Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(email): add a durable outbox independent of the cache (#8386)
Peter Chinman0186cb5c3b8e
diff --git a/.sqlx/query-04f0d00cd4ff8f1e5d191fa136acaae8b3313bd355cb0c924ef6f271070de3e8.json b/.sqlx/query-04f0d00cd4ff8f1e5d191fa136acaae8b3313bd355cb0c924ef6f271070de3e8.jsonnew file mode 100644index 0000000000..f0142956ff--- /dev/null+++ b/.sqlx/query-04f0d00cd4ff8f1e5d191fa136acaae8b3313bd355cb0c924ef6f271070de3e8.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_send_attempts SET cancelled = true\n WHERE message_id = ANY($1) AND link_id = $2\n AND NOT cancelled AND NOT sent AND NOT delivery_unconfirmed",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "UuidArray",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "04f0d00cd4ff8f1e5d191fa136acaae8b3313bd355cb0c924ef6f271070de3e8"+}diff --git a/.sqlx/query-073e75b9bc5c2178a9b1fe2bbb322f168d13953a345d302c8d17f5134386315a.json b/.sqlx/query-073e75b9bc5c2178a9b1fe2bbb322f168d13953a345d302c8d17f5134386315a.jsonnew file mode 100644index 0000000000..cb40741a8d--- /dev/null+++ b/.sqlx/query-073e75b9bc5c2178a9b1fe2bbb322f168d13953a345d302c8d17f5134386315a.json@@ -0,0 +1,18 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_scheduled_messages SET processing = true,\n delivery_status = CASE WHEN $4 THEN 'unconfirmed' ELSE 'failed' END,\n delivery_lease_expires_at = NOW() + make_interval(secs => $5), updated_at = NOW()\n WHERE message_id = $1 AND link_id = $2 AND delivery_claim_id = $3 AND NOT sent",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid",+ "Bool",+ "Float8"+ ]+ },+ "nullable": []+ },+ "hash": "073e75b9bc5c2178a9b1fe2bbb322f168d13953a345d302c8d17f5134386315a"+}diff --git a/.sqlx/query-097ef225d8d24550dfdcae78141f2dd58c53c0fadfa94cc8ded0c1a2a60517de.json b/.sqlx/query-097ef225d8d24550dfdcae78141f2dd58c53c0fadfa94cc8ded0c1a2a60517de.jsonnew file mode 100644index 0000000000..d8813d6eae--- /dev/null+++ b/.sqlx/query-097ef225d8d24550dfdcae78141f2dd58c53c0fadfa94cc8ded0c1a2a60517de.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT NOT EXISTS(SELECT 1 FROM email_messages WHERE thread_id = $1) AS \"empty!\"",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "empty!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "097ef225d8d24550dfdcae78141f2dd58c53c0fadfa94cc8ded0c1a2a60517de"+}diff --git a/.sqlx/query-10f32d13f02fc4bd527573072c84003ac9eebf43eba4a5ed7fe6c2584c5f2fb3.json b/.sqlx/query-10f32d13f02fc4bd527573072c84003ac9eebf43eba4a5ed7fe6c2584c5f2fb3.jsonnew file mode 100644index 0000000000..b3ad81a07c--- /dev/null+++ b/.sqlx/query-10f32d13f02fc4bd527573072c84003ac9eebf43eba4a5ed7fe6c2584c5f2fb3.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT EXISTS(SELECT 1 FROM email_send_attempts WHERE message_id=$1 AND link_id=$2 AND NOT cancelled AND NOT sent) AS \"active!\"",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "active!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "10f32d13f02fc4bd527573072c84003ac9eebf43eba4a5ed7fe6c2584c5f2fb3"+}diff --git a/.sqlx/query-154d913c6186d95bbeab12cc5b57f8e2b3aeef475e0952c07f30eda1ba9be6d7.json b/.sqlx/query-154d913c6186d95bbeab12cc5b57f8e2b3aeef475e0952c07f30eda1ba9be6d7.jsonnew file mode 100644index 0000000000..8494fd2098--- /dev/null+++ b/.sqlx/query-154d913c6186d95bbeab12cc5b57f8e2b3aeef475e0952c07f30eda1ba9be6d7.json@@ -0,0 +1,29 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT local.id AS local_id, provider.id AS provider_id\n FROM email_attachments local JOIN email_attachments provider\n ON provider.provider_attachment_id = local.provider_attachment_id\n WHERE local.message_id = $1 AND provider.message_id = $2",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "local_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false+ ]+ },+ "hash": "154d913c6186d95bbeab12cc5b57f8e2b3aeef475e0952c07f30eda1ba9be6d7"+}diff --git a/.sqlx/query-15ff7c90c0ecc294eee1a3e689f54f324e1373a2112c18008ad85476f51d7720.json b/.sqlx/query-15ff7c90c0ecc294eee1a3e689f54f324e1373a2112c18008ad85476f51d7720.jsonnew file mode 100644index 0000000000..a165078cac--- /dev/null+++ b/.sqlx/query-15ff7c90c0ecc294eee1a3e689f54f324e1373a2112c18008ad85476f51d7720.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT attachment_id AS \"attachment_id!\" FROM email_draft_provider_attachment_ids($1, $2) ORDER BY attachment_id",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "attachment_id!",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "15ff7c90c0ecc294eee1a3e689f54f324e1373a2112c18008ad85476f51d7720"+}diff --git a/.sqlx/query-16975c8ff9585b8da53ace00a26851f992232834de508dac16ff58d9da1cbc2a.json b/.sqlx/query-16975c8ff9585b8da53ace00a26851f992232834de508dac16ff58d9da1cbc2a.jsondeleted file mode 100644index b0e63bec06..0000000000--- a/.sqlx/query-16975c8ff9585b8da53ace00a26851f992232834de508dac16ff58d9da1cbc2a.json+++ /dev/null@@ -1,21 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n INSERT INTO email_attachments_drafts (\n id, draft_id, file_name, content_type, sha, size, s3_key\n )\n -- if the message belongs to a different link_id, nothing will be returned from this\n -- and thus nothing will be inserted\n SELECT $1, $2, $3, $4, $5, $6, $7\n FROM email_messages m\n WHERE m.id = $2 AND m.link_id = $8\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid",- "Uuid",- "Text",- "Text",- "Text",- "Int4",- "Text",- "Uuid"- ]- },- "nullable": []- },- "hash": "16975c8ff9585b8da53ace00a26851f992232834de508dac16ff58d9da1cbc2a"-}diff --git a/.sqlx/query-1949a59fa437563ed9106e70586d9044d222aa619244cf9609aefa4cc6cdd72e.json b/.sqlx/query-1949a59fa437563ed9106e70586d9044d222aa619244cf9609aefa4cc6cdd72e.jsonnew file mode 100644index 0000000000..22a7f5e61b--- /dev/null+++ b/.sqlx/query-1949a59fa437563ed9106e70586d9044d222aa619244cf9609aefa4cc6cdd72e.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_scheduled_messages SET send_time = $1 WHERE message_id = $2 AND link_id = $3",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Timestamptz",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "1949a59fa437563ed9106e70586d9044d222aa619244cf9609aefa4cc6cdd72e"+}diff --git a/.sqlx/query-1963c05b8992487c0ee307f4e8b2abbce4547c4aa88952a1d51ef8a0fab2e038.json b/.sqlx/query-1963c05b8992487c0ee307f4e8b2abbce4547c4aa88952a1d51ef8a0fab2e038.jsonnew file mode 100644index 0000000000..dc599b042b--- /dev/null+++ b/.sqlx/query-1963c05b8992487c0ee307f4e8b2abbce4547c4aa88952a1d51ef8a0fab2e038.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_attachments_sfs SET attachment_id = $1 WHERE attachment_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "1963c05b8992487c0ee307f4e8b2abbce4547c4aa88952a1d51ef8a0fab2e038"+}diff --git a/.sqlx/query-1b09adcc9a9b5331f8574cebb14bcae677938b5a826795cf9b4d5568f045afc0.json b/.sqlx/query-1b09adcc9a9b5331f8574cebb14bcae677938b5a826795cf9b4d5568f045afc0.jsonnew file mode 100644index 0000000000..22044e7b29--- /dev/null+++ b/.sqlx/query-1b09adcc9a9b5331f8574cebb14bcae677938b5a826795cf9b4d5568f045afc0.json@@ -0,0 +1,35 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT COALESCE(c.email_address, l.email_address) AS \"email_address!\", COALESCE(m.from_name, c.name) AS name, c.sfs_photo_url\n FROM email_messages m JOIN email_links l ON l.id = m.link_id\n LEFT JOIN email_contacts c ON c.id = m.from_contact_id\n WHERE m.id = $1 AND m.link_id = $2",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "email_address!",+ "type_info": "Varchar"+ },+ {+ "ordinal": 1,+ "name": "name",+ "type_info": "Varchar"+ },+ {+ "ordinal": 2,+ "name": "sfs_photo_url",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ null,+ null,+ true+ ]+ },+ "hash": "1b09adcc9a9b5331f8574cebb14bcae677938b5a826795cf9b4d5568f045afc0"+}diff --git a/.sqlx/query-20d0011abe45a5cf3abd07007176e2a4036436f9434fbf68fb15f788ba725dcc.json b/.sqlx/query-20d0011abe45a5cf3abd07007176e2a4036436f9434fbf68fb15f788ba725dcc.jsonnew file mode 100644index 0000000000..3e3e1546b9--- /dev/null+++ b/.sqlx/query-20d0011abe45a5cf3abd07007176e2a4036436f9434fbf68fb15f788ba725dcc.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT thread_id FROM email_messages WHERE id = $1 AND link_id = $2",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "thread_id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "20d0011abe45a5cf3abd07007176e2a4036436f9434fbf68fb15f788ba725dcc"+}diff --git a/.sqlx/query-2193daf8a46252c23d86e0fc634c56e61ae0e848fe0e7a1534bd2f032075b24d.json b/.sqlx/query-2193daf8a46252c23d86e0fc634c56e61ae0e848fe0e7a1534bd2f032075b24d.jsonnew file mode 100644index 0000000000..8e936ff67b--- /dev/null+++ b/.sqlx/query-2193daf8a46252c23d86e0fc634c56e61ae0e848fe0e7a1534bd2f032075b24d.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT EXISTS(SELECT 1 FROM email_deferred_message_deletions WHERE message_id=$1) AS \"deferred!\"",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "deferred!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "2193daf8a46252c23d86e0fc634c56e61ae0e848fe0e7a1534bd2f032075b24d"+}diff --git a/.sqlx/query-2386c156456dbaea33ec5071907677174bdfc3048719f1be818c11b6dd7ada01.json b/.sqlx/query-2386c156456dbaea33ec5071907677174bdfc3048719f1be818c11b6dd7ada01.jsondeleted file mode 100644index 5c0001485c..0000000000--- a/.sqlx/query-2386c156456dbaea33ec5071907677174bdfc3048719f1be818c11b6dd7ada01.json+++ /dev/null@@ -1,26 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n esm.link_id, esm.message_id\n FROM email_scheduled_messages esm\n JOIN email_messages em ON em.id = esm.message_id\n WHERE\n esm.send_time < now()\n AND esm.sent = FALSE\n AND em.is_draft = TRUE\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "link_id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "message_id",- "type_info": "Uuid"- }- ],- "parameters": {- "Left": []- },- "nullable": [- false,- false- ]- },- "hash": "2386c156456dbaea33ec5071907677174bdfc3048719f1be818c11b6dd7ada01"-}diff --git a/.sqlx/query-24c770aeb77c07c117b69ad4e88d566230ee40b4408761bbd2323280609e14af.json b/.sqlx/query-24c770aeb77c07c117b69ad4e88d566230ee40b4408761bbd2323280609e14af.jsonnew file mode 100644index 0000000000..6377f9bab1--- /dev/null+++ b/.sqlx/query-24c770aeb77c07c117b69ad4e88d566230ee40b4408761bbd2323280609e14af.json@@ -0,0 +1,52 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT message_id, send_time, delivery_status, processing,\n delivery_claim_id, delivery_started_at\n FROM email_scheduled_messages\n WHERE message_id = ANY($1) AND sent = false\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "message_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "send_time",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 2,+ "name": "delivery_status",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "processing",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "delivery_claim_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 5,+ "name": "delivery_started_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ true,+ true+ ]+ },+ "hash": "24c770aeb77c07c117b69ad4e88d566230ee40b4408761bbd2323280609e14af"+}diff --git a/.sqlx/query-27a5b60a8230345a84888832841ad7adbcc081e0dcd2b2c5f10cde931323cbc0.json b/.sqlx/query-27a5b60a8230345a84888832841ad7adbcc081e0dcd2b2c5f10cde931323cbc0.jsonnew file mode 100644index 0000000000..a62fa4bdda--- /dev/null+++ b/.sqlx/query-27a5b60a8230345a84888832841ad7adbcc081e0dcd2b2c5f10cde931323cbc0.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_messages SET replying_to_id = $1 WHERE replying_to_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "27a5b60a8230345a84888832841ad7adbcc081e0dcd2b2c5f10cde931323cbc0"+}diff --git a/.sqlx/query-28142485794f0a5e1f9cbabc1bd8b686ae09a769a09e2c0e02624dcd799c0d7b.json b/.sqlx/query-28142485794f0a5e1f9cbabc1bd8b686ae09a769a09e2c0e02624dcd799c0d7b.jsonnew file mode 100644index 0000000000..2b38d54811--- /dev/null+++ b/.sqlx/query-28142485794f0a5e1f9cbabc1bd8b686ae09a769a09e2c0e02624dcd799c0d7b.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO email_message_labels (message_id, label_id)\n SELECT $1, label_id FROM email_message_labels WHERE message_id = $2\n ON CONFLICT DO NOTHING",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "28142485794f0a5e1f9cbabc1bd8b686ae09a769a09e2c0e02624dcd799c0d7b"+}diff --git a/.sqlx/query-040bea8d37690c439ebde8e7695b91442d48ab21bdc26a103a1866dbc156cccb.json b/.sqlx/query-2837b4bd138a698a0e4851a9d194a7458646eb69efc2a0b5d97e89fcefe07bef.jsonsimilarity index 57%rename from .sqlx/query-040bea8d37690c439ebde8e7695b91442d48ab21bdc26a103a1866dbc156cccb.jsonrename to .sqlx/query-2837b4bd138a698a0e4851a9d194a7458646eb69efc2a0b5d97e89fcefe07bef.jsonindex 02e620fa1b..c047154734 100644--- a/.sqlx/query-040bea8d37690c439ebde8e7695b91442d48ab21bdc26a103a1866dbc156cccb.json+++ b/.sqlx/query-2837b4bd138a698a0e4851a9d194a7458646eb69efc2a0b5d97e89fcefe07bef.json@@ -1,16 +1,16 @@{"db_name": "PostgreSQL",- "query": "SELECT sent, processing FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2 FOR UPDATE",+ "query": "SELECT is_draft, is_sent FROM email_messages WHERE id = $1 AND link_id = $2 FOR UPDATE","describe": {"columns": [{"ordinal": 0,- "name": "sent",+ "name": "is_draft","type_info": "Bool"},{"ordinal": 1,- "name": "processing",+ "name": "is_sent","type_info": "Bool"}],@@ -25,5 +25,5 @@false]},- "hash": "040bea8d37690c439ebde8e7695b91442d48ab21bdc26a103a1866dbc156cccb"+ "hash": "2837b4bd138a698a0e4851a9d194a7458646eb69efc2a0b5d97e89fcefe07bef"}diff --git a/.sqlx/query-29496c090bdffe2b771ad704687525136fcd17a1d3e680142e5d0f9e253af578.json b/.sqlx/query-29496c090bdffe2b771ad704687525136fcd17a1d3e680142e5d0f9e253af578.jsondeleted file mode 100644index 918f0d6d3d..0000000000--- a/.sqlx/query-29496c090bdffe2b771ad704687525136fcd17a1d3e680142e5d0f9e253af578.json+++ /dev/null@@ -1,28 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT message_id, send_time\n FROM email_scheduled_messages\n WHERE message_id = ANY($1) AND sent = false\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "message_id",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "send_time",- "type_info": "Timestamptz"- }- ],- "parameters": {- "Left": [- "UuidArray"- ]- },- "nullable": [- false,- false- ]- },- "hash": "29496c090bdffe2b771ad704687525136fcd17a1d3e680142e5d0f9e253af578"-}diff --git a/.sqlx/query-2aef608f96d04dcdd19f9dc6da22859d090fbecc89074f21a1cbae172efd2e24.json b/.sqlx/query-2aef608f96d04dcdd19f9dc6da22859d090fbecc89074f21a1cbae172efd2e24.jsonnew file mode 100644index 0000000000..9a23bd2234--- /dev/null+++ b/.sqlx/query-2aef608f96d04dcdd19f9dc6da22859d090fbecc89074f21a1cbae172efd2e24.json@@ -0,0 +1,120 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT a.request, a.created_at, a.link_id, a.attempt_id, a.message_id, a.thread_id, a.send_time, a.cancelled,\n (a.sent OR COALESCE(m.is_sent, false)) AS \"sent!\",\n COALESCE(s.processing, false) AS \"processing!\",\n s.delivery_status AS \"delivery_status?\", s.delivery_started_at,\n s.delivery_claim_id,\n a.delivery_unconfirmed, d.state AS \"mailbox_state?\",\n d.error_code, d.checkpoint->>'stage' AS mailbox_stage\n FROM email_send_attempts a\n LEFT JOIN email_messages m ON m.id = a.message_id AND m.link_id = a.link_id\n LEFT JOIN email_scheduled_messages s ON s.message_id = a.message_id AND s.link_id = a.link_id\n LEFT JOIN email_mailbox_drafts d ON d.message_id = a.message_id AND d.link_id = a.link_id\n WHERE a.user_id = $1 AND a.link_id = $2 AND a.attempt_id = $3",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "request",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 1,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 2,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 3,+ "name": "attempt_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 4,+ "name": "message_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 5,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 6,+ "name": "send_time",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "cancelled",+ "type_info": "Bool"+ },+ {+ "ordinal": 8,+ "name": "sent!",+ "type_info": "Bool"+ },+ {+ "ordinal": 9,+ "name": "processing!",+ "type_info": "Bool"+ },+ {+ "ordinal": 10,+ "name": "delivery_status?",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "delivery_started_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 12,+ "name": "delivery_claim_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 13,+ "name": "delivery_unconfirmed",+ "type_info": "Bool"+ },+ {+ "ordinal": 14,+ "name": "mailbox_state?",+ "type_info": "Text"+ },+ {+ "ordinal": 15,+ "name": "error_code",+ "type_info": "Text"+ },+ {+ "ordinal": 16,+ "name": "mailbox_stage",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ true,+ false,+ false,+ false,+ true,+ true,+ true,+ false,+ null,+ null,+ false,+ true,+ true,+ false,+ false,+ true,+ null+ ]+ },+ "hash": "2aef608f96d04dcdd19f9dc6da22859d090fbecc89074f21a1cbae172efd2e24"+}diff --git a/.sqlx/query-2e6421b05905fb0fe749479f3244ff96b39d0beb745a7c56449ec75a2e4a27ed.json b/.sqlx/query-2e6421b05905fb0fe749479f3244ff96b39d0beb745a7c56449ec75a2e4a27ed.jsonnew file mode 100644index 0000000000..5df03f2cc0--- /dev/null+++ b/.sqlx/query-2e6421b05905fb0fe749479f3244ff96b39d0beb745a7c56449ec75a2e4a27ed.json@@ -0,0 +1,24 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT provider.id FROM email_messages provider\n JOIN email_messages local ON local.id = $3 AND local.link_id = $1\n WHERE provider.link_id = $1 AND provider.provider_id = $2 AND provider.id <> $3\n FOR UPDATE OF provider",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Text",+ "Uuid"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "2e6421b05905fb0fe749479f3244ff96b39d0beb745a7c56449ec75a2e4a27ed"+}diff --git a/.sqlx/query-30c603a1a2cf800cfe56a426f6489356d17d82b29a3d367eff91cd33f70a306c.json b/.sqlx/query-30c603a1a2cf800cfe56a426f6489356d17d82b29a3d367eff91cd33f70a306c.jsonnew file mode 100644index 0000000000..785fcfc5b4--- /dev/null+++ b/.sqlx/query-30c603a1a2cf800cfe56a426f6489356d17d82b29a3d367eff91cd33f70a306c.json@@ -0,0 +1,34 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO email_messages (\n id, provider_id, link_id, thread_id, provider_thread_id,\n replying_to_id, subject, from_contact_id, sent_at,\n has_attachments, is_read, is_starred, is_sent, is_draft,\n body_text, body_html_sanitized, body_macro, headers_jsonb,\n created_at, updated_at, draft_generation\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21)\n ON CONFLICT (id) DO UPDATE SET\n provider_id = COALESCE(email_messages.provider_id, EXCLUDED.provider_id),\n thread_id = EXCLUDED.thread_id,\n provider_thread_id = COALESCE(email_messages.provider_thread_id, EXCLUDED.provider_thread_id),\n replying_to_id = EXCLUDED.replying_to_id,\n subject = EXCLUDED.subject,\n from_contact_id = EXCLUDED.from_contact_id,\n sent_at = EXCLUDED.sent_at,\n is_read = EXCLUDED.is_read,\n is_starred = EXCLUDED.is_starred,\n is_sent = EXCLUDED.is_sent,\n is_draft = EXCLUDED.is_draft,\n body_text = EXCLUDED.body_text,\n body_html_sanitized = EXCLUDED.body_html_sanitized,\n body_macro = EXCLUDED.body_macro,\n headers_jsonb = EXCLUDED.headers_jsonb,\n updated_at = NOW()\n WHERE email_messages.link_id = EXCLUDED.link_id\n AND email_messages.draft_generation = $21\n AND email_messages.is_draft AND NOT email_messages.is_sent\n AND NOT EXISTS (SELECT 1 FROM email_mailbox_drafts d WHERE d.message_id = EXCLUDED.id AND d.delete_requested)\n AND NOT EXISTS (SELECT 1 FROM email_scheduled_messages WHERE message_id = EXCLUDED.id AND link_id = EXCLUDED.link_id)\n AND NOT EXISTS (SELECT 1 FROM email_send_attempts WHERE message_id = EXCLUDED.id AND link_id = EXCLUDED.link_id AND NOT cancelled AND NOT sent)\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Text",+ "Uuid",+ "Uuid",+ "Text",+ "Uuid",+ "Text",+ "Uuid",+ "Timestamptz",+ "Bool",+ "Bool",+ "Bool",+ "Bool",+ "Bool",+ "Text",+ "Text",+ "Text",+ "Jsonb",+ "Timestamptz",+ "Timestamptz",+ "Int4"+ ]+ },+ "nullable": []+ },+ "hash": "30c603a1a2cf800cfe56a426f6489356d17d82b29a3d367eff91cd33f70a306c"+}diff --git a/.sqlx/query-3b25b8737c0ee22878c9db73183214b244a76d66340b563bc718ed396abfcdda.json b/.sqlx/query-3b25b8737c0ee22878c9db73183214b244a76d66340b563bc718ed396abfcdda.jsonnew file mode 100644index 0000000000..a7f5123a74--- /dev/null+++ b/.sqlx/query-3b25b8737c0ee22878c9db73183214b244a76d66340b563bc718ed396abfcdda.json@@ -0,0 +1,122 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT a.request, a.created_at, a.link_id, a.attempt_id, a.message_id, a.thread_id, a.send_time, a.cancelled,\n (a.sent OR COALESCE(m.is_sent, false)) AS \"sent!\",\n COALESCE(s.processing, false) AS \"processing!\",\n s.delivery_status AS \"delivery_status?\", s.delivery_started_at,\n s.delivery_claim_id,\n a.delivery_unconfirmed, d.state AS \"mailbox_state?\",\n d.error_code, d.checkpoint->>'stage' AS mailbox_stage\n FROM email_send_attempts a\n LEFT JOIN email_messages m ON m.id = a.message_id AND m.link_id = a.link_id\n LEFT JOIN email_scheduled_messages s ON s.message_id = a.message_id AND s.link_id = a.link_id\n LEFT JOIN email_mailbox_drafts d ON d.message_id = a.message_id AND d.link_id = a.link_id\n WHERE a.user_id = $1 AND a.link_id = ANY($2) AND NOT a.cancelled AND NOT a.sent\n AND ($3::timestamptz IS NULL OR (a.created_at, a.link_id, a.attempt_id) < ($3, $4, $5))\n ORDER BY a.created_at DESC, a.link_id DESC, a.attempt_id DESC LIMIT 51",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "request",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 1,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 2,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 3,+ "name": "attempt_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 4,+ "name": "message_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 5,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 6,+ "name": "send_time",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "cancelled",+ "type_info": "Bool"+ },+ {+ "ordinal": 8,+ "name": "sent!",+ "type_info": "Bool"+ },+ {+ "ordinal": 9,+ "name": "processing!",+ "type_info": "Bool"+ },+ {+ "ordinal": 10,+ "name": "delivery_status?",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "delivery_started_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 12,+ "name": "delivery_claim_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 13,+ "name": "delivery_unconfirmed",+ "type_info": "Bool"+ },+ {+ "ordinal": 14,+ "name": "mailbox_state?",+ "type_info": "Text"+ },+ {+ "ordinal": 15,+ "name": "error_code",+ "type_info": "Text"+ },+ {+ "ordinal": 16,+ "name": "mailbox_stage",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "UuidArray",+ "Timestamptz",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ true,+ false,+ false,+ false,+ true,+ true,+ true,+ false,+ null,+ null,+ false,+ true,+ true,+ false,+ false,+ true,+ null+ ]+ },+ "hash": "3b25b8737c0ee22878c9db73183214b244a76d66340b563bc718ed396abfcdda"+}diff --git a/.sqlx/query-3b7b251ab2a7eaef184c9a8dee3c75a2136fafec1c9438715dfef58a3e62f00e.json b/.sqlx/query-3b7b251ab2a7eaef184c9a8dee3c75a2136fafec1c9438715dfef58a3e62f00e.jsonnew file mode 100644index 0000000000..1aeb5ad00d--- /dev/null+++ b/.sqlx/query-3b7b251ab2a7eaef184c9a8dee3c75a2136fafec1c9438715dfef58a3e62f00e.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_send_attempts a SET cancelled=true\n WHERE a.message_id=$1 AND a.link_id=$2\n AND NOT a.cancelled AND NOT a.sent AND NOT a.delivery_unconfirmed\n AND EXISTS(SELECT 1 FROM email_links WHERE id=$2 AND provider='GMAIL')\n AND NOT EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id=$1 AND link_id=$2)",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "3b7b251ab2a7eaef184c9a8dee3c75a2136fafec1c9438715dfef58a3e62f00e"+}diff --git a/.sqlx/query-3cf9a36c27710c210368b2aa53da91fd26985e737ce1929fa61b8fd2e06ea387.json b/.sqlx/query-3cf9a36c27710c210368b2aa53da91fd26985e737ce1929fa61b8fd2e06ea387.jsonnew file mode 100644index 0000000000..ebde16e09e--- /dev/null+++ b/.sqlx/query-3cf9a36c27710c210368b2aa53da91fd26985e737ce1929fa61b8fd2e06ea387.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO email_message_recipients (message_id, contact_id, recipient_type, name)\n SELECT $1, contact_id, recipient_type, name\n FROM email_message_recipients WHERE message_id = $2\n ON CONFLICT (message_id, contact_id, recipient_type) DO UPDATE\n SET name = COALESCE(EXCLUDED.name, email_message_recipients.name)",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "3cf9a36c27710c210368b2aa53da91fd26985e737ce1929fa61b8fd2e06ea387"+}diff --git a/.sqlx/query-4530d8ed9ea92fc9447a74e038f9a1b12136f85c6776de4720d96de736687602.json b/.sqlx/query-4530d8ed9ea92fc9447a74e038f9a1b12136f85c6776de4720d96de736687602.jsonnew file mode 100644index 0000000000..a189792287--- /dev/null+++ b/.sqlx/query-4530d8ed9ea92fc9447a74e038f9a1b12136f85c6776de4720d96de736687602.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_messages local SET\n global_id = provider.global_id,\n provider_history_id = provider.provider_history_id,\n internal_date_ts = COALESCE(provider.internal_date_ts, local.internal_date_ts),\n snippet = provider.snippet, size_estimate = provider.size_estimate,\n sent_at = COALESCE(provider.sent_at, local.sent_at),\n has_attachments = local.has_attachments OR provider.has_attachments,\n is_read = provider.is_read, is_starred = local.is_starred OR provider.is_starred,\n headers_jsonb = provider.headers_jsonb\n FROM email_messages provider\n WHERE local.id = $1 AND local.link_id = $3 AND provider.id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "4530d8ed9ea92fc9447a74e038f9a1b12136f85c6776de4720d96de736687602"+}diff --git a/.sqlx/query-469f1de62c1329571c04fa759ec91796c96fce5c9e9fb3e3e828871c14780e5d.json b/.sqlx/query-469f1de62c1329571c04fa759ec91796c96fce5c9e9fb3e3e828871c14780e5d.jsonnew file mode 100644index 0000000000..87fa749c8b--- /dev/null+++ b/.sqlx/query-469f1de62c1329571c04fa759ec91796c96fce5c9e9fb3e3e828871c14780e5d.json@@ -0,0 +1,34 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT id, draft_generation, EXISTS(SELECT 1 FROM email_send_attempts WHERE message_id=$1 AND NOT cancelled AND NOT sent) AS \"send_active!\" FROM email_messages WHERE id = $1 FOR UPDATE",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "draft_generation",+ "type_info": "Int4"+ },+ {+ "ordinal": 2,+ "name": "send_active!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ null+ ]+ },+ "hash": "469f1de62c1329571c04fa759ec91796c96fce5c9e9fb3e3e828871c14780e5d"+}diff --git a/.sqlx/query-473db34286d4aeefece0b6a97cea69cad83d20908c700d750a4047ce5bee30f4.json b/.sqlx/query-473db34286d4aeefece0b6a97cea69cad83d20908c700d750a4047ce5bee30f4.jsondeleted file mode 100644index f182e4bc32..0000000000--- a/.sqlx/query-473db34286d4aeefece0b6a97cea69cad83d20908c700d750a4047ce5bee30f4.json+++ /dev/null@@ -1,16 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n DELETE FROM email_attachments_drafts ead\n USING email_messages m\n WHERE ead.draft_id = m.id\n AND ead.id = $1 AND ead.draft_id = $2 AND m.link_id = $3\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid",- "Uuid",- "Uuid"- ]- },- "nullable": []- },- "hash": "473db34286d4aeefece0b6a97cea69cad83d20908c700d750a4047ce5bee30f4"-}diff --git a/.sqlx/query-48596f1b1bb856fb4287d0991652658f8f741cdb16c55708a03fdb7f1db51374.json b/.sqlx/query-48596f1b1bb856fb4287d0991652658f8f741cdb16c55708a03fdb7f1db51374.jsonnew file mode 100644index 0000000000..a7ff0e6a74--- /dev/null+++ b/.sqlx/query-48596f1b1bb856fb4287d0991652658f8f741cdb16c55708a03fdb7f1db51374.json@@ -0,0 +1,17 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_scheduled_messages SET delivery_started_at = NOW(),\n delivery_lease_expires_at = NOW() + make_interval(secs => $4), updated_at = NOW()\n WHERE message_id = $1 AND link_id = $2 AND delivery_claim_id = $3\n AND processing AND NOT sent AND delivery_status = 'ready'\n AND delivery_started_at IS NULL AND delivery_lease_expires_at > NOW()",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid",+ "Float8"+ ]+ },+ "nullable": []+ },+ "hash": "48596f1b1bb856fb4287d0991652658f8f741cdb16c55708a03fdb7f1db51374"+}diff --git a/.sqlx/query-4b0c1988db98a33fdd702d5d165429062539515092f1ee48b49d952a26ad0edf.json b/.sqlx/query-4b0c1988db98a33fdd702d5d165429062539515092f1ee48b49d952a26ad0edf.jsonnew file mode 100644index 0000000000..f93c918357--- /dev/null+++ b/.sqlx/query-4b0c1988db98a33fdd702d5d165429062539515092f1ee48b49d952a26ad0edf.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO email_attachments_fwd (message_id, attachment_id, created_at)\n SELECT message_id, $1, created_at FROM email_attachments_fwd WHERE attachment_id = $2\n ON CONFLICT DO NOTHING",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "4b0c1988db98a33fdd702d5d165429062539515092f1ee48b49d952a26ad0edf"+}diff --git a/.sqlx/query-70e2086750c756b918425cc00b930fda9389a182e38b0da0cffa756deecd7e95.json b/.sqlx/query-51e49f0039fa11c253768845ca181353d486f0e15b1cbf255d9348506caf2af2.jsonsimilarity index 68%rename from .sqlx/query-70e2086750c756b918425cc00b930fda9389a182e38b0da0cffa756deecd7e95.jsonrename to .sqlx/query-51e49f0039fa11c253768845ca181353d486f0e15b1cbf255d9348506caf2af2.jsonindex f674ec478c..545c1b7b02 100644--- a/.sqlx/query-70e2086750c756b918425cc00b930fda9389a182e38b0da0cffa756deecd7e95.json+++ b/.sqlx/query-51e49f0039fa11c253768845ca181353d486f0e15b1cbf255d9348506caf2af2.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "SELECT EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2) AS \"exists!\"",+ "query": "SELECT EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id = $1) AS \"exists!\"","describe": {"columns": [{@@ -11,7 +11,6 @@],"parameters": {"Left": [- "Uuid","Uuid"]},@@ -19,5 +18,5 @@null]},- "hash": "70e2086750c756b918425cc00b930fda9389a182e38b0da0cffa756deecd7e95"+ "hash": "51e49f0039fa11c253768845ca181353d486f0e15b1cbf255d9348506caf2af2"}diff --git a/.sqlx/query-54c5443635a7eea27ab488bc352a3dd6e32cfc4d44e2f24c71361df59e0df9e4.json b/.sqlx/query-54c5443635a7eea27ab488bc352a3dd6e32cfc4d44e2f24c71361df59e0df9e4.jsonnew file mode 100644index 0000000000..4031bb2cd3--- /dev/null+++ b/.sqlx/query-54c5443635a7eea27ab488bc352a3dd6e32cfc4d44e2f24c71361df59e0df9e4.json@@ -0,0 +1,24 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT EXISTS(SELECT 1 FROM email_send_attempts WHERE (link_id=$1 OR $1=ANY(draft_link_ids))\n AND ($2=ANY(draft_handles) OR $3=ANY(draft_handles))) AS \"retired!\"",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "retired!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "54c5443635a7eea27ab488bc352a3dd6e32cfc4d44e2f24c71361df59e0df9e4"+}diff --git a/.sqlx/query-550d45c65dc3cbf8e9aa708213d6c9d098f1486a65f8ffb7542eb3d8296e6121.json b/.sqlx/query-550d45c65dc3cbf8e9aa708213d6c9d098f1486a65f8ffb7542eb3d8296e6121.jsonnew file mode 100644index 0000000000..a6f28083dd--- /dev/null+++ b/.sqlx/query-550d45c65dc3cbf8e9aa708213d6c9d098f1486a65f8ffb7542eb3d8296e6121.json@@ -0,0 +1,14 @@+{+ "db_name": "PostgreSQL",+ "query": "DELETE FROM email_attachments WHERE id = $1",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "550d45c65dc3cbf8e9aa708213d6c9d098f1486a65f8ffb7542eb3d8296e6121"+}diff --git a/.sqlx/query-55e3bcf2b676a70538617b46f22f8236d4f2856f41cb2997e3e7397de3c8e542.json b/.sqlx/query-55e3bcf2b676a70538617b46f22f8236d4f2856f41cb2997e3e7397de3c8e542.jsonnew file mode 100644index 0000000000..38cf96148f--- /dev/null+++ b/.sqlx/query-55e3bcf2b676a70538617b46f22f8236d4f2856f41cb2997e3e7397de3c8e542.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "DELETE FROM email_attachments_drafts WHERE id=$1 AND draft_id=$2 AND EXISTS(SELECT 1 FROM email_messages WHERE id=$2 AND link_id=$3)",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "55e3bcf2b676a70538617b46f22f8236d4f2856f41cb2997e3e7397de3c8e542"+}diff --git a/.sqlx/query-5606c021006e80ba6a786c1c415b45f23b849bf579aae21e434a334fa3a7b1ca.json b/.sqlx/query-5606c021006e80ba6a786c1c415b45f23b849bf579aae21e434a334fa3a7b1ca.jsonnew file mode 100644index 0000000000..a511f92647--- /dev/null+++ b/.sqlx/query-5606c021006e80ba6a786c1c415b45f23b849bf579aae21e434a334fa3a7b1ca.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_scheduled_messages SET sent = true, processing = false,\n delivery_status = 'ready', delivery_lease_expires_at = NULL, updated_at = NOW()\n WHERE message_id = $1 AND link_id = $2 AND delivery_claim_id = $3\n AND processing AND NOT sent AND delivery_started_at IS NOT NULL",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "5606c021006e80ba6a786c1c415b45f23b849bf579aae21e434a334fa3a7b1ca"+}diff --git a/.sqlx/query-0b0ee8515cb079ef1cedbb5d8f254fef2bdc00de80faccc661bc89ffbabc7eb4.json b/.sqlx/query-5cd7b850374d638d7add9eaf4cd51d409b854b4134ee752dcf9cfba333e5b1f9.jsonsimilarity index 77%rename from .sqlx/query-0b0ee8515cb079ef1cedbb5d8f254fef2bdc00de80faccc661bc89ffbabc7eb4.jsonrename to .sqlx/query-5cd7b850374d638d7add9eaf4cd51d409b854b4134ee752dcf9cfba333e5b1f9.jsonindex 05db2fa7d3..4349b9b471 100644--- a/.sqlx/query-0b0ee8515cb079ef1cedbb5d8f254fef2bdc00de80faccc661bc89ffbabc7eb4.json+++ b/.sqlx/query-5cd7b850374d638d7add9eaf4cd51d409b854b4134ee752dcf9cfba333e5b1f9.json@@ -1,135 +1,140 @@{"db_name": "PostgreSQL",- "query": "\n SELECT\n m.id, m.provider_id, m.global_id, m.link_id, m.thread_id, m.provider_thread_id, m.provider_history_id,\n m.replying_to_id, m.internal_date_ts, m.snippet, m.size_estimate, m.subject, m.from_name,\n m.from_contact_id, m.sent_at, m.has_attachments, m.is_read, m.is_starred, m.is_sent, m.is_draft,\n m.body_text as body_text,\n m.body_html_sanitized as body_html_sanitized,\n NULL::TEXT as body_macro,\n m.headers_jsonb, m.created_at, m.updated_at\n FROM email_messages m\n JOIN email_links l ON m.link_id = l.id\n WHERE m.id = ANY($1)\n ",+ "query": "\n SELECT\n m.draft_generation, m.id, m.provider_id, m.global_id, m.link_id, m.thread_id, m.provider_thread_id, m.provider_history_id,\n m.replying_to_id, m.internal_date_ts, m.snippet, m.size_estimate, m.subject, m.from_name,\n m.from_contact_id, m.sent_at, m.has_attachments, m.is_read, m.is_starred, m.is_sent, m.is_draft,\n m.body_text as body_text,\n m.body_html_sanitized as body_html_sanitized,\n NULL::TEXT as body_macro,\n m.headers_jsonb, m.created_at, m.updated_at\n FROM email_messages m\n JOIN email_links l ON m.link_id = l.id\n WHERE m.id = ANY($1)\n ","describe": {"columns": [{"ordinal": 0,+ "name": "draft_generation",+ "type_info": "Int4"+ },+ {+ "ordinal": 1,"name": "id","type_info": "Uuid"},{- "ordinal": 1,+ "ordinal": 2,"name": "provider_id","type_info": "Text"},{- "ordinal": 2,+ "ordinal": 3,"name": "global_id","type_info": "Text"},{- "ordinal": 3,+ "ordinal": 4,"name": "link_id","type_info": "Uuid"},{- "ordinal": 4,+ "ordinal": 5,"name": "thread_id","type_info": "Uuid"},{- "ordinal": 5,+ "ordinal": 6,"name": "provider_thread_id","type_info": "Text"},{- "ordinal": 6,+ "ordinal": 7,"name": "provider_history_id","type_info": "Text"},{- "ordinal": 7,+ "ordinal": 8,"name": "replying_to_id","type_info": "Uuid"},{- "ordinal": 8,+ "ordinal": 9,"name": "internal_date_ts","type_info": "Timestamptz"},{- "ordinal": 9,+ "ordinal": 10,"name": "snippet","type_info": "Text"},{- "ordinal": 10,+ "ordinal": 11,"name": "size_estimate","type_info": "Int8"},{- "ordinal": 11,+ "ordinal": 12,"name": "subject","type_info": "Text"},{- "ordinal": 12,+ "ordinal": 13,"name": "from_name","type_info": "Varchar"},{- "ordinal": 13,+ "ordinal": 14,"name": "from_contact_id","type_info": "Uuid"},{- "ordinal": 14,+ "ordinal": 15,"name": "sent_at","type_info": "Timestamptz"},{- "ordinal": 15,+ "ordinal": 16,"name": "has_attachments","type_info": "Bool"},{- "ordinal": 16,+ "ordinal": 17,"name": "is_read","type_info": "Bool"},{- "ordinal": 17,+ "ordinal": 18,"name": "is_starred","type_info": "Bool"},{- "ordinal": 18,+ "ordinal": 19,"name": "is_sent","type_info": "Bool"},{- "ordinal": 19,+ "ordinal": 20,"name": "is_draft","type_info": "Bool"},{- "ordinal": 20,+ "ordinal": 21,"name": "body_text","type_info": "Text"},{- "ordinal": 21,+ "ordinal": 22,"name": "body_html_sanitized","type_info": "Text"},{- "ordinal": 22,+ "ordinal": 23,"name": "body_macro","type_info": "Text"},{- "ordinal": 23,+ "ordinal": 24,"name": "headers_jsonb","type_info": "Jsonb"},{- "ordinal": 24,+ "ordinal": 25,"name": "created_at","type_info": "Timestamptz"},{- "ordinal": 25,+ "ordinal": 26,"name": "updated_at","type_info": "Timestamptz"}@@ -140,6 +145,7 @@]},"nullable": [+ false,false,true,true,@@ -168,5 +174,5 @@false]},- "hash": "0b0ee8515cb079ef1cedbb5d8f254fef2bdc00de80faccc661bc89ffbabc7eb4"+ "hash": "5cd7b850374d638d7add9eaf4cd51d409b854b4134ee752dcf9cfba333e5b1f9"}diff --git a/.sqlx/query-5ebe5411562b9d4546a7969f4858a1469d0e25e2e314554c8815fb9bd3dfdadc.json b/.sqlx/query-5ebe5411562b9d4546a7969f4858a1469d0e25e2e314554c8815fb9bd3dfdadc.jsonnew file mode 100644index 0000000000..cd05dfd901--- /dev/null+++ b/.sqlx/query-5ebe5411562b9d4546a7969f4858a1469d0e25e2e314554c8815fb9bd3dfdadc.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO crm_cleanup_candidates (link_id, contact_email)\n SELECT DISTINCT $2::uuid, lower(trim(c.email_address))\n FROM email_message_recipients r JOIN email_contacts c ON c.id = r.contact_id\n WHERE r.message_id=$1 AND c.email_address IS NOT NULL AND trim(c.email_address) <> ''\n ON CONFLICT (link_id, contact_email) DO UPDATE SET created_at=NOW()",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "5ebe5411562b9d4546a7969f4858a1469d0e25e2e314554c8815fb9bd3dfdadc"+}diff --git a/.sqlx/query-62bd73e9ee38003a2e6b84489f251da9da64285ee3e2657575bd3634c164ab14.json b/.sqlx/query-62bd73e9ee38003a2e6b84489f251da9da64285ee3e2657575bd3634c164ab14.jsonnew file mode 100644index 0000000000..aa4fe35e36--- /dev/null+++ b/.sqlx/query-62bd73e9ee38003a2e6b84489f251da9da64285ee3e2657575bd3634c164ab14.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT EXISTS(SELECT 1 FROM email_send_attempts WHERE message_id=$1 AND link_id=$2 AND NOT cancelled AND NOT sent) AS \"protected!\"",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "protected!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "62bd73e9ee38003a2e6b84489f251da9da64285ee3e2657575bd3634c164ab14"+}diff --git a/.sqlx/query-6573c5e62f650b04d3b574f002c7f57028e583de4d1f140b3748162423de5fad.json b/.sqlx/query-6573c5e62f650b04d3b574f002c7f57028e583de4d1f140b3748162423de5fad.jsonnew file mode 100644index 0000000000..cf49f96fa3--- /dev/null+++ b/.sqlx/query-6573c5e62f650b04d3b574f002c7f57028e583de4d1f140b3748162423de5fad.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT (EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2) OR EXISTS(SELECT 1 FROM email_send_attempts WHERE message_id = $1 AND link_id = $2 AND NOT cancelled AND NOT sent)) AS \"exists!\"",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "exists!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "6573c5e62f650b04d3b574f002c7f57028e583de4d1f140b3748162423de5fad"+}diff --git a/.sqlx/query-661a28768082c545f48087f2c0195509117b69c487f94900f6f9a1cabfc504c9.json b/.sqlx/query-661a28768082c545f48087f2c0195509117b69c487f94900f6f9a1cabfc504c9.jsonnew file mode 100644index 0000000000..be8dea36a3--- /dev/null+++ b/.sqlx/query-661a28768082c545f48087f2c0195509117b69c487f94900f6f9a1cabfc504c9.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_messages SET link_id = $1, thread_id = $2,\n provider_id = NULL, provider_thread_id = NULL, provider_history_id = NULL,\n global_id = NULL, updated_at = NOW() WHERE id = $3",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "661a28768082c545f48087f2c0195509117b69c487f94900f6f9a1cabfc504c9"+}diff --git a/.sqlx/query-6efb5723cc37cdfe42ddbf50a2369f5d59151c150454b3a859a2238f9e531d02.json b/.sqlx/query-6efb5723cc37cdfe42ddbf50a2369f5d59151c150454b3a859a2238f9e531d02.jsonnew file mode 100644index 0000000000..2d256bc291--- /dev/null+++ b/.sqlx/query-6efb5723cc37cdfe42ddbf50a2369f5d59151c150454b3a859a2238f9e531d02.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT id FROM email_messages\n WHERE id = ANY($1) AND link_id = $2 AND is_draft AND NOT is_sent\n ORDER BY id FOR UPDATE\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray",+ "Uuid"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "6efb5723cc37cdfe42ddbf50a2369f5d59151c150454b3a859a2238f9e531d02"+}diff --git a/.sqlx/query-6f2af6cdd54a420ea80c8e754e0b6bf6252041fc6e6cd10200ccb6103f4137e5.json b/.sqlx/query-6f2af6cdd54a420ea80c8e754e0b6bf6252041fc6e6cd10200ccb6103f4137e5.jsonnew file mode 100644index 0000000000..7df896903e--- /dev/null+++ b/.sqlx/query-6f2af6cdd54a420ea80c8e754e0b6bf6252041fc6e6cd10200ccb6103f4137e5.json@@ -0,0 +1,28 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT provider_id, draft_generation FROM email_deferred_message_deletions WHERE message_id=$1",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "draft_generation",+ "type_info": "Int4"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ true,+ false+ ]+ },+ "hash": "6f2af6cdd54a420ea80c8e754e0b6bf6252041fc6e6cd10200ccb6103f4137e5"+}diff --git a/.sqlx/query-aaca1db3775d2031002552cb716f80d3327b5c758bbf9deb3e081833a0b6097d.json b/.sqlx/query-72c1d48b44cd49f3a0b0b515e9c428b23ece885b4b2ab4435b9f5757d15bdc17.jsonsimilarity index 62%rename from .sqlx/query-aaca1db3775d2031002552cb716f80d3327b5c758bbf9deb3e081833a0b6097d.jsonrename to .sqlx/query-72c1d48b44cd49f3a0b0b515e9c428b23ece885b4b2ab4435b9f5757d15bdc17.jsonindex d4764fbdbd..d8c0f340c4 100644--- a/.sqlx/query-aaca1db3775d2031002552cb716f80d3327b5c758bbf9deb3e081833a0b6097d.json+++ b/.sqlx/query-72c1d48b44cd49f3a0b0b515e9c428b23ece885b4b2ab4435b9f5757d15bdc17.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "SELECT id FROM email_messages WHERE id = $1 FOR UPDATE",+ "query": "SELECT id FROM email_attachments_drafts WHERE draft_id = $1 ORDER BY id","describe": {"columns": [{@@ -18,5 +18,5 @@false]},- "hash": "aaca1db3775d2031002552cb716f80d3327b5c758bbf9deb3e081833a0b6097d"+ "hash": "72c1d48b44cd49f3a0b0b515e9c428b23ece885b4b2ab4435b9f5757d15bdc17"}diff --git a/.sqlx/query-734403ba8ce10abe359f7b51113e3cfa8093a80c224232cf2ac2ae8ddc72bb9f.json b/.sqlx/query-734403ba8ce10abe359f7b51113e3cfa8093a80c224232cf2ac2ae8ddc72bb9f.jsonnew file mode 100644index 0000000000..816e0c50a4--- /dev/null+++ b/.sqlx/query-734403ba8ce10abe359f7b51113e3cfa8093a80c224232cf2ac2ae8ddc72bb9f.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH editable AS (\n SELECT id FROM email_messages\n WHERE id = $1 AND link_id = $3 AND is_draft AND NOT is_sent\n FOR UPDATE\n )\n DELETE FROM email_attachments_fwd eaf\n USING editable m\n WHERE eaf.message_id = m.id AND eaf.attachment_id = $2\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "734403ba8ce10abe359f7b51113e3cfa8093a80c224232cf2ac2ae8ddc72bb9f"+}diff --git a/.sqlx/query-759606e630ca24a91fd25d3d33795fe984b73c846312d37bbf8b8f42d8dbc0bd.json b/.sqlx/query-759606e630ca24a91fd25d3d33795fe984b73c846312d37bbf8b8f42d8dbc0bd.jsonnew file mode 100644index 0000000000..ba37b38fde--- /dev/null+++ b/.sqlx/query-759606e630ca24a91fd25d3d33795fe984b73c846312d37bbf8b8f42d8dbc0bd.json@@ -0,0 +1,14 @@+{+ "db_name": "PostgreSQL",+ "query": "DELETE FROM email_deferred_message_deletions WHERE message_id=$1",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "759606e630ca24a91fd25d3d33795fe984b73c846312d37bbf8b8f42d8dbc0bd"+}diff --git a/.sqlx/query-76c0812d5d7bd1940c215dc7d66a4508a047b621603e5394029eb369b967d14e.json b/.sqlx/query-76c0812d5d7bd1940c215dc7d66a4508a047b621603e5394029eb369b967d14e.jsonnew file mode 100644index 0000000000..e575d73ad8--- /dev/null+++ b/.sqlx/query-76c0812d5d7bd1940c215dc7d66a4508a047b621603e5394029eb369b967d14e.json@@ -0,0 +1,19 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_scheduled_messages SET processing = true, delivery_claim_id = $3,\n delivery_lease_expires_at = NOW() + make_interval(secs => $4),\n delivery_message_id = $5,\n delivery_started_at = CASE WHEN $6 THEN COALESCE(delivery_started_at, updated_at) ELSE delivery_started_at END,\n updated_at = NOW() WHERE message_id = $1 AND link_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid",+ "Float8",+ "Text",+ "Bool"+ ]+ },+ "nullable": []+ },+ "hash": "76c0812d5d7bd1940c215dc7d66a4508a047b621603e5394029eb369b967d14e"+}diff --git a/.sqlx/query-77f1050baa680b91d1380bcbd64da65e5ec2c7cddc581192fa094a2c4a2caac4.json b/.sqlx/query-77f1050baa680b91d1380bcbd64da65e5ec2c7cddc581192fa094a2c4a2caac4.jsonnew file mode 100644index 0000000000..6cef549b88--- /dev/null+++ b/.sqlx/query-77f1050baa680b91d1380bcbd64da65e5ec2c7cddc581192fa094a2c4a2caac4.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_messages SET thread_id = $3, updated_at = NOW() WHERE id = $1 AND link_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "77f1050baa680b91d1380bcbd64da65e5ec2c7cddc581192fa094a2c4a2caac4"+}diff --git a/.sqlx/query-e8bf9c53f71988ac7364aef5680e3cb74f7ddc5bacda3caf78db4b8672a8cf72.json b/.sqlx/query-7a1c166306e445127428704ab62c29c6b1daac51babb3467f6aa5714a821252e.jsonsimilarity index 79%rename from .sqlx/query-e8bf9c53f71988ac7364aef5680e3cb74f7ddc5bacda3caf78db4b8672a8cf72.jsonrename to .sqlx/query-7a1c166306e445127428704ab62c29c6b1daac51babb3467f6aa5714a821252e.jsonindex 5d56d3b171..167963617c 100644--- a/.sqlx/query-e8bf9c53f71988ac7364aef5680e3cb74f7ddc5bacda3caf78db4b8672a8cf72.json+++ b/.sqlx/query-7a1c166306e445127428704ab62c29c6b1daac51babb3467f6aa5714a821252e.json@@ -1,125 +1,130 @@{"db_name": "PostgreSQL",- "query": "\n SELECT\n id, provider_id, thread_id, provider_thread_id, replying_to_id,\n global_id, link_id, provider_history_id, internal_date_ts, snippet,\n size_estimate, subject, sent_at, has_attachments, is_read, is_starred,\n is_sent, is_draft, body_text, body_html_sanitized, body_macro,\n headers_jsonb, created_at, updated_at\n FROM email_messages\n WHERE is_draft = true\n AND provider_id IS NULL\n AND replying_to_id = ANY($1)\n AND link_id = ANY($2)\n AND thread_id <> $3\n ",+ "query": "SELECT draft_generation, id, provider_id, thread_id, provider_thread_id, replying_to_id,\n global_id, link_id, provider_history_id, internal_date_ts, snippet,\n size_estimate, subject, sent_at, has_attachments, is_read, is_starred,\n is_sent, is_draft, body_text, body_html_sanitized, body_macro,\n headers_jsonb, created_at, updated_at\n FROM email_messages WHERE (id, link_id) IN (SELECT * FROM unnest($1::uuid[], $2::uuid[]))","describe": {"columns": [{"ordinal": 0,+ "name": "draft_generation",+ "type_info": "Int4"+ },+ {+ "ordinal": 1,"name": "id","type_info": "Uuid"},{- "ordinal": 1,+ "ordinal": 2,"name": "provider_id","type_info": "Text"},{- "ordinal": 2,+ "ordinal": 3,"name": "thread_id","type_info": "Uuid"},{- "ordinal": 3,+ "ordinal": 4,"name": "provider_thread_id","type_info": "Text"},{- "ordinal": 4,+ "ordinal": 5,"name": "replying_to_id","type_info": "Uuid"},{- "ordinal": 5,+ "ordinal": 6,"name": "global_id","type_info": "Text"},{- "ordinal": 6,+ "ordinal": 7,"name": "link_id","type_info": "Uuid"},{- "ordinal": 7,+ "ordinal": 8,"name": "provider_history_id","type_info": "Text"},{- "ordinal": 8,+ "ordinal": 9,"name": "internal_date_ts","type_info": "Timestamptz"},{- "ordinal": 9,+ "ordinal": 10,"name": "snippet","type_info": "Text"},{- "ordinal": 10,+ "ordinal": 11,"name": "size_estimate","type_info": "Int8"},{- "ordinal": 11,+ "ordinal": 12,"name": "subject","type_info": "Text"},{- "ordinal": 12,+ "ordinal": 13,"name": "sent_at","type_info": "Timestamptz"},{- "ordinal": 13,+ "ordinal": 14,"name": "has_attachments","type_info": "Bool"},{- "ordinal": 14,+ "ordinal": 15,"name": "is_read","type_info": "Bool"},{- "ordinal": 15,+ "ordinal": 16,"name": "is_starred","type_info": "Bool"},{- "ordinal": 16,+ "ordinal": 17,"name": "is_sent","type_info": "Bool"},{- "ordinal": 17,+ "ordinal": 18,"name": "is_draft","type_info": "Bool"},{- "ordinal": 18,+ "ordinal": 19,"name": "body_text","type_info": "Text"},{- "ordinal": 19,+ "ordinal": 20,"name": "body_html_sanitized","type_info": "Text"},{- "ordinal": 20,+ "ordinal": 21,"name": "body_macro","type_info": "Text"},{- "ordinal": 21,+ "ordinal": 22,"name": "headers_jsonb","type_info": "Jsonb"},{- "ordinal": 22,+ "ordinal": 23,"name": "created_at","type_info": "Timestamptz"},{- "ordinal": 23,+ "ordinal": 24,"name": "updated_at","type_info": "Timestamptz"}@@ -127,11 +132,11 @@"parameters": {"Left": ["UuidArray",- "UuidArray",- "Uuid"+ "UuidArray"]},"nullable": [+ false,false,true,false,@@ -158,5 +163,5 @@false]},- "hash": "e8bf9c53f71988ac7364aef5680e3cb74f7ddc5bacda3caf78db4b8672a8cf72"+ "hash": "7a1c166306e445127428704ab62c29c6b1daac51babb3467f6aa5714a821252e"}diff --git a/.sqlx/query-7bf8a10427f32241206f02b499aaca45f3e17288ea37c0905257a0afce6ba551.json b/.sqlx/query-7bf8a10427f32241206f02b499aaca45f3e17288ea37c0905257a0afce6ba551.jsonnew file mode 100644index 0000000000..307f7efb3a--- /dev/null+++ b/.sqlx/query-7bf8a10427f32241206f02b499aaca45f3e17288ea37c0905257a0afce6ba551.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_attachments_drafts SET draft_id = $1 WHERE draft_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "7bf8a10427f32241206f02b499aaca45f3e17288ea37c0905257a0afce6ba551"+}diff --git a/.sqlx/query-b5bf34fa23cec47e38d38cee18acffed018d15459e101dc907bd1fafb2158979.json b/.sqlx/query-8071a5aaef3c699b2fa2d557b5a8878471431a479c374c036a9e198cebf0b42a.jsonsimilarity index 77%rename from .sqlx/query-b5bf34fa23cec47e38d38cee18acffed018d15459e101dc907bd1fafb2158979.jsonrename to .sqlx/query-8071a5aaef3c699b2fa2d557b5a8878471431a479c374c036a9e198cebf0b42a.jsonindex 3254e45676..371ef07256 100644--- a/.sqlx/query-b5bf34fa23cec47e38d38cee18acffed018d15459e101dc907bd1fafb2158979.json+++ b/.sqlx/query-8071a5aaef3c699b2fa2d557b5a8878471431a479c374c036a9e198cebf0b42a.json@@ -1,135 +1,140 @@{"db_name": "PostgreSQL",- "query": "\n SELECT\n m.id, m.provider_id, m.global_id, m.link_id, m.thread_id, m.provider_thread_id, m.provider_history_id,\n m.replying_to_id, m.internal_date_ts, m.snippet, m.size_estimate, m.subject, m.from_name,\n m.from_contact_id, m.sent_at, m.has_attachments, m.is_read, m.is_starred, m.is_sent, m.is_draft,\n NULL::TEXT as body_text,\n NULL::TEXT as body_html_sanitized,\n NULL::TEXT as body_macro,\n m.headers_jsonb, m.created_at, m.updated_at\n FROM email_messages m\n JOIN email_links l ON m.link_id = l.id\n WHERE m.id = $1\n ",+ "query": "\n SELECT\n m.draft_generation, m.id, m.provider_id, m.global_id, m.link_id, m.thread_id, m.provider_thread_id, m.provider_history_id,\n m.replying_to_id, m.internal_date_ts, m.snippet, m.size_estimate, m.subject, m.from_name,\n m.from_contact_id, m.sent_at, m.has_attachments, m.is_read, m.is_starred, m.is_sent, m.is_draft,\n NULL::TEXT as body_text,\n NULL::TEXT as body_html_sanitized,\n NULL::TEXT as body_macro,\n m.headers_jsonb, m.created_at, m.updated_at\n FROM email_messages m\n JOIN email_links l ON m.link_id = l.id\n WHERE m.id = $1\n ","describe": {"columns": [{"ordinal": 0,+ "name": "draft_generation",+ "type_info": "Int4"+ },+ {+ "ordinal": 1,"name": "id","type_info": "Uuid"},{- "ordinal": 1,+ "ordinal": 2,"name": "provider_id","type_info": "Text"},{- "ordinal": 2,+ "ordinal": 3,"name": "global_id","type_info": "Text"},{- "ordinal": 3,+ "ordinal": 4,"name": "link_id","type_info": "Uuid"},{- "ordinal": 4,+ "ordinal": 5,"name": "thread_id","type_info": "Uuid"},{- "ordinal": 5,+ "ordinal": 6,"name": "provider_thread_id","type_info": "Text"},{- "ordinal": 6,+ "ordinal": 7,"name": "provider_history_id","type_info": "Text"},{- "ordinal": 7,+ "ordinal": 8,"name": "replying_to_id","type_info": "Uuid"},{- "ordinal": 8,+ "ordinal": 9,"name": "internal_date_ts","type_info": "Timestamptz"},{- "ordinal": 9,+ "ordinal": 10,"name": "snippet","type_info": "Text"},{- "ordinal": 10,+ "ordinal": 11,"name": "size_estimate","type_info": "Int8"},{- "ordinal": 11,+ "ordinal": 12,"name": "subject","type_info": "Text"},{- "ordinal": 12,+ "ordinal": 13,"name": "from_name","type_info": "Varchar"},{- "ordinal": 13,+ "ordinal": 14,"name": "from_contact_id","type_info": "Uuid"},{- "ordinal": 14,+ "ordinal": 15,"name": "sent_at","type_info": "Timestamptz"},{- "ordinal": 15,+ "ordinal": 16,"name": "has_attachments","type_info": "Bool"},{- "ordinal": 16,+ "ordinal": 17,"name": "is_read","type_info": "Bool"},{- "ordinal": 17,+ "ordinal": 18,"name": "is_starred","type_info": "Bool"},{- "ordinal": 18,+ "ordinal": 19,"name": "is_sent","type_info": "Bool"},{- "ordinal": 19,+ "ordinal": 20,"name": "is_draft","type_info": "Bool"},{- "ordinal": 20,+ "ordinal": 21,"name": "body_text","type_info": "Text"},{- "ordinal": 21,+ "ordinal": 22,"name": "body_html_sanitized","type_info": "Text"},{- "ordinal": 22,+ "ordinal": 23,"name": "body_macro","type_info": "Text"},{- "ordinal": 23,+ "ordinal": 24,"name": "headers_jsonb","type_info": "Jsonb"},{- "ordinal": 24,+ "ordinal": 25,"name": "created_at","type_info": "Timestamptz"},{- "ordinal": 25,+ "ordinal": 26,"name": "updated_at","type_info": "Timestamptz"}@@ -140,6 +145,7 @@]},"nullable": [+ false,false,true,true,@@ -168,5 +174,5 @@false]},- "hash": "b5bf34fa23cec47e38d38cee18acffed018d15459e101dc907bd1fafb2158979"+ "hash": "8071a5aaef3c699b2fa2d557b5a8878471431a479c374c036a9e198cebf0b42a"}diff --git a/.sqlx/query-819f3e17c7e49e84daf3e59e63ded73d875f778c31ed260ce74bc861f2b772e5.json b/.sqlx/query-819f3e17c7e49e84daf3e59e63ded73d875f778c31ed260ce74bc861f2b772e5.jsonnew file mode 100644index 0000000000..0583f0d5df--- /dev/null+++ b/.sqlx/query-819f3e17c7e49e84daf3e59e63ded73d875f778c31ed260ce74bc861f2b772e5.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO email_thread_client_ids (client_id, link_id, thread_id)\n VALUES ($1, $2, $3) ON CONFLICT (link_id, client_id)\n DO UPDATE SET thread_id = EXCLUDED.thread_id, created_at = NOW()",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "819f3e17c7e49e84daf3e59e63ded73d875f778c31ed260ce74bc861f2b772e5"+}diff --git a/.sqlx/query-2c64f9b08f5ae8d78c841c023acc118b1a3a157f1fca8a4f7f494c057be38e5e.json b/.sqlx/query-81f301a1d476c227ad1b2640ddc5ae40f05a2d739b70ebdc8c0deb157511d703.jsonsimilarity index 52%rename from .sqlx/query-2c64f9b08f5ae8d78c841c023acc118b1a3a157f1fca8a4f7f494c057be38e5e.jsonrename to .sqlx/query-81f301a1d476c227ad1b2640ddc5ae40f05a2d739b70ebdc8c0deb157511d703.jsonindex 72595e8d2b..094d459d47 100644--- a/.sqlx/query-2c64f9b08f5ae8d78c841c023acc118b1a3a157f1fca8a4f7f494c057be38e5e.json+++ b/.sqlx/query-81f301a1d476c227ad1b2640ddc5ae40f05a2d739b70ebdc8c0deb157511d703.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "SELECT link_id, is_sent, is_draft, (EXISTS (SELECT 1 FROM email_mailbox_drafts d WHERE d.message_id = email_messages.id AND d.delete_requested) OR EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.source_id=email_messages.id AND t.state<>'preparing')) AS \"deleted!\" FROM email_messages WHERE id = $1 FOR UPDATE",+ "query": "SELECT link_id, thread_id, is_draft, is_sent FROM email_messages WHERE id = $1 FOR UPDATE","describe": {"columns": [{@@ -10,8 +10,8 @@},{"ordinal": 1,- "name": "is_sent",- "type_info": "Bool"+ "name": "thread_id",+ "type_info": "Uuid"},{"ordinal": 2,@@ -20,7 +20,7 @@},{"ordinal": 3,- "name": "deleted!",+ "name": "is_sent","type_info": "Bool"}],@@ -33,8 +33,8 @@false,false,false,- null+ false]},- "hash": "2c64f9b08f5ae8d78c841c023acc118b1a3a157f1fca8a4f7f494c057be38e5e"+ "hash": "81f301a1d476c227ad1b2640ddc5ae40f05a2d739b70ebdc8c0deb157511d703"}diff --git a/.sqlx/query-851fe05391377c57115594c61e4491d7220a657cd0aff2c0b52f3d3628abe824.json b/.sqlx/query-851fe05391377c57115594c61e4491d7220a657cd0aff2c0b52f3d3628abe824.jsonnew file mode 100644index 0000000000..c60f2ba008--- /dev/null+++ b/.sqlx/query-851fe05391377c57115594c61e4491d7220a657cd0aff2c0b52f3d3628abe824.json@@ -0,0 +1,180 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n draft_generation,\n id,\n provider_id,\n global_id,\n thread_id,\n provider_thread_id,\n replying_to_id,\n link_id,\n provider_history_id,\n internal_date_ts,\n snippet,\n size_estimate,\n subject,\n from_name,\n from_contact_id,\n sent_at,\n has_attachments,\n is_read,\n is_starred,\n is_sent,\n is_draft,\n headers_jsonb,\n created_at,\n updated_at,\n -- No body attributes\n body_text as body_text,\n body_html_sanitized as body_html_sanitized,\n NULL::TEXT as body_macro\n FROM email_messages\n WHERE thread_id = $1\n ORDER BY internal_date_ts DESC NULLS LAST\n LIMIT $2 OFFSET $3\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "draft_generation",+ "type_info": "Int4"+ },+ {+ "ordinal": 1,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "global_id",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 5,+ "name": "provider_thread_id",+ "type_info": "Text"+ },+ {+ "ordinal": 6,+ "name": "replying_to_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 7,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 8,+ "name": "provider_history_id",+ "type_info": "Text"+ },+ {+ "ordinal": 9,+ "name": "internal_date_ts",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 10,+ "name": "snippet",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "size_estimate",+ "type_info": "Int8"+ },+ {+ "ordinal": 12,+ "name": "subject",+ "type_info": "Text"+ },+ {+ "ordinal": 13,+ "name": "from_name",+ "type_info": "Varchar"+ },+ {+ "ordinal": 14,+ "name": "from_contact_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 15,+ "name": "sent_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 16,+ "name": "has_attachments",+ "type_info": "Bool"+ },+ {+ "ordinal": 17,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 18,+ "name": "is_starred",+ "type_info": "Bool"+ },+ {+ "ordinal": 19,+ "name": "is_sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 20,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 21,+ "name": "headers_jsonb",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 22,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 23,+ "name": "updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 24,+ "name": "body_text",+ "type_info": "Text"+ },+ {+ "ordinal": 25,+ "name": "body_html_sanitized",+ "type_info": "Text"+ },+ {+ "ordinal": 26,+ "name": "body_macro",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int8",+ "Int8"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ true,+ false,+ true,+ true,+ false,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ false,+ false,+ false,+ false,+ false,+ true,+ false,+ false,+ true,+ true,+ null+ ]+ },+ "hash": "851fe05391377c57115594c61e4491d7220a657cd0aff2c0b52f3d3628abe824"+}diff --git a/.sqlx/query-89ff0dfc2ffa9a795dff1f7fa526f14aaca565462003217f7fb303494c0d6130.json b/.sqlx/query-89ff0dfc2ffa9a795dff1f7fa526f14aaca565462003217f7fb303494c0d6130.jsonnew file mode 100644index 0000000000..223577c068--- /dev/null+++ b/.sqlx/query-89ff0dfc2ffa9a795dff1f7fa526f14aaca565462003217f7fb303494c0d6130.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT id FROM email_messages WHERE provider_id=$1 AND link_id=$2 FOR UPDATE",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "Uuid"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "89ff0dfc2ffa9a795dff1f7fa526f14aaca565462003217f7fb303494c0d6130"+}diff --git a/.sqlx/query-8adc89227f2393330219e8887137a46b3432e1636c58c49a681a047da4f56a6f.json b/.sqlx/query-8adc89227f2393330219e8887137a46b3432e1636c58c49a681a047da4f56a6f.jsonnew file mode 100644index 0000000000..fbe270b376--- /dev/null+++ b/.sqlx/query-8adc89227f2393330219e8887137a46b3432e1636c58c49a681a047da4f56a6f.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_draft_client_ids SET message_id = $1 WHERE message_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "8adc89227f2393330219e8887137a46b3432e1636c58c49a681a047da4f56a6f"+}diff --git a/.sqlx/query-8b7426b136c6e628ad8944416888bd8ce48883614c97ca660d57ac9dd510c087.json b/.sqlx/query-8b7426b136c6e628ad8944416888bd8ce48883614c97ca660d57ac9dd510c087.jsonnew file mode 100644index 0000000000..c0be72175a--- /dev/null+++ b/.sqlx/query-8b7426b136c6e628ad8944416888bd8ce48883614c97ca660d57ac9dd510c087.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO document_email (document_id, email_attachment_id)\n SELECT document_id, $1 FROM document_email WHERE email_attachment_id = $2\n ON CONFLICT DO NOTHING",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "8b7426b136c6e628ad8944416888bd8ce48883614c97ca660d57ac9dd510c087"+}diff --git a/.sqlx/query-8b8194993cc2ec93b2db6104da98fe3569d973d3d2a3f723c70414c04cc574ef.json b/.sqlx/query-8b8194993cc2ec93b2db6104da98fe3569d973d3d2a3f723c70414c04cc574ef.jsondeleted file mode 100644index e065f0dc6a..0000000000--- a/.sqlx/query-8b8194993cc2ec93b2db6104da98fe3569d973d3d2a3f723c70414c04cc574ef.json+++ /dev/null@@ -1,16 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n INSERT INTO email_attachments_fwd (message_id, attachment_id)\n SELECT $1, $2\n FROM email_messages m\n WHERE m.id = $1 AND m.link_id = $3\n ON CONFLICT DO NOTHING\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid",- "Uuid",- "Uuid"- ]- },- "nullable": []- },- "hash": "8b8194993cc2ec93b2db6104da98fe3569d973d3d2a3f723c70414c04cc574ef"-}diff --git a/.sqlx/query-92a552187680c30d0124b8bb0e87ca610560c8cebec23ab23c5bafee8daede4c.json b/.sqlx/query-92a552187680c30d0124b8bb0e87ca610560c8cebec23ab23c5bafee8daede4c.jsonnew file mode 100644index 0000000000..68abbe9ae7--- /dev/null+++ b/.sqlx/query-92a552187680c30d0124b8bb0e87ca610560c8cebec23ab23c5bafee8daede4c.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2) AS \"scheduled!\"",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "scheduled!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "92a552187680c30d0124b8bb0e87ca610560c8cebec23ab23c5bafee8daede4c"+}diff --git a/.sqlx/query-96e1c8ad471a481b167f41c4b3223d91fe4294456caf266862f4315bb3141f51.json b/.sqlx/query-96e1c8ad471a481b167f41c4b3223d91fe4294456caf266862f4315bb3141f51.jsonnew file mode 100644index 0000000000..57f2ed6ca7--- /dev/null+++ b/.sqlx/query-96e1c8ad471a481b167f41c4b3223d91fe4294456caf266862f4315bb3141f51.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO email_attachments_fwd (message_id, attachment_id, created_at)\n SELECT $1, attachment_id, created_at FROM email_attachments_fwd WHERE message_id = $2\n ON CONFLICT DO NOTHING",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "96e1c8ad471a481b167f41c4b3223d91fe4294456caf266862f4315bb3141f51"+}diff --git a/.sqlx/query-971a825044153a72c2aa1316b951eda3ca16849422e86c61e90fe210d312a34b.json b/.sqlx/query-971a825044153a72c2aa1316b951eda3ca16849422e86c61e90fe210d312a34b.jsondeleted file mode 100644index e42f6769c1..0000000000--- a/.sqlx/query-971a825044153a72c2aa1316b951eda3ca16849422e86c61e90fe210d312a34b.json+++ /dev/null@@ -1,77 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "SELECT m.updated_at,m.provider_id,m.thread_id,\n CASE WHEN l.provider='OUTLOOK' THEN COALESCE(d.checkpoint->'draft'->>'version',m.provider_version,d.base_version) ELSE m.provider_history_id END AS version,\n m.is_draft,m.is_sent,\n (COALESCE(d.delete_requested,false) OR EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.source_id=m.id AND t.state<>'preparing')) AS \"retired!\",\n (EXISTS(SELECT 1 FROM email_scheduled_messages s WHERE s.message_id=m.id)\n OR EXISTS(SELECT 1 FROM email_attachments_drafts a WHERE a.draft_id=m.id AND a.upload_pending)\n OR COALESCE(d.lease_until>now(),false) OR COALESCE(d.state IN ('conflict','unknown'),false)\n OR COALESCE(d.checkpoint->>'stage' NOT IN ('inspect','ready'),false)) AS \"busy!\",\n EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.destination_id=m.id AND t.state NOT IN ('ready','retained')) AS \"predecessor!\",\n jsonb_build_object('db_id',m.id,'thread_db_id',m.thread_id,'subject',COALESCE(m.subject,''),'replying_to_id',m.replying_to_id,\n 'body_text',m.body_text,'body_html',m.body_html_sanitized,'body_macro',m.body_macro,'headers_json',m.headers_jsonb,\n 'to',COALESCE(recipients.to_addresses,'[]'::jsonb),'cc',COALESCE(recipients.cc_addresses,'[]'::jsonb),'bcc',COALESCE(recipients.bcc_addresses,'[]'::jsonb)) AS \"content!\"\n FROM email_messages m JOIN email_links l ON l.id=m.link_id LEFT JOIN email_mailbox_drafts d ON d.message_id=m.id\n CROSS JOIN LATERAL (SELECT jsonb_agg(jsonb_build_object('email',c.email_address,'name',COALESCE(r.name,c.name))) FILTER(WHERE r.recipient_type='TO') AS to_addresses,\n jsonb_agg(jsonb_build_object('email',c.email_address,'name',COALESCE(r.name,c.name))) FILTER(WHERE r.recipient_type='CC') AS cc_addresses,\n jsonb_agg(jsonb_build_object('email',c.email_address,'name',COALESCE(r.name,c.name))) FILTER(WHERE r.recipient_type='BCC') AS bcc_addresses\n FROM email_message_recipients r JOIN email_contacts c ON c.id=r.contact_id WHERE r.message_id=m.id) recipients\n WHERE m.id=$1 AND m.link_id=$2 FOR UPDATE OF m",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "updated_at",- "type_info": "Timestamptz"- },- {- "ordinal": 1,- "name": "provider_id",- "type_info": "Text"- },- {- "ordinal": 2,- "name": "thread_id",- "type_info": "Uuid"- },- {- "ordinal": 3,- "name": "version",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "is_draft",- "type_info": "Bool"- },- {- "ordinal": 5,- "name": "is_sent",- "type_info": "Bool"- },- {- "ordinal": 6,- "name": "retired!",- "type_info": "Bool"- },- {- "ordinal": 7,- "name": "busy!",- "type_info": "Bool"- },- {- "ordinal": 8,- "name": "predecessor!",- "type_info": "Bool"- },- {- "ordinal": 9,- "name": "content!",- "type_info": "Jsonb"- }- ],- "parameters": {- "Left": [- "Uuid",- "Uuid"- ]- },- "nullable": [- false,- true,- false,- null,- false,- false,- null,- null,- null,- null- ]- },- "hash": "971a825044153a72c2aa1316b951eda3ca16849422e86c61e90fe210d312a34b"-}diff --git a/.sqlx/query-97bdc12f2c4f553f3387e1171dd9a161dadb87dd867aa05065a7f40d0a0c867b.json b/.sqlx/query-97bdc12f2c4f553f3387e1171dd9a161dadb87dd867aa05065a7f40d0a0c867b.jsonnew file mode 100644index 0000000000..9de13f5931--- /dev/null+++ b/.sqlx/query-97bdc12f2c4f553f3387e1171dd9a161dadb87dd867aa05065a7f40d0a0c867b.json@@ -0,0 +1,29 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT request, prepared_content FROM email_send_attempts WHERE message_id = $1 AND link_id = $2 AND NOT cancelled AND NOT sent ORDER BY send_time DESC NULLS LAST LIMIT 1",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "request",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 1,+ "name": "prepared_content",+ "type_info": "Jsonb"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ true,+ true+ ]+ },+ "hash": "97bdc12f2c4f553f3387e1171dd9a161dadb87dd867aa05065a7f40d0a0c867b"+}diff --git a/.sqlx/query-989393947d0bce21e1cd8b1e6ebfa98014f85d8de4b1da214a029cd96a72a063.json b/.sqlx/query-989393947d0bce21e1cd8b1e6ebfa98014f85d8de4b1da214a029cd96a72a063.jsonnew file mode 100644index 0000000000..070298d841--- /dev/null+++ b/.sqlx/query-989393947d0bce21e1cd8b1e6ebfa98014f85d8de4b1da214a029cd96a72a063.json@@ -0,0 +1,17 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_scheduled_messages SET processing = true,\n delivery_lease_expires_at = NOW() + make_interval(secs => $4), updated_at = NOW()\n WHERE message_id = $1 AND link_id = $2 AND delivery_claim_id = $3\n AND processing AND NOT sent AND delivery_started_at IS NULL AND delivery_status = 'ready'",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid",+ "Float8"+ ]+ },+ "nullable": []+ },+ "hash": "989393947d0bce21e1cd8b1e6ebfa98014f85d8de4b1da214a029cd96a72a063"+}diff --git a/.sqlx/query-773d0b6612870f6750de395ca225fb4d180682d34c80b269bf53edba5a93e3a3.json b/.sqlx/query-98f56decf90d1b63f7f5b67201cf8c917a01471b84ae23c54c17c961b17c83b1.jsonsimilarity index 80%rename from .sqlx/query-773d0b6612870f6750de395ca225fb4d180682d34c80b269bf53edba5a93e3a3.jsonrename to .sqlx/query-98f56decf90d1b63f7f5b67201cf8c917a01471b84ae23c54c17c961b17c83b1.jsonindex eb6a3a4446..a68b7647fb 100644--- a/.sqlx/query-773d0b6612870f6750de395ca225fb4d180682d34c80b269bf53edba5a93e3a3.json+++ b/.sqlx/query-98f56decf90d1b63f7f5b67201cf8c917a01471b84ae23c54c17c961b17c83b1.json@@ -1,125 +1,130 @@{"db_name": "PostgreSQL",- "query": "\n SELECT\n id, provider_id, thread_id, provider_thread_id, replying_to_id,\n global_id, link_id, provider_history_id, internal_date_ts, snippet,\n size_estimate, subject, sent_at, has_attachments, is_read, is_starred,\n is_sent, is_draft, body_text, body_html_sanitized, body_macro,\n headers_jsonb, created_at, updated_at\n FROM email_messages\n WHERE thread_id = $1\n ORDER BY COALESCE(internal_date_ts, sent_at, created_at) DESC, id DESC\n LIMIT $2 OFFSET $3\n ",+ "query": "SELECT draft_generation, id, provider_id, thread_id, provider_thread_id, replying_to_id,\n global_id, link_id, provider_history_id, internal_date_ts, snippet,\n size_estimate, subject, sent_at, has_attachments, is_read, is_starred,\n is_sent, is_draft, body_text, body_html_sanitized, body_macro,\n headers_jsonb, created_at, updated_at\n FROM email_messages WHERE id = $1 AND link_id = $2","describe": {"columns": [{"ordinal": 0,+ "name": "draft_generation",+ "type_info": "Int4"+ },+ {+ "ordinal": 1,"name": "id","type_info": "Uuid"},{- "ordinal": 1,+ "ordinal": 2,"name": "provider_id","type_info": "Text"},{- "ordinal": 2,+ "ordinal": 3,"name": "thread_id","type_info": "Uuid"},{- "ordinal": 3,+ "ordinal": 4,"name": "provider_thread_id","type_info": "Text"},{- "ordinal": 4,+ "ordinal": 5,"name": "replying_to_id","type_info": "Uuid"},{- "ordinal": 5,+ "ordinal": 6,"name": "global_id","type_info": "Text"},{- "ordinal": 6,+ "ordinal": 7,"name": "link_id","type_info": "Uuid"},{- "ordinal": 7,+ "ordinal": 8,"name": "provider_history_id","type_info": "Text"},{- "ordinal": 8,+ "ordinal": 9,"name": "internal_date_ts","type_info": "Timestamptz"},{- "ordinal": 9,+ "ordinal": 10,"name": "snippet","type_info": "Text"},{- "ordinal": 10,+ "ordinal": 11,"name": "size_estimate","type_info": "Int8"},{- "ordinal": 11,+ "ordinal": 12,"name": "subject","type_info": "Text"},{- "ordinal": 12,+ "ordinal": 13,"name": "sent_at","type_info": "Timestamptz"},{- "ordinal": 13,+ "ordinal": 14,"name": "has_attachments","type_info": "Bool"},{- "ordinal": 14,+ "ordinal": 15,"name": "is_read","type_info": "Bool"},{- "ordinal": 15,+ "ordinal": 16,"name": "is_starred","type_info": "Bool"},{- "ordinal": 16,+ "ordinal": 17,"name": "is_sent","type_info": "Bool"},{- "ordinal": 17,+ "ordinal": 18,"name": "is_draft","type_info": "Bool"},{- "ordinal": 18,+ "ordinal": 19,"name": "body_text","type_info": "Text"},{- "ordinal": 19,+ "ordinal": 20,"name": "body_html_sanitized","type_info": "Text"},{- "ordinal": 20,+ "ordinal": 21,"name": "body_macro","type_info": "Text"},{- "ordinal": 21,+ "ordinal": 22,"name": "headers_jsonb","type_info": "Jsonb"},{- "ordinal": 22,+ "ordinal": 23,"name": "created_at","type_info": "Timestamptz"},{- "ordinal": 23,+ "ordinal": 24,"name": "updated_at","type_info": "Timestamptz"}@@ -127,11 +132,11 @@"parameters": {"Left": ["Uuid",- "Int8",- "Int8"+ "Uuid"]},"nullable": [+ false,false,true,false,@@ -158,5 +163,5 @@false]},- "hash": "773d0b6612870f6750de395ca225fb4d180682d34c80b269bf53edba5a93e3a3"+ "hash": "98f56decf90d1b63f7f5b67201cf8c917a01471b84ae23c54c17c961b17c83b1"}diff --git a/.sqlx/query-9b9c80b63b348331a14f489518d7be283c746db0af70ae0af08af29b8c06a272.json b/.sqlx/query-9b9c80b63b348331a14f489518d7be283c746db0af70ae0af08af29b8c06a272.jsonnew file mode 100644index 0000000000..91884f2b68--- /dev/null+++ b/.sqlx/query-9b9c80b63b348331a14f489518d7be283c746db0af70ae0af08af29b8c06a272.json@@ -0,0 +1,168 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n draft_generation, id, provider_id, thread_id, provider_thread_id, replying_to_id,\n global_id, link_id, provider_history_id, internal_date_ts, snippet,\n size_estimate, subject, sent_at, has_attachments, is_read, is_starred,\n is_sent, is_draft, body_text, body_html_sanitized, body_macro,\n headers_jsonb, created_at, updated_at\n FROM email_messages\n WHERE is_draft = true\n AND provider_id IS NULL\n AND replying_to_id = ANY($1)\n AND link_id = ANY($2)\n AND thread_id <> $3\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "draft_generation",+ "type_info": "Int4"+ },+ {+ "ordinal": 1,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 4,+ "name": "provider_thread_id",+ "type_info": "Text"+ },+ {+ "ordinal": 5,+ "name": "replying_to_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 6,+ "name": "global_id",+ "type_info": "Text"+ },+ {+ "ordinal": 7,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 8,+ "name": "provider_history_id",+ "type_info": "Text"+ },+ {+ "ordinal": 9,+ "name": "internal_date_ts",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 10,+ "name": "snippet",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "size_estimate",+ "type_info": "Int8"+ },+ {+ "ordinal": 12,+ "name": "subject",+ "type_info": "Text"+ },+ {+ "ordinal": 13,+ "name": "sent_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 14,+ "name": "has_attachments",+ "type_info": "Bool"+ },+ {+ "ordinal": 15,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 16,+ "name": "is_starred",+ "type_info": "Bool"+ },+ {+ "ordinal": 17,+ "name": "is_sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 18,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 19,+ "name": "body_text",+ "type_info": "Text"+ },+ {+ "ordinal": 20,+ "name": "body_html_sanitized",+ "type_info": "Text"+ },+ {+ "ordinal": 21,+ "name": "body_macro",+ "type_info": "Text"+ },+ {+ "ordinal": 22,+ "name": "headers_jsonb",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 23,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 24,+ "name": "updated_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray",+ "UuidArray",+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ false,+ true,+ true,+ true,+ false,+ true,+ true,+ true,+ true,+ true,+ true,+ false,+ false,+ false,+ false,+ false,+ true,+ true,+ true,+ true,+ false,+ false+ ]+ },+ "hash": "9b9c80b63b348331a14f489518d7be283c746db0af70ae0af08af29b8c06a272"+}diff --git a/.sqlx/query-9ef1cc9b408ca8d8eaf8041c48f2c34ac9b2ec67fd6e036f87f937dfbc4aa3de.json b/.sqlx/query-9ef1cc9b408ca8d8eaf8041c48f2c34ac9b2ec67fd6e036f87f937dfbc4aa3de.jsonnew file mode 100644index 0000000000..cb547931ae--- /dev/null+++ b/.sqlx/query-9ef1cc9b408ca8d8eaf8041c48f2c34ac9b2ec67fd6e036f87f937dfbc4aa3de.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT id FROM email_threads WHERE link_id = $1 AND provider_id = $2 FOR UPDATE",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Text"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "9ef1cc9b408ca8d8eaf8041c48f2c34ac9b2ec67fd6e036f87f937dfbc4aa3de"+}diff --git a/.sqlx/query-a4e712e4735b8dbf7804d106cbacec8242712d5278a9c6252342de447e86dadd.json b/.sqlx/query-a4e712e4735b8dbf7804d106cbacec8242712d5278a9c6252342de447e86dadd.jsonnew file mode 100644index 0000000000..523bf4fbd4--- /dev/null+++ b/.sqlx/query-a4e712e4735b8dbf7804d106cbacec8242712d5278a9c6252342de447e86dadd.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO email_message_calendar_invites (message_id, component_id, snapshot)\n SELECT $1, component_id, snapshot FROM email_message_calendar_invites WHERE message_id = $2\n ON CONFLICT (message_id, component_id) DO UPDATE SET snapshot = EXCLUDED.snapshot",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "a4e712e4735b8dbf7804d106cbacec8242712d5278a9c6252342de447e86dadd"+}diff --git a/.sqlx/query-aa8bdb42e40f86c2696a6e0c7ccc3ba534e2be6c6af419e172deb8a4896c763e.json b/.sqlx/query-aa8bdb42e40f86c2696a6e0c7ccc3ba534e2be6c6af419e172deb8a4896c763e.jsonnew file mode 100644index 0000000000..85c5cb46de--- /dev/null+++ b/.sqlx/query-aa8bdb42e40f86c2696a6e0c7ccc3ba534e2be6c6af419e172deb8a4896c763e.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_thread_client_ids SET thread_id = $3, created_at = NOW()\n WHERE link_id = $1 AND thread_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "aa8bdb42e40f86c2696a6e0c7ccc3ba534e2be6c6af419e172deb8a4896c763e"+}diff --git a/.sqlx/query-c68f45e8a939d63144008a9254f03bf5198710a57c1a8bad4901f61c27cb5f6f.json b/.sqlx/query-afa432da825aca91189f0874e76bf55b0c102bb0d48f1c209b0143296812d09e.jsonsimilarity index 56%rename from .sqlx/query-c68f45e8a939d63144008a9254f03bf5198710a57c1a8bad4901f61c27cb5f6f.jsonrename to .sqlx/query-afa432da825aca91189f0874e76bf55b0c102bb0d48f1c209b0143296812d09e.jsonindex bb08a58f15..d757cf0286 100644--- a/.sqlx/query-c68f45e8a939d63144008a9254f03bf5198710a57c1a8bad4901f61c27cb5f6f.json+++ b/.sqlx/query-afa432da825aca91189f0874e76bf55b0c102bb0d48f1c209b0143296812d09e.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n DELETE FROM email_scheduled_messages\n WHERE message_id = ANY($1) AND link_id = $2 AND sent = false\n RETURNING message_id\n ",+ "query": "\n DELETE FROM email_scheduled_messages\n WHERE message_id = ANY($1) AND link_id = $2 AND sent = false\n AND (delivery_status = 'failed' OR\n (delivery_started_at IS NULL AND delivery_status <> 'unconfirmed'\n AND (NOT processing OR delivery_claim_id IS NOT NULL)))\n RETURNING message_id\n ","describe": {"columns": [{@@ -19,5 +19,5 @@false]},- "hash": "c68f45e8a939d63144008a9254f03bf5198710a57c1a8bad4901f61c27cb5f6f"+ "hash": "afa432da825aca91189f0874e76bf55b0c102bb0d48f1c209b0143296812d09e"}diff --git a/.sqlx/query-870e4e50d9b48d79f09b34581374521e085f5a6e25722ba95a00882d37679402.json b/.sqlx/query-b31a861f9f8ee265e0a4b5557b27ad15663c6ec6b84df7bdeea73cdc9af69320.jsonsimilarity index 63%rename from .sqlx/query-870e4e50d9b48d79f09b34581374521e085f5a6e25722ba95a00882d37679402.jsonrename to .sqlx/query-b31a861f9f8ee265e0a4b5557b27ad15663c6ec6b84df7bdeea73cdc9af69320.jsonindex c4aab27710..6d111d439f 100644--- a/.sqlx/query-870e4e50d9b48d79f09b34581374521e085f5a6e25722ba95a00882d37679402.json+++ b/.sqlx/query-b31a861f9f8ee265e0a4b5557b27ad15663c6ec6b84df7bdeea73cdc9af69320.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "DELETE FROM email_scheduled_messages WHERE link_id = $1 AND message_id = $2 AND NOT sent AND NOT processing",+ "query": "DELETE FROM email_scheduled_messages WHERE link_id = $1 AND message_id = $2","describe": {"columns": [],"parameters": {@@ -11,5 +11,5 @@},"nullable": []},- "hash": "870e4e50d9b48d79f09b34581374521e085f5a6e25722ba95a00882d37679402"+ "hash": "b31a861f9f8ee265e0a4b5557b27ad15663c6ec6b84df7bdeea73cdc9af69320"}diff --git a/.sqlx/query-b9d3465546196d99d8d9fb838929564d3b3a2aa5bbd435d0f0eddd8291957cac.json b/.sqlx/query-b9d3465546196d99d8d9fb838929564d3b3a2aa5bbd435d0f0eddd8291957cac.jsonnew file mode 100644index 0000000000..f62e669e37--- /dev/null+++ b/.sqlx/query-b9d3465546196d99d8d9fb838929564d3b3a2aa5bbd435d0f0eddd8291957cac.json@@ -0,0 +1,26 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO email_send_attempts (user_id, link_id, attempt_id, request, message_id, thread_id, send_time, restore_body_html, restore_body_text, restore_body_macro, prepared_content, draft_handles, draft_link_ids)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11,\n ARRAY(SELECT client_id FROM email_draft_client_ids WHERE message_id=$5\n UNION SELECT $5 UNION SELECT $12::uuid WHERE $12 IS NOT NULL),\n ARRAY(SELECT link_id FROM email_draft_client_ids WHERE message_id=$5\n UNION SELECT $2 UNION SELECT $13::uuid WHERE $13 IS NOT NULL))",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Uuid",+ "Uuid",+ "Jsonb",+ "Uuid",+ "Uuid",+ "Timestamptz",+ "Text",+ "Text",+ "Text",+ "Jsonb",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "b9d3465546196d99d8d9fb838929564d3b3a2aa5bbd435d0f0eddd8291957cac"+}diff --git a/.sqlx/query-bad9bae721ab59d9c21b86b10d24d324e5ff56f638df3b3a3f67304a61767d6d.json b/.sqlx/query-bad9bae721ab59d9c21b86b10d24d324e5ff56f638df3b3a3f67304a61767d6d.jsonnew file mode 100644index 0000000000..7df2cd613f--- /dev/null+++ b/.sqlx/query-bad9bae721ab59d9c21b86b10d24d324e5ff56f638df3b3a3f67304a61767d6d.json@@ -0,0 +1,78 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT send_time, sent, processing, actor_id, delivery_claim_id,\n delivery_started_at, delivery_message_id, delivery_status, approved_attachments,\n (send_time <= NOW() AND NOT sent AND delivery_status <> 'failed'\n AND (CASE WHEN processing THEN\n COALESCE(delivery_lease_expires_at, updated_at + make_interval(secs => $3)) <= NOW()\n ELSE delivery_lease_expires_at IS NULL OR delivery_lease_expires_at <= NOW() END)) AS \"available!\"\n FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2 FOR UPDATE",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "send_time",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 1,+ "name": "sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 2,+ "name": "processing",+ "type_info": "Bool"+ },+ {+ "ordinal": 3,+ "name": "actor_id",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "delivery_claim_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 5,+ "name": "delivery_started_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "delivery_message_id",+ "type_info": "Text"+ },+ {+ "ordinal": 7,+ "name": "delivery_status",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "approved_attachments",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 9,+ "name": "available!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Float8"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ true,+ true,+ true,+ true,+ false,+ false,+ null+ ]+ },+ "hash": "bad9bae721ab59d9c21b86b10d24d324e5ff56f638df3b3a3f67304a61767d6d"+}diff --git a/.sqlx/query-bf794fd3cb54d1e926a8ad5e949718eb535a75999b9a3de30908e9a1fa98eaaf.json b/.sqlx/query-bf794fd3cb54d1e926a8ad5e949718eb535a75999b9a3de30908e9a1fa98eaaf.jsonnew file mode 100644index 0000000000..61fb21cb00--- /dev/null+++ b/.sqlx/query-bf794fd3cb54d1e926a8ad5e949718eb535a75999b9a3de30908e9a1fa98eaaf.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "DELETE FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "bf794fd3cb54d1e926a8ad5e949718eb535a75999b9a3de30908e9a1fa98eaaf"+}diff --git a/.sqlx/query-bf7cc96fab146df832304d9eb908dab203c71f056c98705eded826a7318b39b0.json b/.sqlx/query-bf7cc96fab146df832304d9eb908dab203c71f056c98705eded826a7318b39b0.jsonnew file mode 100644index 0000000000..a20fb71aae--- /dev/null+++ b/.sqlx/query-bf7cc96fab146df832304d9eb908dab203c71f056c98705eded826a7318b39b0.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO email_send_attempts (user_id, link_id, attempt_id, cancelled) VALUES ($1, $2, $3, true)\n ON CONFLICT (user_id, link_id, attempt_id) DO UPDATE SET cancelled = true",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "bf7cc96fab146df832304d9eb908dab203c71f056c98705eded826a7318b39b0"+}diff --git a/.sqlx/query-ca3b33a057e344110392552fcefcc9b597c2038f36dcfa90ed8db6b23c41340b.json b/.sqlx/query-ca3b33a057e344110392552fcefcc9b597c2038f36dcfa90ed8db6b23c41340b.jsondeleted file mode 100644index 1d98fa9b5c..0000000000--- a/.sqlx/query-ca3b33a057e344110392552fcefcc9b597c2038f36dcfa90ed8db6b23c41340b.json+++ /dev/null@@ -1,23 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "SELECT a.id AS \"id!\" FROM email_attachments a\n JOIN email_messages m ON m.id=a.message_id WHERE m.id=$1 AND m.link_id=$2\n AND NOT EXISTS(SELECT 1 FROM email_draft_attachment_removals r WHERE r.message_id=m.id AND (r.provider_id=a.provider_attachment_id OR trim(both '<>' from r.content_id)=trim(both '<>' from a.content_id)))\n AND NOT EXISTS(SELECT 1 FROM email_attachments_drafts u WHERE u.draft_id=m.id AND trim(both '<>' from a.content_id)=COALESCE(trim(both '<>' from u.content_id),u.id::text||'@attachments.macro.com'))\n AND NOT EXISTS(SELECT 1 FROM email_attachments_fwd f JOIN email_attachments original ON original.id=f.attachment_id WHERE f.message_id=m.id AND (trim(both '<>' from a.content_id)=trim(both '<>' from original.content_id) OR trim(both '<>' from a.content_id)=f.attachment_id::text||'@attachments.macro.com'))\n UNION SELECT f.attachment_id FROM email_attachments_fwd f JOIN email_messages m ON m.id=f.message_id WHERE m.id=$1 AND m.link_id=$2",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "id!",- "type_info": "Uuid"- }- ],- "parameters": {- "Left": [- "Uuid",- "Uuid"- ]- },- "nullable": [- null- ]- },- "hash": "ca3b33a057e344110392552fcefcc9b597c2038f36dcfa90ed8db6b23c41340b"-}diff --git a/.sqlx/query-ca7f8ef97b3f2ad8866fe75e48817d9d3d852683833b9359e9576a5cbb25a023.json b/.sqlx/query-ca7f8ef97b3f2ad8866fe75e48817d9d3d852683833b9359e9576a5cbb25a023.jsonnew file mode 100644index 0000000000..0d578f35d3--- /dev/null+++ b/.sqlx/query-ca7f8ef97b3f2ad8866fe75e48817d9d3d852683833b9359e9576a5cbb25a023.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT target.id FROM email_thread_client_ids alias\n JOIN email_threads source ON source.id = alias.client_id AND source.link_id = alias.link_id\n JOIN email_threads target ON target.id = alias.thread_id AND target.link_id = source.link_id\n WHERE source.id = $1 AND source.link_id = ANY($2) AND target.id <> source.id\n AND NOT EXISTS(SELECT 1 FROM email_messages WHERE thread_id = source.id)",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "UuidArray"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "ca7f8ef97b3f2ad8866fe75e48817d9d3d852683833b9359e9576a5cbb25a023"+}diff --git a/.sqlx/query-b401a896a9d36c58b2068d611733f5030c82c03957047cf5e49145588ded98a0.json b/.sqlx/query-cbd15cad230869cb36613a0d94aaaaa571124b15daac3b2824314fa50a1d9fb7.jsonsimilarity index 69%rename from .sqlx/query-b401a896a9d36c58b2068d611733f5030c82c03957047cf5e49145588ded98a0.jsonrename to .sqlx/query-cbd15cad230869cb36613a0d94aaaaa571124b15daac3b2824314fa50a1d9fb7.jsonindex 217744e097..e6635071b6 100644--- a/.sqlx/query-b401a896a9d36c58b2068d611733f5030c82c03957047cf5e49145588ded98a0.json+++ b/.sqlx/query-cbd15cad230869cb36613a0d94aaaaa571124b15daac3b2824314fa50a1d9fb7.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "SELECT thread_id, is_draft, is_sent, replying_to_id, body_html_sanitized, body_text FROM email_messages WHERE id = $1 AND link_id = $2 FOR UPDATE",+ "query": "SELECT thread_id, draft_generation, is_draft, is_sent, replying_to_id, body_html_sanitized, body_text FROM email_messages WHERE id = $1 AND link_id = $2 FOR UPDATE","describe": {"columns": [{@@ -10,26 +10,31 @@},{"ordinal": 1,+ "name": "draft_generation",+ "type_info": "Int4"+ },+ {+ "ordinal": 2,"name": "is_draft","type_info": "Bool"},{- "ordinal": 2,+ "ordinal": 3,"name": "is_sent","type_info": "Bool"},{- "ordinal": 3,+ "ordinal": 4,"name": "replying_to_id","type_info": "Uuid"},{- "ordinal": 4,+ "ordinal": 5,"name": "body_html_sanitized","type_info": "Text"},{- "ordinal": 5,+ "ordinal": 6,"name": "body_text","type_info": "Text"}@@ -44,10 +49,11 @@false,false,false,+ false,true,true,true]},- "hash": "b401a896a9d36c58b2068d611733f5030c82c03957047cf5e49145588ded98a0"+ "hash": "cbd15cad230869cb36613a0d94aaaaa571124b15daac3b2824314fa50a1d9fb7"}diff --git a/.sqlx/query-cbe9ae0d3352631c4014d918c8a0da3de2a436368b81d0b12bcbab85a0f36ef2.json b/.sqlx/query-cbe9ae0d3352631c4014d918c8a0da3de2a436368b81d0b12bcbab85a0f36ef2.jsonnew file mode 100644index 0000000000..84016c6296--- /dev/null+++ b/.sqlx/query-cbe9ae0d3352631c4014d918c8a0da3de2a436368b81d0b12bcbab85a0f36ef2.json@@ -0,0 +1,28 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n esm.link_id AS \"link_id!\", esm.message_id AS \"message_id!\"\n FROM email_scheduled_messages esm\n JOIN email_messages em ON em.id = esm.message_id\n WHERE\n esm.send_time < now()\n AND esm.sent = FALSE\n AND em.is_sent = FALSE\n AND esm.delivery_status <> 'failed'\n AND (CASE WHEN esm.processing THEN\n COALESCE(esm.delivery_lease_expires_at, esm.updated_at + make_interval(secs => $1)) <= NOW()\n ELSE esm.delivery_lease_expires_at IS NULL OR esm.delivery_lease_expires_at <= NOW() END)\n AND (em.is_draft OR esm.delivery_claim_id IS NOT NULL OR EXISTS (\n SELECT 1 FROM email_send_attempts a\n WHERE a.link_id = esm.link_id AND a.message_id = esm.message_id AND NOT a.cancelled\n ))\n UNION\n SELECT em.link_id, em.id AS message_id\n FROM email_deferred_message_deletions d\n JOIN email_messages em ON em.id = d.message_id\n WHERE em.draft_generation <> d.draft_generation\n OR em.provider_id IS DISTINCT FROM d.provider_id\n OR NOT EXISTS (\n SELECT 1 FROM email_send_attempts a\n WHERE a.message_id = em.id AND a.link_id = em.link_id\n AND NOT a.cancelled AND NOT a.sent\n )\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "link_id!",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "message_id!",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Float8"+ ]+ },+ "nullable": [+ null,+ null+ ]+ },+ "hash": "cbe9ae0d3352631c4014d918c8a0da3de2a436368b81d0b12bcbab85a0f36ef2"+}diff --git a/.sqlx/query-b4ae2d46f7ff9706d19e08a451d2cde93241c6411c00be4051e4630a5af96eb6.json b/.sqlx/query-cc57aaf8643f10d98dd717c1d66e5bbfc23e69d0bd49997ab0a5eb9d8c44f908.jsonsimilarity index 72%rename from .sqlx/query-b4ae2d46f7ff9706d19e08a451d2cde93241c6411c00be4051e4630a5af96eb6.jsonrename to .sqlx/query-cc57aaf8643f10d98dd717c1d66e5bbfc23e69d0bd49997ab0a5eb9d8c44f908.jsonindex abc77d8b15..3247c016bf 100644--- a/.sqlx/query-b4ae2d46f7ff9706d19e08a451d2cde93241c6411c00be4051e4630a5af96eb6.json+++ b/.sqlx/query-cc57aaf8643f10d98dd717c1d66e5bbfc23e69d0bd49997ab0a5eb9d8c44f908.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n UPDATE email_scheduled_messages\n SET\n processing = false,\n updated_at = NOW()\n WHERE link_id = $1 AND message_id = $2 AND processing AND NOT sent\n ",+ "query": "\n UPDATE email_scheduled_messages\n SET\n processing = false,\n updated_at = NOW()\n WHERE link_id = $1 AND message_id = $2 AND processing AND NOT sent AND delivery_claim_id IS NULL\n ","describe": {"columns": [],"parameters": {@@ -11,5 +11,5 @@},"nullable": []},- "hash": "b4ae2d46f7ff9706d19e08a451d2cde93241c6411c00be4051e4630a5af96eb6"+ "hash": "cc57aaf8643f10d98dd717c1d66e5bbfc23e69d0bd49997ab0a5eb9d8c44f908"}diff --git a/.sqlx/query-ce89ab18aec6745899752b455669d1228673bda3a6ff4ea63ad66fe8d958519f.json b/.sqlx/query-ce89ab18aec6745899752b455669d1228673bda3a6ff4ea63ad66fe8d958519f.jsonnew file mode 100644index 0000000000..37b7681b73--- /dev/null+++ b/.sqlx/query-ce89ab18aec6745899752b455669d1228673bda3a6ff4ea63ad66fe8d958519f.json@@ -0,0 +1,78 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT m.updated_at,m.provider_id,m.thread_id,\n CASE WHEN l.provider='OUTLOOK' THEN COALESCE(d.checkpoint->'draft'->>'version',m.provider_version,d.base_version) ELSE m.provider_history_id END AS version,\n m.is_draft,m.is_sent,\n (COALESCE(d.delete_requested,false) OR EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.source_id=m.id AND t.state<>'preparing')) AS \"retired!\",\n (m.draft_generation <> $3 OR EXISTS(SELECT 1 FROM email_send_attempts a WHERE a.message_id=m.id AND NOT a.cancelled AND NOT a.sent)\n OR EXISTS(SELECT 1 FROM email_scheduled_messages s WHERE s.message_id=m.id)\n OR EXISTS(SELECT 1 FROM email_attachments_drafts a WHERE a.draft_id=m.id AND a.upload_pending)\n OR COALESCE(d.lease_until>now(),false) OR COALESCE(d.state IN ('conflict','unknown'),false)\n OR COALESCE(d.checkpoint->>'stage' NOT IN ('inspect','ready'),false)) AS \"busy!\",\n EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.destination_id=m.id AND t.state NOT IN ('ready','retained')) AS \"predecessor!\",\n jsonb_build_object('db_id',m.id,'thread_db_id',m.thread_id,'subject',COALESCE(m.subject,''),'replying_to_id',m.replying_to_id,\n 'body_text',m.body_text,'body_html',m.body_html_sanitized,'body_macro',m.body_macro,'headers_json',m.headers_jsonb,\n 'to',COALESCE(recipients.to_addresses,'[]'::jsonb),'cc',COALESCE(recipients.cc_addresses,'[]'::jsonb),'bcc',COALESCE(recipients.bcc_addresses,'[]'::jsonb)) AS \"content!\"\n FROM email_messages m JOIN email_links l ON l.id=m.link_id LEFT JOIN email_mailbox_drafts d ON d.message_id=m.id\n CROSS JOIN LATERAL (SELECT jsonb_agg(jsonb_build_object('email',c.email_address,'name',COALESCE(r.name,c.name))) FILTER(WHERE r.recipient_type='TO') AS to_addresses,\n jsonb_agg(jsonb_build_object('email',c.email_address,'name',COALESCE(r.name,c.name))) FILTER(WHERE r.recipient_type='CC') AS cc_addresses,\n jsonb_agg(jsonb_build_object('email',c.email_address,'name',COALESCE(r.name,c.name))) FILTER(WHERE r.recipient_type='BCC') AS bcc_addresses\n FROM email_message_recipients r JOIN email_contacts c ON c.id=r.contact_id WHERE r.message_id=m.id) recipients\n WHERE m.id=$1 AND m.link_id=$2 FOR UPDATE OF m",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 3,+ "name": "version",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 5,+ "name": "is_sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 6,+ "name": "retired!",+ "type_info": "Bool"+ },+ {+ "ordinal": 7,+ "name": "busy!",+ "type_info": "Bool"+ },+ {+ "ordinal": 8,+ "name": "predecessor!",+ "type_info": "Bool"+ },+ {+ "ordinal": 9,+ "name": "content!",+ "type_info": "Jsonb"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Int4"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ null,+ false,+ false,+ null,+ null,+ null,+ null+ ]+ },+ "hash": "ce89ab18aec6745899752b455669d1228673bda3a6ff4ea63ad66fe8d958519f"+}diff --git a/.sqlx/query-2a2a6703037b21130e08903f6065fb0ee2209d1c8dc5d466eb7bc80acfc37431.json b/.sqlx/query-cf692bb824f6a1debcb531fe43ec1318acd76752bf3490272399b23183964701.jsonsimilarity index 88%rename from .sqlx/query-2a2a6703037b21130e08903f6065fb0ee2209d1c8dc5d466eb7bc80acfc37431.jsonrename to .sqlx/query-cf692bb824f6a1debcb531fe43ec1318acd76752bf3490272399b23183964701.jsonindex 5ff2178e91..0fddb6591a 100644--- a/.sqlx/query-2a2a6703037b21130e08903f6065fb0ee2209d1c8dc5d466eb7bc80acfc37431.json+++ b/.sqlx/query-cf692bb824f6a1debcb531fe43ec1318acd76752bf3490272399b23183964701.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "SELECT provider::text AS \"provider!\",sync_generation,\n (macro_id = $2 OR EXISTS (SELECT 1 FROM macro_user_links u WHERE u.link_id = l.id AND u.primary_macro_id = $2)) AS \"authorized!\"\n FROM email_links l WHERE id = $1 FOR UPDATE",+ "query": "SELECT provider::text AS \"provider!\",sync_generation,\n (macro_id = $2 OR EXISTS (SELECT 1 FROM macro_user_links u WHERE u.link_id = l.id AND u.primary_macro_id = $2)) AS \"authorized!\"\n FROM email_links l WHERE id = $1 FOR NO KEY UPDATE","describe": {"columns": [{@@ -31,5 +31,5 @@null]},- "hash": "2a2a6703037b21130e08903f6065fb0ee2209d1c8dc5d466eb7bc80acfc37431"+ "hash": "cf692bb824f6a1debcb531fe43ec1318acd76752bf3490272399b23183964701"}diff --git a/.sqlx/query-9d18e2de7155b4ccff96e94d488a0366815105394ee53dbf7e6c6a351dbdc66f.json b/.sqlx/query-cfa2888a5031e84835839d854a59e7a78e5b2797f1582c3570157adfc3d4f09b.jsonsimilarity index 69%rename from .sqlx/query-9d18e2de7155b4ccff96e94d488a0366815105394ee53dbf7e6c6a351dbdc66f.jsonrename to .sqlx/query-cfa2888a5031e84835839d854a59e7a78e5b2797f1582c3570157adfc3d4f09b.jsonindex 55791933b1..f7d01e40de 100644--- a/.sqlx/query-9d18e2de7155b4ccff96e94d488a0366815105394ee53dbf7e6c6a351dbdc66f.json+++ b/.sqlx/query-cfa2888a5031e84835839d854a59e7a78e5b2797f1582c3570157adfc3d4f09b.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n UPDATE email_scheduled_messages\n SET\n sent = true,\n processing = false,\n updated_at = NOW()\n WHERE link_id = $1 AND message_id = $2 AND processing AND NOT sent\n ",+ "query": "\n UPDATE email_scheduled_messages\n SET\n sent = true,\n processing = false,\n updated_at = NOW()\n WHERE link_id = $1 AND message_id = $2 AND processing AND NOT sent AND delivery_claim_id IS NULL\n ","describe": {"columns": [],"parameters": {@@ -11,5 +11,5 @@},"nullable": []},- "hash": "9d18e2de7155b4ccff96e94d488a0366815105394ee53dbf7e6c6a351dbdc66f"+ "hash": "cfa2888a5031e84835839d854a59e7a78e5b2797f1582c3570157adfc3d4f09b"}diff --git a/.sqlx/query-d023b1625ec0e058eaa859db063218126d72694c160006f33cf70f4e8a27942e.json b/.sqlx/query-d023b1625ec0e058eaa859db063218126d72694c160006f33cf70f4e8a27942e.jsonnew file mode 100644index 0000000000..da1b20df72--- /dev/null+++ b/.sqlx/query-d023b1625ec0e058eaa859db063218126d72694c160006f33cf70f4e8a27942e.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_messages SET draft_generation = draft_generation + 1 WHERE id = $1 AND link_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "d023b1625ec0e058eaa859db063218126d72694c160006f33cf70f4e8a27942e"+}diff --git a/.sqlx/query-d436671bbff9ba43b4d162af10e1d0f57bfec50cbac105c4e2caf00bd15c6d50.json b/.sqlx/query-d436671bbff9ba43b4d162af10e1d0f57bfec50cbac105c4e2caf00bd15c6d50.jsonnew file mode 100644index 0000000000..ed6cd1df5f--- /dev/null+++ b/.sqlx/query-d436671bbff9ba43b4d162af10e1d0f57bfec50cbac105c4e2caf00bd15c6d50.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_attachments SET message_id = $1 WHERE message_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "d436671bbff9ba43b4d162af10e1d0f57bfec50cbac105c4e2caf00bd15c6d50"+}diff --git a/.sqlx/query-d5cd971d0d36fa95b67c7d7da471e3b0527ecc96bdb539d2d7e7606251463951.json b/.sqlx/query-d5cd971d0d36fa95b67c7d7da471e3b0527ecc96bdb539d2d7e7606251463951.jsonnew file mode 100644index 0000000000..05293a1ece--- /dev/null+++ b/.sqlx/query-d5cd971d0d36fa95b67c7d7da471e3b0527ecc96bdb539d2d7e7606251463951.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH editable AS (\n -- Sent rows are used by the worker's post-delivery cleanup.\n SELECT id FROM email_messages\n WHERE id = $2 AND link_id = $3 AND (is_draft OR is_sent)\n FOR UPDATE\n )\n DELETE FROM email_attachments_drafts ead\n USING editable m\n WHERE ead.draft_id = m.id AND ead.id = $1\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "d5cd971d0d36fa95b67c7d7da471e3b0527ecc96bdb539d2d7e7606251463951"+}diff --git a/.sqlx/query-d6fc42cb77b6d8b7ba923084e3493db02c8adc882fb8e6fe51c5925ffa5035ac.json b/.sqlx/query-d6fc42cb77b6d8b7ba923084e3493db02c8adc882fb8e6fe51c5925ffa5035ac.jsonnew file mode 100644index 0000000000..66cbcd7092--- /dev/null+++ b/.sqlx/query-d6fc42cb77b6d8b7ba923084e3493db02c8adc882fb8e6fe51c5925ffa5035ac.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_send_attempts SET thread_id = $3 WHERE message_id = $1 AND link_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "d6fc42cb77b6d8b7ba923084e3493db02c8adc882fb8e6fe51c5925ffa5035ac"+}diff --git a/.sqlx/query-db987b7728fbbda9a755a9b4ddfa98cc493538cd0907c9d5a983ae690516e59a.json b/.sqlx/query-db987b7728fbbda9a755a9b4ddfa98cc493538cd0907c9d5a983ae690516e59a.jsonnew file mode 100644index 0000000000..e8e769cf92--- /dev/null+++ b/.sqlx/query-db987b7728fbbda9a755a9b4ddfa98cc493538cd0907c9d5a983ae690516e59a.json@@ -0,0 +1,168 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n draft_generation, id, provider_id, thread_id, provider_thread_id, replying_to_id,\n global_id, link_id, provider_history_id, internal_date_ts, snippet,\n size_estimate, subject, sent_at, has_attachments, is_read, is_starred,\n is_sent, is_draft, body_text, body_html_sanitized, body_macro,\n headers_jsonb, created_at, updated_at\n FROM email_messages\n WHERE thread_id = $1\n ORDER BY COALESCE(internal_date_ts, sent_at, created_at) DESC, id DESC\n LIMIT $2 OFFSET $3\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "draft_generation",+ "type_info": "Int4"+ },+ {+ "ordinal": 1,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 4,+ "name": "provider_thread_id",+ "type_info": "Text"+ },+ {+ "ordinal": 5,+ "name": "replying_to_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 6,+ "name": "global_id",+ "type_info": "Text"+ },+ {+ "ordinal": 7,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 8,+ "name": "provider_history_id",+ "type_info": "Text"+ },+ {+ "ordinal": 9,+ "name": "internal_date_ts",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 10,+ "name": "snippet",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "size_estimate",+ "type_info": "Int8"+ },+ {+ "ordinal": 12,+ "name": "subject",+ "type_info": "Text"+ },+ {+ "ordinal": 13,+ "name": "sent_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 14,+ "name": "has_attachments",+ "type_info": "Bool"+ },+ {+ "ordinal": 15,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 16,+ "name": "is_starred",+ "type_info": "Bool"+ },+ {+ "ordinal": 17,+ "name": "is_sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 18,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 19,+ "name": "body_text",+ "type_info": "Text"+ },+ {+ "ordinal": 20,+ "name": "body_html_sanitized",+ "type_info": "Text"+ },+ {+ "ordinal": 21,+ "name": "body_macro",+ "type_info": "Text"+ },+ {+ "ordinal": 22,+ "name": "headers_jsonb",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 23,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 24,+ "name": "updated_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int8",+ "Int8"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ false,+ true,+ true,+ true,+ false,+ true,+ true,+ true,+ true,+ true,+ true,+ false,+ false,+ false,+ false,+ false,+ true,+ true,+ true,+ true,+ false,+ false+ ]+ },+ "hash": "db987b7728fbbda9a755a9b4ddfa98cc493538cd0907c9d5a983ae690516e59a"+}diff --git a/.sqlx/query-e016d0f8696a123adb021d10da5d5f62e654c0700e75a2aa1390cad9e388cb9c.json b/.sqlx/query-e016d0f8696a123adb021d10da5d5f62e654c0700e75a2aa1390cad9e388cb9c.jsondeleted file mode 100644index 882ee647e7..0000000000--- a/.sqlx/query-e016d0f8696a123adb021d10da5d5f62e654c0700e75a2aa1390cad9e388cb9c.json+++ /dev/null@@ -1,33 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n INSERT INTO email_messages (\n id, provider_id, link_id, thread_id, provider_thread_id,\n replying_to_id, subject, from_contact_id, sent_at,\n has_attachments, is_read, is_starred, is_sent, is_draft,\n body_text, body_html_sanitized, body_macro, headers_jsonb,\n created_at, updated_at\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)\n ON CONFLICT (id) DO UPDATE SET\n provider_id = COALESCE(email_messages.provider_id, EXCLUDED.provider_id),\n thread_id = EXCLUDED.thread_id,\n provider_thread_id = COALESCE(email_messages.provider_thread_id, EXCLUDED.provider_thread_id),\n replying_to_id = EXCLUDED.replying_to_id,\n subject = EXCLUDED.subject,\n from_contact_id = EXCLUDED.from_contact_id,\n sent_at = EXCLUDED.sent_at,\n is_read = EXCLUDED.is_read,\n is_starred = EXCLUDED.is_starred,\n is_sent = EXCLUDED.is_sent,\n is_draft = EXCLUDED.is_draft,\n body_text = EXCLUDED.body_text,\n body_html_sanitized = EXCLUDED.body_html_sanitized,\n body_macro = EXCLUDED.body_macro,\n headers_jsonb = EXCLUDED.headers_jsonb,\n updated_at = NOW()\n WHERE email_messages.link_id = EXCLUDED.link_id\n AND email_messages.is_draft AND NOT email_messages.is_sent\n AND NOT EXISTS (SELECT 1 FROM email_mailbox_drafts d WHERE d.message_id = EXCLUDED.id AND d.delete_requested)\n AND NOT EXISTS (SELECT 1 FROM email_scheduled_messages WHERE message_id = EXCLUDED.id AND link_id = EXCLUDED.link_id)\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid",- "Text",- "Uuid",- "Uuid",- "Text",- "Uuid",- "Text",- "Uuid",- "Timestamptz",- "Bool",- "Bool",- "Bool",- "Bool",- "Bool",- "Text",- "Text",- "Text",- "Jsonb",- "Timestamptz",- "Timestamptz"- ]- },- "nullable": []- },- "hash": "e016d0f8696a123adb021d10da5d5f62e654c0700e75a2aa1390cad9e388cb9c"-}diff --git a/.sqlx/query-e3533359b90acc70b380fb62ad89ba302f4f8be5937c6e3caa53db42a5e29bbf.json b/.sqlx/query-e3533359b90acc70b380fb62ad89ba302f4f8be5937c6e3caa53db42a5e29bbf.jsonnew file mode 100644index 0000000000..054e8b7103--- /dev/null+++ b/.sqlx/query-e3533359b90acc70b380fb62ad89ba302f4f8be5937c6e3caa53db42a5e29bbf.json@@ -0,0 +1,47 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT sent, processing, delivery_status, delivery_started_at, delivery_claim_id FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2 FOR UPDATE",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 1,+ "name": "processing",+ "type_info": "Bool"+ },+ {+ "ordinal": 2,+ "name": "delivery_status",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "delivery_started_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 4,+ "name": "delivery_claim_id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ true,+ true+ ]+ },+ "hash": "e3533359b90acc70b380fb62ad89ba302f4f8be5937c6e3caa53db42a5e29bbf"+}diff --git a/.sqlx/query-ebc750455d2e0ed762f338314132d16d06b46c1417adff666448143afb522fa9.json b/.sqlx/query-ebc750455d2e0ed762f338314132d16d06b46c1417adff666448143afb522fa9.jsonnew file mode 100644index 0000000000..fcdabaac08--- /dev/null+++ b/.sqlx/query-ebc750455d2e0ed762f338314132d16d06b46c1417adff666448143afb522fa9.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH editable AS (\n SELECT id FROM email_messages\n WHERE id = $1 AND link_id = $3 AND is_draft AND NOT is_sent\n FOR UPDATE\n )\n INSERT INTO email_attachments_fwd (message_id, attachment_id)\n SELECT $1, $2\n FROM editable\n ON CONFLICT DO NOTHING\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "ebc750455d2e0ed762f338314132d16d06b46c1417adff666448143afb522fa9"+}diff --git a/.sqlx/query-ebcb56d94bbb9e2ddf7ba350cd64a34824645b9faddb60c41289f96274d68880.json b/.sqlx/query-ebcb56d94bbb9e2ddf7ba350cd64a34824645b9faddb60c41289f96274d68880.jsonnew file mode 100644index 0000000000..6929158991--- /dev/null+++ b/.sqlx/query-ebcb56d94bbb9e2ddf7ba350cd64a34824645b9faddb60c41289f96274d68880.json@@ -0,0 +1,46 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT link_id, draft_generation, is_sent, is_draft, (EXISTS (SELECT 1 FROM email_mailbox_drafts d WHERE d.message_id = email_messages.id AND d.delete_requested) OR EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.source_id=email_messages.id AND t.state<>'preparing')) AS \"deleted!\" FROM email_messages WHERE id = $1 FOR UPDATE",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "draft_generation",+ "type_info": "Int4"+ },+ {+ "ordinal": 2,+ "name": "is_sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 3,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "deleted!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ null+ ]+ },+ "hash": "ebcb56d94bbb9e2ddf7ba350cd64a34824645b9faddb60c41289f96274d68880"+}diff --git a/.sqlx/query-e309f7cc887923bdbe851bc60f96903c444ab809b1f90f15414329969dbbdce3.json b/.sqlx/query-ed593bddcc4661e7da5d24e43ba7c33377733274b71a50ecfbdf407d21d58af2.jsonsimilarity index 63%rename from .sqlx/query-e309f7cc887923bdbe851bc60f96903c444ab809b1f90f15414329969dbbdce3.jsonrename to .sqlx/query-ed593bddcc4661e7da5d24e43ba7c33377733274b71a50ecfbdf407d21d58af2.jsonindex 29a80437a7..53a390d857 100644--- a/.sqlx/query-e309f7cc887923bdbe851bc60f96903c444ab809b1f90f15414329969dbbdce3.json+++ b/.sqlx/query-ed593bddcc4661e7da5d24e43ba7c33377733274b71a50ecfbdf407d21d58af2.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n UPDATE email_scheduled_messages\n SET processing = true, updated_at = NOW()\n WHERE link_id = $1 AND message_id = $2\n AND NOT sent AND NOT processing AND send_time <= NOW()\n AND NOT EXISTS(SELECT 1 FROM email_attachments_drafts WHERE draft_id=$2 AND upload_pending)\n AND NOT EXISTS(SELECT 1 FROM email_draft_transfers WHERE (destination_id=$2 AND state NOT IN ('ready','retained','preparing')) OR (source_id=$2 AND state<>'preparing'))\n RETURNING link_id, message_id, send_time, sent, processing, actor_id\n ",+ "query": "\n UPDATE email_scheduled_messages\n SET processing = true, updated_at = NOW()\n WHERE link_id = $1 AND message_id = $2\n AND NOT sent AND NOT processing AND send_time <= NOW()\n AND delivery_claim_id IS NULL AND delivery_started_at IS NULL AND delivery_status = 'ready'\n AND NOT EXISTS(SELECT 1 FROM email_attachments_drafts WHERE draft_id=$2 AND upload_pending)\n AND NOT EXISTS(SELECT 1 FROM email_draft_transfers WHERE (destination_id=$2 AND state NOT IN ('ready','retained','preparing')) OR (source_id=$2 AND state<>'preparing'))\n RETURNING link_id, message_id, send_time, sent, processing, actor_id\n ","describe": {"columns": [{@@ -49,5 +49,5 @@true]},- "hash": "e309f7cc887923bdbe851bc60f96903c444ab809b1f90f15414329969dbbdce3"+ "hash": "ed593bddcc4661e7da5d24e43ba7c33377733274b71a50ecfbdf407d21d58af2"}diff --git a/.sqlx/query-ef940739abcdd136e97b1b931bde0a0d8bc4171a419d748dcffca7baec8c9a40.json b/.sqlx/query-ef940739abcdd136e97b1b931bde0a0d8bc4171a419d748dcffca7baec8c9a40.jsonnew file mode 100644index 0000000000..8304715d67--- /dev/null+++ b/.sqlx/query-ef940739abcdd136e97b1b931bde0a0d8bc4171a419d748dcffca7baec8c9a40.json@@ -0,0 +1,41 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT thread_id, provider_id, draft_generation, is_draft FROM email_messages WHERE id=$1 AND link_id=$2 FOR UPDATE",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "draft_generation",+ "type_info": "Int4"+ },+ {+ "ordinal": 3,+ "name": "is_draft",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ false+ ]+ },+ "hash": "ef940739abcdd136e97b1b931bde0a0d8bc4171a419d748dcffca7baec8c9a40"+}diff --git a/.sqlx/query-f3da46717963b1f2baced16a495b9b5282b48a6dbddda39c880e10090d113b76.json b/.sqlx/query-f3da46717963b1f2baced16a495b9b5282b48a6dbddda39c880e10090d113b76.jsonnew file mode 100644index 0000000000..fc5609d965--- /dev/null+++ b/.sqlx/query-f3da46717963b1f2baced16a495b9b5282b48a6dbddda39c880e10090d113b76.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT (EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id=$1 AND link_id=$2) OR EXISTS(SELECT 1 FROM email_send_attempts WHERE message_id=$1 AND link_id=$2 AND NOT cancelled AND NOT sent)) AS \"exists!\"",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "exists!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "f3da46717963b1f2baced16a495b9b5282b48a6dbddda39c880e10090d113b76"+}diff --git a/.sqlx/query-f61e5ffbf5f10d3989640c3f1b70bbe79c9e1b2e6d2e6925bdf89df1a07ead5d.json b/.sqlx/query-f61e5ffbf5f10d3989640c3f1b70bbe79c9e1b2e6d2e6925bdf89df1a07ead5d.jsondeleted file mode 100644index b75c335b28..0000000000--- a/.sqlx/query-f61e5ffbf5f10d3989640c3f1b70bbe79c9e1b2e6d2e6925bdf89df1a07ead5d.json+++ /dev/null@@ -1,16 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n DELETE FROM email_attachments_fwd eaf\n USING email_messages m\n WHERE eaf.message_id = m.id\n AND eaf.message_id = $1 AND eaf.attachment_id = $2 AND m.link_id = $3\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid",- "Uuid",- "Uuid"- ]- },- "nullable": []- },- "hash": "f61e5ffbf5f10d3989640c3f1b70bbe79c9e1b2e6d2e6925bdf89df1a07ead5d"-}diff --git a/.sqlx/query-f91a7963ecfdfc6940be755ad615f71034bc0c6c5fc57ee6e1a794f929488115.json b/.sqlx/query-f91a7963ecfdfc6940be755ad615f71034bc0c6c5fc57ee6e1a794f929488115.jsonnew file mode 100644index 0000000000..a1ed7be5ed--- /dev/null+++ b/.sqlx/query-f91a7963ecfdfc6940be755ad615f71034bc0c6c5fc57ee6e1a794f929488115.json@@ -0,0 +1,21 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH editable AS (\n SELECT id FROM email_messages\n WHERE id = $2 AND link_id = $8 AND is_draft AND NOT is_sent\n FOR UPDATE\n )\n INSERT INTO email_attachments_drafts (\n id, draft_id, file_name, content_type, sha, size, s3_key\n )\n -- if the message belongs to a different link_id, nothing will be returned from this\n -- and thus nothing will be inserted\n SELECT $1, $2, $3, $4, $5, $6, $7\n FROM editable\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Text",+ "Text",+ "Text",+ "Int4",+ "Text",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "f91a7963ecfdfc6940be755ad615f71034bc0c6c5fc57ee6e1a794f929488115"+}diff --git a/.sqlx/query-f942ff57aa734a1a01e1323e0e886b3128f1a00405b4dc675b5fa0fa3a2713e4.json b/.sqlx/query-f942ff57aa734a1a01e1323e0e886b3128f1a00405b4dc675b5fa0fa3a2713e4.jsonnew file mode 100644index 0000000000..1ed1af69a8--- /dev/null+++ b/.sqlx/query-f942ff57aa734a1a01e1323e0e886b3128f1a00405b4dc675b5fa0fa3a2713e4.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT id FROM email_links WHERE id = $1 AND provider = 'OUTLOOK' FOR UPDATE",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "f942ff57aa734a1a01e1323e0e886b3128f1a00405b4dc675b5fa0fa3a2713e4"+}diff --git a/.sqlx/query-fb1028e6b42b5d0fb8074db94c5a28060a7cf1e65ab37aa1ebc678b45e42bc3d.json b/.sqlx/query-fb1028e6b42b5d0fb8074db94c5a28060a7cf1e65ab37aa1ebc678b45e42bc3d.jsonnew file mode 100644index 0000000000..7f80afe3aa--- /dev/null+++ b/.sqlx/query-fb1028e6b42b5d0fb8074db94c5a28060a7cf1e65ab37aa1ebc678b45e42bc3d.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE email_messages m SET is_draft = true, draft_generation = m.draft_generation + 1, body_html_sanitized = a.restore_body_html,\n body_text = a.restore_body_text, body_macro = a.restore_body_macro, updated_at = NOW()\n FROM email_send_attempts a WHERE a.user_id = $1 AND a.link_id = $2 AND a.attempt_id = $3\n AND m.id = a.message_id AND m.link_id = a.link_id AND NOT m.is_sent",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "fb1028e6b42b5d0fb8074db94c5a28060a7cf1e65ab37aa1ebc678b45e42bc3d"+}diff --git a/.sqlx/query-f3e09de8f4ad7935f854a301671166d3158463023632e571fcc590fc36b1a5ed.json b/.sqlx/query-fcb3b252b4f2b1458e175ba5be17f8faba8d524df91839d67bb0ff170f72e8f6.jsonsimilarity index 51%rename from .sqlx/query-f3e09de8f4ad7935f854a301671166d3158463023632e571fcc590fc36b1a5ed.jsonrename to .sqlx/query-fcb3b252b4f2b1458e175ba5be17f8faba8d524df91839d67bb0ff170f72e8f6.jsonindex 467ea7a07f..c37c5127f7 100644--- a/.sqlx/query-f3e09de8f4ad7935f854a301671166d3158463023632e571fcc590fc36b1a5ed.json+++ b/.sqlx/query-fcb3b252b4f2b1458e175ba5be17f8faba8d524df91839d67bb0ff170f72e8f6.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "SELECT thread_id,is_draft,is_sent,\n EXISTS (SELECT 1 FROM email_scheduled_messages s WHERE s.message_id = m.id) AS \"scheduled!\",\n (EXISTS (SELECT 1 FROM email_mailbox_drafts d WHERE d.message_id = m.id AND d.delete_requested) OR EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.source_id=m.id AND t.state<>'preparing')) AS \"deleted!\"\n FROM email_messages m WHERE id = $1 AND link_id = $2 FOR UPDATE",+ "query": "SELECT thread_id,draft_generation,is_draft,is_sent,\n (EXISTS (SELECT 1 FROM email_mailbox_drafts d WHERE d.message_id = m.id AND d.delete_requested) OR EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.source_id=m.id AND t.state<>'preparing')) AS \"deleted!\"\n FROM email_messages m WHERE id = $1 AND link_id = $2 FOR UPDATE","describe": {"columns": [{@@ -10,17 +10,17 @@},{"ordinal": 1,- "name": "is_draft",- "type_info": "Bool"+ "name": "draft_generation",+ "type_info": "Int4"},{"ordinal": 2,- "name": "is_sent",+ "name": "is_draft","type_info": "Bool"},{"ordinal": 3,- "name": "scheduled!",+ "name": "is_sent","type_info": "Bool"},{@@ -39,9 +39,9 @@false,false,false,- null,+ false,null]},- "hash": "f3e09de8f4ad7935f854a301671166d3158463023632e571fcc590fc36b1a5ed"+ "hash": "fcb3b252b4f2b1458e175ba5be17f8faba8d524df91839d67bb0ff170f72e8f6"}diff --git a/Cargo.lock b/Cargo.lockindex 2599f29613..0e49334e0e 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -3644,7 +3644,7 @@ dependencies = [[[package]]name = "cache-wasm"-version = "0.6.49"+version = "0.6.52"dependencies = ["async-lock","cache-core",@@ -7272,6 +7272,8 @@ dependencies = ["aws-sdk-sqs","aws_lambda_events","chrono",+ "email",+ "futures","lambda_runtime","macro_aws_config","macro_db_migrator",diff --git a/Cargo.toml b/Cargo.tomlindex ef19e51ce2..444d3a9d32 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -351,7 +351,7 @@ rustix = { version = "1", default-features = false, features = ["process", "std"rootcause-tracing = "0.12.1"schemars = { version = "1.0.4", features = ["chrono04", "uuid1"] }semver = { version = "1", features = ["serde"] }-ruzstd = { version = "0.9", default-features = false, features = ["std"] }+ruzstd = { version = "0.9.1", default-features = false, features = ["std"] }serde = { version = "1.0.214", features = ["derive"] }serde-wasm-bindgen = "0.6"serde_dynamo = { version = "4", features = ["aws-sdk-dynamodb+1"] }diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex 8deb0b4219..054126d555 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -91,6 +91,7 @@ without changing the active route. Backend registration still verifies accountownership. Cancel, logout, and the ten-minute timeout retire pending callbacks.### General+- Email draft reads compare server generations before choosing cached delivery state over a restored working copy; only a definitive first-submission rejection permits local send recovery without server cancellation.- Compose settings pages with `features/settings/primitives.tsx` so section headings,raised composer cards, row spacing, and control shapes stay consistent; keepIntegrations on the shared page width and side padding.@@ -158,6 +159,9 @@ ownership. Cancel, logout, and the ten-minute timeout retire pending callbacks.tokens out of telemetry. See [call diagnostics](../../docs/agent-guide/calls.md#browser-call-diagnostics).- Keep desktop Gmail and Outlook inbox consent in the system browser with a`macro:///inbox-link-callback` return; webview origins are not desktop callbacks.+- Keep send reservations, leases, and cancellation in the email journal; the general GraphQL queue handles draft autosaves only.+- Always persist composer sends in account-scoped IndexedDB and dispatch through the fetch-only email client, without a feature flag; cache health and unrelated mutation queues must not gate delivery. See `docs/architecture/email.md` for state and rollout invariants.+- Retry cache bootstrap on reconnect/foreground or draft Retry only when storage was proven untouched; retain the same scope and block draft sync until the replacement queue is readable.- Touch email replies and forwards use the full-screen composer with the shared new-email header actions; preserve thread state underneath and flush local edits before closing.- Draft autosaves preserve active email thread messages; evict inactive legacycaches on save and the active cache on thread exit. Revalidate GraphQL threaddiff --git a/apps/web/docs/graphql-normalized-cache-plan.md b/apps/web/docs/graphql-normalized-cache-plan.mdindex d8eb70577e..e38c34a9fb 100644--- a/apps/web/docs/graphql-normalized-cache-plan.md+++ b/apps/web/docs/graphql-normalized-cache-plan.md@@ -240,7 +240,13 @@ registration gets sixty seconds per attempt, with three attempts; engine recoverretains its bounded five retries. Exhausted bootstrap retries preserve the cachescope only when the coordinator explicitly proves storage was untouched, not froma page's last-seen phase. Missing/broken transports remain conservatively-uncertain.+uncertain. Pages retry proven untouched bootstrap and owner-lock failures on reconnect,+foregrounding, or explicit draft Retry, with jittered exponential backoff capped+at thirty seconds. A newly registered host restarts an exhausted untouched+coordinator at a new owner epoch with `open-existing`; failed hosts remain+excluded. Draft writes stay blocked until the replacement opens and inspects+the preserved mutation queue. Unknown storage failures still require explicit+recovery or an update; retry never rotates the scope or clears persisted data.A build's coordinator has its build time in the SharedWorker name, so buildsuse separate coordinators even when their coordinator script URL is identical.@@ -641,6 +647,11 @@ from the prediction keep their cached values on existing entities. Nestedresponse keys come from the representative, so a document that selects a fieldunder a different alias does not receive that field's predicted value.+Email sends use the independent email working-copy database and fetch-only+GraphQL client. The cache queue holds draft autosaves and ordinary mutations;+it does not persist, dispatch, or cancel sends. The email dispatcher owns send+leases and recovery, including when no composer is mounted.+The durable optimistic queue owns ordering, retries, commit and rollback. Thequery author supplies no optimistic callbacks, result traversal or cache writes.Both the list and a detail query for that thread observe the same effective@@ -754,7 +765,8 @@ a supported filter plus created/updated sort, their combined server membershipis the baseline for the same predicate adapter used by flat Soup. Selectednormalized rows then derive date, project and property memberships (includingmulti-value and scoped property joins); entity-type bins retain their invariant-server keys. Missing grouping evidence retains the old membership. When local selection is+server keys. Missing grouping evidence or an unrecognized grouping field retains+the old membership. When local selection isincomplete, display fields come from current merged server pages before fallingback to the original evidence; current page fields do not rebase membership orcount evidence. Unsupporteddiff --git a/apps/web/src/features/block-email/EmailThreadHostView.tsx b/apps/web/src/features/block-email/EmailThreadHostView.tsxindex 93e9dcedcc..3861e9cc29 100644--- a/apps/web/src/features/block-email/EmailThreadHostView.tsx+++ b/apps/web/src/features/block-email/EmailThreadHostView.tsx@@ -15,6 +15,7 @@ import { fireAndForget } from '@core/util/fireAndForget';import { buildMentionMarkdownString } from '@macro-inc/lexical-core';import type { Accessor, JSX } from 'solid-js';import { Show } from 'solid-js';+import { QueuedSendStatus } from '../email-compose/queued-send-status';import { EmailTaskButton } from './component/EmailTaskButton';import { EmailSidePanelSections } from './component/sidepanel/EmailSidePanelSections';@@ -70,6 +71,7 @@ export function EmailThreadHostView(props: EmailThreadHostViewProps) {frame={(content) => (<>{props.chrome?.({ createTask })}+ <QueuedSendStatus threadId={props.threadId()} /><SidePanel.LayoutfloatingdefaultOpen={false}diff --git a/apps/web/src/features/email-compose/browser-test/fixture.tsx b/apps/web/src/features/email-compose/browser-test/fixture.tsxindex 05622a95eb..6c5ee18084 100644--- a/apps/web/src/features/email-compose/browser-test/fixture.tsx+++ b/apps/web/src/features/email-compose/browser-test/fixture.tsx@@ -22,6 +22,7 @@ import { CalendarReplacementFixture } from './calendar-replacement-fixture';import { DraftOwnerFixture } from './draft-owner-fixture';import { DraftRecoveryFixture } from './draft-recovery-fixture';import { OutlookRecoveryFixture } from './outlook-recovery-fixture';+import { ScheduleRecoveryFixture } from './schedule-recovery-fixture';import { SenderFixture } from './sender-fixture';type ScheduledItem = {@@ -348,6 +349,8 @@ render(<DraftOwnerFixture />) : new URLSearchParams(location.search).has('recovery') ? (<DraftRecoveryFixture />+ ) : new URLSearchParams(location.search).has('scheduled-recovery') ? (+ <ScheduleRecoveryFixture />) : new URLSearchParams(location.search).has('android-back') ? (<AndroidBackFixture />) : (diff --git a/apps/web/src/features/email-compose/browser-test/outbox-fixture.tsx b/apps/web/src/features/email-compose/browser-test/outbox-fixture.tsxnew file mode 100644index 0000000000..7885dea1da--- /dev/null+++ b/apps/web/src/features/email-compose/browser-test/outbox-fixture.tsx@@ -0,0 +1,178 @@+import { createEmailSendDispatcher } from '@queries/email/email-send-dispatcher';+import { createLocalDraftStore } from '@queries/email/local-draft-store';+import type { EmailSendIntent } from '@queries/email/send-intent';+import type { EmailSendAttemptFieldsFragment } from '@service-storage/graphql/generated/graphql';+import { CombinedError } from '@urql/core';+import { createSignal, onCleanup, onMount } from 'solid-js';+import { render } from 'solid-js/web';++/** Real browser journal and dispatcher; only provider HTTP is replaced. No cache exists. */+function OutboxFixture() {+ const journal = createLocalDraftStore('email-outbox-browser');+ const [rows, setRows] = createSignal<EmailSendIntent[]>([]);+ const [ready, setReady] = createSignal(false);+ const [error, setError] = createSignal('');+ const [restored, setRestored] = createSignal('');+ let session: Awaited<ReturnType<typeof journal.activate>>;+ let dispatcher: ReturnType<typeof createEmailSendDispatcher> | undefined;+ const refresh = async () => {+ setRows(await journal.sends(session));+ };+ const request = async (+ operation: string,+ row: EmailSendIntent,+ signal: AbortSignal+ ) => {+ const response = await fetch(`/test-email/${operation}`, {+ method: 'POST',+ signal,+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify(row.metadata.payload.input),+ });+ if (response.status === 403)+ throw new CombinedError({+ graphQLErrors: [+ {+ message: 'Inbox unavailable',+ extensions: { code: 'INBOX_NOT_FOUND' },+ path: ['sendEmailMessage'],+ },+ ],+ });+ if (!response.ok) throw new Error('Network unavailable');+ return (await response.json()) as EmailSendAttemptFieldsFragment | null;+ };+ const start = () => {+ dispatcher = createEmailSendDispatcher({+ session,+ journal,+ submit: async (row, signal) => {+ const result = await request('submit', row, signal);+ if (!result) throw new Error('Missing acceptance');+ return result;+ },+ cancel: async (row, signal) => {+ const result = await request('cancel', row, signal);+ if (!result) throw new Error('Missing cancellation');+ return result;+ },+ status: (row, signal) => request('status', row, signal),+ report: () => {},+ });+ };+ const persist = async () => {+ try {+ const uuid = crypto.randomUUID();+ const draftId = crypto.randomUUID();+ await journal.putSend(+ session,+ {+ uuid,+ dispatchVersion: 2,+ phase: 'pending',+ locallyCancelled: false,+ metadata: {+ kind: 'email-send-v1',+ payload: {+ input: {+ attachmentIds: [],+ forwardedAttachmentIds: [],+ attempt: { attemptId: uuid, linkId: 'inbox' },+ message: {+ draftId,+ subject: 'Approved subject',+ bodyText: 'Frozen message',+ },+ },+ draft: {+ draftId,+ threadDbId: 'thread',+ subject: 'Approved subject',+ senderEmail: '[email protected]',+ senderLinkId: 'inbox',+ optimisticBodyHtml: null,+ bodyText: 'Frozen message',+ },+ },+ },+ },+ true+ );+ await refresh();+ } catch (failure) {+ setError(String(failure));+ }+ };+ onMount(() => {+ (async () => {+ session = await journal.activate('owner');+ await refresh();+ start();+ setReady(true);+ })().catch((failure) => setError(String(failure)));+ });+ const unsubscribe = journal.subscribe(() => {+ if (session) refresh().catch((failure) => setError(String(failure)));+ });+ onCleanup(() => {+ dispatcher?.dispose();+ unsubscribe();+ journal.close().catch((failure) => setError(String(failure)));+ });+ return (+ <main>+ <h1>Email outbox</h1>+ <button disabled={!ready()} onClick={persist}>+ Send frozen message+ </button>+ <button+ disabled={!ready()}+ onClick={async () => {+ dispatcher?.dispose();+ await journal.clear(true, session.epoch);+ session = await journal.activate('other');+ await refresh();+ start();+ }}+ >+ Switch account+ </button>+ <button+ disabled={!ready()}+ onClick={async () => {+ dispatcher?.dispose();+ session = await journal.activate('owner', crypto.randomUUID());+ await refresh();+ start();+ }}+ >+ Return to owner+ </button>+ <output data-testid="rows">{JSON.stringify(rows())}</output>+ <button+ disabled={+ !rows().some(+ (row) =>+ row.locallyCancelled && !row.metadata.requiresServerConfirmation+ )+ }+ onClick={async () => {+ const row = rows().find((row) => row.locallyCancelled);+ if (!row) return;+ try {+ const result = await journal.restoreSend(session, row.uuid);+ setRestored(result?.draft.content.body_text ?? '');+ await refresh();+ } catch (failure) {+ setError(String(failure));+ }+ }}+ >+ Restore draft+ </button>+ <output data-testid="restored">{restored()}</output>+ <output data-testid="error">{error()}</output>+ </main>+ );+}+render(() => <OutboxFixture />, document.getElementById('root')!);diff --git a/apps/web/src/features/email-compose/browser-test/outbox.browser.e2e.ts b/apps/web/src/features/email-compose/browser-test/outbox.browser.e2e.tsnew file mode 100644index 0000000000..db6c972a69--- /dev/null+++ b/apps/web/src/features/email-compose/browser-test/outbox.browser.e2e.ts@@ -0,0 +1,78 @@+import { expect, test } from '@playwright/test';++test('an inbox rejection survives reload and restores the saved message without cancellation HTTP', async ({+ page,+ context,+}) => {+ let requests = 0;+ await context.route('**/test-email/*', async (route) => {+ requests++;+ expect(route.request().url()).toContain('/submit');+ await route.fulfill({ status: 403, json: {} });+ });+ await page.goto('/outbox.html');+ await page.getByRole('button', { name: 'Send frozen message' }).click();+ await expect(+ page.getByRole('button', { name: 'Restore draft' })+ ).toBeEnabled();+ await page.reload();+ await expect(+ page.getByRole('button', { name: 'Restore draft' })+ ).toBeEnabled();+ await page.getByRole('button', { name: 'Restore draft' }).click();+ await expect(page.getByTestId('restored')).toHaveText('Frozen message');+ await expect(page.getByTestId('rows')).toHaveText('[]');+ await expect(page.getByTestId('error')).toHaveText('');+ expect(requests).toBe(1);+});++test('offline approval survives reload and account changes, then reconciles lost acceptance without resending', async ({+ page,+ context,+}) => {+ const errors: string[] = [];+ page.on('pageerror', (error) => errors.push(error.message));+ let submissions = 0;+ let checks = 0;+ let accepted: object | null = null;+ await context.route('**/test-email/*', async (route) => {+ const input = route.request().postDataJSON();+ if (route.request().url().endsWith('/submit')) {+ submissions++;+ expect(input.message.bodyText).toBe('Frozen message');+ accepted = {+ attemptId: input.attempt.attemptId,+ status: 'ACCEPTED',+ message: null,+ threadId: 'thread',+ sendTime: null,+ };+ await route.abort('failed'); // Commit succeeded; HTTP response was lost.+ } else {+ checks++;+ await route.fulfill({ json: accepted });+ }+ });+ await page.goto('/outbox.html');+ await expect(+ page.getByRole('button', { name: 'Send frozen message' })+ ).toBeEnabled();+ await context.setOffline(true);+ await page.getByRole('button', { name: 'Send frozen message' }).click();+ await expect(page.getByTestId('rows')).toContainText('Frozen message');+ expect(submissions).toBe(0);+ await page.getByRole('button', { name: 'Switch account' }).click();+ await expect(page.getByTestId('rows')).toHaveText('[]');+ await page.getByRole('button', { name: 'Return to owner' }).click();+ await expect(page.getByTestId('rows')).toContainText('Frozen message');+ // Reload with the browser online, retaining the actual IndexedDB intent.+ await context.setOffline(false);+ await page.reload();+ await expect(page.getByTestId('rows')).toContainText('"phase":"committed"', {+ timeout: 15_000,+ });+ expect(submissions).toBe(1);+ expect(checks).toBeGreaterThan(0);+ await expect(page.getByTestId('error')).toHaveText('');+ expect(errors).toEqual([]);+});diff --git a/apps/web/src/features/email-compose/browser-test/outbox.html b/apps/web/src/features/email-compose/browser-test/outbox.htmlnew file mode 100644index 0000000000..e835414903--- /dev/null+++ b/apps/web/src/features/email-compose/browser-test/outbox.html@@ -0,0 +1 @@+<!doctype html><html><head><meta charset="UTF-8"><title>Email outbox recovery</title></head><body><div id="root"></div><script type="module" src="/outbox-fixture.tsx"></script></body></html>\ No newline at end of filediff --git a/apps/web/src/features/email-compose/browser-test/schedule-recovery-fixture.tsx b/apps/web/src/features/email-compose/browser-test/schedule-recovery-fixture.tsxnew file mode 100644index 0000000000..69ea59eccf--- /dev/null+++ b/apps/web/src/features/email-compose/browser-test/schedule-recovery-fixture.tsx@@ -0,0 +1,110 @@+import { fireAndForget } from '@core/util/fireAndForget';+import { createSignal } from 'solid-js';+import { EmailDateSelector } from '../components/email-date-selector';+import {+ EmailScheduleBar,+ EmailScheduleSummary,+} from '../components/email-schedule-summary';+import { createEmailSendSchedule } from '../primitives/email-send-schedule';++/** Real schedule controller and controls with an isolated provider-status fixture. */+export function ScheduleRecoveryFixture() {+ const params = new URLSearchParams(location.search);+ const status =+ (['pending', 'sending', 'failed', 'unconfirmed'] as const).find(+ (value) => value === params.get('status')+ ) ?? 'unconfirmed';+ const sendTime = new Date(Date.now() - 60_000);+ const [cancelCount, setCancelCount] = createSignal(0);+ const [checkCount, setCheckCount] = createSignal(0);+ const [sendCount, setSendCount] = createSignal(0);+ const [error, setError] = createSignal('');+ const schedule = createEmailSendSchedule({+ initialScheduledTime: sendTime,+ initialDeliveryStatus: status,+ draftId: () => 'recovery-draft',+ threadId: () => 'recovery-thread',+ inboxId: () => 'recovery-inbox',+ generation: () => 'one',+ includeSignature: () => undefined,+ saveDraft: async () => 'recovery-draft',+ delivery: {+ schedule: async () => {+ setSendCount((value) => value + 1);+ },+ unschedule: async () => {+ setCancelCount((value) => value + 1);+ },+ archive: async () => {},+ },+ notices: {+ confirm: async () => false,+ feedback: {+ success: () => undefined,+ failure: (message) => {+ setError(message);+ return undefined;+ },+ alert: setError,+ dismiss: () => {},+ },+ reportError: () => {},+ blockingNotice: async () => {},+ },+ reconcile: async () => {+ setCheckCount((value) => value + 1);+ return {+ type: 'scheduled',+ draftId: 'recovery-draft',+ threadId: 'recovery-thread',+ inboxId: 'recovery-inbox',+ sendTime: sendTime.toISOString(),+ deliveryStatus: status,+ observedAt: Date.now(),+ };+ },+ });+ const Summary = params.has('mobile')+ ? EmailScheduleSummary+ : EmailScheduleBar;+ return (+ <main class="mx-auto flex max-w-xl flex-col gap-3 p-6 text-ink">+ <label>+ Message+ <textarea+ aria-label="Message"+ disabled={schedule.state().type === 'scheduled'}+ >+ Preserve this scheduled message+ </textarea>+ </label>+ <Summary+ state={schedule.state()}+ operation={schedule.operation()}+ onSelectTime={schedule.select}+ onCancelSchedule={schedule.cancel}+ onCheckStatus={schedule.checkStatus}+ />+ <EmailDateSelector+ state={schedule.state()}+ selectedTime={schedule.selectedTime()}+ mobile={params.has('mobile')}+ onSelectTime={schedule.select}+ onCancelSchedule={schedule.cancel}+ operation={schedule.operation()}+ />+ <button+ disabled={schedule.action() === 'unavailable'}+ onClick={() =>+ fireAndForget(schedule.submit(), 'email-schedule-fixture')+ }+ >+ Send email+ </button>+ <output data-testid="cancel-count">{cancelCount()}</output>+ <output data-testid="check-count">{checkCount()}</output>+ <output data-testid="send-count">{sendCount()}</output>+ <output role="alert">{error()}</output>+ </main>+ );+}diff --git a/apps/web/src/features/email-compose/browser-test/schedule-recovery.browser.e2e.ts b/apps/web/src/features/email-compose/browser-test/schedule-recovery.browser.e2e.tsnew file mode 100644index 0000000000..f5779be07f--- /dev/null+++ b/apps/web/src/features/email-compose/browser-test/schedule-recovery.browser.e2e.ts@@ -0,0 +1,53 @@+import { expect, test } from '@playwright/test';++for (const mobile of [false, true]) {+ const surface = mobile ? 'mobile summary' : 'desktop bar';+ test(`${surface} restores a failed scheduled send without resending`, async ({+ page,+ }) => {+ await page.goto(+ `/?scheduled-recovery&status=failed${mobile ? '&mobile' : ''}`+ );+ await expect(page.getByTestId('schedule-summary-label')).toContainText(+ 'Send failed before delivery'+ );+ await expect(page.getByRole('textbox', { name: 'Message' })).toBeDisabled();+ await expect(+ page.getByRole('button', { name: /Send time cannot be changed/ })+ ).toBeDisabled();+ await expect(+ page.getByRole('button', { name: 'Send email', exact: true })+ ).toBeDisabled();+ await page+ .getByRole('button', { name: 'Restore failed scheduled draft' })+ .click();+ await expect(page.getByRole('textbox', { name: 'Message' })).toBeEnabled();+ await expect(page.getByRole('textbox', { name: 'Message' })).toHaveValue(+ 'Preserve this scheduled message'+ );+ await expect(page.getByTestId('cancel-count')).toHaveText('1');+ await expect(page.getByTestId('send-count')).toHaveText('0');+ });++ test(`${surface} checks an uncertain send and keeps delivery locked`, async ({+ page,+ }) => {+ await page.goto(+ `/?scheduled-recovery&status=unconfirmed${mobile ? '&mobile' : ''}`+ );+ await expect(page.getByTestId('schedule-summary-label')).toContainText(+ 'We will not resend automatically'+ );+ await expect(+ page.getByRole('button', { name: /Send time cannot be changed/ })+ ).toBeDisabled();+ await expect(+ page.getByRole('button', { name: /cancel|restore/i })+ ).toHaveCount(0);+ await page.getByRole('button', { name: 'Check delivery status' }).click();+ await expect(page.getByTestId('check-count')).toHaveText('1');+ await expect(page.getByRole('textbox', { name: 'Message' })).toBeDisabled();+ await expect(page.getByTestId('cancel-count')).toHaveText('0');+ await expect(page.getByTestId('send-count')).toHaveText('0');+ });+}diff --git a/apps/web/src/features/email-compose/components/email-date-selector.tsx b/apps/web/src/features/email-compose/components/email-date-selector.tsxindex 46baa66930..06de20694f 100644--- a/apps/web/src/features/email-compose/components/email-date-selector.tsx+++ b/apps/web/src/features/email-compose/components/email-date-selector.tsx@@ -1,4 +1,7 @@-import type { EmailScheduleState } from '@app/features/email-compose/primitives/email-send-schedule';+import {+ type EmailScheduleState,+ scheduleTimeLocked,+} from '@app/features/email-compose/primitives/email-send-schedule';import { fireAndForget } from '@core/util/fireAndForget';import ClockIcon from '@phosphor/clock.svg';import { buttonClasses, cn, Tooltip } from '@ui';@@ -37,6 +40,8 @@ export const EmailDateSelector: VoidComponent<EmailDateSelectorProps> = (const hasProposal = () =>props.state.type === 'scheduled' && !!props.state.proposedTime;const accessibleLabel = () => {+ if (scheduleTimeLocked(props.state))+ return 'Send time cannot be changed during delivery or recovery.';const label = formattedDate();if (!label) return 'Choose send time';if (!isConfirmed()) return `Send time set to ${label}. Open to change it.`;@@ -60,7 +65,7 @@ export const EmailDateSelector: VoidComponent<EmailDateSelectorProps> = (<DateSelectorselectedDate={props.selectedTime}onSelectDate={props.onSelectTime}- disabled={props.disabled}+ disabled={props.disabled || scheduleTimeLocked(props.state)}disablePriorToDate={new Date()}disableAfterDate={addYears(new Date(), 1)}disablePortal={props.disablePortal}@@ -76,7 +81,13 @@ export const EmailDateSelector: VoidComponent<EmailDateSelectorProps> = (: undefined}footer={- <Show when={props.mobile && isConfirmed()}>+ <Show+ when={+ props.mobile &&+ isConfirmed() &&+ !scheduleTimeLocked(props.state)+ }+ ><div class="flex flex-col gap-2"><p class="px-1 text-xs text-ink-muted">{hasProposal()diff --git a/apps/web/src/features/email-compose/components/email-schedule-summary.test.tsx b/apps/web/src/features/email-compose/components/email-schedule-summary.test.tsxnew file mode 100644index 0000000000..e3d82fa7c1--- /dev/null+++ b/apps/web/src/features/email-compose/components/email-schedule-summary.test.tsx@@ -0,0 +1,99 @@+import {+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from '@solidjs/testing-library';+import { type ComponentProps, createSignal } from 'solid-js';+import { afterEach, expect, it, vi } from 'vitest';+import { EmailScheduleBar } from './email-schedule-summary';++vi.mock('@ui', () => ({+ Button: (props: ComponentProps<'button'>) => <button {...props} />,+ cn: (...values: (string | undefined)[]) => values.filter(Boolean).join(' '),+}));+afterEach(cleanup);++it('explains uncertain delivery and checks status without offering restoration', async () => {+ const cancel = vi.fn(async () => true);+ const check = vi.fn(async () => {});+ render(() => (+ <EmailScheduleBar+ state={{+ type: 'scheduled',+ confirmedTime: new Date(),+ deliveryStatus: 'unconfirmed',+ }}+ operation="idle"+ onSelectTime={vi.fn()}+ onCancelSchedule={cancel}+ onCheckStatus={check}+ />+ ));+ expect(screen.getByRole('status').textContent).toContain(+ 'We will not resend automatically'+ );+ expect(screen.queryByRole('button', { name: /cancel|restore/i })).toBeNull();+ fireEvent.click(+ screen.getByRole('button', { name: 'Check delivery status' })+ );+ await waitFor(() => expect(check).toHaveBeenCalledOnce());+ expect(cancel).not.toHaveBeenCalled();+});++it('does not offer a status action when the host has no refresh capability', () => {+ render(() => (+ <EmailScheduleBar+ state={{+ type: 'scheduled',+ confirmedTime: new Date(),+ deliveryStatus: 'unconfirmed',+ }}+ operation="idle"+ onSelectTime={vi.fn()}+ onCancelSchedule={vi.fn()}+ />+ ));+ expect(screen.getByRole('status').textContent).toContain(+ 'Delivery unconfirmed'+ );+ expect(screen.queryByRole('button')).toBeNull();+});++it('shows cancellation progress while restoring a failed scheduled draft', async () => {+ const finished = Promise.withResolvers<boolean>();+ const [operation, setOperation] = createSignal<'idle' | 'cancelling'>('idle');+ const cancel = vi.fn(async () => {+ setOperation('cancelling');+ try {+ return await finished.promise;+ } finally {+ setOperation('idle');+ }+ });+ render(() => (+ <EmailScheduleBar+ state={{+ type: 'scheduled',+ confirmedTime: new Date(),+ deliveryStatus: 'failed',+ }}+ operation={operation()}+ onSelectTime={vi.fn()}+ onCancelSchedule={cancel}+ />+ ));+ expect(screen.getByRole('status').textContent).toContain(+ 'Send failed before delivery'+ );+ const restore = screen.getByRole('button', {+ name: 'Restore failed scheduled draft',+ });+ fireEvent.click(restore);+ expect(restore.textContent).toBe('Cancelling…');+ expect(restore.hasAttribute('disabled')).toBe(true);+ finished.resolve(true);+ await waitFor(() => expect(restore.hasAttribute('disabled')).toBe(false));+ expect(cancel).toHaveBeenCalledOnce();+});diff --git a/apps/web/src/features/email-compose/components/email-schedule-summary.tsx b/apps/web/src/features/email-compose/components/email-schedule-summary.tsxindex f22358a816..9b4201394e 100644--- a/apps/web/src/features/email-compose/components/email-schedule-summary.tsx+++ b/apps/web/src/features/email-compose/components/email-schedule-summary.tsx@@ -11,6 +11,7 @@ interface EmailScheduleSummaryProps {operation: 'idle' | 'committing' | 'updating' | 'cancelling';onSelectTime: (date: Date | null) => void | boolean;onCancelSchedule: () => Promise<boolean>;+ onCheckStatus?: () => Promise<void>;}type ScheduleSummary = {@@ -18,7 +19,7 @@ type ScheduleSummary = {detail: string | undefined;actionLabel: string;accessibleActionLabel: string;- action: () => void;+ action: (() => void) | undefined;};/** A send time with its zone, since the viewer's zone may not be the recipient's. */@@ -42,6 +43,44 @@ function describeSchedule(action: () => props.onSelectTime(null),};}+ if (+ state.deliveryStatus === 'unconfirmed' ||+ state.deliveryStatus === 'sending'+ ) {+ return {+ label:+ state.deliveryStatus === 'unconfirmed'+ ? 'Delivery unconfirmed'+ : 'Sending',+ detail:+ state.deliveryStatus === 'unconfirmed'+ ? 'This email may already have been sent. Check Sent. We will not resend automatically.'+ : 'Delivery has started. Cancellation is no longer available.',+ actionLabel: 'Check status',+ accessibleActionLabel: 'Check delivery status',+ action: props.onCheckStatus+ ? () =>+ fireAndForget(+ props.onCheckStatus?.(),+ 'email-compose-check-schedule'+ )+ : undefined,+ };+ }+ if (state.deliveryStatus === 'failed') {+ return {+ label: 'Send failed before delivery',+ detail:+ 'Cancel to restore this draft and review it before sending again.',+ actionLabel: 'Restore draft',+ accessibleActionLabel: 'Restore failed scheduled draft',+ action: () =>+ fireAndForget(+ props.onCancelSchedule(),+ 'email-compose-cancel-schedule'+ ),+ };+ }if (state.proposedTime) {return {label: `Scheduled for ${sendTimeLabel(state.confirmedTime)}`,@@ -90,17 +129,19 @@ function ScheduleSummaryAction(props: {operation: EmailScheduleSummaryProps['operation'];}) {return (- <Button- size="sm"- aria-label={props.summary.accessibleActionLabel}- tooltip={props.summary.accessibleActionLabel}- disabled={props.operation !== 'idle'}- onClick={props.summary.action}- >- {props.operation === 'cancelling'- ? 'Cancelling…'- : props.summary.actionLabel}- </Button>+ <Show when={props.summary.action}>+ <Button+ size="sm"+ aria-label={props.summary.accessibleActionLabel}+ tooltip={props.summary.accessibleActionLabel}+ disabled={props.operation !== 'idle'}+ onClick={props.summary.action}+ >+ {props.operation === 'cancelling'+ ? 'Cancelling…'+ : props.summary.actionLabel}+ </Button>+ </Show>);}diff --git a/apps/web/src/features/email-compose/compose-adapter.ts b/apps/web/src/features/email-compose/compose-adapter.tsindex 0bb05c6dc5..1dd7fd82f8 100644--- a/apps/web/src/features/email-compose/compose-adapter.ts+++ b/apps/web/src/features/email-compose/compose-adapter.ts@@ -1,4 +1,3 @@-import { useAnalytics } from '@app/lib/analytics/analytics-context';import { useFeatureFlag } from '@app/lib/analytics/posthog';import { useHasPaidAccess } from '@core/auth';import {@@ -35,23 +34,25 @@ import {useRemoveForwardedAttachmentMutation,useUploadDraftAttachmentsMutation,} from '@queries/email/attachment';+import { cancelServerEmailSend } from '@queries/email/cancel-server-send';import {transferEmailDraft,useDeleteDraftMutation,} from '@queries/email/draft';import { markThreadDraftSaved } from '@queries/email/draft-cache';+import { subscribeToDraftLifecycleChanges } from '@queries/email/draft-lifecycle-events';import {assertEmailDraftQueueAvailable,deleteEmailDraftQueued,draftQueueActive,+ graphqlCacheRecoveryState,readEmailDraft,+ recoverDraftSynchronization,+ retryEmailDraftSynchronization,saveEmailDraftQueued,watchEmailDrafts,} from '@queries/email/draft-queue';-import {- saveEmailComposeDraft,- sendEmailComposeMessage,-} from '@queries/email/graphql/compose';+import { saveEmailComposeDraft } from '@queries/email/graphql/compose';import {archiveEmailThread,scheduleEmailMessage,@@ -61,16 +62,24 @@ import {findPrimaryEmailLinkId,nonPrimaryEmailLinkIdHeader,} from '@queries/email/link';+import { confirmLocalDraftSave } from '@queries/email/local-draft-confirmation';import {clearLocalAttachmentReceipt,- forgetLocalDraft,readLocalDraft,recordLocalAttachment,- resumeLocalDraft,reviveLocalDraft,saveLocalDraft,+ withLocalAttachmentUpload,} from '@queries/email/local-drafts';import { useMailAccountsQuery } from '@queries/email/mail-accounts';+import { useQueuedEmailSends } from '@queries/email/queued-sends';+import {+ cancelEmailSendAndConfirm,+ emailSendLocked,+ emailSendMatchesDraft,+ sendEmailQueued,+} from '@queries/email/send-queue';+import { serverEmailSends } from '@queries/email/server-sends';import {fetchAndCacheThread,fetchFreshEmailThread,@@ -101,7 +110,11 @@ import {} from './queries/draft-lifecycle';import { createEmailInboxSource } from './queries/inbox-source';import { queuedDraftSaveArgs } from './queries/queued-draft';-import { restoreDraftBodyAfterUndo, runUndoSend } from './undo-send';+import {+ restoreDraftBodyAfterUndo,+ runQueuedUndoSend,+ runUndoSend,+} from './undo-send';import { uploadAttachmentDocuments } from './upload-documents';export type EmailComposeContextOptions = {@@ -136,6 +149,7 @@ export function createEmailComposeContext(options.threadTransport?.() ??(graphqlSoupFlag().enabled ? 'graphql' : 'rest'));+ const sends = useQueuedEmailSends(() => true);// Attach handlers run as event handlers, which have no Solid owner of// their own; the dialog needs the surface's.const dialogOwner = getOwner();@@ -154,7 +168,6 @@ export function createEmailComposeContext();const signatures = useFeatureFlag(enableEmailSignatures);const remove = useDeleteDraftMutation();- const analytics = useAnalytics();const upload = useUploadDraftAttachmentsMutation();const forward = useAddForwardedAttachmentsMutation();const removeAttachment = useRemoveDraftAttachmentMutation();@@ -303,6 +316,17 @@ export function createEmailComposeContext(reportError,},drafts: {+ syncAvailability: graphqlCacheRecoveryState,+ recoverSynchronization: recoverDraftSynchronization,+ watchRestorations: (changed) =>+ subscribeToDraftLifecycleChanges((event) => {+ if (event.restoration)+ changed({+ ...event.restoration,+ draftId: event.draftId,+ inboxId: event.inboxId,+ });+ }),async transferDraft(input) {const result = await transferEmailDraft(input);return {@@ -317,32 +341,23 @@ export function createEmailComposeContext((message) => message.db_id === draftId && message.is_draft);},- get saveLocalDraft() {- return queueActive()- ? (input: import('@queries/email/local-drafts').LocalDraftInput) =>- saveLocalDraft({- ...input,- inboxId: input.inboxId ?? primaryId(),- senderEmail:- input.draft.sender_email ??- inboxSource- .inboxes()- .find(- (inbox) => inbox.id === (input.inboxId ?? primaryId())- )?.email_address ??- viewerEmail(),- })- : undefined;- },+ saveLocalDraft: (input) =>+ saveLocalDraft({+ ...input,+ inboxId: input.inboxId ?? primaryId(),+ senderEmail:+ input.draft.sender_email ??+ inboxSource+ .inboxes()+ .find((inbox) => inbox.id === (input.inboxId ?? primaryId()))+ ?.email_address ??+ viewerEmail(),+ }),get retryDraft() {- return queueActive() ? resumeLocalDraft : undefined;- },- get readDraft() {- return queueActive() ? readEmailDraft : undefined;- },- get watchDrafts() {- return queueActive() ? watchEmailDrafts : undefined;+ return queueActive() ? retryEmailDraftSynchronization : undefined;},+ readDraft: readEmailDraft,+ watchDrafts: watchEmailDrafts,async saveDraft({completingThread,previousThreadId,@@ -404,10 +419,17 @@ export function createEmailComposeContext(};return saved;}+ const localId = input.clientHandles?.draftId ?? input.draft.db_id;+ const local = localId ? await readLocalDraft(localId) : undefined;const result = await saveEmailComposeDraft({...input,inboxId: inboxId ?? primaryId(),});+ try {+ await confirmLocalDraftSave(local, result);+ } catch (error) {+ reportError(error);+ }try {const threadId = result.threadId;if (threadId) {@@ -434,6 +456,7 @@ export function createEmailComposeContext(if (input.threadId && queueActive()) {const outcome = await deleteEmailDraftQueued({draftId: input.draftId,+ draftGeneration: input.draftGeneration,threadId: input.threadId,completingThread,});@@ -481,34 +504,92 @@ export function createEmailComposeContext(},},delivery: {- async sendMessage({ completingThread, inboxId, ...input }) {- await requireSavedDraftForDelivery(input.message.db_id);- const result = await sendEmailComposeMessage({- ...input,- inboxId: inboxId ?? primaryId(),+ queueActive: () => true,+ sendLocked: (draftId) =>+ !sends.ready() ||+ (!!draftId &&+ serverEmailSends().some(+ (row) => row.attempt.message?.id === draftId+ )) ||+ (!!draftId &&+ sends+ .intents()+ .some(+ (intent) =>+ emailSendMatchesDraft(intent, draftId) &&+ emailSendLocked(intent)+ )),+ async sendMessage({ inboxId, ...input }) {+ if (+ !inboxSource+ .inboxes()+ .some((inbox) => inbox.id === (inboxId ?? primaryId()))+ )+ throw new Error(+ 'Linked email accounts are still loading. Try sending again after they load.'+ );+ const senderLinkId = inboxId ?? primaryId() ?? '';+ const draftId = input.clientHandles?.draftId ?? input.message.db_id;+ const threadId =+ input.clientHandles?.threadId ?? input.message.thread_db_id;+ if (!draftId || !threadId)+ throw new Error('Draft identity is required to queue a send');+ const inbox = inboxSource+ .inboxes()+ .find((inbox) => inbox.id === senderLinkId);+ if (!inbox) throw new Error('The sending account is unavailable');+ const signatureHtml =+ input.message.include_signature === false ||+ (input.message.replying_to_id &&+ input.message.include_signature !== true &&+ !inbox.settings.signature_on_replies_forwards)+ ? ''+ : (inbox.settings.signature ?? '');+ return await sendEmailQueued({+ signatureHtml,+ expectedLocalVersion: input.expectedLocalVersion,+ draft: {+ ...queuedDraftSaveArgs({+ draft: input.message,+ handles: { draftId, threadId },+ senderLinkId,+ senderAccount: accounts.isSuccess+ ? accounts.data?.links.find((link) => link.id === senderLinkId)+ : undefined,+ senderEmail:+ inboxSource.inboxes().find((inbox) => inbox.id === senderLinkId)+ ?.email_address ??+ viewerEmail() ??+ '',+ }),+ sendTime: input.sendTime,+ },+ attachmentIds: input.attachmentIds ?? [],+ forwardedAttachmentIds: input.forwardedAttachmentIds ?? [],+ includeSignature: input.message.include_signature,+ restoreBodyHtml: input.restoreBodyHtml,+ restoreBodyText: input.restoreBodyText,+ restoreBodyMacro: input.restoreBodyMacro,});- try {- if (queueActive() && input.message.db_id)- await forgetLocalDraft(input.message.db_id);- if (result.draftId)- publishDraftLifecycleChange(result.draftId, result.inboxId);- if (result.threadId) {- markThreadDraftSaved(result.threadId);- refreshThread(result.threadId);- fireAndForget(- refreshEmailLists(result.threadId, !!completingThread),- 'email-compose'- );- }- analytics.track('email_message_sent');- } catch (error) {- reportError(error);- }- return result;},- async unschedule({ draftId, threadId, inboxId }) {+ async unschedule({ draftId, threadId, inboxId, draftGeneration }) {+ const local = sends+ .intents()+ .find((row) => emailSendMatchesDraft(row, draftId));+ if (local) {+ await cancelEmailSendAndConfirm(local);+ return;+ }+ const remote = serverEmailSends().find(+ (row) => row.attempt.message?.id === draftId+ );+ if (remote) {+ await cancelServerEmailSend(remote);+ return;+ }await unschedule.mutateAsync({draftID: draftId,+ draftGeneration,linkId: headerId(inboxId),});try {@@ -520,7 +601,7 @@ export function createEmailComposeContext(}},schedule: async (- { draftId, threadId, sendTime, includeSignature },+ { draftId, threadId, sendTime, includeSignature, draftGeneration },inboxId) => {await requireSavedDraftForDelivery(draftId);@@ -528,6 +609,7 @@ export function createEmailComposeContext({draftID: draftId,send_time: sendTime,+ draftGeneration,include_signature: includeSignature,},headerId(inboxId)@@ -549,8 +631,16 @@ export function createEmailComposeContext(archive: async ({ threadId, value }, inboxId) => {await archiveEmailThread({ id: threadId, value }, headerId(inboxId));},- undoSend: (input) =>- runUndoSend({+ undoSend: async (input) => {+ if (input.sendAttemptId) {+ await runQueuedUndoSend({+ draftId: input.draftId,+ attemptId: input.sendAttemptId,+ onUndone: () => input.onUndone({ draftRestored: true }),+ });+ return;+ }+ await runUndoSend({draftId: input.draftId,linkId: headerId(input.inboxId),onUndone: async () => {@@ -561,58 +651,117 @@ export function createEmailComposeContext('email-compose');},- }),+ });+ },},attachmentStorage: {completeAttachment: completeDraftAttachment,- uploadAttachments: ({ draftId, inboxId, ...input }) =>- upload.mutateAsync({- ...input,- draftID: draftId,- linkId: headerId(inboxId),- onAttachmentAdded: async (file, id) => {- input.onAttachmentAdded?.(file, id);- if (queueActive())- await recordLocalAttachment(draftId, file, id, false);- },- onAttachmentUploaded: async (file, id) => {- input.onAttachmentUploaded?.(file, id);- if (queueActive())- await recordLocalAttachment(draftId, file, id, true);- },- onAttachmentUploadFailed: (file) => {- if (queueActive())- void recordLocalAttachment(draftId, file, undefined, false).catch(- reportError+ async uploadAttachments({ draftId, inboxId, draftGeneration, ...input }) {+ for (const file of input.attachments) {+ const run = async (+ receipt?: { attachmentId?: string; uploaded: boolean },+ generation?: string+ ) => {+ if (receipt?.uploaded && receipt.attachmentId) {+ input.onAttachmentUploaded?.(file, receipt.attachmentId);+ return;+ }+ if (receipt?.attachmentId) {+ await removeAttachment.mutateAsync({+ draftID: draftId,+ draftGeneration,+ attachmentID: receipt.attachmentId,+ linkId: headerId(inboxId),+ });+ await recordLocalAttachment(+ draftId,+ file,+ undefined,+ false,+ generation);- input.onAttachmentUploadFailed?.(file);- },- }),- addForwardedAttachments: ({ draftId, attachments, inboxId }) =>+ }+ await upload.mutateAsync({+ draftID: draftId,+ draftGeneration,+ attachments: [file],+ linkId: headerId(inboxId),+ onAttachmentAdded: async (uploadedFile, id) => {+ input.onAttachmentAdded?.(uploadedFile, id);+ await recordLocalAttachment(+ draftId,+ uploadedFile,+ id,+ false,+ generation+ );+ },+ onAttachmentUploaded: async (uploadedFile, id) => {+ input.onAttachmentUploaded?.(uploadedFile, id);+ await recordLocalAttachment(+ draftId,+ uploadedFile,+ id,+ true,+ generation+ );+ },+ onAttachmentUploadFailed: (uploadedFile) => {+ void recordLocalAttachment(+ draftId,+ uploadedFile,+ undefined,+ false,+ generation+ ).catch(reportError);+ input.onAttachmentUploadFailed?.(uploadedFile);+ },+ });+ };+ await withLocalAttachmentUpload(draftId, file, run);+ }+ },+ addForwardedAttachments: ({+ draftId,+ attachments,+ inboxId,+ draftGeneration,+ }) =>forward.mutateAsync({draftID: draftId,+ draftGeneration,attachments: attachments.map(({ attachmentId }) => ({attachmentID: attachmentId,})),linkId: headerId(inboxId),}),- removeAttachment: async ({ draftId, attachmentId, inboxId }) => {+ removeAttachment: async ({+ draftId,+ attachmentId,+ inboxId,+ draftGeneration,+ }) => {await removeAttachment.mutateAsync({draftID: draftId,+ draftGeneration,attachmentID: attachmentId,linkId: headerId(inboxId),});- if (queueActive()) {- try {- await clearLocalAttachmentReceipt(draftId, attachmentId);- } catch (error) {- reportError(error);- }+ try {+ await clearLocalAttachmentReceipt(draftId, attachmentId);+ } catch (error) {+ reportError(error);}},- removeForwardedAttachment: ({ draftId, attachmentId, inboxId }) =>+ removeForwardedAttachment: ({+ draftId,+ attachmentId,+ inboxId,+ draftGeneration,+ }) =>removeForwarded.mutateAsync({draftID: draftId,+ draftGeneration,attachmentID: attachmentId,linkId: headerId(inboxId),}),diff --git a/apps/web/src/features/email-compose/context/compose-capabilities.ts b/apps/web/src/features/email-compose/context/compose-capabilities.tsindex cba7cbe26e..cba6448d76 100644--- a/apps/web/src/features/email-compose/context/compose-capabilities.ts+++ b/apps/web/src/features/email-compose/context/compose-capabilities.ts@@ -18,6 +18,9 @@ export interface EmailInbox extends SenderInbox {/** Identity returned by a successful save or send. Transport envelopes stay in adapters. */export interface PersistedEmailIdentity {+ /** Present when durable send admission owns this message. */+ sendAttemptId?: string;+ persistence?: 'committed' | 'queued';draftId?: string;threadId?: string;inboxId: string;@@ -76,18 +79,29 @@ export interface SaveEmailDraft {completingThread?: boolean;}export interface DeleteEmailDraft {+ draftGeneration?: number;draftId: string;threadId?: string;inboxId?: string;completingThread?: boolean;}export interface SendEmailDraft {- clientHandles?: DraftClientHandles;+ /** Frozen Send Later deadline; omitted uses the server Undo Send delay. */+ sendTime?: string;message: EmailDraft;+ clientHandles?: DraftClientHandles;+ /** The exact working-copy version persisted for this submission. */+ expectedLocalVersion?: Pick<LocalDraft, 'generation' | 'revision'>;+ attachmentIds?: string[];+ forwardedAttachmentIds?: string[];+ restoreBodyHtml?: string | null;+ restoreBodyText?: string | null;+ restoreBodyMacro?: string | null;inboxId?: string;completingThread?: boolean;}export interface UploadEmailAttachments {+ draftGeneration?: number;draftId: string;attachments: File[];inboxId?: string;@@ -96,6 +110,7 @@ export interface UploadEmailAttachments {onAttachmentUploadFailed?: (file: File) => void;}export interface EmailAttachmentChange {+ draftGeneration?: number;draftId: string;attachmentId: string;inboxId?: string;@@ -105,6 +120,16 @@ export interface EmailAttachmentChange {export class DraftTransferAborted extends Error {}export interface EmailDraftStorage {+ recoverSynchronization?(): Promise<void>;+ syncAvailability?():+ | 'ready'+ | 'recovering'+ | 'unavailable'+ | 'recovery-required';+ /** Explicit restoration may replace editor content; ordinary cache updates never do. */+ watchRestorations?(+ changed: (restoration: EmailDraftRestoration) => void+ ): () => void;/** Reload canonical provider content after an explicit conflict resolution. */reloadDraft?(draftId: string,@@ -143,6 +168,7 @@ export interface EmailDraftStorage {}) => void): () => void;transferDraft(input: {+ draftGeneration?: number;operationId: string;draftId: string;sourceInboxId: string;@@ -163,10 +189,20 @@ export interface EmailDraftStorage {}): Promise<void>;}+export interface EmailDraftRestoration {+ draftId: string;+ originalDraftId: string;+ threadId: string;+ inboxId?: string;+ replyingToId?: string | null;+ includeSignature?: boolean | null;+}+export interface EmailAttachmentStorage {completeAttachment(input: EmailAttachmentChange): Promise<void>;uploadAttachments(input: UploadEmailAttachments): Promise<void>;addForwardedAttachments(input: {+ draftGeneration?: number;draftId: string;attachments: { attachmentId: string }[];inboxId?: string;@@ -176,8 +212,13 @@ export interface EmailAttachmentStorage {}export interface EmailDelivery {+ /** Whether sends can be persisted and replayed without connectivity. */+ queueActive?: (inboxId?: string) => boolean;+ /** Persisted locks, scoped to the composing surface's owner. */+ sendLocked?: (draftId: string | undefined) => boolean;sendMessage(input: SendEmailDraft): Promise<PersistedEmailIdentity>;unschedule(input: {+ draftGeneration?: number;draftId: string;threadId?: string;inboxId?: string;@@ -187,6 +228,7 @@ export interface EmailDelivery {draftId: string;threadId?: string;sendTime: string;+ draftGeneration?: number;includeSignature?: boolean;},inboxId?: string@@ -196,10 +238,11 @@ export interface EmailDelivery {inboxId?: string): Promise<void>;undoSend(input: {+ sendAttemptId?: string;threadId?: string;draftId: string;inboxId: string | undefined;- onUndone: () => Promise<void> | void;+ onUndone: (result?: { draftRestored: boolean }) => Promise<void> | void;}): Promise<void>;}@@ -217,6 +260,7 @@ export type EmailDraftLifecycleState =threadId: string;inboxId: string;sendTime: string;+ deliveryStatus?: 'pending' | 'sending' | 'failed' | 'unconfirmed';observedAt: number;}| {diff --git a/apps/web/src/features/email-compose/core/email-draft.ts b/apps/web/src/features/email-compose/core/email-draft.tsindex 57abf1cc3d..de27e38722 100644--- a/apps/web/src/features/email-compose/core/email-draft.ts+++ b/apps/web/src/features/email-compose/core/email-draft.ts@@ -2,6 +2,7 @@ import type { EmailContact } from '../../email-message/core/email-message';/** Feature-owned values. Transport adaptation belongs to queries. */export interface EmailDraft {+ draft_generation?: number;sender_email?: string;bcc?: EmailContact[] | null;body_html?: string | null;diff --git a/apps/web/src/features/email-compose/core/local-draft.ts b/apps/web/src/features/email-compose/core/local-draft.tsindex a8cfe7bfcf..cb0209d5df 100644--- a/apps/web/src/features/email-compose/core/local-draft.ts+++ b/apps/web/src/features/email-compose/core/local-draft.ts@@ -88,7 +88,7 @@ export type DraftSyncViewState = {canKeepEditing: boolean;};-/** Immediate and scheduled delivery must both wait for the latest local intent. */+/** REST sending and scheduling require the latest local revision on the server. */export function localDraftReadyForDelivery(draft: LocalDraft): boolean {return (draft.acknowledgedRevision >= draft.revision &&diff --git a/apps/web/src/features/email-compose/primitives/attachment-links.test.ts b/apps/web/src/features/email-compose/primitives/attachment-links.test.tsindex 9ec0c36ce0..0752247af7 100644--- a/apps/web/src/features/email-compose/primitives/attachment-links.test.ts+++ b/apps/web/src/features/email-compose/primitives/attachment-links.test.ts@@ -4,6 +4,7 @@ import {$isDocumentMentionNode,} from '@macro-inc/lexical-core';import { $getRoot, $isElementNode, type LexicalEditor } from 'lexical';+import { createRoot, createSignal } from 'solid-js';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { MAX_ATTACHMENTS_BYTES_SIZE } from '../core/constants';import { createComposeContext } from '../tests/capabilities';@@ -15,8 +16,12 @@ import {createAttachmentLinkOffer,} from './attachment-links';+const disposers: (() => void)[] = [];beforeEach(() => vi.useFakeTimers());-afterEach(() => vi.useRealTimers());+afterEach(() => {+ for (const dispose of disposers.splice(0)) dispose();+ vi.useRealTimers();+});const report = {documentId: 'doc-1',@@ -83,14 +88,27 @@ describe('appendAttachmentLinks', () => {});describe('createAttachmentLinkOffer', () => {- function offerFor(editor: LexicalEditor, confirmed: boolean) {+ function offerFor(+ editor: LexicalEditor,+ confirmed: boolean,+ canEdit = () => true,+ version = () => ''+ ) {const confirm = vi.fn(async () => confirmed);const uploadDocuments = vi.fn(async () => [report]);const makePublic = vi.fn();- const links = createAttachmentLinkOffer({- editor: () => editor,- notices: { confirm },- editorFiles: { uploadDocuments, makePublic },+ const links = createRoot((dispose) => {+ disposers.push(dispose);+ return {+ ...createAttachmentLinkOffer({+ editor: () => editor,+ canEdit,+ version,+ notices: { confirm },+ editorFiles: { uploadDocuments, makePublic },+ }),+ dispose,+ };});return { ...links, confirm, uploadDocuments, makePublic };}@@ -160,6 +178,48 @@ describe('createAttachmentLinkOffer', () => {expect(outline(editor)).toEqual(['text:Hi']);});+ it('invalidates a pending confirmation when a queued lock arrives and clears', async () => {+ const editor = createEmailEditor('Frozen');+ const [canEdit, setCanEdit] = createSignal(true);+ const decision = Promise.withResolvers<boolean>();+ const links = offerFor(editor, true, canEdit);+ links.confirm.mockReturnValue(decision.promise);+ const sharing = links.share([huge], MAX_ATTACHMENTS_BYTES_SIZE);+ setCanEdit(false);+ setCanEdit(true);+ decision.resolve(true);+ await sharing;+ expect(links.uploadDocuments).not.toHaveBeenCalled();+ expect(outline(editor)).toEqual(['text:Frozen']);+ });++ it.each(['lock', 'identity', 'dispose', 'readonly'] as const)(+ 'keeps late uploads private and unlinked after %s',+ async (change) => {+ const editor = createEmailEditor('Frozen');+ const [canEdit, setCanEdit] = createSignal(true);+ const [version, setVersion] = createSignal('original');+ const started = Promise.withResolvers<void>();+ const pending = Promise.withResolvers<(typeof report)[]>();+ const links = offerFor(editor, true, canEdit, version);+ links.uploadDocuments.mockImplementation(() => {+ started.resolve();+ return pending.promise;+ });+ const sharing = links.share([huge], MAX_ATTACHMENTS_BYTES_SIZE);+ await started.promise;+ if (change === 'lock') setCanEdit(false);+ if (change === 'identity') setVersion('restored');+ if (change === 'dispose') links.dispose();+ if (change === 'readonly') editor.setEditable(false);+ pending.resolve([report]);+ await sharing;+ expect(links.makePublic).not.toHaveBeenCalled();+ expect(outline(editor)).toEqual(['text:Frozen']);+ expect(links.uploading()).toBe(false);+ }+ );+it('keeps a file private and unlinked when the composer moved on mid-upload', async () => {const editor = createEmailEditor('Hi');const pending = Promise.withResolvers<(typeof report)[]>();diff --git a/apps/web/src/features/email-compose/primitives/attachment-links.ts b/apps/web/src/features/email-compose/primitives/attachment-links.tsindex 3c1895b54e..9dd6b5f47d 100644--- a/apps/web/src/features/email-compose/primitives/attachment-links.ts+++ b/apps/web/src/features/email-compose/primitives/attachment-links.ts@@ -10,7 +10,7 @@ import {$getRoot,type LexicalEditor,} from 'lexical';-import { type Accessor, createSignal } from 'solid-js';+import { type Accessor, createEffect, createSignal, onCleanup } from 'solid-js';import type {EmailComposeFeedback,EmailEditorFiles,@@ -23,31 +23,36 @@ import type {*/export function appendAttachmentLinks(editor: LexicalEditor,- documents: readonly UploadedDocument[]+ documents: readonly UploadedDocument[],+ canEdit: Accessor<boolean> = () => true) {- if (documents.length === 0) return;- editor.update(() => {- // Attaching from the toolbar must not pull focus into the editor.- $addUpdateTag('skip-dom-selection');- const root = $getRoot();- const quote = root- .getChildren()- .find(- (node) =>- $isClassedBlockNode(node) && node.__classes.includes('macro_quote')- );- for (const document of documents) {- const paragraph = $createParagraphNode().append(- $createDocumentMentionNode({- documentId: document.documentId,- documentName: document.name,- blockName: document.blockName,- })- );- if (quote) quote.insertBefore(paragraph);- else root.append(paragraph);- }- });+ if (documents.length === 0 || !editor.isEditable() || !canEdit()) return;+ editor.update(+ () => {+ if (!editor.isEditable() || !canEdit()) return;+ // Attaching from the toolbar must not pull focus into the editor.+ $addUpdateTag('skip-dom-selection');+ const root = $getRoot();+ const quote = root+ .getChildren()+ .find(+ (node) =>+ $isClassedBlockNode(node) && node.__classes.includes('macro_quote')+ );+ for (const document of documents) {+ const paragraph = $createParagraphNode().append(+ $createDocumentMentionNode({+ documentId: document.documentId,+ documentName: document.name,+ blockName: document.blockName,+ })+ );+ if (quote) quote.insertBefore(paragraph);+ else root.append(paragraph);+ }+ },+ { discrete: true }+ );}/**@@ -59,16 +64,32 @@ export function appendAttachmentLinks(*/export function createAttachmentLinkOffer(options: {editor: Accessor<LexicalEditor | undefined>;+ canEdit: Accessor<boolean>;+ version: Accessor<string>;notices: Pick<EmailComposeFeedback, 'confirm'>;editorFiles: Pick<EmailEditorFiles, 'uploadDocuments' | 'makePublic'>;}) {const inFlight = new Set<Promise<UploadedDocument[]>>();const [uploading, setUploading] = createSignal(false);let generation = 0;+ createEffect(() => {+ if (!options.canEdit()) generation += 1;+ });+ onCleanup(() => {+ generation += 1;+ });const share = async (files: File[], limitBytes: number): Promise<void> => {- if (files.length === 0) return;+ if (files.length === 0 || !options.canEdit()) return;const started = generation;+ const version = options.version();+ const editor = options.editor();+ const current = () =>+ started === generation &&+ version === options.version() &&+ options.canEdit() &&+ options.editor() === editor &&+ !!editor?.isEditable();const single = files.length === 1;const limitLabel = `${limitBytes / 1_000_000} MB`;await Telemetry.span('email.attachment_links', async (span) => {@@ -87,7 +108,7 @@ export function createAttachmentLinkOffer(options: {span.setAttr('email.attachment_links.confirmed', confirmed);// The composer may have reset while the prompt was open; nothing to// upload for then.- if (!confirmed || started !== generation) {+ if (!confirmed || !current()) {span.setAttr('email.attachment_links.linked', false);return;}@@ -96,24 +117,20 @@ export function createAttachmentLinkOffer(options: {);inFlight.add(upload);setUploading(true);- let documents: UploadedDocument[];try {- documents = await upload;+ const documents = await upload;+ span.setAttr('email.attachment_links.uploaded_count', documents.length);+ const valid = current();+ span.setAttr('email.attachment_links.linked', valid);+ if (!valid) return;+ for (const document of documents) {+ options.editorFiles.makePublic(document.documentId);+ }+ if (editor) appendAttachmentLinks(editor, documents, current);} finally {inFlight.delete(upload);setUploading(inFlight.size > 0);}- span.setAttr('email.attachment_links.uploaded_count', documents.length);- // The composer moved on while the files uploaded: they stay private and- // unlinked rather than landing in whatever is being written now.- const current = started === generation;- span.setAttr('email.attachment_links.linked', current);- if (!current) return;- for (const document of documents) {- options.editorFiles.makePublic(document.documentId);- }- const editor = options.editor();- if (editor) appendAttachmentLinks(editor, documents);});};diff --git a/apps/web/src/features/email-compose/primitives/attachment-persistence.test.ts b/apps/web/src/features/email-compose/primitives/attachment-persistence.test.tsindex 2a2c08293e..2e8c674d05 100644--- a/apps/web/src/features/email-compose/primitives/attachment-persistence.test.ts+++ b/apps/web/src/features/email-compose/primitives/attachment-persistence.test.ts@@ -106,11 +106,13 @@ describe('draft attachment persistence', () => {];expect(state.form.attachments.list()).toEqual([]);expect(state.services.removeAttachment).toHaveBeenCalledWith({+ draftGeneration: 0,draftId: 'draft',attachmentId: 'local',inboxId: 'secondary-inbox',});expect(state.services.removeForwardedAttachment).toHaveBeenCalledWith({+ draftGeneration: 0,draftId: 'draft',attachmentId: 'forwarded',inboxId: 'secondary-inbox',diff --git a/apps/web/src/features/email-compose/primitives/attachment-persistence.ts b/apps/web/src/features/email-compose/primitives/attachment-persistence.tsindex 86e6524e90..e59d69f87c 100644--- a/apps/web/src/features/email-compose/primitives/attachment-persistence.ts+++ b/apps/web/src/features/email-compose/primitives/attachment-persistence.ts@@ -1,5 +1,5 @@import { fireAndForget } from '@core/util/fireAndForget';-import { type Accessor, createSignal } from 'solid-js';+import { type Accessor, createSignal, onCleanup } from 'solid-js';import type {EmailAttachmentStorage,EmailComposeFeedback,@@ -21,9 +21,8 @@ type AttachmentState = Pick<>;/**- * A queued save carries only text; file bytes live in the composer's memory- * until a save commits, so adding attachments offline is refused rather than- * silently missed. Resolves true when the add must not proceed.+ * Attachment creation requires connectivity; existing files remain in the+ * durable working copy while offline. Resolves true when the add must not proceed.*/export async function refuseAttachmentsOffline(connectivity: EmailConnectivity,@@ -42,8 +41,10 @@ export function createAttachmentPersistence(options: {attachments: AttachmentState;/** Durable working copies must not hide attachments still present on the server. */confirmRemoval?: boolean;+ allowed?: Accessor<boolean>;draftId: Accessor<string | null | undefined>;inboxId: Accessor<string | undefined>;+ draftGeneration?: Accessor<number>;services: Pick<EmailAttachmentStorage,| 'completeAttachment'@@ -56,6 +57,12 @@ export function createAttachmentPersistence(options: {// An assigned ID only proves that the attachment record exists. Every save// must also wait for content uploads started by earlier concurrent saves.const inFlight = new Set<Promise<void>>();+ const pendingFiles = new Map<File, number>();+ let disposed = false;+ onCleanup(() => {+ disposed = true;+ generation += 1;+ });const [uploading, setUploading] = createSignal(false);let generation = 0;const [removals, setRemovals] = createSignal(0);@@ -78,20 +85,34 @@ export function createAttachmentPersistence(options: {return removed;},async upload(draftId: string, inbox = { inboxId: options.inboxId() }) {+ if (disposed || options.allowed?.() === false) return;const uploadGeneration = generation;+ const draftGeneration = options.draftGeneration?.() ?? 0;const stillCurrent = () =>- uploadGeneration === generation && options.draftId() === draftId;+ !disposed &&+ options.allowed?.() !== false &&+ uploadGeneration === generation &&+ draftGeneration === (options.draftGeneration?.() ?? 0) &&+ options.draftId() === draftId &&+ options.inboxId() === inbox.inboxId;for (const attachment of options.attachments.list()) {if (attachment.type !== 'local' ||+ pendingFiles.get(attachment.file) === uploadGeneration ||!attachment.uploadPending ||!attachment.attachmentId)continue;+ if (options.confirmRemoval) {+ // Durable transport checks the latest receipt under a cross-tab upload lock.+ options.attachments.clearAttachmentId(attachment.file);+ continue;+ }await options.services.removeAttachment({draftId,attachmentId: attachment.attachmentId,inboxId: inbox.inboxId,+ draftGeneration,});if (!stillCurrent()) return;options.attachments.clearAttachmentId(attachment.file);@@ -102,14 +123,19 @@ export function createAttachmentPersistence(options: {(attachment): attachment is Extract<DraftFormAttachment, { type: 'local' }> =>- attachment.type === 'local' && !attachment.attachmentId+ attachment.type === 'local' &&+ !attachment.attachmentId &&+ pendingFiles.get(attachment.file) !== uploadGeneration);let run: Promise<void> | undefined;if (attachments.length) {+ for (const attachment of attachments)+ pendingFiles.set(attachment.file, uploadGeneration);run = options.services.uploadAttachments({draftId: draftId,attachments: attachments.map((attachment) => attachment.file),inboxId: inbox.inboxId,+ draftGeneration,onAttachmentAdded: (file, id) => {if (stillCurrent())options.attachments.assignAttachmentId(file, id);@@ -130,6 +156,9 @@ export function createAttachmentPersistence(options: {setUploading(true);fireAndForget(settled.then(() => {+ for (const attachment of attachments)+ if (pendingFiles.get(attachment.file) === uploadGeneration)+ pendingFiles.delete(attachment.file);inFlight.delete(settled);setUploading(inFlight.size > 0);}),@@ -146,6 +175,7 @@ export function createAttachmentPersistence(options: {draftId,attachmentId: attachment.attachmentId,inboxId: inbox.inboxId,+ draftGeneration,});if (stillCurrent())options.attachments.markUploadComplete(attachment.attachmentId);@@ -158,6 +188,7 @@ export function createAttachmentPersistence(options: {await options.services.addForwardedAttachments({draftId,inboxId: inbox.inboxId,+ draftGeneration,attachments: forwarded.map(({ attachmentId }) => ({ attachmentId })),});}@@ -179,6 +210,7 @@ export function createAttachmentPersistence(options: {draftId,attachmentId: attachment.attachmentId,inboxId: options.inboxId(),+ draftGeneration: options.draftGeneration?.() ?? 0,}: undefined;if (options.confirmRemoval && request) {diff --git a/apps/web/src/features/email-compose/primitives/attachment-send-handoff.test.ts b/apps/web/src/features/email-compose/primitives/attachment-send-handoff.test.tsnew file mode 100644index 0000000000..480162fc3a--- /dev/null+++ b/apps/web/src/features/email-compose/primitives/attachment-send-handoff.test.ts@@ -0,0 +1,85 @@+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { createComposeContext } from '../tests/capabilities';+import { mountEmailComposer } from '../tests/composer';+import { mountReplyComposer } from '../tests/reply';++beforeEach(() => vi.useFakeTimers());+afterEach(() => vi.useRealTimers());+it.each(['standalone', 'reply'] as const)(+ 'continues attachment upload when Send interrupts debounce: %s',+ async (kind) => {+ const context = createComposeContext();+ context.delivery.queueActive = () => true;+ context.connectivity.looksOffline = () => true;+ context.drafts.saveLocalDraft = vi.fn(async (input) => ({+ key: input.clientHandles?.draftId ?? input.draft.db_id!,+ draftId: input.clientHandles?.draftId ?? input.draft.db_id!,+ threadId:+ input.clientHandles?.threadId ?? input.draft.thread_db_id ?? undefined,+ accountId: 'owner',+ generation: 'local-generation',+ revision: 1,+ acknowledgedRevision: 0,+ status: 'dirty' as const,+ updatedAt: Date.now(),+ content: input.draft,+ attachments: [],+ }));+ const root =+ kind === 'standalone'+ ? mountEmailComposer(context)+ : mountReplyComposer(context);+ try {+ root.edit('Body with still-uploading image');+ context.connectivity.looksOffline = () => false;+ const file = new File(['audit'], 'audit.txt', { type: 'text/plain' });+ if ('state' in root) await root.state.context.onAddAttachments([file]);+ else await root.handleAddAttachments([file]);+ if ('state' in root) root.state.context.onSend();+ else await root.sendEmail();+ await vi.advanceTimersByTimeAsync(0);+ await vi.advanceTimersByTimeAsync(2000);+ expect(context.attachmentStorage.uploadAttachments).toHaveBeenCalled();+ } finally {+ root.dispose();+ }+ }+);++it.each(['standalone', 'reply'] as const)(+ 'refuses adding attachments offline and preserves existing files when sending offline: %s',+ async (kind) => {+ const context = createComposeContext();+ context.delivery.queueActive = () => true;+ let offline = true;+ context.connectivity.looksOffline = () => offline;+ const root =+ kind === 'standalone'+ ? mountEmailComposer(context)+ : mountReplyComposer(context);+ const file = new File(['audit'], 'audit.txt');+ const add = () =>+ 'state' in root+ ? root.state.context.onAddAttachments([file])+ : root.handleAddAttachments([file]);+ try {+ await add();+ expect(context.notices.blockingNotice).toHaveBeenCalledOnce();+ offline = false;+ await add();+ root.edit('Offline attachment must be preserved');+ offline = true;+ if ('state' in root) root.state.context.onSend();+ else await root.sendEmail();+ await vi.advanceTimersByTimeAsync(0);+ expect(context.delivery.sendMessage).not.toHaveBeenCalled();+ expect(context.notices.feedback.failure).toHaveBeenCalledWith(+ 'Failed to send email',+ { subtext: 'Reconnect to send this email.' }+ );+ expect(context.attachmentStorage.removeAttachment).not.toHaveBeenCalled();+ } finally {+ root.dispose();+ }+ }+);diff --git a/apps/web/src/features/email-compose/primitives/compose-persistence.test.ts b/apps/web/src/features/email-compose/primitives/compose-persistence.test.tsindex 28e85310d7..5bf09411fc 100644--- a/apps/web/src/features/email-compose/primitives/compose-persistence.test.ts+++ b/apps/web/src/features/email-compose/primitives/compose-persistence.test.ts@@ -411,6 +411,7 @@ it('only commits a selected time through the primary action', async () => {expect(composeContext.delivery.sendMessage).not.toHaveBeenCalled();expect(composeContext.delivery.schedule).toHaveBeenCalledExactlyOnceWith({+ draftGeneration: 0,draftId: 'draft',threadId: 'thread',sendTime: firstTime.toISOString(),@@ -454,6 +455,7 @@ it('only commits a selected time through the primary action', async () => {await vi.advanceTimersByTimeAsync(1);threadView.dispose();expect(composeContext.delivery.unschedule).toHaveBeenCalledExactlyOnceWith({+ draftGeneration: 0,draftId: 'draft',threadId: 'thread',inboxId: 'inbox',diff --git a/apps/web/src/features/email-compose/primitives/compose-view-state.ts b/apps/web/src/features/email-compose/primitives/compose-view-state.tsindex bc0d0b8945..e43f9bdc76 100644--- a/apps/web/src/features/email-compose/primitives/compose-view-state.ts+++ b/apps/web/src/features/email-compose/primitives/compose-view-state.ts@@ -56,6 +56,7 @@ export interface ComposeState {operation: Accessor<'idle' | 'committing' | 'updating' | 'cancelling'>;onSelect(date: Date | null): boolean;onCancel(): Promise<boolean>;+ onCheckStatus?(): Promise<void>;pickerDisabled: Accessor<boolean>;};diff --git a/apps/web/src/features/email-compose/primitives/draft-autosave.ts b/apps/web/src/features/email-compose/primitives/draft-autosave.tsindex 7e87e441f1..10f7c9bee5 100644--- a/apps/web/src/features/email-compose/primitives/draft-autosave.ts+++ b/apps/web/src/features/email-compose/primitives/draft-autosave.ts@@ -89,6 +89,10 @@ export function createDraftAutosave<Snapshot, Result>(options: {});return {save,+ async saveLocal(snapshot = options.capture()) {+ cancel();+ await saveLocally(snapshot);+ },cancel,settled: () => queue,flushLocal,diff --git a/apps/web/src/features/email-compose/primitives/draft-identity.test.ts b/apps/web/src/features/email-compose/primitives/draft-identity.test.tsindex efcb86671f..e55e9010a6 100644--- a/apps/web/src/features/email-compose/primitives/draft-identity.test.ts+++ b/apps/web/src/features/email-compose/primitives/draft-identity.test.ts@@ -473,3 +473,55 @@ it('waits for a replacement identity read before correlating an already-sent fairoot.dispose();}});++it('retries a failed confirmed attachment handoff once on reconnect', async () => {+ let changed!: () => void;+ const upload = vi+ .fn()+ .mockRejectedValueOnce(new Error('transport offline'))+ .mockResolvedValue(undefined);+ const root = createRoot((dispose) => {+ const session = createDraftSession({+ draftId: 'server',+ threadId: 'server-thread',+ persistence: 'committed',+ });+ observeDraftIdentity(+ {+ ...createComposeContext().drafts,+ readDraft: async () => ({+ draft: message('server', {+ thread_db_id: 'server-thread',+ is_draft: true,+ }),+ persistence: 'committed',+ }),+ watchDrafts: (callback) => {+ changed = callback;+ return () => {};+ },+ },+ session,+ createComposeContext().notices,+ vi.fn(),+ vi.fn(),+ upload+ );+ return { dispose };+ });+ try {+ await vi.waitFor(() => expect(upload).toHaveBeenCalledOnce());+ changed();+ await Promise.resolve();+ await Promise.resolve();+ expect(upload).toHaveBeenCalledOnce();+ window.dispatchEvent(new Event('online'));+ await vi.waitFor(() => expect(upload).toHaveBeenCalledTimes(2));+ changed();+ await Promise.resolve();+ await Promise.resolve();+ expect(upload).toHaveBeenCalledTimes(2);+ } finally {+ root.dispose();+ }+});diff --git a/apps/web/src/features/email-compose/primitives/draft-identity.ts b/apps/web/src/features/email-compose/primitives/draft-identity.tsindex 76322ced69..a129640bb0 100644--- a/apps/web/src/features/email-compose/primitives/draft-identity.ts+++ b/apps/web/src/features/email-compose/primitives/draft-identity.ts@@ -12,7 +12,8 @@ export function observeDraftIdentity(session: DraftSession,notices: Pick<EmailComposeFeedback, 'feedback' | 'reportError'>,recover: () => void,- onAlreadySent: () => void+ onAlreadySent: () => void,+ onConfirmed?: () => Promise<boolean | void>) {createEffect(on(@@ -26,7 +27,8 @@ export function observeDraftIdentity(notices,recover,onAlreadySent,- !!storage.retryDraft+ !!storage.retryDraft,+ onConfirmed);})@@ -40,11 +42,13 @@ function observeAvailableDraftIdentity(notices: Pick<EmailComposeFeedback, 'feedback' | 'reportError'>,recover: () => void,onAlreadySent: () => void,- durableRecovery: boolean+ durableRecovery: boolean,+ onConfirmed?: () => Promise<boolean | void>) {let generation = 0;let mutationUuid: string | undefined;let disposed = false;+ let uploadHandoff: string | undefined;let rejectionNotice: number | undefined;const dismissRejectionNotice = () => {if (rejectionNotice === undefined) return;@@ -77,6 +81,14 @@ function observeAvailableDraftIdentity(}if (!result.draft) return;const current = session.identity();+ const confirmed = result.persistence === 'committed';+ const handoff = async () => {+ const version = `${result.draft!.db_id}:${result.local?.generation ?? ''}:${result.local?.acknowledgedRevision ?? result.draft!.updated_at}`;+ if (version === uploadHandoff) return;+ uploadHandoff = version;+ if ((await onConfirmed?.()) === false && uploadHandoff === version)+ uploadHandoff = undefined;+ };if (current.kind !== 'none' &¤t.draftId === result.draft.db_id &&@@ -84,8 +96,10 @@ function observeAvailableDraftIdentity(current.queued === (result.persistence === 'queued') &&(result.persistence === 'queued' ||current.inboxId === result.draft.link_id)- )+ ) {+ if (confirmed) await handoff();return;+ }session.dispatch({type: 'saved',epoch,@@ -96,6 +110,7 @@ function observeAvailableDraftIdentity(persistence: result.persistence,},});+ if (confirmed) await handoff();} catch (error) {notices.reportError(error);}@@ -177,6 +192,7 @@ function observeAvailableDraftIdentity(createEffect(on(epoch, () => {mutationUuid = undefined;+ uploadHandoff = undefined;dismissRejectionNotice();}));@@ -185,7 +201,13 @@ function observeAvailableDraftIdentity(fireAndForget(refresh(), 'email-compose');}));+ const reconnect = () => {+ uploadHandoff = undefined;+ fireAndForget(refresh(), 'email-compose');+ };+ window.addEventListener('online', reconnect);onCleanup(() => {+ window.removeEventListener('online', reconnect);disposed = true;dismissRejectionNotice();unsubscribe();diff --git a/apps/web/src/features/email-compose/primitives/draft-persistence.ts b/apps/web/src/features/email-compose/primitives/draft-persistence.tsindex d6b7310b08..4f35b8ca2f 100644--- a/apps/web/src/features/email-compose/primitives/draft-persistence.ts+++ b/apps/web/src/features/email-compose/primitives/draft-persistence.ts@@ -50,6 +50,7 @@ export async function deleteDraftForDiscard(*/export function createDraftPersistence(options: {session: DraftSession;+ draftGeneration?: () => number;drafts: Pick<EmailDraftStorage,'saveDraft' | 'deleteDraft' | 'saveLocalDraft' | 'retryDraft' | 'readDraft'@@ -91,6 +92,15 @@ export function createDraftPersistence(options: {};return {+ localVersion(): Pick<LocalDraft, 'generation' | 'revision'> | undefined {+ return localGeneration !== undefined && localRevision !== undefined+ ? { generation: localGeneration, revision: localRevision }+ : undefined;+ },+ restored(local: Pick<LocalDraft, 'revision' | 'generation'> | undefined) {+ localRevision = local?.revision;+ localGeneration = local?.generation;+ },async saveLocally(input: {draft: EmailDraft | null;inboxId?: string;@@ -156,6 +166,7 @@ export function createDraftPersistence(options: {try {await options.drafts.deleteDraft({draftId,+ draftGeneration: options.draftGeneration?.() ?? 0,threadId: session.threadId(),...input,});diff --git a/apps/web/src/features/email-compose/primitives/draft-restoration.test.ts b/apps/web/src/features/email-compose/primitives/draft-restoration.test.tsnew file mode 100644index 0000000000..42e041e1b3--- /dev/null+++ b/apps/web/src/features/email-compose/primitives/draft-restoration.test.ts@@ -0,0 +1,132 @@+import { createRoot, createSignal } from 'solid-js';+import { expect, it, vi } from 'vitest';+import { message } from '../../email-message/tests/messages';+import type { EmailDraftRestoration } from '../context/compose-capabilities';+import { createComposeContext } from '../tests/capabilities';+import { observeDraftRestoration } from './draft-restoration';++const change: EmailDraftRestoration = {+ draftId: 'draft',+ originalDraftId: 'local-draft',+ threadId: 'thread',+ inboxId: 'inbox',+};+const result = {+ draft: message('draft', { is_draft: true }),+ persistence: 'queued' as const,+};++function mountRestoration(readyInitially = false) {+ const context = createComposeContext();+ const [ready, setReady] = createSignal(readyInitially);+ let version = 0;+ let listener: ((event: EmailDraftRestoration) => void) | undefined;+ const read = vi.fn(async () => result);+ const restored = vi.fn();+ const setPending = vi.fn();+ const cancelPendingSave = vi.fn(() => {+ version += 1;+ });+ context.drafts.readDraft = read;+ context.drafts.watchRestorations = (changed) => {+ listener = changed;+ return () => {+ listener = undefined;+ };+ };+ const dispose = createRoot((dispose) => {+ observeDraftRestoration({+ storage: context.drafts,+ accepts: (event) => event.draftId === 'draft',+ ready,+ version: () => String(version),+ cancelPendingSave,+ setPending,+ restore: restored,+ reportError: context.notices.reportError,+ });+ return dispose;+ });+ return {+ read,+ restored,+ setPending,+ cancelPendingSave,+ setReady,+ emit: (event = change) => listener?.(event),+ changeSession: () => {+ version += 1;+ },+ dispose,+ };+}++it('discards a buffered restoration when the same draft starts a newer editor session', () => {+ const root = mountRestoration();+ try {+ root.emit();+ expect(root.cancelPendingSave).toHaveBeenCalledOnce();+ expect(root.setPending).toHaveBeenLastCalledWith(true);+ root.changeSession();+ root.setReady(true);+ expect(root.read).not.toHaveBeenCalled();+ expect(root.restored).not.toHaveBeenCalled();+ expect(root.setPending).toHaveBeenLastCalledWith(false);+ } finally {+ root.dispose();+ }+});++it('discards a buffered restoration when the editor unmounts before journal unlock', () => {+ const root = mountRestoration();+ root.emit();+ root.dispose();+ root.setReady(true);+ expect(root.read).not.toHaveBeenCalled();+ expect(root.restored).not.toHaveBeenCalled();+ expect(root.setPending).toHaveBeenLastCalledWith(false);+});++it('waits for another unlock if the journal locks again during the draft read', async () => {+ const root = mountRestoration(true);+ const firstRead = Promise.withResolvers<typeof result>();+ root.read.mockReturnValueOnce(firstRead.promise);+ try {+ root.emit();+ root.setReady(false);+ firstRead.resolve(result);+ await firstRead.promise;+ expect(root.restored).not.toHaveBeenCalled();+ expect(root.setPending).toHaveBeenLastCalledWith(true);+ root.setReady(true);+ await vi.waitFor(() => expect(root.restored).toHaveBeenCalledOnce());+ expect(root.read).toHaveBeenCalledTimes(2);+ expect(root.setPending).toHaveBeenLastCalledWith(false);+ } finally {+ root.dispose();+ }+});++it('keeps the latest restoration when an older draft read finishes afterward', async () => {+ const root = mountRestoration(true);+ const firstRead = Promise.withResolvers<typeof result>();+ root.read.mockReturnValueOnce(firstRead.promise);+ try {+ root.emit();+ const newerChange = { ...change, includeSignature: false };+ root.emit(newerChange);+ await vi.waitFor(() => expect(root.restored).toHaveBeenCalledOnce());+ expect(root.restored).toHaveBeenCalledWith(+ result.draft,+ newerChange,+ 'queued',+ undefined,+ undefined+ );+ firstRead.resolve(result);+ await firstRead.promise;+ expect(root.restored).toHaveBeenCalledOnce();+ } finally {+ root.dispose();+ }+});diff --git a/apps/web/src/features/email-compose/primitives/draft-restoration.ts b/apps/web/src/features/email-compose/primitives/draft-restoration.tsnew file mode 100644index 0000000000..60aff9c205--- /dev/null+++ b/apps/web/src/features/email-compose/primitives/draft-restoration.ts@@ -0,0 +1,115 @@+import { fireAndForget } from '@core/util/fireAndForget';+import { createEffect, createSignal, on, onCleanup } from 'solid-js';+import type { EmailMessage } from '../../email-message/core/email-message';+import type {+ EmailDraftRestoration,+ EmailDraftStorage,+} from '../context/compose-capabilities';+import type { LocalDraft } from '../core/local-draft';+import type { DraftFormAttachment } from './email-form-state';++/** Explicit recovery reseeds the matching editor; normal cache echoes never do. */+type RestorationOptions = {+ storage: EmailDraftStorage;+ accepts(change: EmailDraftRestoration): boolean;+ ready?(): boolean;+ version(): string;+ cancelPendingSave(): void;+ setPending(pending: boolean): void;+ restore(+ draft: EmailMessage,+ change: EmailDraftRestoration,+ persistence: 'committed' | 'queued',+ local?: LocalDraft,+ attachments?: DraftFormAttachment[]+ ): void;+ reportError(error: unknown): void;+};++export function observeDraftRestoration(options: RestorationOptions) {+ createEffect(+ on(+ () =>+ [options.storage.readDraft, options.storage.watchRestorations] as const,+ ([read, watch]) => {+ if (read && watch) observeAvailableRestorations(options, read, watch);+ }+ )+ );+}++function observeAvailableRestorations(+ options: RestorationOptions,+ read: NonNullable<EmailDraftStorage['readDraft']>,+ watch: NonNullable<EmailDraftStorage['watchRestorations']>+) {+ let disposed = false;+ type PendingRestoration = {+ change: EmailDraftRestoration;+ version: string;+ reading: boolean;+ };+ const [pending, setPending] = createSignal<PendingRestoration>();+ const current = (request: PendingRestoration) =>+ !disposed && pending() === request;+ const valid = (request: PendingRestoration) =>+ request.version === options.version() && options.accepts(request.change);+ const finish = (request: PendingRestoration) => {+ if (!current(request)) return;+ setPending(undefined);+ options.setPending(false);+ };+ const restore = async (request: PendingRestoration) => {+ if (request.reading) return;+ if (!valid(request)) {+ finish(request);+ return;+ }+ request.reading = true;+ let awaitingUnlock = false;+ try {+ const result = await read(request.change.draftId);+ if (!current(request) || !valid(request)) return;+ if (options.ready?.() === false) {+ awaitingUnlock = true;+ return;+ }+ if (!result?.draft)+ throw new Error('The restored draft is unavailable on this device');+ options.restore(+ result.draft,+ request.change,+ result.persistence,+ result.local,+ result.attachments+ );+ } catch (error) {+ if (current(request) && valid(request)) options.reportError(error);+ } finally {+ request.reading = false;+ if (!awaitingUnlock) finish(request);+ }+ };+ createEffect(+ on(+ () => [pending(), options.ready?.() ?? true] as const,+ ([request, ready]) => {+ if (request && ready)+ fireAndForget(restore(request), 'email-draft-restoration');+ }+ )+ );+ const unsubscribe = watch((change) => {+ if (!options.accepts(change)) return;+ // Cross-tab notifications can precede the journal observer's unlock. Pause+ // stale autosaves immediately and retain the event until that observer agrees.+ options.cancelPendingSave();+ options.setPending(true);+ setPending({ change, version: options.version(), reading: false });+ });+ onCleanup(() => {+ disposed = true;+ unsubscribe();+ options.setPending(false);+ });+}diff --git a/apps/web/src/features/email-compose/primitives/draft-session-scenarios.test.ts b/apps/web/src/features/email-compose/primitives/draft-session-scenarios.test.tsindex f6625fc677..5474cb0ea3 100644--- a/apps/web/src/features/email-compose/primitives/draft-session-scenarios.test.ts+++ b/apps/web/src/features/email-compose/primitives/draft-session-scenarios.test.ts@@ -511,6 +511,7 @@ describe.each(['reply', 'compose'] as const)();expect(context.delivery.schedule).toHaveBeenCalledExactlyOnceWith({+ draftGeneration: 0,draftId: 'scheduled-server',threadId: 'thread',sendTime: '2027-01-01T12:00:00.000Z',diff --git a/apps/web/src/features/email-compose/primitives/draft-sync-status.test.ts b/apps/web/src/features/email-compose/primitives/draft-sync-status.test.tsindex dedc823968..4a9a895930 100644--- a/apps/web/src/features/email-compose/primitives/draft-sync-status.test.ts+++ b/apps/web/src/features/email-compose/primitives/draft-sync-status.test.ts@@ -28,7 +28,11 @@ it('offers retry discard when a crash interrupted deletion before admission', aslocal: draft,persistence: 'queued' as const,}));- const discard = vi.fn(async () => {});+ const recover = vi.fn(async () => {});+ context.drafts.recoverSynchronization = recover;+ const discard = vi.fn(async () => {+ expect(recover).toHaveBeenCalledOnce();+ });const status = createRoot((dispose) => {disposers.push(dispose);return createDraftSyncStatus({@@ -160,3 +164,37 @@ it('offers retry for server failures while newer edits remain saved locally', asexpect(status.state()).toMatchObject({ failed: true, action: 'retry' }));});++it('keeps local edits visible with an actionable synchronization status during recovery', async () => {+ const context = createComposeContext();+ const [availability, setAvailability] = createSignal<+ 'unavailable' | 'recovering' | 'ready'+ >('unavailable');+ context.drafts.syncAvailability = availability;+ context.drafts.saveLocalDraft = vi.fn();+ context.drafts.readDraft = vi.fn(async () => ({+ local: { ...draft, status: 'dirty' as const },+ persistence: 'queued' as const,+ }));+ const status = createRoot((dispose) => {+ disposers.push(dispose);+ return createDraftSyncStatus({+ drafts: context.drafts,+ draftId: () => 'draft',+ localSaveState: () => 'saved',+ acknowledgeSaved: () => true,+ retry: vi.fn(),+ discard: vi.fn(),+ });+ });+ await vi.waitFor(() =>+ expect(status.state()?.message).toBe(+ 'Saved on this device; waiting to sync'+ )+ );+ expect(status.state()?.action).toBe('retry');+ setAvailability('recovering');+ expect(status.state()?.action).toBeUndefined();+ setAvailability('ready');+ expect(status.state()?.message).toBe('Draft saved');+});diff --git a/apps/web/src/features/email-compose/primitives/draft-sync-status.ts b/apps/web/src/features/email-compose/primitives/draft-sync-status.tsindex 511b7fcac3..068202aa8c 100644--- a/apps/web/src/features/email-compose/primitives/draft-sync-status.ts+++ b/apps/web/src/features/email-compose/primitives/draft-sync-status.ts@@ -58,6 +58,23 @@ export function createDraftSyncStatus(options: {draft?.status ?? '') ||deletePending();+ const availability = options.drafts.syncAvailability?.() ?? 'ready';+ if (disk !== 'failed' && availability !== 'ready') {+ return {+ message: draft+ ? 'Saved on this device; waiting to sync'+ : 'Draft synchronization unavailable',+ detail:+ availability === 'recovering'+ ? 'Reconnecting to saved changes…'+ : availability === 'recovery-required'+ ? 'Queued changes are preserved. Update or reload Macro to recover local storage.'+ : 'Reconnect or retry to resume draft synchronization.',+ failed: true,+ action: availability === 'unavailable' ? 'retry' : undefined,+ canKeepEditing: false,+ };+ }// Only a newly persisted version restarts the brief acknowledgement.// Queue notifications and identity adoption do not count as another save.if (!failed) {@@ -101,6 +118,7 @@ export function createDraftSyncStatus(options: {setBusy(true);setActionError(undefined);try {+ await options.drafts.recoverSynchronization?.();await action();await refetch();} catch (error) {diff --git a/apps/web/src/features/email-compose/primitives/draft-transfer.ts b/apps/web/src/features/email-compose/primitives/draft-transfer.tsindex 40c64050d4..41e2c67c35 100644--- a/apps/web/src/features/email-compose/primitives/draft-transfer.ts+++ b/apps/web/src/features/email-compose/primitives/draft-transfer.ts@@ -13,6 +13,8 @@ import type { DraftFormAttachment } from './email-form-state';/** Preserve the operation ID across a lost response and adopt a distinct identity. */export function createDraftTransfer(options: {session: DraftSession;+ draftGeneration?: () => number;+ onTransferred?: () => void;drafts: Pick<EmailDraftStorage, 'transferDraft'>;attachments: {list(): DraftFormAttachment[];@@ -54,6 +56,7 @@ export function createDraftTransfer(options: {);setPending({operationId: uuidv7(),+ draftGeneration: options.draftGeneration?.(),draftId,sourceInboxId,destinationInboxId: destination.id,@@ -69,6 +72,7 @@ export function createDraftTransfer(options: {throw error;}options.invalidateOldSaves();+ options.onTransferred?.();options.session.dispatch({type: 'seeded',draftId: result.draftId,diff --git a/apps/web/src/features/email-compose/primitives/durable-send-composer.test.ts b/apps/web/src/features/email-compose/primitives/durable-send-composer.test.tsnew file mode 100644index 0000000000..85eacf47df--- /dev/null+++ b/apps/web/src/features/email-compose/primitives/durable-send-composer.test.ts@@ -0,0 +1,602 @@+import { $getRoot } from 'lexical';+import { createSignal } from 'solid-js';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { message } from '../../email-message/tests/messages';+import type { EmailDraftRestoration } from '../context/compose-capabilities';+import { decodeBase64Utf8 } from '../core/decode-base64';+import type { LocalDraft } from '../core/local-draft';+import type { ReplyType } from '../core/reply-type';+import { createComposeContext } from '../tests/capabilities';+import { mountEmailComposer } from '../tests/composer';+import { mountReplyComposer } from '../tests/reply';+import type { DraftFormAttachment } from './email-form-state';++beforeEach(() => vi.useFakeTimers());+afterEach(() => vi.useRealTimers());++it.each(['standalone', 'reply'] as const)(+ 'requires local persistence but no server acknowledgement for an offline %s send',+ async (kind) => {+ const context = createComposeContext();+ context.delivery.queueActive = () => true;+ context.connectivity.looksOffline = () => true;+ context.drafts.saveLocalDraft = vi.fn(+ async (input): Promise<LocalDraft> => ({+ key: input.clientHandles?.draftId ?? input.draft.db_id!,+ draftId: input.clientHandles?.draftId ?? input.draft.db_id!,+ threadId:+ input.clientHandles?.threadId ??+ input.draft.thread_db_id ??+ undefined,+ accountId: 'owner',+ generation: 'local-generation',+ revision: 1,+ acknowledgedRevision: 0,+ status: 'dirty',+ updatedAt: Date.now(),+ content: input.draft,+ attachments: [],+ })+ );+ const root =+ kind === 'standalone'+ ? mountEmailComposer(context)+ : mountReplyComposer(context);+ try {+ root.edit('Offline body');+ if ('state' in root) {+ root.state.context.onSend();+ await vi.advanceTimersByTimeAsync(0);+ } else await root.sendEmail();+ expect(context.drafts.saveLocalDraft).toHaveBeenCalled();+ expect(context.drafts.saveDraft).not.toHaveBeenCalled();+ expect(context.delivery.sendMessage).toHaveBeenCalledOnce();+ expect(context.delivery.sendMessage).toHaveBeenCalledWith(+ expect.objectContaining({+ expectedLocalVersion: { generation: 'local-generation', revision: 1 },+ })+ );+ } finally {+ root.dispose();+ }+ }+);++it.each(['standalone', 'reply'] as const)(+ 'does not send a stale %s editor after a local revision conflict',+ async (kind) => {+ const context = createComposeContext();+ context.delivery.queueActive = () => true;+ context.drafts.saveLocalDraft = vi.fn(async () => {+ throw new Error('This draft changed while saving');+ });+ const root =+ kind === 'standalone'+ ? mountEmailComposer(context)+ : mountReplyComposer(context);+ try {+ root.edit('Stale content');+ if ('state' in root) {+ root.state.context.onSend();+ await vi.advanceTimersByTimeAsync(0);+ } else await root.sendEmail();+ expect(context.delivery.sendMessage).not.toHaveBeenCalled();+ expect(context.notices.feedback.failure).toHaveBeenCalled();+ } finally {+ root.dispose();+ }+ }+);++function restorationContext() {+ const context = createComposeContext();+ let listener: ((event: EmailDraftRestoration) => void) | undefined;+ context.drafts.watchRestorations = (changed) => {+ listener = changed;+ return () => {+ listener = undefined;+ };+ };+ return {+ context,+ restore: (overrides: Partial<EmailDraftRestoration> = {}) =>+ listener?.({+ draftId: 'draft',+ originalDraftId: 'local-draft',+ threadId: 'thread',+ inboxId: 'inbox',+ ...overrides,+ }),+ };+}++it.each(['standalone', 'reply'] as const)(+ 'uses the restored local generation for subsequent mounted %s edits',+ async (kind) => {+ const { context, restore } = restorationContext();+ const original: LocalDraft = {+ key: 'draft',+ draftId: 'draft',+ threadId: 'thread',+ accountId: 'owner',+ generation: 'original-generation',+ revision: 3,+ acknowledgedRevision: 0,+ status: 'dirty',+ updatedAt: Date.now(),+ content: { subject: 'Original' },+ attachments: [],+ };+ const restored = {+ ...original,+ generation: 'restored-generation',+ revision: 7,+ };+ context.drafts.saveLocalDraft = vi.fn(async () => original);+ context.drafts.readDraft = vi.fn(async () => ({+ draft: message('draft', {+ is_draft: true,+ replying_to_id: kind === 'reply' ? 'parent' : undefined,+ body_text: 'Restored content',+ body_html_sanitized: null,+ }),+ persistence: 'queued' as const,+ local: restored,+ }));+ const seed = { draft: message('draft', { is_draft: true }) };+ const root =+ kind === 'standalone'+ ? mountEmailComposer(context, undefined, seed)+ : mountReplyComposer(context, undefined, seed);+ try {+ root.edit('Original editor');+ await vi.advanceTimersByTimeAsync(0);+ expect(context.drafts.saveLocalDraft).toHaveBeenCalled();+ restore({ replyingToId: kind === 'reply' ? 'parent' : undefined });+ await vi.advanceTimersByTimeAsync(0);+ root.edit('Edited after restoration');+ await vi.advanceTimersByTimeAsync(0);+ expect(context.drafts.saveLocalDraft).toHaveBeenLastCalledWith(+ expect.objectContaining({+ expectedRevision: restored.revision,+ expectedGeneration: restored.generation,+ })+ );+ } finally {+ root.dispose();+ }+ }+);++it.each(['standalone', 'reply'] as const)(+ 'preserves newer local files when a delayed %s restoration adopts their revision',+ async (kind) => {+ const { context, restore } = restorationContext();+ const [locked, setLocked] = createSignal(false);+ context.delivery.sendLocked = locked;+ const file: DraftFormAttachment = {+ type: 'local',+ file: new File(['new attachment'], 'new.txt', { type: 'text/plain' }),+ uploaded: false,+ };+ const local: LocalDraft = {+ key: 'draft',+ draftId: 'draft',+ threadId: 'thread',+ accountId: 'owner',+ generation: 'restored-generation',+ revision: 7,+ acknowledgedRevision: 0,+ status: 'dirty',+ updatedAt: Date.now(),+ content: { subject: 'Restored' },+ attachments: [],+ };+ context.drafts.saveLocalDraft = vi.fn(async () => local);+ context.drafts.readDraft = vi.fn(async () => ({+ draft: message('draft', {+ is_draft: true,+ replying_to_id: kind === 'reply' ? 'parent' : undefined,+ body_text: 'Restored content with a new local file',+ body_html_sanitized: null,+ }),+ persistence: 'queued' as const,+ local,+ attachments: [file],+ }));+ const seed = { draft: message('draft', { is_draft: true }) };+ const root =+ kind === 'standalone'+ ? mountEmailComposer(context, undefined, seed)+ : mountReplyComposer(context, undefined, seed);+ try {+ setLocked(true);+ restore({ replyingToId: kind === 'reply' ? 'parent' : undefined });+ await vi.advanceTimersByTimeAsync(600);+ expect(context.drafts.readDraft).not.toHaveBeenCalled();+ setLocked(false);+ await vi.advanceTimersByTimeAsync(0);+ root.edit('Edited after restoration');+ await vi.advanceTimersByTimeAsync(0);+ expect(context.drafts.saveLocalDraft).toHaveBeenLastCalledWith(+ expect.objectContaining({+ expectedRevision: local.revision,+ expectedGeneration: local.generation,+ attachments: [file],+ })+ );+ } finally {+ root.dispose();+ }+ }+);++it.each([false, true])(+ 'restores the mounted standalone body and envelope when the journal unlock is delayed: %s',+ async (delayedUnlock) => {+ const { context, restore } = restorationContext();+ const [locked, setLocked] = createSignal(false);+ context.delivery.sendLocked = locked;+ context.drafts.readDraft = vi.fn(async () => ({+ draft: message('draft', {+ is_draft: true,+ subject: 'Original subject',+ body_text: 'Original body',+ body_html_sanitized: null,+ }),+ persistence: 'queued' as const,+ }));+ const root = mountEmailComposer(context, undefined, {+ draft: message('draft', { is_draft: true }),+ });+ try {+ root.edit('Send-time watermark and stale body', 'Wrong subject');+ setLocked(delayedUnlock);+ restore();+ expect(root.state.context.disabled()).toBe(true);+ if (delayedUnlock) {+ await vi.advanceTimersByTimeAsync(600);+ expect(context.drafts.readDraft).not.toHaveBeenCalled();+ expect(context.drafts.saveDraft).not.toHaveBeenCalled();+ setLocked(false);+ }+ await vi.advanceTimersByTimeAsync(0);+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe(+ 'Original body'+ );+ expect(root.state.context.subject()).toBe('Original subject');+ expect(root.state.context.disabled()).toBe(false);+ await vi.advanceTimersByTimeAsync(600);+ expect(context.drafts.saveDraft).not.toHaveBeenCalled();+ } finally {+ root.dispose();+ }+ }+);++it('does not apply a restored draft after its composer unmounts', async () => {+ const { context, restore } = restorationContext();+ const pending =+ Promise.withResolvers<+ Awaited<ReturnType<NonNullable<typeof context.drafts.readDraft>>>+ >();+ context.drafts.readDraft = vi.fn(() => pending.promise);+ const root = mountEmailComposer(context, undefined, {+ draft: message('draft', { is_draft: true }),+ });+ root.edit('Keep current editor');+ restore();+ root.dispose();+ pending.resolve({+ draft: message('draft', {+ is_draft: true,+ body_text: 'Old restoration',+ body_html_sanitized: null,+ }),+ persistence: 'committed',+ });+ await vi.advanceTimersByTimeAsync(0);+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe(+ 'Keep current editor'+ );+ expect(context.drafts.saveDraft).not.toHaveBeenCalled();+});++it.each([false, true])(+ 'restores a completed mounted standalone composer after cancellation with delayed unlock: %s',+ async (delayedUnlock) => {+ const { context, restore } = restorationContext();+ const [locked, setLocked] = createSignal(false);+ context.delivery.sendLocked = (id) => id === 'draft' && locked();+ context.delivery.sendMessage = vi.fn(async () => {+ setLocked(true);+ return { draftId: 'draft', threadId: 'thread', inboxId: 'inbox' };+ });+ context.drafts.readDraft = vi.fn(async () => ({+ draft: message('draft', {+ is_draft: true,+ subject: 'Recovered subject',+ body_text: 'Recovered body',+ body_html_sanitized: null,+ }),+ persistence: 'queued' as const,+ }));+ const root = mountEmailComposer(context, undefined, {+ draft: message('draft', { is_draft: true }),+ });+ try {+ root.edit('Original send');+ root.state.context.onSend();+ await vi.advanceTimersByTimeAsync(0);+ expect(context.delivery.sendMessage).toHaveBeenCalledOnce();+ expect(root.state.draftId()).toBeUndefined();+ expect(root.state.context.disabled()).toBe(true);+ if (!delayedUnlock) setLocked(false);+ restore();+ if (delayedUnlock) {+ await vi.advanceTimersByTimeAsync(600);+ expect(context.drafts.readDraft).not.toHaveBeenCalled();+ setLocked(false);+ }+ await vi.advanceTimersByTimeAsync(0);+ expect(root.state.draftId()).toBe('draft');+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe(+ 'Recovered body'+ );+ expect(root.state.context.subject()).toBe('Recovered subject');+ expect(root.state.context.disabled()).toBe(false);+ root.edit('Edited recovered body');+ await vi.advanceTimersByTimeAsync(600);+ const saved = vi.mocked(context.drafts.saveDraft).mock.calls.at(-1)?.[0];+ expect(decodeBase64Utf8(saved?.draft.body_html ?? '')).toContain(+ 'Edited recovered body'+ );+ } finally {+ root.dispose();+ }+ }+);++it('blocks queued standalone envelope, attachment, signature, schedule, delete, and send changes', async () => {+ const context = createComposeContext();+ const [locked, setLocked] = createSignal(true);+ context.delivery.sendLocked = locked;+ const root = mountEmailComposer(context, undefined, {+ draft: message('draft', { is_draft: true, subject: 'Original' }),+ });+ try {+ const composer = root.state.context;+ const recipients = composer.recipients();+ expect(composer.disabled()).toBe(true);+ expect(composer.primaryActionDisabled()).toBe(true);+ expect(composer.schedule.pickerDisabled()).toBe(true);+ expect(composer.schedule.onSelect(new Date(Date.now() + 60_000))).toBe(+ false+ );+ expect(await composer.schedule.onCancel()).toBe(false);+ composer.setSubject('Changed');+ composer.setRecipients('to', []);+ composer.onSelectInbox?.('other');+ composer.onAddAttachments([new File(['audit'], 'audit.txt')]);+ root.state.setIncludeSignature(false);+ composer.onDelete?.();+ composer.onSend();+ await vi.advanceTimersByTimeAsync(600);+ expect(composer.subject()).toBe('Original');+ expect(composer.recipients()).toEqual(recipients);+ expect(composer.selectedInboxId?.()).toBe('inbox');+ expect(composer.attachments()).toEqual([]);+ expect(root.state.includeSignature()).toBe(true);+ expect(context.drafts.saveDraft).not.toHaveBeenCalled();+ expect(context.drafts.deleteDraft).not.toHaveBeenCalled();+ expect(context.delivery.sendMessage).not.toHaveBeenCalled();+ expect(context.delivery.unschedule).not.toHaveBeenCalled();+ setLocked(false);+ expect(composer.schedule.selectedTime()).toBeUndefined();+ expect(composer.schedule.actionLabel()).toBe('Send email');+ } finally {+ root.dispose();+ }+});++it.each([false, true])(+ 'reopens an empty post-send reply with its restored content and attachments when the journal unlock is delayed: %s',+ async (delayedUnlock) => {+ const { context, restore } = restorationContext();+ const [locked, setLocked] = createSignal(delayedUnlock);+ context.delivery.sendLocked = locked;+ const attachment = {+ id: 'upload',+ draft_id: 'draft',+ content_type: 'text/plain',+ file_name: 'original.txt',+ s3_key: 'fixture',+ size: 12,+ };+ context.drafts.readDraft = vi.fn(async () => ({+ draft: message('draft', {+ is_draft: true,+ replying_to_id: 'parent',+ body_text: 'Original reply',+ body_html_sanitized: null,+ attachments_draft: [attachment],+ }),+ persistence: 'queued' as const,+ }));+ const showReply = vi.fn();+ const root = mountReplyComposer(context, undefined, {+ setShowReply: showReply,+ });+ try {+ restore({ replyingToId: 'parent' });+ if (delayedUnlock) {+ await vi.advanceTimersByTimeAsync(600);+ expect(context.drafts.readDraft).not.toHaveBeenCalled();+ expect(context.drafts.saveDraft).not.toHaveBeenCalled();+ expect(showReply).not.toHaveBeenCalled();+ setLocked(false);+ }+ await vi.advanceTimersByTimeAsync(0);+ expect(root.savedDraftId()).toBe('draft');+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe(+ 'Original reply'+ );+ expect(root.form.attachments.list()).toEqual([+ expect.objectContaining({+ attachmentId: 'upload',+ fileName: 'original.txt',+ }),+ ]);+ expect(showReply).toHaveBeenCalledWith(true);+ await vi.advanceTimersByTimeAsync(600);+ expect(context.drafts.saveDraft).not.toHaveBeenCalled();+ } finally {+ root.dispose();+ }+ }+);++it('does not replace a newer edited reply with an earlier cancelled send', async () => {+ const { context, restore } = restorationContext();+ context.drafts.readDraft = vi.fn();+ const root = mountReplyComposer(context);+ try {+ root.edit('Newer reply text');+ restore({+ draftId: 'older-draft',+ originalDraftId: 'older-local',+ replyingToId: 'parent',+ });+ await vi.advanceTimersByTimeAsync(0);+ expect(context.drafts.readDraft).not.toHaveBeenCalled();+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe(+ 'Newer reply text'+ );+ } finally {+ root.dispose();+ }+});++it.each(['forward', 'reply', 'reply-all'] as const)(+ 'consumes external %s requests without changing a queued reply',+ async (type) => {+ const context = createComposeContext();+ const [locked, setLocked] = createSignal(true);+ const [request, setRequest] = createSignal<ReplyType>();+ context.delivery.sendLocked = locked;+ const clear = vi.fn(() => setRequest(undefined));+ const root = mountReplyComposer(+ context,+ undefined,+ { draft: message('draft', { is_draft: true }) },+ { replyRequest: { replyType: request, clear } }+ );+ try {+ const before = {+ type: root.form.replyType(),+ subject: root.form.subject(),+ recipients: JSON.stringify(root.form.recipients()),+ };+ setRequest(type);+ await vi.advanceTimersByTimeAsync(0);+ expect(clear).toHaveBeenCalledOnce();+ expect({+ type: root.form.replyType(),+ subject: root.form.subject(),+ recipients: JSON.stringify(root.form.recipients()),+ }).toEqual(before);+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe(+ 'Ready to send'+ );+ setLocked(false);+ await vi.advanceTimersByTimeAsync(600);+ expect(root.form.replyType()).toBe(before.type);+ expect(context.drafts.saveDraft).not.toHaveBeenCalled();+ } finally {+ root.dispose();+ }+ }+);++it('waits for durable storage before applying the initial Forward on a fresh composer', async () => {+ const context = createComposeContext();+ const [locked, setLocked] = createSignal(true);+ const [request, setRequest] = createSignal<ReplyType | undefined>('forward');+ context.delivery.sendLocked = locked;+ const clear = vi.fn(() => setRequest(undefined));+ const root = mountReplyComposer(+ context,+ undefined,+ {},+ { replyRequest: { replyType: request, clear } }+ );+ try {+ expect(clear).not.toHaveBeenCalled();+ setLocked(false);+ await vi.advanceTimersByTimeAsync(0);+ expect(root.form.replyType()).toBe('forward');+ expect(clear).toHaveBeenCalledOnce();+ } finally {+ root.dispose();+ }+});++it('explains why a queued reply cannot be sent again', () => {+ const context = createComposeContext();+ const [locked, setLocked] = createSignal(true);+ context.delivery.sendLocked = locked;+ const root = mountReplyComposer(context);+ try {+ expect(root.sendActionDisabled()).toBe(true);+ expect(root.sendUnavailableReason()).toBe(+ 'Queued to send. Cancel the send before editing.'+ );+ setLocked(false);+ expect(root.sendUnavailableReason()).toBeUndefined();+ } finally {+ root.dispose();+ }+});++it.each(['standalone', 'reply'] as const)(+ 'omits empty forwarded attachment identifiers from the %s send',+ async (kind) => {+ const context = createComposeContext();+ const root =+ kind === 'standalone'+ ? mountEmailComposer(context)+ : mountReplyComposer(context);+ const forwarded: DraftFormAttachment[] = [+ {+ type: 'forwarded',+ attachmentId: '',+ fileName: 'Unavailable',+ mimeType: 'text/plain',+ fileSize: 1,+ },+ {+ type: 'forwarded',+ attachmentId: 'forwarded-id',+ fileName: 'Available',+ mimeType: 'text/plain',+ fileSize: 1,+ },+ ];+ try {+ root.edit('Body with forwarded attachments');+ const form = 'state' in root ? root.state.form : root.form;+ for (const file of forwarded) form.attachments.add(file);+ if ('state' in root) {+ root.state.context.onSend();+ } else {+ await root.sendEmail();+ }+ await vi.advanceTimersByTimeAsync(0);+ expect(context.delivery.sendMessage).toHaveBeenCalledWith(+ expect.objectContaining({ forwardedAttachmentIds: ['forwarded-id'] })+ );+ } finally {+ root.dispose();+ }+ }+);diff --git a/apps/web/src/features/email-compose/primitives/email-composer.ts b/apps/web/src/features/email-compose/primitives/email-composer.tsindex caa099eb8e..d20fb1aef4 100644--- a/apps/web/src/features/email-compose/primitives/email-composer.ts+++ b/apps/web/src/features/email-compose/primitives/email-composer.ts@@ -2,6 +2,7 @@ import {attachmentLimitBytes,MACRO_EMAIL_SIGNATURE,} from '@app/features/email-compose/core/constants';+import { setEditorStateFromHtml } from '@core/component/LexicalMarkdown/utils/setEditorStateFromHtml';import { fireAndForget } from '@core/util/fireAndForget';import { $generateHtmlFromNodes } from '@lexical/html';import {@@ -72,11 +73,13 @@ import {createDraftPersistence,deleteDraftForDiscard,} from './draft-persistence';+import { observeDraftRestoration } from './draft-restoration';import { createDraftSaveNotice } from './draft-save-notice';import { createDraftSession } from './draft-session';import { createDraftTransfer } from './draft-transfer';import { createEmailSendSchedule } from './email-send-schedule';import {+ pendingInlineMedia,refuseSend,sendRefusalAfterSave,sendRefusalBeforeSave,@@ -187,6 +190,11 @@ export function createEmailComposer(props: EmailComposerOptions) {// FE only renders the preview and signals an explicit dismiss.const signature = () => link()?.settings.signature ?? undefined;const [includeSignature, setIncludeSignature] = createSignal(true);+ const [draftGeneration, setDraftGeneration] = createSignal(+ props.localDraft?.content.draft_generation ??+ props.draft?.draft_generation ??+ 0+ );const hasInboxError = createMemo(() => {if (props.accounts.loading()) return false;@@ -197,6 +205,8 @@ export function createEmailComposer(props: EmailComposerOptions) {const [editor, setEditor] = createSignal<LexicalEditor | undefined>();const [content, setContent] = createSignal('');+ const [restoring, setRestoring] = createSignal(false);+ const [restoredBodyHtml, setRestoredBodyHtml] = createSignal<string>();// The selected sender can change before the server migrates the draft.// Lifecycle reads always use one complete persisted identity.const session = createDraftSession(@@ -219,7 +229,10 @@ export function createEmailComposer(props: EmailComposerOptions) {code: 'INTERNAL',});const currentDraftId = session.draftId;+ const [sentDraftId, setSentDraftId] = createSignal<string>();const currentThreadId = session.threadId;+ const sendLocked = () =>+ props.delivery.sendLocked?.(currentDraftId() ?? sentDraftId()) ?? false;observeDraftIdentity(props.drafts,session,@@ -230,7 +243,19 @@ export function createEmailComposer(props: EmailComposerOptions) {void retryDraft().catch(props.notices.reportError);} else detachFromObsoleteDraft('Saving your edits as a new draft.');},- handleAlreadySent+ handleAlreadySent,+ async () => {+ if (+ sendLocked() ||+ schedule.state().type === 'scheduled' ||+ !session.autosaveAllowed() ||+ props.connectivity.looksOffline()+ )+ return false;+ const draftId = session.draftId();+ if (draftId && session.serverConfirmed())+ await attachmentPersistence.upload(draftId);+ });const persistedInboxId = session.inboxId;const [movingInbox, setMovingInbox] = createSignal(false);@@ -245,7 +270,12 @@ export function createEmailComposer(props: EmailComposerOptions) {});const attachmentPersistence = createAttachmentPersistence({+ draftGeneration,confirmRemoval: !!props.drafts.saveLocalDraft,+ allowed: () =>+ !sendLocked() &&+ schedule.state().type !== 'scheduled' &&+ !props.connectivity.looksOffline(),services: props.attachmentStorage,attachments: form.attachments,draftId: () =>@@ -269,9 +299,7 @@ export function createEmailComposer(props: EmailComposerOptions) {form.setRecipients('cc', restoredSnapshot.recipients.cc);form.setRecipients('bcc', restoredSnapshot.recipients.bcc);form.setSubject(restoredSnapshot.subject);- for (const attachment of restoredSnapshot.attachments) {- form.attachments.add(attachment);- }+ form.attachments.replace(restoredSnapshot.attachments);setIncludeSignature(restoredSnapshot.includeSignature);}@@ -321,6 +349,7 @@ export function createEmailComposer(props: EmailComposerOptions) {subject: form.subject(),to: form.recipients().to.map(convertEmailRecipientToContactInfo),include_signature: includeSignature() ? undefined : false,+ draft_generation: draftGeneration(),};}@@ -372,6 +401,7 @@ export function createEmailComposer(props: EmailComposerOptions) {}const persistence = createDraftPersistence({+ draftGeneration,session,drafts: props.drafts,attachments: attachmentPersistence,@@ -420,6 +450,7 @@ export function createEmailComposer(props: EmailComposerOptions) {'idle' | 'preparing' | 'sending'>('idle');const submitting = () => sendPhase() !== 'idle';+ let sendOperationVersion = 0;const [discarding, setDiscarding] = createSignal(false);const [completed, setCompleted] = createSignal(false);const [terminalState, setTerminalState] = createSignal<@@ -441,6 +472,8 @@ export function createEmailComposer(props: EmailComposerOptions) {operationSource?.needsReload?.() ||operationBlocksEditing(currentOperation());const persistencePaused = () =>+ restoring() ||+ sendLocked() ||operationBlocked() ||submitting() ||discarding() ||@@ -470,6 +503,46 @@ export function createEmailComposer(props: EmailComposerOptions) {},paused: persistencePaused,});+ observeDraftRestoration({+ storage: props.drafts,+ accepts: (change) =>+ [change.draftId, change.originalDraftId].includes(+ currentDraftId() ?? sentDraftId() ?? ''+ ),+ ready: () => !sendLocked(),+ version: () => `${identityVersion}:${editVersion}:${session.epoch()}`,+ cancelPendingSave: () => {+ identityVersion += 1;+ sendOperationVersion += 1;+ setSendPhase('idle');+ autosave.cancel();+ },+ setPending: setRestoring,+ restore: (draft, change, restoredPersistence, local, attachments) => {+ persistence.restored(local);+ setDraftGeneration(draft.draft_generation ?? 0);+ session.dispatch({+ type: 'seeded',+ draftId: draft.db_id,+ threadId: draft.thread_db_id,+ inboxId: draft.link_id,+ persistence: restoredPersistence,+ });+ form.restoreDraft(draft);+ if (attachments) form.attachments.replace(attachments);+ setIncludeSignature(change.includeSignature !== false);+ const bodyHtml = draft.body_html_sanitized+ ? decodeBase64Utf8(draft.body_html_sanitized)+ : plainTextToHtml(draft.body_text ?? '');+ setRestoredBodyHtml(bodyHtml);+ const currentEditor = editor();+ if (currentEditor) setEditorStateFromHtml(currentEditor, bodyHtml);+ setDraftDirty(false);+ setSentDraftId(undefined);+ setCompleted(false);+ },+ reportError: props.notices.reportError,+ });const saveForSchedule = async () => {if (deliveryBlocked()) return undefined;@@ -497,11 +570,13 @@ export function createEmailComposer(props: EmailComposerOptions) {};schedule = createEmailSendSchedule({+ draftGeneration,delivery: props.delivery,notices: props.notices,initialScheduledTime: props.draft?.scheduled_send_time? new Date(props.draft.scheduled_send_time): undefined,+ initialDeliveryStatus: props.draft?.scheduled_send_status ?? undefined,draftId: currentDraftId,saveDraft: saveForSchedule,threadId: currentThreadId,@@ -523,6 +598,7 @@ export function createEmailComposer(props: EmailComposerOptions) {},});const cancelSchedule = async () => {+ if (sendLocked() || restoring()) return false;if (!(await schedule.cancel())) return false;session.dispatch({ type: 'schedule-cancelled' });// An in-place schedule marked the composer complete; a host that keeps it@@ -541,17 +617,19 @@ export function createEmailComposer(props: EmailComposerOptions) {const attachmentLinks = createAttachmentLinkOffer({editor,+ canEdit: () =>+ !persistencePaused() && terminalState() === undefined && !hasInboxError(),+ version: () =>+ `${identityVersion}:${session.epoch()}:${activeInboxId() ?? ''}`,notices: props.notices,editorFiles: props.editorFiles,});const handleAddAttachments = async (files: File[]) => {if (persistencePaused()) return;- if (- !props.drafts.saveLocalDraft &&- (await refuseAttachmentsOffline(props.connectivity, props.notices))- )+ if (await refuseAttachmentsOffline(props.connectivity, props.notices))return;+ if (persistencePaused()) return;const limit = attachmentLimitBytes(props.accounts.inboxes().find((inbox) => inbox.id === activeInboxId())?.provider@@ -622,27 +700,33 @@ export function createEmailComposer(props: EmailComposerOptions) {const restoreAfterUndoSend = async (draftId: string,threadId: string | undefined,- inboxId: string | undefined+ inboxId: string | undefined,+ draftRestored = false) => {const snapshot = composeUndo.peek(draftId);- await props.drafts.restoreDraft({- draftId,- threadId,- draft: snapshot- ? {- bcc: snapshot.recipients.bcc.map(- convertEmailRecipientToContactInfo- ),- cc: snapshot.recipients.cc.map(convertEmailRecipientToContactInfo),- db_id: draftId,- subject: snapshot.subject,- sender_email: snapshot.senderEmail,- to: snapshot.recipients.to.map(convertEmailRecipientToContactInfo),- }- : undefined,- html: snapshot?.bodyHtml,- inboxId,- });+ if (!draftRestored)+ await props.drafts.restoreDraft({+ draftId,+ threadId,+ draft: snapshot+ ? {+ bcc: snapshot.recipients.bcc.map(+ convertEmailRecipientToContactInfo+ ),+ cc: snapshot.recipients.cc.map(+ convertEmailRecipientToContactInfo+ ),+ db_id: draftId,+ subject: snapshot.subject,+ sender_email: snapshot.senderEmail,+ to: snapshot.recipients.to.map(+ convertEmailRecipientToContactInfo+ ),+ }+ : undefined,+ html: snapshot?.bodyHtml,+ inboxId,+ });props.host?.showDraft?.(draftId);};@@ -651,13 +735,16 @@ export function createEmailComposer(props: EmailComposerOptions) {const undoSend = (draftId: string,threadId: string | undefined,- inboxId: string | undefined+ inboxId: string | undefined,+ sendAttemptId?: string) =>props.delivery.undoSend({+ sendAttemptId,threadId,draftId,inboxId,- onUndone: () => restoreAfterUndoSend(draftId, threadId, inboxId),+ onUndone: (result) =>+ restoreAfterUndoSend(draftId, threadId, inboxId, result?.draftRestored),});const afterSend = (@@ -668,22 +755,33 @@ export function createEmailComposer(props: EmailComposerOptions) {const threadId = identity.threadId;if (draftId) endUndoSend(draftId);try {- const toastId = props.notices.feedback.success('Email sent', {- actions: draftId- ? [- {- label: 'Undo',- onClick: () => {- if (toastId != null) props.notices.feedback.dismiss(toastId);- void undoSend(draftId, threadId ?? undefined, inboxId).catch(- props.notices.reportError- );+ const toastId = props.notices.feedback.success(+ identity.sendAttemptId+ ? identity.persistence === 'queued'+ ? 'Email queued to send'+ : 'Email sending'+ : 'Email sent',+ {+ actions: draftId+ ? [+ {+ label: 'Undo',+ onClick: () => {+ if (toastId != null)+ props.notices.feedback.dismiss(toastId);+ void undoSend(+ draftId,+ threadId ?? undefined,+ inboxId,+ identity.sendAttemptId+ ).catch(props.notices.reportError);+ },},- },- ]- : undefined,- duration: 5_000,- });+ ]+ : undefined,+ duration: 5_000,+ }+ );} catch (error) {props.notices.reportError(error);}@@ -697,6 +795,7 @@ export function createEmailComposer(props: EmailComposerOptions) {const onSubmit = async () => {if (deliveryBlocked()) return;if (+ restoring() ||attachmentPersistence.removing() ||schedule.pending() ||submitting() ||@@ -704,7 +803,8 @@ export function createEmailComposer(props: EmailComposerOptions) {movingInbox() ||draftTransfer?.pending() ||completed() ||- terminalState()+ terminalState() ||+ sendLocked())return;setValidationError(null);@@ -745,18 +845,45 @@ export function createEmailComposer(props: EmailComposerOptions) {return;}- const offline = sendRefusalBeforeSave(props.connectivity);+ const offline = sendRefusalBeforeSave(+ props.connectivity,+ props.delivery.queueActive?.(activeInboxId()),+ form.attachments+ .list()+ .some(+ (attachment) => attachment.type === 'local' && !attachment.uploaded+ )+ );if (offline) return refuseSend(props.notices, offline);+ if (pendingInlineMedia(editor()))+ return refuseSend(props.notices, 'media-not-uploaded');if (attachmentLinks.uploading())return refuseSend(props.notices, 'files-uploading');const scheduleAction = schedule.action();+ const queuedLater =+ scheduleAction === 'schedule' &&+ !!props.delivery.queueActive?.(activeInboxId());+ const selectedTime = queuedLater ? schedule.selectedTime() : undefined;+ if (+ queuedLater &&+ (!selectedTime ||+ !Number.isFinite(selectedTime.getTime()) ||+ selectedTime.getTime() <= Date.now())+ ) {+ props.notices.feedback.alert('Choose a future send time.');+ return;+ }+ const sendTime = selectedTime?.toISOString();if (scheduleAction === 'unavailable') {props.notices.feedback.alert(`This email is scheduled for ${schedule.confirmedTime()?.toLocaleString()}. Choose a new time to update it, or cancel the schedule to edit.`);return;}- if (scheduleAction === 'schedule' || scheduleAction === 'update') {+ if (+ (scheduleAction === 'schedule' && !queuedLater) ||+ scheduleAction === 'update'+ ) {const result = await schedule.submit();if (result === 'scheduled') {const scheduledDraftId = currentDraftId();@@ -773,18 +900,38 @@ export function createEmailComposer(props: EmailComposerOptions) {}setSendPhase('preparing');+ const sendOperation = ++sendOperationVersion;const sendGeneration = identityVersion;try {- // Ensure the draft is saved before sending so undo-send always has a- // draft id to snapshot and restore (the send reuses the draft's db_id).+ // Durable sends need the latest local copy, without waiting for a server save.const epochBeforeSave = session.epoch();- try {- await autosave.save(undefined, { acknowledge: false });- } catch {- // Draft save is best-effort; the send still works without one.+ if (+ props.delivery.queueActive?.(activeInboxId()) &&+ props.drafts.saveLocalDraft &&+ form.attachments+ .list()+ .every((attachment) =>+ attachment.type === 'local'+ ? attachment.uploaded+ : attachment.type === 'remote'+ ? !attachment.uploadPending+ : true+ ) &&+ (form.attachments.list().length === 0 || session.serverConfirmed())+ ) {+ await autosave.saveLocal();+ } else {+ try {+ await autosave.save(undefined, { acknowledge: false });+ } catch {+ // Legacy standalone sends can proceed without a saved draft.+ }}// Already sent from another device: the composer was reset mid-save.if (session.isStale(epochBeforeSave)) return;+ const expectedLocalVersion = props.delivery.queueActive?.(activeInboxId())+ ? persistence.localVersion()+ : undefined;const identity = session.identity();const refusal = sendRefusalAfterSave({identity,@@ -792,6 +939,7 @@ export function createEmailComposer(props: EmailComposerOptions) {attachments: form.attachments.list(),// A failed REST save leaves unused handles; the send can still create the message.unqueuedHandleMaySend: true,+ queueActive: props.delivery.queueActive?.(activeInboxId()),});if (refusal) return refuseSend(props.notices, refusal);@@ -800,16 +948,22 @@ export function createEmailComposer(props: EmailComposerOptions) {completed() ||terminalState() ||schedule.pending() ||- schedule.action() !== 'send'+ (schedule.action() !== 'send' &&+ !(queuedLater && schedule.selectedTime()?.toISOString() === sendTime)))return;const draftId = identity.kind === 'server' ? identity.draftId : undefined;+ if (pendingInlineMedia(editor()))+ return refuseSend(props.notices, 'media-not-uploaded');+// Snapshot editor state before watermark so undo-send can restore itif (draftId) rememberForUndo(draftId, currentLink.id);// Append watermark after all validation passes so failed sends don't// leave orphaned watermark nodes in the editor tree.+ const restoration = prepareEmailBody(currentEditor);+ const restoreMacro = content();const cleanupWatermark = $appendWatermarkNodeToLast(currentEditor,!hasPaidAccess() ? MACRO_EMAIL_SIGNATURE : undefined@@ -826,10 +980,23 @@ export function createEmailComposer(props: EmailComposerOptions) {try {setSendPhase('sending');const result = await props.delivery.sendMessage({- clientHandles:- session.identity().kind === 'handle' && session.draftId()- ? { draftId: session.draftId()!, threadId: session.threadId() }- : undefined,+ sendTime,+ expectedLocalVersion,+ clientHandles: {+ draftId: currentDraftId()!,+ threadId: currentThreadId(),+ },+ attachmentIds: form.attachments+ .list()+ .filter((a) => a.type === 'local' || a.type === 'remote')+ .flatMap((a) => (a.attachmentId ? [a.attachmentId] : [])),+ forwardedAttachmentIds: form.attachments+ .list()+ .filter((a) => a.type === 'forwarded' || a.type === 'native')+ .flatMap((a) => (a.attachmentId ? [a.attachmentId] : [])),+ restoreBodyHtml: restoration?.bodyHtml,+ restoreBodyText: restoration?.bodyText,+ restoreBodyMacro: restoreMacro,message: {sender_email: form.senderEmail() ?? link()?.email_address,to: convertToContactInfoArray(recipients.to),@@ -849,26 +1016,42 @@ export function createEmailComposer(props: EmailComposerOptions) {// Backend includes the signature by default for new emails; only signal// an explicit dismiss. Omitting it falls through to the backend default.include_signature: includeSignature() ? undefined : false,+ draft_generation: draftGeneration(),},inboxId: activeInboxId(),});+ if (+ sendGeneration !== identityVersion ||+ session.isStale(epochBeforeSave)+ )+ return;+ cleanupWatermark();+ setSentDraftId(currentDraftId());setCompleted(true);session.dispatch({ type: 'reset' });+ setDraftGeneration(0);afterSend(result, currentLink.id);} finally {- cleanupWatermark();+ if (+ sendGeneration === identityVersion &&+ !session.isStale(epochBeforeSave)+ )+ cleanupWatermark();}} catch (error) {+ if (sendGeneration !== identityVersion) return;props.notices.reportError(error);if (!completed()) props.notices.feedback.failure('Failed to send email');} finally {- setSendPhase('idle');+ if (sendOperation === sendOperationVersion) setSendPhase('idle');}};const scheduling = schedule.pending;const scheduleBlocked = () =>+ sendLocked() ||+ restoring() ||deliveryBlocked() ||attachmentPersistence.removing() ||submitting() ||@@ -884,10 +1067,13 @@ export function createEmailComposer(props: EmailComposerOptions) {// --- Reset / delete ---const resetState = () => {+ setSentDraftId(undefined);+ setRestoredBodyHtml(plainTextToHtml(''));attachmentLinks.detach();clearEmailBody(editor());setContent('');session.dispatch({ type: 'reset' });+ setDraftGeneration(0);form.clear();schedule.reset();setTerminalState(undefined);@@ -944,6 +1130,7 @@ export function createEmailComposer(props: EmailComposerOptions) {identityVersion += 1;autosave.cancel();session.dispatch({ type: 'reset' });+ setDraftGeneration(0);const omittedAttachments = attachmentPersistence.detach();attachmentLinks.detach();schedule.detach();@@ -961,15 +1148,27 @@ export function createEmailComposer(props: EmailComposerOptions) {let lastScheduledTime = schedule.confirmedTime()?.toISOString();let handledTerminalIdentity: string | undefined;+ let reconcileAfterQueuedSend = false;const lifecycleInputs = () =>[lifecycle.state(),scheduling(),movingInbox() || !!draftTransfer?.pending(),submitting(),+ sendLocked() || restoring(),] as const;createEffect(- on(lifecycleInputs, ([state, , moving, sending]) => {+ on(lifecycleInputs, ([state, , moving, sending, queued]) => {+ if (queued) {+ reconcileAfterQueuedSend = true;+ return;+ }+ if (reconcileAfterQueuedSend) {+ reconcileAfterQueuedSend = false;+ // Admission's non-draft observation predates the cancellation.+ void lifecycle.refresh().catch(props.notices.reportError);+ return;+ }// While this composer sends, the draft turning into a sent message is// its own doing; the send settles the composer and replays the rest.if (@@ -1038,6 +1237,7 @@ export function createEmailComposer(props: EmailComposerOptions) {identityVersion += 1;autosave.cancel();session.dispatch({ type: 'reset' });+ setDraftGeneration(0);schedule.detach();setCompleted(true);setTerminalState(state.type);@@ -1054,6 +1254,8 @@ export function createEmailComposer(props: EmailComposerOptions) {);draftTransfer = createDraftTransfer({+ draftGeneration,+ onTransferred: () => setDraftGeneration(0),session,drafts: props.drafts,attachments: form.attachments,@@ -1065,6 +1267,8 @@ export function createEmailComposer(props: EmailComposerOptions) {});const selectInbox = async (inboxId: string, senderEmail?: string) => {if (+ sendLocked() ||+ restoring() ||(!draftTransfer?.pending() && deliveryBlocked()) ||submitting() ||discarding() ||@@ -1122,6 +1326,7 @@ export function createEmailComposer(props: EmailComposerOptions) {// --- Derived state ---const initialHtml = () => {+ if (restoredBodyHtml() !== undefined) return restoredBodyHtml();if (restoredSnapshot) {return restoredSnapshot.bodyHtml;}@@ -1216,11 +1421,14 @@ export function createEmailComposer(props: EmailComposerOptions) {operation: schedule.operation,onSelect: handleSendTimeChange,onCancel: cancelSchedule,- pickerDisabled: () => scheduleBlocked() || scheduling(),+ onCheckStatus: schedule.checkStatus,+ pickerDisabled: () => scheduleBlocked() || schedule.pickerDisabled(),},// Statusdisabled: () =>+ restoring() ||+ sendLocked() ||operationBlocked() ||hasInboxError() ||submitting() ||@@ -1232,6 +1440,7 @@ export function createEmailComposer(props: EmailComposerOptions) {scheduling() ||schedule.state().type === 'scheduled',primaryActionDisabled: () =>+ sendLocked() ||deliveryBlocked() ||hasInboxError() ||submitting() ||@@ -1250,6 +1459,8 @@ export function createEmailComposer(props: EmailComposerOptions) {terminalState() ??(schedule.state().type === 'scheduled' ? 'scheduled' : 'draft'),sendUnavailableReason: () => {+ if (sendLocked())+ return 'Queued to send. Cancel the send before editing.';if (terminalState() === 'sent')return 'This email has already been sent.';if (terminalState() === 'missing')@@ -1314,7 +1525,10 @@ export function createEmailComposer(props: EmailComposerOptions) {deleteDraftAndReset,signature,includeSignature,- setIncludeSignature,+ setIncludeSignature: (include: boolean) => {+ if (persistencePaused() || scheduling()) return;+ setIncludeSignature(include);+ },};}diff --git a/apps/web/src/features/email-compose/primitives/email-form-sender.test.ts b/apps/web/src/features/email-compose/primitives/email-form-sender.test.tsindex 2ac4acc6c6..e5189a283e 100644--- a/apps/web/src/features/email-compose/primitives/email-form-sender.test.ts+++ b/apps/web/src/features/email-compose/primitives/email-form-sender.test.ts@@ -144,3 +144,56 @@ it('does not pick an alias belonging only to another connected inbox', () =>dispose();}}));++it.each(['[email protected]', '[email protected]'])(+ 'restores sender %s and edited recipients into a new reply after cancellation',+ (email) =>+ createRoot((dispose) => {+ try {+ const [inboxes, setInboxes] = createSignal<SenderInbox[]>([loaded]);+ const form = createEmailFormState(+ { viewerEmail: () => '[email protected]', inboxes },+ { type: 'replying_to', messageId: 'parent' },+ {+ getMessageById: () => parent,+ getDraftForMessageReply: () => undefined,+ }+ );+ form.setSelectedInbox(+ 'inbox',+ email === '[email protected]'+ ? '[email protected]'+ : '[email protected]'+ );+ form.clear();+ const revision = form.editRevision();+ form.restoreDraft(+ message('restored', {+ is_draft: true,+ link_id: 'inbox',+ from: { email },+ to: [{ email: '[email protected]' }],+ cc: [{ email: '[email protected]' }],+ bcc: [{ email: '[email protected]' }],+ body_html_sanitized: null,+ })+ );+ // Catalog refreshes must not re-derive explicit restored choices.+ setInboxes([primary]);+ setInboxes([loaded]);+ expect(form.senderEmail()).toBe(email);+ expect(form.recipients().to.map((item) => item.data.email)).toEqual([+ '[email protected]',+ ]);+ expect(form.recipients().cc.map((item) => item.data.email)).toEqual([+ '[email protected]',+ ]);+ expect(form.recipients().bcc.map((item) => item.data.email)).toEqual([+ '[email protected]',+ ]);+ expect(form.editRevision()).toBe(revision);+ } finally {+ dispose();+ }+ })+);diff --git a/apps/web/src/features/email-compose/primitives/email-form-state.ts b/apps/web/src/features/email-compose/primitives/email-form-state.tsindex 1a36613004..10241399b1 100644--- a/apps/web/src/features/email-compose/primitives/email-form-state.ts+++ b/apps/web/src/features/email-compose/primitives/email-form-state.ts@@ -157,8 +157,8 @@ export function createEmailFormState(].filter((address): address is string => !!address);const [recipientsEdited, setRecipientsEdited] = createSignal(false);- const draftContainsAppendedReply = () => {- const encoded = draft?.body_html_sanitized;+ const draftContainsAppendedReply = (message = draft) => {+ const encoded = message?.body_html_sanitized;if (!encoded) return false;const decodedHtml = decodeBase64Utf8(encoded);if (!decodedHtml) return false;@@ -211,47 +211,50 @@ export function createEmailFormState(// Values and edit revisions may outlive a mounted composer; effects do not.const [editRevision, setEditRevision] = createSignal(0);- const representedIds = new Set([- ...(draft?.attachments_draft.map((a) => a.id) ?? []),- ...(draft?.attachments_forwarded.map((a) => a.attachment_id) ?? []),- ]);- const representedCids = new Set(- [...representedIds].map((id) => `${id}@attachments.macro.com`)- );- for (const file of draft?.attachments_draft ?? [])- if (file.content_id) representedCids.add(file.content_id);- const [attachments, setAttachments] = createSignal<DraftFormAttachment[]>([- ...(draft?.attachments- .filter(- (a) =>- !representedIds.has(a.db_id) &&- !representedCids.has(a.content_id?.replace(/^<|>$/g, '') ?? '')- )- .map((a) => ({- type: 'native' as const,- referenceUrl: a.reference_url,- attachmentId: a.db_id,+ const draftAttachments = (message?: EmailMessage): DraftFormAttachment[] => {+ const representedIds = new Set([+ ...(message?.attachments_draft.map((a) => a.id) ?? []),+ ...(message?.attachments_forwarded.map((a) => a.attachment_id) ?? []),+ ]);+ const representedCids = new Set(+ [...representedIds].map((id) => `${id}@attachments.macro.com`)+ );+ for (const file of message?.attachments_draft ?? [])+ if (file.content_id) representedCids.add(file.content_id);+ return [+ ...(message?.attachments+ .filter(+ (a) =>+ !representedIds.has(a.db_id) &&+ !representedCids.has(a.content_id?.replace(/^<|>$/g, '') ?? '')+ )+ .map((a) => ({+ type: 'native' as const,+ referenceUrl: a.reference_url,+ attachmentId: a.db_id,+ fileName: a.filename ?? 'attachment',+ mimeType: a.mime_type ?? 'application/octet-stream',+ fileSize: a.size_bytes ?? 0,+ })) ?? []),+ ...(message?.attachments_draft.map((a) => ({+ type: 'remote' as const,+ uploadPending: a.upload_pending,+ attachmentId: a.id,+ contentType: a.content_type,+ fileName: a.file_name,+ url: a.s3_key,+ fileSize: a.size,+ })) ?? []),+ ...(message?.attachments_forwarded.map((a) => ({+ type: 'forwarded' as const,+ attachmentId: a.attachment_id,fileName: a.filename ?? 'attachment',mimeType: a.mime_type ?? 'application/octet-stream',fileSize: a.size_bytes ?? 0,})) ?? []),- ...(draft?.attachments_draft.map((a) => ({- type: 'remote' as const,- uploadPending: a.upload_pending,- attachmentId: a.id,- contentType: a.content_type,- fileName: a.file_name,- url: a.s3_key,- fileSize: a.size,- })) ?? []),- ...(draft?.attachments_forwarded.map((a) => ({- type: 'forwarded' as const,- attachmentId: a.attachment_id,- fileName: a.filename ?? 'attachment',- mimeType: a.mime_type ?? 'application/octet-stream',- fileSize: a.size_bytes ?? 0,- })) ?? []),- ]);+ ];+ };+ const [attachments, setAttachments] = createSignal(draftAttachments(draft));const setRecipients = (field: keyof EmailFormRecipients,@@ -356,6 +359,28 @@ export function createEmailFormState(return {draft,+ restoreDraft(message: EmailMessage) {+ setSelectedInboxId(message.link_id);+ setSenderChoice({ email: message.from?.email });+ setRecipientsEdited(true);+ setState({+ subject: message.subject ?? '',+ recipients: {+ to: message.to.map(convertContactInfoToEmailRecipient),+ cc: message.cc.map(convertContactInfoToEmailRecipient),+ bcc: message.bcc.map(convertContactInfoToEmailRecipient),+ },+ withQuotedText: draftContainsAppendedReply(message),+ });+ setAttachments(draftAttachments(message));+ options?.onRecipientsChange?.(+ unwrap([+ ...state.recipients.to,+ ...state.recipients.cc,+ ...state.recipients.bcc,+ ])+ );+ },replyAppended: () => state.withQuotedText,setReplyAppended: (next: boolean) => setState('withQuotedText', next),recipients: () => {@@ -388,7 +413,8 @@ export function createEmailFormState(attachments: {clear: () => setAttachments([]),list: attachments,- replace: (files: DraftFormAttachment[]) => setAttachments(files),+ replace: (next: DraftFormAttachment[]) => setAttachments([...next]),+markUploadComplete: (attachmentId: string) =>setAttachments((files) =>files.map((file) =>diff --git a/apps/web/src/features/email-compose/primitives/email-send-schedule.ts b/apps/web/src/features/email-compose/primitives/email-send-schedule.tsindex aba2c01ff8..2585ad040f 100644--- a/apps/web/src/features/email-compose/primitives/email-send-schedule.ts+++ b/apps/web/src/features/email-compose/primitives/email-send-schedule.ts@@ -14,7 +14,12 @@ export type EmailDeliveryIntent =export type EmailScheduleState =| { type: 'editing'; intent: EmailDeliveryIntent }- | { type: 'scheduled'; confirmedTime: Date; proposedTime?: Date };+ | {+ type: 'scheduled';+ confirmedTime: Date;+ proposedTime?: Date;+ deliveryStatus?: 'pending' | 'sending' | 'failed' | 'unconfirmed';+ };export type EmailScheduleAction =| 'send'@@ -22,6 +27,14 @@ export type EmailScheduleAction =| 'update'| 'unavailable';+export function scheduleTimeLocked(state: EmailScheduleState) {+ return (+ state.type === 'scheduled' &&+ state.deliveryStatus !== undefined &&+ state.deliveryStatus !== 'pending'+ );+}+export function getScheduleSelection(state: EmailScheduleState) {if (state.type === 'editing') {return state.intent.type === 'later' ? state.intent.sendTime : undefined;@@ -35,6 +48,7 @@ export function getScheduleAction(if (state.type === 'editing') {return state.intent.type === 'later' ? 'schedule' : 'send';}+ if (scheduleTimeLocked(state)) return 'unavailable';return state.proposedTime ? 'update' : 'unavailable';}@@ -60,7 +74,12 @@ export function createEmailSendSchedule(options: {delivery: Pick<EmailDelivery, 'schedule' | 'unschedule' | 'archive'>;notices: EmailComposeFeedback;initialScheduledTime?: Date;+ initialDeliveryStatus?: Extract<+ EmailScheduleState,+ { type: 'scheduled' }+ >['deliveryStatus'];draftId: Accessor<string | null | undefined>;+ draftGeneration?: Accessor<number>;saveDraft: () => Promise<string | undefined>;threadId: Accessor<string | null | undefined>;/** Scheduling marks the thread done only when this reports it in the inbox. */@@ -95,6 +114,7 @@ export function createEmailSendSchedule(options: {? {type: 'scheduled',confirmedTime: options.initialScheduledTime,+ deliveryStatus: options.initialDeliveryStatus,}: { type: 'editing', intent: { type: 'immediate' } });@@ -127,6 +147,8 @@ export function createEmailSendSchedule(options: {/** Picker changes are deliberately local. They never mutate delivery state. */const select = (date: Date | null): boolean => {if (pending()) return false;+ const before = state();+ if (scheduleTimeLocked(before)) return false;selectionRevision += 1;setState((current) => {if (current.type === 'editing') {@@ -136,30 +158,38 @@ export function createEmailSendSchedule(options: {}if (!date || sameTime(date, current.confirmedTime)) {- return { type: 'scheduled', confirmedTime: current.confirmedTime };+ return { ...current, proposedTime: undefined };}return {- type: 'scheduled',- confirmedTime: current.confirmedTime,+ ...current,proposedTime: date,};});return true;};- const applyScheduled = (sendTime: Date, replaceProposal = false) => {+ const applyScheduled = (+ sendTime: Date,+ replaceProposal = false,+ deliveryStatus?: Extract<+ EmailScheduleState,+ { type: 'scheduled' }+ >['deliveryStatus']+ ) => {const current = state();if (!replaceProposal &¤t.type === 'scheduled' &&sameTime(current.confirmedTime, sendTime) &&- current.proposedTime+ current.proposedTime &&+ (!deliveryStatus || deliveryStatus === 'pending')) {+ setState({ ...current, deliveryStatus });return;}scheduledDraftId = options.draftId() ?? scheduledDraftId;selectionRevision += 1;- setState({ type: 'scheduled', confirmedTime: sendTime });+ setState({ type: 'scheduled', confirmedTime: sendTime, deliveryStatus });};const applyEditing = () => {@@ -180,7 +210,7 @@ export function createEmailSendSchedule(options: {}if (next === ignoredLifecycleObservation) return;if (next.type === 'scheduled') {- applyScheduled(new Date(next.sendTime));+ applyScheduled(new Date(next.sendTime), false, next.deliveryStatus);return;}if (next.type === 'editing') applyEditing();@@ -210,6 +240,7 @@ export function createEmailSendSchedule(options: {}) => {try {await delivery.unschedule({+ draftGeneration: options.draftGeneration?.(),draftId: input.draftId,threadId: input.threadId,inboxId: input.inboxId,@@ -332,6 +363,7 @@ export function createEmailSendSchedule(options: {try {await delivery.schedule({+ draftGeneration: options.draftGeneration?.(),draftId,threadId: options.threadId() ?? undefined,sendTime: requested.toISOString(),@@ -461,6 +493,11 @@ export function createEmailSendSchedule(options: {const cancel = async (): Promise<boolean> => {const before = state();if (before.type !== 'scheduled' || pending()) return false;+ if (+ before.deliveryStatus === 'sending' ||+ before.deliveryStatus === 'unconfirmed'+ )+ return false;const draftId = options.draftId();if (!draftId) return false;const generation = options.generation();@@ -470,6 +507,7 @@ export function createEmailSendSchedule(options: {try {try {await delivery.unschedule({+ draftGeneration: options.draftGeneration?.(),draftId,threadId: options.threadId() ?? undefined,inboxId,@@ -507,6 +545,18 @@ export function createEmailSendSchedule(options: {}};+ const checkStatus = async () => {+ try {+ const next = await options.reconcile?.();+ if (next) observe(next);+ } catch (error) {+ notices.reportError(error);+ notices.feedback.failure(+ 'Could not check delivery status. Try again when you have service.'+ );+ }+ };+/** Preserve a proposed replacement as inert local intent after detaching. */const detach = () => {const current = state();@@ -530,9 +580,11 @@ export function createEmailSendSchedule(options: {confirmedTime,action: () => getScheduleAction(state()),actionLabel: () => getScheduleActionLabel(state()),+ pickerDisabled: () => pending() || scheduleTimeLocked(state()),select,submit,cancel,+ checkStatus,observe,detach,reset: () => {diff --git a/apps/web/src/features/email-compose/primitives/pending-inline-media.test.ts b/apps/web/src/features/email-compose/primitives/pending-inline-media.test.tsnew file mode 100644index 0000000000..731cc2b8e6--- /dev/null+++ b/apps/web/src/features/email-compose/primitives/pending-inline-media.test.ts@@ -0,0 +1,60 @@+import { $createImageNode, $createVideoNode } from '@macro-inc/lexical-core';+import { $getRoot } from 'lexical';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { createComposeContext } from '../tests/capabilities';+import { mountEmailComposer } from '../tests/composer';+import { mountReplyComposer } from '../tests/reply';++beforeEach(() => vi.useFakeTimers());+afterEach(() => vi.useRealTimers());+it.each([+ ['standalone', 'image'],+ ['reply', 'image'],+ ['standalone', 'video'],+ ['reply', 'video'],+] as const)(+ 'does not queue local blob-backed inline media: %s %s',+ async (kind, media) => {+ const context = createComposeContext();+ context.delivery.queueActive = () => true;+ context.connectivity.looksOffline = () => true;+ context.drafts.saveLocalDraft = vi.fn(async (input) => ({+ key: input.clientHandles?.draftId ?? input.draft.db_id!,+ draftId: input.clientHandles?.draftId ?? input.draft.db_id!,+ threadId:+ input.clientHandles?.threadId ?? input.draft.thread_db_id ?? undefined,+ accountId: 'owner',+ generation: 'local-generation',+ revision: 1,+ acknowledgedRevision: 0,+ status: 'dirty' as const,+ updatedAt: Date.now(),+ content: input.draft,+ attachments: [],+ }));+ const root =+ kind === 'standalone'+ ? mountEmailComposer(context)+ : mountReplyComposer(context);+ try {+ root.edit('Body with still-uploading image');+ root.editor.update(+ () =>+ $getRoot().append(+ (media === 'image' ? $createImageNode : $createVideoNode)({+ srcType: 'local',+ url: 'blob:http://localhost/audit-pending-upload',+ alt: 'audit',+ })+ ),+ { discrete: true }+ );+ if ('state' in root) root.state.context.onSend();+ else await root.sendEmail();+ await vi.advanceTimersByTimeAsync(0);+ expect(context.delivery.sendMessage).not.toHaveBeenCalled();+ } finally {+ root.dispose();+ }+ }+);diff --git a/apps/web/src/features/email-compose/primitives/queued-editor.test.ts b/apps/web/src/features/email-compose/primitives/queued-editor.test.tsnew file mode 100644index 0000000000..d34c523911--- /dev/null+++ b/apps/web/src/features/email-compose/primitives/queued-editor.test.ts@@ -0,0 +1,75 @@+import {+ addMediaFromFile,+ INSERT_MEDIA_COMMAND,+} from '@core/component/LexicalMarkdown/plugins/media';+import { beforeEach, expect, it, vi } from 'vitest';+import { createEmailEditor } from '../tests/editor';++const convertFile = vi.hoisted(() => vi.fn<(file: File) => Promise<File>>());+vi.mock('@core/util/uploadFile', () => ({+ createUploadFile: (file: File) => ({+ kind: 'browser',+ file,+ name: file.name,+ }),+ createUploadFilePreviewUrl: () => 'blob:audit',+ createStaticUploadFile: vi.fn(),+ getUploadFileCacheKey: vi.fn(),+}));+vi.mock('@queries/storage/binary-document', () => ({+ fetchBinaryDocumentData: vi.fn(),+}));+vi.mock('@core/component/LexicalMarkdown/utils', () => ({+ $insertNodesAndSplitList: vi.fn(),+}));+vi.mock('@core/heic/service', () => ({+ heicConversionService: {+ canConvert: () => true,+ convertFile,+ },+}));++vi.mock('@service-storage/websocket', () => ({+ storageWS: { reconnectIfDisconnected: vi.fn() },+ createWebSocketJob: vi.fn(),+}));+vi.mock('@service-connection/websocket', () => ({+ ws: { addEventListener: vi.fn(), send: vi.fn() },+ state: () => 'closed',+ createConnectionBlockWebsocketEffect: vi.fn(),+ createConnectionWebsocketEffect: vi.fn(),+}));++beforeEach(() => convertFile.mockReset());++it('refuses inline media in an already locked composer', async () => {+ const editor = createEmailEditor();+ const dispatch = vi.spyOn(editor, 'dispatchCommand');+ editor.setEditable(false);+ await addMediaFromFile(editor, new File(['image'], 'audit.heic'), 'image');+ expect(convertFile).not.toHaveBeenCalled();+ expect(dispatch).not.toHaveBeenCalledWith(+ INSERT_MEDIA_COMMAND,+ expect.anything()+ );+});++it('does not insert inline media when a send locks the composer during conversion', async () => {+ const editor = createEmailEditor();+ const dispatch = vi.spyOn(editor, 'dispatchCommand');+ const conversion = Promise.withResolvers<File>();+ convertFile.mockReturnValue(conversion.promise);+ const insert = addMediaFromFile(+ editor,+ new File(['image'], 'audit.heic'),+ 'image'+ );+ expect(convertFile).toHaveBeenCalledOnce();+ editor.setEditable(false);+ conversion.resolve(new File(['image'], 'audit.png', { type: 'image/png' }));+ await insert;+ expect(dispatch).not.toHaveBeenCalledWith(+ INSERT_MEDIA_COMMAND,+ expect.anything()+ );+});diff --git a/apps/web/src/features/email-compose/primitives/reply-composer.ts b/apps/web/src/features/email-compose/primitives/reply-composer.tsindex 30b9d79999..87fad8402d 100644--- a/apps/web/src/features/email-compose/primitives/reply-composer.ts+++ b/apps/web/src/features/email-compose/primitives/reply-composer.ts@@ -43,7 +43,9 @@ import type {EmailUndoHandle,} from '../context/compose-capabilities';import type { EmailReplySession } from '../context/email-form-inputs';+import { decodeBase64Utf8 } from '../core/decode-base64';import type { EmailDraft } from '../core/email-draft';+import { plainTextToHtml } from '../core/plain-text-to-html';import {convertContactInfoToEmailRecipient,convertEmailRecipientToContactInfo,@@ -60,6 +62,7 @@ import {createDraftPersistence,deleteDraftForDiscard,} from './draft-persistence';+import { observeDraftRestoration } from './draft-restoration';import { createDraftSaveNotice } from './draft-save-notice';import { createDraftSession } from './draft-session';import { createDraftTransfer } from './draft-transfer';@@ -80,6 +83,7 @@ import {} from './reply-composer-focus';import { createReplyRecipientFields } from './reply-recipient-fields';import {+ pendingInlineMedia,refuseSend,sendRefusalAfterSave,sendRefusalBeforeSave,@@ -213,6 +217,11 @@ export function createReplyComposer(// Whether this reply includes the signature. Defaults on, reset per reply,// and dismissable via the preview ✕.const [includeSignature, setIncludeSignature] = createSignal(true);+ const [draftGeneration, setDraftGeneration] = createSignal(+ props.localDraft?.content.draft_generation ??+ props.draft?.draft_generation ??+ 0+ );// Signature HTML for the preview (and whether to show it): only for// replies/forwards, when the inbox's "add to replies & forwards" setting is on// and the user hasn't dismissed it. The backend does the actual injection on@@ -225,6 +234,7 @@ export function createReplyComposer(: undefined;const [bodyMacro, setBodyMacro] = createSignal<string>('');+ const [restoring, setRestoring] = createSignal(false);const [scrollContainer, setScrollContainer] = createSignal<HTMLElement>();// Gmail-style sizing: the composer opens compact and grows to the full cap// once the user scrolls the content@@ -240,29 +250,6 @@ export function createReplyComposer(const [quoteCollapsed, setQuoteCollapsed] = createSignal(!form.replyAppended());- const recipients = createReplyRecipientFields({- values: form.recipients,- setValues: form.setRecipients,- onChange: scheduleDraftSave,- container: dom.container,- disabled: () =>- operationBlocked() ||- submitting() ||- pendingDeletion() ||- movingInbox() ||- !!draftTransfer?.pending() ||- schedule?.pending() ||- schedule?.state().type === 'scheduled' ||- terminalState() !== undefined,- });- const focus = createReplyComposerFocus({- editor,- container: dom.container,- footer: dom.footer,- scrollContainer,- toInput: recipients.toRef,- expandRecipients: () => recipients.setShowExpandedRecipients(true),- });// A pending undo-send restore that belongs to this thread (inline reply// remount case). It carries a just-undone send. Consumed below.const restoredSnapshot = replyUndo.takePending(undoKey);@@ -325,6 +312,32 @@ export function createReplyComposer(operationBlocksEditing(currentOperation()));}+ const sendLocked = () => props.delivery.sendLocked?.(savedDraftId()) ?? false;+ const recipients = createReplyRecipientFields({+ values: form.recipients,+ setValues: form.setRecipients,+ onChange: scheduleDraftSave,+ container: dom.container,+ disabled: () =>+ operationBlocked() ||+ !!draftTransfer?.pending() ||+ restoring() ||+ submitting() ||+ pendingDeletion() ||+ movingInbox() ||+ schedule?.pending() ||+ schedule?.state().type === 'scheduled' ||+ terminalState() !== undefined ||+ sendLocked(),+ });+ const focus = createReplyComposerFocus({+ editor,+ container: dom.container,+ footer: dom.footer,+ scrollContainer,+ toInput: recipients.toRef,+ expandRecipients: () => recipients.setShowExpandedRecipients(true),+ });const savedDraftThreadId = session.threadId;observeDraftIdentity(@@ -337,7 +350,19 @@ export function createReplyComposer(void retryDraft().catch(props.notices.reportError);} else detachFromObsoleteDraft('Saving your edits as a new draft.');},- handleAlreadySent+ handleAlreadySent,+ async () => {+ if (+ sendLocked() ||+ schedule.state().type === 'scheduled' ||+ !session.autosaveAllowed() ||+ props.connectivity.looksOffline()+ )+ return false;+ const draftId = session.draftId();+ if (draftId && session.serverConfirmed())+ await attachmentPersistence.upload(draftId);+ });const persistedInboxId = session.inboxId;const [movingInbox, setMovingInbox] = createSignal(false);@@ -354,6 +379,7 @@ export function createReplyComposer(// Consume the undo-send snapshot so a later composer mount doesn't restore// it again. Use bodyHtml as initialHtml for the editor, restore attachments// on mount.+ const [restoredBodyHtml, setRestoredBodyHtml] = createSignal<string>();const restoreEnvelope = (snapshot: UndoReplySnapshot) => {form.setSelectedInbox(snapshot.inboxId, snapshot.draftRestore.sender_email);form.setSubject(snapshot.draftRestore.subject);@@ -371,9 +397,7 @@ export function createReplyComposer(onMount(() => {// Restored content is local state worth keeping — latch the seed.props.onEngaged?.();- for (const attachment of restoredSnapshot.attachments) {- form.attachments.add(attachment);- }+ form.attachments.replace(restoredSnapshot.attachments);setIncludeSignature(restoredSnapshot.includeSignature);form.setReplyAppended(restoredSnapshot.replyAppended);// Reopen with the quote visible, as it was when the send was undone.@@ -406,13 +430,12 @@ export function createReplyComposer(inboxId: snapshot.inboxId,});restoreEnvelope(snapshot);+ setRestoredBodyHtml(snapshot.bodyHtml ?? plainTextToHtml(''));const currentEditor = editor();if (currentEditor && snapshot.bodyHtml) {setEditorStateFromHtml(currentEditor, snapshot.bodyHtml);}- for (const attachment of snapshot.attachments) {- form.attachments.add(attachment);- }+ form.attachments.replace(snapshot.attachments);setIncludeSignature(snapshot.includeSignature);form.setReplyAppended(snapshot.replyAppended);// Reopen with the quote visible, as it was when the send was undone.@@ -425,7 +448,8 @@ export function createReplyComposer(unregisterUndo();});- const initialHtml = () => restoredSnapshot?.bodyHtml ?? props.preloadedHtml;+ const initialHtml = () =>+ restoredBodyHtml() ?? restoredSnapshot?.bodyHtml ?? props.preloadedHtml;const [editorConnected, setEditorConnected] = createSignal(false);const handleEditorConnect = () => {const currentEditor = editor();@@ -447,33 +471,41 @@ export function createReplyComposer(const restoreAfterUndoSend = async (draftId: string,sentThreadId: string | undefined,- inboxId: string | undefined+ inboxId: string | undefined,+ draftRestored = false) => {const snapshot = replyUndo.peek(draftId);// Reconcile the actual message thread, which can differ from the host when// replying from another inbox. The host's undoKey still owns local recovery.const threadId = sentThreadId ?? snapshot?.threadId;- await props.drafts.restoreDraft({- draftId,- threadId,- draft: snapshot?.draftRestore,- html: snapshot?.bodyHtml,- inboxId,- });+ if (!draftRestored)+ await props.drafts.restoreDraft({+ draftId,+ threadId,+ draft: snapshot?.draftRestore,+ html: snapshot?.bodyHtml,+ inboxId,+ });if (snapshot) {// Keep the recovery snapshot available if restoring the server draft// fails. Consume it only after the authoritative restore succeeds.replyUndo.take(draftId);// Resolve the live registration after cache updates and unmounts settle.- setTimeout(() => replyUndo.restore(undoKey, snapshot), 0);+ if (!draftRestored)+ setTimeout(() => replyUndo.restore(undoKey, snapshot), 0);props.setShowReply?.(true);}};const attachmentPersistence = createAttachmentPersistence({+ draftGeneration,confirmRemoval: !!props.drafts.saveLocalDraft,+ allowed: () =>+ !sendLocked() &&+ schedule.state().type !== 'scheduled' &&+ !props.connectivity.looksOffline(),services: props.attachmentStorage,attachments: form.attachments,draftId: () =>@@ -526,6 +558,7 @@ export function createReplyComposer('idle' | 'preparing' | 'sending'>('idle');const submitting = () => sendPhase() !== 'idle';+ let sendOperationVersion = 0;const [pendingDeletion, setPendingDeletion] = createSignal(false);function collectDraft(forDelivery = false) {@@ -566,6 +599,7 @@ export function createReplyComposer(to: form.recipients().to.map(convertEmailRecipientToContactInfo),body_macro: forDelivery ? prepareMacroBody(bodyMacro()) : undefined,include_signature: includeSignature() ? undefined : false,+ draft_generation: draftGeneration(),};}@@ -638,6 +672,7 @@ export function createReplyComposer(}const persistence = createDraftPersistence({+ draftGeneration,session,drafts: props.drafts,attachments: attachmentPersistence,@@ -714,6 +749,7 @@ export function createReplyComposer(});},paused: () =>+ restoring() ||operationBlocked() ||submitting() ||pendingDeletion() ||@@ -721,7 +757,52 @@ export function createReplyComposer(!!draftTransfer?.pending() ||schedule?.pending() ||schedule?.state().type === 'scheduled' ||- terminalState() !== undefined,+ terminalState() !== undefined ||+ sendLocked(),+ });+ observeDraftRestoration({+ storage: props.drafts,+ accepts: (change) =>+ savedDraftId()+ ? [change.draftId, change.originalDraftId].includes(savedDraftId()!)+ : !hasLocalChanges &&+ change.threadId === thread()?.db_id &&+ change.replyingToId === replyTarget?.db_id,+ ready: () => !sendLocked(),+ version: () => `${identityVersion}:${editVersion}:${session.epoch()}`,+ cancelPendingSave: () => {+ identityVersion += 1;+ sendOperationVersion += 1;+ setSendPhase('idle');+ autosave.cancel();+ },+ setPending: setRestoring,+ restore: (draft, change, restoredPersistence, local, attachments) => {+ persistence.restored(local);+ setDraftGeneration(draft.draft_generation ?? 0);+ session.dispatch({+ type: 'seeded',+ draftId: draft.db_id,+ threadId: draft.thread_db_id,+ inboxId: draft.link_id,+ persistence: restoredPersistence,+ });+ form.restoreDraft(draft);+ if (attachments) form.attachments.replace(attachments);+ setIncludeSignature(change.includeSignature !== false);+ const bodyHtml = draft.body_html_sanitized+ ? decodeBase64Utf8(draft.body_html_sanitized)+ : plainTextToHtml(draft.body_text ?? '');+ setRestoredBodyHtml(bodyHtml);+ const currentEditor = editor();+ if (currentEditor) setEditorStateFromHtml(currentEditor, bodyHtml);+ setQuoteCollapsed(!form.replyAppended());+ hasLocalChanges = false;+ setTerminalState(undefined);+ props.onEngaged?.();+ props.setShowReply?.(true);+ },+ reportError: props.notices.reportError,});function executeSaveDraft(completingThread = false) {return autosave.save(captureSave(completingThread));@@ -729,13 +810,15 @@ export function createReplyComposer(function scheduleDraftSave() {if (operationBlocked()) return;if (+ restoring() ||submitting() ||pendingDeletion() ||movingInbox() ||draftTransfer?.pending() ||schedule.pending() ||schedule.state().type === 'scheduled' ||- terminalState()+ terminalState() ||+ sendLocked())return;hasLocalChanges = true;@@ -748,6 +831,8 @@ export function createReplyComposer(// without a text edit, so it moves to the new inbox and the choice survives a// refresh. Driven by the explicit switch (below) rather than inbox reactivity.draftTransfer = createDraftTransfer({+ draftGeneration,+ onTransferred: () => setDraftGeneration(0),session,drafts: props.drafts,attachments: form.attachments,@@ -759,13 +844,15 @@ export function createReplyComposer(});const saveSelectedInbox = async (inboxId: string, senderEmail?: string) => {if (+ restoring() ||(!draftTransfer?.pending() && deliveryBlocked()) ||submitting() ||pendingDeletion() ||movingInbox() ||schedule.pending() ||schedule.state().type === 'scheduled' ||- terminalState()+ terminalState() ||+ sendLocked())return;hasLocalChanges = true;@@ -833,11 +920,13 @@ export function createReplyComposer(};schedule = createEmailSendSchedule({+ draftGeneration,delivery: props.delivery,notices: props.notices,initialScheduledTime: draftSeed?.scheduled_send_time? new Date(draftSeed.scheduled_send_time): undefined,+ initialDeliveryStatus: draftSeed?.scheduled_send_status ?? undefined,draftId: savedDraftId,saveDraft: saveForSchedule,threadId: savedDraftThreadId,@@ -862,6 +951,7 @@ export function createReplyComposer(},});const cancelSchedule = async () => {+ if (sendLocked() || restoring()) return false;if (!(await schedule.cancel())) return false;session.dispatch({ type: 'schedule-cancelled' });return true;@@ -872,6 +962,27 @@ export function createReplyComposer(if (!requestReplyType) return;+ // Message-card actions reach this path even while composer controls are disabled.+ // Consume the request so cancelling the send cannot apply a stale Forward later.+ if (sendLocked()) {+ // A fresh composer can be waiting for durable storage initialization.+ // Preserve its initial action; requests against a queued draft are discarded.+ if (savedDraftId()) ctx.replyRequest.clear();+ return;+ }+ if (+ restoring() ||+ submitting() ||+ pendingDeletion() ||+ movingInbox() ||+ schedule.pending() ||+ schedule.state().type === 'scheduled' ||+ terminalState()+ ) {+ ctx.replyRequest.clear();+ return;+ }+if (form.replyType() !== requestReplyType) {form.setReplyType(requestReplyType);} else if (requestReplyType === 'forward') {@@ -900,6 +1011,7 @@ export function createReplyComposer(const hasPaidAccess = props.hasPaidAccess;const sendEmail = async (markDone = false) => {+ if (sendLocked() || restoring()) return;if (deliveryBlocked()) return;if (scheduling() || movingInbox() || terminalState()) return;if (submitting() || pendingDeletion()) return;@@ -956,8 +1068,18 @@ export function createReplyComposer(inboxId = primaryInboxId() ?? inboxes[0].id;}- const offline = sendRefusalBeforeSave(props.connectivity);+ const offline = sendRefusalBeforeSave(+ props.connectivity,+ props.delivery.queueActive?.(sendingInbox()?.id),+ form.attachments+ .list()+ .some(+ (attachment) => attachment.type === 'local' && !attachment.uploaded+ )+ );if (offline) return refuseSend(props.notices, offline);+ if (pendingInlineMedia(editor()))+ return refuseSend(props.notices, 'media-not-uploaded');if (attachmentLinks.uploading())return refuseSend(props.notices, 'files-uploading');const currentEditor = editor();@@ -992,13 +1114,30 @@ export function createReplyComposer(});};const scheduleAction = schedule.action();+ const queuedLater =+ scheduleAction === 'schedule' &&+ !!props.delivery.queueActive?.(sendingInbox()?.id);+ const selectedTime = queuedLater ? schedule.selectedTime() : undefined;+ if (+ queuedLater &&+ (!selectedTime ||+ !Number.isFinite(selectedTime.getTime()) ||+ selectedTime.getTime() <= Date.now())+ ) {+ props.notices.feedback.alert('Choose a future send time.');+ return;+ }+ const sendTime = selectedTime?.toISOString();if (scheduleAction === 'unavailable') {props.notices.feedback.alert(`This email is scheduled for ${schedule.confirmedTime()?.toLocaleString()}. Choose a new time to update it, or cancel the schedule to edit.`);return;}- if (scheduleAction === 'schedule' || scheduleAction === 'update') {+ if (+ (scheduleAction === 'schedule' && !queuedLater) ||+ scheduleAction === 'update'+ ) {const result = await schedule.submit();if (result === 'scheduled') {const scheduledDraftId = savedDraftId();@@ -1023,12 +1162,31 @@ export function createReplyComposer(const willMarkDone = markDone || currentThread.inbox_visible;setSendPhase('preparing');+ const sendOperation = ++sendOperationVersion;const sendGeneration = identityVersion;try {// Ensure draft is saved before sending so undo-send always has a draft to restoreconst epochBeforeSave = session.epoch();try {- await autosave.save(captureSave(willMarkDone), { acknowledge: false });+ if (+ props.delivery.queueActive?.(sendingInbox()?.id) &&+ props.drafts.saveLocalDraft &&+ form.attachments+ .list()+ .every((attachment) =>+ attachment.type === 'local'+ ? attachment.uploaded+ : attachment.type === 'remote'+ ? !attachment.uploadPending+ : true+ ) &&+ (form.attachments.list().length === 0 || session.serverConfirmed())+ )+ await autosave.saveLocal(captureSave(willMarkDone));+ else+ await autosave.save(captureSave(willMarkDone), {+ acknowledge: false,+ });} catch (error) {props.notices.reportError(error);if (session.isStale(epochBeforeSave)) return;@@ -1037,27 +1195,43 @@ export function createReplyComposer(if (sendGeneration !== identityVersion ||session.isStale(epochBeforeSave) ||- terminalState()+ terminalState() ||+ sendLocked())return;+ const expectedLocalVersion = props.delivery.queueActive?.(+ sendingInbox()?.id+ )+ ? persistence.localVersion()+ : undefined;const refusal = sendRefusalAfterSave({identity: session.identity(),autosaveAllowed: session.autosaveAllowed(),attachments: form.attachments.list(),unqueuedHandleMaySend: false,+ queueActive: props.delivery.queueActive?.(sendingInbox()?.id),});if (refusal) return refuseSend(props.notices, refusal);+ if (pendingInlineMedia(editor()))+ return refuseSend(props.notices, 'media-not-uploaded');+// Snapshot editor state before watermark so undo-send can restore it.// Remember by draft so sends in separate composers cannot replace each other.rememberCurrentReply();- if (scheduling() || schedule.action() !== 'send') {+ if (+ scheduling() ||+ (schedule.action() !== 'send' &&+ !(queuedLater && schedule.selectedTime()?.toISOString() === sendTime))+ ) {return;}// Append watermark after all validation passes so failed sends don't// leave orphaned watermark nodes in the editor tree.+ const restoration = prepareEmailBody(currentEditor);+ const restoreMacro = bodyMacro();const cleanupWatermark = $appendWatermarkNodeToLast(currentEditor,!hasPaidAccess() ? MACRO_EMAIL_SIGNATURE : undefined@@ -1085,10 +1259,23 @@ export function createReplyComposer(setSendPhase('sending');const pendingSend = props.delivery.sendMessage({- clientHandles:- session.identity().kind === 'handle' && session.draftId()- ? { draftId: session.draftId()!, threadId: session.threadId() }- : undefined,+ sendTime,+ expectedLocalVersion,+ clientHandles: {+ draftId: currentDraftId!,+ threadId: savedDraftThreadId() ?? currentThread.db_id,+ },+ attachmentIds: form.attachments+ .list()+ .filter((a) => a.type === 'local' || a.type === 'remote')+ .flatMap((a) => (a.attachmentId ? [a.attachmentId] : [])),+ forwardedAttachmentIds: form.attachments+ .list()+ .filter((a) => a.type === 'forwarded' || a.type === 'native')+ .flatMap((a) => (a.attachmentId ? [a.attachmentId] : [])),+ restoreBodyHtml: restoration?.bodyHtml,+ restoreBodyText: restoration?.bodyText,+ restoreBodyMacro: restoreMacro,message: {sender_email: activeInboxEmail(),db_id: currentDraftId,@@ -1106,24 +1293,22 @@ export function createReplyComposer(// Replies/forwards follow the inbox's "add to replies & forwards"// setting on the backend; only signal an explicit per-reply dismiss.include_signature: includeSignature() ? undefined : false,+ draft_generation: draftGeneration(),},inboxId,completingThread: willMarkDone,});- // Reset immediately while this task owns completion, including after unmount.- try {- resetState();- clearDraftState();- } catch (error) {- props.notices.reportError(error);- } finally {- cleanupWatermark();- }let result;try {result = await pendingSend;} catch (error) {+ if (+ sendGeneration !== identityVersion ||+ session.isStale(epochBeforeSave)+ )+ return;+ cleanupWatermark();autosave.cancel();if (mounted && currentDraftId) {const snapshot = replyUndo.peek(currentDraftId);@@ -1133,6 +1318,20 @@ export function createReplyComposer(props.notices.feedback.failure('Failed to send email');return;}+ if (+ sendGeneration !== identityVersion ||+ session.isStale(epochBeforeSave)+ )+ return;+ // Clear only after the send is durably accepted, including after unmount.+ try {+ resetState();+ clearDraftState();+ } catch (error) {+ props.notices.reportError(error);+ } finally {+ cleanupWatermark();+ }autosave.cancel();const draftId = result.draftId;if (draftId) endUndoSend(draftId);@@ -1144,12 +1343,18 @@ export function createReplyComposer(let sendUndone = false;const undoSend = (draftId: string) =>props.delivery.undoSend({+ sendAttemptId: result.sendAttemptId,threadId: result.threadId,draftId,inboxId,- onUndone: async () => {+ onUndone: async (undo) => {sendUndone = true;- await restoreAfterUndoSend(draftId, result.threadId, inboxId);+ await restoreAfterUndoSend(+ draftId,+ result.threadId,+ inboxId,+ undo?.draftRestored+ );const doneHandle = markDoneUndoHandle;markDoneUndoHandle = undefined;await doneHandle?.undo({@@ -1161,21 +1366,28 @@ export function createReplyComposer(},});try {- const toastId = props.notices.feedback.success('Email sent', {- actions: draftId- ? [- {- label: 'Undo',- onClick: () => {- if (toastId != null)- props.notices.feedback.dismiss(toastId);- void undoSend(draftId).catch(props.notices.reportError);+ const toastId = props.notices.feedback.success(+ result.sendAttemptId+ ? result.persistence === 'queued'+ ? 'Email queued to send'+ : 'Email sending'+ : 'Email sent',+ {+ actions: draftId+ ? [+ {+ label: 'Undo',+ onClick: () => {+ if (toastId != null)+ props.notices.feedback.dismiss(toastId);+ void undoSend(draftId).catch(props.notices.reportError);+ },},- },- ]- : undefined,- duration: 5_000,- });+ ]+ : undefined,+ duration: 5_000,+ }+ );} catch (error) {props.notices.reportError(error);}@@ -1196,7 +1408,8 @@ export function createReplyComposer(markDoneUndoHandle = handle;},navigate: markDone,- cancelled: () => sendUndone,+ cancelled: () =>+ sendUndone || sendOperation !== sendOperationVersion,});} catch (error) {props.notices.reportError(error);@@ -1216,15 +1429,17 @@ export function createReplyComposer(} catch (error) {props.notices.reportError(error);} finally {- setSendPhase('idle');+ if (sendOperation === sendOperationVersion) setSendPhase('idle');}};const resetState = () => {+ setRestoredBodyHtml(plainTextToHtml(''));attachmentLinks.detach();clearEmailBody(editor());setBodyMacro('');session.dispatch({ type: 'reset' });+ setDraftGeneration(0);form.reset();schedule.reset();setTerminalState(undefined);@@ -1237,6 +1452,7 @@ export function createReplyComposer(};const deleteDraftAndReset = async () => {+ if (sendLocked() || restoring()) return;if (schedule.state().type === 'scheduled') {props.notices.feedback.alert('Cancel the schedule before deleting this draft.'@@ -1300,27 +1516,18 @@ export function createReplyComposer(const attachmentLinks = createAttachmentLinkOffer({editor,+ canEdit: () => !editingDisabled(),+ version: () =>+ `${identityVersion}:${session.epoch()}:${activeInboxId() ?? ''}`,notices: props.notices,editorFiles: props.editorFiles,});const handleAddAttachments = async (files: File[]) => {- if (- operationBlocked() ||- submitting() ||- pendingDeletion() ||- movingInbox() ||- draftTransfer?.pending() ||- scheduling() ||- schedule.state().type === 'scheduled' ||- terminalState()- )- return;- if (- !props.drafts.saveLocalDraft &&- (await refuseAttachmentsOffline(props.connectivity, props.notices))- )+ if (editingDisabled()) return;+ if (await refuseAttachmentsOffline(props.connectivity, props.notices))return;+ if (editingDisabled()) return;const limit = attachmentLimitBytes(sendingInbox()?.provider);const { attachable, oversized } = partitionByAttachmentLimit(files,@@ -1339,17 +1546,7 @@ export function createReplyComposer(};const handleRemoveAttachment = async (attachment: DraftFormAttachment) => {- if (- operationBlocked() ||- submitting() ||- pendingDeletion() ||- movingInbox() ||- draftTransfer?.pending() ||- scheduling() ||- schedule.state().type === 'scheduled' ||- terminalState()- )- return;+ if (editingDisabled()) return;try {if (!(await attachmentPersistence.remove(attachment))) return;scheduleDraftSave();@@ -1360,13 +1557,15 @@ export function createReplyComposer(const scheduling = schedule.pending;const scheduleBlocked = () =>+ restoring() ||deliveryBlocked() ||attachmentPersistence.removing() ||pendingDeletion() ||movingInbox() ||!!draftTransfer?.pending() ||submitting() ||- terminalState() !== undefined;+ terminalState() !== undefined ||+ sendLocked();const handleSendTimeChange = (date: Date | null) =>scheduleBlocked() ? false : schedule.select(date);@@ -1374,6 +1573,7 @@ export function createReplyComposer(identityVersion += 1;autosave.cancel();session.dispatch({ type: 'reset' });+ setDraftGeneration(0);const omittedAttachments = attachmentPersistence.detach();attachmentLinks.detach();schedule.detach();@@ -1390,14 +1590,27 @@ export function createReplyComposer(let lastScheduledTime = schedule.confirmedTime()?.toISOString();let handledTerminalIdentity: string | undefined;+ let reconcileAfterQueuedSend = false;createEffect(on([lifecycle.state,scheduling,() => movingInbox() || !!draftTransfer?.pending(),+ () => sendPhase() === 'sending',+ () => sendLocked() || restoring(),],- ([state, , moving]) => {+ ([state, , moving, sending, queued]) => {+ if (queued) {+ reconcileAfterQueuedSend = true;+ return;+ }+ if (reconcileAfterQueuedSend) {+ reconcileAfterQueuedSend = false;+ // Admission's non-draft observation predates the cancellation.+ void lifecycle.refresh().catch(props.notices.reportError);+ return;+ }if (!state ||!session.serverConfirmed() ||@@ -1406,6 +1619,7 @@ export function createReplyComposer((state.inboxId !== undefined &&state.inboxId !== persistedInboxId()) ||moving ||+ sending ||pendingDeletion())return;@@ -1479,6 +1693,7 @@ export function createReplyComposer(const hasBodyText = () => bodyMacro().trim().length > 0;const editingDisabled = () =>+ restoring() ||operationBlocked() ||submitting() ||pendingDeletion() ||@@ -1486,8 +1701,10 @@ export function createReplyComposer(!!draftTransfer?.pending() ||scheduling() ||schedule.state().type === 'scheduled' ||- terminalState() !== undefined;+ terminalState() !== undefined ||+ sendLocked();const sendUnavailableReason = () => {+ if (sendLocked()) return 'Queued to send. Cancel the send before editing.';if (terminalState() === 'sent') return 'This email has already been sent.';if (terminalState() === 'missing')return 'This draft is no longer available.';@@ -1501,6 +1718,7 @@ export function createReplyComposer(return undefined;};const sendActionDisabled = () =>+ restoring() ||deliveryBlocked() ||submitting() ||pendingDeletion() ||@@ -1508,6 +1726,7 @@ export function createReplyComposer(!!draftTransfer?.pending() ||scheduling() ||terminalState() !== undefined ||+ sendLocked() ||attachmentPersistence.uploading() ||attachmentLinks.uploading() ||schedule.action() === 'unavailable';@@ -1555,7 +1774,10 @@ export function createReplyComposer(activeInboxEmail,replyType: form.replyType,signatureHtml: replySignatureHtml,- setIncludeSignature,+ setIncludeSignature: (include: boolean) => {+ if (editingDisabled()) return;+ setIncludeSignature(include);+ },setScrollContainer,composerExpanded,setComposerExpanded,@@ -1581,7 +1803,9 @@ export function createReplyComposer(scheduleActionLabel: schedule.actionLabel,scheduleOperation: schedule.operation,cancelSchedule,- schedulePickerDisabled: () => scheduleBlocked() || scheduling(),+ checkScheduleStatus: schedule.checkStatus,+ schedulePickerDisabled: () =>+ scheduleBlocked() || schedule.pickerDisabled(),editingDisabled,sendUnavailableReason,hasBodyText,diff --git a/apps/web/src/features/email-compose/primitives/reply-undo-restoration.test.ts b/apps/web/src/features/email-compose/primitives/reply-undo-restoration.test.tsnew file mode 100644index 0000000000..187f71075c--- /dev/null+++ b/apps/web/src/features/email-compose/primitives/reply-undo-restoration.test.ts@@ -0,0 +1,110 @@+import 'fake-indexeddb/auto';+import { createLocalDraftStore } from '@queries/email/local-draft-store';+import { expect, it, vi } from 'vitest';+import { message } from '../../email-message/tests/messages';+import type { EmailDraftRestoration } from '../context/compose-capabilities';+import type { LocalDraft } from '../core/local-draft';+import { createComposeContext } from '../tests/capabilities';+import { mountReplyComposer } from '../tests/reply';++it('adopts the new local generation when the Undo callback overtakes a restoration read', async () => {+ const store = createLocalDraftStore(crypto.randomUUID());+ const owner = await store.activate('owner');+ let restoredLocal: LocalDraft;+ const context = createComposeContext();+ context.delivery.queueActive = () => true;+ context.drafts.saveLocalDraft = vi.fn(async (input) => {+ const previous = await store.read(owner, 'draft');+ return await store.save(owner, {+ key: 'draft',+ draftId: 'draft',+ threadId: 'thread',+ accountId: 'owner',+ generation:+ input.expectedGeneration ?? previous?.generation ?? 'original',+ expectedRevision: input.expectedRevision ?? previous?.revision ?? 0,+ status: 'dirty',+ content: input.draft,+ attachments: [],+ });+ });+ context.delivery.sendMessage = vi.fn(async () => ({+ draftId: 'draft',+ threadId: 'thread',+ inboxId: 'inbox',+ sendAttemptId: 'attempt',+ persistence: 'queued' as const,+ }));+ let changed: ((event: EmailDraftRestoration) => void) | undefined;+ context.drafts.watchRestorations = (listener) => {+ changed = listener;+ return () => {};+ };+ const restored =+ Promise.withResolvers<+ Awaited<ReturnType<NonNullable<typeof context.drafts.readDraft>>>+ >();+ context.drafts.readDraft = () => restored.promise;+ context.delivery.undoSend = vi.fn(async (input) => {+ await store.update(owner, 'draft', () => undefined);+ const generation = await store.generation(owner, 'draft', true);+ restoredLocal = await store.save(owner, {+ key: 'draft',+ draftId: 'draft',+ threadId: 'thread',+ accountId: 'owner',+ generation,+ expectedRevision: 0,+ status: 'dirty',+ content: { subject: 'Review' },+ attachments: [],+ });+ // The production adapter publishes after durable restore, then invokes onUndone.+ changed?.({+ draftId: 'draft',+ originalDraftId: 'draft',+ threadId: 'thread',+ inboxId: 'inbox',+ replyingToId: 'parent',+ });+ await input.onUndone({ draftRestored: true });+ });+ const root = mountReplyComposer(context, undefined, {+ draft: message('draft', { is_draft: true }),+ });+ try {+ root.edit('Body before sending');+ await root.sendEmail();+ const toast = vi+ .mocked(context.notices.feedback.success)+ .mock.calls.find((call) =>+ call[1]?.actions?.some((a) => a.label === 'Undo')+ );+ expect(toast).toBeDefined();+ toast![1]!.actions!.find((a) => a.label === 'Undo')!.onClick();+ await vi.waitFor(() => expect(root.editingDisabled()).toBe(true));+ restored.resolve({+ draft: message('draft', {+ is_draft: true,+ replying_to_id: 'parent',+ body_text: 'Body before sending',+ body_html_sanitized: null,+ }),+ persistence: 'queued',+ local: restoredLocal!,+ });+ await vi.waitFor(() => expect(root.editingDisabled()).toBe(false));+ root.edit('Edited after Undo');+ await root.flushLocal();+ expect(root.localSaveState()).toBe('saved');+ expect((await store.read(owner, 'draft'))?.generation).toBe(+ restoredLocal!.generation+ );+ await root.sendEmail();+ expect(context.delivery.sendMessage).toHaveBeenCalledTimes(2);+ expect(context.notices.reportError).not.toHaveBeenCalled();+ } finally {+ root.dispose();+ await store.close();+ }+});diff --git a/apps/web/src/features/email-compose/primitives/restoration-initialization.test.ts b/apps/web/src/features/email-compose/primitives/restoration-initialization.test.tsnew file mode 100644index 0000000000..c23e0fab69--- /dev/null+++ b/apps/web/src/features/email-compose/primitives/restoration-initialization.test.ts@@ -0,0 +1,205 @@+import { $getRoot } from 'lexical';+import { createRoot } from 'solid-js';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { message } from '../../email-message/tests/messages';+import type { EmailDraftRestoration } from '../context/compose-capabilities';+import { createComposeContext } from '../tests/capabilities';+import { mountEmailComposer } from '../tests/composer';+import { mountReplyComposer } from '../tests/reply';+import { createEmailComposer } from './email-composer';++beforeEach(() => vi.useFakeTimers());+afterEach(() => vi.useRealTimers());++const bodies = [+ ['plain text', null, 'Restored body', 'Restored body'],+ [+ 'HTML',+ btoa('<p>Restored <strong>HTML</strong></p>'),+ null,+ 'Restored HTML',+ ],+ ['empty', null, '', ''],+] as const;++function restoration(+ reply: boolean,+ bodyHtml: string | null,+ bodyText: string | null+) {+ const context = createComposeContext();+ let listener: ((change: EmailDraftRestoration) => void) | undefined;+ context.drafts.watchRestorations = (changed) => {+ listener = changed;+ return () => {};+ };+ context.drafts.readDraft = vi.fn(async () => ({+ draft: message('draft', {+ is_draft: true,+ subject: 'Restored subject',+ body_text: bodyText,+ body_html_sanitized: bodyHtml,+ replying_to_id: reply ? 'parent' : undefined,+ }),+ persistence: 'queued' as const,+ }));+ return {+ context,+ emit: () =>+ listener?.({+ draftId: 'draft',+ originalDraftId: 'draft',+ threadId: 'thread',+ inboxId: 'inbox',+ replyingToId: reply ? 'parent' : undefined,+ }),+ };+}++it.each(bodies)(+ 'retains restored %s as the standalone editor seed before capture',+ async (_, html, text, expected) => {+ const { context, emit } = restoration(false, html, text);+ const root = createRoot((dispose) => ({+ dispose,+ state: createEmailComposer({+ ...context,+ draft: message('draft', {+ is_draft: true,+ body_text: 'Original sent body',+ body_html_sanitized: null,+ }),+ }),+ }));+ try {+ emit();+ await vi.advanceTimersByTimeAsync(0);+ expect(root.state.context.subject()).toBe('Restored subject');+ const element = document.createElement('div');+ element.innerHTML = root.state.context.initialHtml() ?? '';+ expect(element.textContent).toBe(expected);+ } finally {+ root.dispose();+ }+ }+);++it.each(bodies)(+ 'keeps restored %s when the reply editor connects afterward',+ async (_, html, text, expected) => {+ const { context, emit } = restoration(true, html, text);+ const root = mountReplyComposer(context, undefined, {+ draft: message('draft', { is_draft: true }),+ preloadedHtml: '<p>Original sent body</p>',+ });+ try {+ emit();+ await vi.advanceTimersByTimeAsync(0);+ expect(root.editor.read(() => $getRoot().getTextContent()).trim()).toBe(+ expected+ );+ root.handleEditorConnect();+ await vi.advanceTimersByTimeAsync(0);+ expect(root.editor.read(() => $getRoot().getTextContent()).trim()).toBe(+ expected+ );+ } finally {+ root.dispose();+ }+ }+);++it('rejects delayed attachment callbacks until reply restoration finishes', async () => {+ const { context, emit } = restoration(true, null, 'Restored body');+ const read =+ Promise.withResolvers<+ Awaited<ReturnType<NonNullable<typeof context.drafts.readDraft>>>+ >();+ context.drafts.readDraft = vi.fn(() => read.promise);+ const root = mountReplyComposer(context, undefined, {+ draft: message('draft', { is_draft: true }),+ });+ const attachment = {+ type: 'remote' as const,+ attachmentId: 'existing',+ fileName: 'existing.txt',+ contentType: 'text/plain',+ fileSize: 5,+ url: '',+ };+ const file = new File(['audit'], 'new.txt');+ try {+ root.form.attachments.replace([attachment]);+ emit();+ expect(root.editingDisabled()).toBe(true);+ await root.handleAddAttachments([file]);+ await root.handleRemoveAttachment(attachment);+ expect(root.form.attachments.list()).toEqual([attachment]);+ expect(context.attachmentStorage.removeAttachment).not.toHaveBeenCalled();+ expect(context.drafts.saveDraft).not.toHaveBeenCalled();+ read.resolve({+ draft: message('draft', {+ is_draft: true,+ replying_to_id: 'parent',+ body_html_sanitized: null,+ body_text: 'Restored body',+ }),+ persistence: 'queued',+ attachments: [attachment],+ });+ await vi.advanceTimersByTimeAsync(0);+ expect(root.editingDisabled()).toBe(false);+ expect(root.form.attachments.list()).toEqual([attachment]);+ await root.handleAddAttachments([file]);+ expect(root.form.attachments.list()).toHaveLength(2);+ } finally {+ root.dispose();+ }+});++it('clears the standalone initialization seed after discarding a restored draft', async () => {+ const { context, emit } = restoration(false, null, 'Restored body');+ const root = mountEmailComposer(context, undefined, {+ draft: message('draft', {+ is_draft: true,+ body_text: 'Original sent body',+ body_html_sanitized: null,+ }),+ });+ try {+ emit();+ await vi.advanceTimersByTimeAsync(0);+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe(+ 'Restored body'+ );+ expect(await root.state.deleteDraftAndReset()).toBe(true);+ const element = document.createElement('div');+ element.innerHTML = root.state.context.initialHtml() ?? '';+ expect(element.textContent).toBe('');+ } finally {+ root.dispose();+ }+});++it('does not revive either reply seed after discarding and then connecting', async () => {+ const { context, emit } = restoration(true, null, 'Restored body');+ const root = mountReplyComposer(context, undefined, {+ draft: message('draft', { is_draft: true }),+ preloadedHtml: '<p>Original sent body</p>',+ });+ try {+ emit();+ await vi.advanceTimersByTimeAsync(0);+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe(+ 'Restored body'+ );+ await root.deleteDraftAndReset();+ await vi.advanceTimersByTimeAsync(0);+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe('');+ root.handleEditorConnect();+ await vi.advanceTimersByTimeAsync(0);+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe('');+ } finally {+ root.dispose();+ }+});diff --git a/apps/web/src/features/email-compose/primitives/schedule-recovery.test.ts b/apps/web/src/features/email-compose/primitives/schedule-recovery.test.tsnew file mode 100644index 0000000000..12c8827738--- /dev/null+++ b/apps/web/src/features/email-compose/primitives/schedule-recovery.test.ts@@ -0,0 +1,165 @@+import { createRoot } from 'solid-js';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { message } from '../../email-message/tests/messages';+import type { EmailDraftLifecycleState } from '../context/compose-capabilities';+import { createComposeContext } from '../tests/capabilities';+import { mountEmailComposer } from '../tests/composer';+import { mountReplyComposer } from '../tests/reply';+import { createEmailSendSchedule } from './email-send-schedule';++const sendTime = '2026-12-01T12:00:00Z';+const scheduled = (+ deliveryStatus: 'pending' | 'sending' | 'failed' | 'unconfirmed'+): EmailDraftLifecycleState => ({+ type: 'scheduled',+ draftId: 'draft',+ threadId: 'thread',+ inboxId: 'inbox',+ observedAt: Date.now(),+ sendTime,+ deliveryStatus,+});++beforeEach(() => vi.useFakeTimers());+afterEach(() => vi.useRealTimers());++it.each(['standalone', 'reply'] as const)(+ '%s preserves an uncertain delivery from its initial draft before refreshing',+ async (kind) => {+ const context = createComposeContext();+ const draft = message('draft', {+ is_draft: true,+ scheduled_send_time: sendTime,+ scheduled_send_status: 'unconfirmed',+ });+ const root =+ kind === 'standalone'+ ? mountEmailComposer(context, undefined, { draft })+ : mountReplyComposer(context, undefined, { draft });+ try {+ const state =+ 'state' in root+ ? root.state.context.schedule+ : {+ state: root.scheduleState,+ pickerDisabled: root.schedulePickerDisabled,+ onCancel: root.cancelSchedule,+ };+ expect(state.state()).toMatchObject({ deliveryStatus: 'unconfirmed' });+ expect(state.pickerDisabled()).toBe(true);+ expect(await state.onCancel()).toBe(false);+ expect(context.delivery.unschedule).not.toHaveBeenCalled();+ } finally {+ root.dispose();+ }+ }+);++it.each(['sending', 'failed', 'unconfirmed'] as const)(+ 'replaces a local time proposal when delivery becomes %s without changing its send time',+ async (status) => {+ const context = createComposeContext();+ const { schedule, dispose } = createRoot((dispose) => ({+ dispose,+ schedule: createEmailSendSchedule({+ delivery: context.delivery,+ notices: context.notices,+ draftId: () => 'draft',+ threadId: () => 'thread',+ inboxId: () => 'inbox',+ saveDraft: vi.fn(),+ generation: () => 'one',+ includeSignature: () => undefined,+ }),+ }));+ try {+ schedule.observe(scheduled('pending'));+ const proposed = new Date('2026-12-02T12:00:00Z');+ expect(schedule.select(proposed)).toBe(true);+ schedule.observe(scheduled('pending'));+ expect(schedule.selectedTime()).toEqual(proposed);+ schedule.observe(scheduled(status));+ expect(schedule.state()).toEqual({+ type: 'scheduled',+ confirmedTime: new Date(sendTime),+ deliveryStatus: status,+ });+ expect(schedule.select(proposed)).toBe(false);+ expect(schedule.pickerDisabled()).toBe(true);+ expect(await schedule.submit()).toBe(false);+ expect(await schedule.cancel()).toBe(status === 'failed');+ expect(context.delivery.unschedule).toHaveBeenCalledTimes(+ status === 'failed' ? 1 : 0+ );+ expect(context.delivery.schedule).not.toHaveBeenCalled();+ expect(context.delivery.sendMessage).not.toHaveBeenCalled();+ } finally {+ dispose();+ }+ }+);++it.each(['standalone', 'reply'] as const)(+ '%s refreshes recovery status, keeps uncertain delivery locked, and restores a confirmed failure',+ async (kind) => {+ const context = createComposeContext();+ const root =+ kind === 'standalone'+ ? mountEmailComposer(context)+ : mountReplyComposer(context);+ const schedule =+ 'state' in root+ ? root.state.context.schedule+ : {+ state: root.scheduleState,+ pickerDisabled: root.schedulePickerDisabled,+ onSelect: root.handleSendTimeChange,+ onCancel: root.cancelSchedule,+ onCheckStatus: root.checkScheduleStatus,+ };+ const editingDisabled =+ 'state' in root ? root.state.context.disabled : root.editingDisabled;+ try {+ root.edit('Keep the scheduled message');+ await vi.advanceTimersByTimeAsync(600);+ context.setDraftLifecycle(scheduled('pending'));+ await vi.advanceTimersByTimeAsync(0);+ expect(schedule.onSelect(new Date('2026-12-02T12:00:00Z'))).toBe(true);+ context.setDraftLifecycle(scheduled('unconfirmed'));+ await vi.advanceTimersByTimeAsync(0);+ expect(schedule.state()).toMatchObject({+ type: 'scheduled',+ deliveryStatus: 'unconfirmed',+ confirmedTime: new Date(sendTime),+ });+ expect(schedule.pickerDisabled()).toBe(true);+ expect(editingDisabled()).toBe(true);+ expect(await schedule.onCancel()).toBe(false);+ const lifecycle = vi.mocked(context.draftLifecycle.observe).mock+ .results[0].value;+ const failure = new Error('Offline');+ vi.mocked(lifecycle.refresh).mockRejectedValueOnce(failure);+ await schedule.onCheckStatus?.();+ expect(context.notices.reportError).toHaveBeenCalledWith(failure);+ expect(schedule.state()).toMatchObject({ deliveryStatus: 'unconfirmed' });++ vi.mocked(lifecycle.refresh).mockImplementationOnce(async () => {+ const next = scheduled('failed');+ context.setDraftLifecycle(next);+ return next;+ });+ await schedule.onCheckStatus?.();+ await vi.advanceTimersByTimeAsync(0);+ expect(schedule.state()).toMatchObject({ deliveryStatus: 'failed' });+ expect(schedule.pickerDisabled()).toBe(true);+ expect(await schedule.onCancel()).toBe(true);+ expect(schedule.state().type).toBe('editing');+ expect(editingDisabled()).toBe(false);+ expect(context.delivery.unschedule).toHaveBeenCalledOnce();+ expect(context.delivery.schedule).not.toHaveBeenCalled();+ expect(context.delivery.sendMessage).not.toHaveBeenCalled();+ } finally {+ root.dispose();+ }+ }+);diff --git a/apps/web/src/features/email-compose/primitives/send-readiness.test.ts b/apps/web/src/features/email-compose/primitives/send-readiness.test.tsindex c504cd507e..345508ed27 100644--- a/apps/web/src/features/email-compose/primitives/send-readiness.test.ts+++ b/apps/web/src/features/email-compose/primitives/send-readiness.test.ts@@ -13,6 +13,7 @@ const handle: DraftIdentity = { kind: 'handle', draftId: 'h-1', queued: false };const uploaded = {type: 'local',attachmentId: 'a-1',+ uploaded: true,} as unknown as DraftFormAttachment;const pending = { type: 'local' } as unknown as DraftFormAttachment;@@ -24,6 +25,27 @@ const ready = {};describe('sendRefusalBeforeSave', () => {+ it('allows offline immediate sends on the durable transport', () => {+ expect(+ sendRefusalBeforeSave({ looksOffline: () => true }, true)+ ).toBeUndefined();+ expect(+ sendRefusalAfterSave({+ ...ready,+ queueActive: true,+ identity: { ...handle, queued: true },+ })+ ).toBeUndefined();+ expect(+ sendRefusalAfterSave({+ ...ready,+ queueActive: true,+ identity: { ...handle, queued: true },+ attachments: [pending],+ })+ ).toBe('attachment-not-uploaded');+ });+it('refuses only while the device looks offline', () => {expect(sendRefusalBeforeSave({ looksOffline: () => true })).toBe('offline');expect(@@ -33,6 +55,22 @@ describe('sendRefusalBeforeSave', () => {});describe('sendRefusalAfterSave', () => {+ it('refuses an interrupted upload after reopening even though it has an ID', () => {+ const attachment: DraftFormAttachment = {+ type: 'local',+ file: new File(['pending'], 'pending.txt'),+ attachmentId: 'allocated-id',+ uploaded: false,+ uploadPending: true,+ };+ expect(+ sendRefusalAfterSave({+ ...ready,+ queueActive: true,+ attachments: [attachment],+ })+ ).toBe('attachment-not-uploaded');+ });it('allows a confirmed server draft with uploaded attachments', () => {expect(sendRefusalAfterSave(ready)).toBeUndefined();});diff --git a/apps/web/src/features/email-compose/primitives/send-readiness.ts b/apps/web/src/features/email-compose/primitives/send-readiness.tsindex 8960414586..8835adc230 100644--- a/apps/web/src/features/email-compose/primitives/send-readiness.ts+++ b/apps/web/src/features/email-compose/primitives/send-readiness.ts@@ -1,3 +1,10 @@+import { $isImageNode, $isVideoNode } from '@macro-inc/lexical-core';+import {+ $getRoot,+ $isElementNode,+ type LexicalEditor,+ type LexicalNode,+} from 'lexical';import type {EmailComposeFeedback,EmailConnectivity,@@ -5,14 +12,11 @@ import type {import type { DraftIdentity } from './draft-session';import type { DraftFormAttachment } from './email-form-state';-/**- * Why an immediate send cannot proceed. Send is a REST call that resolves- * server ids only and is never queued (it moves onto the durable queue in a- * later change), so it needs the device online, a draft the server can- * address, and every attachment uploaded.- */+/** Durable sends accept local handles; attachment uploads must already be complete. */export type SendRefusal =| 'offline'+ | 'offline-attachments'+ | 'media-not-uploaded'| 'draft-not-saved'| 'draft-not-confirmed'| 'attachment-not-uploaded'@@ -20,6 +24,9 @@ export type SendRefusal =const SEND_REFUSAL_SUBTEXT: Record<SendRefusal, string> = {offline: "You're offline",+ 'offline-attachments': 'Reconnect to send this email.',+ 'media-not-uploaded':+ 'Wait for images and videos to finish uploading, or remove them.','draft-not-saved': 'Draft not saved','draft-not-confirmed': 'Draft still syncing, try again','attachment-not-uploaded': 'Attachment not uploaded',@@ -35,11 +42,18 @@ export function refuseSend(});}-/** Offline, the pre-send save could only queue; refuse before it runs. */+/** Only legacy delivery and unfinished uploads require connectivity. */export function sendRefusalBeforeSave(- connectivity: EmailConnectivity+ connectivity: EmailConnectivity,+ queueActive = false,+ hasAttachments = false): SendRefusal | undefined {- return connectivity.looksOffline() ? 'offline' : undefined;+ if (!connectivity.looksOffline()) return;+ return hasAttachments+ ? 'offline-attachments'+ : !queueActive+ ? 'offline'+ : undefined;}/**@@ -53,12 +67,14 @@ export function sendRefusalAfterSave(input: {autosaveAllowed: boolean;attachments: readonly DraftFormAttachment[];unqueuedHandleMaySend: boolean;+ queueActive?: boolean;}): SendRefusal | undefined {const { identity } = input;if (!input.autosaveAllowed) return 'draft-not-confirmed';- if (identity.kind === 'server' && identity.queued)+ if (!input.queueActive && identity.kind === 'server' && identity.queued)return 'draft-not-confirmed';if (+ !input.queueActive &&identity.kind === 'handle' &&(!input.unqueuedHandleMaySend || identity.queued)) {@@ -66,10 +82,29 @@ export function sendRefusalAfterSave(input: {}if (input.attachments.some(- (attachment) => attachment.type === 'local' && !attachment.attachmentId+ (attachment) =>+ (attachment.type === 'local' &&+ (!attachment.attachmentId ||+ (input.queueActive && attachment.uploaded !== true))) ||+ (attachment.type === 'remote' && attachment.uploadPending === true))) {return 'attachment-not-uploaded';}return undefined;}++/** The immutable send payload must contain durable media URLs. */+export function pendingInlineMedia(editor: LexicalEditor | undefined): boolean {+ if (!editor) return false;+ return editor.read(() => {+ const pending = (node: LexicalNode): boolean => {+ if ($isImageNode(node) || $isVideoNode(node))+ return (+ node.getSrcType() === 'local' || node.getUrl().startsWith('blob:')+ );+ return $isElementNode(node) && node.getChildren().some(pending);+ };+ return pending($getRoot());+ });+}diff --git a/apps/web/src/features/email-compose/primitives/send-restoration-race.test.ts b/apps/web/src/features/email-compose/primitives/send-restoration-race.test.tsnew file mode 100644index 0000000000..0f2814aea6--- /dev/null+++ b/apps/web/src/features/email-compose/primitives/send-restoration-race.test.ts@@ -0,0 +1,179 @@+import { fireAndForget } from '@core/util/fireAndForget';+import { $getRoot } from 'lexical';+import { createSignal } from 'solid-js';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { message } from '../../email-message/tests/messages';+import type { EmailDraftRestoration } from '../context/compose-capabilities';+import { createComposeContext } from '../tests/capabilities';+import { mountEmailComposer } from '../tests/composer';+import { mountReplyComposer } from '../tests/reply';++beforeEach(() => vi.useFakeTimers());+afterEach(() => vi.useRealTimers());++it.each([false, true])(+ 'cancels delayed mark-done when the queued reply is restored: %s',+ async (restore) => {+ const context = createComposeContext();+ const archived = vi.fn();+ let completeMarkDone = () => {};+ let listener: ((event: EmailDraftRestoration) => void) | undefined;+ context.drafts.watchRestorations = (changed) => {+ listener = changed;+ return () => {};+ };+ context.drafts.readDraft = vi.fn(async () => ({+ draft: message('draft', {+ is_draft: true,+ replying_to_id: 'parent',+ body_text: 'Restored body',+ body_html_sanitized: null,+ }),+ persistence: 'queued' as const,+ }));+ const root = mountReplyComposer(context, undefined, {+ draft: message('draft', { is_draft: true }),+ onMarkDone: (options) => {+ completeMarkDone = () => {+ if (!options?.cancelled?.()) archived();+ };+ return true;+ },+ });+ try {+ await root.sendEmail(true);+ expect(context.delivery.sendMessage).toHaveBeenCalledOnce();+ if (restore) {+ listener?.({+ draftId: 'draft',+ originalDraftId: 'draft',+ threadId: 'thread',+ inboxId: 'inbox',+ replyingToId: 'parent',+ });+ await vi.advanceTimersByTimeAsync(0);+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe(+ 'Restored body'+ );+ }+ completeMarkDone();+ expect(archived).toHaveBeenCalledTimes(restore ? 0 : 1);+ } finally {+ root.dispose();+ }+ }+);++it.each([+ ['standalone', false],+ ['reply', false],+ ['standalone', true],+ ['reply', true],+] as const)(+ 'retains restoration and the current send phase: %s, preparing another send: %s',+ async (kind, sendAgain) => {+ const context = createComposeContext();+ context.delivery.queueActive = () => true;+ context.drafts.saveLocalDraft = vi.fn(async (input) => ({+ key: input.draft.db_id ?? input.clientHandles?.draftId ?? 'draft',+ draftId: input.draft.db_id ?? input.clientHandles?.draftId ?? 'draft',+ threadId: 'thread',+ accountId: 'owner',+ generation: 'original',+ revision: 1,+ acknowledgedRevision: 0,+ status: 'dirty' as const,+ updatedAt: Date.now(),+ content: input.draft,+ attachments: [],+ }));+ let listener: ((event: EmailDraftRestoration) => void) | undefined;+ context.drafts.watchRestorations = (changed) => {+ listener = changed;+ return () => {};+ };+ const [locked, setLocked] = createSignal(false);+ context.delivery.sendLocked = locked;+ let finish: (() => void) | undefined;+ context.delivery.sendMessage = vi.fn(async () => {+ setLocked(true);+ await new Promise<void>((resolve) => {+ finish = resolve;+ });+ return {+ draftId: 'draft',+ threadId: 'thread',+ inboxId: 'inbox',+ sendAttemptId: 'attempt',+ persistence: 'queued' as const,+ };+ });+ context.drafts.readDraft = vi.fn(async () => ({+ draft: message('draft', {+ is_draft: true,+ replying_to_id: kind === 'reply' ? 'parent' : undefined,+ subject: 'Restored subject',+ body_text: 'Restored body',+ body_html_sanitized: null,+ }),+ persistence: 'queued' as const,+ }));+ const root =+ kind === 'standalone'+ ? mountEmailComposer(context, undefined, {+ draft: message('draft', { is_draft: true }),+ })+ : mountReplyComposer(context, undefined, {+ draft: message('draft', { is_draft: true }),+ });+ try {+ root.edit('Original body');+ if ('state' in root) root.state.context.onSend();+ else fireAndForget(root.sendEmail(), 'email-restoration-test');+ await vi.advanceTimersByTimeAsync(0);+ expect(context.delivery.sendMessage).toHaveBeenCalledOnce();+ setLocked(false);+ listener?.({+ draftId: 'draft',+ originalDraftId: 'draft',+ threadId: 'thread',+ inboxId: 'inbox',+ replyingToId: kind === 'reply' ? 'parent' : undefined,+ });+ await vi.advanceTimersByTimeAsync(0);+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe(+ 'Restored body'+ );+ expect(+ 'state' in root ? root.state.context.disabled() : root.editingDisabled()+ ).toBe(false);+ if (sendAgain) {+ context.drafts.saveLocalDraft = vi.fn(+ () => new Promise<never>(() => {})+ );+ if ('state' in root) root.state.context.onSend();+ else fireAndForget(root.sendEmail(), 'email-restoration-test');+ await vi.advanceTimersByTimeAsync(0);+ expect(context.drafts.saveLocalDraft).toHaveBeenCalledOnce();+ expect(+ 'state' in root+ ? root.state.context.disabled()+ : root.editingDisabled()+ ).toBe(true);+ }+ finish?.();+ await vi.advanceTimersByTimeAsync(0);+ expect('state' in root ? root.state.draftId() : root.savedDraftId()).toBe(+ 'draft'+ );+ expect(root.editor.read(() => $getRoot().getTextContent())).toBe(+ 'Restored body'+ );+ expect(+ 'state' in root ? root.state.context.disabled() : root.editingDisabled()+ ).toBe(sendAgain);+ } finally {+ root.dispose();+ }+ }+);diff --git a/apps/web/src/features/email-compose/primitives/send-schedule.test.ts b/apps/web/src/features/email-compose/primitives/send-schedule.test.tsindex 740f7f9d3e..0f33b06996 100644--- a/apps/web/src/features/email-compose/primitives/send-schedule.test.ts+++ b/apps/web/src/features/email-compose/primitives/send-schedule.test.ts@@ -25,6 +25,56 @@ function hoursFromNow(hours: number): Date {return new Date(Date.now() + hours * 60 * 60 * 1000);}+it.each(['standalone', 'reply'] as const)(+ '%s refreshes lifecycle after a queued cancellation before accepting an old sent observation',+ async (kind) => {+ vi.useFakeTimers();+ const context = createComposeContext();+ const [locked, setLocked] = createSignal(false);+ context.delivery.sendLocked = locked;+ const state = composer(kind, context);+ try {+ state.edit('Keep this draft');+ await vi.advanceTimersByTimeAsync(600);+ const lifecycle = vi.mocked(context.draftLifecycle.observe).mock+ .results[0].value;+ const refreshed = Promise.withResolvers<undefined>();+ vi.mocked(lifecycle.refresh).mockImplementationOnce(() => {+ context.setDraftLifecycle(undefined);+ return refreshed.promise;+ });+ setLocked(true);+ context.setDraftLifecycle({+ type: 'sent',+ draftId: 'draft',+ threadId: 'thread',+ inboxId: 'inbox',+ observedAt: Date.now(),+ });+ await vi.advanceTimersByTimeAsync(0);+ expect(state.disabled()).toBe(true);+ setLocked(false);+ await vi.advanceTimersByTimeAsync(0);+ expect(lifecycle.refresh).toHaveBeenCalledOnce();+ expect(context.notices.feedback.alert).not.toHaveBeenCalled();+ context.setDraftLifecycle({+ type: 'editing',+ draftId: 'draft',+ threadId: 'thread',+ inboxId: 'inbox',+ observedAt: Date.now(),+ });+ refreshed.resolve(undefined);+ await vi.advanceTimersByTimeAsync(0);+ expect(state.disabled()).toBe(false);+ expect(context.notices.feedback.alert).not.toHaveBeenCalled();+ } finally {+ state.dispose();+ vi.useRealTimers();+ }+ }+);+function composer(kind: 'standalone' | 'reply',composeContext: EmailComposeContext,@@ -675,6 +725,7 @@ describe('send and schedule ordering', () => {await vi.advanceTimersByTimeAsync(0);expect(composeContext.delivery.unschedule).toHaveBeenCalledWith({+ draftGeneration: 0,draftId: 'draft',threadId: 'thread',inboxId: 'inbox',@@ -1117,6 +1168,7 @@ describe('send and schedule ordering', () => {expect(context.attachmentStorage.addForwardedAttachments).toHaveBeenCalledExactlyOnceWith({+ draftGeneration: 0,draftId: 'draft',inboxId: 'inbox',attachments: [{ attachmentId: 'source-file' }],diff --git a/apps/web/src/features/email-compose/queries/draft-lifecycle-source.test.tsx b/apps/web/src/features/email-compose/queries/draft-lifecycle-source.test.tsxindex 4b1748b1e1..17ef336f8b 100644--- a/apps/web/src/features/email-compose/queries/draft-lifecycle-source.test.tsx+++ b/apps/web/src/features/email-compose/queries/draft-lifecycle-source.test.tsx@@ -34,6 +34,7 @@ function thread(scheduled: boolean): ApiThread {is_read: true,messages: [{+ draft_generation: 0,attachments: [],attachments_draft: [],attachments_forwarded: [],diff --git a/apps/web/src/features/email-compose/queries/draft-lifecycle.test.ts b/apps/web/src/features/email-compose/queries/draft-lifecycle.test.tsindex 6f329b460f..323a3a8e3a 100644--- a/apps/web/src/features/email-compose/queries/draft-lifecycle.test.ts+++ b/apps/web/src/features/email-compose/queries/draft-lifecycle.test.ts@@ -14,6 +14,22 @@ function draft(overrides: Partial<ApiMessage> = {}): ApiMessage {}describe('deriveEmailDraftLifecycle', () => {+ it.each(['pending', 'sending', 'failed', 'unconfirmed'] as const)(+ 'retains scheduled delivery recovery status %s',+ (status) => {+ expect(+ deriveEmailDraftLifecycle({+ draftId: 'draft',+ threadId: 'thread',+ inboxId: 'inbox',+ message: draft({+ scheduled_send_time: '2026-12-01T12:00:00Z',+ scheduled_send_status: status,+ }),+ })+ ).toMatchObject({ type: 'scheduled', deliveryStatus: status });+ }+ );it('tracks an editable draft by its exact message and inbox identity', () => {expect(deriveEmailDraftLifecycle({diff --git a/apps/web/src/features/email-compose/queries/draft-lifecycle.ts b/apps/web/src/features/email-compose/queries/draft-lifecycle.tsindex 5bbdb85d79..2b613de848 100644--- a/apps/web/src/features/email-compose/queries/draft-lifecycle.ts+++ b/apps/web/src/features/email-compose/queries/draft-lifecycle.ts@@ -54,6 +54,7 @@ export function deriveEmailDraftLifecycle(input: {type: 'scheduled',...identity,sendTime: message.scheduled_send_time,+ deliveryStatus: message.scheduled_send_status ?? undefined,};}return { type: 'editing', ...identity };diff --git a/apps/web/src/features/email-compose/queries/queued-draft.ts b/apps/web/src/features/email-compose/queries/queued-draft.tsindex 4f525caae5..37eaeab6c1 100644--- a/apps/web/src/features/email-compose/queries/queued-draft.ts+++ b/apps/web/src/features/email-compose/queries/queued-draft.ts@@ -33,6 +33,7 @@ export function queuedDraftSaveArgs({senderIsSignal: senderAccount?.draft_is_signal,newThreadOwnerId,draftId: handles.draftId,+ draftGeneration: draft.draft_generation ?? 0,threadDbId: handles.threadId,// Persist the selected inbox itself: the primary inbox can change before replay.linkId: senderLinkId || undefined,diff --git a/apps/web/src/features/email-compose/queued-send-status.test.tsx b/apps/web/src/features/email-compose/queued-send-status.test.tsxnew file mode 100644index 0000000000..1e9a3e7f2b--- /dev/null+++ b/apps/web/src/features/email-compose/queued-send-status.test.tsx@@ -0,0 +1,144 @@+import type { EmailSendIntent } from '@queries/email/send-queue';+import {+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from '@solidjs/testing-library';+import type { ComponentProps } from 'solid-js';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { QueuedSendStatus } from './queued-send-status';++const mocks = vi.hoisted(() => ({+ intents: [] as EmailSendIntent[],+ refresh: vi.fn(async () => {}),+ cancel: vi.fn(async () => {}),+ restore: vi.fn(async () => {}),+ recover: vi.fn(async () => {}),+}));+vi.mock('@queries/email/draft-queue', () => ({ draftQueueActive: () => true }));+vi.mock('@queries/email/queued-sends', () => ({+ useQueuedEmailSends: () => ({+ intents: () => mocks.intents,+ refresh: mocks.refresh,+ }),+}));+vi.mock('@queries/email/send-queue', () => ({+ cancelEmailSendQueued: mocks.cancel,+ restoreCancelledEmailSend: mocks.restore,+ recoverEmailSendIntent: mocks.recover,+ settledSendAttempt: (intent: EmailSendIntent) =>+ intent.response?.sendEmailMessage?.attempt,+ emailSendLocked: () => true,+}));+vi.mock('@ui', () => ({+ Button: (props: ComponentProps<'button'>) => <button {...props} />,+}));+afterEach(cleanup);+beforeEach(() => {+ vi.clearAllMocks();+});++function showStatus(+ status: 'ACCEPTED' | 'FAILED' | 'DELIVERY_UNCONFIRMED',+ cancellationPending = false+) {+ mocks.intents = [+ {+ uuid: 'attempt',+ phase: cancellationPending ? 'pending' : 'committed',+ locallyCancelled: false,+ dispatchVersion: 2,+ cancellationRequested: cancellationPending,+ metadata: {+ kind: 'email-send-v1',+ payload: {+ draft: {+ draftId: 'draft',+ threadDbId: 'thread',+ senderLinkId: 'inbox',+ senderEmail: '[email protected]',+ subject: 'Saved message',+ optimisticBodyHtml: null,+ },+ input: {+ attempt: { attemptId: 'attempt', linkId: 'inbox' },+ message: {+ draftId: 'draft',+ subject: 'Saved message',+ },+ attachmentIds: [],+ forwardedAttachmentIds: [],+ },+ },+ },+ response: {+ sendEmailMessage: {+ attempt: {+ attemptId: 'attempt',+ status,+ sendTime: null,+ threadId: 'thread',+ message: null,+ },+ },+ },+ },+ ];+ return render(() => <QueuedSendStatus />);+}++it('keeps an accepted preparation cancellable while waiting to submit', async () => {+ showStatus('ACCEPTED');+ expect(screen.getByRole('status').textContent).toBe('Accepted by server');+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));+ await waitFor(() => expect(mocks.cancel).toHaveBeenCalledOnce());+ expect(mocks.restore).not.toHaveBeenCalled();+});++it('keeps a pending cancellation visible after an accepted preparation', () => {+ showStatus('ACCEPTED', true);+ expect(screen.getByRole('status').textContent).toBe('Cancellation pending');+ expect(+ screen.getByRole('button', { name: 'Cancel' }).hasAttribute('disabled')+ ).toBe(true);+ expect(mocks.cancel).not.toHaveBeenCalled();+});++it('explains a failure before delivery and offers cancellation for recovery', async () => {+ showStatus('FAILED');+ expect(screen.getByRole('status').textContent).toContain(+ 'failed before delivery'+ );+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }));+ await waitFor(() => expect(mocks.cancel).toHaveBeenCalledOnce());+ expect(mocks.restore).not.toHaveBeenCalled();+});++it('keeps uncertain delivery read-only and offers only status reconciliation', async () => {+ showStatus('DELIVERY_UNCONFIRMED');+ expect(screen.getByRole('status').textContent).toContain(+ 'may already have been sent'+ );+ expect(screen.queryByRole('button', { name: 'Cancel' })).toBeNull();+ expect(screen.queryByRole('button', { name: 'Restore draft' })).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'Check status' }));+ await waitFor(() => expect(mocks.refresh).toHaveBeenCalledWith());+ expect(mocks.cancel).not.toHaveBeenCalled();+ expect(mocks.restore).not.toHaveBeenCalled();+});++it('shows a status refresh error and permits checking again', async () => {+ mocks.recover.mockRejectedValueOnce(new Error('You are offline'));+ showStatus('DELIVERY_UNCONFIRMED');+ const checkStatus = screen.getByRole('button', { name: 'Check status' });+ fireEvent.click(checkStatus);+ await waitFor(() =>+ expect(screen.getByRole('alert').textContent).toBe('You are offline')+ );+ fireEvent.click(checkStatus);+ await waitFor(() => expect(mocks.recover).toHaveBeenCalledTimes(2));+ expect(screen.queryByRole('alert')).toBeNull();+ expect(mocks.cancel).not.toHaveBeenCalled();+});diff --git a/apps/web/src/features/email-compose/queued-send-status.tsx b/apps/web/src/features/email-compose/queued-send-status.tsxnew file mode 100644index 0000000000..00d271310c--- /dev/null+++ b/apps/web/src/features/email-compose/queued-send-status.tsx@@ -0,0 +1,277 @@+import { fireAndForget } from '@core/util/fireAndForget';+import { cancelServerEmailSend } from '@queries/email/cancel-server-send';+import { useQueuedEmailSends } from '@queries/email/queued-sends';+import { emailSendStorageWarning } from '@queries/email/send-intent';+import {+ cancelEmailSendQueued,+ type EmailSendIntent,+ emailSendLocked,+ recoverEmailSendIntent,+ restoreCancelledEmailSend,+ settledSendAttempt,+} from '@queries/email/send-queue';+import {+ hasMoreServerEmailSends,+ loadMoreServerEmailSends,+ refreshServerEmailSends,+ type ServerEmailSend,+ serverEmailSends,+ serverEmailSendsError,+} from '@queries/email/server-sends';+import { Button } from '@ui';+import { createSignal, For, Show } from 'solid-js';++/** App-facing persistent send status, shared by Drafts and conversation hosts. */+export function QueuedSendStatus(props: {+ threadId?: string;+ inboxIds?: readonly string[];+}) {+ const sends = useQueuedEmailSends();+ const visible = () =>+ sends.intents().filter((intent) => {+ const { draft, input } = intent.metadata.payload;+ const attempt = settledSendAttempt(intent);+ return (+ attempt?.status !== 'SENT' &&+ (!props.threadId ||+ intent.resolvedThreadId === props.threadId ||+ draft.threadDbId === props.threadId ||+ attempt?.threadId === props.threadId) &&+ (!props.inboxIds?.length ||+ props.inboxIds.includes(String(input.attempt.linkId)))+ );+ });+ const visibleServer = () =>+ serverEmailSends().filter(+ (row) =>+ !sends+ .intents()+ .some(+ (local) =>+ local.uuid === row.attempt.attemptId &&+ local.metadata.payload.input.attempt.linkId === row.linkId+ ) &&+ row.attempt.status !== 'SENT' &&+ row.attempt.status !== 'CANCELLED' &&+ (!props.threadId || row.attempt.threadId === props.threadId) &&+ (!props.inboxIds?.length || props.inboxIds.includes(row.linkId))+ );+ return (+ <Show+ when={+ visible().length > 0 ||+ visibleServer().length > 0 ||+ serverEmailSendsError() ||+ emailSendStorageWarning()+ }+ >+ <div+ class="shrink-0 border-b border-edge-muted p-3"+ aria-label="Queued email sends"+ >+ <For each={visible()}>+ {(intent) => (+ <SendStatus intent={intent} refresh={() => sends.refresh()} />+ )}+ </For>+ <Show when={emailSendStorageWarning()}>+ <p class="text-xs text-ink-muted" role="alert">+ {emailSendStorageWarning()}+ </p>+ </Show>+ <For each={visibleServer()}>+ {(row) => <ServerSendStatus row={row} />}+ </For>+ <Show when={serverEmailSendsError()}>+ <p class="text-xs text-ink-muted" role="status">+ {serverEmailSendsError()}+ </p>+ </Show>+ <Show when={hasMoreServerEmailSends()}>+ <Button+ onClick={() =>+ fireAndForget(loadMoreServerEmailSends(), 'email-more-sends')+ }+ >+ Load more sends+ </Button>+ </Show>+ </div>+ </Show>+ );+}++function ServerSendStatus(props: { row: ServerEmailSend }) {+ const [working, setWorking] = createSignal(false);+ const [error, setError] = createSignal<string>();+ const status = () => props.row.attempt.status;+ const cancellable = () => status() === 'ACCEPTED' || status() === 'FAILED';+ const action = async () => {+ setWorking(true);+ setError(undefined);+ try {+ if (cancellable()) await cancelServerEmailSend(props.row);+ else await refreshServerEmailSends();+ } catch (error) {+ setError(+ error instanceof Error+ ? error.message+ : 'Could not update delivery status'+ );+ } finally {+ setWorking(false);+ }+ };+ return (+ <div class="flex items-start justify-between gap-3 py-1">+ <div class="min-w-0">+ <div class="truncate text-sm text-ink">+ {props.row.attempt.message?.subject || '(No subject)'}+ </div>+ <div class="text-xs text-ink-muted" role="status">+ {status() === 'ACCEPTED'+ ? 'Accepted by server'+ : status() === 'FAILED'+ ? 'Send failed before delivery. Cancel to recover this draft.'+ : status() === 'DELIVERY_UNCONFIRMED'+ ? 'Delivery unconfirmed. Check sent mail; we will not resend automatically.'+ : 'Sending'}+ <Show when={props.row.attempt.sendTime}>+ {' · '}+ {new Date(props.row.attempt.sendTime!).toLocaleString()}+ </Show>+ </div>+ <Show when={error()}>+ <p class="text-xs text-ink" role="alert">+ {error()}+ </p>+ </Show>+ </div>+ <Button+ disabled={working()}+ onClick={() => fireAndForget(action(), 'email-server-send')}+ >+ {cancellable() ? 'Cancel and restore' : 'Check status'}+ </Button>+ </div>+ );+}++function SendStatus(props: {+ intent: EmailSendIntent;+ refresh: () => Promise<void>;+}) {+ const [working, setWorking] = createSignal(false);+ const [error, setError] = createSignal<string>();+ const status = () => settledSendAttempt(props.intent)?.status;+ const label = () => {+ if (!emailSendLocked(props.intent)) return 'Send cancelled';+ if (status() === 'DELIVERY_UNCONFIRMED')+ return 'Delivery unconfirmed. Your email may already have been sent. Check your sent mail. We will not resend automatically.';+ if (status() === 'FAILED')+ return 'Send failed before delivery. Cancel to recover this draft.';+ if (props.intent.dispatch?.paused) return props.intent.dispatch.error;+ if (props.intent.phase === 'failed')+ return 'Send needs attention. Cancel to recover this draft.';+ if (emailSendLocked(props.intent) && props.intent.cancellationRequested)+ return 'Cancellation pending';+ if (status() === 'ACCEPTED') return 'Accepted by server';+ if (status() === 'SENDING' || props.intent.phase === 'committed')+ return 'Sending';+ return props.intent.submissionStarted+ ? 'Checking server acceptance'+ : 'Queued on this device';+ };+ const cancel = async () => {+ setWorking(true);+ setError(undefined);+ try {+ if (emailSendLocked(props.intent))+ await cancelEmailSendQueued(props.intent);+ else await restoreCancelledEmailSend(props.intent);+ await props.refresh();+ } catch (error) {+ setError(+ error instanceof Error ? error.message : 'Unable to cancel the send'+ );+ } finally {+ setWorking(false);+ }+ };+ const checkStatus = async () => {+ setWorking(true);+ setError(undefined);+ try {+ await recoverEmailSendIntent(props.intent);+ await props.refresh();+ } catch (error) {+ setError(+ error instanceof Error ? error.message : 'Unable to check send status'+ );+ } finally {+ setWorking(false);+ }+ };+ return (+ <div class="flex items-start justify-between gap-3 py-1">+ <div class="min-w-0">+ <div class="truncate text-sm text-ink">+ {props.intent.metadata.payload.draft.subject || '(No subject)'}+ </div>+ <div class="text-xs text-ink-muted" role="status">+ {label()}+ <Show when={props.intent.metadata.payload.input.message.sendTime}>+ {(sendTime) => <> · {new Date(sendTime()).toLocaleString()}</>}+ </Show>+ </div>+ <Show when={error()}>+ <div class="text-xs text-ink" role="alert">+ {error()}+ </div>+ </Show>+ <Show when={props.intent.phase === 'failed'}>+ <details class="text-xs text-ink-muted">+ <summary>View saved message</summary>+ <div>+ {props.intent.metadata.payload.input.message.to+ ?.map((contact) => contact.email)+ .join(', ')}+ </div>+ <pre class="whitespace-pre-wrap">+ {props.intent.metadata.payload.input.restoreBodyText ??+ props.intent.metadata.payload.input.message.bodyText}+ </pre>+ </details>+ </Show>+ </div>+ <Show+ when={status() !== 'SENDING' && status() !== 'DELIVERY_UNCONFIRMED'}+ >+ <Button+ disabled={+ working() ||+ (emailSendLocked(props.intent) &&+ props.intent.cancellationRequested)+ }+ onClick={() => fireAndForget(cancel(), 'email-compose-cancel-send')}+ >+ {emailSendLocked(props.intent) ? 'Cancel' : 'Restore draft'}+ </Button>+ </Show>+ <Show+ when={+ status() === 'DELIVERY_UNCONFIRMED' || props.intent.dispatch?.paused+ }+ >+ <Button+ disabled={working()}+ onClick={() =>+ fireAndForget(checkStatus(), 'email-compose-check-send')+ }+ >+ Check status+ </Button>+ </Show>+ </div>+ );+}diff --git a/apps/web/src/features/email-compose/tests/reply.ts b/apps/web/src/features/email-compose/tests/reply.tsindex a9a55ea1b4..f9e1066338 100644--- a/apps/web/src/features/email-compose/tests/reply.ts+++ b/apps/web/src/features/email-compose/tests/reply.ts@@ -1,6 +1,7 @@import { createMemo, createRoot } from 'solid-js';import { message } from '../../email-message/tests/messages';import type { EmailComposeContext } from '../context/compose-capabilities';+import type { EmailReplySession } from '../context/email-form-inputs';import { createEmailFormState } from '../primitives/email-form-state';import {createReplyComposer,@@ -14,9 +15,16 @@ export function mountReplyComposer(replyingTo = () => message('parent'),callbacks: Pick<ReplyComposerOptions,- 'draft' | 'sideEffectOnSend' | 'onMarkDone'+ | 'draft'+ | 'preloadedHtml'+ | 'sideEffectOnSend'+ | 'onMarkDone'+ | 'setShowReply'> = {},- thread: { inboxVisible?: boolean } = {}+ thread: {+ inboxVisible?: boolean;+ replyRequest?: EmailReplySession['replyRequest'];+ } = {}) {return createRoot((dispose) => {const editor = createEmailEditor('Ready to send');@@ -49,7 +57,10 @@ export function mountReplyComposer(isPersonalReply: () => false,onDraftRemoved() {},exitToThread: () => false,- replyRequest: { replyType: () => undefined, clear() {} },+ replyRequest: thread.replyRequest ?? {+ replyType: () => undefined,+ clear() {},+ },},},() => editor,diff --git a/apps/web/src/features/email-compose/undo-send.test.ts b/apps/web/src/features/email-compose/undo-send.test.tsnew file mode 100644index 0000000000..edc40cf713--- /dev/null+++ b/apps/web/src/features/email-compose/undo-send.test.ts@@ -0,0 +1,145 @@+import {+ EmailSendCancellationTooLate,+ EmailSendDeliveryUnconfirmed,+ type EmailSendIntent,+} from '@queries/email/send-queue';+import { createRoot } from 'solid-js';+import { beforeEach, expect, it, vi } from 'vitest';+import { endUndoSend } from './primitives/undo-send-claim';+import { runQueuedUndoSend } from './undo-send';++const mocks = vi.hoisted(() => ({+ read: vi.fn(),+ cancel: vi.fn(),+ restore: vi.fn(),+ success: vi.fn(),+ failure: vi.fn(),+ alert: vi.fn(),+ error: vi.fn(),+}));+vi.mock('@core/component/Toast/Toast', () => ({ toast: mocks }));+vi.mock('@macro-inc/observability', () => ({ Telemetry: mocks }));+vi.mock('@queries/client', () => ({ queryClient: {} }));+vi.mock('@queries/email/integration', () => ({}));+vi.mock('@queries/email/keys', () => ({}));+vi.mock('@queries/soup/cache', () => ({}));+vi.mock('./primitives/prepare-email-body', () => ({}));+vi.mock('@queries/email/send-queue', () => ({+ readEmailSendIntents: mocks.read,+ cancelEmailSendQueued: mocks.cancel,+ restoreCancelledEmailSend: mocks.restore,+ emailSendLocked: (intent: EmailSendIntent) => !intent.locallyCancelled,+ EmailSendCancellationTooLate: class extends Error {},+ EmailSendDeliveryUnconfirmed: class extends Error {+ constructor() {+ super(+ 'Delivery unconfirmed; check your sent mail. We will not resend automatically.'+ );+ }+ },+}));++const intent: EmailSendIntent = {+ uuid: 'attempt',+ dispatchVersion: 2,+ phase: 'pending',+ locallyCancelled: false,+ metadata: {+ kind: 'email-send-v1',+ payload: {+ input: {+ attempt: { attemptId: 'attempt', linkId: 'inbox' },+ message: {+ draftId: 'draft',+ subject: 'Approved subject',+ to: [],+ cc: [],+ bcc: [],+ },+ attachmentIds: [],+ forwardedAttachmentIds: [],+ },+ draft: {+ draftId: 'draft',+ threadDbId: 'thread',+ senderLinkId: 'inbox',+ senderEmail: '[email protected]',+ optimisticBodyHtml: null,+ subject: 'Approved subject',+ to: [],+ },+ },+ },+};++const cancelled = { ...intent, locallyCancelled: true };+const onUndone = vi.fn();+const options = { draftId: 'draft', attemptId: intent.uuid, onUndone };+beforeEach(() => {+ vi.clearAllMocks();+ endUndoSend(options.draftId);+ mocks.read.mockResolvedValue([intent]);+ mocks.cancel.mockResolvedValue(cancelled);+ mocks.restore.mockResolvedValue(undefined);+});++it('restores the persisted cancellation and reopens the draft after navigation disposes the composer', async () => {+ const undo = createRoot((dispose) => {+ const undo = () => runQueuedUndoSend(options);+ dispose();+ return undo;+ });+ await undo();+ expect(mocks.restore).toHaveBeenCalledWith(cancelled);+ expect(onUndone).toHaveBeenCalledOnce();+ expect(mocks.success).toHaveBeenCalledWith('Send cancelled');+ await undo();+ expect(mocks.cancel).toHaveBeenCalledOnce();+});++it('keeps uncertain cancellation locked, gives feedback, and allows a confirmed retry', async () => {+ mocks.cancel.mockResolvedValueOnce(intent);+ await runQueuedUndoSend(options);+ expect(mocks.restore).not.toHaveBeenCalled();+ expect(onUndone).not.toHaveBeenCalled();+ expect(mocks.alert).toHaveBeenCalledWith(+ 'Cancellation pending — waiting for confirmation'+ );+ await runQueuedUndoSend(options);+ expect(mocks.restore).toHaveBeenCalledWith(cancelled);+ expect(onUndone).toHaveBeenCalledOnce();+});++it.each([+ [+ new EmailSendCancellationTooLate(),+ 'Too late to undo — delivery has already started',+ ],+ [new Error('storage unavailable'), 'Failed to undo send'],+ [+ new EmailSendDeliveryUnconfirmed(),+ 'Delivery unconfirmed; check your sent mail. We will not resend automatically.',+ ],+])(+ 'shows cancellation failures and allows retry: %s',+ async (error, message) => {+ mocks.cancel.mockRejectedValueOnce(error);+ await runQueuedUndoSend(options);+ expect(mocks.failure).toHaveBeenCalledWith(message);+ expect(mocks.error).toHaveBeenCalledWith(error);+ expect(mocks.restore).not.toHaveBeenCalled();+ expect(onUndone).not.toHaveBeenCalled();+ await runQueuedUndoSend(options);+ expect(onUndone).toHaveBeenCalledOnce();+ }+);++it('reports failed restoration without claiming success or losing the recovery intent', async () => {+ mocks.restore.mockRejectedValueOnce(new Error('restore failed'));+ await runQueuedUndoSend(options);+ expect(mocks.failure).toHaveBeenCalledWith('Failed to undo send');+ expect(mocks.success).not.toHaveBeenCalled();+ expect(onUndone).not.toHaveBeenCalled();+ await runQueuedUndoSend(options);+ expect(onUndone).toHaveBeenCalledOnce();+});diff --git a/apps/web/src/features/email-compose/undo-send.ts b/apps/web/src/features/email-compose/undo-send.tsindex 648fe57f14..1118cdaa94 100644--- a/apps/web/src/features/email-compose/undo-send.ts+++ b/apps/web/src/features/email-compose/undo-send.ts@@ -4,6 +4,14 @@ import { queryClient } from '@queries/client';import { saveEmailComposeDraft } from '@queries/email/graphql/compose';import { unscheduleEmailMessage } from '@queries/email/integration';import { emailKeys } from '@queries/email/keys';+import {+ cancelEmailSendQueued,+ EmailSendCancellationTooLate,+ EmailSendDeliveryUnconfirmed,+ emailSendLocked,+ readEmailSendIntents,+ restoreCancelledEmailSend,+} from '@queries/email/send-queue';import { invalidateSoupEntity } from '@queries/soup/cache';import type { EmailDraft } from './core/email-draft';import { prepareEmailBodyFromHtml } from './primitives/prepare-email-body';@@ -41,13 +49,44 @@ async function unscheduleWithRetry(return unscheduleEmailMessage({ draftID: draftId }, linkId);}-/**- * The shared undo-send flow: claims the guard, unschedules with retry,- * surfaces failures (including the definitive "already sent" 400), and on- * success invalidates the previews then runs the surface-specific `onUndone`- * work — cache edits, snapshot restore, navigation — before announcing the- * cancellation. Callers keep only what genuinely differs per surface.- */+/** Durable undo survives navigation and restores only confirmed cancellations. */+export async function runQueuedUndoSend(options: {+ draftId: string;+ attemptId: string;+ onUndone: () => Promise<void> | void;+}): Promise<void> {+ const { draftId, attemptId } = options;+ if (!tryBeginUndoSend(draftId)) return;+ try {+ const intent = (await readEmailSendIntents()).find(+ (row) => row.uuid === attemptId+ );+ if (!intent) throw new Error('This send is no longer available to undo');+ const updated = await cancelEmailSendQueued(intent);+ if (emailSendLocked(updated)) {+ endUndoSend(draftId);+ toast.alert('Cancellation pending — waiting for confirmation');+ return;+ }+ await restoreCancelledEmailSend(updated);+ await options.onUndone();+ toast.success('Send cancelled');+ } catch (error) {+ endUndoSend(draftId);+ Telemetry.error(+ error instanceof Error ? error : new Error('Failed to undo send')+ );+ toast.failure(+ error instanceof EmailSendDeliveryUnconfirmed+ ? error.message+ : error instanceof EmailSendCancellationTooLate+ ? 'Too late to undo — delivery has already started'+ : 'Failed to undo send'+ );+ }+}++/** Unschedules legacy sends, then restores the composing surface with feedback. */export async function runUndoSend(options: {draftId: string;/** The X-Email-Link-Id header value the send itself used. */diff --git a/apps/web/src/features/email-compose/views/compose-body.tsx b/apps/web/src/features/email-compose/views/compose-body.tsxindex 7041d00177..1ed31d8861 100644--- a/apps/web/src/features/email-compose/views/compose-body.tsx+++ b/apps/web/src/features/email-compose/views/compose-body.tsx@@ -100,9 +100,10 @@ export function ComposeBody(props: {editor()?.focus();}}use:fileFolderDrop={{- onDragStart: (valid) => setIsDragging(valid),+ onDragStart: (valid) => setIsDragging(valid && !ctx.disabled()),onDragEnd: () => setIsDragging(false),onDrop: (files, dirs, event) => {+ if (ctx.disabled()) return;const ed = editor();const media =ed && event@@ -174,6 +175,7 @@ export function ComposeBody(props: {}}portalScope="local"onPasteFilesAndDirs={(files, directories) => {+ if (ctx.disabled()) return;const ed = editor();if (!ed) return;ctx.bodyActions.insertFiles(ed, {@@ -224,7 +226,7 @@ function AttachmentItem(props: {fileName: attachment().file.name,mimeType: attachment().file.type,}}- removable+ removable={!ctx.disabled()}onRemove={handleRemove}onClick={props.onOpen}/>@@ -239,7 +241,7 @@ function AttachmentItem(props: {: attachment().fileName,mimeType: attachment().contentType,}}- removable+ removable={!ctx.disabled()}onRemove={handleRemove}onClick={props.onOpen}/>@@ -258,7 +260,7 @@ function AttachmentItem(props: {fileName: attachment().fileName,mimeType: attachment().mimeType,}}- removable+ removable={!ctx.disabled()}onRemove={handleRemove}onClick={props.onOpen}/>diff --git a/apps/web/src/features/email-compose/views/compose-toolbar.tsx b/apps/web/src/features/email-compose/views/compose-toolbar.tsxindex 3a88c7e25e..d47b4e9589 100644--- a/apps/web/src/features/email-compose/views/compose-toolbar.tsx+++ b/apps/web/src/features/email-compose/views/compose-toolbar.tsx@@ -35,7 +35,7 @@ export function EmailComposeToolbar(props: {when={props.inline || !ctx.isMobile()}fallback={<MobileToolbar status={props.status} />}>- <Show when={showFormatRibbon()}>+ <Show when={showFormatRibbon() && !ctx.disabled()}><div class="flex flex-row w-full gap-2 items-center p-2 -ml-3"><FormatButtonsselectionState={() => defaultSelectionData}@@ -132,6 +132,7 @@ function MobileToolbar(props: { status?: JSX.Element }) {operation={ctx.schedule.operation()}onSelectTime={ctx.schedule.onSelect}onCancelSchedule={ctx.schedule.onCancel}+ onCheckStatus={ctx.schedule.onCheckStatus}/></HeaderIsland></Show>diff --git a/apps/web/src/features/email-compose/views/email-compose.tsx b/apps/web/src/features/email-compose/views/email-compose.tsxindex d8d963448f..f0d33488db 100644--- a/apps/web/src/features/email-compose/views/email-compose.tsx+++ b/apps/web/src/features/email-compose/views/email-compose.tsx@@ -287,6 +287,7 @@ function LoadedEmailComposeView(operation={ctxValue.schedule.operation()}onSelectTime={ctxValue.schedule.onSelect}onCancelSchedule={ctxValue.schedule.onCancel}+ onCheckStatus={ctxValue.schedule.onCheckStatus}class="-mt-6 rounded-b-[20px] border border-t-0 border-edge-muted px-4 pt-8 pb-2"/></div>diff --git a/apps/web/src/features/email-compose/views/reply-input-close.test.tsx b/apps/web/src/features/email-compose/views/reply-input-close.test.tsxindex ec954fc0b0..dac3d35e10 100644--- a/apps/web/src/features/email-compose/views/reply-input-close.test.tsx+++ b/apps/web/src/features/email-compose/views/reply-input-close.test.tsx@@ -16,7 +16,10 @@ import { createComposeContext } from '../tests/capabilities';import { createEmailEditor } from '../tests/editor';import { ReplyInputView } from './reply-input';-const fixture = vi.hoisted(() => ({ text: '' }));+const fixture = vi.hoisted(() => ({+ text: '',+ onChange: (_value: string) => {},+}));// Keep the real view, form, draft controller and deletion lifecycle. Stub only// app-owned editor plugins and presentation unrelated to closing the reply.@@ -42,7 +45,10 @@ vi.mock(withSelectionData: () => config,withFloatingFormatMenu: () => config,use: () => config,- onChange: () => config,+ onChange: (handler: (value: string) => void) => {+ fixture.onChange = handler;+ return config;+ },withFilePaste: () => config,buildHandle: () => ({ lexical: createEmailEditor(fixture.text) }),};@@ -102,9 +108,8 @@ afterEach(() => {vi.clearAllMocks();});-function mount(draftId?: string, text = '') {+function mount(draftId?: string, text = '', context = createComposeContext()) {fixture.text = text;- const context = createComposeContext();context.presentation.isTouch = () => true;context.presentation.scheduleEnabled = false;const draft = draftId@@ -170,6 +175,34 @@ it('routes the composer Escape hotkey through the mobile draft choices', () => {expect(state.onClose).not.toHaveBeenCalled();});+it('keeps the mobile reply open when saving its working copy fails', async () => {+ const context = createComposeContext();+ const failure = new Error('Local storage is unavailable');+ context.drafts.saveLocalDraft = vi.fn(async () => {+ throw failure;+ });+ const state = mount('draft', 'Keep this unsent reply', context);+ // The real editor emits its initial value before subsequent user edits.+ fixture.onChange('Original reply');+ fixture.onChange('Keep this unsent reply');++ fireEvent.click(screen.getByRole('button', { name: 'Go Back' }));+ fireEvent.click(screen.getByRole('button', { name: 'Save Draft' }));++ await waitFor(() =>+ expect(context.notices.reportError).toHaveBeenCalledWith(failure)+ );+ expect(context.drafts.saveLocalDraft).toHaveBeenCalledWith(+ expect.objectContaining({+ draft: expect.objectContaining({ db_id: 'draft' }),+ })+ );+ expect(screen.getByRole('button', { name: 'Save Draft' })).toBeTruthy();+ expect(state.onClose).not.toHaveBeenCalled();+ expect(state.setShowReply).not.toHaveBeenCalled();+ expect(context.drafts.deleteDraft).not.toHaveBeenCalled();+});+it.each([undefined, 'saved-draft'])('discards an empty reply and clears the preview (identity: %s)',async (draftId) => {diff --git a/apps/web/src/features/email-compose/views/reply-input.tsx b/apps/web/src/features/email-compose/views/reply-input.tsxindex 6e888ce5e8..5b082ec301 100644--- a/apps/web/src/features/email-compose/views/reply-input.tsx+++ b/apps/web/src/features/email-compose/views/reply-input.tsx@@ -199,6 +199,7 @@ function LoadedReplyInputView(props: ReplyInputViewProps) {scheduleActionLabel,scheduleOperation,cancelSchedule,+ checkScheduleStatus,schedulePickerDisabled,editingDisabled,sendUnavailableReason,@@ -542,6 +543,7 @@ function LoadedReplyInputView(props: ReplyInputViewProps) {operation={scheduleOperation()}onSelectTime={handleSendTimeChange}onCancelSchedule={cancelSchedule}+ onCheckStatus={checkScheduleStatus}/>}scheduleControl={@@ -845,6 +847,7 @@ function LoadedReplyInputView(props: ReplyInputViewProps) {operation={scheduleOperation()}onSelectTime={handleSendTimeChange}onCancelSchedule={cancelSchedule}+ onCheckStatus={checkScheduleStatus}class="-mx-4 -mb-4 mt-3 rounded-b-[26.25px] border-t border-edge-muted px-4 py-2 touch:rounded-b-lg mobile:rounded-none"/></Show>diff --git a/apps/web/src/features/email-message/core/email-message.ts b/apps/web/src/features/email-message/core/email-message.tsindex b37e79e5b6..7e10d63b02 100644--- a/apps/web/src/features/email-message/core/email-message.ts+++ b/apps/web/src/features/email-message/core/email-message.ts@@ -41,6 +41,7 @@ export interface EmailLabel {}export interface EmailMessage {+ draft_generation?: number;operation?: MessageOperation | null;calendar_invitations?: CalendarInvitation[];attachments: EmailAttachment[];@@ -63,6 +64,12 @@ export interface EmailMessage {provider_id?: string | null;replying_to_id?: string | null;scheduled_send_time?: string | null;+ scheduled_send_status?:+ | 'pending'+ | 'sending'+ | 'failed'+ | 'unconfirmed'+ | null;sent_at?: string | null;snippet?: string | null;subject?: string | null;diff --git a/apps/web/src/features/email-thread/primitives/email-thread-state.test.ts b/apps/web/src/features/email-thread/primitives/email-thread-state.test.tsindex 2fe6bc656d..838ffb5e07 100644--- a/apps/web/src/features/email-thread/primitives/email-thread-state.test.ts+++ b/apps/web/src/features/email-thread/primitives/email-thread-state.test.ts@@ -6,6 +6,49 @@ import { createThreadContext, message, thread } from '../tests/fixtures';import { createEmailThreadState } from './email-thread-state';describe('thread state with an injected source', () => {+ it('adopts a canonical reply identity over a restored local handle despite client clock skew', () =>+ createRoot((dispose) => {+ try {+ const local = message('local-draft', {+ is_draft: true,+ replying_to_id: 'parent',+ updated_at: '2026-09-01T12:00:00Z',+ });+ const [snapshot, setSnapshot] = createSignal(+ thread([message('parent'), local])+ );+ const state = createEmailThreadState(+ createThreadContext({ thread: snapshot })+ );+ state.drafts.deleteDraftForMessage('parent');+ const restored = {+ ...local,+ body_text: 'Restored reply',+ updated_at: '2026-09-01T13:00:00Z',+ };+ state.drafts.restoreDraftForMessage(restored);+ expect(state.drafts.getDraftForMessage('parent')).toEqual(restored);+ const canonical = {+ ...restored,+ db_id: 'server-draft',+ updated_at: '2026-09-01T10:00:00Z',+ };+ setSnapshot(thread([message('parent'), canonical]));+ expect(state.drafts.getDraftForMessage('parent')).toEqual(canonical);+ const edited = {+ ...canonical,+ body_text: 'New canonical edits',+ updated_at: '2026-09-01T11:00:00Z',+ };+ setSnapshot(thread([message('parent'), edited]));+ expect(state.drafts.getDraftForMessage('parent')).toEqual(edited);+ state.drafts.deleteDraftForMessage('parent');+ expect(state.drafts.getDraftForMessage('parent')).toBeUndefined();+ } finally {+ dispose();+ }+ }));+function advancingState(markDone: (archive: (options?: ArchiveThreadOptions) => boolean,@@ -128,6 +171,79 @@ describe('thread state with an injected source', () => {}}));+ it('keeps a newly restored canonical reply ahead of the unchanged local source handle', () =>+ createRoot((dispose) => {+ try {+ const local = message('local-draft', {+ is_draft: true,+ replying_to_id: 'parent',+ updated_at: '2026-09-01T12:00:00Z',+ });+ const [snapshot, setSnapshot] = createSignal(+ thread([message('parent'), local])+ );+ const state = createEmailThreadState(+ createThreadContext({ thread: snapshot })+ );+ const restored = {+ ...local,+ db_id: 'server-draft',+ body_text: 'Restored canonical reply',+ updated_at: '2026-09-01T10:00:00Z',+ };+ state.drafts.restoreDraftForMessage(restored);+ expect(state.drafts.getDraftForMessage('parent')).toEqual(restored);+ setSnapshot(thread([message('parent'), { ...local }]));+ expect(state.drafts.getDraftForMessage('parent')).toEqual(restored);+ const canonical = {+ ...restored,+ body_text: 'Canonical source caught up',+ updated_at: '2026-09-01T11:00:00Z',+ };+ setSnapshot(thread([message('parent'), canonical]));+ expect(state.drafts.getDraftForMessage('parent')).toEqual(canonical);+ } finally {+ dispose();+ }+ }));++ it('explicit restoration reopens a sent reply tombstone without resurrecting stale content', () =>+ createRoot((dispose) => {+ try {+ const sent = message('draft', {+ is_draft: true,+ replying_to_id: 'parent',+ updated_at: '2026-09-01T10:00:00Z',+ });+ const [snapshot, setSnapshot] = createSignal(+ thread([message('parent'), sent])+ );+ const state = createEmailThreadState(+ createThreadContext({ thread: snapshot })+ );+ state.drafts.deleteDraftForMessage('parent');+ const restored = {+ ...sent,+ body_text: 'Original restored body',+ updated_at: '2026-09-01T11:00:00Z',+ };+ state.drafts.restoreDraftForMessage(restored);+ expect(state.drafts.getDraftForMessage('parent')).toEqual(restored);+ setSnapshot(thread([message('parent'), sent]));+ expect(state.drafts.getDraftForMessage('parent')).toEqual(restored);+ const edited = {+ ...restored,+ body_text: 'New edits',+ updated_at: '2026-09-01T12:00:00Z',+ };+ setSnapshot(thread([message('parent'), edited]));+ expect(state.drafts.getDraftForMessage('parent')).toEqual(edited);+ state.drafts.deleteDraftForMessage('parent');+ expect(state.drafts.getDraftForMessage('parent')).toBeUndefined();+ } finally {+ dispose();+ }+ }));it('retains newer drafts through stale snapshots and does not resurrect discarded replies', () =>createRoot((dispose) => {try {diff --git a/apps/web/src/features/email-thread/primitives/email-thread-state.ts b/apps/web/src/features/email-thread/primitives/email-thread-state.tsindex 35bce79393..2de277ca8c 100644--- a/apps/web/src/features/email-thread/primitives/email-thread-state.ts+++ b/apps/web/src/features/email-thread/primitives/email-thread-state.ts@@ -38,6 +38,7 @@ export type EmailThreadState = {drafts: {getDraftForMessage: (messageDbId: string) => EmailMessage | undefined;deleteDraftForMessage: (messageDbId: string) => void;+ restoreDraftForMessage: (draft: EmailMessage) => void;initialDraftsSettled: Accessor<boolean>;};diff --git a/apps/web/src/features/email-thread/primitives/optimistic-send.test.ts b/apps/web/src/features/email-thread/primitives/optimistic-send.test.tsindex bace113cfd..fb4eea5fef 100644--- a/apps/web/src/features/email-thread/primitives/optimistic-send.test.ts+++ b/apps/web/src/features/email-thread/primitives/optimistic-send.test.ts@@ -19,13 +19,13 @@ const input: SendEmailDraft = {to: [{ email: '[email protected]' }],},};-const identity: PersistedEmailIdentity = {+const identity = {draftId: 'draft',threadId: 'thread',inboxId: 'inbox',-};+} satisfies PersistedEmailIdentity;-function setup() {+function setup(queueActive = false) {return createRoot((dispose) => {const draft = message('draft', {is_draft: true,@@ -46,6 +46,7 @@ function setup() {thread([message('received'), draft]));const compose = createComposeContext();+ compose.delivery.queueActive = () => queueActive;const request = Promise.withResolvers<PersistedEmailIdentity>();vi.mocked(compose.delivery.sendMessage).mockReturnValue(request.promise);const optimistic = createOptimisticThreadSend(@@ -56,6 +57,62 @@ function setup() {});}+it('leaves durable queued sends in the draft projection until the authoritative source changes', async () => {+ const state = setup(true);+ try {+ const send = state.delivery.sendMessage(input);+ expect(state.compose.delivery.sendMessage).toHaveBeenCalledWith(input);+ expect(state.source.thread()).toBe(state.snapshot());+ expect(state.source.thread()?.messages[1]).toMatchObject({+ is_draft: true,+ body_text: 'Older body',+ labels: [{ provider_label_id: 'DRAFT' }],+ });+ const queued = {+ ...identity,+ sendAttemptId: 'send-attempt',+ persistence: 'queued' as const,+ };+ state.request.resolve(queued);+ await expect(send).resolves.toEqual(queued);+ expect(state.source.thread()).toBe(state.snapshot());+ state.setSnapshot(thread([message('received')]));+ expect(state.source.thread()?.messages.map((value) => value.db_id)).toEqual(+ ['received']+ );+ } finally {+ state.dispose();+ }+});++it.each([true, false])(+ 'propagates Undo restoration ownership (draftRestored=%s)',+ async (draftRestored) => {+ const state = setup(true);+ try {+ const result = { draftRestored };+ vi.mocked(state.compose.delivery.undoSend).mockImplementation(+ async ({ onUndone }) => {+ await onUndone(result);+ }+ );+ const onUndone = vi.fn();+ await state.delivery.undoSend({+ ...identity,+ sendAttemptId: 'send-attempt',+ onUndone,+ });+ expect(onUndone).toHaveBeenCalledExactlyOnceWith(result);+ expect(state.compose.delivery.undoSend).toHaveBeenCalledWith(+ expect.objectContaining({ sendAttemptId: 'send-attempt' })+ );+ expect(state.source.thread()).toBe(state.snapshot());+ } finally {+ state.dispose();+ }+ }+);+it.each(['reply', 'standalone'] as const)('shows a %s before send settles and retains it until the thread refreshes',async (kind) => {@@ -219,3 +276,24 @@ it('keeps optimistic sends scoped to their thread when the source navigates', asstate.dispose();}});++it.each([+ ['gmail', true],+ ['outlook', false],+] as const)(+ 'uses the selected %s inbox to decide optimistic send ownership',+ async (inboxId, queued) => {+ const state = setup();+ try {+ const queueActive = vi.fn((selected?: string) => selected === 'gmail');+ state.compose.delivery.queueActive = queueActive;+ const send = state.delivery.sendMessage({ ...input, inboxId });+ expect(queueActive).toHaveBeenCalledWith(inboxId);+ expect(state.source.thread()?.messages[1].is_draft).toBe(queued);+ state.request.resolve({ ...identity, inboxId });+ await send;+ } finally {+ state.dispose();+ }+ }+);diff --git a/apps/web/src/features/email-thread/primitives/optimistic-send.ts b/apps/web/src/features/email-thread/primitives/optimistic-send.tsindex 856f7ad93f..a4b341a157 100644--- a/apps/web/src/features/email-thread/primitives/optimistic-send.ts+++ b/apps/web/src/features/email-thread/primitives/optimistic-send.ts@@ -125,6 +125,8 @@ export function createOptimisticThreadSend(const delivery: EmailComposeContext['delivery'] = {...compose.delivery,async sendMessage(input) {+ if (compose.delivery.queueActive?.(input.inboxId))+ return await compose.delivery.sendMessage(input);const entry = prepare(input);if (!entry) return await compose.delivery.sendMessage(input);const acknowledged = confirmed();@@ -159,7 +161,7 @@ export function createOptimisticThreadSend(async undoSend(input) {await compose.delivery.undoSend({...input,- onUndone: async () => {+ onUndone: async (result) => {setPending((entries) =>entries.filter((entry) =>@@ -167,7 +169,7 @@ export function createOptimisticThreadSend(entry.message.db_id !== input.draftId));- await input.onUndone();+ await input.onUndone(result);},});},diff --git a/apps/web/src/features/email-thread/primitives/thread-drafts.ts b/apps/web/src/features/email-thread/primitives/thread-drafts.tsindex d760014cc8..9f90dbd72c 100644--- a/apps/web/src/features/email-thread/primitives/thread-drafts.ts+++ b/apps/web/src/features/email-thread/primitives/thread-drafts.ts@@ -48,21 +48,54 @@ export function createThreadDrafts(// a fetch that still contains the deleted draft (delete propagation lag)// can't resurrect it.const [deletedDraftIds, setDeletedDraftIds] = createStore<- Record<string, true>+ Record<string, true | undefined>+ >({});+ const [restoredDrafts, setRestoredDrafts] = createStore<+ Record<+ string,+ { draft: EmailMessage; sourceDraftId: string | undefined } | undefined+ >>({});const deleteDraftForMessage = (messageId: string) => {setDeletedDraftIds(messageId, true);+ setRestoredDrafts(messageId, undefined);+ };++ const restoreDraftForMessage = (draft: EmailMessage) => {+ if (!draft.replying_to_id || draft.thread_db_id !== source()?.db_id) return;+ setRestoredDrafts(draft.replying_to_id, {+ draft,+ sourceDraftId: serverDrafts()?.map[draft.replying_to_id]?.db_id,+ });+ setDeletedDraftIds(draft.replying_to_id, undefined);};const getDraftForMessage = (messageId: string) => {if (deletedDraftIds[messageId]) return undefined;- return serverDrafts()?.map[messageId];+ const current = serverDrafts()?.map[messageId];+ const restoration = restoredDrafts[messageId];+ if (!restoration || restoration.draft.thread_db_id !== source()?.db_id)+ return current;+ const restored = restoration.draft;+ // Keep the pre-restoration source behind the explicit snapshot, but adopt a+ // subsequent canonical identity even when the client's clock is ahead.+ return current &&+ (current.db_id !== restoration.sourceDraftId ||+ (current.db_id === restored.db_id &&+ new Date(current.updated_at) >= new Date(restored.updated_at)))+ ? current+ : restored;};// Drafts derive straight from the query, so "settled" is simply "we have a// thread snapshot" — cached or fresh, revalidating or not.const initialDraftsSettled = () => serverDrafts() !== undefined;- return { getDraftForMessage, deleteDraftForMessage, initialDraftsSettled };+ return {+ getDraftForMessage,+ deleteDraftForMessage,+ restoreDraftForMessage,+ initialDraftsSettled,+ };}diff --git a/apps/web/src/features/email-thread/queries/thread-source.test.ts b/apps/web/src/features/email-thread/queries/thread-source.test.tsindex 5c90f42f4c..58413a14a8 100644--- a/apps/web/src/features/email-thread/queries/thread-source.test.ts+++ b/apps/web/src/features/email-thread/queries/thread-source.test.ts@@ -19,6 +19,7 @@ function message(id: string, overrides: Partial<ApiMessage> = {}): ApiMessage {to: [{ email: '[email protected]' }],cc: [],bcc: [],+ draft_generation: 0,attachments: [],attachments_draft: [],attachments_forwarded: [],@@ -292,12 +293,14 @@ it('keeps rendering and attachment identities while excluding transport metadata],provider_id: 'reply-provider-id',scheduled_send_time: '2026-10-01T12:00:00Z',+ scheduled_send_status: 'unconfirmed',}),]);const projected = toEmailThread(wire).messages[0];expect(projected).toMatchObject({provider_id: 'reply-provider-id',scheduled_send_time: '2026-10-01T12:00:00Z',+ scheduled_send_status: 'unconfirmed',labels: [{ name: 'CATEGORY_PERSONAL', provider_label_id: 'UNREAD' }],attachments: [{ db_id: 'inline', content_id: 'image-cid', sfs_id: 'file' }],attachments_draft: [{ id: 'draft-file', s3_key: 'notes' }],diff --git a/apps/web/src/features/email-thread/queries/thread-source.ts b/apps/web/src/features/email-thread/queries/thread-source.tsindex 4e8e386176..e253a92a76 100644--- a/apps/web/src/features/email-thread/queries/thread-source.ts+++ b/apps/web/src/features/email-thread/queries/thread-source.ts@@ -88,6 +88,7 @@ export function toEmailThread(thread: ApiThread): EmailThread {provider_id: message.provider_id,replying_to_id: message.replying_to_id,scheduled_send_time: message.scheduled_send_time,+ scheduled_send_status: message.scheduled_send_status,sent_at: message.sent_at,snippet: message.snippet,subject: message.subject,diff --git a/apps/web/src/features/email-thread/views/email-thread.tsx b/apps/web/src/features/email-thread/views/email-thread.tsxindex 6d46c99af5..ba159aa0cb 100644--- a/apps/web/src/features/email-thread/views/email-thread.tsx+++ b/apps/web/src/features/email-thread/views/email-thread.tsx@@ -1,4 +1,5 @@import { EmailFormContextProvider } from '@app/features/email-compose/context/email-form-context';+import { observeDraftRestoration } from '@app/features/email-compose/primitives/draft-restoration';import { EmailComposeView } from '@app/features/email-compose/views/email-compose';import { CustomScrollbar } from '@core/component/CustomScrollbar';import type { JSX } from 'solid-js';@@ -23,6 +24,22 @@ export function EmailThreadView(props: EmailThreadViewProps) {const viewContext = useEmailThreadViewContext();const threadContext = viewContext.thread;const isTouchDevice = threadContext.isTouch;+ observeDraftRestoration({+ storage: viewContext.compose.drafts,+ accepts: (change) =>+ change.threadId === props.threadId() && !!change.replyingToId,+ version: props.threadId,+ cancelPendingSave() {},+ setPending() {},+ restore: (draft) => {+ context.drafts.restoreDraftForMessage(draft);+ if (!draft.replying_to_id) return;+ if (isTouchDevice())+ context.mobileReplyComposer.openForMessage(draft.replying_to_id);+ else context.messages.setReplyingToMessageId(draft.replying_to_id);+ },+ reportError: viewContext.compose.notices.reportError,+ });const navigation = createThreadNavigation(props,context,diff --git a/apps/web/src/features/email-view/components/EmailList.tsx b/apps/web/src/features/email-view/components/EmailList.tsxindex f739245f42..b1297192c1 100644--- a/apps/web/src/features/email-view/components/EmailList.tsx+++ b/apps/web/src/features/email-view/components/EmailList.tsx@@ -1,3 +1,4 @@+import { QueuedSendStatus } from '../../email-compose/queued-send-status';import '@entity/composed/ListEntity.css';import { type ListActivation, useListInteractions } from '@app/components/list';import { CommandState } from '@app/features/command/state';@@ -506,6 +507,9 @@ export function EmailList(props: EmailListProps) {tabIndex={0}class="soup-list relative flex size-full min-h-0 min-w-0 flex-col overflow-hidden outline-none [--color-list-highlighted:var(--color-active)]">+ <Show when={state.tab === 'drafts'}>+ <QueuedSendStatus inboxIds={state.inboxIds} />+ </Show><PullToRefreshscrollContainer={pullScrollContainer}onRefresh={pullRefresh}diff --git a/apps/web/src/lib/core/auth/logout.test.ts b/apps/web/src/lib/core/auth/logout.test.tsindex d915843ed5..486efcd083 100644--- a/apps/web/src/lib/core/auth/logout.test.ts+++ b/apps/web/src/lib/core/auth/logout.test.ts@@ -29,6 +29,13 @@ vi.mock('@queries/email/local-drafts', () => ({flushLocalDrafts: vi.fn(async () => {}),listLocalDrafts: vi.fn(async () => []),}));+vi.mock('@queries/email/send-queue', () => ({+ readEmailSendIntents: vi.fn(async () => []),+ settledSendAttempt: () => ({ status: 'ACCEPTED' }),+}));+vi.mock('@queries/email/outbox-session', () => ({+ setEmailOutboxSession: vi.fn(),+}));vi.mock('@core/constant/servers', () => ({SERVER_HOSTS: { 'auth-logout': 'https://auth.example.com/oauth2/logout' },}));@@ -65,6 +72,7 @@ import {flushLocalDrafts,listLocalDrafts,} from '@queries/email/local-drafts';+import { readEmailSendIntents } from '@queries/email/send-queue';import { authServiceClient } from '@service-auth/client';import { setGraphqlSoupSessionActive } from '@service-storage/graphql-soup';import { confirmDialog } from '@ui';@@ -217,6 +225,28 @@ describe('local draft logout warning', () => {}});+ it('warns about queued sends after their working copies have been retired', async () => {+ vi.mocked(readEmailSendIntents).mockResolvedValueOnce([+ { uuid: 'send' },+ ] as Awaited<ReturnType<typeof readEmailSendIntents>>);+ const { logout, dispose } = createRoot((dispose) => ({+ logout: useLogout(),+ dispose,+ }));+ try {+ await logout();+ expect(confirmDialog).toHaveBeenLastCalledWith(+ expect.objectContaining({+ body: expect.stringContaining('signing out does not cancel them'),+ }),+ expect.anything()+ );+ expect(authServiceClient.logout).not.toHaveBeenCalled();+ } finally {+ dispose();+ }+ });+it('offers a warning and cancellation when local storage cannot be checked', async () => {vi.mocked(flushLocalDrafts).mockRejectedValueOnce(new Error('Disk unavailable')diff --git a/apps/web/src/lib/core/auth/logout.ts b/apps/web/src/lib/core/auth/logout.tsindex b53f544c52..27eacb444d 100644--- a/apps/web/src/lib/core/auth/logout.ts+++ b/apps/web/src/lib/core/auth/logout.ts@@ -17,6 +17,11 @@ import {flushLocalDrafts,listLocalDrafts,} from '@queries/email/local-drafts';+import { setEmailOutboxSession } from '@queries/email/outbox-session';+import {+ readEmailSendIntents,+ settledSendAttempt,+} from '@queries/email/send-queue';import { resetGraphqlSoupDoneSession } from '@queries/soup/graphql/done-session';import { clearDocumentQueryCache } from '@queries/storage/document-cache';import { clearOfflineDocumentContexts } from '@queries/storage/documentLoad/offline-context-runtime';@@ -52,6 +57,7 @@ export async function clearLocalAuthSession() {clearPipedreamCallbacks();document.cookie ='login=false; expires=Thu, 01 Jan 1970 00:00:00 UTC; max-age=0; path=/; SameSite=Lax';+ setEmailOutboxSession(undefined);syncLoginStorage(false);const documentContextsCleared = clearOfflineDocumentContexts();clearDocumentQueryCache(queryClient);@@ -85,9 +91,13 @@ export function useLogout() {try {const inspectDrafts = async () => {await flushLocalDrafts();- return await listLocalDrafts();+ const [drafts, sends] = await Promise.all([+ listLocalDrafts(),+ readEmailSendIntents(),+ ]);+ return { drafts, sends };};- const drafts = await Promise.race([+ const { drafts, sends } = await Promise.race([inspectDrafts(),new Promise<never>((_, reject) => {timer = setTimeout(@@ -99,9 +109,16 @@ export function useLogout() {const unsynced = drafts.filter((draft) => draft.status !== 'synced');if (unsynced.length)warning = `${unsynced.length} draft(s) have changes saved only on this device. Signing out removes those changes and their pending attachments.`;+ if (sends.some((send) => settledSendAttempt(send)?.status !== 'SENT'))+ warning = [+ warning,+ 'Pending sends remain saved for this account and resume when you sign in again. Sends already accepted by the server may still be delivered; signing out does not cancel them.',+ ]+ .filter(Boolean)+ .join(' ');} catch {warning =- 'Draft storage could not be checked. Signing out removes drafts and attachments saved only on this device, including any changes that have not synced.';+ 'Draft storage could not be checked. Signing out removes unsubmitted drafts and their pending attachments. Approved sends stay saved for this account; sends already accepted by the server may still be delivered.';} finally {clearTimeout(timer);}diff --git a/apps/web/src/lib/core/component/AI/component/tool/email/DraftComposer.tsx b/apps/web/src/lib/core/component/AI/component/tool/email/DraftComposer.tsxindex b0d2946e4b..12012c60b1 100644--- a/apps/web/src/lib/core/component/AI/component/tool/email/DraftComposer.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/email/DraftComposer.tsx@@ -265,6 +265,8 @@ export function EmailDraftComposer(props: EmailDraftComposerProps) {const dialogOwner = getOwner();const attachmentLinks = createAttachmentLinkOffer({editor,+ canEdit: () => !isSending() && !uiDisabled() && !finalized,+ version: () => `${sendingLink()?.id ?? ''}:${fromAddress() ?? ''}`,notices: {confirm: (input) => confirmDialog(input, { owner: dialogOwner }),},diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsxindex 3fa585508d..c04a33ef9b 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MarkdownImage.tsx@@ -4,7 +4,6 @@ false && internalDrag;import { Lightbox } from '@core/component/Lightbox';import { toast } from '@core/component/Toast/Toast';-import { debouncedDependent } from '@core/util/debounce';import { fireAndForget } from '@core/util/fireAndForget';import { Dialog } from '@kobalte/core/dialog';import { mergeRegister } from '@lexical/utils';@@ -249,17 +248,26 @@ export function MarkdownImage(props: ImageDecoratorProps) {cleanupListners();});- const debouncedScale = debouncedDependent(scale, 60);- createEffect(- on(debouncedScale, (value) => {- editor()?.update(() => {+ const persistScale = debounce((value: number) => {+ const currentEditor = editor();+ if (!interactable() || !currentEditor?.isEditable()) return;+ currentEditor.update(() => {+ if (!currentEditor.isEditable()) return;+ const node = $getNodeByKey(props.key);+ if (node && $isImageNode(node)) node.setScale(value, false);+ });+ }, 60);+ createEffect(on(scale, persistScale));+ createEffect(() => {+ if (!interactable()) {+ persistScale.clear();+ const committedScale = editor()?.read(() => {const node = $getNodeByKey(props.key);- if (node && $isImageNode(node)) {- node.setScale(value, false);- }+ return node && $isImageNode(node) ? node.getScale() : props.scale;});- })- );+ setScale(committedScale ?? props.scale);+ }+ });const debouncedSetHover = debounce((state: boolean) => {setImageHover(state);@@ -301,17 +309,21 @@ export function MarkdownImage(props: ImageDecoratorProps) {setImageHover(false);}}>- <Show when={state() === 'ok' && editor()?.isEditable()}>+ <Show when={state() === 'ok' && interactable()}><ResizeHandlescale={scale}- setScale={setScale}+ setScale={(value) => {+ if (interactable() && editor()?.isEditable()) setScale(value);+ }}side="left"imageDims={effectiveDims}containerRef={containerRef}/><ResizeHandlescale={scale}- setScale={setScale}+ setScale={(value) => {+ if (interactable() && editor()?.isEditable()) setScale(value);+ }}side="right"imageDims={effectiveDims}containerRef={containerRef}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsxindex 529a53abc6..936d7ba24a 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MarkdownVideo.tsx@@ -1,5 +1,4 @@import { toast } from '@core/component/Toast/Toast';-import { debouncedDependent } from '@core/util/debounce';import { fireAndForget } from '@core/util/fireAndForget';import { Dialog } from '@kobalte/core/dialog';import { mergeRegister } from '@lexical/utils';@@ -235,17 +234,26 @@ export function MarkdownVideo(props: VideoDecoratorProps) {cleanupListners();});- const debouncedScale = debouncedDependent(scale, 60);- createEffect(- on(debouncedScale, (value) => {- editor()?.update(() => {+ const persistScale = debounce((value: number) => {+ const currentEditor = editor();+ if (!interactable() || !currentEditor?.isEditable()) return;+ currentEditor.update(() => {+ if (!currentEditor.isEditable()) return;+ const node = $getNodeByKey(props.key);+ if (node && $isVideoNode(node)) node.setScale(value, false);+ });+ }, 60);+ createEffect(on(scale, persistScale));+ createEffect(() => {+ if (!interactable()) {+ persistScale.clear();+ const committedScale = editor()?.read(() => {const node = $getNodeByKey(props.key);- if (node && $isVideoNode(node)) {- node.setScale(value, false);- }+ return node && $isVideoNode(node) ? node.getScale() : props.scale;});- })- );+ setScale(committedScale ?? props.scale);+ }+ });const debouncedSetHover = debounce((state: boolean) => {setVideoHover(state);@@ -286,17 +294,21 @@ export function MarkdownVideo(props: VideoDecoratorProps) {setVideoHover(false);}}>- <Show when={state() === 'ok' && editor()?.isEditable()}>+ <Show when={state() === 'ok' && interactable()}><ResizeHandlescale={scale}- setScale={setScale}+ setScale={(value) => {+ if (interactable() && editor()?.isEditable()) setScale(value);+ }}side="left"imageDims={videoDims}containerRef={containerRef}/><ResizeHandlescale={scale}- setScale={setScale}+ setScale={(value) => {+ if (interactable() && editor()?.isEditable()) setScale(value);+ }}side="right"imageDims={videoDims}containerRef={containerRef}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MediaReadonly.test.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MediaReadonly.test.tsxnew file mode 100644index 0000000000..0f1649da2e--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/MediaReadonly.test.tsx@@ -0,0 +1,154 @@+/** @vitest-environment jsdom */++import {+ $createImageNode,+ $createVideoNode,+ $isImageNode,+ $isVideoNode,+} from '@macro-inc/lexical-core';+import { fireEvent, render } from '@solidjs/testing-library';+import { $getNodeByKey, $getRoot } from 'lexical';+import { createSignal } from 'solid-js';+import { expect, it, vi } from 'vitest';++const plugin = vi.hoisted(() => ({+ getMediaUrl: vi.fn(),+ $upgradeDSSMediaUrl: vi.fn(),+ ON_MEDIA_COMPONENT_MOUNT_COMMAND: 'ON_MEDIA_COMPONENT_MOUNT_COMMAND',+ UPDATE_MEDIA_SIZE_COMMAND: 'UPDATE_MEDIA_SIZE_COMMAND',+ UPLOAD_MEDIA_FAILURE_COMMAND: 'UPLOAD_MEDIA_FAILURE_COMMAND',+ UPLOAD_MEDIA_START_COMMAND: 'UPLOAD_MEDIA_START_COMMAND',+ UPLOAD_MEDIA_SUCCESS_COMMAND: 'UPLOAD_MEDIA_SUCCESS_COMMAND',+}));+vi.mock('../../plugins/media', () => plugin);+vi.mock('../../plugins', () => plugin);+vi.mock('@core/component/Lightbox', () => ({ Lightbox: () => null }));+vi.mock('@core/component/Toast/Toast', () => ({ toast: { failure: vi.fn() } }));++import { createEmailEditor } from '@app/features/email-compose/tests/editor';+import { LexicalWrapperContext } from '../../context/LexicalWrapperContext';+import { createPluginManager } from '../../plugins/pluginManager';+import { MarkdownImage } from './MarkdownImage';+import { MarkdownVideo } from './MarkdownVideo';++it.each(['image', 'video'] as const)(+ 'stops active and debounced %s resizing on lock while preserving committed size',+ async (kind) => {+ vi.useFakeTimers();+ const [editable, setEditable] = createSignal(true);+ const editor = createEmailEditor();+ let key = '';+ const url = 'https://files.macro.com/audit';+ editor.update(+ () => {+ const node = (kind === 'image' ? $createImageNode : $createVideoNode)({+ srcType: 'url',+ url,+ width: 200,+ height: 100,+ scale: 1,+ });+ $getRoot().append(node);+ key = node.getKey();+ },+ { discrete: true }+ );+ const value = {+ type: 'markdown' as const,+ owner: null,+ editor,+ isInteractable: editable,+ plugins: createPluginManager(editor, 'markdown'),+ cleanup: () => {},+ };+ const view = render(() => (+ <LexicalWrapperContext.Provider value={value}>+ {kind === 'image' ? (+ <MarkdownImage+ srcType="url"+ id="image"+ key={key}+ url={url}+ alt="audit"+ width={200}+ height={100}+ scale={1}+ />+ ) : (+ <MarkdownVideo+ controls={true}+ srcType="url"+ id="video"+ key={key}+ url={url}+ width={200}+ height={100}+ scale={1}+ />+ )}+ </LexicalWrapperContext.Provider>+ ));+ try {+ const media = view.container.querySelector(+ kind === 'image' ? 'img' : 'video'+ )!;+ Object.defineProperties(+ media,+ kind === 'image'+ ? { naturalWidth: { value: 200 }, naturalHeight: { value: 100 } }+ : { videoWidth: { value: 200 }, videoHeight: { value: 100 } }+ );+ fireEvent(media, new Event(kind === 'image' ? 'load' : 'loadeddata'));+ const handles = [+ ...view.container.querySelectorAll<HTMLDivElement>(+ '.cursor-col-resize'+ ),+ ];+ expect(handles).toHaveLength(2);+ const handle = handles[1];+ handle.setPointerCapture = () => {};+ handle.releasePointerCapture = () => {};+ const frame = handle.parentElement!;+ frame.getBoundingClientRect = () => ({ ...new DOMRect(), height: 100 });+ handle.dispatchEvent(+ new MouseEvent('pointerdown', { bubbles: true, clientX: 50 })+ );+ handle.dispatchEvent(+ new MouseEvent('pointermove', { bubbles: true, clientX: 100 })+ );+ await vi.advanceTimersByTimeAsync(100);+ const scale = () =>+ editor.read(() => {+ const node = $getNodeByKey(key);+ return node && ($isImageNode(node) || $isVideoNode(node))+ ? node.getScale()+ : undefined;+ });+ expect(scale()).toBe(1.5);+ // The next movement has not reached the node when the editor locks.+ handle.dispatchEvent(+ new MouseEvent('pointermove', { bubbles: true, clientX: 150 })+ );+ editor.setEditable(false);+ setEditable(false);+ expect(+ view.container.querySelectorAll('.cursor-col-resize')+ ).toHaveLength(0);+ handle.dispatchEvent(+ new MouseEvent('pointermove', { bubbles: true, clientX: 200 })+ );+ await vi.advanceTimersByTimeAsync(100);+ expect(scale()).toBe(1.5);+ expect(+ kind === 'image' ? frame.style.maxWidth : frame.style.maxHeight+ ).toBe(kind === 'image' ? '300px' : '150px');+ editor.setEditable(true);+ setEditable(true);+ await vi.advanceTimersByTimeAsync(100);+ expect(scale()).toBe(1.5);+ } finally {+ view.unmount();+ vi.useRealTimers();+ }+ }+);diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingGifMenu.test.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingGifMenu.test.tsxnew file mode 100644index 0000000000..862cb4a78b--- /dev/null+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingGifMenu.test.tsx@@ -0,0 +1,113 @@+/** @vitest-environment jsdom */+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import { $createParagraphNode, $getRoot } from 'lexical';+import { createSignal, onCleanup } from 'solid-js';+import { afterEach, expect, it, vi } from 'vitest';+import {+ createLexicalWrapper,+ LexicalWrapperContext,+} from '../../context/LexicalWrapperContext';+import { TRY_INSERT_GIF_COMMAND } from '../../plugins/gif';+import { FloatingGifMenu } from './FloatingGifMenu';++const insertGif = vi.hoisted(() => vi.fn());+vi.mock('../../plugins/gif', async (original) => ({+ ...(await original<typeof import('../../plugins/gif')>()),+ $insertGifNode: insertGif,+ searchGifs: async () => [+ {+ id: 'audit-gif',+ title: 'Audit GIF',+ previewUrl: 'https://example.com/preview.gif',+ url: 'https://example.com/audit.gif',+ width: 100,+ height: 100,+ },+ ],+}));+vi.mock('../../directive/floatWithSelection', () => ({+ floatWithSelection: vi.fn(),+}));+vi.mock('@service-connection/websocket', () => ({+ ws: { send() {}, addEventListener() {}, removeEventListener() {} },+ state: () => 'closed',+ createConnectionBlockWebsocketEffect() {},+ createConnectionWebsocketEffect() {},+ parseWebsocketPayload: () => undefined,+}));+vi.mock('@service-storage/websocket', () => ({+ storageWS: { send() {}, addEventListener() {}, removeEventListener() {} },+ createWebSocketJob() {},+}));++afterEach(() => {+ cleanup();+ insertGif.mockClear();+ vi.useRealTimers();+});++function mountPicker() {+ const [canEdit, setCanEdit] = createSignal(true);+ let wrapper: ReturnType<typeof createLexicalWrapper>;+ render(() => {+ wrapper = createLexicalWrapper({+ type: 'markdown',+ namespace: 'gif-lock-test',+ isInteractable: canEdit,+ });+ onCleanup(wrapper.cleanup);+ return (+ <LexicalWrapperContext.Provider value={wrapper}>+ <FloatingGifMenu canEdit={canEdit} />+ </LexicalWrapperContext.Provider>+ );+ });+ const editor = wrapper!.editor;+ const open = () => {+ editor.update(+ () => {+ $getRoot().append($createParagraphNode());+ $getRoot().selectEnd();+ editor.dispatchCommand(TRY_INSERT_GIF_COMMAND, undefined);+ },+ { discrete: true }+ );+ };+ return { editor, open, setCanEdit };+}++it('inserts a selected GIF while editing remains allowed', async () => {+ const { open } = mountPicker();+ open();+ fireEvent.click(await screen.findByRole('button', { name: 'Audit GIF' }));+ expect(insertGif).toHaveBeenCalledOnce();+ expect(screen.queryByRole('searchbox')).toBeNull();+});++it('rejects a GIF selection after the editor becomes readonly', async () => {+ const { editor, open } = mountPicker();+ open();+ const gif = await screen.findByRole('button', { name: 'Audit GIF' });+ editor.setEditable(false);+ fireEvent.click(gif);+ expect(insertGif).not.toHaveBeenCalled();+ expect(screen.queryByRole('searchbox')).toBeNull();+});++it('closes an open picker when send locking removes edit permission', async () => {+ const { open, setCanEdit } = mountPicker();+ open();+ await screen.findByRole('button', { name: 'Audit GIF' });+ setCanEdit(false);+ expect(screen.queryByRole('searchbox')).toBeNull();+ expect(insertGif).not.toHaveBeenCalled();+});++it('does not open a deferred picker after send locking', () => {+ vi.useFakeTimers();+ const { open, setCanEdit } = mountPicker();+ open();+ setCanEdit(false);+ vi.runOnlyPendingTimers();+ expect(screen.queryByRole('searchbox')).toBeNull();+});diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingGifMenu.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingGifMenu.tsxindex 3f4840754e..6e41a8cfc5 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingGifMenu.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingGifMenu.tsx@@ -94,6 +94,7 @@ export function FloatingGifMenu(};const handleOpenPicker = createCallback(() => {+ if (!canEdit() || !editor()?.isEditable()) return;if (menuOpen()) {resetMenu();return;@@ -101,20 +102,31 @@ export function FloatingGifMenu(insertAt = $getSelection()?.clone() ?? null;// Defer past the keystroke that ran the command, as FloatingTableMenu does.setTimeout(() => {+ if (!canEdit() || !editor()?.isEditable()) return;setMenuOpen(true);inputRef?.focus();}, 0);});const insertGif = (gif: Gif) => {+ const currentEditor = editor();+ if (!canEdit() || !currentEditor?.isEditable()) {+ resetMenu();+ return;+ }const selection = insertAt;- editor()?.update(() => {+ currentEditor.update(() => {+ if (!canEdit() || !currentEditor.isEditable()) return;if (selection) $setSelection(selection.clone());$insertGifNode(gif);});closeToEditor();};+ createEffect(() => {+ if (!canEdit()) resetMenu();+ });+createEffect(() => {const currentPlugins = plugins();if (!currentPlugins) return;diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingLinkMenu.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingLinkMenu.tsxindex 319c5ca5d0..d9e9aecb21 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingLinkMenu.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingLinkMenu.tsx@@ -25,6 +25,7 @@ import {createMemo,createSignal,Match,+ on,onCleanup,onMount,type ParentProps,@@ -61,7 +62,8 @@ export function FloatingLinkMenu(props: {closePopup?: () => void;autoLinkMatchMode?: AutoLinkMatchMode;}) {- const { plugins, editor } = useContext(LexicalWrapperContext) ?? {};+ const { plugins, editor, isInteractable } =+ useContext(LexicalWrapperContext) ?? {};if (!plugins || !editor) {console.error('FloatingLinkMenu requires plugins and editor from LexicalWrapperContext!'@@ -105,6 +107,15 @@ export function FloatingLinkMenu(props: {setCreateMode(false);};+ createEffect(+ on(+ () => isInteractable?.(),+ (interactable) => {+ if (interactable === false) reset();+ }+ )+ );+// Passed to link plugin in to be called when the mouse hovers over a link.const onHoverLink = (link?: ILinkInfo) => {// We are editing a link so ignore hover.@@ -159,6 +170,7 @@ export function FloatingLinkMenu(props: {};const handleUnlink = () => {+ if (!editor.isEditable()) return;editor.dispatchCommand(UNLINK_COMMAND, undefined);reset();setTimeout(() => {@@ -184,6 +196,7 @@ export function FloatingLinkMenu(props: {};const handleEditClick = () => {+ if (!editor.isEditable()) return;setIsEditing(true);setTimeout(() => {if (urlInputRef) {@@ -193,6 +206,7 @@ export function FloatingLinkMenu(props: {};const handleSubmit = () => {+ if (!editor.isEditable()) return;const prev = linkInfo();const pending = pendingLinkInfo();if (!prev || !pending) {@@ -262,7 +276,8 @@ export function FloatingLinkMenu(props: {pendingLinkInfo()?.url === undefined) {setTimeout(() => {- editor.dispatchCommand(UNLINK_COMMAND, undefined);+ if (editor.isEditable())+ editor.dispatchCommand(UNLINK_COMMAND, undefined);});}reset();diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/media/mediaPlugin.ts b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/media/mediaPlugin.tsindex a8fcc68e99..70c29fe146 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/media/mediaPlugin.ts+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/media/mediaPlugin.ts@@ -111,7 +111,9 @@ export async function addMediaFromFile(mediaType: MediaType,constrainedMediaDimensions?: { width: number; height: number }) {+ if (!editor.isEditable()) return { success: false };const processedFile = await processFile(createUploadFile(file));+ if (!editor.isEditable()) return { success: false };if (!validateMediaFile(processedFile, mediaType)) return { success: false };editor.dispatchCommand(INSERT_MEDIA_COMMAND, {type: 'local',diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/utils/fileUploadUtils.ts b/apps/web/src/lib/core/component/LexicalMarkdown/utils/fileUploadUtils.tsindex d85d2e15fa..f1c72f717c 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/utils/fileUploadUtils.ts+++ b/apps/web/src/lib/core/component/LexicalMarkdown/utils/fileUploadUtils.ts@@ -50,6 +50,7 @@ async function processInlineMediaFiles(const IMAGE_EXTENSIONS_HEIC = getImageExtensionsHeic();const VIDEO_EXTENSIONS = getVideoExtensions();for (const file of files) {+ if (!editor.isEditable()) return;const ext = fileExtension(file.name);if (ext != null && IMAGE_EXTENSIONS_HEIC.includes(ext)) {const res = await addMediaFromFile(@@ -58,7 +59,7 @@ async function processInlineMediaFiles('image',constrainedMediaDimensions);- if (!res.success) {+ if (!res.success && editor.isEditable()) {toast.failure('Invalid media attachment file(s)');}} else if (ext != null && VIDEO_EXTENSIONS.includes(ext)) {@@ -68,7 +69,7 @@ async function processInlineMediaFiles('video',constrainedMediaDimensions);- if (!res.success) {+ if (!res.success && editor.isEditable()) {toast.failure('Invalid media attachment file(s)');}}@@ -98,6 +99,7 @@ async function onFilesReady(afterFileUpload?: (uploadedItemIds: string[]) => void,constrainedMediaDimensions?: { width: number; height: number }): Promise<void> {+ if (!editor.isEditable()) return;const mediaFiles: File[] = [];const filesToUpload: UploadInput[] = [];@@ -123,9 +125,10 @@ async function onFilesReady(await processInlineMediaFiles(editor, mediaFiles, constrainedMediaDimensions);- if (filesToUpload.length === 0) return;+ if (!editor.isEditable() || filesToUpload.length === 0) return;const results = await uploadFiles(filesToUpload, forceDssRuleset);+ if (!editor.isEditable()) return;let uploadedItemIds: string[] = [];@@ -138,6 +141,7 @@ async function onFilesReady(const blockName = fileTypeToBlockName(result.fileType, true);if (blockName) {const item = await documentUploadToItem(result);+ if (!editor.isEditable()) return;if (!item) {toast.failure('Document upload failed or timed out');Telemetry.error(new Error('Document upload failed or timed out'));@@ -157,6 +161,7 @@ async function onFilesReady(}} else if (result.type === 'folder') {const item = await documentUploadToItem(result);+ if (!editor.isEditable()) return;if (!item) {toast.failure('Folder upload failed or timed out');Telemetry.error(new Error('Folder upload failed or timed out'));diff --git a/apps/web/src/lib/graphql-cache/exchange/mutation-queue-runner.test.ts b/apps/web/src/lib/graphql-cache/exchange/mutation-queue-runner.test.tsnew file mode 100644index 0000000000..9d293d0345--- /dev/null+++ b/apps/web/src/lib/graphql-cache/exchange/mutation-queue-runner.test.ts@@ -0,0 +1,237 @@+import { SaveEmailDraftDocument } from '@service-storage/graphql/generated/graphql';+import {+ createClient,+ createRequest,+ makeOperation,+ type Operation,+ stringifyDocument,+} from '@urql/core';+import { getOperationAST, parse } from 'graphql';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { filter, makeSubject, mergeMap, pipe } from 'wonka';+import type { CacheHost } from '../host/types';+import {+ type ClaimedMutation,+ type CommitOptimisticWriteResult,+ type EnqueueOptimisticMutationResult,+ INITIAL_CACHE_REVISION,+ parseCacheRevision,+} from '../protocol';+import {+ createMutationQueueRunner,+ type MutationQueueRunner,+ queueAttemptOf,+} from './mutation-queue-runner';++beforeEach(() => vi.useFakeTimers());+afterEach(() => {+ vi.clearAllTimers();+ vi.useRealTimers();+ vi.unstubAllGlobals();+});+function operation(): Operation {+ return makeOperation(+ 'mutation',+ createRequest(parse(stringifyDocument(SaveEmailDraftDocument)), {+ input: { draftId: 'draft', subject: 'Draft' },+ }),+ { url: 'http://test', requestPolicy: 'cache-first' }+ );+}+function enqueue(+ op: Operation,+ generation: string,+ claim = true+): EnqueueOptimisticMutationResult {+ const mutation: ClaimedMutation = {+ transactionId: '1',+ uuid: 'same-attempt',+ query: stringifyDocument(op.query),+ operationName: getOperationAST(op.query)?.name?.value,+ variables: op.variables ?? {},+ leaseGeneration: generation,+ attemptCount: Number(generation),+ serverFailureCount: 0,+ superseded: false,+ requiresConfirmation: false,+ };+ return {+ transactionId: mutation.transactionId,+ revision: parseCacheRevision(generation),+ revisionAdvanced: true,+ changed: [],+ affectedOps: [],+ reset: false,+ upsertKind: { kind: 'inserted' },+ initialClaim: claim+ ? { kind: 'claimed', mutation }+ : { kind: 'not-runnable' },+ };+}+function fixture() {+ const forwarded: Operation[] = [];+ const commit = vi.fn<CacheHost['commitOptimisticWrite']>(+ async () =>+ ({+ kind: 'committed',+ revision: INITIAL_CACHE_REVISION,+ revisionAdvanced: true,+ changed: [],+ affectedOps: [],+ reset: false,+ }) satisfies CommitOptimisticWriteResult+ );+ const host = {+ commitOptimisticWrite: commit,+ currentRevision: async () => INITIAL_CACHE_REVISION,+ claimNextMutation: async () => undefined,+ } as unknown as CacheHost;+ let runner!: MutationQueueRunner;+ runner = createMutationQueueRunner({+ host,+ client: createClient({+ url: 'http://test',+ exchanges: [+ () => (source) =>+ pipe(+ source,+ filter((op) => op.kind === 'mutation'),+ mergeMap((op) => {+ forwarded.push(op);+ return makeSubject<import('@urql/core').OperationResult>().source;+ })+ ),+ ],+ }),+ options: {},+ owner: 'owner',+ forward: (op) => forwarded.push(op),+ writeThrough: (result) =>+ runner.settle(result, queueAttemptOf(result.operation)!),+ cacheDocument: (op) => ({+ query: stringifyDocument(op.query),+ operationName: getOperationAST(op.query)?.name?.value,+ variables: op.variables ?? {},+ }),+ deleteReportedRecords: async () => {},+ replayExplicitEffects: () => undefined,+ revalidate: async () => {},+ });+ return { runner, forwarded, commit, host };+}+it.each([false, true])(+ 'ignores an older lease arriving after a newer draft claim, already settled: %s',+ async (settled) => {+ const { runner, forwarded, commit } = fixture();+ await runner.admit(operation(), enqueue(operation(), '3'), runner.epoch());+ const result = {+ operation: forwarded[0],+ data: { saveEmailDraft: { draftId: 'draft', subject: 'Draft' } },+ stale: false,+ hasNext: false,+ };+ if (settled) await runner.settle(result, queueAttemptOf(forwarded[0])!);+ await runner.admit(operation(), enqueue(operation(), '1'), runner.epoch());+ expect(forwarded).toHaveLength(1);+ if (!settled) await runner.settle(result, queueAttemptOf(forwarded[0])!);+ expect(commit).toHaveBeenCalledOnce();+ expect(commit).toHaveBeenCalledWith(+ '1',+ { owner: 'owner', generation: '3' },+ expect.anything()+ );+ }+);++it('ignores a late unclaimed enqueue acknowledgement without releasing a newer claim', async () => {+ const { runner, forwarded, commit } = fixture();+ await runner.admit(operation(), enqueue(operation(), '4'), runner.epoch());+ await runner.admit(+ operation(),+ enqueue(operation(), '2', false),+ runner.epoch()+ );+ await runner.settle(+ {+ operation: forwarded[0],+ data: { saveEmailDraft: { draftId: 'draft', subject: 'Draft' } },+ stale: false,+ hasNext: false,+ },+ queueAttemptOf(forwarded[0])!+ );+ expect(forwarded).toHaveLength(1);+ expect(commit).toHaveBeenCalledOnce();+});++it('ignores a late claim from an earlier transaction after advancing the head', async () => {+ const { runner, forwarded, commit } = fixture();+ await runner.admit(operation(), enqueue(operation(), '3'), runner.epoch());+ const old = enqueue(operation(), '9');+ old.transactionId = '0';+ if (old.initialClaim.kind === 'claimed')+ old.initialClaim.mutation.transactionId = '0';+ await runner.admit(operation(), old, runner.epoch());+ await runner.settle(+ {+ operation: forwarded[0],+ data: { saveEmailDraft: { draftId: 'draft', subject: 'Draft' } },+ stale: false,+ hasNext: false,+ },+ queueAttemptOf(forwarded[0])!+ );+ expect(forwarded).toHaveLength(1);+ expect(commit).toHaveBeenCalledOnce();+});++it('still routes an older head enqueue after a newer tail acknowledgement', async () => {+ const { runner, forwarded } = fixture();+ const tail = enqueue(operation(), '3', false);+ tail.transactionId = '2';+ await runner.admit(operation(), tail, runner.epoch());+ await runner.admit(operation(), enqueue(operation(), '1'), runner.epoch());+ expect(forwarded).toHaveLength(1);+ expect(getOperationAST(forwarded[0].query)?.name?.value).toBe(+ 'SaveEmailDraft'+ );+});++it('clears claim watermarks when storage resets and reuses queue identities', async () => {+ const { runner, forwarded } = fixture();+ await runner.admit(operation(), enqueue(operation(), '3'), runner.epoch());+ runner.resetStorage();+ await runner.admit(operation(), enqueue(operation(), '1'), runner.epoch());+ expect(forwarded).toHaveLength(2);+});++it('preserves a pump claim when its unclaimed enqueue acknowledgement arrives afterward', async () => {+ const { runner, forwarded, commit, host } = fixture();+ const current = enqueue(operation(), '5');+ if (current.initialClaim.kind !== 'claimed') throw new Error('Missing claim');+ const claim = current.initialClaim.mutation;+ vi.spyOn(host, 'claimNextMutation').mockResolvedValueOnce(claim);+ runner.start();+ await vi.advanceTimersByTimeAsync(0);+ expect(forwarded).toHaveLength(1);+ await runner.admit(+ operation(),+ enqueue(operation(), '3', false),+ runner.epoch()+ );+ await runner.settle(+ {+ operation: forwarded[0],+ data: { saveEmailDraft: { draftId: 'draft', subject: 'Draft' } },+ stale: false,+ hasNext: false,+ },+ queueAttemptOf(forwarded[0])!+ );+ expect(commit).toHaveBeenCalledOnce();+ expect(commit).toHaveBeenCalledWith(+ '1',+ { owner: 'owner', generation: '5' },+ expect.anything()+ );+});diff --git a/apps/web/src/lib/graphql-cache/exchange/mutation-queue-runner.ts b/apps/web/src/lib/graphql-cache/exchange/mutation-queue-runner.tsindex 2eaa433b90..f2ed4c9261 100644--- a/apps/web/src/lib/graphql-cache/exchange/mutation-queue-runner.ts+++ b/apps/web/src/lib/graphql-cache/exchange/mutation-queue-runner.ts@@ -338,6 +338,12 @@ export function createMutationQueueRunner(const { host, client, options, owner, forward, writeThrough } = deps;const liveQueuedOps = new Map<string, LiveQueuedOperation>();let storageGeneration = 0;+ let activeAttempt: AttemptToken | undefined;+ // Queue IDs advance in order; retries advance their lease.+ // Keep the watermark after settlement so a late claim cannot revive an old head.+ let latestClaim:+ | Pick<ClaimedMutation, 'transactionId' | 'leaseGeneration'>+ | undefined;// The durable queue is strictly ordered. A confirmed head keeps its server// response until local settlement succeeds, without repeating a server// effect after a cache failure. Process loss still requires server-side@@ -351,8 +357,25 @@ export function createMutationQueueRunner(let deferredUntil: number | undefined;let drainTimer: ReturnType<typeof setTimeout> | undefined;- function isCurrent(token: StorageEpoch): boolean {- return token.storageGeneration === storageGeneration;+ function isNewClaim(claim: ClaimedMutation): boolean {+ if (!latestClaim) return true;+ const id = BigInt(claim.transactionId);+ const previousId = BigInt(latestClaim.transactionId);+ return (+ id > previousId ||+ (id === previousId &&+ BigInt(claim.leaseGeneration) > BigInt(latestClaim.leaseGeneration))+ );+ }++ function isCurrent(token: StorageEpoch | AttemptToken): boolean {+ if (token.storageGeneration !== storageGeneration) return false;+ if (!('leaseGeneration' in token)) return true;+ return (+ activeAttempt?.transactionId === token.transactionId &&+ activeAttempt?.leaseOwner === token.leaseOwner &&+ activeAttempt?.leaseGeneration === token.leaseGeneration+ );}/** Moves the head only while `token` has survived every storage reset. */@@ -408,6 +431,9 @@ export function createMutationQueueRunner(serverFailureCount: claimed.serverFailureCount ?? 0,storageGeneration: epoch.storageGeneration,};+ if (!isCurrent(epoch) || !isNewClaim(claimed)) return;+ latestClaim = claimed;+ activeAttempt = attempt;const confirmed = confirmedOf(head);if (confirmed?.transactionId === claimed.transactionId) {// claim → settling: re-apply the server's response before admission@@ -728,7 +754,26 @@ export function createMutationQueueRunner(enqueue: EnqueueOptimisticMutationResult,epoch: StorageEpoch): Promise<OperationResult | undefined> {+ notifyOptimisticMutationEnqueued(op);+ // Enqueue IDs are monotonic and immutable. A delayed acknowledgement must+ // not replace the live observer for a head already claimed by the pump.+ const stale =+ enqueue.initialClaim.kind === 'claimed'+ ? !isNewClaim(enqueue.initialClaim.mutation)+ : latestClaim !== undefined &&+ BigInt(enqueue.transactionId) <= BigInt(latestClaim.transactionId);+ if (!isCurrent(epoch) || stale)+ return queuedMutationResult(op, enqueue.transactionId);if (enqueue.upsertKind.kind === 'replaced-pending') {+ const removedId = enqueue.upsertKind.removedTransactionId;+ if (+ activeAttempt?.transactionId === removedId ||+ confirmedOf(head)?.transactionId === removedId+ ) {+ activeAttempt = undefined;+ head = IDLE;+ deferredUntil = undefined;+ }const superseded = liveQueuedOps.get(enqueue.upsertKind.removedTransactionId);@@ -748,7 +793,6 @@ export function createMutationQueueRunner(resolveRoute: resolve,});});- notifyOptimisticMutationEnqueued(op);try {await match(enqueue.initialClaim).with({ kind: 'claimed' }, ({ mutation }) =>@@ -890,7 +934,10 @@ export function createMutationQueueRunner(}}} else {- const confirmed = { transactionId: attempt.transactionId, result };+ const confirmed: ConfirmedMutation = {+ transactionId: attempt.transactionId,+ result,+ };if (!transition(attempt, confirm(confirmed))) return detachedResult();await recordAttemptResult(attempt, result, false);if (!isCurrent(attempt)) return detachedResult();@@ -985,6 +1032,8 @@ export function createMutationQueueRunner(function resetStorage(): void {storageGeneration += 1;+ activeAttempt = undefined;+ latestClaim = undefined;head = IDLE;deferredUntil = undefined;resolveLiveOperationsAsQueued();diff --git a/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.ts b/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.tsindex d0d96a5a89..5132e0e40f 100644--- a/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.ts+++ b/apps/web/src/lib/graphql-cache/exchange/normalized-cache-exchange.test.ts@@ -300,7 +300,7 @@ function makeFakeHost(): FakeHost {},seedQueued: (args, serverFailureCount = 0) => {queue.push({- transactionId: `restored-${queue.length + 1}`,+ transactionId: String(++nextTransaction),args,attemptCount: 0,serverFailureCount,@@ -379,7 +379,7 @@ function makeFakeHost(): FakeHost {data: args.data,linkPatches: args.linkPatches,});- const transactionId = `txn-${++nextTransaction}`;+ const transactionId = String(++nextTransaction);queue.push({transactionId,args,@@ -2944,7 +2944,7 @@ describe('normalizedCacheExchange', () => {}await tick();expect(host.commits).toEqual([]);- expect(host.rollbacks).toEqual([replay ? 'restored-1' : 'txn-1']);+ expect(host.rollbacks).toEqual([replay ? '1' : '1']);});@@ -2968,7 +2968,7 @@ describe('normalizedCacheExchange', () => {extensions: {normalizedCacheMutationDisposition: {kind: 'queued',- transactionId: 'tx',+ transactionId: '1',},},};@@ -3005,7 +3005,7 @@ describe('normalizedCacheExchange', () => {op.kind === 'mutation' ? { data: context.optimisticResponse } : {});await tick();- expect(host.commits[0]?.transactionId).toBe('restored-1');+ expect(host.commits[0]?.transactionId).toBe('1');expect(vi.mocked(client.query)).toHaveBeenCalledTimes(2);expect(vi.mocked(client.query).mock.calls.map((call) => call[1])@@ -3028,10 +3028,10 @@ describe('normalizedCacheExchange', () => {await tick();expect(host.begins).toHaveLength(0);- expect(host.claims).toEqual(['restored-1']);+ expect(host.claims).toEqual(['1']);expect(forwarded.map((op) => op.kind)).toEqual(['mutation']);expect(forwarded[0]?.context.fetch).toBeTypeOf('function');- expect(host.commits[0]?.transactionId).toBe('restored-1');+ expect(host.commits[0]?.transactionId).toBe('1');});it.each(['rejects', 'hangs'] as const)(@@ -3093,9 +3093,9 @@ describe('normalizedCacheExchange', () => {expect.anything(),false);- expect(host.rollbacks).toEqual(['restored-1']);+ expect(host.rollbacks).toEqual(['1']);expect(host.defers).toHaveLength(0);- expect(host.commits).toMatchObject([{ transactionId: 'restored-2' }]);+ expect(host.commits).toMatchObject([{ transactionId: '2' }]);expect(forwarded).toHaveLength(2);} finally {vi.useRealTimers();@@ -3125,7 +3125,7 @@ describe('normalizedCacheExchange', () => {});await vi.advanceTimersByTimeAsync(4_010);expect(forwarded).toHaveLength(1);- expect(host.commits).toMatchObject([{ transactionId: 'restored-1' }]);+ expect(host.commits).toMatchObject([{ transactionId: '1' }]);expect(warning).toHaveBeenCalled();} finally {warning.mockRestore();@@ -3226,7 +3226,7 @@ describe('normalizedCacheExchange', () => {await vi.advanceTimersByTimeAsync(1_010);expect(host.rollbacks).toHaveLength(0);expect(forwarded).toHaveLength(1);- expect(host.commits).toMatchObject([{ transactionId: 'restored-1' }]);+ expect(host.commits).toMatchObject([{ transactionId: '1' }]);} finally {vi.useRealTimers();}@@ -3250,7 +3250,7 @@ describe('normalizedCacheExchange', () => {await vi.advanceTimersByTimeAsync(10);expect(forwarded).toHaveLength(1);expect(host.defers).toHaveLength(0);- expect(host.commits).toMatchObject([{ transactionId: 'restored-1' }]);+ expect(host.commits).toMatchObject([{ transactionId: '1' }]);} finally {vi.useRealTimers();}@@ -3267,8 +3267,8 @@ describe('normalizedCacheExchange', () => {);ops.next(draftOp(1));await vi.advanceTimersByTimeAsync(10);- expect(host.claims).toEqual(['txn-1']);- expect(host.defers).toMatchObject([{ transactionId: 'txn-1' }]);+ expect(host.claims).toEqual(['1']);+ expect(host.defers).toMatchObject([{ transactionId: '1' }]);expect(host.rollbacks).toHaveLength(0);expect(forwarded).toHaveLength(0);expect(results).toHaveLength(1);@@ -3278,7 +3278,7 @@ describe('normalizedCacheExchange', () => {await vi.advanceTimersByTimeAsync(1_010);expect(host.rollbacks).toHaveLength(0);expect(forwarded).toHaveLength(1);- expect(host.commits).toMatchObject([{ transactionId: 'txn-1' }]);+ expect(host.commits).toMatchObject([{ transactionId: '1' }]);} finally {vi.useRealTimers();}@@ -3339,12 +3339,12 @@ describe('normalizedCacheExchange', () => {onMutationAttemptResult,});await vi.advanceTimersByTimeAsync(2_010);- expect(host.rollbacks).toEqual(['restored-1']);+ expect(host.rollbacks).toEqual(['1']);expect(host.defers).toHaveLength(0);- expect(host.commits).toMatchObject([{ transactionId: 'restored-2' }]);+ expect(host.commits).toMatchObject([{ transactionId: '2' }]);expect(forwarded).toHaveLength(1);expect(onMutationAttemptResult).toHaveBeenCalledWith(- expect.objectContaining({ transactionId: 'restored-1' }),+ expect.objectContaining({ transactionId: '1' }),expect.objectContaining({error: expect.objectContaining({message: expect.stringContaining('Unable to prepare'),@@ -3368,7 +3368,7 @@ describe('normalizedCacheExchange', () => {await vi.waitFor(() => expect(results).toHaveLength(1));expect(forwarded).toHaveLength(0);expect(host.defers).toHaveLength(0);- expect(host.rollbacks).toEqual(['txn-1']);+ expect(host.rollbacks).toEqual(['1']);expect(optimisticMutationDispositionOf(results[0])).toMatchObject({kind: 'permanently-failed',error: results[0]?.error,@@ -3446,9 +3446,9 @@ describe('normalizedCacheExchange', () => {await vi.advanceTimersByTimeAsync(10);expect(forwarded).toHaveLength(2);expect(host.defers).toHaveLength(0);- expect(host.rollbacks).toEqual(['restored-1']);+ expect(host.rollbacks).toEqual(['1']);expect(host.commits).toMatchObject([- { transactionId: 'restored-2', data: readResult },+ { transactionId: '2', data: readResult },]);} finally {vi.useRealTimers();@@ -3514,7 +3514,7 @@ describe('normalizedCacheExchange', () => {}await vi.advanceTimersByTimeAsync(0);expect(host.begins).toHaveLength(0);- expect(host.claims).toEqual(['restored-1']);+ expect(host.claims).toEqual(['1']);expect(host.rollbacks).toHaveLength(outcome === 'retryable' ? 0 : 1);expect(host.defers).toHaveLength(outcome === 'retryable' ? 1 : 0);const repairs =@@ -3552,7 +3552,7 @@ describe('normalizedCacheExchange', () => {const claimNext = host.claimNextMutation.bind(host);host.claimNextMutation = async (...args) => {const claimed = await claimNext(...args);- if (claimed?.transactionId === 'restored-1') {+ if (claimed?.transactionId === '1') {claimed.superseded = true;if (requiresConfirmation === undefined) {// Old deployed hosts have no flag. They must also recover.@@ -3567,8 +3567,8 @@ describe('normalizedCacheExchange', () => {const { forwarded } = harness(host, undefined, { onCacheError });await vi.waitFor(() =>expect(host.commits.map((commit) => commit.transactionId)).toEqual([- 'restored-1',- 'restored-2',+ '1',+ '2',]));expect(forwarded.map((op) => op.variables?.input.version)).toEqual([@@ -3631,7 +3631,7 @@ describe('normalizedCacheExchange', () => {await vi.advanceTimersByTimeAsync(1);expect(host.commits).toEqual([{- transactionId: 'txn-1',+ transactionId: '1',query: stringifyDocument(MUTATION),data: newData,},@@ -3647,6 +3647,18 @@ describe('normalizedCacheExchange', () => {vi.restoreAllMocks();});+ it('backs off empty cache wakeups while offline without spinning', async () => {+ vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(false);+ const claim = vi.spyOn(host, 'claimNextMutation');+ const { forwarded } = harness(host);+ host.pushGeneration({ storage: 'reset' });+ await vi.advanceTimersByTimeAsync(1_000);+ expect(claim).toHaveBeenCalledOnce();+ expect(host.claims).toEqual([]);+ expect(forwarded).toHaveLength(0);+ expect(vi.getTimerCount()).toBeLessThan(5);+ });+it.each(['restore', 'poll', 'online'] as const)('waits for restore readiness before claiming a mutation after %s',async (wake) => {@@ -3688,7 +3700,7 @@ describe('normalizedCacheExchange', () => {await vi.advanceTimersByTimeAsync(1);expect(forwarded.map((op) => op.kind)).toEqual(['mutation']);- expect(host.claims).toEqual(['restored-1']);+ expect(host.claims).toEqual(['1']);expect(host.commits).toHaveLength(1);expect(host.rollbacks).toEqual([]);expect(claimsBeforeReady).toBe(0);@@ -3716,7 +3728,7 @@ describe('normalizedCacheExchange', () => {expect(claim).not.toHaveBeenCalled();expect(forwarded).toEqual([]);await vi.advanceTimersByTimeAsync(1);- expect(host.claims).toEqual(['restored-1']);+ expect(host.claims).toEqual(['1']);expect(host.commits).toHaveLength(1);expect(forwarded.map((op) => op.kind)).toEqual(['mutation']);});@@ -3739,7 +3751,7 @@ describe('normalizedCacheExchange', () => {);const { forwarded } = harness(host);await vi.advanceTimersByTimeAsync(0);- expect(host.claims).toEqual(['restored-1']);+ expect(host.claims).toEqual(['1']);host.resetStorage();// The replacement database can reuse the old transaction ID.host.seedQueued({@@ -3868,7 +3880,7 @@ describe('normalizedCacheExchange', () => {await vi.advanceTimersByTimeAsync(1);}- expect(host.claims).toEqual(['restored-1']);+ expect(host.claims).toEqual(['1']);expect(host.commits).toHaveLength(1);expect(forwarded.map((op) => op.kind)).toEqual(['mutation']);}@@ -3920,7 +3932,7 @@ describe('normalizedCacheExchange', () => {optimisticMutationDispositionOf(results.find((result) => result.operation.key === 1)!)- ).toEqual({ kind: 'queued', transactionId: 'txn-1' });+ ).toEqual({ kind: 'queued', transactionId: '1' });// A runnable successor is sent immediately, but an unsettled head's// existing lease must never be stolen or its network call duplicated.expect(forwarded).toHaveLength(committed ? 2 : 1);@@ -3938,7 +3950,7 @@ describe('normalizedCacheExchange', () => {expect(forwarded).toHaveLength(2);expect(host.commits.map(({ transactionId }) => transactionId)- ).toEqual(['txn-1', committed ? 'restored-1' : 'restored-2']);+ ).toEqual(['1', '2']);});@@ -3991,21 +4003,21 @@ describe('normalizedCacheExchange', () => {await vi.advanceTimersByTimeAsync(300_000);expect(events).toEqual([- 'admit txn-1',- 'result txn-1',- 'commit failed txn-1',+ 'admit 1',+ 'result 1',+ 'commit failed 1',// Re-applied without sending again or asking admission to veto it.- 'result txn-1',- 'commit txn-1',- 'admit txn-2',- 'rollback txn-2 LOCAL_SUPERSEDED',+ 'result 1',+ 'commit 1',+ 'admit 2',+ 'rollback 2 LOCAL_SUPERSEDED',]);expect(forwarded).toHaveLength(1);expect(host.commits).toMatchObject([- { transactionId: 'txn-1', data: { from: 'network' } },+ { transactionId: '1', data: { from: 'network' } },]);const confirmedResult = [- expect.objectContaining({ transactionId: 'txn-1' }),+ expect.objectContaining({ transactionId: '1' }),expect.objectContaining({ data: { from: 'network' } }),false,];@@ -4015,7 +4027,7 @@ describe('normalizedCacheExchange', () => {]);});- // The replacement queue reuses transaction id txn-1 and lease+ // The replacement queue reuses transaction id 1 and lease// generation 1, so an unfenced stale attempt would discard the new head.it('fences a recovery-failure rollback after storage resets', async () => {const recording = deferred<void>();@@ -4061,7 +4073,7 @@ describe('normalizedCacheExchange', () => {);await tick();- expect(host.rollbacks).toEqual(['restored-1']);+ expect(host.rollbacks).toEqual(['1']);});it.each(['foreground', 'restored', 'unhandled replay'] as const)(@@ -4109,14 +4121,14 @@ describe('normalizedCacheExchange', () => {}await tick();expect(rollback).toHaveBeenCalledExactlyOnceWith(- path === 'foreground' ? 'txn-1' : 'restored-1',+ path === 'foreground' ? '1' : '1',expect.any(Object),rejection.message,'DRAFT_ALREADY_SENT');expect(host.begins).toHaveLength(path === 'foreground' ? 1 : 0);if (path === 'restored') {- expect(host.claims).toEqual(['restored-1']);+ expect(host.claims).toEqual(['1']);expect(forwarded[0]?.variables).toEqual(variables);expect(optimisticContextOf(forwarded[0])).toBeUndefined();}@@ -4237,7 +4249,7 @@ describe('normalizedCacheExchange', () => {expect(forwarded).toHaveLength(0);expect(optimisticMutationDispositionOf(results[0])).toEqual({kind: 'queued',- transactionId: 'txn-1',+ transactionId: '1',});});@@ -4334,13 +4346,13 @@ describe('normalizedCacheExchange', () => {ops.next(makeMutationOp(2, optimistic));await tick();- expect(host.claims[0]).toBe('restored-1');+ expect(host.claims[0]).toBe('1');expect(forwarded[0]?.kind).toBe('mutation');const liveResult = results.find((result) => result.operation.key === 2);expect(liveResult).toBeDefined();expect(optimisticMutationDispositionOf(liveResult!)).toEqual({kind: 'queued',- transactionId: 'txn-1',+ transactionId: '2',});});@@ -4359,7 +4371,7 @@ describe('normalizedCacheExchange', () => {expect(forwarded).toHaveLength(0);expect(optimisticMutationDispositionOf(results[0])).toEqual({kind: 'queued',- transactionId: 'txn-1',+ transactionId: '1',});});@@ -4385,7 +4397,7 @@ describe('normalizedCacheExchange', () => {);expect(optimisticMutationDispositionOf(results[0])).toEqual({kind: 'queued',- transactionId: 'txn-1',+ transactionId: '1',});});@@ -4614,7 +4626,7 @@ describe('normalizedCacheExchange', () => {await tick();expect(host.commits).toHaveLength(1);- expect(host.commits[0]?.transactionId).toBe('txn-1');+ expect(host.commits[0]?.transactionId).toBe('1');expect(host.commits[0]?.data).toEqual({ from: 'network' });expect(host.rollbacks).toHaveLength(0);// Only the real network result reaches the caller.@@ -4633,7 +4645,7 @@ describe('normalizedCacheExchange', () => {host.commitOptimisticWrite = async (transactionId, claim, args) => ({...(await commit(transactionId, claim, args)),kind: 'committed-superseded',- replacementTransactionId: 'txn-2',+ replacementTransactionId: '2',});const { ops, results } = harness(host);@@ -4644,7 +4656,7 @@ describe('normalizedCacheExchange', () => {expect(results[0]?.data).toBeUndefined();expect(optimisticMutationDispositionOf(results[0])).toEqual({kind: 'queued',- transactionId: 'txn-2',+ transactionId: '2',});});@@ -4770,7 +4782,7 @@ describe('normalizedCacheExchange', () => {host.commitOptimisticWrite = async (transactionId, claim, args) => ({...(await commit(transactionId, claim, args)),kind: 'committed-superseded',- replacementTransactionId: 'txn-2',+ replacementTransactionId: '2',revalidations: [{query: stringifyDocument(QUERY),@@ -4800,7 +4812,7 @@ describe('normalizedCacheExchange', () => {expect(results[0]?.data).toBeUndefined();expect(optimisticMutationDispositionOf(results[0])).toEqual({kind: 'queued',- transactionId: 'txn-2',+ transactionId: '2',});});@@ -4843,8 +4855,8 @@ describe('normalizedCacheExchange', () => {it.each([{ replacementTransactionId: undefined, callbackThrows: false },{ replacementTransactionId: undefined, callbackThrows: true },- { replacementTransactionId: 'txn-2', callbackThrows: false },- { replacementTransactionId: 'txn-2', callbackThrows: true },+ { replacementTransactionId: '2', callbackThrows: false },+ { replacementTransactionId: '2', callbackThrows: true },])('settles an identity failure without replaying the failed attempt (replacement $replacementTransactionId, callback throws=$callbackThrows)',async ({ replacementTransactionId, callbackThrows }) => {@@ -5053,7 +5065,7 @@ describe('normalizedCacheExchange', () => {ops.next(makeMutationOp(1, optimistic));await tick();- expect(host.rollbacks).toEqual(['txn-1']);+ expect(host.rollbacks).toEqual(['1']);expect(host.commits).toHaveLength(0);expect(results[0]?.error).toBe(error);expect(optimisticMutationDispositionOf(results[0])).toEqual({@@ -5104,7 +5116,7 @@ describe('normalizedCacheExchange', () => {await vi.advanceTimersByTimeAsync(1_000);expect(attempts).toBe(2);expect(rollback).toHaveBeenCalledExactlyOnceWith(- 'txn-1',+ '1',expect.any(Object),rejection.message,expected@@ -5128,7 +5140,7 @@ describe('normalizedCacheExchange', () => {expect(optimisticMutationDispositionOf(results[0])).toEqual({kind: 'queued',- transactionId: 'txn-1',+ transactionId: '1',});});@@ -5142,7 +5154,7 @@ describe('normalizedCacheExchange', () => {ops.next(makeMutationOp(1, optimistic));await tick();- expect(host.rollbacks).toEqual(['txn-1']);+ expect(host.rollbacks).toEqual(['1']);expect(host.commits).toHaveLength(0);});@@ -5161,14 +5173,14 @@ describe('normalizedCacheExchange', () => {expect(shouldRetryMutation).toHaveBeenCalledWith(error);expect(host.defers).toEqual([- { transactionId: 'txn-1', error: error.message },+ { transactionId: '1', error: error.message },]);expect(host.rollbacks).toHaveLength(0);expect(results[0]?.error).toBeUndefined();expect(results[0]?.data).toEqual(optimistic);expect(optimisticMutationDispositionOf(results[0])).toEqual({kind: 'queued',- transactionId: 'txn-1',+ transactionId: '1',});});@@ -5224,7 +5236,7 @@ describe('normalizedCacheExchange', () => {expect(host.commits).toHaveLength(0);if (failures === 0) {expect(defer).toHaveBeenCalledExactlyOnceWith(- 'txn-1',+ '1',expect.any(Object),expect.any(Number),expect.stringContaining(String(status)),@@ -5233,12 +5245,12 @@ describe('normalizedCacheExchange', () => {expect(host.rollbacks).toHaveLength(0);expect(optimisticMutationDispositionOf((await pending)!)).toEqual({kind: 'queued',- transactionId: 'txn-1',+ transactionId: '1',});} else {expect(host.defers).toHaveLength(0);expect(rollback).toHaveBeenCalledExactlyOnceWith(- 'restored-1',+ '1',expect.any(Object),expect.stringContaining('10 server failures'),'MUTATION_RETRY_EXHAUSTED'@@ -5351,13 +5363,13 @@ describe('normalizedCacheExchange', () => {await vi.advanceTimersByTimeAsync(1);expect(host.defers).toHaveLength(9);expect(rollback).toHaveBeenCalledExactlyOnceWith(- 'txn-1',+ '1',expect.any(Object),expect.stringContaining('10 server failures'),'MUTATION_RETRY_EXHAUSTED');expect(host.commits.map((entry) => entry.transactionId)).toEqual([- 'txn-2',+ '2',]);expect(forwarded).toHaveLength(11);expect(@@ -5412,7 +5424,7 @@ describe('normalizedCacheExchange', () => {}expect(attempts).toBe(34);expect(host.defers).toHaveLength(33);- expect(host.rollbacks).toEqual(['txn-1']);+ expect(host.rollbacks).toEqual(['1']);} finally {vi.clearAllTimers();vi.useRealTimers();@@ -5445,14 +5457,14 @@ describe('normalizedCacheExchange', () => {await tick();expect(host.defers).toHaveLength(0);expect(rollback).toHaveBeenCalledExactlyOnceWith(- 'restored-1',+ '1',expect.any(Object),expect.stringContaining('10 server failures'),'MUTATION_RETRY_EXHAUSTED');expect(onMutationAttemptResult).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({- transactionId: 'restored-1',+ transactionId: '1',serverFailureCount: 9,}),expect.objectContaining({@@ -5521,7 +5533,7 @@ describe('normalizedCacheExchange', () => {await vi.advanceTimersByTimeAsync(0);expect(attempts).toBe(1);- expect(host.rollbacks).toEqual(['txn-1']);+ expect(host.rollbacks).toEqual(['1']);expect(host.defers).toHaveLength(0);expect(results[0]?.error).toBe(error);expect(optimisticMutationDispositionOf(results[0])).toEqual({@@ -5547,11 +5559,11 @@ describe('normalizedCacheExchange', () => {expect(host.begins).toHaveLength(2);expect(host.commits).toEqual([expect.objectContaining({- transactionId: 'txn-2',+ transactionId: '2',data: saved,}),]);- expect(host.rollbacks).toEqual(['txn-1']);+ expect(host.rollbacks).toEqual(['1']);} finally {vi.useRealTimers();}@@ -5578,7 +5590,7 @@ describe('normalizedCacheExchange', () => {ops.next(makeMutationOp(2, secondOptimistic));await tick();- expect(host.claims).toEqual(['txn-1']);+ expect(host.claims).toEqual(['1']);expect(forwarded.map((op) => op.key)).toEqual([1]);expect(host.begins.map((begin) => begin.data)).toEqual([firstOptimistic,@@ -5591,7 +5603,7 @@ describe('normalizedCacheExchange', () => {expect(results[1]?.data).toEqual(secondOptimistic);expect(optimisticMutationDispositionOf(results[1])).toEqual({kind: 'queued',- transactionId: 'txn-2',+ transactionId: '2',});});@@ -5601,15 +5613,15 @@ describe('normalizedCacheExchange', () => {ops.next(makeMutationOp(2, optimistic));await tick();- expect(host.claims).toEqual(['txn-1', 'txn-2']);+ expect(host.claims).toEqual(['1', '2']);// The second caller was released as queued while the first attempt was// in flight, so its eventual send is reconstructed from durable data.expect(forwarded).toHaveLength(2);expect(forwarded[0]?.key).toBe(1);expect(forwarded[1]?.kind).toBe('mutation');expect(host.commits.map((entry) => entry.transactionId)).toEqual([- 'txn-1',- 'txn-2',+ '1',+ '2',]);});diff --git a/apps/web/src/lib/graphql-cache/host/worker-host.integration.test.ts b/apps/web/src/lib/graphql-cache/host/worker-host.integration.test.tsindex f510521cab..51b4dc14e0 100644--- a/apps/web/src/lib/graphql-cache/host/worker-host.integration.test.ts+++ b/apps/web/src/lib/graphql-cache/host/worker-host.integration.test.ts@@ -186,7 +186,7 @@ class IntegrationCore {if (request.kind === 'read') result = { kind: 'miss' };if (request.kind === 'enqueue-optimistic-mutation') {result = {- transactionId: `integration-${request.id}`,+ transactionId: String(request.id),changed: [],affectedOps: [],reset: false,diff --git a/apps/web/src/lib/graphql-cache/worker/browser-test/cache-startup.browser.e2e.ts b/apps/web/src/lib/graphql-cache/worker/browser-test/cache-startup.browser.e2e.tsindex 52ce360cea..0c8e29d4cc 100644--- a/apps/web/src/lib/graphql-cache/worker/browser-test/cache-startup.browser.e2e.ts+++ b/apps/web/src/lib/graphql-cache/worker/browser-test/cache-startup.browser.e2e.ts@@ -60,3 +60,47 @@ for (const failure of ['slow-download', 'failed-download'] as const) {});});}++test('a fresh host recovers exhausted downloads on the same page and preserves stored data', async ({+ context,+ page,+}, testInfo) => {+ const path = testInfo.project.name.includes('production')+ ? '/app/cache-lifecycle.html'+ : '/cache-lifecycle.html';+ const url = `${path}?treatment=true&scope=cache-retry-${crypto.randomUUID()}`;+ await page.goto(url);+ await expect(page.locator('#result')).toHaveAttribute('data-status', 'ready');+ await page.evaluate(() => window.cacheLifecycleHarness.startSingle());+ await page.evaluate(() =>+ window.cacheLifecycleHarness.write('preserved-after-exhaustion')+ );+ await page.goto('about:blank');+ let downloads = 0;+ const pattern = /\/cache_wasm_bg[^/]*\.wasm(?:\?.*)?$/;+ await context.route(pattern, async (route) => {+ downloads += 1;+ await route.abort('failed');+ });+ await page.goto(url);+ await expect(page.locator('#result')).toHaveAttribute('data-status', 'ready');+ const failed = await page.evaluate(async () => {+ try {+ await window.cacheLifecycleHarness.startSingle();+ return false;+ } catch {+ return true;+ }+ });+ expect(failed).toBe(true);+ expect(downloads).toBe(6);+ await context.unroute(pattern);+ await page.evaluate(() => window.cacheLifecycleHarness.dispose());+ await page.evaluate(() => window.cacheLifecycleHarness.startSingle());+ expect(+ await page.evaluate(() => window.cacheLifecycleHarness.read())+ ).toMatchObject({+ kind: 'hit',+ data: { user: { soup: { items: [{ id: 'preserved-after-exhaustion' }] } } },+ });+});diff --git a/apps/web/src/lib/graphql-cache/worker/browser-test/independent-send-recovery.browser.e2e.ts b/apps/web/src/lib/graphql-cache/worker/browser-test/independent-send-recovery.browser.e2e.tsnew file mode 100644index 0000000000..ccfec7f637--- /dev/null+++ b/apps/web/src/lib/graphql-cache/worker/browser-test/independent-send-recovery.browser.e2e.ts@@ -0,0 +1,138 @@+import { fileURLToPath } from 'node:url';+import { expect, test } from '@playwright/test';++const storePath = fileURLToPath(+ new URL('../../../queries/email/local-draft-store.ts', import.meta.url)+);+const wasmPath = fileURLToPath(new URL('../wasm-module.ts', import.meta.url));++test('independent send authority survives actual WASM physical cache recovery', async ({+ page,+}) => {+ await page.goto(+ `/cache-lifecycle.html?scope=independent-${crypto.randomUUID()}`+ );+ const result = await page.evaluate(+ async ({ storePath, wasmPath }) => {+ const {+ createLocalDraftStore,+ }: typeof import('../../../queries/email/local-draft-store') =+ await import(`${location.origin}/@fs${storePath}`);+ const store = createLocalDraftStore(+ 'audit-independent-' + crypto.randomUUID()+ );+ const owner = await store.activate('audit');+ const uuid = crypto.randomUUID();+ await store.save(owner, {+ key: 'draft',+ accountId: 'audit',+ generation: 'generation',+ draftId: 'draft',+ threadId: 'thread',+ expectedRevision: 0,+ content: { subject: 'AUDIT cache reset', body_text: 'Approved body' },+ attachments: [],+ status: 'dirty',+ });+ const intent: import('../../../queries/email/send-queue').EmailSendIntent =+ {+ uuid,+ dispatchVersion: 2,+ phase: 'pending',+ locallyCancelled: false,+ metadata: {+ kind: 'email-send-v1',+ payload: {+ input: {+ attempt: { attemptId: uuid, linkId: 'inbox' },+ message: {+ draftId: 'draft',+ subject: 'AUDIT cache reset',+ bodyText: 'Approved body',+ },+ attachmentIds: [],+ forwardedAttachmentIds: [],+ },+ draft: {+ draftId: 'draft',+ threadDbId: 'thread',+ senderLinkId: 'inbox',+ senderEmail: '[email protected]',+ subject: 'AUDIT cache reset',+ bodyText: 'Approved body',+ optimisticBodyHtml: null,+ },+ workingCopy: {+ key: 'draft',+ generation: 'generation',+ revision: 1,+ attachments: [],+ },+ },+ },+ };+ await store.putSend(owner, intent, true);+ const workerSource = `import {loadCacheWasm} from ${JSON.stringify(`${location.origin}/@fs${wasmPath}`)};+try { const wasm=await loadCacheWasm(); const engine=await wasm.openCache('independent-cache-'+crypto.randomUUID()); const query='mutation SetEntityProperty($input: SetEntityPropertyInput!) { setEntityProperty(input: $input) { id displayName } }'; await engine.enqueueOptimisticMutation(undefined,${JSON.stringify(uuid)},query,'SetEntityProperty',{input:{entityId:'doc',value:{string:'Approved body'}}},{setEntityProperty:{id:'property',displayName:'Approved body'}},[],[],[],1,'audit',1,1000); const before=(await engine.inspectMutations()).length; await engine.physicalReset(); const after=(await engine.inspectMutations()).length; await engine.close(); postMessage({before,after}); } catch(e){postMessage({error:String(e)});}`;+ const worker = new Worker(+ URL.createObjectURL(+ new Blob([workerSource], { type: 'text/javascript' })+ ),+ { type: 'module' }+ );+ const cache = await new Promise<{+ before: number;+ after: number;+ error?: string;+ }>((resolve, reject) => {+ const timer = setTimeout(+ () => reject(new Error('worker timeout')),+ 60000+ );+ worker.onmessage = (e) => {+ clearTimeout(timer);+ worker.terminate();+ resolve(e.data);+ };+ worker.onerror = (e) => {+ clearTimeout(timer);+ worker.terminate();+ reject(new Error(e.message));+ };+ });+ const recovered = (await store.sends(owner))[0];+ let locked = false;+ try {+ await store.save(owner, {+ key: 'draft',+ accountId: 'audit',+ generation: 'generation',+ draftId: 'draft',+ expectedRevision: 1,+ content: { subject: 'Late edit' },+ attachments: [],+ status: 'dirty',+ });+ } catch {+ locked = true;+ }+ await store.clear();+ await store.close();+ return {+ cache,+ backupCount: recovered ? 1 : 0,+ sameAttemptId: recovered?.uuid === uuid,+ body: recovered?.metadata.payload.input.message.bodyText,+ locked,+ };+ },+ { storePath, wasmPath }+ );+ expect(result).toEqual({+ cache: { before: 1, after: 0 },+ backupCount: 1,+ sameAttemptId: true,+ body: 'Approved body',+ locked: true,+ });+});diff --git a/apps/web/src/lib/graphql-cache/worker/browser-test/mail-projection-harness.ts b/apps/web/src/lib/graphql-cache/worker/browser-test/mail-projection-harness.tsindex 74ceb00651..595c57c61a 100644--- a/apps/web/src/lib/graphql-cache/worker/browser-test/mail-projection-harness.ts+++ b/apps/web/src/lib/graphql-cache/worker/browser-test/mail-projection-harness.ts@@ -190,6 +190,7 @@ document.querySelector('#create-draft')!.addEventListener('click', async () => {const now = new Date().toISOString();const draft: SaveEmailDraftMutation['saveEmailDraft']['draft'] = {__typename: 'GraphqlSoupEmailMessage',+ draftGeneration: 0,operationStatus: null,id: id(8001),threadId: id(8002),@@ -206,6 +207,7 @@ document.querySelector('#create-draft')!.addEventListener('click', async () => {isDraft: true,hasAttachments: false,scheduledSendTime: null,+ scheduledSendStatus: null,from: { email: '[email protected]', name: null, photoUrl: null },to: [{ email: '[email protected]', name: null, photoUrl: null }],cc: [],diff --git a/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.config.ts b/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.config.tsindex 863bcae78d..e4be160f2b 100644--- a/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.config.ts+++ b/apps/web/src/lib/graphql-cache/worker/browser-test/playwright.config.ts@@ -7,6 +7,7 @@ const webDirectory = fileURLToPath(new URL('../../../../../', import.meta.url));export default defineConfig({testDir: directory,testMatch: [+ 'independent-send-recovery.browser.e2e.ts','calendar-points.browser.e2e.ts','coordinator.browser.e2e.ts','cache-wasm-packaging.browser.e2e.ts',diff --git a/apps/web/src/lib/graphql-cache/worker/coordinator-core.test.ts b/apps/web/src/lib/graphql-cache/worker/coordinator-core.test.tsindex df121af9a6..04e93e9463 100644--- a/apps/web/src/lib/graphql-cache/worker/coordinator-core.test.ts+++ b/apps/web/src/lib/graphql-cache/worker/coordinator-core.test.ts@@ -738,6 +738,35 @@ describe('CoordinatorCore', () => {]);});+ it('retries exhausted asset bootstrap from a new host without resetting persisted writes', () => {+ const core = new CoordinatorCore('scope');+ core.registerTab('failed-host');+ core.ownerLost('failed-host', 1, 'Failed to fetch');+ expect(core.terminalFailure('bootstrap exhausted')).toEqual([+ {+ kind: 'terminal-failure',+ error: 'bootstrap exhausted',+ storageUntouched: true,+ },+ ]);+ expect(core.registerTab('replacement')).toEqual([+ {+ kind: 'elect-owner',+ tabId: 'replacement',+ ownerEpoch: 2,+ databaseAction: 'open-existing',+ },+ ]);+ ready(core, 'replacement', 2, 'opened-existing');+ expect(core.request('failed-host', { id: 7, kind: 'clear' })).toEqual([+ expect.objectContaining({+ kind: 'reject-request',+ errorCode: 'owner-lock-unavailable',+ }),+ ]);+ expect(core.snapshot().activeOwnerCount).toBe(1);+ });+it('makes retry exhaustion terminal for current and future tabs', () => {const core = new CoordinatorCore('scope');core.registerTab('tab-a');diff --git a/apps/web/src/lib/graphql-cache/worker/coordinator-core.ts b/apps/web/src/lib/graphql-cache/worker/coordinator-core.tsindex f7f507b555..cf2b12bf77 100644--- a/apps/web/src/lib/graphql-cache/worker/coordinator-core.ts+++ b/apps/web/src/lib/graphql-cache/worker/coordinator-core.ts@@ -193,6 +193,14 @@ export class CoordinatorCore {},];}+ if (this.stateValue.kind === 'failed' && this.stateValue.storageUntouched) {+ // A fresh host may retry asset bootstrap, but never reopen a database+ // whose recovery required a reset. Failed hosts stay excluded below.+ this.stateValue = {+ kind: 'waiting-for-tab',+ nextDatabaseAction: 'open-existing',+ };+ }if (this.stateValue.kind === 'failed') {return [{@@ -484,7 +492,7 @@ export class CoordinatorCore {return actions;}- /** Stops owner recovery and fails every current or future page connection. */+ /** Stops this recovery cycle. Only untouched storage permits a new host to retry. */terminalFailure(reason: string): CoordinatorAction[] {if (this.stateValue.kind === 'failed') return [];const storageUntouched =@@ -492,6 +500,7 @@ export class CoordinatorCore {this.stateValue.databaseAction === 'open-existing';this.queuedRequests.length = 0;this.inFlight.clear();+ for (const tabId of this.tabs) this.unavailableTabs.set(tabId, reason);this.stateValue = {kind: 'failed',reason,diff --git a/apps/web/src/lib/graphql-cache/worker/coordinator-router.test.ts b/apps/web/src/lib/graphql-cache/worker/coordinator-router.test.tsindex 57f7ec912e..b21f8d9f10 100644--- a/apps/web/src/lib/graphql-cache/worker/coordinator-router.test.ts+++ b/apps/web/src/lib/graphql-cache/worker/coordinator-router.test.ts@@ -1562,9 +1562,22 @@ describe('CoordinatorRouter', () => {]);const late = new FakePort();await register(router, late, 'tab-b');- expect(messagesOfKind(late, 'terminal-error')).toEqual([- expect.objectContaining({ storageUntouched: true }),- ]);+ expect(messagesOfKind(late, 'terminal-error')).toEqual([]);+ expect(router.snapshot()?.state).toMatchObject({+ kind: 'activating',+ tabId: 'tab-b',+ ownerEpoch: 7,+ databaseAction: 'open-existing',+ });+ // A fresh registration gets a fresh bounded budget, not another immediate+ // terminal error from the previous host's exhausted cycle.+ await vi.advanceTimersByTimeAsync(2000);+ expect(messagesOfKind(late, 'become-owner')).toHaveLength(6);+ expect(messagesOfKind(tab, 'become-owner')).toHaveLength(6);+ expect(router.snapshot()?.state).toMatchObject({+ kind: 'failed',+ storageUntouched: true,+ });});it('preserves the owner and in-flight work through repeated missed heartbeats', async () => {diff --git a/apps/web/src/lib/graphql-cache/worker/coordinator-router.ts b/apps/web/src/lib/graphql-cache/worker/coordinator-router.tsindex 7f0c8fc998..fb4369eed8 100644--- a/apps/web/src/lib/graphql-cache/worker/coordinator-router.ts+++ b/apps/web/src/lib/graphql-cache/worker/coordinator-router.ts@@ -524,6 +524,12 @@ export class CoordinatorRouter {tabId: message.tabId,}));+ if (+ this.coreValue.state.kind === 'failed' &&+ this.coreValue.state.storageUntouched+ ) {+ this.resetRecoveryRetries();+ }const actions = this.coreValue.registerTab(message.tabId);this.applyActions(actions);// Late joiners must use the same startup budget as the elected owner.diff --git a/apps/web/src/lib/queries/email/attachment.ts b/apps/web/src/lib/queries/email/attachment.tsindex 4bf486cb2e..c0c3d5b962 100644--- a/apps/web/src/lib/queries/email/attachment.ts+++ b/apps/web/src/lib/queries/email/attachment.ts@@ -12,6 +12,7 @@ import { useMutation } from '@tanstack/solid-query';type UploadDraftAttachmentsParams = {draftID: string;+ draftGeneration?: number;attachments: File[];/** Target inbox for a non-primary inbox; sent as the X-Email-Link-Id header. */linkId?: string;@@ -66,13 +67,18 @@ function uploadId(file: File, draft: string): string {export async function completeDraftAttachment(input: {draftId: string;+ draftGeneration?: number;attachmentId: string;inboxId?: string;}): Promise<void> {try {await throwOnErr(() =>emailClient.completeDraftAttachment(- { draftID: input.draftId, attachmentID: input.attachmentId },+ {+ draftID: input.draftId,+ attachmentID: input.attachmentId,+ draftGeneration: input.draftGeneration,+ },input.inboxId));@@ -97,6 +103,7 @@ export const useUploadDraftAttachmentsMutation = (await emailClient.addDraftAttachment({draftID: params.draftID,+ draftGeneration: params.draftGeneration,attachment: {upload_id: uploadId(attachment, params.draftID),file_name: attachment.name,@@ -145,6 +152,7 @@ export const useUploadDraftAttachmentsMutation = (}await completeDraftAttachment({draftId: params.draftID,+ draftGeneration: params.draftGeneration,attachmentId: result.attachment_id,inboxId: params.linkId,});@@ -170,6 +178,7 @@ export const useUploadDraftAttachmentsMutation = (await emailClient.removeDraftAttachment({draftID: variables.draftID,+ draftGeneration: variables.draftGeneration,attachmentID: error.context.attachmentID,},variables.linkId@@ -191,6 +200,7 @@ export const useUploadDraftAttachmentsMutation = (type RemoveDraftAttachmentParams = {draftID: string;+ draftGeneration?: number;attachmentID: string;/** Target inbox for a non-primary inbox; sent as the X-Email-Link-Id header. */linkId?: string;@@ -206,6 +216,7 @@ export const useRemoveDraftAttachmentMutation = (await emailClient.removeDraftAttachment({draftID: params.draftID,+ draftGeneration: params.draftGeneration,attachmentID: params.attachmentID,},params.linkId@@ -225,6 +236,7 @@ export const useRemoveDraftAttachmentMutation = (type AddForwardedAttachmentsParams = {draftID: string;+ draftGeneration?: number;attachments: { attachmentID: string }[];/** Target inbox for a non-primary inbox; sent as the X-Email-Link-Id header. */linkId?: string;@@ -241,6 +253,7 @@ export const useAddForwardedAttachmentsMutation = (await emailClient.addForwardedAttachment({draftID: params.draftID,+ draftGeneration: params.draftGeneration,attachmentID: att.attachmentID,},params.linkId@@ -261,6 +274,7 @@ export const useAddForwardedAttachmentsMutation = (type RemoveForwardedAttachmentParams = {draftID: string;+ draftGeneration?: number;attachmentID: string;/** Target inbox for a non-primary inbox; sent as the X-Email-Link-Id header. */linkId?: string;@@ -276,6 +290,7 @@ export const useRemoveForwardedAttachmentMutation = (await emailClient.removeForwardedAttachment({draftID: params.draftID,+ draftGeneration: params.draftGeneration,attachmentID: params.attachmentID,},params.linkIddiff --git a/apps/web/src/lib/queries/email/cancel-server-send.ts b/apps/web/src/lib/queries/email/cancel-server-send.tsnew file mode 100644index 0000000000..3de1e7c173--- /dev/null+++ b/apps/web/src/lib/queries/email/cancel-server-send.ts@@ -0,0 +1,69 @@+import { decodeBase64Utf8 } from '@app/features/email-compose/core/decode-base64';+import { cancelEmailSend } from '@service-storage/email-send';+import { publishDraftRestoration } from './draft-lifecycle-events';+import { restoreSendWorkingCopy } from './send-draft-lifecycle';+import {+ refreshServerEmailSends,+ type ServerEmailSend,+ serverSendAccount,+} from './server-sends';++/** Other devices already handed off delivery. Cancellation uses that same authority. */+export async function cancelServerEmailSend(row: ServerEmailSend) {+ const account = serverSendAccount();+ if (!account) throw new Error('Sign in to cancel this send');+ const result = await cancelEmailSend(+ {+ attemptId: row.attempt.attemptId,+ linkId: row.linkId,+ },+ AbortSignal.timeout(15_000)+ );+ if (serverSendAccount() !== account) return;+ if (result.status !== 'CANCELLED') {+ await refreshServerEmailSends();+ throw new Error(+ result.status === 'DELIVERY_UNCONFIRMED'+ ? 'Delivery is unconfirmed. Check sent mail before taking further action.'+ : 'Delivery has already started; cancellation was too late.'+ );+ }+ const message = result.message;+ if (message) {+ if (serverSendAccount() !== account) return;+ const restored = await restoreSendWorkingCopy(+ {+ draftId: message.id,+ draftGeneration: message.draftGeneration,+ threadDbId: message.threadId,+ senderLinkId: row.linkId,+ senderEmail: message.from?.email ?? '',+ subject: message.subject ?? '',+ to: message.to,+ cc: message.cc,+ bcc: message.bcc,+ replyingToId: message.replyingToId,+ providerId: message.providerId,+ bodyHtml: message.bodyHtmlSanitized,+ bodyText: message.bodyText,+ bodyMacro: message.bodyMacro,+ optimisticBodyHtml: message.bodyHtmlSanitized+ ? decodeBase64Utf8(message.bodyHtmlSanitized)+ : null,+ existingDraft: message,+ },+ undefined,+ true+ );+ publishDraftRestoration({+ draftId: String(restored.draftId),+ inboxId: row.linkId,+ restoration: {+ originalDraftId: message.id,+ threadId: message.threadId,+ replyingToId: message.replyingToId,+ },+ });+ }+ await refreshServerEmailSends();+}diff --git a/apps/web/src/lib/queries/email/draft-lifecycle-events.ts b/apps/web/src/lib/queries/email/draft-lifecycle-events.tsindex f2bc7ad86b..30da80ffcf 100644--- a/apps/web/src/lib/queries/email/draft-lifecycle-events.ts+++ b/apps/web/src/lib/queries/email/draft-lifecycle-events.ts@@ -4,6 +4,12 @@ export type DraftLifecycleChange = {draftId: string;inboxId?: string;changedAt: number;+ restoration?: {+ originalDraftId: string;+ threadId: string;+ replyingToId?: string | null;+ includeSignature?: boolean | null;+ };};const lifecycleBus = createCrossTabBus<DraftLifecycleChange>({@@ -19,10 +25,23 @@ const lifecycleBus = createCrossTabBus<DraftLifecycleChange>({) {return null;}+ const restoration = candidate.restoration;+ if (+ restoration !== undefined &&+ (typeof restoration !== 'object' ||+ restoration === null ||+ typeof restoration.originalDraftId !== 'string' ||+ typeof restoration.threadId !== 'string' ||+ (restoration.replyingToId != null &&+ typeof restoration.replyingToId !== 'string') ||+ (restoration.includeSignature != null &&+ typeof restoration.includeSignature !== 'boolean'))+ )+ return null;return candidate as DraftLifecycleChange;},getMessageKey: (message) =>- `${message.draftId}:${message.inboxId ?? ''}:${message.changedAt}`,+ `${message.draftId}:${message.inboxId ?? ''}:${message.changedAt}:${message.restoration ? 'restored' : 'changed'}`,});export function publishDraftLifecycleChange(@@ -32,6 +51,15 @@ export function publishDraftLifecycleChange(lifecycleBus.publish({ draftId, inboxId, changedAt: Date.now() });}+/** Only identity is broadcast; mounted editors reread the restored durable draft. */+export function publishDraftRestoration(+ change: Omit<DraftLifecycleChange, 'changedAt'> & {+ restoration: NonNullable<DraftLifecycleChange['restoration']>;+ }+): void {+ lifecycleBus.publish({ ...change, changedAt: Date.now() });+}+export function subscribeToDraftLifecycleChanges(listener: (change: DraftLifecycleChange) => void): VoidFunction {diff --git a/apps/web/src/lib/queries/email/draft-queue.test.ts b/apps/web/src/lib/queries/email/draft-queue.test.tsindex 48f80ea071..150ab58105 100644--- a/apps/web/src/lib/queries/email/draft-queue.test.ts+++ b/apps/web/src/lib/queries/email/draft-queue.test.ts@@ -419,8 +419,50 @@ it('does not reopen unsynced content over an authoritative sent record', async (const { draftResult } = await setup();const cached = draftResult();cached.records[0].record.isDraft = false;+ cached.records[0].record.isSent = true;vi.mocked(readLocalDraft).mockResolvedValue(workingCopy('failed'));mocks.readRecordsByKeys.mockResolvedValue(cached);expect((await readEmailDraft(serverId))?.draft).toBeUndefined();expect(restoreLocalAttachments).not.toHaveBeenCalled();});++it('reads a restored generation over an older accepted cache record', async () => {+ const { draftResult } = await setup();+ const cached = draftResult();+ cached.records[0].record.isDraft = false;+ cached.records[0].record.isSent = false;+ cached.records[0].record.draftGeneration = 1;+ const local = workingCopy('dirty');+ local.content.draft_generation = 2;+ vi.mocked(readLocalDraft).mockResolvedValue(local);+ mocks.readRecordsByKeys.mockResolvedValue(cached);+ expect(await readEmailDraft(serverId)).toMatchObject({ local });+ expect(localDraftMessage).toHaveBeenCalledWith(local);+ expect(restoreLocalAttachments).toHaveBeenCalledWith(local);+});++it('keeps a newer server send authoritative over a restored working copy', async () => {+ const { draftResult } = await setup();+ const cached = draftResult();+ cached.records[0].record.isDraft = false;+ cached.records[0].record.isSent = true;+ cached.records[0].record.draftGeneration = 3;+ const local = workingCopy('dirty');+ local.content.draft_generation = 2;+ vi.mocked(readLocalDraft).mockResolvedValue(local);+ mocks.readRecordsByKeys.mockResolvedValue(cached);+ expect((await readEmailDraft(serverId))?.draft).toBeUndefined();+ expect(restoreLocalAttachments).not.toHaveBeenCalled();+});++it('returns the working copy when cache initialization fails during the status read', async () => {+ await setup();+ const local = workingCopy('dirty');+ vi.mocked(readLocalDraft).mockResolvedValue(local);+ mocks.readRecordsByKeys.mockRejectedValue(+ new Error('cache bootstrap failed')+ );+ expect(await readEmailDraft(serverId, { attachments: false })).toMatchObject({+ local,+ });+});diff --git a/apps/web/src/lib/queries/email/draft-queue.ts b/apps/web/src/lib/queries/email/draft-queue.tsindex c90ccd766d..2f993a79d3 100644--- a/apps/web/src/lib/queries/email/draft-queue.ts+++ b/apps/web/src/lib/queries/email/draft-queue.ts@@ -18,8 +18,11 @@ import {getGraphqlCacheHost,getGraphqlSoupClient,graphqlCacheEnabled,+ graphqlCacheRecoveryState,graphqlDraftQueueBlocked,+ retryGraphqlCacheInitialization,} from '@service-storage/graphql-soup';+import { ResultAsync } from 'neverthrow';import { queryClient } from '../client';import {invalidateAllSoup,@@ -44,10 +47,22 @@ import {markDraftAttemptQueued,readLocalDraft,restoreLocalAttachments,+ resumeLocalDraft,} from './local-drafts';import { fetchAndCacheThread, type ThreadQueryTransport } from './thread';-export { assertEmailDraftQueueAvailable };+export {+ assertEmailDraftQueueAvailable,+ graphqlCacheRecoveryState,+ retryGraphqlCacheInitialization as recoverDraftSynchronization,+};++export async function retryEmailDraftSynchronization(+ id: string+): Promise<void> {+ await retryGraphqlCacheInitialization();+ await resumeLocalDraft(id);+}/** Read content and persistence state together, including resolved local handles. */export async function readEmailDraft(@@ -56,19 +71,29 @@ export async function readEmailDraft() {const local = await readLocalDraft(draftId);const host = getGraphqlCacheHost();- const result = host- ? await readRecordsByKeys(- host,- selectRecords(EmailThreadMessageFieldsFragmentDoc),- [`GraphqlSoupEmailMessage:${local?.serverDraftId ?? draftId}`]+ const cached = host+ ? await ResultAsync.fromPromise(+ readRecordsByKeys(+ host,+ selectRecords(EmailThreadMessageFieldsFragmentDoc),+ [`GraphqlSoupEmailMessage:${local?.serverDraftId ?? draftId}`]+ ),+ (error: unknown) => error): undefined;- const selected = result?.records[0];- // A confirmed sent record always wins. A fully synced working copy must- // also yield to newer server content, attachments, and scheduling state.+ // The independent working copy remains readable when cache startup fails.+ // Without one, preserve the read error rather than inventing an empty draft.+ if (cached?.isErr() && !local) throw cached.error;+ const selected = cached?.isOk() ? cached.value.records[0] : undefined;+ // Cancellation advances the server generation before restoring the local copy.+ // An older accepted/sent cache record must not hide that restored draft.+ // At the same or newer generation, server delivery state remains authoritative.if (selected &&- (!selected.record.isDraft || !local || local.status === 'synced')+ (!local ||+ ((selected.record.draftGeneration ?? 0) >=+ (local.content.draft_generation ?? 0) &&+ (!selected.record.isDraft || local.status === 'synced')))) {return {draft: selected.record.isDraft@@ -220,7 +245,7 @@ function rejection(const SNAPSHOT_READ_ATTEMPTS = 3;/** The draft and thread records a queued write rebases onto, when cached. */-async function readCachedDraftAndThread(+export async function readCachedDraftAndThread(draftId: string,threadId: string): Promise<@@ -251,12 +276,13 @@ async function readCachedDraftAndThread(),]);if (draft.revision !== thread.revision) continue;+ const mutationUuid = draft.records[0]?.identity?.mutationUuid;return {draftId: draft.records[0]?.record.id ?? draftId,threadDbId: thread.records[0]?.record.id ?? threadId,existingDraft: draft.records[0]?.record,existingThread: thread.records[0]?.record,- mutationUuid: draft.records[0]?.identity?.mutationUuid ?? undefined,+ mutationUuid: mutationUuid ?? undefined,};}throw new Error('Email draft cache kept changing; retry the draft write');@@ -290,8 +316,8 @@ export async function saveEmailDraftQueued(input: {...cached,...(local ? { draftId: local.draftId, clientMetadata: attempt } : {}),mutationUuid:- cached.mutationUuid ??input.args.mutationUuid ??+ cached.mutationUuid ??String(input.args.draftId),});if (outcome.kind === 'failed') {@@ -341,6 +367,7 @@ export async function saveEmailDraftQueued(input: {/** Deletes over the queue; a commit mirrors useDeleteDraftMutation's cache effects. */export async function deleteEmailDraftQueued(input: {+ draftGeneration?: number;draftId: string;threadId: string;completingThread?: boolean;@@ -357,6 +384,11 @@ export async function deleteEmailDraftQueued(input: {mutationUuid: cached.mutationUuid ?? input.draftId,draftId: local?.draftId ?? String(cached.draftId),clientMetadata: attempt,+ draftGeneration:+ input.draftGeneration ??+ local?.content.draft_generation ??+ cached.existingDraft?.draftGeneration ??+ 0,threadDbId: cached.threadDbId,});if (outcome.kind === 'failed') {diff --git a/apps/web/src/lib/queries/email/draft.ts b/apps/web/src/lib/queries/email/draft.tsindex fd7b65e68a..b410b4d410 100644--- a/apps/web/src/lib/queries/email/draft.ts+++ b/apps/web/src/lib/queries/email/draft.ts@@ -68,6 +68,7 @@ export function useSaveDraftMutation(type DeleteDraftParams = {draftId: string;+ draftGeneration?: number;/** Thread the draft belonged to, refetched so it leaves the drafts tab. */threadId?: string;/** Target inbox for a non-primary inbox; sent as the X-Email-Link-Id header. */@@ -86,7 +87,10 @@ export function useDeleteDraftMutation(mutationFn: async (vars: DeleteDraftParams) => {await throwOnErr(async () =>- await emailClient.deleteDraft({ id: vars.draftId }, vars.linkId)+ await emailClient.deleteDraft(+ { id: vars.draftId, draftGeneration: vars.draftGeneration },+ vars.linkId+ ));},...withCallbacks<void, Error, DeleteDraftParams>(@@ -132,6 +136,7 @@ export function useDeleteDraftMutation(export async function transferEmailDraft(input: {operationId: string;draftId: string;+ draftGeneration?: number;sourceInboxId: string;destinationInboxId: string;}) {@@ -142,6 +147,7 @@ export async function transferEmailDraft(input: {input.draftId,{operation_id: input.operationId,+ draft_generation: input.draftGeneration ?? 0,destination_link_id: input.destinationInboxId,},input.sourceInboxIddiff --git a/apps/web/src/lib/queries/email/email-send-dispatcher.test.ts b/apps/web/src/lib/queries/email/email-send-dispatcher.test.tsnew file mode 100644index 0000000000..60ed53912d--- /dev/null+++ b/apps/web/src/lib/queries/email/email-send-dispatcher.test.ts@@ -0,0 +1,685 @@+import 'fake-indexeddb/auto';+import type { EmailSendAttemptFieldsFragment } from '@service-storage/graphql/generated/graphql';+import { CombinedError } from '@urql/core';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { createEmailSendDispatcher } from './email-send-dispatcher';+import { createLocalDraftStore } from './local-draft-store';+import type { EmailSendIntent } from './send-intent';++const stores: ReturnType<typeof createLocalDraftStore>[] = [];+const runners: ReturnType<typeof createEmailSendDispatcher>[] = [];+const accepted: EmailSendAttemptFieldsFragment = {+ attemptId: 'attempt',+ status: 'ACCEPTED',+ message: null,+ threadId: 'thread',+ sendTime: '2026-10-20T20:00:00Z',+};+const intent = (id = 'attempt'): EmailSendIntent => ({+ uuid: id,+ dispatchVersion: 2,+ phase: 'pending',+ locallyCancelled: false,+ metadata: {+ kind: 'email-send-v1',+ payload: {+ input: {+ attempt: { attemptId: id, linkId: 'inbox' },+ message: {+ draftId: `draft-${id}`,+ subject: 'Approved',+ bodyText: 'Exact content',+ },+ attachmentIds: [],+ forwardedAttachmentIds: [],+ },+ draft: {+ draftId: `draft-${id}`,+ threadDbId: 'thread',+ subject: 'Approved',+ senderEmail: '[email protected]',+ senderLinkId: 'inbox',+ optimisticBodyHtml: null,+ },+ },+ },+});+async function setup() {+ const journal = createLocalDraftStore(crypto.randomUUID());+ stores.push(journal);+ const session = await journal.activate('owner');+ return { journal, session };+}+function run(options: Parameters<typeof createEmailSendDispatcher>[0]) {+ const runner = createEmailSendDispatcher(options);+ runners.push(runner);+ return runner;+}+beforeEach(() => {+ vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout', 'Date'] });+ vi.setSystemTime(new Date('2026-10-20T19:00:00Z'));+ vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(true);+});+afterEach(async () => {+ for (const runner of runners.splice(0)) runner.dispose();+ for (const store of stores.splice(0)) await store.close();+ vi.useRealTimers();+ vi.restoreAllMocks();+});++describe('independent email dispatch', () => {+ it.each(['INBOX_NOT_FOUND', 'FORBIDDEN'])(+ 'restores a first submission rejected with %s without inaccessible server cancellation',+ async (code) => {+ const storage = await setup();+ const original = await storage.journal.putSend(+ storage.session,+ intent(),+ true+ );+ const cancel = vi.fn();+ const submit = vi.fn(async () => {+ throw new CombinedError({+ graphQLErrors: [+ { message: 'Inbox unavailable', extensions: { code } },+ ],+ });+ });+ const runner = run({+ ...storage,+ submit,+ cancel,+ status: vi.fn(),+ report: vi.fn(),+ });+ await runner.wake();+ // A stale composer callback cannot restore the old confirmation requirement.+ await storage.journal.putSend(storage.session, {+ ...original,+ cancellationRequested: true,+ });+ await runner.wake();+ expect((await storage.journal.sends(storage.session))[0]).toMatchObject({+ locallyCancelled: true,+ metadata: { requiresServerConfirmation: false },+ });+ const restored = await storage.journal.restoreSend(+ storage.session,+ original.uuid+ );+ expect(restored?.draft.content.subject).toBe('Approved');+ expect(await storage.journal.sends(storage.session)).toEqual([]);+ expect(submit).toHaveBeenCalledTimes(1);+ expect(cancel).not.toHaveBeenCalled();+ }+ );++ it('keeps an inbox rejection after a lost response locked until server confirmation', async () => {+ const storage = await setup();+ await storage.journal.putSend(storage.session, intent(), true);+ const first = run({+ ...storage,+ submit: async () => {+ throw new Error('Response lost');+ },+ cancel: vi.fn(),+ status: vi.fn(),+ report: vi.fn(),+ });+ await first.wake();+ first.dispose();+ vi.setSystemTime(Date.now() + 31_000);+ const denied = async () => {+ throw new CombinedError({+ graphQLErrors: [+ {+ message: 'Inbox unavailable',+ extensions: { code: 'INBOX_NOT_FOUND' },+ },+ ],+ });+ };+ const submit = vi.fn();+ const second = run({+ ...storage,+ submit,+ status: denied,+ cancel: denied,+ report: vi.fn(),+ });+ await second.wake();+ const row = (await storage.journal.sends(storage.session))[0];+ await storage.journal.putSend(storage.session, {+ ...row,+ cancellationRequested: true,+ });+ await second.wake();+ expect(submit).not.toHaveBeenCalled();+ await expect(+ storage.journal.restoreSend(storage.session, row.uuid)+ ).rejects.toThrow('Confirm cancellation');+ expect((await storage.journal.sends(storage.session))[0]).toMatchObject({+ locallyCancelled: false,+ metadata: { requiresServerConfirmation: true },+ });+ });++ it('submits a durable intent without a cache or mounted composer', async () => {+ const storage = await setup();+ await storage.journal.putSend(storage.session, intent(), true);+ const submit = vi.fn(async (row: EmailSendIntent) => {+ expect(+ (await storage.journal.sends(storage.session))[0].submissionStarted+ ).toBe(true);+ expect(row.metadata.payload.input.message.bodyText).toBe('Exact content');+ return accepted;+ });+ const status = vi.fn(async () => null);+ const runner = run({+ ...storage,+ submit,+ status,+ cancel: vi.fn(),+ report: vi.fn(),+ });+ await runner.wake();+ expect(submit).toHaveBeenCalledTimes(1);+ expect(status).not.toHaveBeenCalled();+ expect((await storage.journal.sends(storage.session))[0]).toMatchObject({+ phase: 'committed',+ response: { sendEmailMessage: { attempt: accepted } },+ });+ });++ it('recovers a lost acceptance response after restart without a second submission', async () => {+ const storage = await setup();+ await storage.journal.putSend(storage.session, intent(), true);+ const submit = vi.fn(async () => {+ throw new Error('Response lost after commit');+ });+ const status = vi.fn(async () => accepted);+ const first = run({+ ...storage,+ submit,+ status,+ cancel: vi.fn(),+ report: vi.fn(),+ });+ await first.wake();+ first.dispose();+ vi.setSystemTime(Date.now() + 31_000);+ const second = run({+ ...storage,+ submit,+ status,+ cancel: vi.fn(),+ report: vi.fn(),+ });+ await second.wake();+ expect(submit).toHaveBeenCalledTimes(1);+ expect(status).toHaveBeenCalledTimes(1);+ expect((await storage.journal.sends(storage.session))[0].phase).toBe(+ 'committed'+ );+ });++ it('cancels before the submission claim without sending any HTTP', async () => {+ const storage = await setup();+ const row = await storage.journal.putSend(storage.session, intent(), true);+ await storage.journal.putSend(storage.session, {+ ...row,+ cancellationRequested: true,+ });+ const submit = vi.fn();+ const cancel = vi.fn();+ const runner = run({+ ...storage,+ submit,+ cancel,+ status: vi.fn(),+ report: vi.fn(),+ });+ await runner.wake();+ expect(submit).not.toHaveBeenCalled();+ expect(cancel).not.toHaveBeenCalled();+ expect(+ (await storage.journal.sends(storage.session))[0].locallyCancelled+ ).toBe(true);+ });++ it('preserves cancellation requested during submission and dispatches it immediately after acceptance', async () => {+ const storage = await setup();+ await storage.journal.putSend(storage.session, intent(), true);+ const started = Promise.withResolvers<void>();+ const response = Promise.withResolvers<EmailSendAttemptFieldsFragment>();+ const submit = vi.fn(() => {+ started.resolve();+ return response.promise;+ });+ const cancel = vi.fn(async () => ({+ ...accepted,+ status: 'CANCELLED' as const,+ }));+ const runner = run({+ ...storage,+ submit,+ cancel,+ status: vi.fn(),+ report: vi.fn(),+ });+ await started.promise;+ const row = (await storage.journal.sends(storage.session))[0];+ await storage.journal.putSend(storage.session, {+ ...row,+ cancellationRequested: true,+ });+ response.resolve(accepted);+ await runner.wake();+ await runner.wake();+ expect(submit).toHaveBeenCalledTimes(1);+ expect(cancel).toHaveBeenCalledTimes(1);+ expect((await storage.journal.sends(storage.session))[0]).toMatchObject({+ cancellationRequested: true,+ response: { sendEmailMessage: { attempt: { status: 'CANCELLED' } } },+ });+ });++ it('does not let a stalled submission block an unrelated draft', async () => {+ const storage = await setup();+ await storage.journal.putSend(storage.session, intent('slow'), true);+ await storage.journal.putSend(storage.session, intent('fast'), true);+ const slow = Promise.withResolvers<EmailSendAttemptFieldsFragment>();+ const fast = Promise.withResolvers<void>();+ const runner = run({+ ...storage,+ submit: async (row) =>+ row.uuid === 'slow' ? slow.promise : { ...accepted, attemptId: 'fast' },+ cancel: vi.fn(),+ status: vi.fn(),+ report: (row) => {+ if (row.uuid === 'fast') fast.resolve();+ },+ });+ await fast.promise;+ expect(+ (await storage.journal.sends(storage.session)).find(+ (row) => row.uuid === 'fast'+ )?.phase+ ).toBe('committed');+ slow.resolve({ ...accepted, attemptId: 'slow' });+ await runner.wake();+ });++ it('reconciles an uncertain provider outcome without resubmitting', async () => {+ const storage = await setup();+ const row = await storage.journal.putSend(storage.session, intent(), true);+ const claim = await storage.journal.claimSend(+ storage.session,+ row.uuid,+ 'old',+ Date.now()+ );+ await storage.journal.settleSend(+ storage.session,+ row.uuid,+ 'old',+ claim!.dispatch!.generation,+ {+ attempt: { ...accepted, status: 'DELIVERY_UNCONFIRMED' },+ nextAttemptAt: 0,+ }+ );+ const submit = vi.fn();+ const status = vi.fn(async () => ({+ ...accepted,+ status: 'SENT' as const,+ }));+ const runner = run({+ ...storage,+ submit,+ status,+ cancel: vi.fn(),+ report: vi.fn(),+ });+ await runner.wake();+ expect(submit).not.toHaveBeenCalled();+ expect(status).toHaveBeenCalledTimes(1);+ expect(+ (await storage.journal.sends(storage.session))[0].response+ ?.sendEmailMessage?.attempt.status+ ).toBe('SENT');+ });+});++describe('email journal authority', () => {+ it('leases work to one tab and fences an expired worker after reclamation', async () => {+ const { journal, session } = await setup();+ await journal.putSend(session, intent(), true);+ const claims = await Promise.all([+ journal.claimSend(session, 'attempt', 'tab-a', Date.now()),+ journal.claimSend(session, 'attempt', 'tab-b', Date.now()),+ ]);+ expect(claims.filter(Boolean)).toHaveLength(1);+ const first = claims.find((claim) => claim !== undefined)!;+ const second = await journal.claimSend(+ session,+ 'attempt',+ 'tab-c',+ Date.now() + 60_001+ );+ expect(+ await journal.settleSend(+ session,+ 'attempt',+ first.dispatch!.owner!,+ first.dispatch!.generation,+ {+ attempt: accepted,+ nextAttemptAt: 0,+ }+ )+ ).toBe(false);+ expect(+ await journal.settleSend(+ session,+ 'attempt',+ 'tab-c',+ second!.dispatch!.generation,+ {+ attempt: accepted,+ nextAttemptAt: 0,+ }+ )+ ).toBe(true);+ });++ it('retains sends across logout but hides them and rejects callbacks in another account', async () => {+ const { journal, session } = await setup();+ await journal.putSend(session, intent(), true);+ const claim = await journal.claimSend(+ session,+ 'attempt',+ 'old',+ Date.now()+ );+ await journal.clear(true, session.epoch);+ const other = await journal.activate('other');+ expect(await journal.sends(other)).toEqual([]);+ expect(+ await journal.settleSend(+ session,+ 'attempt',+ 'old',+ claim!.dispatch!.generation,+ {+ attempt: accepted,+ nextAttemptAt: 0,+ }+ )+ ).toBe(false);+ const returned = await journal.activate('owner', crypto.randomUUID());+ expect((await journal.sends(returned))[0].metadata.payload.input).toEqual(+ intent().metadata.payload.input+ );+ });++ it('rejects changed content under the same attempt and ignores stale observer settlements', async () => {+ const { journal, session } = await setup();+ const row = await journal.putSend(session, intent(), true);+ const changed = structuredClone(row);+ changed.metadata.payload.input.message.bodyText = 'Different content';+ await expect(journal.putSend(session, changed)).rejects.toThrow(+ 'cannot be changed'+ );+ const claim = await journal.claimSend(+ session,+ row.uuid,+ 'worker',+ Date.now()+ );+ await journal.settleSend(+ session,+ row.uuid,+ 'worker',+ claim!.dispatch!.generation,+ {+ attempt: { ...accepted, status: 'SENT' },+ nextAttemptAt: 0,+ }+ );+ await journal.putSend(session, row);+ expect(+ (await journal.sends(session))[0].response?.sendEmailMessage?.attempt+ .status+ ).toBe('SENT');+ });+});++it('restores cancellation and retires authority atomically across tabs', async () => {+ const { journal, session } = await setup();+ const approved = intent();+ approved.metadata.payload.input.restoreBodyText = 'Editable content';+ const row = await journal.putSend(session, approved, true);+ await journal.putSend(session, { ...row, cancellationRequested: true });+ const results = await Promise.all([+ journal.restoreSend(session, row.uuid),+ journal.restoreSend(session, row.uuid),+ ]);+ expect(results.filter(Boolean)).toHaveLength(1);+ const restored = results.find(Boolean)!.draft;+ expect(restored.content.body_text).toBe('Editable content');+ expect(await journal.sends(session)).toEqual([]);+ const edited = await journal.save(session, {+ ...restored,+ expectedRevision: restored.revision,+ content: { ...restored.content, body_text: 'Newer edit after Undo' },+ });+ expect(await journal.restoreSend(session, row.uuid)).toBeUndefined();+ expect(await journal.read(session, restored.key)).toMatchObject(edited);+ await expect(+ journal.putSend(session, { ...row, cancellationRequested: true })+ ).rejects.toThrow('already resolved');+});++it('preserves newer content while fencing its pre-cancellation save callbacks', async () => {+ const { journal, session } = await setup();+ const approved = intent();+ const key = String(approved.metadata.payload.input.message.draftId);+ const generation = await journal.generation(session, key);+ const local = await journal.save(session, {+ key,+ draftId: key,+ threadId: 'thread',+ accountId: session.accountId,+ generation,+ content: { subject: 'Newer subject', body_text: 'Keep my edits' },+ attachments: [],+ status: 'dirty',+ expectedRevision: 0,+ });+ const row = await journal.putSend(session, approved, true);+ await journal.putSend(session, { ...row, cancellationRequested: true });+ await journal.update(session, key, (copy) => ({+ ...copy,+ status: 'queued',+ latestAttemptId: 'new-save',+ }));+ const restored = (await journal.restoreSend(session, row.uuid))!.draft;+ expect(restored).toMatchObject({+ status: 'dirty',+ latestAttemptId: undefined,+ content: local.content,+ });+ expect(restored.generation).not.toBe(local.generation);+});++it('continues valid sends while preserving an unsupported journal version', async () => {+ const storage = await setup();+ const future = {+ ...intent('future'),+ dispatchVersion: 99,+ } as unknown as EmailSendIntent;+ await storage.journal.putSend(storage.session, future, true);+ await storage.journal.putSend(storage.session, intent(), true);+ const submit = vi.fn(async () => accepted);+ const runner = run({+ ...storage,+ submit,+ cancel: vi.fn(),+ status: vi.fn(),+ report: vi.fn(),+ });+ await runner.wake();+ expect(submit).toHaveBeenCalledTimes(1);+ expect(+ (await storage.journal.sends(storage.session)).find(+ (row) => row.uuid === 'future'+ )+ ).toMatchObject({ dispatchVersion: 99, submissionStarted: undefined });+});++it('reserves unsupported sends against a second approval of the same draft', async () => {+ const { journal, session } = await setup();+ const future = {+ ...intent('future'),+ dispatchVersion: 99,+ } as unknown as EmailSendIntent;+ await journal.putSend(session, future, true);+ const duplicate = intent('duplicate');+ duplicate.metadata.payload.input.message.draftId =+ future.metadata.payload.input.message.draftId;+ await expect(journal.putSend(session, duplicate, true)).rejects.toThrow(+ 'already queued'+ );+});++it('quarantines a malformed response without blocking unrelated dispatch', async () => {+ const storage = await setup();+ const damaged = intent('damaged');+ damaged.response = { sendEmailMessage: {} } as EmailSendIntent['response'];+ await storage.journal.putSend(storage.session, damaged, true);+ await storage.journal.putSend(storage.session, intent(), true);+ const submit = vi.fn(async () => accepted);+ await run({+ ...storage,+ submit,+ status: vi.fn(),+ cancel: vi.fn(),+ report: vi.fn(),+ }).wake();+ expect(submit).toHaveBeenCalledTimes(1);+ expect(+ (await storage.journal.sends(storage.session)).some(+ (row) => row.uuid === 'damaged'+ )+ ).toBe(true);+});++it('uses a free network slot for a new approval while an earlier request is stalled', async () => {+ const storage = await setup();+ await storage.journal.putSend(storage.session, intent('slow'), true);+ const started = Promise.withResolvers<void>();+ const slow = Promise.withResolvers<EmailSendAttemptFieldsFragment>();+ const fast = Promise.withResolvers<void>();+ const runner = run({+ ...storage,+ status: vi.fn(),+ cancel: vi.fn(),+ submit: async (row) => {+ if (row.uuid === 'slow') {+ started.resolve();+ return slow.promise;+ }+ return { ...accepted, attemptId: row.uuid };+ },+ report: (row) => {+ if (row.uuid === 'later') fast.resolve();+ },+ });+ await started.promise;+ await storage.journal.putSend(storage.session, intent('later'), true);+ await fast.promise;+ expect(+ (await storage.journal.sends(storage.session)).find(+ (row) => row.uuid === 'later'+ )?.phase+ ).toBe('committed');+ slow.resolve({ ...accepted, attemptId: 'slow' });+ await runner.wake();+});++it.each(['network', 'nested', 'mixed'])(+ 'does not treat %s errors as definitive admission rejection',+ async (kind) => {+ const storage = await setup();+ await storage.journal.putSend(storage.session, intent(), true);+ const error = new CombinedError({+ networkError:+ kind === 'network' ? new Error('Connection lost') : undefined,+ graphQLErrors: [+ {+ message: 'Denied',+ extensions: { code: 'FORBIDDEN' },+ path:+ kind === 'nested'+ ? ['sendEmailMessage', 'attempt', 'message']+ : ['sendEmailMessage'],+ },+ ...(kind === 'mixed'+ ? [{ message: 'Internal failure', extensions: { code: 'INTERNAL' } }]+ : []),+ ],+ });+ const runner = run({+ ...storage,+ submit: async () => {+ throw error;+ },+ cancel: vi.fn(),+ status: vi.fn(),+ report: vi.fn(),+ });+ await runner.wake();+ expect(+ (await storage.journal.sends(storage.session))[0].locallyCancelled+ ).toBe(false);+ await expect(+ storage.journal.restoreSend(storage.session, 'attempt')+ ).rejects.toThrow('Confirm cancellation');+ }+);++it('cannot unlock a newer submission with an expired first-claim rejection', async () => {+ const { journal, session } = await setup();+ await journal.putSend(session, intent(), true);+ await journal.claimSend(session, 'attempt', 'first', Date.now());+ const second = await journal.claimSend(+ session,+ 'attempt',+ 'second',+ Date.now() + 60_001+ );+ expect(+ await journal.settleSend(session, 'attempt', 'first', 1, {+ rejectedBeforeAdmission: true,+ failed: true,+ nextAttemptAt: 0,+ })+ ).toBe(false);+ expect(+ await journal.settleSend(+ session,+ 'attempt',+ 'second',+ second!.dispatch!.generation,+ {+ attempt: accepted,+ nextAttemptAt: 0,+ }+ )+ ).toBe(true);+ expect((await journal.sends(session))[0].locallyCancelled).toBe(false);+ await expect(journal.restoreSend(session, 'attempt')).rejects.toThrow(+ 'Confirm cancellation'+ );+});diff --git a/apps/web/src/lib/queries/email/email-send-dispatcher.ts b/apps/web/src/lib/queries/email/email-send-dispatcher.tsnew file mode 100644index 0000000000..472f756969--- /dev/null+++ b/apps/web/src/lib/queries/email/email-send-dispatcher.ts@@ -0,0 +1,233 @@+import { fireAndForget } from '@core/util/fireAndForget';+import type { EmailSendAttemptFieldsFragment } from '@service-storage/graphql/generated/graphql';+import { CombinedError } from '@urql/core';+import type {+ createLocalDraftStore,+ DraftStorageSession,+} from './local-draft-store';+import { type EmailSendIntent, usableEmailSendIntents } from './send-intent';++type Journal = Pick<+ ReturnType<typeof createLocalDraftStore>,+ 'sends' | 'claimSend' | 'settleSend' | 'subscribe'+>;++/** One authenticated account owns this runner. Database leases coordinate tabs. */+export function createEmailSendDispatcher(options: {+ session: DraftStorageSession;+ journal: Journal;+ submit(+ intent: EmailSendIntent,+ signal: AbortSignal+ ): Promise<EmailSendAttemptFieldsFragment>;+ cancel(+ intent: EmailSendIntent,+ signal: AbortSignal+ ): Promise<EmailSendAttemptFieldsFragment>;+ status(+ intent: EmailSendIntent,+ signal: AbortSignal+ ): Promise<EmailSendAttemptFieldsFragment | null>;+ report(intent: EmailSendIntent, error?: unknown): void;+}) {+ const worker = crypto.randomUUID();+ const controllers = new Set<AbortController>();+ const inFlight = new Map<string, Promise<void>>();+ let disposed = false;+ let running: Promise<void> | undefined;+ let rerun = false;+ let timer: ReturnType<typeof setTimeout> | undefined;+ const active = (row: EmailSendIntent) => {+ const status =+ row.response?.cancelEmailSend?.attempt.status ??+ row.response?.sendEmailMessage?.attempt.status;+ return (+ !row.dispatch?.paused &&+ !row.locallyCancelled &&+ status !== 'SENT' &&+ status !== 'CANCELLED' &&+ (row.cancellationRequested ||+ (row.phase !== 'failed' && status !== 'FAILED'))+ );+ };+ async function dispatch(row: EmailSendIntent) {+ const claimed = await options.journal.claimSend(+ options.session,+ row.uuid,+ worker,+ Date.now()+ );+ if (!claimed?.dispatch || disposed) return;+ const controller = new AbortController();+ controllers.add(controller);+ const timeout = setTimeout(() => controller.abort(), 15_000);+ const leaseGeneration = claimed.dispatch.generation;+ try {+ let attempt: EmailSendAttemptFieldsFragment | null;+ if (claimed.cancellationRequested) {+ attempt = await options.cancel(claimed, controller.signal);+ } else if (row.submissionStarted || row.phase === 'committed') {+ attempt = await options.status(claimed, controller.signal);+ if (!attempt && row.phase !== 'committed')+ attempt = await options.submit(claimed, controller.signal);+ if (!attempt)+ throw new Error('Server acceptance could not be confirmed');+ } else {+ attempt = await options.submit(claimed, controller.signal);+ }+ if (disposed) return;+ await options.journal.settleSend(+ options.session,+ row.uuid,+ worker,+ leaseGeneration,+ {+ attempt,+ nextAttemptAt: Date.now() + 5_000,+ }+ );+ options.report(claimed);+ } catch (error) {+ if (disposed) return;+ const codes =+ error instanceof CombinedError+ ? error.graphQLErrors.map((entry) => entry.extensions.code)+ : [];+ const rejected = codes.some((code) =>+ [+ 'INVALID',+ 'INVALID_SENDER',+ 'SEND_ATTEMPT_CONFLICT',+ 'DRAFT_ALREADY_SENT',+ 'DRAFT_VERSION_CONFLICT',+ 'NOT_FOUND',+ 'INBOX_NOT_FOUND',+ 'FORBIDDEN',+ ].includes(String(code))+ );+ const needsAuthentication =+ codes.some((code) =>+ ['UNAUTHENTICATED', 'UNAUTHORIZED', 'NEEDS_REAUTH'].includes(+ String(code)+ )+ ) ||+ (error instanceof CombinedError && error.response?.status === 401);+ const backoff = Math.min(+ 30_000,+ 1_000 * 2 ** Math.min(claimed.dispatch.failures, 5)+ );+ const retryAfter =+ error instanceof CombinedError+ ? Number(error.response?.headers.get('retry-after')) * 1_000+ : 0;+ await options.journal.settleSend(+ options.session,+ row.uuid,+ worker,+ leaseGeneration,+ {+ failed: rejected && !claimed.cancellationRequested,+ // Only the first exclusive submission can prove that no earlier+ // request was accepted. A status rejection after a timeout cannot.+ rejectedBeforeAdmission:+ claimed.dispatchVersion === 2 &&+ leaseGeneration === 1 &&+ !row.submissionStarted &&+ row.phase !== 'committed' &&+ !claimed.cancellationRequested &&+ error instanceof CombinedError &&+ !error.networkError &&+ error.graphQLErrors.every(+ (entry) =>+ !entry.path ||+ (entry.path.length === 1 &&+ entry.path[0] === 'sendEmailMessage')+ ) &&+ codes.length > 0 &&+ codes.every((code) =>+ ['INBOX_NOT_FOUND', 'FORBIDDEN'].includes(String(code))+ ),+ paused: needsAuthentication,+ error: needsAuthentication+ ? 'Reconnect your email account, then check status to resume.'+ : rejected+ ? 'Review this message before sending again.'+ : 'Waiting to confirm server acceptance.',+ nextAttemptAt:+ Date.now() ++ Math.max(retryAfter || 0, backoff * (0.8 + Math.random() * 0.4)),+ }+ );+ options.report(claimed, error);+ } finally {+ clearTimeout(timeout);+ controllers.delete(controller);+ }+ }+ async function run() {+ try {+ const rows = usableEmailSendIntents(+ await options.journal.sends(options.session)+ ).filter(active);+ if (disposed) return;+ const now = Date.now();+ const due = rows.filter(+ (row) =>+ !inFlight.has(row.uuid) &&+ (row.dispatch?.leaseUntil ?? 0) <= now &&+ (row.dispatch?.nextAttemptAt ?? 0) <= now+ );+ // The journal also reserves each draft; unrelated drafts never share a+ // head-of-line queue. Limit concurrent HTTP work rather than ordering it.+ for (const row of due.slice(0, Math.max(0, 4 - inFlight.size))) {+ const task = dispatch(row).finally(() => {+ inFlight.delete(row.uuid);+ schedule();+ });+ inFlight.set(row.uuid, task);+ fireAndForget(task, 'email-outbox-attempt');+ }+ } finally {+ running = undefined;+ if (!disposed) {+ timer = setTimeout(schedule, rerun ? 0 : 1_000);+ rerun = false;+ }+ }+ }+ function wake() {+ if (disposed || navigator.onLine === false) return;+ if (timer !== undefined) clearTimeout(timer);+ if (running) rerun = true;+ else running = run();+ // Scan ownership ends before HTTP completes, so a newly approved message+ // can use a free slot while another request is slow. Await current work for+ // explicit callers; event-driven wakeups remain non-blocking.+ const completion = running.then(async () => {+ await Promise.allSettled([...inFlight.values()]);+ });+ return completion;+ }+ function schedule() {+ const completion = wake();+ if (completion) fireAndForget(completion, 'email-outbox');+ }+ const visibility = () => {+ if (document.visibilityState === 'visible') schedule();+ };+ const unsubscribe = options.journal.subscribe(schedule);+ window.addEventListener('online', schedule);+ document.addEventListener('visibilitychange', visibility);+ schedule();+ return {+ wake,+ dispose() {+ disposed = true;+ if (timer !== undefined) clearTimeout(timer);+ unsubscribe();+ window.removeEventListener('online', schedule);+ document.removeEventListener('visibilitychange', visibility);+ for (const controller of controllers) controller.abort();+ },+ };+}diff --git a/apps/web/src/lib/queries/email/email-send-journal.ts b/apps/web/src/lib/queries/email/email-send-journal.tsnew file mode 100644index 0000000000..cd6fe68660--- /dev/null+++ b/apps/web/src/lib/queries/email/email-send-journal.ts@@ -0,0 +1,448 @@+import type { LocalDraft } from '@app/features/email-compose/core/local-draft';+import { deepEqual } from '@core/util/compareUtils';+import type { EmailSendAttemptFieldsFragment } from '@service-storage/graphql/generated/graphql';+import {+ type RestoredEmailSend,+ restoreEmailSendTransaction,+} from './email-send-restoration';+import type { DraftStorageSession as Session } from './local-draft-store';+import {+ type EmailSendIntent,+ emailSendReservedDraftIds,+ isEmailSendIntent,+} from './send-intent';++export function restoreEmailSendLocks(tx: IDBTransaction, accountId: string) {+ const request = tx.objectStore('sends').getAll();+ request.onsuccess = () => {+ for (const row of request.result as EmailSendIntent[]) {+ if (row?.accountId !== accountId) continue;+ for (const id of emailSendReservedDraftIds(row))+ if (id) tx.objectStore('meta').put(row.uuid, ['send-lock', id]);+ }+ };+}++type Transaction = <T>(+ mode: IDBTransactionMode,+ run: (tx: IDBTransaction, finish: (value: T) => void) => void,+ publish?: boolean+) => Promise<T>;+type WithSession = <T>(+ tx: IDBTransaction,+ session: Session,+ run: () => void,+ finish: (value: T) => void,+ stale: T+) => void;++/** Email-specific transactions share the working-copy database and account fence. */+export function createEmailSendJournal(+ transaction: Transaction,+ withSession: WithSession+) {+ return {+ /** Backup and reservation commit before any send can leave this device. */+ async putSend(+ session: Session,+ intent: EmailSendIntent,+ reserve = false+ ): Promise<EmailSendIntent> {+ const result = await transaction<EmailSendIntent | Error | undefined>(+ 'readwrite',+ (tx, finish) =>+ withSession(+ tx,+ session,+ () => {+ const sends = tx.objectStore('sends');+ const request = sends.getAll();+ request.onsuccess = () => {+ const all = request.result as EmailSendIntent[];+ const previous = all.find((row) => row?.uuid === intent.uuid);+ if (!previous && !reserve) {+ finish(new Error('This send was already resolved'));+ return;+ }+ if (+ (previous && previous.accountId !== session.accountId) ||+ (intent.accountId && intent.accountId !== session.accountId)+ ) {+ finish(new Error('This send belongs to another account'));+ return;+ }+ if (+ previous &&+ !deepEqual(+ previous.metadata.payload.input,+ intent.metadata.payload.input+ )+ ) {+ finish(new Error('Approved send content cannot be changed'));+ return;+ }+ const rows = all.filter(+ (row) => row?.accountId === session.accountId+ );+ const ids = emailSendReservedDraftIds;+ if (+ reserve &&+ rows.some(+ (row) =>+ row.uuid !== intent.uuid &&+ ids(row).some((id) => id && ids(intent).includes(id))+ )+ ) {+ finish(new Error('This draft is already queued for sending'));+ return;+ }+ const persist = () => {+ // A late send settlement must not erase a cancellation or restoration.+ const next = {+ ...intent,+ accountId: session.accountId,+ dispatchVersion:+ previous?.dispatchVersion ?? intent.dispatchVersion,+ submissionStarted:+ previous?.submissionStarted || intent.submissionStarted,+ dispatch: previous?.dispatch ?? intent.dispatch,+ // Only the dispatcher may settle v2 authority. A late+ // composer/status callback cannot regress its response.+ ...(previous+ ? {+ phase: previous.phase,+ response: previous.response,+ resolvedDraftId: previous.resolvedDraftId,+ resolvedThreadId: previous.resolvedThreadId,+ locallyCancelled: previous.locallyCancelled,+ metadata: {+ ...intent.metadata,+ requiresServerConfirmation:+ previous.metadata.requiresServerConfirmation,+ },+ }+ : {}),+ cancellationRequested:+ previous?.cancellationRequested ||+ intent.cancellationRequested,+ };+ if (next.cancellationRequested && !next.submissionStarted) {+ next.locallyCancelled = true;+ next.metadata = {+ ...next.metadata,+ requiresServerConfirmation: false,+ };+ }+ if (+ next.cancellationRequested &&+ !previous?.cancellationRequested &&+ next.dispatch+ ) {+ next.dispatch = { ...next.dispatch, nextAttemptAt: 0 };+ }+ sends.put(next, intent.uuid);+ for (const id of ids(next))+ if (id)+ tx.objectStore('meta').put(intent.uuid, [+ 'send-lock',+ id,+ ]);+ finish(next);+ };+ const copy = intent.metadata.payload.workingCopy;+ if (!reserve || !copy) {+ persist();+ return;+ }+ const draft = tx.objectStore('drafts').get(copy.key);+ draft.onsuccess = () => {+ const current = draft.result as LocalDraft | undefined;+ if (+ !current ||+ current.generation !== copy.generation ||+ current.revision !== copy.revision+ ) {+ finish(+ new Error('This draft changed while preparing the send')+ );+ return;+ }+ persist();+ };+ };+ },+ finish,+ new Error('This draft session is no longer active')+ )+ );+ if (result instanceof Error) throw result;+ if (!result) throw new Error('This draft session is no longer active');+ return result;+ },+ async requestSendCheck(session: Session, uuid: string): Promise<void> {+ await transaction<void>('readwrite', (tx, finish) =>+ withSession(+ tx,+ session,+ () => {+ const sends = tx.objectStore('sends');+ const request = sends.get(uuid);+ request.onsuccess = () => {+ const row = request.result as EmailSendIntent | undefined;+ if (row?.accountId === session.accountId && row.dispatch) {+ sends.put(+ {+ ...row,+ phase:+ row.phase === 'failed' && !row.response+ ? 'pending'+ : row.phase,+ dispatch: {+ ...row.dispatch,+ nextAttemptAt: 0,+ paused: false,+ },+ },+ uuid+ );+ }+ finish();+ };+ },+ finish,+ undefined+ )+ );+ },+ async restoreSend(+ session: Session,+ uuid: string+ ): Promise<RestoredEmailSend | undefined> {+ const result = await transaction<RestoredEmailSend | Error | undefined>(+ 'readwrite',+ (tx, finish) =>+ withSession(+ tx,+ session,+ () => restoreEmailSendTransaction(tx, session, uuid, finish),+ finish,+ undefined+ )+ );+ if (result instanceof Error) throw result;+ return result;+ },+ /** Claim and persist the submission boundary before any HTTP can start. */+ async claimSend(+ session: Session,+ uuid: string,+ worker: string,+ now: number+ ): Promise<EmailSendIntent | undefined> {+ return await transaction(+ 'readwrite',+ (tx, finish) =>+ withSession(+ tx,+ session,+ () => {+ const sends = tx.objectStore('sends');+ const request = sends.get(uuid);+ request.onsuccess = () => {+ const row = request.result as EmailSendIntent | undefined;+ const status =+ row?.response?.cancelEmailSend?.attempt.status ??+ row?.response?.sendEmailMessage?.attempt.status;+ if (+ !row ||+ row.accountId !== session.accountId ||+ row.dispatch?.paused ||+ status === 'SENT' ||+ status === 'CANCELLED' ||+ (!row.cancellationRequested &&+ (row.phase === 'failed' || status === 'FAILED')) ||+ row.locallyCancelled ||+ (row.dispatch?.leaseUntil ?? 0) > now ||+ (row.dispatch?.nextAttemptAt ?? 0) > now+ ) {+ finish(undefined);+ return;+ }+ const next: EmailSendIntent = {+ ...row,+ submissionStarted: true,+ metadata: {+ ...row.metadata,+ requiresServerConfirmation: true,+ },+ dispatch: {+ generation: (row.dispatch?.generation ?? 0) + 1,+ owner: worker,+ leaseUntil: now + 60_000,+ nextAttemptAt: 0,+ failures: row.dispatch?.failures ?? 0,+ cancelling: row.cancellationRequested,+ },+ };+ sends.put(next, uuid);+ finish(next);+ };+ },+ finish,+ undefined+ ),+ false+ );+ },+ /** A timed-out worker cannot settle a newer claim or another account. */+ async settleSend(+ session: Session,+ uuid: string,+ worker: string,+ generation: number,+ update: {+ attempt?: EmailSendAttemptFieldsFragment;+ error?: string;+ failed?: boolean;+ paused?: boolean;+ rejectedBeforeAdmission?: boolean;+ nextAttemptAt: number;+ }+ ): Promise<boolean> {+ return await transaction('readwrite', (tx, finish) =>+ withSession(+ tx,+ session,+ () => {+ const sends = tx.objectStore('sends');+ const request = sends.get(uuid);+ request.onsuccess = () => {+ const row = request.result as EmailSendIntent | undefined;+ if (+ !row ||+ row.accountId !== session.accountId ||+ row.dispatch?.owner !== worker ||+ row.dispatch.generation !== generation+ ) {+ finish(false);+ return;+ }+ sends.put(+ {+ ...row,+ ...(update.rejectedBeforeAdmission &&+ generation === 1 &&+ row.dispatchVersion === 2 &&+ !row.response &&+ !update.attempt+ ? {+ locallyCancelled: true,+ metadata: {+ ...row.metadata,+ requiresServerConfirmation: false,+ },+ }+ : {}),+ phase: update.attempt+ ? 'committed'+ : update.failed+ ? 'failed'+ : row.phase,+ response: update.attempt+ ? { sendEmailMessage: { attempt: update.attempt } }+ : row.response,+ resolvedDraftId:+ update.attempt?.message?.id ?? row.resolvedDraftId,+ resolvedThreadId:+ update.attempt?.threadId ?? row.resolvedThreadId,+ dispatch: {+ generation,+ leaseUntil: 0,+ nextAttemptAt:+ row.cancellationRequested && !row.dispatch.cancelling+ ? 0+ : update.nextAttemptAt,+ failures: update.error ? row.dispatch.failures + 1 : 0,+ error: update.error,+ paused: update.paused,+ },+ } satisfies EmailSendIntent,+ uuid+ );+ finish(true);+ };+ },+ finish,+ false+ )+ );+ },+ async sends(session: Session): Promise<EmailSendIntent[]> {+ return await transaction('readonly', (tx, finish) =>+ withSession(+ tx,+ session,+ () => {+ const request = tx.objectStore('sends').getAll();+ request.onsuccess = () =>+ finish(+ (request.result as EmailSendIntent[]).filter(+ (row) => row?.accountId === session.accountId+ )+ );+ },+ finish,+ []+ )+ );+ },+ async removeSend(session: Session, uuid: string): Promise<void> {+ await transaction<void>('readwrite', (tx, finish) =>+ withSession(+ tx,+ session,+ () => {+ const request = tx.objectStore('sends').get(uuid);+ request.onsuccess = () => {+ const row = request.result as EmailSendIntent | undefined;+ if (row?.accountId !== session.accountId) {+ finish();+ return;+ }+ if (!isEmailSendIntent(row)) {+ finish();+ return;+ }+ const sent =+ (+ row.response?.cancelEmailSend?.attempt ??+ row.response?.sendEmailMessage?.attempt+ )?.status === 'SENT';+ if (!sent) {+ finish();+ return;+ }+ if (row)+ for (const id of [+ row.resolvedDraftId,+ String(row.metadata.payload.input.message.draftId),+ row.metadata.payload.workingCopy?.key,+ ]) {+ if (!id) continue;+ const lock = tx.objectStore('meta').get(['send-lock', id]);+ lock.onsuccess = () => {+ if (lock.result === uuid)+ tx.objectStore('meta').delete(['send-lock', id]);+ };+ }+ tx.objectStore('sends').delete(uuid);+ finish();+ };+ },+ finish,+ undefined+ )+ );+ },+ };+}diff --git a/apps/web/src/lib/queries/email/email-send-recovery.ts b/apps/web/src/lib/queries/email/email-send-recovery.tsnew file mode 100644index 0000000000..d8f4213e17--- /dev/null+++ b/apps/web/src/lib/queries/email/email-send-recovery.ts@@ -0,0 +1,68 @@+import { fireAndForget } from '@core/util/fireAndForget';+import {+ readEmailSendIntents,+ restoreCancelledEmailSend,+ retireEmailSendIntent,+ settledSendAttempt,+ watchEmailSends,+} from './send-queue';+import { emailSendFailureKind, recordEmailSend } from './send-telemetry';++/** Finish durable Undo decisions even after the toast or composer has unmounted. */+export function createEmailSendRecovery(accountId: string) {+ let disposed = false;+ let running: Promise<void> | undefined;+ let timer: ReturnType<typeof setTimeout> | undefined;+ const failures = new Set<string>();+ async function recover() {+ try {+ const rows = await readEmailSendIntents();+ for (const row of rows) {+ if (disposed) return;+ if (row.dispatchVersion !== 2 || row.accountId !== accountId) continue;+ try {+ const status = settledSendAttempt(row)?.status;+ if (status === 'SENT') await retireEmailSendIntent(row);+ else if (+ row.cancellationRequested &&+ (status === 'CANCELLED' ||+ (row.locallyCancelled &&+ !row.metadata.requiresServerConfirmation))+ )+ await restoreCancelledEmailSend(row);+ failures.delete(row.uuid);+ } catch (error) {+ if (!failures.has(row.uuid)) {+ failures.add(row.uuid);+ recordEmailSend(+ {+ operation: 'restore',+ outcome: 'error',+ failureKind: emailSendFailureKind(error),+ },+ row+ );+ }+ }+ }+ } finally {+ running = undefined;+ if (!disposed) timer = setTimeout(wake, 5_000);+ }+ }+ function wake() {+ if (disposed || running) return;+ if (timer !== undefined) clearTimeout(timer);+ running = Promise.resolve().then(recover);+ fireAndForget(running, 'email-send-recovery');+ }+ const unsubscribe = watchEmailSends(wake);+ wake();+ return {+ dispose() {+ disposed = true;+ unsubscribe();+ if (timer !== undefined) clearTimeout(timer);+ },+ };+}diff --git a/apps/web/src/lib/queries/email/email-send-restoration.ts b/apps/web/src/lib/queries/email/email-send-restoration.tsnew file mode 100644index 0000000000..ffbe7f4b88--- /dev/null+++ b/apps/web/src/lib/queries/email/email-send-restoration.ts@@ -0,0 +1,199 @@+import type {+ LocalDraft,+ LocalDraftAttachment,+} from '@app/features/email-compose/core/local-draft';+import type { DraftStorageSession } from './local-draft-store';+import { type EmailSendIntent, isEmailSendIntent } from './send-intent';++export type RestoredEmailSend = { draft: LocalDraft; intent: EmailSendIntent };++/** Cancellation, copy restoration and authority retirement share one transaction. */+export function restoreEmailSendTransaction(+ tx: IDBTransaction,+ session: DraftStorageSession,+ uuid: string,+ finish: (result: RestoredEmailSend | Error | undefined) => void+) {+ const sends = tx.objectStore('sends');+ const request = sends.get(uuid);+ request.onsuccess = () => {+ const intent = request.result as EmailSendIntent | undefined;+ if (+ !isEmailSendIntent(intent) ||+ intent.accountId !== session.accountId ||+ intent.dispatchVersion !== 2+ ) {+ finish(undefined);+ return;+ }+ const attempt =+ intent.response?.cancelEmailSend?.attempt ??+ intent.response?.sendEmailMessage?.attempt;+ if (+ !(+ intent.locallyCancelled && !intent.metadata.requiresServerConfirmation+ ) &&+ attempt?.status !== 'CANCELLED'+ ) {+ finish(new Error('Confirm cancellation before restoring the draft'));+ return;+ }+ const { input, workingCopy: copy, draft: frozen } = intent.metadata.payload;+ const server = attempt?.message;+ const ids = new Set([+ copy?.key,+ String(input.message.draftId),+ intent.resolvedDraftId,+ server?.id,+ ]);+ const drafts = tx.objectStore('drafts');+ const read = drafts.getAll();+ read.onsuccess = () => {+ const current = (read.result as LocalDraft[]).find(+ (row) =>+ row.accountId === session.accountId &&+ [row.key, row.draftId, row.serverDraftId].some(+ (id) => id && ids.has(id)+ )+ );+ const exact =+ !!current &&+ !!copy &&+ current.key === copy.key &&+ current.generation === copy.generation &&+ current.revision === copy.revision;+ // Preserve newer contents/files, but fence saves issued before cancellation:+ // their server generation is stale and their callbacks cannot retire this copy.+ const generation = Math.max(+ current?.content.draft_generation ?? 0,+ server?.draftGeneration ?? frozen.draftGeneration ?? 0+ );+ const restored: LocalDraft =+ current && !exact+ ? {+ ...current,+ generation: crypto.randomUUID(),+ revision: current.revision + 1,+ acknowledgedRevision: 0,+ latestAttemptId: undefined,+ queuedAttemptId: undefined,+ status: 'dirty',+ errorCode: undefined,+ updatedAt: Date.now(),+ content: { ...current.content, draft_generation: generation },+ }+ : {+ key: copy?.key ?? String(frozen.draftId),+ draftId: copy?.key ?? String(frozen.draftId),+ threadId:+ server?.threadId ??+ intent.resolvedThreadId ??+ frozen.threadDbId,+ serverDraftId: server?.id ?? current?.serverDraftId,+ serverThreadId: server?.threadId ?? current?.serverThreadId,+ accountId: session.accountId,+ generation: crypto.randomUUID(),+ revision: (current?.revision ?? 0) + 1,+ acknowledgedRevision: 0,+ status: 'dirty',+ updatedAt: Date.now(),+ inboxId: frozen.senderLinkId,+ senderEmail: frozen.senderEmail,+ content: {+ draft_generation: generation,+ subject: frozen.subject,+ sender_email: frozen.senderEmail,+ to: frozen.to,+ cc: frozen.cc,+ bcc: frozen.bcc,+ replying_to_id:+ frozen.replyingToId == null+ ? frozen.replyingToId+ : String(frozen.replyingToId),+ thread_db_id: server?.threadId ?? frozen.threadDbId,+ provider_id: frozen.providerId,+ provider_thread_id: frozen.providerThreadId,+ include_signature: input.includeSignature,+ body_html: input.restoreBodyHtml ?? frozen.bodyHtml,+ body_text: input.restoreBodyText ?? frozen.bodyText,+ body_macro: input.restoreBodyMacro ?? frozen.bodyMacro,+ },+ attachments: restoreAttachments(intent),+ };+ if (current)+ tx.objectStore('meta').put(true, [+ 'retired',+ current.key,+ current.generation,+ ]);+ if (exact) {+ for (const attachment of current.attachments)+ if (attachment.type === 'local')+ tx.objectStore('files').delete([current.key, attachment.id]);+ }+ drafts.put({ ...restored, epoch: session.epoch }, restored.key);+ tx.objectStore('meta').put(restored.generation, [+ 'generation',+ restored.key,+ ]);+ for (const id of ids) {+ if (!id) continue;+ const lock = tx.objectStore('meta').get(['send-lock', id]);+ lock.onsuccess = () => {+ if (lock.result === uuid)+ tx.objectStore('meta').delete(['send-lock', id]);+ };+ }+ sends.delete(uuid);+ finish({ draft: restored, intent });+ };+ };+}++function restoreAttachments(intent: EmailSendIntent): LocalDraftAttachment[] {+ const copy = intent.metadata.payload.workingCopy;+ if (copy)+ return copy.attachments.map((file) => {+ if (file.type !== 'local') return file;+ if (!file.attachmentId || !file.uploaded)+ throw new Error('Approved attachment is incomplete');+ return {+ type: 'remote' as const,+ attachmentId: file.attachmentId,+ fileName: file.name,+ fileSize: file.size,+ contentType: file.mimeType,+ url: '',+ };+ });+ const message =+ (+ intent.response?.cancelEmailSend?.attempt ??+ intent.response?.sendEmailMessage?.attempt+ )?.message ?? intent.metadata.payload.draft.existingDraft;+ return [+ ...(message?.attachmentsDraft ?? []).map((file) => ({+ type: 'remote' as const,+ attachmentId: file.id,+ fileName: file.fileName,+ fileSize: file.size,+ contentType: file.contentType,+ url: '',+ })),+ ...(message?.attachmentsForwarded ?? []).map((file) => ({+ type: 'forwarded' as const,+ attachmentId: file.attachmentId,+ fileName: file.filename ?? 'Attachment',+ mimeType: file.mimeType ?? 'application/octet-stream',+ fileSize: file.sizeBytes ?? 0,+ })),+ ...(message?.attachments ?? []).map((file) => ({+ type: 'native' as const,+ attachmentId: file.id,+ fileName: file.filename ?? 'Attachment',+ mimeType: file.mimeType ?? 'application/octet-stream',+ fileSize: file.sizeBytes ?? 0,+ referenceUrl: file.referenceUrl,+ })),+ ];+}diff --git a/apps/web/src/lib/queries/email/graphql/compose.test.ts b/apps/web/src/lib/queries/email/graphql/compose.test.tsindex 979486f666..e5a56e5339 100644--- a/apps/web/src/lib/queries/email/graphql/compose.test.ts+++ b/apps/web/src/lib/queries/email/graphql/compose.test.ts@@ -7,11 +7,7 @@ vi.mock('@service-storage/graphql-soup', () => ({getGraphqlSoupClient: getClient,}));-import {- composeDraftInput,- saveEmailComposeDraft,- sendEmailComposeMessage,-} from './compose';+import { composeDraftInput, saveEmailComposeDraft } from './compose';const input = {subject: 'Resident',@@ -21,7 +17,7 @@ const input = {};describe('GraphQL compose transport', () => {- it('carries sender and stable client handles in both save and online send', async () => {+ it('carries sender and stable client handles when saving drafts', async () => {const operations: Operation[] = [];const client = createClient({url: 'https://unused/graphql',@@ -40,12 +36,6 @@ describe('GraphQL compose transport', () => {draftId: 'server-message',draft: { threadId: 'server-thread', linkId: 'delegated' },},- sendEmailMessage: {- messageId: 'server-message',- threadId: 'server-thread',- linkId: 'delegated',- sendTime: null,- },},};})@@ -65,28 +55,12 @@ describe('GraphQL compose transport', () => {threadId: 'server-thread',inboxId: 'delegated',});- expect(- await sendEmailComposeMessage({- message: { ...input, include_signature: false },- inboxId: 'delegated',- clientHandles: handles,- })- ).toEqual({- draftId: 'server-message',- threadId: 'server-thread',- inboxId: 'delegated',- });expect(operations[0].variables?.input).toMatchObject({draftId: 'client-message',threadDbId: 'client-thread',senderEmail: '[email protected]',linkId: 'delegated',});- expect(operations[1].variables?.input).toMatchObject({- draft: operations[0].variables?.input,- includeSignature: false,- });- expect(operations[1].context.optimistic).toBeUndefined();});it('refuses to send without a stable draft identity', () => {expect(() => composeDraftInput(input)).toThrow(diff --git a/apps/web/src/lib/queries/email/graphql/compose.ts b/apps/web/src/lib/queries/email/graphql/compose.tsindex 5073a54c92..762fe017bc 100644--- a/apps/web/src/lib/queries/email/graphql/compose.ts+++ b/apps/web/src/lib/queries/email/graphql/compose.ts@@ -2,14 +2,12 @@ import type {DraftClientHandles,PersistedEmailIdentity,SaveEmailDraft,- SendEmailDraft,} from '@app/features/email-compose/context/compose-capabilities';import { DraftPersistRejected } from '@app/features/email-compose/context/compose-capabilities';import type { EmailDraft } from '@app/features/email-compose/core/email-draft';import {SaveEmailDraftDocument,type SaveEmailDraftInput,- SendEmailMessageDocument,} from '@service-storage/graphql/generated/graphql';import { getGraphqlSoupClient } from '@service-storage/graphql-soup';import { draftContactInput, draftFailureCode } from './draft';@@ -63,30 +61,3 @@ export async function saveEmailComposeDraft(inboxId: saved.draft.linkId,};}--/** Delivery is online-only: no optimistic resolver/durable queue and no retry- * that could hide an ambiguous send. The same draft handle identifies retries. */-export async function sendEmailComposeMessage(- input: SendEmailDraft-): Promise<PersistedEmailIdentity> {- const result = await getGraphqlSoupClient()- .mutation(SendEmailMessageDocument, {- input: {- draft: composeDraftInput(- input.message,- input.inboxId,- input.clientHandles- ),- includeSignature: input.message.include_signature,- },- })- .toPromise();- if (result.error) throw result.error;- const sent = result.data?.sendEmailMessage;- if (!sent) throw new Error('Send returned no delivery identity');- return {- draftId: sent.messageId,- threadId: sent.threadId,- inboxId: sent.linkId,- };-}diff --git a/apps/web/src/lib/queries/email/graphql/draft.test.ts b/apps/web/src/lib/queries/email/graphql/draft.test.tsindex 773fdeeb96..0178a16e87 100644--- a/apps/web/src/lib/queries/email/graphql/draft.test.ts+++ b/apps/web/src/lib/queries/email/graphql/draft.test.ts@@ -65,6 +65,7 @@ describe('optimistic draft saves', () => {calendarInvitations: [{ id: 'saved-invitation' }],createdAt: '2026-01-01T00:00:00Z',scheduledSendTime: '2027-01-01T12:00:00Z',+ scheduledSendStatus: 'FAILED' as const,hasAttachments: true,attachmentsDraft: [{@@ -104,6 +105,7 @@ describe('optimistic draft saves', () => {hasAttachments: true,createdAt: existing.createdAt,scheduledSendTime: existing.scheduledSendTime,+ scheduledSendStatus: existing.scheduledSendStatus,calendarInvitations: existing.calendarInvitations,},},diff --git a/apps/web/src/lib/queries/email/graphql/draft.ts b/apps/web/src/lib/queries/email/graphql/draft.tsindex 6f273b6e77..7bf2f09f4c 100644--- a/apps/web/src/lib/queries/email/graphql/draft.ts+++ b/apps/web/src/lib/queries/email/graphql/draft.ts@@ -193,7 +193,7 @@ function optimisticContact(* The cache binds the handle to the server identity atomically at settlement,* rebasing later queued edits and preserving reads through the old handle.*/-function optimisticDraftEntity(+export function optimisticDraftEntity(args: GraphqlSaveEmailDraftArgs): OptimisticDraftEntity {const now = new Date().toISOString();@@ -214,8 +214,10 @@ function optimisticDraftEntity(isStarred: existing?.isStarred ?? false,isSent: false,isDraft: true,+ draftGeneration: args.draftGeneration ?? 0,hasAttachments: existing?.hasAttachments ?? false,scheduledSendTime: args.sendTime ?? existing?.scheduledSendTime ?? null,+ scheduledSendStatus: existing?.scheduledSendStatus ?? null,bodyText: args.bodyText ?? null,bodyHtmlSanitized: args.optimisticBodyHtml,bodyMacro: args.bodyMacro ?? null,@@ -381,6 +383,7 @@ export async function executeGraphqlSaveEmailDraft(/** Input for a durable GraphQL draft delete. */export type GraphqlDeleteEmailDraftArgs = {+ draftGeneration?: number;/** The draft to delete, by its client-generated id. */draftId: string;/** Thread the draft lives in — targets the optimistic removal from the@@ -415,7 +418,10 @@ export async function executeGraphqlDeleteEmailDraft(args: GraphqlDeleteEmailDraftArgs): Promise<DeleteEmailDraftOutcome> {const variables: DeleteEmailDraftMutationVariables = {- input: { draftId: args.draftId },+ input: {+ draftId: args.draftId,+ draftGeneration: args.draftGeneration ?? 0,+ },};const threadPageVariables: EmailThreadPageQueryVariables = {threadId: args.threadDbId,diff --git a/apps/web/src/lib/queries/email/graphql/mapper.test.ts b/apps/web/src/lib/queries/email/graphql/mapper.test.tsindex 342505918b..02fb87132d 100644--- a/apps/web/src/lib/queries/email/graphql/mapper.test.ts+++ b/apps/web/src/lib/queries/email/graphql/mapper.test.ts@@ -7,6 +7,7 @@ import { mapGraphqlEmailThreadPage } from './mapper';const message: EmailThreadMessageFieldsFragment = {__typename: 'GraphqlSoupEmailMessage',+ draftGeneration: 0,operationStatus: null,calendarInvitations: [],id: 'message-1',@@ -24,6 +25,7 @@ const message: EmailThreadMessageFieldsFragment = {isDraft: true,hasAttachments: true,scheduledSendTime: '2026-08-07T12:00:00Z',+ scheduledSendStatus: 'FAILED',from: { email: '[email protected]', name: 'From', photoUrl: 'from-photo' },to: [{ email: '[email protected]', name: 'To', photoUrl: null }],cc: [],@@ -157,6 +159,7 @@ describe('mapGraphqlEmailThreadPage', () => {provider_id: 'provider-message-1',replying_to_id: 'message-0',scheduled_send_time: '2026-08-07T12:00:00Z',+ scheduled_send_status: 'failed',from: { email: '[email protected]', photo_url: 'from-photo' },labels: [{@@ -195,6 +198,23 @@ describe('mapGraphqlEmailThreadPage', () => {expect(mapped.access_level).toBe('view');});+ it('preserves a thread when a newer server returns an unknown delivery state', () => {+ const fromNewerServer = JSON.parse('"AWAITING_PROVIDER_RECEIPT"');+ const mapped = mapGraphqlEmailThreadPage(+ thread({+ messages: [{ ...message, scheduledSendStatus: fromNewerServer }],+ })+ );++ expect(mapped.messages).toHaveLength(1);+ expect(mapped.messages[0]).toMatchObject({+ db_id: 'message-1',+ body_macro: 'Macro',+ scheduled_send_time: '2026-08-07T12:00:00Z',+ scheduled_send_status: 'unconfirmed',+ });+ });+it('defaults an access level from a newer server to view-only', () => {const fromNewerServer = JSON.parse('"SUPER_OWNER"');const mapped = mapGraphqlEmailThreadPage(diff --git a/apps/web/src/lib/queries/email/graphql/mapper.ts b/apps/web/src/lib/queries/email/graphql/mapper.tsindex 178b1dba64..72f5a980f1 100644--- a/apps/web/src/lib/queries/email/graphql/mapper.ts+++ b/apps/web/src/lib/queries/email/graphql/mapper.ts@@ -10,6 +10,7 @@ import type {EmailThreadMessageFieldsFragment,EmailThreadPageFieldsFragment,GraphqlEntityAccessLevel,+ GraphqlScheduledSendStatus,} from '@service-storage/graphql/generated/graphql';import { match } from 'ts-pattern';@@ -71,6 +72,7 @@ export function mapGraphqlEmailMessage(> = new Map()): ApiMessage {return {+ draft_generation: message.draftGeneration,attachments: message.attachments.map((attachment) => ({db_id: attachment.id,provider_id: optional(attachment.providerId),@@ -134,6 +136,16 @@ export function mapGraphqlEmailMessage(provider_id: optional(message.providerId),replying_to_id: optional(message.replyingToId),scheduled_send_time: message.scheduledSendTime,+ scheduled_send_status:+ message.scheduledSendStatus == null+ ? null+ : match<GraphqlScheduledSendStatus>(message.scheduledSendStatus)+ .with('PENDING', () => 'pending' as const)+ .with('SENDING', () => 'sending' as const)+ .with('FAILED', () => 'failed' as const)+ .with('UNCONFIRMED', () => 'unconfirmed' as const)+ // An unfamiliar delivery state cannot prove the draft is editable.+ .exhaustive(() => 'unconfirmed' as const),sent_at: message.sentAt,snippet: message.snippet,subject: message.subject,diff --git a/apps/web/src/lib/queries/email/graphql/thread.test.ts b/apps/web/src/lib/queries/email/graphql/thread.test.tsindex f810f62521..c84d51e3f4 100644--- a/apps/web/src/lib/queries/email/graphql/thread.test.ts+++ b/apps/web/src/lib/queries/email/graphql/thread.test.ts@@ -106,9 +106,74 @@ const cachedPage: EmailThreadPageQuery = {},};+it('uses a returned canonical thread identity without applying stale route responses', async () => {+ cacheEnabledMock.mockReturnValue(false);+ hostMock.mockReturnValue(undefined);+ const reads: Array<{+ requested: string;+ emit(canonical: string): void;+ }> = [];+ executeQueryMock.mockImplementation(+ (+ request: GraphQLRequest<+ EmailThreadPageQuery,+ EmailThreadPageQueryVariables+ >,+ context: Partial<OperationContext>+ ) => {+ const stream = makeSubject<OperationResult<EmailThreadPageQuery>>();+ const operation = makeOperation('query', request, {+ url: '/graphql',+ ...context,+ requestPolicy: context.requestPolicy ?? 'network-only',+ });+ reads.push({+ requested: String(request.variables?.threadId),+ emit: (canonical) =>+ stream.next({+ operation,+ stale: false,+ hasNext: false,+ data: {+ user: {+ ...cachedPage.user,+ emailThread: { ...cachedPage.user.emailThread!, id: canonical },+ },+ },+ }),+ });+ return stream.source;+ }+ );+ const [route, setRoute] = createSignal('retained-source');+ const root = createRoot((dispose) => ({+ dispose,+ ...createGraphqlEmailThreadQuery(route, () => ({ enabled: true })),+ }));+ try {+ await vi.waitFor(() => expect(reads).toHaveLength(1));+ reads[0].emit('canonical-thread');+ expect(root.resolvedThreadId()).toBe('canonical-thread');+ expect(root.query.data?.pages[0].db_id).toBe('canonical-thread');+ // Redirects do not reset pagination or start another query while the old+ // route remains mounted. Actions observe the verified response identity.+ expect(reads).toHaveLength(1);+ setRoute('other-thread');+ await vi.waitFor(() => expect(reads).toHaveLength(2));+ reads[0].emit('late-canonical-thread');+ expect(root.resolvedThreadId()).toBe('other-thread');+ expect(root.query.data).toBeUndefined();+ reads[1].emit('other-thread');+ expect(root.query.data?.pages[0].db_id).toBe('other-thread');+ } finally {+ root.dispose();+ }+});+function threadMessages(offset: number, count: number) {return Array.from({ length: count }, (_, i) => ({__typename: 'GraphqlSoupEmailMessage' as const,+ draftGeneration: 0,operationStatus: null,id: `message-${offset + i}`,threadId: 'thread-1',@@ -125,6 +190,7 @@ function threadMessages(offset: number, count: number) {isDraft: false,hasAttachments: false,scheduledSendTime: null,+ scheduledSendStatus: null,from: null,to: [],cc: [],diff --git a/apps/web/src/lib/queries/email/graphql/thread.ts b/apps/web/src/lib/queries/email/graphql/thread.tsindex 4f999f66fa..9c481152ac 100644--- a/apps/web/src/lib/queries/email/graphql/thread.ts+++ b/apps/web/src/lib/queries/email/graphql/thread.ts@@ -237,6 +237,11 @@ export function createGraphqlEmailThreadQuery<TData = GraphqlEmailThreadPages>(getGraphqlSoupClient();const host = getGraphqlCacheHost();const [identity, setIdentity] = createSignal<ThreadIdentity>();+ const [returnedIdentity, setReturnedIdentity] = createSignal<{+ requested: string;+ queried: string;+ canonical: string;+ }>();let request = 0;let disposed = false;const refreshIdentity = async () => {@@ -281,8 +286,15 @@ export function createGraphqlEmailThreadQuery<TData = GraphqlEmailThreadPages>(disposed = true;unsubscribe?.();});- const resolvedThreadId = () =>+ const queryThreadId = () =>identity()?.requested === threadId() ? identity()!.canonical : threadId();+ const resolvedThreadId = () => {+ const returned = returnedIdentity();+ return returned?.requested === threadId() &&+ returned.queried === queryThreadId()+ ? returned.canonical+ : queryThreadId();+ };const query = createUrqlInfiniteQuery<EmailThreadPageQuery,EmailThreadPageQueryVariables,@@ -293,7 +305,7 @@ export function createGraphqlEmailThreadQuery<TData = GraphqlEmailThreadPages>(client: getGraphqlSoupClient(),initialPageParam: 0,variables: (offset) => ({- threadId: resolvedThreadId(),+ threadId: queryThreadId(),offset,limit: DEFAULT_THREAD_MESSAGES_LIMIT,}),@@ -317,6 +329,18 @@ export function createGraphqlEmailThreadQuery<TData = GraphqlEmailThreadPages>(? 'cache-only': 'cache-and-network',keepPreviousData: false,+ onResult: (result, { pageIndex }) => {+ const canonical = result.data?.user.emailThread?.id;+ const queried = result.operation.variables.threadId;+ if (+ pageIndex !== 0 ||+ result.error ||+ !canonical ||+ queried !== untrack(queryThreadId)+ )+ return;+ setReturnedIdentity({ requested: untrack(threadId), queried, canonical });+ },select: ({ pages, pageParams }) => {const mapped = {pages: pages.map((page) =>diff --git a/apps/web/src/lib/queries/email/local-draft-confirmation.ts b/apps/web/src/lib/queries/email/local-draft-confirmation.tsnew file mode 100644index 0000000000..7400704f30--- /dev/null+++ b/apps/web/src/lib/queries/email/local-draft-confirmation.ts@@ -0,0 +1,38 @@+import type { LocalDraft } from '@app/features/email-compose/core/local-draft';+import {+ draftSyncPaused,+ emailStorageSession,+ localDraftStore,+} from './local-drafts';++/** REST autosave confirms the same independent working copy used by the outbox. */+export async function confirmLocalDraftSave(+ saved: LocalDraft | undefined,+ result: { draftId?: string; threadId?: string }+) {+ if (!saved || !result.draftId) return;+ const session = await emailStorageSession();+ if (session.accountId !== saved.accountId) return;+ await localDraftStore.update(session, saved.key, (current) => {+ if (+ current.generation !== saved.generation ||+ current.acknowledgedRevision > saved.revision+ )+ return current;+ return {+ ...current,+ serverDraftId: result.draftId,+ serverThreadId: result.threadId ?? current.serverThreadId,+ acknowledgedRevision: saved.revision,+ status:+ draftSyncPaused(current) || current.status === 'deleting'+ ? current.status+ : current.revision === saved.revision &&+ !current.attachments.some(+ (file) => file.type === 'local' && !file.uploaded+ )+ ? 'synced'+ : 'dirty',+ };+ });+}diff --git a/apps/web/src/lib/queries/email/local-draft-store.test.ts b/apps/web/src/lib/queries/email/local-draft-store.test.tsindex e7e813c8ab..a6e87ea657 100644--- a/apps/web/src/lib/queries/email/local-draft-store.test.ts+++ b/apps/web/src/lib/queries/email/local-draft-store.test.ts@@ -49,6 +49,26 @@ describe('draft connection recovery', () => {});});+ it('reopens without losing frozen sends, cancellation decisions or editing locks', async () => {+ const store = open();+ const session = await store.activate('owner');+ await store.save(session, snapshot());+ await store.putSend(session, sendIntent(), true);+ connections[0].close();+ expect(await store.sends(session)).toEqual([sendIntent()]);+ await expect(store.save(session, snapshot('Late edit', 1))).rejects.toThrow(+ 'Cancel and restore'+ );+ await store.putSend(session, {+ ...sendIntent(),+ cancellationRequested: true,+ });+ connections.at(-1)!.close();+ expect((await store.sends(session))[0].cancellationRequested).toBe(true);+ await expect(+ store.save(session, snapshot('Still locked', 1))+ ).rejects.toThrow('Cancel and restore');+ });it('waits for rollback and preserves the underlying request error', async () => {const report = vi.fn();const store = createLocalDraftStore(crypto.randomUUID(), report);@@ -555,3 +575,155 @@ describe('notification failures do not affect durable commits', () => {expect(listener).toHaveBeenCalledOnce();});});++const sendIntent = (+ uuid = 'attempt'+): import('./send-queue').EmailSendIntent => ({+ uuid,+ accountId: 'owner',+ dispatchVersion: 2,+ phase: 'pending',+ locallyCancelled: false,+ metadata: {+ kind: 'email-send-v1',+ payload: {+ input: {+ attempt: { attemptId: uuid, linkId: 'inbox' },+ message: {+ draftId: 'local',+ subject: 'Approved',+ linkId: 'inbox',+ bodyText: 'Approved body',+ },+ attachmentIds: [],+ forwardedAttachmentIds: [],+ },+ draft: {+ draftId: 'local',+ threadDbId: 'thread',+ senderEmail: '[email protected]',+ optimisticBodyHtml: null,+ senderLinkId: 'inbox',+ subject: 'Approved',+ bodyText: 'Approved body',+ },+ workingCopy: {+ key: 'local',+ generation: 'generation',+ revision: 1,+ attachments: [],+ },+ },+ },+});++describe('independent send recovery records', () => {+ it('retains the frozen snapshot and attempt identity independently of the cache', async () => {+ const name = crypto.randomUUID();+ const first = open(name);+ const owner = await first.activate('owner');+ await first.save(owner, snapshot());+ await first.putSend(owner, sendIntent(), true);+ await first.close();+ const second = open(name);+ const restoredOwner = await second.activate('owner');+ expect(await second.sends(restoredOwner)).toEqual([sendIntent()]);+ await expect(+ second.save(restoredOwner, snapshot('Late edit', 1))+ ).rejects.toThrow('Cancel and restore');+ expect((await second.read(restoredOwner, 'local'))?.content.subject).toBe(+ 'Keep this draft'+ );+ });+ it('atomically admits only one send across tabs and rejects a stale snapshot', async () => {+ const name = crypto.randomUUID();+ const first = open(name),+ second = open(name);+ const owner = await first.activate('owner');+ await second.activate('owner', owner.epoch);+ await first.save(owner, snapshot());+ const results = await Promise.allSettled([+ first.putSend(owner, sendIntent('one'), true),+ second.putSend(owner, sendIntent('two'), true),+ ]);+ expect(+ results.filter((result) => result.status === 'fulfilled')+ ).toHaveLength(1);+ expect(await first.sends(owner)).toHaveLength(1);+ await first.putSend(owner, {+ ...(await first.sends(owner))[0],+ cancellationRequested: true,+ });+ await first.restoreSend(owner, (await first.sends(owner))[0].uuid);+ const restored = (await first.read(owner, 'local'))!;+ await first.save(owner, {+ ...snapshot('New edit', restored.revision),+ generation: restored.generation,+ });+ await expect(first.putSend(owner, sendIntent(), true)).rejects.toThrow(+ 'changed'+ );+ });+ it('keeps cancellation and restoration when a late original send settles', async () => {+ const store = open(),+ owner = await store.activate('owner');+ await store.save(owner, snapshot());+ await store.putSend(+ owner,+ { ...sendIntent(), cancellationRequested: true },+ true+ );+ await store.putSend(owner, sendIntent());+ expect((await store.sends(owner))[0].cancellationRequested).toBe(true);+ await store.restoreSend(owner, sendIntent().uuid);+ await expect(store.putSend(owner, sendIntent())).rejects.toThrow(+ 'already resolved'+ );+ const restored = (await store.read(owner, 'local'))!;+ await expect(+ store.save(owner, {+ ...snapshot('Restored edit', restored.revision),+ generation: restored.generation,+ })+ ).resolves.toMatchObject({ revision: restored.revision + 1 });+ });+ it('clears send content and fences old sessions on account changes and logout', async () => {+ const store = open(),+ owner = await store.activate('owner');+ await store.save(owner, snapshot());+ await store.putSend(owner, sendIntent(), true);+ const next = await store.activate('next', 'next-epoch');+ expect(await store.sends(next)).toEqual([]);+ await expect(store.putSend(owner, sendIntent())).rejects.toThrow(+ 'no longer active'+ );+ await store.clear(true, next.epoch);+ expect(await store.sends(next)).toEqual([]);+ });+});++it('a late old cancellation cannot release a newer send reservation', async () => {+ const store = open(),+ owner = await store.activate('owner');+ await store.save(owner, snapshot());+ const old = await store.putSend(+ owner,+ { ...sendIntent('old'), cancellationRequested: true },+ true+ );+ await store.restoreSend(owner, old.uuid);+ const restored = (await store.read(owner, 'local'))!;+ const next = sendIntent('new');+ next.metadata.payload.workingCopy = {+ key: restored.key,+ generation: restored.generation,+ revision: restored.revision,+ attachments: [],+ };+ await store.putSend(owner, next, true);+ await expect(store.putSend(owner, old)).rejects.toThrow('already resolved');+ await expect(+ store.save(owner, snapshot('Late edit', restored.revision))+ ).rejects.toThrow('Cancel and restore');+ expect((await store.sends(owner))[0].uuid).toBe('new');+});diff --git a/apps/web/src/lib/queries/email/local-draft-store.ts b/apps/web/src/lib/queries/email/local-draft-store.tsindex bb2561c049..4ff3394cd9 100644--- a/apps/web/src/lib/queries/email/local-draft-store.ts+++ b/apps/web/src/lib/queries/email/local-draft-store.ts@@ -2,15 +2,20 @@ import type {DraftAttempt,LocalDraft,} from '@app/features/email-compose/core/local-draft';+import {+ createEmailSendJournal,+ restoreEmailSendLocks,+} from './email-send-journal';+import type { EmailSendIntent } from './send-intent';/** Only pre-metadata queue entries need a separate durable association. */type AttemptRecord = DraftAttempt & {transactionId: string;storageGeneration: string;};-type Session = { accountId: string; epoch: string };+export type DraftStorageSession = { accountId: string; epoch: string };type StoredDraft = LocalDraft & { epoch: string };-const STORES = ['drafts', 'files', 'attempts', 'meta'] as const;+const STORES = ['drafts', 'files', 'attempts', 'sends', 'meta'] as const;export type DraftStorageEvent =| { type: 'closed' | 'recovered' }@@ -52,10 +57,29 @@ export function createLocalDraftStore(};const open = () => {if (connection) return connection;- const request = indexedDB.open(dbName, 1);+ const request = indexedDB.open(dbName, 3);const opening = new Promise<IDBDatabase>((resolve, reject) => {request.onupgradeneeded = () => {- for (const name of STORES) request.result.createObjectStore(name);+ for (const name of STORES)+ if (!request.result.objectStoreNames.contains(name))+ request.result.createObjectStore(name);+ const tx = request.transaction;+ if (!tx) return;+ const owner = tx.objectStore('meta').get('session');+ owner.onsuccess = () => {+ const session = owner.result as DraftStorageSession | undefined;+ // Never infer legacy ownership from the next account signing in.+ if (!session?.accountId) return;+ const cursor = tx.objectStore('sends').openCursor();+ cursor.onsuccess = () => {+ const row = cursor.result;+ if (!row) return;+ const intent = row.value as EmailSendIntent;+ if (!intent.accountId)+ row.update({ ...intent, accountId: session.accountId });+ row.continue();+ };+ };};request.onerror = () => {if (connection === opening) connection = undefined;@@ -154,14 +178,14 @@ export function createLocalDraftStore(}function withSession<T>(tx: IDBTransaction,- session: Session,+ session: DraftStorageSession,run: () => void,finish: (value: T) => void,stale: T) {const request = tx.objectStore('meta').get('session');request.onsuccess = () => {- const current = request.result as Session | undefined;+ const current = request.result as DraftStorageSession | undefined;if (current?.accountId !== session.accountId ||current.epoch !== session.epoch@@ -172,7 +196,7 @@ export function createLocalDraftStore(run();};}- const read = async (session: Session, id: string) =>+ const read = async (session: DraftStorageSession, id: string) =>await transaction<LocalDraft | undefined>('readonly', (tx, finish) => {withSession(tx,@@ -196,12 +220,12 @@ export function createLocalDraftStore();});return {- /** Account transitions clear old content and fence outstanding transactions. */+ /** Account transitions clear unapproved drafts, retain approved sends, and fence old transactions. */async activate(accountId: string,epoch?: string,isCurrent = () => true- ): Promise<Session> {+ ): Promise<DraftStorageSession> {return await transaction('readwrite',(tx, finish) => {@@ -214,7 +238,9 @@ export function createLocalDraftStore(}const request = meta.get('session');request.onsuccess = () => {- const previous = request.result as Session | undefined;+ const previous = request.result as+ | DraftStorageSession+ | undefined;if (!isCurrent() ||(previous &&@@ -231,12 +257,14 @@ export function createLocalDraftStore(finish(previous);return;}- for (const name of STORES) tx.objectStore(name).clear();+ for (const name of STORES)+ if (name !== 'sends') tx.objectStore(name).clear();const session = {accountId,epoch: epoch ?? crypto.randomUUID(),};meta.put(session, 'session');+ restoreEmailSendLocks(tx, accountId);finish(session);};};@@ -246,7 +274,7 @@ export function createLocalDraftStore(},read,async generation(- session: Session,+ session: DraftStorageSession,key: string,revive = false): Promise<string> {@@ -275,7 +303,7 @@ export function createLocalDraftStore(if (!result) throw new Error('This draft session is no longer active');return result;},- async list(session: Session): Promise<LocalDraft[]> {+ async list(session: DraftStorageSession): Promise<LocalDraft[]> {return await transaction('readonly', (tx, finish) =>withSession(tx,@@ -298,7 +326,7 @@ export function createLocalDraftStore(},/** Compare the snapshot revision and commit its content and files atomically. */async save(- session: Session,+ session: DraftStorageSession,input: Omit<LocalDraft,'revision' | 'acknowledgedRevision' | 'updatedAt'@@ -313,97 +341,108 @@ export function createLocalDraftStore(session,() => {const drafts = tx.objectStore('drafts');- const retired = tx- .objectStore('meta')- .get(['retired', input.key, input.generation]);- retired.onsuccess = () => {- if (retired.result) {- finish(undefined);+ const lock = tx.objectStore('meta').get(['send-lock', input.key]);+ lock.onsuccess = () => {+ if (lock.result) {+ finish(+ new Error(+ 'Cancel and restore the queued send before editing'+ )+ );return;}- const request = drafts.get(input.key);- request.onsuccess = () => {- const previous = request.result as StoredDraft | undefined;- if (previous && previous.generation !== input.generation) {+ const retired = tx+ .objectStore('meta')+ .get(['retired', input.key, input.generation]);+ retired.onsuccess = () => {+ if (retired.result) {finish(undefined);return;}- const paused =- previous?.status === 'failed' ||- previous?.status === 'unconfirmed' ||- previous?.status === 'delete-failed';- if (previous?.status === 'deleting') {- finish(undefined);- return;- }- if ((previous?.revision ?? 0) !== input.expectedRevision) {- finish(- new Error(- 'This draft changed while saving. Reopen it to use the latest version.'+ const request = drafts.get(input.key);+ request.onsuccess = () => {+ const previous = request.result as StoredDraft | undefined;+ if (previous && previous.generation !== input.generation) {+ finish(undefined);+ return;+ }+ const paused =+ previous?.status === 'failed' ||+ previous?.status === 'unconfirmed' ||+ previous?.status === 'delete-failed';+ if (previous?.status === 'deleting') {+ finish(undefined);+ return;+ }+ if ((previous?.revision ?? 0) !== input.expectedRevision) {+ finish(+ new Error(+ 'This draft changed while saving. Reopen it to use the latest version.'+ )+ );+ return;+ }+ const { expectedRevision: _expectedRevision, ...snapshot } =+ input;+ const draft: StoredDraft = {+ ...snapshot,+ epoch: session.epoch,+ latestAttemptId: previous?.latestAttemptId,+ queuedAttemptId: previous?.queuedAttemptId,+ attachments: input.attachments.map((attachment) => {+ if (attachment.type !== 'local') return attachment;+ const receipt = previous?.attachments.find(+ (saved) =>+ saved.type === 'local' && saved.id === attachment.id+ );+ // Upload callbacks can commit while file bytes are being copied.+ // The working-copy snapshot must not erase a newer receipt.+ return receipt?.type === 'local'+ ? {+ ...attachment,+ attachmentId:+ receipt.attachmentId ??+ (attachment.uploaded+ ? attachment.attachmentId+ : undefined),+ uploaded:+ receipt.uploaded ||+ (attachment.uploaded &&+ (!receipt.attachmentId ||+ receipt.attachmentId ===+ attachment.attachmentId)),+ }+ : attachment;+ }),+ serverDraftId:+ previous?.serverDraftId ?? input.serverDraftId,+ serverThreadId:+ previous?.serverThreadId ?? input.serverThreadId,+ revision: (previous?.revision ?? 0) + 1,+ acknowledgedRevision: previous?.acknowledgedRevision ?? 0,+ status: paused ? previous.status : 'dirty',+ errorCode: paused ? previous.errorCode : undefined,+ updatedAt: Date.now(),+ };+ for (const [id, blob] of files)+ tx.objectStore('files').put(blob, [input.key, id]);+ const retained = new Set(+ input.attachments.flatMap((a) =>+ a.type === 'local' ? [a.id] : []));- return;- }- const { expectedRevision: _expectedRevision, ...snapshot } =- input;- const draft: StoredDraft = {- ...snapshot,- epoch: session.epoch,- latestAttemptId: previous?.latestAttemptId,- queuedAttemptId: previous?.queuedAttemptId,- attachments: input.attachments.map((attachment) => {- if (attachment.type !== 'local') return attachment;- const receipt = previous?.attachments.find(- (saved) =>- saved.type === 'local' && saved.id === attachment.id- );- // Upload callbacks can commit while file bytes are being copied.- // The working-copy snapshot must not erase a newer receipt.- return receipt?.type === 'local'- ? {- ...attachment,- attachmentId:- receipt.attachmentId ??- (attachment.uploaded- ? attachment.attachmentId- : undefined),- uploaded:- receipt.uploaded ||- (attachment.uploaded &&- (!receipt.attachmentId ||- receipt.attachmentId ===- attachment.attachmentId)),- }- : attachment;- }),- serverDraftId:- previous?.serverDraftId ?? input.serverDraftId,- serverThreadId:- previous?.serverThreadId ?? input.serverThreadId,- revision: (previous?.revision ?? 0) + 1,- acknowledgedRevision: previous?.acknowledgedRevision ?? 0,- status: paused ? previous.status : 'dirty',- errorCode: paused ? previous.errorCode : undefined,- updatedAt: Date.now(),+ for (const attachment of previous?.attachments ?? [])+ if (+ attachment.type === 'local' &&+ !retained.has(attachment.id)+ )+ tx.objectStore('files').delete([+ input.key,+ attachment.id,+ ]);+ drafts.put(draft, input.key);+ finish(draft);};- for (const [id, blob] of files)- tx.objectStore('files').put(blob, [input.key, id]);- const retained = new Set(- input.attachments.flatMap((a) =>- a.type === 'local' ? [a.id] : []- )- );- for (const attachment of previous?.attachments ?? [])- if (- attachment.type === 'local' &&- !retained.has(attachment.id)- )- tx.objectStore('files').delete([- input.key,- attachment.id,- ]);- drafts.put(draft, input.key);- finish(draft);};};},@@ -416,7 +455,7 @@ export function createLocalDraftStore(return result;},async file(- session: Session,+ session: DraftStorageSession,key: string,id: string): Promise<Blob | undefined> {@@ -434,7 +473,7 @@ export function createLocalDraftStore();},async update(- session: Session,+ session: DraftStorageSession,key: string,change: (draft: LocalDraft) => LocalDraft | undefined): Promise<LocalDraft | undefined> {@@ -485,8 +524,9 @@ export function createLocalDraftStore());},+ ...createEmailSendJournal(transaction, withSession),async recordAttempt(- session: Session,+ session: DraftStorageSession,attempt: AttemptRecord): Promise<void> {await transaction<void>('readwrite', (tx, finish) =>@@ -506,7 +546,7 @@ export function createLocalDraftStore();},async removeAttempt(- session: Session,+ session: DraftStorageSession,storageGeneration: string,transactionId: string): Promise<void> {@@ -539,7 +579,7 @@ export function createLocalDraftStore(false);},- async attempts(session: Session): Promise<AttemptRecord[]> {+ async attempts(session: DraftStorageSession): Promise<AttemptRecord[]> {return await transaction('readwrite',(tx, finish) =>@@ -577,12 +617,13 @@ export function createLocalDraftStore(const meta = tx.objectStore('meta');const request = meta.get('session');request.onsuccess = () => {- const previous = request.result as Session | undefined;+ const previous = request.result as DraftStorageSession | undefined;if (expectedEpoch && previous && previous.epoch !== expectedEpoch) {finish();return;}- for (const name of STORES) tx.objectStore(name).clear();+ for (const name of STORES)+ if (name !== 'sends') tx.objectStore(name).clear();if (retire && previous)meta.put(true, ['retired-session', previous.epoch]);finish();diff --git a/apps/web/src/lib/queries/email/local-drafts.test.ts b/apps/web/src/lib/queries/email/local-drafts.test.tsindex 7a6fdbb80e..c6e070f2b1 100644--- a/apps/web/src/lib/queries/email/local-drafts.test.ts+++ b/apps/web/src/lib/queries/email/local-drafts.test.ts@@ -1,13 +1,17 @@import 'fake-indexeddb/auto';+import { File as NodeFile } from 'node:buffer';import type { CacheHost } from '@graphql-cache/host/types';import type {ClaimedMutation,MutationInspection,} from '@graphql-cache/protocol';import type { OperationResult } from '@urql/core';+import { IDBFactory } from 'fake-indexeddb';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';const auth = vi.hoisted(() => ({ user: { authenticated: true, id: 'owner' } }));+const native = vi.hoisted(() => ({ active: false }));+vi.mock('@core/util/platform', () => ({ isTauri: () => native.active }));const telemetry = vi.hoisted(() => ({track: vi.fn(),posthog: { captureException: vi.fn() },@@ -33,13 +37,21 @@ const host = {inspectMutations: async () => queue,currentStorageGeneration: async () => 'storage',} as unknown as CacheHost;-const claimed = (metadata: unknown) =>- ({- transactionId: 'tx',- clientMetadata: metadata,- operationName: 'SaveEmailDraft',- superseded: false,- }) as ClaimedMutation;+const claimed = (+ metadata: ClaimedMutation['clientMetadata']+): ClaimedMutation => ({+ transactionId: 'tx',+ uuid: 'local',+ requiresConfirmation: false,+ leaseGeneration: 'lease',+ query: '',+ attemptCount: 0,+ serverFailureCount: 0,+ clientMetadata: metadata,+ operationName: 'SaveEmailDraft',+ superseded: false,+ variables: { input: { draftId: 'local' } },+});const success = {data: {saveEmailDraft: { draftId: 'server', thread: { id: 'server-thread' } },@@ -51,22 +63,262 @@ const failure = {beforeEach(async () => {vi.resetModules();+ vi.stubGlobal('indexedDB', new IDBFactory());localStorage.clear();queue.length = 0;auth.user = { authenticated: true, id: 'owner' };stagedUpload.mockReset();+ native.active = false;telemetry.track.mockClear();telemetry.posthog.captureException.mockClear();runtime = await import('./local-drafts');await runtime.localDraftStore.clear();});afterEach(async () => {- vi.unstubAllGlobals();await runtime.localDraftStore.close();+ vi.unstubAllGlobals();vi.restoreAllMocks();});describe('draft queue recovery', () => {+ it('preserves another device working copy when its pre-Undo server generation is rejected', async () => {+ const local = await runtime.saveLocalDraft({+ ...input('Offline edits from device B'),+ draft: { subject: 'Offline edits from device B', draft_generation: 0 },+ });+ const attempt = await runtime.beginDraftAttempt(local, 'save');+ await runtime.localDraftQueueLifecycle(host).onMutationAttemptResult!(+ claimed(attempt),+ {+ error: {+ graphQLErrors: [{ extensions: { code: 'DRAFT_VERSION_CONFLICT' } }],+ },+ } as unknown as OperationResult,+ false+ );+ const retained = await runtime.readLocalDraft('local');+ expect(retained?.content.subject).toBe('Offline edits from device B');+ expect(retained?.status).toBe('failed');+ expect(retained?.generation).toBe(local.generation);+ });++ it('suppresses intermediate offline inbox moves once send owns the final snapshot', async () => {+ let local = await runtime.saveLocalDraft({+ ...input('Switch sender offline'),+ inboxId: 'inbox-a',+ });+ const moves: ClaimedMutation[] = [];+ for (const inboxId of ['inbox-b', 'inbox-c']) {+ local = await runtime.saveLocalDraft({+ ...input('Switch sender offline'),+ inboxId,+ expectedGeneration: local.generation,+ expectedRevision: local.revision,+ });+ moves.push({+ ...claimed(await runtime.beginDraftAttempt(local, 'save')),+ variables: { input: { draftId: 'local', linkId: inboxId } },+ });+ }+ await runtime.persistLocalEmailSend(+ {+ uuid: 'send',+ dispatchVersion: 2,+ phase: 'pending',+ locallyCancelled: false,+ metadata: {+ kind: 'email-send-v1',+ payload: {+ draft: {+ draftId: 'local',+ threadDbId: 'thread',+ senderLinkId: 'inbox-c',+ senderEmail: '[email protected]',+ subject: 'Frozen',+ optimisticBodyHtml: null,+ },+ workingCopy: local,+ input: {+ attempt: { attemptId: 'send', linkId: 'inbox-c' },+ message: { draftId: 'local', subject: 'Frozen' },+ attachmentIds: [],+ forwardedAttachmentIds: [],+ },+ },+ },+ },+ true+ );+ await runtime.forgetLocalDraft(local.key, local);+ const lifecycle = runtime.localDraftQueueLifecycle(host);+ for (const move of moves)+ expect(await lifecycle.beforeMutationAttempt!(move)).toBe(false);+ expect(await runtime.readLocalDraft('local')).toBeUndefined();+ });++ it('resumes newer send-time edits in a fresh generation without losing files or server aliases', async () => {+ vi.stubGlobal('File', NodeFile);+ const original = await runtime.saveLocalDraft(input('Approved send'));+ const stale = await runtime.beginDraftAttempt(original, 'save');+ const lifecycle = runtime.localDraftQueueLifecycle(host);+ await lifecycle.onMutationAttemptResult!(claimed(stale), success, false);+ const file = new File(['Retain these bytes'], 'newer.txt', {+ type: 'text/plain',+ });+ const newer = await runtime.saveLocalDraft({+ draft: { db_id: 'server', subject: 'Newer edits' },+ attachments: [{ type: 'local', file }],+ });++ await runtime.resumeLocalDraft('server', original.generation);+ const resumed = (await runtime.readLocalDraft('local'))!;+ expect(resumed.generation).not.toBe(original.generation);+ expect(resumed).toMatchObject({+ revision: newer.revision,+ serverDraftId: 'server',+ content: { subject: 'Newer edits' },+ });+ await runtime.resumeLocalDraft('local', original.generation);+ expect((await runtime.readLocalDraft('server'))?.generation).toBe(+ resumed.generation+ );++ // An expired RPC can return this verdict after cancellation. Its old+ // generation must not delete the newer recovered content.+ await lifecycle.onMutationAttemptResult!(+ claimed(stale),+ {+ error: {+ graphQLErrors: [{ extensions: { code: 'DRAFT_ALREADY_SENT' } }],+ },+ } as unknown as OperationResult,+ false+ );+ expect(await runtime.readLocalDraft('server')).toEqual(resumed);+ const attachments = await runtime.restoreLocalAttachments(resumed);+ const recovered = attachments[0];+ expect(recovered.type).toBe('local');+ if (recovered.type !== 'local') throw new Error('Missing recovered file');+ expect(await recovered.file.text()).toBe('Retain these bytes');++ const saved = await runtime.saveLocalDraft({+ draft: { db_id: 'server', subject: 'Edited after cancellation' },+ attachments,+ expectedGeneration: resumed.generation,+ expectedRevision: resumed.revision,+ });+ expect(saved.generation).toBe(resumed.generation);+ expect(saved.revision).toBe(resumed.revision + 1);+ await expect(+ runtime.saveLocalDraft({+ ...input('Obsolete editor'),+ expectedGeneration: original.generation,+ expectedRevision: original.revision,+ })+ ).rejects.toThrow();+ expect((await runtime.readLocalDraft('server'))?.content.subject).toBe(+ 'Edited after cancellation'+ );+ });+ it('syncs newer restored edits after atomic cancellation retires the send', async () => {+ const original = await runtime.saveLocalDraft(input('Original'));+ const stale = await runtime.beginDraftAttempt(original, 'save');+ const send = await runtime.persistLocalEmailSend(+ {+ uuid: 'send',+ dispatchVersion: 2,+ phase: 'pending',+ locallyCancelled: false,+ cancellationRequested: true,+ metadata: {+ kind: 'email-send-v1',+ payload: {+ draft: {+ draftId: 'local',+ threadDbId: 'thread',+ senderLinkId: 'inbox',+ senderEmail: '[email protected]',+ subject: 'Original',+ optimisticBodyHtml: null,+ },+ workingCopy: original,+ input: {+ attempt: { attemptId: 'send', linkId: 'inbox' },+ message: { draftId: 'local', subject: 'Original' },+ attachmentIds: [],+ forwardedAttachmentIds: [],+ },+ },+ },+ },+ true+ );+ const result = await runtime.localDraftStore.restoreSend(+ await runtime.emailStorageSession(),+ send.uuid+ );+ const edited = await runtime.saveLocalDraft(input('Newer edit'));+ const saving = await runtime.beginDraftAttempt(edited, 'save');+ const lifecycle = runtime.localDraftQueueLifecycle(host);+ expect(await lifecycle.beforeMutationAttempt!(claimed(stale))).toBe(false);+ expect(await lifecycle.beforeMutationAttempt!(claimed(saving))).toBe(true);+ await lifecycle.onMutationAttemptResult!(claimed(saving), success, false);+ expect(await runtime.readLocalDraft('local')).toMatchObject({+ generation: result!.draft.generation,+ acknowledgedRevision: edited.revision,+ content: { subject: 'Newer edit' },+ });+ });+ it('does not resurrect or replay an obsolete draft save owned by a send', async () => {+ await runtime.persistLocalEmailSend(+ {+ uuid: 'send',+ dispatchVersion: 2,+ phase: 'pending',+ locallyCancelled: false,+ metadata: {+ kind: 'email-send-v1',+ payload: {+ draft: {+ draftId: 'local',+ threadDbId: 'thread',+ senderLinkId: 'inbox',+ senderEmail: '[email protected]',+ subject: 'Frozen',+ optimisticBodyHtml: null,+ },+ input: {+ attempt: { attemptId: 'send', linkId: 'inbox' },+ message: { draftId: 'local', subject: 'Frozen' },+ attachmentIds: [],+ forwardedAttachmentIds: [],+ },+ },+ },+ },+ true+ );+ const old: MutationInspection = {+ transactionId: 'old-save',+ uuid: 'local',+ operationName: 'SaveEmailDraft',+ query: 'mutation SaveEmailDraft { saveEmailDraft { draftId } }',+ superseded: false,+ variables: { input: { draftId: 'local', subject: 'Old' } },+ optimisticData: {},+ };+ queue.push(old);+ const lifecycle = runtime.localDraftQueueLifecycle(host);+ await lifecycle.prepareMutationQueue!();+ expect(await runtime.readLocalDraft('local')).toBeUndefined();+ expect(+ await lifecycle.beforeMutationAttempt!({+ ...claimed(undefined),+ uuid: 'local',+ })+ ).toBe(false);+ expect(await runtime.readLocalDraft('local')).toBeUndefined();+ });it('reports caught storage failures and recovery with lifecycle context, without draft content', async () => {const error = new DOMException('Storage unavailable', 'UnknownError');vi.spyOn(IDBDatabase.prototype, 'transaction').mockImplementationOnce(@@ -390,3 +642,68 @@ describe('draft queue recovery', () => {});});});++it.each(['web', 'native'] as const)(+ 'serializes restored copies of one file and adopts an existing upload receipt: %s',+ async (platform) => {+ native.active = platform === 'native';+ const locks = new Map<string, Promise<unknown>>();+ const original = Object.getOwnPropertyDescriptor(navigator, 'locks');+ Object.defineProperty(navigator, 'locks', {+ configurable: true,+ value: {+ request: async (name: string, run: () => Promise<void>) => {+ const previous = locks.get(name) ?? Promise.resolve();+ const next = previous.then(run);+ locks.set(+ name,+ next.catch(() => {})+ );+ return await next;+ },+ },+ });+ if (native.active) Reflect.deleteProperty(navigator, 'locks');+ try {+ const file = new File(['upload'], 'audit.txt');+ const local = await runtime.saveLocalDraft({+ ...input(),+ attachments: [{ type: 'local', file }],+ });+ const restored = (await runtime.restoreLocalAttachments(local))[0];+ if (restored.type !== 'local') throw new Error('Expected local file');+ const pending = Promise.withResolvers<void>(),+ started = Promise.withResolvers<void>();+ const upload = vi.fn(async () => {+ started.resolve();+ await pending.promise;+ await runtime.recordLocalAttachment(+ 'local',+ file,+ 'uploaded',+ true,+ local.generation+ );+ });+ const first = runtime.withLocalAttachmentUpload('local', file, upload);+ await started.promise;+ const adopt = vi.fn(async (receipt) => {+ expect(receipt.uploaded).toBe(true);+ expect(receipt.attachmentId).toBe('uploaded');+ });+ const second = runtime.withLocalAttachmentUpload(+ 'local',+ restored.file,+ adopt+ );+ expect(adopt).not.toHaveBeenCalled();+ pending.resolve();+ await Promise.all([first, second]);+ expect(upload).toHaveBeenCalledOnce();+ expect(adopt).toHaveBeenCalledOnce();+ } finally {+ if (original) Object.defineProperty(navigator, 'locks', original);+ else Reflect.deleteProperty(navigator, 'locks');+ }+ }+);diff --git a/apps/web/src/lib/queries/email/local-drafts.ts b/apps/web/src/lib/queries/email/local-drafts.tsindex e1ccffaf9c..0765c00f3d 100644--- a/apps/web/src/lib/queries/email/local-drafts.ts+++ b/apps/web/src/lib/queries/email/local-drafts.ts@@ -9,6 +9,7 @@ import type { EmailMessage } from '@app/features/email-message/core/email-messagimport { analytics } from '@app/lib/analytics';import { getNativeStagedUpload } from '@core/mobile/nativeStagedUpload';import { fireAndForget } from '@core/util/fireAndForget';+import { isTauri } from '@core/util/platform';import type { NormalizedCacheExchangeOptions } from '@graphql-cache/exchange/normalized-cache-exchange';import type { CacheHost } from '@graphql-cache/host/types';import type {@@ -21,6 +22,8 @@ import type { UserInfoData } from '../auth/user-info';import { queryClient } from '../client';import { createLocalDraftStore } from './local-draft-store';+import type { EmailSendIntent } from './send-intent';+export const localDraftStore = createLocalDraftStore(undefined, (event) => {const context = {storage: 'email-working-copies',@@ -35,6 +38,7 @@ export const localDraftStore = createLocalDraftStore(undefined, (event) => {});const fileIds = new WeakMap<File, string>();const fileCopies = new WeakMap<File, Promise<Blob>>();+const nativeUploadLocks = new Map<string, Promise<void>>();const pendingWrites = new Set<Promise<LocalDraft>>();const EPOCH_KEY = 'email-working-copies:epoch';let documentSession: { accountId: string; epoch: string } | undefined;@@ -86,7 +90,7 @@ export async function clearLocalDrafts(): Promise<void> {}}-async function session() {+export async function emailStorageSession() {const user = queryClient.getQueryData<UserInfoData>(authKeys.userInfo.queryKey);@@ -123,13 +127,13 @@ async function session() {}export async function listLocalDrafts(): Promise<LocalDraft[]> {- const owner = await session();+ const owner = await emailStorageSession();return await localDraftStore.list(owner);}export async function readLocalDraft(id: string): Promise<LocalDraft | undefined> {- return await localDraftStore.read(await session(), id);+ return await localDraftStore.read(await emailStorageSession(), id);}/** Local body HTML uses the same base64 representation as the editor's save input. */@@ -244,7 +248,7 @@ async function finishLocalWrite(write: Promise<LocalDraft>): Promise<void> {}async function persistLocalDraft(input: LocalDraftInput): Promise<LocalDraft> {- const owner = await session();+ const owner = await emailStorageSession();const id = input.clientHandles?.draftId ?? input.draft.db_id;if (!id)throw new Error('Draft identity must be minted before local persistence');@@ -329,7 +333,7 @@ async function persistLocalDraft(input: LocalDraftInput): Promise<LocalDraft> {export async function restoreLocalAttachments(local: LocalDraft): Promise<DraftFormAttachment[]> {- const owner = await session();+ const owner = await emailStorageSession();const attachments: DraftFormAttachment[] = [];for (const attachment of local.attachments) {if (attachment.type !== 'local') {@@ -365,12 +369,21 @@ export function draftSyncPaused(local: LocalDraft): boolean {);}-export async function resumeLocalDraft(id: string): Promise<void> {- const owner = await session();+export async function resumeLocalDraft(+ id: string,+ retireGeneration?: string+): Promise<void> {+ const owner = await emailStorageSession();const draft = await localDraftStore.read(owner, id);if (!draft) return;await localDraftStore.update(owner, draft.key, (current) => ({...current,+ // Explicit send recovery keeps newer edits and their blobs while fencing+ // callbacks from the send's old lifetime. Concurrent restores rotate once.+ generation:+ current.generation === retireGeneration+ ? crypto.randomUUID()+ : current.generation,status: 'dirty',errorCode: undefined,latestAttemptId: undefined,@@ -378,15 +391,25 @@ export async function resumeLocalDraft(id: string): Promise<void> {}));}-export async function forgetLocalDraft(id: string): Promise<void> {- const owner = await session();+export async function forgetLocalDraft(+ id: string,+ expected?: Pick<LocalDraft, 'generation' | 'revision'>+): Promise<void> {+ const owner = await emailStorageSession();const draft = await localDraftStore.read(owner, id);- if (draft) await localDraftStore.update(owner, draft.key, () => undefined);+ if (draft)+ await localDraftStore.update(owner, draft.key, (current) =>+ expected &&+ (current.generation !== expected.generation ||+ current.revision !== expected.revision)+ ? current+ : undefined+ );}/** Only an explicit server Undo may start a fresh lifetime for a retired handle. */export async function reviveLocalDraft(id: string): Promise<void> {- const owner = await session();+ const owner = await emailStorageSession();await localDraftStore.generation(owner, id, true);}@@ -394,7 +417,7 @@ export async function clearLocalAttachmentReceipt(draftId: string,attachmentId: string): Promise<void> {- const owner = await session();+ const owner = await emailStorageSession();const draft = await localDraftStore.read(owner, draftId);if (!draft) return;await localDraftStore.update(owner, draft.key, (current) => ({@@ -412,12 +435,18 @@ export async function recordLocalAttachment(draftId: string,file: File,attachmentId: string | undefined,- uploaded: boolean+ uploaded: boolean,+ expectedGeneration?: string): Promise<void> {- const owner = await session();+ const owner = await emailStorageSession();const draft = await localDraftStore.read(owner, draftId);const id = fileIds.get(file);- if (!draft || !id) return;+ if (+ !draft ||+ !id ||+ (expectedGeneration && draft.generation !== expectedGeneration)+ )+ return;await localDraftStore.update(owner, draft.key, (current) => {if (current.generation !== draft.generation) return current;const attachments = current.attachments.map((attachment) =>@@ -445,7 +474,7 @@ export async function beginDraftAttempt(local: LocalDraft,operation: 'save' | 'delete'): Promise<DraftAttempt> {- const owner = await session();+ const owner = await emailStorageSession();if (local.accountId !== owner.accountId)throw new Error('This draft belongs to a previous account');const attempt: DraftAttempt = {@@ -478,7 +507,7 @@ export async function beginDraftAttempt(export async function markDraftAttemptQueued(attempt: DraftAttempt): Promise<void> {- const owner = await session();+ const owner = await emailStorageSession();if (owner.accountId !== attempt.accountId) return;await localDraftStore.update(owner, attempt.draftKey, (draft) =>draft.generation !== attempt.generation ||@@ -539,6 +568,38 @@ export function localDraftQueueLifecycle(let initialized: Promise<void> | undefined;const legacy = new Map<string, DraftAttempt>();const migrated = new Map<string, number>();+ async function ownedBySend(mutation: ClaimedMutation | MutationInspection) {+ if (+ mutation.operationName !== 'SaveEmailDraft' &&+ mutation.operationName !== 'DeleteEmailDraft'+ )+ return false;+ const id = text(object(mutation.variables.input).draftId);+ if (!id) return false;+ const intents = await readLocalEmailSends();+ return intents.some((value) => {+ const intent = object(value);+ const metadata = object(intent.metadata);+ if (metadata.kind !== 'email-send-v1') return false;+ const payload = object(metadata.payload);+ const response = object(intent.response);+ const attempt = object(+ object(response.cancelEmailSend ?? response.sendEmailMessage).attempt+ );+ const restoredAttempt = attemptOf(mutation);+ if (+ (intent.locallyCancelled || attempt.status === 'CANCELLED') &&+ restoredAttempt &&+ restoredAttempt.generation !== object(payload.workingCopy).generation+ )+ return false;+ return [+ object(payload.draft).draftId,+ object(payload.workingCopy).key,+ object(attempt.message).id,+ ].includes(id);+ });+ }async function preserveLegacy(mutation: MutationInspection): Promise<DraftAttempt | undefined> {@@ -547,9 +608,10 @@ export function localDraftQueueLifecycle(mutation.operationName !== 'DeleteEmailDraft')return;+ if (await ownedBySend(mutation)) return;const known = legacy.get(mutation.transactionId);if (known) return known;- const owner = await session();+ const owner = await emailStorageSession();const storageGeneration = await host.currentStorageGeneration();const saved = (await localDraftStore.attempts(owner)).find((entry) =>@@ -663,7 +725,7 @@ export function localDraftQueueLifecycle(return attempt;}async function prepare() {- const owner = await session();+ const owner = await emailStorageSession();if (!host.inspectMutations)throw new Error('Draft recovery requires an updated cache runtime');const before = await localDraftStore.list(owner);@@ -762,9 +824,10 @@ export function localDraftQueueLifecycle(mutation.operationName === 'DeleteEmailDraft'))return 'defer';+ if (await ownedBySend(mutation)) return false;const attempt = await resolveAttempt(mutation);if (!attempt) return true;- const owner = await session();+ const owner = await emailStorageSession();if (owner.accountId !== attempt.accountId) return false;const local = await localDraftStore.read(owner, attempt.draftKey);if (!local || local.generation !== attempt.generation) return false;@@ -794,7 +857,7 @@ async function settleDraftAttempt(result: OperationResult,superseded: boolean) {- const owner = await session();+ const owner = await emailStorageSession();if (owner.accountId !== attempt.accountId) return;const code = result.error?.graphQLErrors[0]?.extensions.code;const failed = !!result.error || result.data == null;@@ -843,3 +906,65 @@ async function settleDraftAttempt(};});}++export async function readLocalEmailSends(): Promise<EmailSendIntent[]> {+ return await localDraftStore.sends(await emailStorageSession());+}+export async function persistLocalEmailSend(+ intent: EmailSendIntent,+ reserve = false+): Promise<EmailSendIntent> {+ return await localDraftStore.putSend(+ await emailStorageSession(),+ intent,+ reserve+ );+}+export async function removeLocalEmailSend(uuid: string): Promise<void> {+ await localDraftStore.removeSend(await emailStorageSession(), uuid);+}+export function watchLocalEmailSends(changed: () => void): () => void {+ return localDraftStore.subscribe(changed);+}++/** Web Locks serialize one durable file's upload across composers and tabs. */+export async function withLocalAttachmentUpload(+ draftId: string,+ file: File,+ upload: (+ receipt: Extract<LocalDraftAttachment, { type: 'local' }>,+ generation: string+ ) => Promise<void>+): Promise<void> {+ const owner = await emailStorageSession();+ const draft = await localDraftStore.read(owner, draftId);+ const id = fileIds.get(file);+ if (!draft || !id)+ throw new Error('Save the attachment on this device before uploading');+ const name = `macro-email-upload:${owner.accountId}:${draft.key}:${draft.generation}:${id}`;+ const run = async () => {+ await emailStorageSession();+ const current = await localDraftStore.read(owner, draft.key);+ const receipt = current?.attachments.find(+ (attachment) => attachment.type === 'local' && attachment.id === id+ );+ if (current?.generation !== draft.generation || receipt?.type !== 'local')+ throw new Error('This attachment belongs to an obsolete draft');+ await upload(receipt, current.generation);+ };+ if (navigator.locks) {+ await navigator.locks.request(name, run);+ return;+ }+ if (!isTauri())+ throw new Error('This browser cannot safely upload queued attachments');+ // The native app has one main webview; serialize its composers even on older WebKit.+ const previous = nativeUploadLocks.get(name) ?? Promise.resolve();+ const next = previous.catch(() => {}).then(run);+ nativeUploadLocks.set(name, next);+ try {+ await next;+ } finally {+ if (nativeUploadLocks.get(name) === next) nativeUploadLocks.delete(name);+ }+}diff --git a/apps/web/src/lib/queries/email/outbox-session.ts b/apps/web/src/lib/queries/email/outbox-session.tsnew file mode 100644index 0000000000..14e78da7d7--- /dev/null+++ b/apps/web/src/lib/queries/email/outbox-session.ts@@ -0,0 +1,76 @@+import { fireAndForget } from '@core/util/fireAndForget';+import {+ cancelEmailSend,+ readEmailSendStatus,+ submitEmailSend,+} from '@service-storage/email-send';+import { createEmailSendDispatcher } from './email-send-dispatcher';+import { createEmailSendRecovery } from './email-send-recovery';+import { emailStorageSession, localDraftStore } from './local-drafts';+import {+ emailSendFailureKind,+ recordEmailSend,+ traceEmailSend,+} from './send-telemetry';+import { setServerSendSession } from './server-sends';++let account: string | undefined;+let generation = 0;+let dispatcher: ReturnType<typeof createEmailSendDispatcher> | undefined;+let retry: ReturnType<typeof setTimeout> | undefined;+let recovery: ReturnType<typeof createEmailSendRecovery> | undefined;++/** Called by the authenticated app shell, not by individual email surfaces. */+export function setEmailOutboxSession(accountId: string | undefined): void {+ if (account === accountId) return;+ account = accountId;+ const current = ++generation;+ if (retry !== undefined) clearTimeout(retry);+ dispatcher?.dispose();+ recovery?.dispose();+ recovery = undefined;+ dispatcher = undefined;+ setServerSendSession(accountId);+ if (accountId) fireAndForget(start(accountId, current), 'email-outbox');+}++async function start(accountId: string, current: number) {+ let session: Awaited<ReturnType<typeof emailStorageSession>>;+ try {+ session = await emailStorageSession();+ } catch (error) {+ if (current === generation) {+ retry = setTimeout(() => {+ fireAndForget(start(accountId, current), 'email-outbox');+ }, 5_000);+ }+ throw error;+ }+ if (current !== generation || session.accountId !== accountId) return;+ recovery = createEmailSendRecovery(accountId);+ dispatcher = createEmailSendDispatcher({+ session,+ journal: localDraftStore,+ submit: (intent, signal) =>+ traceEmailSend('submit', intent.metadata.payload.input.attempt, () =>+ submitEmailSend(intent.metadata.payload.input, signal)+ ),+ cancel: (intent, signal) =>+ traceEmailSend('cancel', intent.metadata.payload.input.attempt, () =>+ cancelEmailSend(intent.metadata.payload.input.attempt, signal)+ ),+ status: (intent, signal) =>+ traceEmailSend('status', intent.metadata.payload.input.attempt, () =>+ readEmailSendStatus(intent.metadata.payload.input.attempt, signal)+ ),+ report: (intent, error) =>+ recordEmailSend(+ {+ operation: 'recover',+ outcome: error ? 'error' : 'completed',+ failureKind: error ? emailSendFailureKind(error) : undefined,+ },+ intent+ ),+ });+}diff --git a/apps/web/src/lib/queries/email/queued-sends.test.ts b/apps/web/src/lib/queries/email/queued-sends.test.tsnew file mode 100644index 0000000000..c192a1f22f--- /dev/null+++ b/apps/web/src/lib/queries/email/queued-sends.test.ts@@ -0,0 +1,143 @@+import { createRoot } from 'solid-js';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { useQueuedEmailSends } from './queued-sends';+import type { EmailSendIntent } from './send-queue';++const mocks = vi.hoisted(() => ({+ read: vi.fn(),+ recover: vi.fn(async () => {}),+ status: vi.fn(async () => null),+ warn: vi.fn(),+ info: vi.fn(),+}));+vi.mock('@macro-inc/observability', () => ({+ Telemetry: { info: mocks.info, warn: mocks.warn },+}));+vi.mock('./send-queue', async (original) => ({+ ...(await original<typeof import('./send-queue')>()),+ readEmailSendIntents: mocks.read,+ recoverEmailSendIntent: mocks.recover,+ fetchEmailSendStatus: mocks.status,+ retireEmailSendIntent: async () => false,+ watchEmailSends: () => () => {},+}));++const intent: EmailSendIntent = {+ uuid: 'attempt',+ dispatchVersion: 2,+ phase: 'pending',+ locallyCancelled: false,+ cancellationRequested: true,+ metadata: {+ kind: 'email-send-v1',+ payload: {+ input: {+ attempt: { attemptId: 'attempt', linkId: 'inbox' },+ message: { draftId: 'draft', subject: 'Recovered decision' },+ attachmentIds: [],+ forwardedAttachmentIds: [],+ },+ draft: {+ draftId: 'draft',+ threadDbId: 'thread',+ senderLinkId: 'inbox',+ senderEmail: '[email protected]',+ subject: 'Recovered decision',+ optimisticBodyHtml: null,+ },+ },+ },+};++beforeEach(() => {+ vi.clearAllMocks();+ mocks.recover.mockResolvedValue(undefined);+ mocks.status.mockResolvedValue(null);+ vi.stubGlobal('navigator', { onLine: true });+ vi.stubGlobal('window', { addEventListener() {}, removeEventListener() {} });+});+afterEach(() => vi.unstubAllGlobals());++it('observes persisted sends without submitting or reconciling from the composer', async () => {+ mocks.read.mockResolvedValue([intent]);+ let dispose = () => {};+ const queue = createRoot((cleanup) => {+ dispose = cleanup;+ return useQueuedEmailSends();+ });+ try {+ await queue.refresh();+ expect(queue.ready()).toBe(true);+ expect(queue.intents()).toEqual([intent]);+ expect(mocks.recover).not.toHaveBeenCalled();+ expect(mocks.status).not.toHaveBeenCalled();+ } finally {+ dispose();+ }+});++it('reports unavailable storage once until a read succeeds, while preserving readiness', async () => {+ mocks.read.mockRejectedValue(new Error('PRIVATE storage failure'));+ let dispose = () => {};+ const queue = createRoot((cleanup) => {+ dispose = cleanup;+ return useQueuedEmailSends();+ });+ try {+ await queue.refresh();+ await queue.refresh();+ expect(mocks.warn).toHaveBeenCalledTimes(1);+ expect(queue.ready()).toBe(false);+ mocks.read.mockResolvedValue([]);+ await queue.refresh();+ expect(queue.ready()).toBe(true);+ mocks.read.mockRejectedValue(new Error('PRIVATE storage failure'));+ await queue.refresh();+ expect(mocks.warn).toHaveBeenCalledTimes(2);+ } finally {+ dispose();+ }+});++it.each([false, true])(+ 'starts and cleans up polling only for an enabled observer: %s',+ async (enabled) => {+ const interval = vi.spyOn(globalThis, 'setInterval');+ const clear = vi.spyOn(globalThis, 'clearInterval');+ mocks.read.mockResolvedValue([]);+ let dispose = () => {};+ createRoot((cleanup) => {+ dispose = cleanup;+ useQueuedEmailSends(() => enabled);+ });+ await Promise.resolve();+ if (enabled)+ expect(interval).toHaveBeenCalledWith(expect.any(Function), 5_000);+ else expect(interval).not.toHaveBeenCalled();+ dispose();+ if (enabled) expect(clear).toHaveBeenCalled();+ interval.mockRestore();+ clear.mockRestore();+ }+);++it('ignores a late failed read after a newer journal refresh succeeds', async () => {+ mocks.read.mockResolvedValue([]);+ let dispose = () => {};+ const queue = createRoot((cleanup) => {+ dispose = cleanup;+ return useQueuedEmailSends();+ });+ await Promise.resolve();+ const oldRead = Promise.withResolvers<EmailSendIntent[]>();+ mocks.read.mockReturnValueOnce(oldRead.promise);+ const oldRefresh = queue.refresh();+ mocks.read.mockResolvedValue([intent]);+ await queue.refresh();+ oldRead.reject(new Error('late storage error'));+ await oldRefresh;+ expect(queue.ready()).toBe(true);+ expect(queue.intents()).toEqual([intent]);+ expect(mocks.warn).not.toHaveBeenCalled();+ dispose();+});diff --git a/apps/web/src/lib/queries/email/queued-sends.ts b/apps/web/src/lib/queries/email/queued-sends.tsnew file mode 100644index 0000000000..54c1d64d3e--- /dev/null+++ b/apps/web/src/lib/queries/email/queued-sends.ts@@ -0,0 +1,61 @@+import { fireAndForget } from '@core/util/fireAndForget';+import { createSignal, onCleanup, onMount } from 'solid-js';+import {+ type EmailSendIntent,+ readEmailSendIntents,+ watchEmailSends,+} from './send-queue';+import { emailSendFailureKind, recordEmailSend } from './send-telemetry';++/** Owner-scoped observer; missed events are recovered by reading durable state. */+export function useQueuedEmailSends(enabled: () => boolean = () => true) {+ const [intents, setIntents] = createSignal<EmailSendIntent[]>([]);+ const [ready, setReady] = createSignal(false);+ let disposed = false;+ let generation = 0;+ let storageFailureReported = false;+ const refresh = async () => {+ if (!enabled()) return;+ const current = ++generation;+ try {+ const rows = await readEmailSendIntents();+ if (disposed || current !== generation) return;+ storageFailureReported = false;+ setIntents(rows);+ setReady(true);+ } catch (error) {+ if (!disposed && current === generation && !storageFailureReported) {+ storageFailureReported = true;+ recordEmailSend({+ operation: 'refresh',+ outcome: 'error',+ failureKind: emailSendFailureKind(error),+ });+ }+ if (!disposed && current === generation)+ setReady(+ false+ ); /* Missing storage is uncertainty, not an empty queue. */+ }+ };+ onMount(() => {+ fireAndForget(refresh(), 'email-queued-sends');+ const unsubscribe = enabled()+ ? watchEmailSends(() => {+ fireAndForget(refresh(), 'email-queued-sends');+ })+ : () => {};+ const reconnect = () => {+ fireAndForget(refresh(), 'email-queued-sends');+ };+ window.addEventListener('online', reconnect);+ const interval = enabled() ? setInterval(reconnect, 5_000) : undefined;+ onCleanup(() => {+ disposed = true;+ unsubscribe();+ if (interval !== undefined) clearInterval(interval);+ window.removeEventListener('online', reconnect);+ });+ });+ return { intents, ready, refresh };+}diff --git a/apps/web/src/lib/queries/email/send-draft-lifecycle.test.ts b/apps/web/src/lib/queries/email/send-draft-lifecycle.test.tsnew file mode 100644index 0000000000..8a4ede78bf--- /dev/null+++ b/apps/web/src/lib/queries/email/send-draft-lifecycle.test.ts@@ -0,0 +1,404 @@+import 'fake-indexeddb/auto';+import type { DraftFormAttachment } from '@app/features/email-compose/primitives/email-form-state';+import type { CacheHost } from '@graphql-cache/host/types';+import type { ClaimedMutation } from '@graphql-cache/protocol';+import { SaveEmailDraftDocument } from '@service-storage/graphql/generated/graphql';+import { createRequest, makeOperation, type OperationResult } from '@urql/core';+import { print } from 'graphql';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import type { GraphqlSaveEmailDraftArgs } from './graphql/draft';+import type { LocalDraftInput } from './local-drafts';++const auth = vi.hoisted(() => ({ user: { authenticated: true, id: 'owner' } }));+vi.mock('../client', () => ({+ queryClient: { getQueryData: () => auth.user },+}));+vi.mock('@core/mobile/nativeStagedUpload', () => ({+ getNativeStagedUpload: () => undefined,+}));+vi.mock('@macro-inc/observability', () => ({+ Telemetry: { error: vi.fn() },+}));++let drafts: typeof import('./local-drafts');+let lifecycle: typeof import('./send-draft-lifecycle');++const args: GraphqlSaveEmailDraftArgs = {+ draftId: 'local-draft',+ threadDbId: 'local-thread',+ senderLinkId: 'inbox',+ senderEmail: '[email protected]',+ subject: 'Original subject',+ to: [{ email: '[email protected]' }],+ bodyText: 'Original body',+ bodyHtml: 'PHA+T3JpZ2luYWwgYm9keTwvcD4=',+ optimisticBodyHtml: '<p>Original body</p>',+};++function input(attachments: DraftFormAttachment[] = []): LocalDraftInput {+ return {+ clientHandles: { draftId: String(args.draftId), threadId: args.threadDbId },+ inboxId: args.senderLinkId,+ senderEmail: args.senderEmail,+ draft: {+ subject: args.subject,+ to: args.to,+ body_text: args.bodyText,+ body_html: args.bodyHtml,+ },+ attachments,+ };+}++function uploadedAttachments(): DraftFormAttachment[] {+ return [+ {+ type: 'local',+ file: new File(['hello'], 'uploaded.txt', { type: 'text/plain' }),+ attachmentId: 'uploaded',+ uploaded: true,+ },+ {+ type: 'forwarded',+ attachmentId: 'forwarded',+ fileName: 'forwarded.pdf',+ mimeType: 'application/pdf',+ fileSize: 25,+ },+ ];+}++beforeEach(async () => {+ vi.resetModules();+ localStorage.clear();+ drafts = await import('./local-drafts');+ lifecycle = await import('./send-draft-lifecycle');+ await drafts.localDraftStore.clear();+});++afterEach(async () => {+ vi.unstubAllGlobals();+ await drafts.localDraftStore.close();+});++it('restores the frozen alias into a replacement working copy after restart', async () => {+ const alias = '[email protected]';+ const frozen = JSON.parse(JSON.stringify({ ...args, senderEmail: alias }));+ await drafts.localDraftStore.close();+ vi.resetModules();+ drafts = await import('./local-drafts');+ lifecycle = await import('./send-draft-lifecycle');++ const restoredArgs = await lifecycle.restoreSendWorkingCopy(+ frozen,+ undefined+ );+ const restored = (await drafts.readLocalDraft(String(args.draftId)))!;++ expect(restored.content.sender_email).toBe(alias);+ expect(restored.senderEmail).toBe(alias);+ expect(drafts.localDraftMessage(restored).from?.email).toBe(alias);+ expect(restoredArgs.senderEmail).toBe(alias);+});++it('preserves the sender of an older working copy without content.sender_email', async () => {+ const alias = '[email protected]';+ const legacy = await drafts.saveLocalDraft({+ ...input(),+ senderEmail: alias,+ });+ expect(legacy.content.sender_email).toBeUndefined();++ const restoredArgs = await lifecycle.restoreSendWorkingCopy(args, undefined);++ expect(restoredArgs.senderEmail).toBe(alias);+ expect(+ drafts.localDraftMessage((await drafts.readLocalDraft(legacy.key))!).from+ ).toBe(alias);+});++it('preserves uploaded and forwarded descriptors through retirement, restart, and offline restore', async () => {+ const original = await drafts.saveLocalDraft(input(uploadedAttachments()));+ const captured = await lifecycle.captureSendWorkingCopy(+ original.key,+ ['uploaded'],+ ['forwarded'],+ original+ );+ expect(captured).toMatchObject({+ key: original.key,+ generation: original.generation,+ revision: original.revision,+ attachments: [+ { type: 'local', attachmentId: 'uploaded', uploaded: true },+ { type: 'forwarded', attachmentId: 'forwarded' },+ ],+ });+ // The durable send journal carries serializable descriptors, not file blobs.+ const recovered = JSON.parse(JSON.stringify(captured));+ expect(recovered).toEqual(captured);+ await lifecycle.retireSendWorkingCopy(captured);+ expect(await drafts.readLocalDraft(original.key)).toBeUndefined();+ await drafts.localDraftStore.close();+ vi.resetModules();+ drafts = await import('./local-drafts');+ lifecycle = await import('./send-draft-lifecycle');+ const fetch = vi.fn(() => Promise.reject(new Error('Offline')));+ vi.stubGlobal('fetch', fetch);++ const restoredArgs = await lifecycle.restoreSendWorkingCopy(args, recovered);+ const restored = (await drafts.readLocalDraft(original.key))!;+ expect(restored.generation).not.toBe(original.generation);+ expect(restored.attachments).toEqual([+ {+ type: 'remote',+ attachmentId: 'uploaded',+ fileName: 'uploaded.txt',+ contentType: 'text/plain',+ fileSize: 5,+ url: '',+ },+ {+ type: 'forwarded',+ attachmentId: 'forwarded',+ fileName: 'forwarded.pdf',+ mimeType: 'application/pdf',+ fileSize: 25,+ },+ ]);+ expect(await drafts.restoreLocalAttachments(restored)).toEqual(+ restored.attachments+ );+ expect(restoredArgs).toMatchObject({+ draftId: original.draftId,+ localRevision: restored.revision,+ subject: args.subject,+ to: args.to,+ bodyHtml: args.bodyHtml,+ bodyText: args.bodyText,+ optimisticBodyHtml: '<p>Original body</p>',+ });+ expect(fetch).not.toHaveBeenCalled();+});++it('fences old save results, stale editor callbacks, and delayed retirement after restore', async () => {+ const original = await drafts.saveLocalDraft(input());+ const attempt = await drafts.beginDraftAttempt(original, 'save');+ const captured = await lifecycle.captureSendWorkingCopy(+ original.key,+ [],+ [],+ original+ );+ await lifecycle.retireSendWorkingCopy(captured);+ await lifecycle.restoreSendWorkingCopy(args, captured);+ const restored = (await drafts.readLocalDraft(original.key))!;+ expect(restored.generation).not.toBe(original.generation);+ const host = {+ inspectMutations: async () => [],+ currentStorageGeneration: async () => 'storage',+ } as unknown as CacheHost;+ const variables = {+ input: {+ draftId: original.draftId,+ threadDbId: original.threadId,+ subject: original.content.subject,+ },+ };+ const claimed: ClaimedMutation = {+ transactionId: 'old-save',+ uuid: '00000000-0000-4000-8000-000000000001',+ clientMetadata: attempt,+ operationName: 'SaveEmailDraft',+ superseded: false,+ requiresConfirmation: false,+ leaseGeneration: '1',+ query: print(SaveEmailDraftDocument),+ variables,+ identity: auth.user.id,+ attemptCount: 1,+ serverFailureCount: 0,+ };+ const response: OperationResult = {+ operation: makeOperation(+ 'mutation',+ createRequest(SaveEmailDraftDocument, variables),+ { url: 'http://email-send.test/graphql', requestPolicy: 'network-only' }+ ),+ data: {+ saveEmailDraft: {+ draftId: 'stale-server-id',+ thread: { id: 'stale-thread' },+ },+ },+ stale: false,+ hasNext: false,+ };+ await drafts.localDraftQueueLifecycle(host).onMutationAttemptResult!(+ claimed,+ response,+ false+ );+ await lifecycle.retireSendWorkingCopy(captured);+ await expect(+ drafts.saveLocalDraft({+ ...input(),+ draft: { subject: 'Stale editor text' },+ expectedGeneration: original.generation,+ expectedRevision: original.revision,+ })+ ).rejects.toThrow();+ expect(await drafts.readLocalDraft(original.key)).toEqual(restored);+});++it('preserves a newer revision when send cleanup arrives after another local edit', async () => {+ const original = await drafts.saveLocalDraft(input());+ const captured = await lifecycle.captureSendWorkingCopy(+ original.key,+ [],+ [],+ original+ );+ const newer = await drafts.saveLocalDraft({+ ...input(),+ draft: { subject: 'Newer unsent edit', body_text: 'Keep this content' },+ });+ await lifecycle.retireSendWorkingCopy(captured);+ const restored = await lifecycle.restoreSendWorkingCopy(args, captured);+ const resumed = (await drafts.readLocalDraft(original.key))!;+ expect(resumed.generation).not.toBe(original.generation);+ expect(resumed).toMatchObject({+ revision: newer.revision,+ content: newer.content,+ });+ expect(restored).toMatchObject({+ subject: 'Newer unsent edit',+ bodyText: 'Keep this content',+ localRevision: newer.revision,+ });+ await lifecycle.retireSendWorkingCopy(captured);+ expect(await drafts.readLocalDraft(original.key)).toEqual(resumed);+});++it('reuses newer edits from another restored generation instead of the old send snapshot', async () => {+ const original = await drafts.saveLocalDraft(input());+ const captured = await lifecycle.captureSendWorkingCopy(+ original.key,+ [],+ [],+ original+ );+ await lifecycle.retireSendWorkingCopy(captured);+ await lifecycle.restoreSendWorkingCopy(args, captured);+ const newer = await drafts.saveLocalDraft({+ ...input(),+ inboxId: 'other-inbox',+ senderEmail: '[email protected]',+ draft: {+ subject: 'Edited after restore',+ to: [{ email: '[email protected]' }],+ body_text: 'New body',+ body_html: 'PHA+TmV3IGJvZHk8L3A+',+ },+ });++ const restoredAgain = await lifecycle.restoreSendWorkingCopy(args, captured);+ expect(restoredAgain).toMatchObject({+ localRevision: newer.revision,+ senderLinkId: 'other-inbox',+ linkId: 'other-inbox',+ senderEmail: '[email protected]',+ subject: 'Edited after restore',+ to: [{ email: '[email protected]' }],+ bodyText: 'New body',+ optimisticBodyHtml: '<p>New body</p>',+ });+ expect(await drafts.readLocalDraft(original.key)).toMatchObject({+ generation: newer.generation,+ revision: newer.revision,+ content: newer.content,+ });+});++it('rejects a send with an allocated attachment id whose upload is incomplete', async () => {+ const local = await drafts.saveLocalDraft(+ input([+ {+ type: 'local',+ file: new File(['pending'], 'pending.txt'),+ attachmentId: 'allocated',+ uploaded: false,+ },+ ])+ );+ await expect(+ lifecycle.captureSendWorkingCopy(local.key, ['allocated'], [], local)+ ).rejects.toThrow('Finish uploading');+ expect(await drafts.readLocalDraft(local.key)).toEqual(local);+});++it.each([+ [[], ['forwarded']],+ [['uploaded'], []],+ [['uploaded', 'unexpected'], ['forwarded']],+ [['forwarded'], ['uploaded']],+])(+ 'rejects changed send attachment membership (%j, %j)',+ async (files, forwards) => {+ const local = await drafts.saveLocalDraft(input(uploadedAttachments()));+ await expect(+ lifecycle.captureSendWorkingCopy(local.key, files, forwards, local)+ ).rejects.toThrow('Attachments changed');+ expect(await drafts.readLocalDraft(local.key)).toEqual(local);+ }+);++it('rejects newer edits made after the sending editor persisted its snapshot', async () => {+ const submitted = await drafts.saveLocalDraft(input());+ const newer = await drafts.saveLocalDraft({+ ...input(),+ draft: {+ subject: 'Other tab subject',+ body_text: 'Keep these newer edits',+ },+ expectedGeneration: submitted.generation,+ expectedRevision: submitted.revision,+ });++ await expect(+ lifecycle.captureSendWorkingCopy(submitted.key, [], [], submitted)+ ).rejects.toThrow('changed while preparing the send');+ expect(await drafts.readLocalDraft(submitted.key)).toEqual(newer);+});++it('rejects a replaced draft lifetime even when its revision matches the submitted version', async () => {+ const submitted = await drafts.saveLocalDraft(input());+ await drafts.forgetLocalDraft(submitted.key, submitted);+ await drafts.reviveLocalDraft(submitted.key);+ const restored = await drafts.saveLocalDraft(input());+ expect(restored.revision).toBe(submitted.revision);+ expect(restored.generation).not.toBe(submitted.generation);++ await expect(+ lifecycle.captureSendWorkingCopy(submitted.key, [], [], submitted)+ ).rejects.toThrow('changed while preparing the send');+ expect(await drafts.readLocalDraft(submitted.key)).toEqual(restored);+});++it('rejects a working copy removed after the sending editor persisted it', async () => {+ const submitted = await drafts.saveLocalDraft(input());+ await drafts.forgetLocalDraft(submitted.key, submitted);++ await expect(+ lifecycle.captureSendWorkingCopy(submitted.key, [], [], submitted)+ ).rejects.toThrow('changed while preparing the send');+});++it('requires the sending editor version when a local working copy exists', async () => {+ const local = await drafts.saveLocalDraft(input());+ await expect(+ lifecycle.captureSendWorkingCopy(local.key, [], [])+ ).rejects.toThrow('changed while preparing the send');+ expect(await drafts.readLocalDraft(local.key)).toEqual(local);+});diff --git a/apps/web/src/lib/queries/email/send-draft-lifecycle.ts b/apps/web/src/lib/queries/email/send-draft-lifecycle.tsnew file mode 100644index 0000000000..09de44adb5--- /dev/null+++ b/apps/web/src/lib/queries/email/send-draft-lifecycle.ts@@ -0,0 +1,215 @@+import { decodeBase64Utf8 } from '@app/features/email-compose/core/decode-base64';+import type { LocalDraft } from '@app/features/email-compose/core/local-draft';+import type { DraftFormAttachment } from '@app/features/email-compose/primitives/email-form-state';+import { Telemetry } from '@macro-inc/observability';+import {+ draftContactInput,+ type GraphqlSaveEmailDraftArgs,+} from './graphql/draft';+import {+ emailStorageSession,+ forgetLocalDraft,+ localDraftStore,+ readLocalDraft,+ resumeLocalDraft,+ reviveLocalDraft,+ saveLocalDraft,+} from './local-drafts';++/** The working-copy lifetime handed to the durable send journal; no file blobs. */+export type SendWorkingCopy = Pick<+ LocalDraft,+ 'key' | 'generation' | 'revision' | 'attachments'+>;++export async function captureSendWorkingCopy(+ draftId: string,+ attachmentIds: readonly string[],+ forwardedAttachmentIds: readonly string[],+ expected?: Pick<LocalDraft, 'generation' | 'revision'>+): Promise<SendWorkingCopy | undefined> {+ const local = await readLocalDraft(draftId);+ if (+ (local || expected) &&+ (!local ||+ !expected ||+ local.generation !== expected.generation ||+ local.revision !== expected.revision)+ )+ throw new Error(+ 'This draft changed while preparing the send. Reopen it to review the latest version.'+ );+ if (!local) return;+ if (local.status === 'deleting' || local.status === 'delete-failed')+ throw new Error('Resolve the draft deletion before sending');+ if (local.attachments.some((a) => a.type === 'local' && !a.uploaded))+ throw new Error('Finish uploading attachments before sending');+ const uploaded = new Set(attachmentIds);+ const forwarded = new Set(forwardedAttachmentIds);+ if (+ local.attachments.some(+ (a) =>+ !a.attachmentId ||+ !(+ a.type === 'forwarded' || a.type === 'native' ? forwarded : uploaded+ ).delete(a.attachmentId)+ ) ||+ uploaded.size ||+ forwarded.size+ )+ throw new Error('Attachments changed while preparing this send');+ return {+ key: local.key,+ generation: local.generation,+ revision: local.revision,+ attachments: local.attachments,+ };+}++/** A cleanup failure cannot turn an already accepted send into a failed send. */+export async function retireSendWorkingCopy(copy: SendWorkingCopy | undefined) {+ if (!copy) return;+ try {+ await forgetLocalDraft(copy.key, copy);+ } catch (error) {+ Telemetry.error(error instanceof Error ? error : new Error(String(error)));+ }+}++function restoredAttachments(+ draft: GraphqlSaveEmailDraftArgs,+ copy: SendWorkingCopy | undefined+): DraftFormAttachment[] {+ if (copy)+ return copy.attachments.map((attachment) => {+ if (attachment.type !== 'local') return attachment;+ if (!attachment.uploaded || !attachment.attachmentId)+ throw new Error('The queued attachment has no completed upload');+ return {+ type: 'remote',+ attachmentId: attachment.attachmentId,+ fileName: attachment.name,+ contentType: attachment.mimeType,+ fileSize: attachment.size,+ url: '',+ };+ });+ return [+ ...(draft.existingDraft?.attachments ?? []).map((attachment) => ({+ type: 'native' as const,+ attachmentId: attachment.id,+ fileName: attachment.filename ?? 'Attachment',+ mimeType: attachment.mimeType ?? 'application/octet-stream',+ fileSize: attachment.sizeBytes ?? 0,+ referenceUrl: attachment.referenceUrl,+ })),+ ...(draft.existingDraft?.attachmentsDraft ?? []).map((attachment) => ({+ type: 'remote' as const,+ attachmentId: attachment.id,+ fileName: attachment.fileName,+ contentType: attachment.contentType,+ fileSize: attachment.size,+ url: '',+ })),+ ...(draft.existingDraft?.attachmentsForwarded ?? []).map((attachment) => ({+ type: 'forwarded' as const,+ attachmentId: attachment.attachmentId,+ fileName: attachment.filename ?? 'Attachment',+ mimeType: attachment.mimeType ?? 'application/octet-stream',+ fileSize: attachment.sizeBytes ?? 0,+ })),+ ];+}++/** Explicit cancellation restores local durability before another save can replay. */+export async function restoreSendWorkingCopy(+ draft: GraphqlSaveEmailDraftArgs,+ copy: SendWorkingCopy | undefined,+ serverConfirmed = false+): Promise<GraphqlSaveEmailDraftArgs> {+ if (copy) await forgetLocalDraft(copy.key, copy);+ let local = await readLocalDraft(copy?.key ?? String(draft.draftId));+ if (local) {+ // Keep newer edits, but fence old send-time callbacks before resuming them.+ await resumeLocalDraft(local.key, copy?.generation ?? local.generation);+ local = (await readLocalDraft(local.key)) ?? local;+ } else {+ const draftId = copy?.key ?? String(draft.draftId);+ await reviveLocalDraft(draftId);+ local = await saveLocalDraft({+ clientHandles: { draftId, threadId: draft.threadDbId },+ inboxId: draft.senderLinkId,+ senderEmail: draft.senderEmail,+ draft: {+ draft_generation: draft.draftGeneration ?? 0,+ sender_email: draft.senderEmail,+ subject: draft.subject,+ to: draft.to,+ cc: draft.cc,+ bcc: draft.bcc,+ body_html: draft.bodyHtml,+ body_text: draft.bodyText,+ body_macro: draft.bodyMacro,+ replying_to_id:+ draft.replyingToId == null+ ? draft.replyingToId+ : String(draft.replyingToId),+ provider_id: draft.providerId,+ provider_thread_id: draft.providerThreadId,+ thread_db_id: draft.threadDbId,+ },+ attachments: restoredAttachments(draft, copy),+ });+ }+ const restoredGeneration = local.generation;+ const bound = await localDraftStore.update(+ await emailStorageSession(),+ local.key,+ (current) =>+ current.generation !== restoredGeneration+ ? current+ : {+ ...current,+ content: {+ ...current.content,+ draft_generation: Math.max(+ current.content.draft_generation ?? 0,+ draft.draftGeneration ?? 0+ ),+ },+ serverDraftId: serverConfirmed+ ? String(draft.draftId)+ : current.serverDraftId,+ serverThreadId: serverConfirmed+ ? draft.threadDbId+ : current.serverThreadId,+ }+ );+ if (!bound || bound.generation !== restoredGeneration)+ throw new Error('This restored draft changed in another tab');+ local = bound;+ return {+ ...draft,+ draftId: local.draftId,+ draftGeneration: local.content.draft_generation ?? 0,+ threadDbId: local.serverThreadId ?? local.threadId ?? draft.threadDbId,+ localRevision: local.revision,+ senderLinkId: local.inboxId ?? draft.senderLinkId,+ linkId: local.inboxId ?? draft.linkId,+ senderEmail:+ local.content.sender_email ?? local.senderEmail ?? draft.senderEmail,+ subject: local.content.subject,+ to: local.content.to?.map(draftContactInput),+ cc: local.content.cc?.map(draftContactInput),+ bcc: local.content.bcc?.map(draftContactInput),+ replyingToId: local.content.replying_to_id,+ providerId: local.content.provider_id,+ providerThreadId: local.content.provider_thread_id,+ bodyHtml: local.content.body_html,+ bodyText: local.content.body_text,+ bodyMacro: local.content.body_macro,+ optimisticBodyHtml: local.content.body_html+ ? decodeBase64Utf8(local.content.body_html)+ : null,+ };+}diff --git a/apps/web/src/lib/queries/email/send-intent.ts b/apps/web/src/lib/queries/email/send-intent.tsnew file mode 100644index 0000000000..2b70ac09ef--- /dev/null+++ b/apps/web/src/lib/queries/email/send-intent.ts@@ -0,0 +1,203 @@+import type {+ EmailSendAttemptFieldsFragment,+ SendEmailAttemptInput,+} from '@service-storage/graphql/generated/graphql';+import { createSignal } from 'solid-js';+import type { GraphqlSaveEmailDraftArgs } from './graphql/draft';+import type { SendWorkingCopy } from './send-draft-lifecycle';++/** Persisted independently of the optimistic layer, including after rejection. */+export type EmailSendIntent = {+ uuid: string;+ /** Owner assigned atomically when the intent is persisted. */+ accountId?: string;+ /** Version 2 is dispatched from the email store, independently of the cache. */+ dispatchVersion: 2;+ submissionStarted?: boolean;+ dispatch?: {+ generation: number;+ owner?: string;+ leaseUntil: number;+ nextAttemptAt: number;+ failures: number;+ cancelling?: boolean;+ error?: string;+ paused?: boolean;+ };+ cancellationRequested?: boolean;+ /** Canonical IDs returned by server acceptance. */+ resolvedDraftId?: string;+ resolvedThreadId?: string;+ phase: 'pending' | 'committed' | 'failed';+ locallyCancelled: boolean;+ metadata: {+ kind: 'email-send-v1';+ requiresServerConfirmation?: boolean;+ payload: {+ workingCopy?: SendWorkingCopy;+ input: SendEmailAttemptInput;+ draft: GraphqlSaveEmailDraftArgs;+ };+ };+ response?: {+ sendEmailMessage?: { attempt: EmailSendAttemptFieldsFragment };+ cancelEmailSend?: { attempt: EmailSendAttemptFieldsFragment };+ } | null;+};++function isRecord(value: unknown): value is Record<string, unknown> {+ return typeof value === 'object' && value !== null;+}++const statuses = new Set([+ 'ACCEPTED',+ 'SENDING',+ 'SENT',+ 'CANCELLED',+ 'FAILED',+ 'DELIVERY_UNCONFIRMED',+]);+const optionalBoolean = (value: unknown) =>+ value === undefined || typeof value === 'boolean';+const optionalStrings = (value: unknown) =>+ value == null ||+ (Array.isArray(value) && value.every((entry) => typeof entry === 'string'));++export function isEmailSendIntent(value: unknown): value is EmailSendIntent {+ if (+ !isRecord(value) ||+ typeof value.uuid !== 'string' ||+ value.dispatchVersion !== 2 ||+ !['pending', 'committed', 'failed'].includes(String(value.phase)) ||+ typeof value.locallyCancelled !== 'boolean' ||+ !optionalBoolean(value.submissionStarted) ||+ !optionalBoolean(value.cancellationRequested)+ )+ return false;+ const metadata = value.metadata;+ if (+ !isRecord(metadata) ||+ metadata.kind !== 'email-send-v1' ||+ !isRecord(metadata.payload) ||+ !optionalBoolean(metadata.requiresServerConfirmation)+ )+ return false;+ const { input, draft, workingCopy } = metadata.payload;+ if (+ !isRecord(input) ||+ !isRecord(input.attempt) ||+ input.attempt.attemptId !== value.uuid ||+ typeof input.attempt.linkId !== 'string' ||+ !isRecord(input.message) ||+ typeof input.message.draftId !== 'string' ||+ typeof input.message.subject !== 'string' ||+ !optionalStrings(input.attachmentIds) ||+ !optionalStrings(input.forwardedAttachmentIds) ||+ !isRecord(draft) ||+ typeof draft.draftId !== 'string' ||+ typeof draft.subject !== 'string' ||+ typeof draft.threadDbId !== 'string' ||+ typeof draft.senderLinkId !== 'string' ||+ typeof draft.senderEmail !== 'string'+ )+ return false;+ for (const field of ['to', 'cc', 'bcc']) {+ const recipients = input.message[field];+ if (+ recipients != null &&+ (!Array.isArray(recipients) ||+ !recipients.every(+ (entry) => isRecord(entry) && typeof entry.email === 'string'+ ))+ )+ return false;+ }+ if (+ workingCopy !== undefined &&+ (!isRecord(workingCopy) ||+ typeof workingCopy.key !== 'string' ||+ typeof workingCopy.generation !== 'string' ||+ !Number.isSafeInteger(workingCopy.revision) ||+ !Array.isArray(workingCopy.attachments) ||+ !workingCopy.attachments.every(+ (file) =>+ isRecord(file) &&+ ['local', 'remote', 'forwarded', 'native'].includes(+ String(file.type)+ ) &&+ typeof file.attachmentId === 'string' &&+ (file.type !== 'local' || file.uploaded === true)+ ))+ )+ return false;+ if (value.dispatch !== undefined) {+ const dispatch = value.dispatch;+ if (+ !isRecord(dispatch) ||+ !['generation', 'leaseUntil', 'nextAttemptAt', 'failures'].every(+ (key) =>+ typeof dispatch[key] === 'number' &&+ Number.isFinite(dispatch[key]) &&+ dispatch[key] >= 0+ ) ||+ !optionalBoolean(dispatch.paused)+ )+ return false;+ }+ if (value.response != null) {+ if (!isRecord(value.response)) return false;+ for (const key of ['sendEmailMessage', 'cancelEmailSend']) {+ const response = value.response[key];+ if (response === undefined) continue;+ if (+ !isRecord(response) ||+ !isRecord(response.attempt) ||+ response.attempt.attemptId !== value.uuid ||+ !statuses.has(String(response.attempt.status)) ||+ (response.attempt.message != null &&+ (!isRecord(response.attempt.message) ||+ typeof response.attempt.message.id !== 'string' ||+ typeof response.attempt.message.threadId !== 'string'))+ )+ return false;+ }+ }+ return true;+}++/** Even an unsupported record keeps recognizable identities reserved. */+export function emailSendReservedDraftIds(value: unknown): string[] {+ if (!isRecord(value)) return [];+ const payload =+ isRecord(value.metadata) && isRecord(value.metadata.payload)+ ? value.metadata.payload+ : undefined;+ const input = payload && isRecord(payload.input) ? payload.input : undefined;+ const message = input && isRecord(input.message) ? input.message : undefined;+ const copy =+ payload && isRecord(payload.workingCopy) ? payload.workingCopy : undefined;+ const draft = payload && isRecord(payload.draft) ? payload.draft : undefined;+ return [+ value.resolvedDraftId,+ message?.draftId,+ copy?.key,+ draft?.draftId,+ ].filter((id): id is string => typeof id === 'string');+}++const [emailSendStorageWarning, setStorageWarning] = createSignal<string>();++export { emailSendStorageWarning };++/** Preserve damaged/unsupported records while allowing unrelated valid sends to proceed. */+export function usableEmailSendIntents(+ rows: readonly unknown[]+): EmailSendIntent[] {+ const valid = rows.filter(isEmailSendIntent);+ setStorageWarning(+ valid.length === rows.length+ ? undefined+ : 'A saved email needs recovery. Its contents are preserved on this device. Contact support before clearing storage.'+ );+ return valid;+}diff --git a/apps/web/src/lib/queries/email/send-queue.test.ts b/apps/web/src/lib/queries/email/send-queue.test.tsnew file mode 100644index 0000000000..85f97a68b4--- /dev/null+++ b/apps/web/src/lib/queries/email/send-queue.test.ts@@ -0,0 +1,289 @@+import { beforeEach, expect, it, vi } from 'vitest';+import type { GraphqlSaveEmailDraftArgs } from './graphql/draft';+import {+ cancelEmailSendAndConfirm,+ cancelEmailSendQueued,+ type EmailSendIntent,+ emailSendLocked,+ readEmailSendIntents,+ recoverEmailSendIntent,+ restoreCancelledEmailSend,+ retireEmailSendIntent,+ sendEmailQueued,+} from './send-queue';++const mocks = vi.hoisted(() => ({+ read: vi.fn(),+ persist: vi.fn(),+ local: vi.fn(),+ capture: vi.fn(),+ restore: vi.fn(),+ retire: vi.fn(),+ claim: vi.fn(),+ remove: vi.fn(),+ check: vi.fn(),+ publish: vi.fn(),+ status: vi.fn(),+ save: vi.fn(),+}));+vi.mock('@service-storage/email-send', () => ({+ readEmailSendStatus: mocks.status,+}));+vi.mock('@service-storage/graphql-soup', () => ({+ getGraphqlCacheHost: () => {+ throw new Error('Cache unavailable');+ },+ getGraphqlSoupClient: () => {+ throw new Error('Cache unavailable');+ },+}));+vi.mock('./local-drafts', () => ({+ readLocalEmailSends: mocks.read,+ persistLocalEmailSend: mocks.persist,+ readLocalDraft: mocks.local,+ removeLocalEmailSend: mocks.remove,+ watchLocalEmailSends: vi.fn(() => () => {}),+ emailStorageSession: async () => ({ accountId: 'owner', epoch: 'session' }),+ localDraftStore: {+ restoreSend: mocks.claim,+ removeSend: mocks.remove,+ requestSendCheck: mocks.check,+ },+}));+vi.mock('./draft-queue', () => ({ saveEmailDraftQueued: mocks.save }));+vi.mock('./draft-lifecycle-events', () => ({+ publishDraftRestoration: mocks.publish,+}));+vi.mock('./send-draft-lifecycle', () => ({+ captureSendWorkingCopy: mocks.capture,+ restoreSendWorkingCopy: mocks.restore,+ retireSendWorkingCopy: mocks.retire,+}));+const draft: GraphqlSaveEmailDraftArgs = {+ draftId: '00000000-0000-4000-8000-000000000001',+ threadDbId: '00000000-0000-4000-8000-000000000002',+ senderLinkId: '00000000-0000-4000-8000-000000000003',+ senderEmail: '[email protected]',+ subject: 'Approved',+ to: [{ email: '[email protected]' }],+ bodyText: 'Approved body',+ bodyHtml: 'QXBwcm92ZWQ=',+ optimisticBodyHtml: 'Approved',+ draftGeneration: 2,+};+const args = () => ({+ draft: structuredClone(draft),+ attachmentIds: ['uploaded'],+ forwardedAttachmentIds: ['native'],+});+const persisted = () => mocks.persist.mock.calls[0][0] as EmailSendIntent;+beforeEach(() => {+ vi.clearAllMocks();+ mocks.read.mockResolvedValue([]);+ mocks.local.mockResolvedValue(undefined);+ mocks.capture.mockResolvedValue(undefined);+ mocks.persist.mockImplementation(async (row) => row);+ mocks.claim.mockResolvedValue(undefined);+ mocks.restore.mockImplementation(async (row) => ({+ ...row,+ restorationVersion: {+ key: row.draftId,+ generation: 'restored',+ revision: 1,+ },+ }));+});+it('persists approval without contacting the network or normalized cache', async () => {+ const result = await sendEmailQueued({+ ...args(),+ signatureHtml: '<p>Signature</p>',+ draft: { ...draft, sendTime: '2030-01-01T12:00:00Z' },+ });+ expect(mocks.persist).toHaveBeenCalledWith(+ expect.objectContaining({ dispatchVersion: 2, phase: 'pending' }),+ true+ );+ expect(persisted().metadata.payload.input).toMatchObject({+ attempt: { attemptId: result.sendAttemptId, linkId: draft.senderLinkId },+ message: {+ draftId: draft.draftId,+ draftGeneration: 2,+ senderEmail: draft.senderEmail,+ sendTime: '2030-01-01T12:00:00Z',+ },+ attachmentIds: ['uploaded'],+ forwardedAttachmentIds: ['native'],+ signatureHtml: '<p>Signature</p>',+ });+ expect(mocks.status).not.toHaveBeenCalled();+ expect(result.persistence).toBe('queued');+});+it('freezes the exact input before any asynchronous storage read', async () => {+ const pending = Promise.withResolvers<EmailSendIntent[]>();+ mocks.read.mockReturnValueOnce(pending.promise);+ const input = args();+ const send = sendEmailQueued(input);+ input.draft.subject = 'Later edit';+ input.attachmentIds.push('later attachment');+ pending.resolve([]);+ await send;+ expect(persisted().metadata.payload.input.message.subject).toBe('Approved');+ expect(persisted().metadata.payload.input.attachmentIds).toEqual([+ 'uploaded',+ ]);+});+it('does not claim success when local durable storage rejects the write', async () => {+ mocks.persist.mockRejectedValueOnce(+ new DOMException('Full', 'QuotaExceededError')+ );+ await expect(sendEmailQueued(args())).rejects.toThrow('Full');+ expect(mocks.status).not.toHaveBeenCalled();+});+it('resolves server aliases while reserving the captured working-copy revision', async () => {+ mocks.local.mockResolvedValue({+ serverDraftId: 'server',+ serverThreadId: 'thread',+ });+ mocks.capture.mockResolvedValue({+ key: draft.draftId,+ generation: 'g',+ revision: 5,+ attachments: [],+ });+ await sendEmailQueued({+ ...args(),+ expectedLocalVersion: { generation: 'g', revision: 5 },+ });+ expect(persisted().metadata.payload.input.message.draftId).toBe('server');+ expect(mocks.capture).toHaveBeenCalledWith(+ draft.draftId,+ ['uploaded'],+ ['native'],+ { generation: 'g', revision: 5 }+ );+});+it('blocks a second attempt for a draft whose first send is unresolved', async () => {+ await sendEmailQueued(args());+ const first = persisted();+ mocks.read.mockResolvedValue([first]);+ mocks.persist.mockClear();+ await expect(sendEmailQueued(args())).rejects.toThrow('already queued');+ expect(mocks.persist).not.toHaveBeenCalled();+});+it('persists cancellation without deciding an attempted send is cancelled', async () => {+ await sendEmailQueued(args());+ const row = persisted();+ mocks.persist.mockClear();+ const cancelled = await cancelEmailSendQueued({+ ...row,+ submissionStarted: true,+ });+ expect(cancelled.cancellationRequested).toBe(true);+ expect(emailSendLocked(cancelled)).toBe(true);+ expect(mocks.status).not.toHaveBeenCalled();+});+it.each(['SENDING', 'SENT', 'DELIVERY_UNCONFIRMED'] as const)(+ 'refuses to unlock %s',+ async (status) => {+ await sendEmailQueued(args());+ const row = persisted();+ row.response = {+ sendEmailMessage: {+ attempt: {+ attemptId: row.uuid,+ status,+ message: null,+ threadId: null,+ sendTime: null,+ },+ },+ };+ await expect(cancelEmailSendQueued(row)).rejects.toThrow();+ mocks.claim.mockRejectedValueOnce(new Error('Confirm cancellation'));+ await expect(restoreCancelledEmailSend(row)).rejects.toThrow(+ 'Confirm cancellation'+ );+ expect(mocks.restore).not.toHaveBeenCalled();+ }+);+it('manual reconciliation wakes the existing attempt without bypassing its lease', async () => {+ await sendEmailQueued(args());+ const row = persisted();+ await recoverEmailSendIntent(row);+ expect(mocks.check).toHaveBeenCalledWith(expect.anything(), row.uuid);+ expect(mocks.status).not.toHaveBeenCalled();+});+it('restores a confirmed cancellation durably without needing a cache write', async () => {+ await sendEmailQueued(args());+ const row = {+ ...persisted(),+ cancellationRequested: true,+ locallyCancelled: true,+ };+ mocks.read.mockResolvedValue([row]);+ mocks.claim.mockResolvedValueOnce({+ intent: row,+ draft: {+ draftId: draft.draftId,+ threadId: draft.threadDbId,+ content: {},+ inboxId: draft.senderLinkId,+ },+ });+ await restoreCancelledEmailSend(row);+ expect(mocks.claim).toHaveBeenCalledWith(expect.anything(), row.uuid);+ expect(mocks.restore).not.toHaveBeenCalled();+ expect(mocks.publish).toHaveBeenCalled();+ expect(mocks.save).not.toHaveBeenCalled();+});+it('a stale observer cannot retire accepted delivery authority', async () => {+ await sendEmailQueued(args());+ const row = persisted();+ mocks.read.mockResolvedValue([row]);+ expect(await retireEmailSendIntent(row)).toBe(false);+ expect(mocks.remove).not.toHaveBeenCalled();+});+it('preserves malformed durable entries for recovery instead of treating the queue as empty', async () => {+ mocks.read.mockResolvedValue([{ uuid: 'damaged' }]);+ expect(await readEmailSendIntents()).toEqual([]);+ expect(mocks.remove).not.toHaveBeenCalled();+});++it('keeps scheduled cancellation pending until authoritative confirmation', async () => {+ vi.useFakeTimers();+ try {+ await sendEmailQueued(args());+ const row = { ...persisted(), submissionStarted: true };+ row.metadata.requiresServerConfirmation = true;+ mocks.read.mockResolvedValue([row]);+ let completed = false;+ const cancellation = cancelEmailSendAndConfirm(row).then(() => {+ completed = true;+ });+ await vi.advanceTimersByTimeAsync(500);+ expect(completed).toBe(false);+ expect(mocks.claim).not.toHaveBeenCalled();+ mocks.read.mockResolvedValue([+ {+ ...row,+ response: {+ cancelEmailSend: {+ attempt: {+ attemptId: row.uuid,+ status: 'CANCELLED',+ message: null,+ threadId: null,+ sendTime: null,+ },+ },+ },+ },+ ]);+ await vi.advanceTimersByTimeAsync(250);+ await cancellation;+ expect(completed).toBe(true);+ expect(mocks.claim).toHaveBeenCalled();+ } finally {+ vi.useRealTimers();+ }+});diff --git a/apps/web/src/lib/queries/email/send-queue.ts b/apps/web/src/lib/queries/email/send-queue.tsnew file mode 100644index 0000000000..8afcaeeba8--- /dev/null+++ b/apps/web/src/lib/queries/email/send-queue.ts@@ -0,0 +1,290 @@+import { readEmailSendStatus } from '@service-storage/email-send';+import type { SendEmailAttemptInput } from '@service-storage/graphql/generated/graphql';+import { v7 as uuidV7 } from 'uuid';+import { publishDraftRestoration } from './draft-lifecycle-events';+import type { GraphqlSaveEmailDraftArgs } from './graphql/draft';+import {+ emailStorageSession,+ localDraftStore,+ persistLocalEmailSend,+ readLocalDraft,+ readLocalEmailSends,+ removeLocalEmailSend,+ watchLocalEmailSends,+} from './local-drafts';+import {+ captureSendWorkingCopy,+ retireSendWorkingCopy,+ type SendWorkingCopy,+} from './send-draft-lifecycle';+import {+ emailSendFailureKind,+ recordEmailSend,+ traceEmailSend,+} from './send-telemetry';++export type { EmailSendIntent } from './send-intent';++import { type EmailSendIntent, usableEmailSendIntents } from './send-intent';++export function settledSendAttempt(intent: EmailSendIntent) {+ return (+ intent.response?.cancelEmailSend?.attempt ??+ intent.response?.sendEmailMessage?.attempt+ );+}++/** A pending cancellation never unlocks an attempted send without confirmation. */+export function emailSendLocked(intent: EmailSendIntent): boolean {+ if (intent.locallyCancelled && !intent.metadata.requiresServerConfirmation)+ return false;+ return settledSendAttempt(intent)?.status !== 'CANCELLED';+}++export function emailSendMatchesDraft(+ intent: EmailSendIntent,+ draftId: string+): boolean {+ return (+ intent.resolvedDraftId === draftId ||+ intent.metadata.payload.input.message.draftId === draftId ||+ settledSendAttempt(intent)?.message?.id === draftId+ );+}++export async function readEmailSendIntents(): Promise<EmailSendIntent[]> {+ const rows = await readLocalEmailSends();+ return usableEmailSendIntents(rows);+}++export const watchEmailSends = watchLocalEmailSends;++export async function sendEmailQueued(args: {+ draft: GraphqlSaveEmailDraftArgs;+ expectedLocalVersion?: Pick<SendWorkingCopy, 'generation' | 'revision'>;+ attachmentIds: string[];+ forwardedAttachmentIds: string[];+ includeSignature?: boolean | null;+ signatureHtml?: string;+ restoreBodyHtml?: string | null;+ restoreBodyText?: string | null;+ restoreBodyMacro?: string | null;+}) {+ args = structuredClone(args);+ const previous = (await readEmailSendIntents()).find(+ (intent) =>+ emailSendMatchesDraft(intent, String(args.draft.draftId)) &&+ emailSendLocked(intent)+ );+ if (previous) throw new Error('This draft is already queued for sending');+ const local = await readLocalDraft(String(args.draft.draftId));+ const draft = {+ ...args.draft,+ draftId: local?.serverDraftId ?? args.draft.draftId,+ threadDbId: local?.serverThreadId ?? args.draft.threadDbId,+ };+ const workingCopy = await captureSendWorkingCopy(+ String(args.draft.draftId),+ args.attachmentIds,+ args.forwardedAttachmentIds,+ args.expectedLocalVersion+ );+ const attemptId = uuidV7();+ const input: SendEmailAttemptInput = {+ attempt: { attemptId, linkId: draft.senderLinkId },+ message: {+ draftId: draft.draftId,+ draftGeneration: draft.draftGeneration ?? 0,+ sendTime: draft.sendTime,+ threadDbId: draft.threadDbId,+ subject: draft.subject,+ linkId: draft.senderLinkId,+ senderEmail: draft.senderEmail,+ replyingToId: draft.replyingToId,+ providerId: draft.providerId,+ providerThreadId: draft.providerThreadId,+ to: draft.to,+ cc: draft.cc,+ bcc: draft.bcc,+ bodyHtml: draft.bodyHtml,+ bodyText: draft.bodyText,+ bodyMacro: draft.bodyMacro,+ },+ attachmentIds: args.attachmentIds,+ forwardedAttachmentIds: args.forwardedAttachmentIds,+ includeSignature: args.includeSignature,+ signatureHtml: args.signatureHtml,+ restoreBodyHtml: args.restoreBodyHtml ?? draft.bodyHtml,+ restoreBodyText: args.restoreBodyText ?? draft.bodyText,+ restoreBodyMacro: args.restoreBodyMacro ?? draft.bodyMacro,+ };+ const intent: EmailSendIntent = {+ uuid: attemptId,+ dispatchVersion: 2,+ phase: 'pending',+ locallyCancelled: false,+ metadata: {+ kind: 'email-send-v1',+ payload: { input, draft, workingCopy },+ },+ };+ await traceEmailSend('persist', input.attempt, () =>+ persistLocalEmailSend(intent, true)+ );+ recordEmailSend({ operation: 'enqueue', outcome: 'queued' }, intent);+ return {+ draftId: String(draft.draftId),+ threadId: draft.threadDbId,+ inboxId: draft.senderLinkId,+ sendAttemptId: attemptId,+ persistence: 'queued' as const,+ };+}++/** Cancellation must win before provider submission starts. */+export class EmailSendCancellationTooLate extends Error {+ constructor() {+ super('Delivery already started; cancellation was too late');+ this.name = 'EmailSendCancellationTooLate';+ }+}++export class EmailSendDeliveryUnconfirmed extends Error {+ constructor() {+ super(+ 'Delivery unconfirmed; check your sent mail. We will not resend automatically.'+ );+ this.name = 'EmailSendDeliveryUnconfirmed';+ }+}++/** Returns persisted state independently of any mounted queue observer. */+export async function cancelEmailSendQueued(+ intent: EmailSendIntent+): Promise<EmailSendIntent> {+ const status = settledSendAttempt(intent)?.status;+ if (status === 'DELIVERY_UNCONFIRMED')+ throw new EmailSendDeliveryUnconfirmed();+ if (status === 'SENDING' || status === 'SENT')+ throw new EmailSendCancellationTooLate();+ return await persistLocalEmailSend({+ ...intent,+ cancellationRequested: true,+ });+}++/** Scheduled UI must not become editable merely because Cancel was queued. */+export async function cancelEmailSendAndConfirm(+ intent: EmailSendIntent+): Promise<void> {+ let current = await cancelEmailSendQueued(intent);+ const deadline = Date.now() + 15_000;+ while (true) {+ const status = settledSendAttempt(current)?.status;+ if (+ status === 'CANCELLED' ||+ (current.locallyCancelled && !current.metadata.requiresServerConfirmation)+ ) {+ await restoreCancelledEmailSend(current);+ return;+ }+ if (status === 'SENT' || status === 'SENDING')+ throw new EmailSendCancellationTooLate();+ if (status === 'DELIVERY_UNCONFIRMED')+ throw new EmailSendDeliveryUnconfirmed();+ if (Date.now() >= deadline)+ throw new Error(+ 'Cancellation is pending. Check email send status before editing.'+ );+ await new Promise<void>((resolve) => setTimeout(resolve, 250));+ const latest = (await readEmailSendIntents()).find(+ (row) => row.uuid === intent.uuid+ );+ if (latest) current = latest;+ else {+ // Another tab may have restored or retired it. Absence alone is not Undo.+ const attempt = await fetchEmailSendStatus(current);+ if (attempt?.status === 'CANCELLED') return;+ if (attempt?.status === 'SENT' || attempt?.status === 'SENDING')+ throw new EmailSendCancellationTooLate();+ }+ }+}++/** A status check never resubmits a message. */+export async function fetchEmailSendStatus(intent: EmailSendIntent) {+ return await readEmailSendStatus(+ intent.metadata.payload.input.attempt,+ AbortSignal.timeout(15_000)+ );+}++/** Restore the existing draft identity so uploaded and forwarded files stay attached. */+export async function restoreCancelledEmailSend(+ intent: EmailSendIntent+): Promise<void> {+ const started = performance.now();+ try {+ const result = await localDraftStore.restoreSend(+ await emailStorageSession(),+ intent.uuid+ );+ if (!result) return;+ const { draft, intent: restoredIntent } = result;+ publishDraftRestoration({+ draftId: draft.serverDraftId ?? draft.draftId,+ inboxId: draft.inboxId,+ restoration: {+ originalDraftId: String(+ restoredIntent.metadata.payload.input.message.draftId+ ),+ threadId: draft.serverThreadId ?? draft.threadId ?? draft.draftId,+ replyingToId: draft.content.replying_to_id,+ includeSignature: draft.content.include_signature,+ },+ });+ recordEmailSend(+ {+ operation: 'restore',+ outcome: 'completed',+ durationMs: performance.now() - started,+ },+ restoredIntent+ );+ } catch (error) {+ recordEmailSend(+ {+ operation: 'restore',+ outcome: 'error',+ failureKind: emailSendFailureKind(error),+ durationMs: performance.now() - started,+ },+ intent+ );+ throw error;+ }+}++/** Retire a confirmed success without discarding a newer working copy. */+export async function retireEmailSendIntent(+ intent: EmailSendIntent+): Promise<boolean> {+ const current = (await readEmailSendIntents()).find(+ (row) => row.uuid === intent.uuid+ );+ if (!current) return true;+ if (settledSendAttempt(current)?.status !== 'SENT') return false;+ await retireSendWorkingCopy(current.metadata.payload.workingCopy);+ await removeLocalEmailSend(intent.uuid);+ return true;+}++/** Manual reconciliation uses the same attempt; the app-shell runner owns retries. */+export async function recoverEmailSendIntent(+ intent: EmailSendIntent+): Promise<void> {+ await localDraftStore.requestSendCheck(+ await emailStorageSession(),+ intent.uuid+ );+}diff --git a/apps/web/src/lib/queries/email/send-telemetry.test.ts b/apps/web/src/lib/queries/email/send-telemetry.test.tsnew file mode 100644index 0000000000..45b03ec746--- /dev/null+++ b/apps/web/src/lib/queries/email/send-telemetry.test.ts@@ -0,0 +1,96 @@+import { CombinedError } from '@urql/core';+import { beforeEach, expect, it, vi } from 'vitest';+import type { EmailSendIntent } from './send-queue';+import { emailSendFailureKind, recordEmailSend } from './send-telemetry';++const telemetry = vi.hoisted(() => ({ info: vi.fn(), warn: vi.fn() }));+vi.mock('@macro-inc/observability', () => ({ Telemetry: telemetry }));+beforeEach(() => vi.resetAllMocks());++const intent: EmailSendIntent = {+ uuid: 'audit-attempt',+ dispatchVersion: 2,+ phase: 'pending',+ locallyCancelled: false,+ metadata: {+ kind: 'email-send-v1',+ payload: {+ input: {+ attempt: { attemptId: 'audit-attempt', linkId: 'audit-link' },+ message: { draftId: 'audit-draft', subject: 'PRIVATE SUBJECT' },+ attachmentIds: [],+ forwardedAttachmentIds: [],+ restoreBodyHtml: 'PRIVATE BODY',+ },+ draft: {+ draftId: 'audit-draft',+ threadDbId: 'audit-thread',+ senderLinkId: 'audit-link',+ senderEmail: 'PRIVATE ADDRESS',+ subject: 'PRIVATE SUBJECT',+ optimisticBodyHtml: 'PRIVATE BODY',+ },+ },+ },+};++it('exports only explicit lifecycle fields even when inputs contain private payloads', () => {+ const observation = {+ operation: 'recover' as const,+ outcome: 'error' as const,+ durationMs: 17,+ request: 'PRIVATE REQUEST',+ error: new Error('PRIVATE EXCEPTION'),+ };+ recordEmailSend(observation, intent);+ expect(telemetry.warn).toHaveBeenCalledWith('email_send.lifecycle', {+ 'email_send.operation': 'recover',+ 'email_send.outcome': 'error',+ 'email_send.duration_ms': 17,+ 'email_send.attempt_id': 'audit-attempt',+ 'email_send.link_id': 'audit-link',+ 'email_send.phase': 'pending',+ 'email_send.cancellation_requested': false,+ });+ expect(JSON.stringify(telemetry.warn.mock.calls)).not.toContain('PRIVATE');+});++it('isolates exporter failures from both successful and failed lifecycle operations', () => {+ telemetry.info.mockImplementation(() => {+ throw new Error('export unavailable');+ });+ telemetry.warn.mockImplementation(() => {+ throw new Error('export unavailable');+ });+ expect(() =>+ recordEmailSend({ operation: 'enqueue', outcome: 'queued' }, intent)+ ).not.toThrow();+ expect(() =>+ recordEmailSend({ operation: 'refresh', outcome: 'error' })+ ).not.toThrow();+});++it('classifies transport and GraphQL failures without exporting their private details', () => {+ for (const [error, expected] of [+ [+ new CombinedError({ networkError: new Error('PRIVATE response') }),+ 'network',+ ],+ [+ new CombinedError({ graphQLErrors: [{ message: 'PRIVATE GraphQL' }] }),+ 'graphql',+ ],+ [new Error('PRIVATE local failure'), 'unknown'],+ ] as const) {+ expect(emailSendFailureKind(error)).toBe(expected);+ recordEmailSend(+ {+ operation: 'recover',+ outcome: 'error',+ failureKind: emailSendFailureKind(error),+ },+ intent+ );+ }+ expect(JSON.stringify(telemetry.warn.mock.calls)).not.toContain('PRIVATE');+});diff --git a/apps/web/src/lib/queries/email/send-telemetry.ts b/apps/web/src/lib/queries/email/send-telemetry.tsnew file mode 100644index 0000000000..108c07caa5--- /dev/null+++ b/apps/web/src/lib/queries/email/send-telemetry.ts@@ -0,0 +1,91 @@+import { Telemetry } from '@macro-inc/observability';+import type { EmailSendAttemptFieldsFragment } from '@service-storage/graphql/generated/graphql';+import { CombinedError } from '@urql/core';+import type { EmailSendIntent } from './send-queue';++/** Retries get short traces correlated by the durable attempt ID across reloads. */+export async function traceEmailSend<T>(+ operation: 'persist' | 'submit' | 'cancel' | 'status',+ attempt: { attemptId: string | number; linkId: string | number },+ run: () => Promise<T>+): Promise<T> {+ return Telemetry.span(`email.send.${operation}`, async (span) => {+ span.setAttr('email_send.attempt_id', attempt.attemptId);+ span.setAttr('email_send.link_id', attempt.linkId);+ try {+ return await run();+ } catch (error) {+ // GraphQL exceptions may contain input values; export only classification.+ span.error(`Email ${operation} failed: ${emailSendFailureKind(error)}`);+ throw error;+ }+ });+}++export type EmailSendObservation = {+ operation:+ | 'enqueue'+ | 'cancel'+ | 'restore'+ | 'recover'+ | 'status'+ | 'refresh';+ outcome:+ | 'started'+ | 'queued'+ | 'committed'+ | 'completed'+ | 'error'+ | 'observed';+ status?: EmailSendAttemptFieldsFragment['status'];+ durationMs?: number;+ failureKind?: 'network' | 'graphql' | 'unknown';+};++/** Classify failures without exporting error messages, response bodies, or extensions. */+export function emailSendFailureKind(+ error: unknown+): NonNullable<EmailSendObservation['failureKind']> {+ return error instanceof CombinedError+ ? error.networkError+ ? 'network'+ : 'graphql'+ : 'unknown';+}++/** Explicit fields only: never pass a request, snapshot, or raw exception to telemetry. */+export function recordEmailSend(+ observation: EmailSendObservation,+ intent?: EmailSendIntent+): void {+ try {+ const attributes = {+ 'email_send.operation': observation.operation,+ 'email_send.outcome': observation.outcome,+ ...(observation.failureKind+ ? { 'email_send.failure_kind': observation.failureKind }+ : {}),+ ...(observation.status+ ? { 'email_send.status': observation.status }+ : {}),+ ...(observation.durationMs !== undefined+ ? { 'email_send.duration_ms': Math.max(0, observation.durationMs) }+ : {}),+ ...(intent+ ? {+ 'email_send.attempt_id': intent.uuid,+ 'email_send.link_id': intent.metadata.payload.input.attempt.linkId,+ 'email_send.phase': intent.phase,+ 'email_send.cancellation_requested': !!intent.cancellationRequested,+ }+ : {}),+ };+ if (observation.outcome === 'error') {+ Telemetry.warn('email_send.lifecycle', attributes);+ } else {+ Telemetry.info('email_send.lifecycle', attributes);+ }+ } catch {+ // Exporter failures cannot change send authority or draft persistence.+ }+}diff --git a/apps/web/src/lib/queries/email/server-sends.test.ts b/apps/web/src/lib/queries/email/server-sends.test.tsnew file mode 100644index 0000000000..45e3804cb3--- /dev/null+++ b/apps/web/src/lib/queries/email/server-sends.test.ts@@ -0,0 +1,79 @@+import { readPendingEmailSends } from '@service-storage/email-send';+import type { PendingEmailSendsQuery } from '@service-storage/graphql/generated/graphql';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import {+ refreshServerEmailSends,+ serverEmailSends,+ serverSendAccount,+ setServerSendSession,+} from './server-sends';++vi.mock('@service-storage/email-send', () => ({+ readPendingEmailSends: vi.fn(),+}));++const pending: PendingEmailSendsQuery['user'] = {+ id: 'owner',+ pendingEmailSends: {+ nextCursor: null,+ attempts: [+ {+ linkId: 'inbox',+ attempt: {+ attemptId: 'other-device-send',+ status: 'ACCEPTED',+ message: null,+ threadId: 'thread',+ sendTime: null,+ },+ },+ ],+ },+};++beforeEach(() => {+ vi.useFakeTimers();+ vi.mocked(readPendingEmailSends).mockReset().mockResolvedValue(pending);+ vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(true);+});+afterEach(() => {+ setServerSendSession(undefined);+ vi.restoreAllMocks();+ vi.useRealTimers();+});++it('loads sends from other devices on sign-in without a local send or rollout flag', async () => {+ setServerSendSession('owner');+ await refreshServerEmailSends();+ expect(readPendingEmailSends).toHaveBeenCalledTimes(1);+ expect(serverEmailSends()).toEqual(pending.pendingEmailSends.attempts);+});++it('waits offline and refreshes server sends on reconnect', async () => {+ vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(false);+ setServerSendSession('owner');+ await refreshServerEmailSends();+ expect(readPendingEmailSends).not.toHaveBeenCalled();+ vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(true);+ window.dispatchEvent(new Event('online'));+ await refreshServerEmailSends();+ expect(serverEmailSends()).toEqual(pending.pendingEmailSends.attempts);+});++it('discards an in-flight status response after sign-out', async () => {+ const response = Promise.withResolvers<PendingEmailSendsQuery['user']>();+ const started = Promise.withResolvers<AbortSignal>();+ vi.mocked(readPendingEmailSends).mockImplementationOnce((_, signal) => {+ started.resolve(signal);+ return response.promise;+ });+ setServerSendSession('owner');+ const refresh = refreshServerEmailSends();+ const signal = await started.promise;+ setServerSendSession(undefined);+ expect(signal.aborted).toBe(true);+ response.resolve(pending);+ await refresh;+ expect(serverSendAccount()).toBeUndefined();+ expect(serverEmailSends()).toEqual([]);+});diff --git a/apps/web/src/lib/queries/email/server-sends.ts b/apps/web/src/lib/queries/email/server-sends.tsnew file mode 100644index 0000000000..1d9fd0ea85--- /dev/null+++ b/apps/web/src/lib/queries/email/server-sends.ts@@ -0,0 +1,103 @@+import { fireAndForget } from '@core/util/fireAndForget';+import { readPendingEmailSends } from '@service-storage/email-send';+import type { PendingEmailSendsQuery } from '@service-storage/graphql/generated/graphql';+import { createSignal } from 'solid-js';++export type ServerEmailSend =+ PendingEmailSendsQuery['user']['pendingEmailSends']['attempts'][number];+const [serverEmailSends, setServerEmailSends] = createSignal<ServerEmailSend[]>(+ []+);+const [serverEmailSendsError, setError] = createSignal<string>();+const [hasMoreServerEmailSends, setHasMore] = createSignal(false);++export { hasMoreServerEmailSends, serverEmailSends, serverEmailSendsError };++let current: ReturnType<typeof createServerSendObserver> | undefined;+let owner: string | undefined;++export function setServerSendSession(accountId: string | undefined) {+ current?.dispose();+ current = undefined;+ owner = accountId;+ setServerEmailSends([]);+ setError(undefined);+ setHasMore(false);+ if (accountId) current = createServerSendObserver(accountId);+}+export const serverSendAccount = () => owner;+export const refreshServerEmailSends = async () => {+ await current?.refresh();+};+export const loadMoreServerEmailSends = async () => {+ await current?.more();+};++/** Shared by the app shell, composers and status panel; never grants send authority. */+function createServerSendObserver(accountId: string) {+ let disposed = false;+ let pages = 1;+ let running: Promise<void> | undefined;+ let timer: ReturnType<typeof setTimeout> | undefined;+ let controller: AbortController | undefined;+ async function load() {+ try {+ if (navigator.onLine === false) return;+ controller = new AbortController();+ const signal = AbortSignal.any([+ controller.signal,+ AbortSignal.timeout(15_000),+ ]);+ const collected = new Map<string, ServerEmailSend>();+ let after: string | undefined;+ for (let page = 0; page < pages; page++) {+ const result = await readPendingEmailSends(after, signal);+ if (disposed || result.id !== accountId) return;+ for (const row of result.pendingEmailSends.attempts)+ collected.set(`${row.linkId}:${row.attempt.attemptId}`, row);+ after = result.pendingEmailSends.nextCursor ?? undefined;+ if (!after) break;+ }+ if (disposed) return;+ setServerEmailSends([...collected.values()]);+ setHasMore(!!after);+ setError(undefined);+ } catch {+ if (!disposed)+ setError(+ 'Could not refresh server delivery status. Previously confirmed sends are preserved.'+ );+ } finally {+ running = undefined;+ if (!disposed) timer = setTimeout(wake, 10_000);+ }+ }+ async function refresh() {+ if (disposed || running) return running;+ if (timer !== undefined) clearTimeout(timer);+ // Defer load so its synchronous early-return cannot race this assignment.+ running = Promise.resolve().then(load);+ return running;+ }+ const wake = () => fireAndForget(refresh(), 'email-server-sends');+ const visible = () => {+ if (document.visibilityState === 'visible') wake();+ };+ window.addEventListener('online', wake);+ document.addEventListener('visibilitychange', visible);+ wake();+ return {+ refresh,+ async more() {+ pages++;+ await refresh();+ },+ dispose() {+ disposed = true;+ controller?.abort();+ if (timer !== undefined) clearTimeout(timer);+ window.removeEventListener('online', wake);+ document.removeEventListener('visibilitychange', visible);+ },+ };+}diff --git a/apps/web/src/lib/queries/email/thread-fresh.test.ts b/apps/web/src/lib/queries/email/thread-fresh.test.tsindex 8721795465..d8e9fe7046 100644--- a/apps/web/src/lib/queries/email/thread-fresh.test.ts+++ b/apps/web/src/lib/queries/email/thread-fresh.test.ts@@ -16,6 +16,7 @@ import { fetchFreshEmailThread } from './thread';function message(dbId: string): ApiMessage {return {+ draft_generation: 0,attachments: [],attachments_draft: [],attachments_forwarded: [],diff --git a/apps/web/src/lib/queries/email/thread-redirect.test.ts b/apps/web/src/lib/queries/email/thread-redirect.test.tsnew file mode 100644index 0000000000..eac80b8e22--- /dev/null+++ b/apps/web/src/lib/queries/email/thread-redirect.test.ts@@ -0,0 +1,72 @@+import type { ApiThread } from '@service-email/generated/schemas';+import { QueryClient, QueryClientProvider } from '@tanstack/solid-query';+import { type Ok, ok } from 'neverthrow';+import { createComponent, createRoot, createSignal } from 'solid-js';+import { expect, it, vi } from 'vitest';++const getThread = vi.hoisted(() => vi.fn());+vi.mock('@service-email/client', () => ({ emailClient: { getThread } }));+vi.mock('@app/lib/analytics/posthog', async (original) => ({+ ...(await original<typeof import('@app/lib/analytics/posthog')>()),+ useFeatureFlag: () => () => ({ enabled: false }),+}));+vi.mock('./graphql/thread', () => ({+ createGraphqlEmailThreadQuery: (threadId: () => string) => ({+ query: {},+ resolvedThreadId: threadId,+ }),+ fetchGraphqlEmailThread: vi.fn(),+ mapGraphqlThreadError: vi.fn(),+}));++import { type ThreadQueryResult, useThreadQuery } from './thread';++function thread(id: string): ApiThread {+ return {+ db_id: id,+ link_id: 'inbox',+ access_level: 'owner',+ inbox_visible: true,+ is_read: true,+ created_at: '2026-10-08T00:00:00Z',+ updated_at: '2026-10-08T00:00:00Z',+ messages: [],+ };+}++it('retains the REST response identity independently of consumer selection and route changes', async () => {+ getThread.mockResolvedValueOnce(ok({ thread: thread('canonical') }));+ const next = Promise.withResolvers<Ok<{ thread: ApiThread }, unknown>>();+ getThread.mockReturnValueOnce(next.promise);+ const [route, setRoute] = createSignal('retained-source');+ const client = new QueryClient({+ defaultOptions: { queries: { retry: false } },+ });+ let query!: ThreadQueryResult<number>;+ const dispose = createRoot((dispose) => {+ createComponent(QueryClientProvider, {+ client,+ get children() {+ query = useThreadQuery(route, () => ({+ select: (pages) => pages.pages[0].messages.length,+ }));+ return null;+ },+ });+ return dispose;+ });+ try {+ await vi.waitFor(() => expect(query.isSuccess).toBe(true));+ expect(query.data).toBe(0);+ expect(query.resolvedThreadId).toBe('canonical');+ setRoute('other');+ expect(query.resolvedThreadId).toBe('other');+ await vi.waitFor(() => expect(getThread).toHaveBeenCalledTimes(2));+ next.resolve(ok({ thread: thread('other') }));+ await vi.waitFor(() => expect(query.isSuccess).toBe(true));+ expect(query.resolvedThreadId).toBe('other');+ } finally {+ dispose();+ client.clear();+ }+});diff --git a/apps/web/src/lib/queries/email/thread.ts b/apps/web/src/lib/queries/email/thread.tsindex 3e49aa90b7..87a74b643e 100644--- a/apps/web/src/lib/queries/email/thread.ts+++ b/apps/web/src/lib/queries/email/thread.ts@@ -205,6 +205,14 @@ export type ThreadQueryResult<TData> = {type ThreadQuerySelector<TData> = (data: InfiniteData<Thread, number>) => TData;+/** Preserve the server's canonical identity independently of consumer selection. */+function selectThreadWithIdentity<TData>(select: ThreadQuerySelector<TData>) {+ return (data: InfiniteData<Thread, number>) => ({+ canonicalThreadId: data.pages[0]?.db_id,+ value: select(data),+ });+}+type UseThreadQueryOptions<TData> = {enabled?: boolean;select?: ThreadQuerySelector<TData>;@@ -253,18 +261,21 @@ export function useThreadQuery<TData = ThreadQueryData>(const restQuery = useInfiniteQuery(() => ({...threadQueryOptions(threadId()),...options?.(),- select: select(),+ select: selectThreadWithIdentity(select()),enabled: queryEnabled() && !usesGraphql() && threadId().length > 0,}));return {get resolvedThreadId() {- return usesGraphql() ? resolvedThreadId() : threadId();+ if (usesGraphql()) return resolvedThreadId();+ return restQuery.isSuccess+ ? (restQuery.data?.canonicalThreadId ?? threadId())+ : threadId();},get data() {return usesGraphql()? graphqlQuery.data- : (restQuery.data as TData | undefined);+ : (restQuery.data?.value as TData | undefined);},get error() {if (!usesGraphql()) return (restQuery.error as Error | null) ?? null;@@ -668,6 +679,7 @@ export function useSendMessageMutation(}type ScheduleMessageParams = {+ draftGeneration?: number;draftID: string;sendTime: Date;threadID?: string;@@ -689,6 +701,7 @@ function _useScheduleMessageMutation(async () =>await emailClient.scheduleMessage({draftID: vars.draftID,+ draftGeneration: vars.draftGeneration,send_time: vars.sendTime.toISOString(),})),@@ -714,6 +727,7 @@ function _useScheduleMessageMutation(}type UnscheduleMessageParams = {+ draftGeneration?: number;draftID: string;/** Target inbox for a non-primary inbox; sent as the X-Email-Link-Id header. */linkId?: string;@@ -732,6 +746,7 @@ export function useUnscheduleMessageMutation(await emailClient.unscheduleMessage({draftID: vars.draftID,+ draftGeneration: vars.draftGeneration,},vars.linkId)diff --git a/apps/web/src/lib/queries/mutation-coverage.test.ts b/apps/web/src/lib/queries/mutation-coverage.test.tsindex d4b3ba90a5..39201c120a 100644--- a/apps/web/src/lib/queries/mutation-coverage.test.ts+++ b/apps/web/src/lib/queries/mutation-coverage.test.ts@@ -22,9 +22,10 @@ const policies = {UpdateInitiative: 'resolver',DeleteEntityProperty: 'resolver',SaveEmailDraft: 'custom: draft identity and thread links',- SendEmailMessage:- 'authoritative: online-only delivery; success requires server validation and enqueue',DeleteEmailDraft: 'custom: draft removal and thread links',+ SendEmailMessage:+ 'custom: independent email outbox and fetch-only submission',+ CancelEmailSend: 'custom: independent outbox cancellation and atomic restore',SetFavorite: 'custom: favorite list membership',ReorderFavorites: 'custom: ordered favorite links',SetEntityProperty: 'custom: assignment identity and parent links',diff --git a/apps/web/src/lib/queries/soup/graphql/grouped-local-projection.test.ts b/apps/web/src/lib/queries/soup/graphql/grouped-local-projection.test.tsindex 2ae5c856fa..28fa9ae5b5 100644--- a/apps/web/src/lib/queries/soup/graphql/grouped-local-projection.test.ts+++ b/apps/web/src/lib/queries/soup/graphql/grouped-local-projection.test.ts@@ -88,26 +88,36 @@ describe('loaded grouped pages', () => {});describe('local grouped Soup projection', () => {- it('retains server membership for an unknown grouping field', () => {- const futureInput: GroupedSoupInitialInput = JSON.parse(- '{"groupBy":{"field":"FUTURE"},"sortMethod":"UPDATED_AT"}'- );- const item = groupedDocument('a');- const baseline = [- { key: 'server-group', items: [item], totalCount: 1, nextCursor: null },- ];+ it('retains server membership for an unfamiliar grouping while refreshing rows', () => {+ const before = groupedDocument('a');+ const next = { ...groupedDocument('a', ['done']), displayName: 'Updated' };+ const fromNewerServer = JSON.parse('"ASSIGNEE"');- expect(localSoupGroupKeys(item, futureInput, now)).toBeUndefined();expect(projectLocalGroupedSoup(- baseline,+ [+ {+ key: 'server-group',+ items: [before],+ totalCount: 30,+ nextCursor: 'more',+ },+ ],new Map(),- snapshot([item]),- futureInput,+ snapshot([next]),+ { ...input, groupBy: { field: fromNewerServer } },now)- ).toEqual(baseline);+ ).toEqual([+ {+ key: 'server-group',+ items: [next],+ totalCount: 30,+ nextCursor: 'more',+ },+ ]);});+it('moves normalized rows and removes filter nonmatches without losing unknown rows', () => {const a = groupedDocument('a');const b = groupedDocument('b');diff --git a/apps/web/src/lib/service-clients/service-email/client.ts b/apps/web/src/lib/service-clients/service-email/client.tsindex 129e3798f5..e3274ff0ef 100644--- a/apps/web/src/lib/service-clients/service-email/client.ts+++ b/apps/web/src/lib/service-clients/service-email/client.ts@@ -377,13 +377,16 @@ export const emailClient = {},async scheduleMessage(- args: { draftID: string } & UpsertScheduledRequest,+ args: {+ draftID: string;+ draftGeneration?: number;+ } & UpsertScheduledRequest,linkId?: string) {- const { draftID, ...rest } = args;+ const { draftID, draftGeneration, ...rest } = args;return (await emailFetch<UpsertScheduledResponse>(- `/email/drafts/scheduled/${draftID}`,+ `/email/drafts/scheduled/${draftID}?draft_generation=${draftGeneration ?? 0}`,{method: 'PUT',body: JSON.stringify(rest),@@ -393,10 +396,13 @@ export const emailClient = {).map((result) => result);},- async unscheduleMessage(args: { draftID: string }, linkId?: string) {+ async unscheduleMessage(+ args: { draftID: string; draftGeneration?: number },+ linkId?: string+ ) {return (await emailFetch<EmptyResponse>(- `/email/drafts/scheduled/${args.draftID}`,+ `/email/drafts/scheduled/${args.draftID}?draft_generation=${args.draftGeneration ?? 0}`,{method: 'DELETE',headers: emailLinkHeaders(linkId),@@ -568,25 +574,32 @@ export const emailClient = {headers: emailLinkHeaders(linkId),});},- async deleteDraft(args: { id: string }, linkId?: string) {+ async deleteDraft(+ args: { id: string; draftGeneration?: number },+ linkId?: string+ ) {const { id } = args;return (- await emailFetch<EmptyResponse>(`/email/drafts/${id}`, {- method: 'DELETE',- headers: emailLinkHeaders(linkId),- })+ await emailFetch<EmptyResponse>(+ `/email/drafts/${id}?draft_generation=${args.draftGeneration ?? 0}`,+ {+ method: 'DELETE',+ headers: emailLinkHeaders(linkId),+ }+ )).map((result) => result);},async addDraftAttachment(args: {draftID: string;+ draftGeneration?: number;attachment: AddDraftAttachmentRequest;},linkId?: string) {return (await emailFetch<AddDraftAttachmentResponse>(- `/email/drafts/${args.draftID}/attachments`,+ `/email/drafts/${args.draftID}/attachments?draft_generation=${args.draftGeneration ?? 0}`,{method: 'POST',body: JSON.stringify(args.attachment),@@ -596,21 +609,21 @@ export const emailClient = {).map((result) => result);},async completeDraftAttachment(- args: { draftID: string; attachmentID: string },+ args: { draftID: string; attachmentID: string; draftGeneration?: number },linkId?: string) {return emailFetch<EmptyResponse>(- `/email/drafts/${args.draftID}/attachments/${args.attachmentID}/complete`,+ `/email/drafts/${args.draftID}/attachments/${args.attachmentID}/complete?draft_generation=${args.draftGeneration ?? 0}`,{ method: 'POST', headers: emailLinkHeaders(linkId) });},async removeDraftAttachment(- args: { draftID: string; attachmentID: string },+ args: { draftID: string; attachmentID: string; draftGeneration?: number },linkId?: string) {return (await emailFetch<EmptyResponse>(- `/email/drafts/${args.draftID}/attachments/${args.attachmentID}`,+ `/email/drafts/${args.draftID}/attachments/${args.attachmentID}?draft_generation=${args.draftGeneration ?? 0}`,{method: 'DELETE',headers: emailLinkHeaders(linkId),@@ -621,6 +634,7 @@ export const emailClient = {async addForwardedAttachment(args: {draftID: string;+ draftGeneration?: number;attachmentID: string;},linkId?: string@@ -631,23 +645,27 @@ export const emailClient = {filename: string | null;mime_type: string | null;size_bytes: number | null;- }>(`/email/drafts/${args.draftID}/forwarded-attachments`, {- method: 'POST',- body: JSON.stringify({ attachment_id: args.attachmentID }),- headers: emailLinkHeaders(linkId),- })+ }>(+ `/email/drafts/${args.draftID}/forwarded-attachments?draft_generation=${args.draftGeneration ?? 0}`,+ {+ method: 'POST',+ body: JSON.stringify({ attachment_id: args.attachmentID }),+ headers: emailLinkHeaders(linkId),+ }+ )).map((result) => result);},async removeForwardedAttachment(args: {draftID: string;+ draftGeneration?: number;attachmentID: string;},linkId?: string) {return (await emailFetch<EmptyResponse>(- `/email/drafts/${args.draftID}/forwarded-attachments/${args.attachmentID}`,+ `/email/drafts/${args.draftID}/forwarded-attachments/${args.attachmentID}?draft_generation=${args.draftGeneration ?? 0}`,{method: 'DELETE',headers: emailLinkHeaders(linkId),diff --git a/apps/web/src/lib/service-clients/service-email/generated/client.ts b/apps/web/src/lib/service-clients/service-email/generated/client.tsindex 998e1e1f86..44d6fa6081 100644--- a/apps/web/src/lib/service-clients/service-email/generated/client.ts+++ b/apps/web/src/lib/service-clients/service-email/generated/client.ts@@ -5,18 +5,23 @@* OpenAPI spec version: 0.1.0*/import type {+ AddDraftAttachmentParams,AddDraftAttachmentRequest,AddDraftAttachmentResponse,+ AddForwardedAttachmentParams,AddForwardedAttachmentRequest,AddForwardedAttachmentResponse,ApiPaginatedThreadCursor,ArchiveThreadRequest,BlockSenderRequest,CancelBackfillParams,+ CompleteDraftAttachmentParams,CreateDraftRequest,CreateDraftResponse,CreateLabelRequest,CreateLabelResponse,+ DeleteDraftParams,+ DeleteScheduledDraftParams,EmptyResponse,ErrorResponse,GetActiveBackfillJobResponse,@@ -45,6 +50,8 @@ import type {PatchSettingsRequest,PatchSettingsResponse,PreviewsInboxCursorParams,+ RemoveDraftAttachmentParams,+ RemoveForwardedAttachmentParams,ResolveMessageOperationRequest,ResyncResponse,SendMessageRequest,@@ -64,6 +71,7 @@ import type {UpdateThreadStateRequest,UpsertEmailFilterRequest,UpsertEmailFilterResponse,+ UpsertScheduledMessageParams,UpsertScheduledRequest,UpsertScheduledResponse,} from './schemas';@@ -976,16 +984,32 @@ export type upsertScheduledMessageResponse =| upsertScheduledMessageResponseSuccess| upsertScheduledMessageResponseError;-export const getUpsertScheduledMessageUrl = (id: string) => {- return `/email/drafts/scheduled/${id}`;+export const getUpsertScheduledMessageUrl = (+ id: string,+ params?: UpsertScheduledMessageParams+) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/email/drafts/scheduled/${id}?${stringifiedParams}`+ : `/email/drafts/scheduled/${id}`;};export const upsertScheduledMessage = async (id: string,upsertScheduledRequest: UpsertScheduledRequest,+ params?: UpsertScheduledMessageParams,options?: RequestInit): Promise<upsertScheduledMessageResponse> => {- const res = await fetch(getUpsertScheduledMessageUrl(id), {+ const res = await fetch(getUpsertScheduledMessageUrl(id, params), {...options,method: 'PUT',headers: { 'Content-Type': 'application/json', ...options?.headers },@@ -1055,15 +1079,31 @@ export type deleteScheduledDraftResponse =| deleteScheduledDraftResponseSuccess| deleteScheduledDraftResponseError;-export const getDeleteScheduledDraftUrl = (messageId: string) => {- return `/email/drafts/scheduled/${messageId}`;+export const getDeleteScheduledDraftUrl = (+ messageId: string,+ params?: DeleteScheduledDraftParams+) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/email/drafts/scheduled/${messageId}?${stringifiedParams}`+ : `/email/drafts/scheduled/${messageId}`;};export const deleteScheduledDraft = async (messageId: string,+ params?: DeleteScheduledDraftParams,options?: RequestInit): Promise<deleteScheduledDraftResponse> => {- const res = await fetch(getDeleteScheduledDraftUrl(messageId), {+ const res = await fetch(getDeleteScheduledDraftUrl(messageId, params), {...options,method: 'DELETE',});@@ -1124,15 +1164,28 @@ export type deleteDraftResponse =| deleteDraftResponseSuccess| deleteDraftResponseError;-export const getDeleteDraftUrl = (id: string) => {- return `/email/drafts/${id}`;+export const getDeleteDraftUrl = (id: string, params?: DeleteDraftParams) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/email/drafts/${id}?${stringifiedParams}`+ : `/email/drafts/${id}`;};export const deleteDraft = async (id: string,+ params?: DeleteDraftParams,options?: RequestInit): Promise<deleteDraftResponse> => {- const res = await fetch(getDeleteDraftUrl(id), {+ const res = await fetch(getDeleteDraftUrl(id, params), {...options,method: 'DELETE',});@@ -1192,16 +1245,32 @@ export type addDraftAttachmentResponse =| addDraftAttachmentResponseSuccess| addDraftAttachmentResponseError;-export const getAddDraftAttachmentUrl = (id: string) => {- return `/email/drafts/${id}/attachments`;+export const getAddDraftAttachmentUrl = (+ id: string,+ params?: AddDraftAttachmentParams+) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/email/drafts/${id}/attachments?${stringifiedParams}`+ : `/email/drafts/${id}/attachments`;};export const addDraftAttachment = async (id: string,addDraftAttachmentRequest: AddDraftAttachmentRequest,+ params?: AddDraftAttachmentParams,options?: RequestInit): Promise<addDraftAttachmentResponse> => {- const res = await fetch(getAddDraftAttachmentUrl(id), {+ const res = await fetch(getAddDraftAttachmentUrl(id, params), {...options,method: 'POST',headers: { 'Content-Type': 'application/json', ...options?.headers },@@ -1265,20 +1334,37 @@ export type removeDraftAttachmentResponse =export const getRemoveDraftAttachmentUrl = (id: string,- attachmentId: string+ attachmentId: string,+ params?: RemoveDraftAttachmentParams) => {- return `/email/drafts/${id}/attachments/${attachmentId}`;+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/email/drafts/${id}/attachments/${attachmentId}?${stringifiedParams}`+ : `/email/drafts/${id}/attachments/${attachmentId}`;};export const removeDraftAttachment = async (id: string,attachmentId: string,+ params?: RemoveDraftAttachmentParams,options?: RequestInit): Promise<removeDraftAttachmentResponse> => {- const res = await fetch(getRemoveDraftAttachmentUrl(id, attachmentId), {- ...options,- method: 'DELETE',- });+ const res = await fetch(+ getRemoveDraftAttachmentUrl(id, attachmentId, params),+ {+ ...options,+ method: 'DELETE',+ }+ );const body = [204, 205, 304].includes(res.status) ? null : await res.text();@@ -1345,20 +1431,37 @@ export type completeDraftAttachmentResponse =export const getCompleteDraftAttachmentUrl = (id: string,- attachmentId: string+ attachmentId: string,+ params?: CompleteDraftAttachmentParams) => {- return `/email/drafts/${id}/attachments/${attachmentId}/complete`;+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/email/drafts/${id}/attachments/${attachmentId}/complete?${stringifiedParams}`+ : `/email/drafts/${id}/attachments/${attachmentId}/complete`;};export const completeDraftAttachment = async (id: string,attachmentId: string,+ params?: CompleteDraftAttachmentParams,options?: RequestInit): Promise<completeDraftAttachmentResponse> => {- const res = await fetch(getCompleteDraftAttachmentUrl(id, attachmentId), {- ...options,- method: 'POST',- });+ const res = await fetch(+ getCompleteDraftAttachmentUrl(id, attachmentId, params),+ {+ ...options,+ method: 'POST',+ }+ );const body = [204, 205, 304].includes(res.status) ? null : await res.text();@@ -1405,16 +1508,32 @@ export type addForwardedAttachmentResponse =| addForwardedAttachmentResponseSuccess| addForwardedAttachmentResponseError;-export const getAddForwardedAttachmentUrl = (id: string) => {- return `/email/drafts/${id}/forwarded-attachments`;+export const getAddForwardedAttachmentUrl = (+ id: string,+ params?: AddForwardedAttachmentParams+) => {+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/email/drafts/${id}/forwarded-attachments?${stringifiedParams}`+ : `/email/drafts/${id}/forwarded-attachments`;};export const addForwardedAttachment = async (id: string,addForwardedAttachmentRequest: AddForwardedAttachmentRequest,+ params?: AddForwardedAttachmentParams,options?: RequestInit): Promise<addForwardedAttachmentResponse> => {- const res = await fetch(getAddForwardedAttachmentUrl(id), {+ const res = await fetch(getAddForwardedAttachmentUrl(id, params), {...options,method: 'POST',headers: { 'Content-Type': 'application/json', ...options?.headers },@@ -1468,20 +1587,37 @@ export type removeForwardedAttachmentResponse =export const getRemoveForwardedAttachmentUrl = (id: string,- attachmentId: string+ attachmentId: string,+ params?: RemoveForwardedAttachmentParams) => {- return `/email/drafts/${id}/forwarded-attachments/${attachmentId}`;+ const normalizedParams = new URLSearchParams();++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : value.toString());+ }+ });++ const stringifiedParams = normalizedParams.toString();++ return stringifiedParams.length > 0+ ? `/email/drafts/${id}/forwarded-attachments/${attachmentId}?${stringifiedParams}`+ : `/email/drafts/${id}/forwarded-attachments/${attachmentId}`;};export const removeForwardedAttachment = async (id: string,attachmentId: string,+ params?: RemoveForwardedAttachmentParams,options?: RequestInit): Promise<removeForwardedAttachmentResponse> => {- const res = await fetch(getRemoveForwardedAttachmentUrl(id, attachmentId), {- ...options,- method: 'DELETE',- });+ const res = await fetch(+ getRemoveForwardedAttachmentUrl(id, attachmentId, params),+ {+ ...options,+ method: 'DELETE',+ }+ );const body = [204, 205, 304].includes(res.status) ? null : await res.text();diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/addDraftAttachmentParams.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/addDraftAttachmentParams.tsnew file mode 100644index 0000000000..0bac262d09--- /dev/null+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/addDraftAttachmentParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type AddDraftAttachmentParams = {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+};diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/addForwardedAttachmentParams.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/addForwardedAttachmentParams.tsnew file mode 100644index 0000000000..cac9f04b98--- /dev/null+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/addForwardedAttachmentParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type AddForwardedAttachmentParams = {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+};diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/apiDraftInput.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/apiDraftInput.tsindex 75d5849b1c..3083f80491 100644--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/apiDraftInput.ts+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/apiDraftInput.ts@@ -34,6 +34,8 @@ export interface ApiDraftInput {cc?: ApiDraftInputCc;/** Existing message DB ID (for updating an existing draft). */db_id?: ApiDraftInputDbId;+ /** Generation from the last loaded draft; legacy clients begin at zero. */+ draft_generation?: number;headers_json?: ApiDraftInputHeadersJson;/** Per-message override for whether to include the signature on send:`Some(false)` to exclude (user dismissed it). Omit to use the inbox'sdiff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/apiDraftOutput.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/apiDraftOutput.tsindex f85b47013c..f1611e97ff 100644--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/apiDraftOutput.ts+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/apiDraftOutput.ts@@ -34,6 +34,8 @@ export interface ApiDraftOutput {cc?: ApiDraftOutputCc;/** Message DB ID. */db_id?: ApiDraftOutputDbId;+ /** Generation required for subsequent edits. */+ draft_generation: number;headers_json?: ApiDraftOutputHeadersJson;/** Link ID. */link_id: string;diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/apiMessage.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/apiMessage.tsindex 8722c9d902..90386952c3 100644--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/apiMessage.ts+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/apiMessage.ts@@ -22,6 +22,7 @@ import type { ApiMessageProviderHistoryId } from './apiMessageProviderHistoryId'import type { ApiMessageProviderId } from './apiMessageProviderId';import type { ApiMessageProviderThreadId } from './apiMessageProviderThreadId';import type { ApiMessageReplyingToId } from './apiMessageReplyingToId';+import type { ApiMessageScheduledSendStatus } from './apiMessageScheduledSendStatus';import type { ApiMessageScheduledSendTime } from './apiMessageScheduledSendTime';import type { ApiMessageSentAt } from './apiMessageSentAt';import type { ApiMessageSizeEstimate } from './apiMessageSizeEstimate';@@ -45,6 +46,8 @@ export interface ApiMessage {cc: ApiContactInfo[];created_at: string;db_id: string;+ /** Draft edit generation; changes at send and cancellation boundaries. */+ draft_generation: number;from?: ApiMessageFrom;global_id?: ApiMessageGlobalId;has_attachments: boolean;@@ -61,6 +64,7 @@ export interface ApiMessage {provider_id?: ApiMessageProviderId;provider_thread_id?: ApiMessageProviderThreadId;replying_to_id?: ApiMessageReplyingToId;+ scheduled_send_status?: ApiMessageScheduledSendStatus;scheduled_send_time?: ApiMessageScheduledSendTime;sent_at?: ApiMessageSentAt;size_estimate?: ApiMessageSizeEstimate;diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/apiMessageScheduledSendStatus.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/apiMessageScheduledSendStatus.tsnew file mode 100644index 0000000000..7d0ed58c78--- /dev/null+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/apiMessageScheduledSendStatus.ts@@ -0,0 +1,9 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */+import type { ScheduledSendStatus } from './scheduledSendStatus';++export type ApiMessageScheduledSendStatus = null | ScheduledSendStatus;diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/completeDraftAttachmentParams.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/completeDraftAttachmentParams.tsnew file mode 100644index 0000000000..0833fb53da--- /dev/null+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/completeDraftAttachmentParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type CompleteDraftAttachmentParams = {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+};diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/deleteDraftParams.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/deleteDraftParams.tsnew file mode 100644index 0000000000..6e24000fd3--- /dev/null+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/deleteDraftParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type DeleteDraftParams = {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+};diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/deleteScheduledDraftParams.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/deleteScheduledDraftParams.tsnew file mode 100644index 0000000000..04bdce86ba--- /dev/null+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/deleteScheduledDraftParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type DeleteScheduledDraftParams = {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+};diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/index.tsindex 36232c4984..d20cb2c1c2 100644--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/index.ts+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/index.ts@@ -6,9 +6,11 @@*/export * from './accessLevel';+export * from './addDraftAttachmentParams';export * from './addDraftAttachmentRequest';export * from './addDraftAttachmentRequestUploadId';export * from './addDraftAttachmentResponse';+export * from './addForwardedAttachmentParams';export * from './addForwardedAttachmentRequest';export * from './addForwardedAttachmentResponse';export * from './addForwardedAttachmentResponseFilename';@@ -106,6 +108,7 @@ export * from './apiMessageProviderId';export * from './apiMessageProviderThreadId';export * from './apiMessageReplyingToId';export * from './apiMessageResolutionAction';+export * from './apiMessageScheduledSendStatus';export * from './apiMessageScheduledSendTime';export * from './apiMessageSentAt';export * from './apiMessageSizeEstimate';@@ -190,6 +193,7 @@ export * from './calendarInvitationTitle';export * from './calendarOccurrence';export * from './calendarOccurrenceRecurrenceId';export * from './cancelBackfillParams';+export * from './completeDraftAttachmentParams';export * from './conferenceProvider';export * from './contact';export * from './contactEmailAddress';@@ -209,6 +213,8 @@ export * from './createDraftRequestSendTime';export * from './createDraftResponse';export * from './createLabelRequest';export * from './createLabelResponse';+export * from './deleteDraftParams';+export * from './deleteScheduledDraftParams';export * from './emptyResponse';export * from './errorResponse';export * from './eventReminderOverride';@@ -349,9 +355,12 @@ export * from './refreshEmailEventOneOfSeven';export * from './refreshEmailEventOneOfSevenEvent';export * from './refreshEmailEventOneOfThree';export * from './refreshEmailEventOneOfThreeEvent';+export * from './removeDraftAttachmentParams';+export * from './removeForwardedAttachmentParams';export * from './resolveMessageOperationRequest';export * from './resolveMessageOperationRequestRemoteVersion';export * from './resyncResponse';+export * from './scheduledSendStatus';export * from './sendMessageRequest';export * from './sendMessageResponse';export * from './settings';@@ -395,6 +404,7 @@ export * from './upsertEmailFilterRequest';export * from './upsertEmailFilterRequestEmailAddress';export * from './upsertEmailFilterRequestEmailDomain';export * from './upsertEmailFilterResponse';+export * from './upsertScheduledMessageParams';export * from './upsertScheduledRequest';export * from './upsertScheduledRequestIncludeSignature';export * from './upsertScheduledResponse';diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/parsedMessage.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/parsedMessage.tsindex b1cc8c688f..59fdc0d68f 100644--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/parsedMessage.ts+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/parsedMessage.ts@@ -16,6 +16,8 @@ export interface ParsedMessage {body_parsed?: ParsedMessageBodyParsed;cc: ContactInfo[];db_id: string;+ /** Draft edit generation captured with this message snapshot. */+ draft_generation?: number;from?: ParsedMessageFrom;internal_date_ts?: ParsedMessageInternalDateTs;labels: LabelInfo[];diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/removeDraftAttachmentParams.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/removeDraftAttachmentParams.tsnew file mode 100644index 0000000000..5399f0735b--- /dev/null+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/removeDraftAttachmentParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type RemoveDraftAttachmentParams = {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+};diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/removeForwardedAttachmentParams.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/removeForwardedAttachmentParams.tsnew file mode 100644index 0000000000..c83e4fce8e--- /dev/null+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/removeForwardedAttachmentParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type RemoveForwardedAttachmentParams = {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+};diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/scheduledSendStatus.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/scheduledSendStatus.tsnew file mode 100644index 0000000000..7b33b96973--- /dev/null+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/scheduledSendStatus.ts@@ -0,0 +1,20 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * The user-visible delivery state of an unsent scheduled message.+ */+export type ScheduledSendStatus =+ (typeof ScheduledSendStatus)[keyof typeof ScheduledSendStatus];++// eslint-disable-next-line @typescript-eslint/no-redeclare+export const ScheduledSendStatus = {+ pending: 'pending',+ sending: 'sending',+ failed: 'failed',+ unconfirmed: 'unconfirmed',+} as const;diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/transferDraftRequest.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/transferDraftRequest.tsindex 5da934372c..33888157a7 100644--- a/apps/web/src/lib/service-clients/service-email/generated/schemas/transferDraftRequest.ts+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/transferDraftRequest.ts@@ -10,5 +10,7 @@*/export interface TransferDraftRequest {destination_link_id: string;+ /** Generation captured with the source draft. */+ draft_generation?: number;operation_id: string;}diff --git a/apps/web/src/lib/service-clients/service-email/generated/schemas/upsertScheduledMessageParams.ts b/apps/web/src/lib/service-clients/service-email/generated/schemas/upsertScheduledMessageParams.tsnew file mode 100644index 0000000000..51a0b4dd13--- /dev/null+++ b/apps/web/src/lib/service-clients/service-email/generated/schemas/upsertScheduledMessageParams.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * email_service+ * OpenAPI spec version: 0.1.0+ */++export type UpsertScheduledMessageParams = {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+};diff --git a/apps/web/src/lib/service-clients/service-email/openapi.json b/apps/web/src/lib/service-clients/service-email/openapi.jsonindex 003002bf0d..a9be7c28e4 100644--- a/apps/web/src/lib/service-clients/service-email/openapi.json+++ b/apps/web/src/lib/service-clients/service-email/openapi.json@@ -783,6 +783,16 @@"summary": "Schedule or update a scheduled draft.","operationId": "upsert_scheduled_message","parameters": [+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }+ },{"name": "id","in": "path",@@ -874,6 +884,16 @@"summary": "Remove the scheduled send from a draft, including immediate-send undo.","operationId": "delete_scheduled_draft","parameters": [+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }+ },{"name": "message_id","in": "path",@@ -948,6 +968,16 @@"summary": "Delete a draft.","operationId": "delete_draft","parameters": [+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }+ },{"name": "id","in": "path",@@ -1028,6 +1058,16 @@"type": "string","format": "uuid"}+ },+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }}],"requestBody": {@@ -1119,6 +1159,16 @@"type": "string","format": "uuid"}+ },+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }}],"responses": {@@ -1181,6 +1231,16 @@"summary": "Confirm an uploaded attachment before it becomes part of a sendable draft.","operationId": "complete_draft_attachment","parameters": [+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }+ },{"name": "id","in": "path",@@ -1237,6 +1297,16 @@"type": "string","format": "uuid"}+ },+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }}],"requestBody": {@@ -1308,6 +1378,16 @@"type": "string","format": "uuid"}+ },+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }}],"responses": {@@ -3716,6 +3796,11 @@"format": "uuid","description": "Existing message DB ID (for updating an existing draft)."},+ "draft_generation": {+ "type": "integer",+ "format": "int32",+ "description": "Generation from the last loaded draft; legacy clients begin at zero."+ },"headers_json": {"oneOf": [{@@ -3765,7 +3850,7 @@"ApiDraftOutput": {"type": "object","description": "The draft output matching the current `MessageToSend` JSON shape for backward compat.",- "required": ["link_id", "subject"],+ "required": ["draft_generation", "link_id", "subject"],"properties": {"bcc": {"type": ["array", "null"],@@ -3798,6 +3883,11 @@"format": "uuid","description": "Message DB ID."},+ "draft_generation": {+ "type": "integer",+ "format": "int32",+ "description": "Generation required for subsequent edits."+ },"headers_json": {"oneOf": [{@@ -3928,6 +4018,7 @@"type": "object","description": "API representation of a fully assembled email message.","required": [+ "draft_generation","db_id","thread_db_id","link_id",@@ -4003,6 +4094,11 @@"type": "string","format": "uuid"},+ "draft_generation": {+ "type": "integer",+ "format": "int32",+ "description": "Draft edit generation; changes at send and cancellation boundaries."+ },"from": {"oneOf": [{@@ -4069,6 +4165,17 @@"type": ["string", "null"],"format": "uuid"},+ "scheduled_send_status": {+ "oneOf": [+ {+ "type": "null"+ },+ {+ "$ref": "#/components/schemas/ScheduledSendStatus",+ "description": "Delivery state, including failures and unresolved provider outcomes."+ }+ ]+ },"scheduled_send_time": {"type": ["string", "null"],"format": "date-time"@@ -6297,6 +6404,11 @@"type": "string","format": "uuid"},+ "draft_generation": {+ "type": "integer",+ "format": "int32",+ "description": "Draft edit generation captured with this message snapshot."+ },"from": {"oneOf": [{@@ -6552,6 +6664,11 @@}}},+ "ScheduledSendStatus": {+ "type": "string",+ "description": "The user-visible delivery state of an unsent scheduled message.",+ "enum": ["pending", "sending", "failed", "unconfirmed"]+ },"SendMessageRequest": {"type": "object","description": "Request body for sending a message (backward-compatible with `{ message: MessageToSend }`).",@@ -6794,6 +6911,11 @@"type": "string","format": "uuid"},+ "draft_generation": {+ "type": "integer",+ "format": "int32",+ "description": "Generation captured with the source draft."+ },"operation_id": {"type": "string","format": "uuid"diff --git a/apps/web/src/lib/service-clients/service-storage/cache-recovery.test.ts b/apps/web/src/lib/service-clients/service-storage/cache-recovery.test.tsnew file mode 100644index 0000000000..cb81a6fff2--- /dev/null+++ b/apps/web/src/lib/service-clients/service-storage/cache-recovery.test.ts@@ -0,0 +1,87 @@+import { CacheBootstrapExhaustedError } from '@graphql-cache/worker/startup';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { createCacheRecovery } from './cache-recovery';++vi.mock('@core/util/fireAndForget', () => ({+ fireAndForget: async (work: Promise<unknown>) => {+ try {+ await work;+ } catch {+ // Recovery exposes its error state to the caller.+ }+ },+}));++beforeEach(() => {+ vi.useFakeTimers();+ vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(true);+ vi.spyOn(document, 'visibilityState', 'get').mockReturnValue('visible');+});+afterEach(() => {+ vi.useRealTimers();+ vi.restoreAllMocks();+});++it('retries an untouched bootstrap on reconnect, single flight, until storage is readable', async () => {+ const opened = Promise.withResolvers<void>();+ const rebuild = vi.fn(() => opened.promise);+ const recovery = createCacheRecovery(rebuild);+ recovery.failed(new CacheBootstrapExhaustedError('Failed to fetch'));+ window.dispatchEvent(new Event('online'));+ const retry = recovery.retry();+ expect(recovery.state()).toBe('recovering');+ expect(rebuild).toHaveBeenCalledOnce();+ opened.resolve();+ await retry;+ expect(recovery.state()).toBe('ready');+ await vi.advanceTimersByTimeAsync(60_000);+ expect(rebuild).toHaveBeenCalledOnce();+ recovery.reset();+});++it('allows another foreground attempt after repeated bootstrap failures', async () => {+ const rebuild = vi.fn(async (): Promise<void> => {+ throw new CacheBootstrapExhaustedError('Failed to fetch');+ });+ const recovery = createCacheRecovery(rebuild);+ recovery.failed(new CacheBootstrapExhaustedError('Failed to fetch'));+ await vi.advanceTimersByTimeAsync(120_000);+ expect(rebuild.mock.calls.length).toBeGreaterThan(5);+ expect(recovery.state()).toBe('unavailable');+ rebuild.mockResolvedValueOnce(undefined);+ await recovery.retry();+ expect(recovery.state()).toBe('ready');+ recovery.reset();+});++it('does not reopen potentially damaged storage', async () => {+ const rebuild = vi.fn(async () => {});+ const recovery = createCacheRecovery(rebuild);+ const error = new Error('database recovery failed');+ recovery.failed(error);+ window.dispatchEvent(new Event('online'));+ await vi.advanceTimersByTimeAsync(60_000);+ await expect(recovery.retry()).rejects.toBe(error);+ expect(recovery.state()).toBe('recovery-required');+ expect(rebuild).not.toHaveBeenCalled();+ recovery.reset();+});++it('pauses offline and fences a completion from the previous session', async () => {+ const opened = Promise.withResolvers<void>();+ const rebuild = vi.fn(() => opened.promise);+ const recovery = createCacheRecovery(rebuild);+ const failure = new CacheBootstrapExhaustedError('Failed to fetch');+ recovery.failed(failure);+ vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(false);+ await vi.advanceTimersByTimeAsync(60_000);+ expect(rebuild).not.toHaveBeenCalled();+ vi.spyOn(navigator, 'onLine', 'get').mockReturnValue(true);+ const old = recovery.retry();+ recovery.reset();+ recovery.failed(new Error('new account storage requires recovery'));+ opened.resolve();+ await old;+ expect(recovery.state()).toBe('recovery-required');+ recovery.reset();+});diff --git a/apps/web/src/lib/service-clients/service-storage/cache-recovery.ts b/apps/web/src/lib/service-clients/service-storage/cache-recovery.tsnew file mode 100644index 0000000000..142847d9c7--- /dev/null+++ b/apps/web/src/lib/service-clients/service-storage/cache-recovery.ts@@ -0,0 +1,112 @@+import { fireAndForget } from '@core/util/fireAndForget';+import { isOwnerLockUnavailableError } from '@graphql-cache/protocol';+import { CacheBootstrapExhaustedError } from '@graphql-cache/worker/startup';+import { createSignal } from 'solid-js';++export type CacheRecoveryState =+ | 'ready'+ | 'recovering'+ | 'unavailable'+ | 'recovery-required';++/** Owns a page session's retry cycle, never the persisted cache or its scope. */+export function createCacheRecovery(rebuild: () => Promise<void>) {+ const [state, setState] = createSignal<CacheRecoveryState>('ready');+ let failure: unknown;+ let generation = 0;+ let attempt = 0;+ let pending: Promise<void> | undefined;+ let timer: ReturnType<typeof setTimeout> | undefined;+ let listening = false;++ const clearTimer = () => {+ if (timer !== undefined) clearTimeout(timer);+ timer = undefined;+ };+ const resume = () => {+ if (+ navigator.onLine === false ||+ document.visibilityState === 'hidden' ||+ state() !== 'unavailable'+ )+ return;+ fireAndForget(retry(), 'graphql-cache-recovery');+ };+ const listen = () => {+ if (listening) return;+ listening = true;+ window.addEventListener('online', resume);+ document.addEventListener('visibilitychange', resume);+ };+ const unlisten = () => {+ if (!listening) return;+ listening = false;+ window.removeEventListener('online', resume);+ document.removeEventListener('visibilitychange', resume);+ };+ const schedule = () => {+ clearTimer();+ if (state() !== 'unavailable') return;+ listen();+ const delay = Math.min(30_000, 1_000 * 2 ** Math.min(attempt++, 5));+ timer = setTimeout(resume, delay * (0.8 + Math.random() * 0.4));+ };+ const failed = (error: unknown) => {+ failure = error;+ // Only these typed errors prove restarting cannot bypass a quarantined+ // journal. Unknown storage/transport failures stay closed for recovery.+ const recoverable =+ error instanceof CacheBootstrapExhaustedError ||+ isOwnerLockUnavailableError(error);+ setState(recoverable ? 'unavailable' : 'recovery-required');+ if (recoverable) schedule();+ else {+ clearTimer();+ unlisten();+ }+ };+ async function run(epoch: number) {+ try {+ await rebuild();+ if (generation !== epoch) return;+ failure = undefined;+ attempt = 0;+ clearTimer();+ unlisten();+ setState('ready');+ } catch (error) {+ if (generation !== epoch) return;+ failed(error);+ throw error;+ } finally {+ if (generation === epoch) pending = undefined;+ }+ }+ function retry(): Promise<void> {+ if (pending) return pending;+ if (state() === 'ready') return Promise.resolve();+ if (state() === 'recovery-required') return Promise.reject(failure);+ if (navigator.onLine === false)+ return Promise.reject(+ new Error('Reconnect to retry draft synchronization.')+ );+ clearTimer();+ setState('recovering');+ pending = run(generation);+ return pending;+ }+ return {+ state,+ failed,+ retry,+ reset() {+ generation += 1;+ pending = undefined;+ failure = undefined;+ attempt = 0;+ clearTimer();+ unlisten();+ setState('ready');+ },+ };+}diff --git a/apps/web/src/lib/service-clients/service-storage/email-send.ts b/apps/web/src/lib/service-clients/service-storage/email-send.tsnew file mode 100644index 0000000000..4520dfdd54--- /dev/null+++ b/apps/web/src/lib/service-clients/service-storage/email-send.ts@@ -0,0 +1,81 @@+import { SERVER_HOSTS } from '@core/constant/servers';+import { createClient, fetchExchange } from '@urql/core';+import {+ CancelEmailSendDocument,+ EmailSendAttemptDocument,+ PendingEmailSendsDocument,+ type SendEmailAttemptInput,+ SendEmailMessageDocument,+} from './graphql/generated/graphql';+import { dssGraphqlFetch } from './graphql-soup';++// Delivery already has a durable email journal. Never pass these operations+// through the normalized-cache exchange or its general mutation queue.+const client = createClient({+ url: `${SERVER_HOSTS['document-storage-service']}/items/soup/graphql`,+ preferGetMethod: false,+ exchanges: [fetchExchange],+ fetch: dssGraphqlFetch,+});++export async function submitEmailSend(+ input: SendEmailAttemptInput,+ signal: AbortSignal+) {+ const result = await client+ .mutation(SendEmailMessageDocument, { input }, { fetchOptions: { signal } })+ .toPromise();+ if (result.error) throw result.error;+ if (!result.data) throw new Error('Email acceptance was not confirmed');+ return result.data.sendEmailMessage.attempt;+}++export async function cancelEmailSend(+ input: SendEmailAttemptInput['attempt'],+ signal: AbortSignal+) {+ const result = await client+ .mutation(CancelEmailSendDocument, { input }, { fetchOptions: { signal } })+ .toPromise();+ if (result.error) throw result.error;+ if (!result.data) throw new Error('Email cancellation was not confirmed');+ return result.data.cancelEmailSend.attempt;+}++export async function readEmailSendStatus(+ input: SendEmailAttemptInput['attempt'],+ signal: AbortSignal+) {+ const result = await client+ .query(+ EmailSendAttemptDocument,+ { input },+ {+ requestPolicy: 'network-only',+ fetchOptions: { signal },+ }+ )+ .toPromise();+ if (result.error) throw result.error;+ if (!result.data) throw new Error('Email status was not confirmed');+ return result.data.user.emailSendAttempt;+}++export async function readPendingEmailSends(+ after: string | undefined,+ signal: AbortSignal+) {+ const result = await client+ .query(+ PendingEmailSendsDocument,+ { after },+ {+ requestPolicy: 'network-only',+ fetchOptions: { signal },+ }+ )+ .toPromise();+ if (result.error) throw result.error;+ if (!result.data) throw new Error('Pending email sends could not be loaded');+ return result.data.user;+}diff --git a/apps/web/src/lib/service-clients/service-storage/graphql-soup.test.ts b/apps/web/src/lib/service-clients/service-storage/graphql-soup.test.tsindex f9395a2e13..d5aa111ec9 100644--- a/apps/web/src/lib/service-clients/service-storage/graphql-soup.test.ts+++ b/apps/web/src/lib/service-clients/service-storage/graphql-soup.test.ts@@ -279,6 +279,8 @@ const mocks = vi.hoisted(() => {const cleanupOrder: string[] = [];const host = {disabled: false,+ currentRevision: vi.fn(async () => '1'),+ inspectMutations: vi.fn(async () => []),dispose: vi.fn(() => cleanupOrder.push('host')),enqueueOptimisticMutation: vi.fn(async () => {queuedMutationCount += 1;@@ -748,7 +750,9 @@ describe('GraphQL Soup browser cache session gate', () => {mocks.telemetryError.mockReset();});- afterEach(() => {+ afterEach(async () => {+ const soup = await import('./graphql-soup');+ soup.setGraphqlSoupSessionActive(false);vi.unstubAllGlobals();});@@ -1114,6 +1118,86 @@ describe('GraphQL Soup browser cache session gate', () => {});+ it('reopens the same scope and keeps draft writes blocked until queue inspection completes', async () => {+ vi.spyOn(console, 'warn').mockImplementation(() => {});+ const soup = await import('./graphql-soup');+ const { CacheBootstrapExhaustedError } = await import(+ '@graphql-cache/worker/startup'+ );+ soup.getGraphqlSoupClient();+ mocks.failInitialization(+ new CacheBootstrapExhaustedError('Failed to fetch')+ );+ expect(soup.graphqlDraftQueueBlocked()).toBe(true);+ const inspection = Promise.withResolvers<never[]>();+ mocks.host.inspectMutations.mockImplementationOnce(+ () => inspection.promise+ );+ const retry = soup.retryGraphqlCacheInitialization();+ expect(soup.graphqlDraftQueueBlocked()).toBe(true);+ inspection.resolve([]);+ await retry;+ expect(soup.graphqlDraftQueueBlocked()).toBe(false);+ expect(soup.graphqlCacheEnabled()).toBe(true);+ expect(mocks.createWorkerCacheHost).toHaveBeenCalledTimes(2);+ for (const [options] of mocks.createWorkerCacheHost.mock.calls) {+ expect(options).toMatchObject({ scope: 'anonymous-scope' });+ }+ });++ it('rejects drafts from both retired and uncached transports after recovery', async () => {+ vi.spyOn(console, 'warn').mockImplementation(() => {});+ const soup = await import('./graphql-soup');+ const { CacheBootstrapExhaustedError } = await import(+ '@graphql-cache/worker/startup'+ );+ soup.getGraphqlSoupClient();+ const old = soup.getGraphqlCacheHost();+ mocks.failInitialization(+ new CacheBootstrapExhaustedError('Failed to fetch')+ );+ await soup.retryGraphqlCacheInitialization();+ const request = {+ method: 'POST',+ body: JSON.stringify({+ query: 'mutation { saveEmailDraft(input: {}) { __typename } }',+ }),+ };+ await expect(+ soup.dssGraphqlFetch('http://dss.test/graphql', request, old)+ ).rejects.toThrow('client was replaced');+ await expect(+ soup.dssGraphqlFetch('http://dss.test/graphql', request)+ ).rejects.toThrow('client was replaced');+ expect(mocks.platformFetch).not.toHaveBeenCalled();+ });++ it('does not enable a replacement that finishes inspection after sign-out', async () => {+ vi.spyOn(console, 'warn').mockImplementation(() => {});+ const soup = await import('./graphql-soup');+ const { CacheBootstrapExhaustedError } = await import(+ '@graphql-cache/worker/startup'+ );+ soup.getGraphqlSoupClient();+ mocks.failInitialization(+ new CacheBootstrapExhaustedError('Failed to fetch')+ );+ const inspected = Promise.withResolvers<void>();+ const inspection = Promise.withResolvers<never[]>();+ mocks.host.inspectMutations.mockImplementationOnce(() => {+ inspected.resolve();+ return inspection.promise;+ });+ const retry = soup.retryGraphqlCacheInitialization();+ await inspected.promise;+ soup.setGraphqlSoupSessionActive(false);+ inspection.resolve([]);+ await retry;+ expect(soup.getGraphqlCacheHost()).toBeUndefined();+ expect(soup.graphqlCacheEnabled()).toBe(false);+ expect(soup.getGraphqlSoupClient()).toBe(mocks.plainClient);+ });+it('reports synchronous cache construction failures before falling back', async () => {vi.spyOn(console, 'warn').mockImplementation(() => {});const error = new Error('cache worker construction failed');@@ -1165,7 +1249,8 @@ describe('GraphQL Soup browser cache session gate', () => {expect(soup.graphqlCacheEnabled()).toBe(false);expect(mocks.cleanupOrder()).toEqual(['subscriptions', 'host']);expect(mocks.toastFailure).toHaveBeenCalledWith('Local cache unavailable', {- subtext: 'Macro will continue without local caching for this session.',+ subtext:+ 'Queued changes are preserved. Update or reload Macro to recover local storage.',});expect(warn).toHaveBeenCalledWith('graphql cache async init failed; using uncached client',@@ -1286,7 +1371,7 @@ describe('GraphQL Soup browser cache session gate', () => {expect(mocks.toastFailure).not.toHaveBeenCalled();expect(mocks.telemetryError).not.toHaveBeenCalled();expect(info).toHaveBeenCalledExactlyOnceWith(- '[graphql-cache] owner lock is held by another context; using the network until reload'+ '[graphql-cache] owner lock is held by another context; using the network while waiting to retry');expect(mocks.host.dispose).toHaveBeenCalledOnce();expect(soup.graphqlCacheEnabled()).toBe(false);diff --git a/apps/web/src/lib/service-clients/service-storage/graphql-soup.ts b/apps/web/src/lib/service-clients/service-storage/graphql-soup.tsindex 34bd80bf30..a58b7a03e9 100644--- a/apps/web/src/lib/service-clients/service-storage/graphql-soup.ts+++ b/apps/web/src/lib/service-clients/service-storage/graphql-soup.ts@@ -73,6 +73,7 @@ import { batch, createSignal, untrack } from 'solid-js';import { match, P } from 'ts-pattern';import { delegateChannelNotificationRefresh } from '../../queries/channel/notification-refresh';import { soupOptimisticResolvers } from '../../queries/optimistic-resolvers';+import { createCacheRecovery } from './cache-recovery';import { emailCacheDeletionKeys } from './email-cache-deletions';import type { SoupApiItem } from './generated/schemas/soupApiItem';import type { SoupCalendarEventSoupPropertiesField } from './generated/schemas/soupCalendarEventSoupPropertiesField';@@ -270,11 +271,18 @@ async function isLegacyProjectionValidationError(export async function dssGraphqlFetch(input: RequestInfo | URL,- init?: RequestInit+ init?: RequestInit,+ queueOwner?: CacheHost): Promise<Response> {+ const retiredQueue =+ queueOwner?.disabled ||+ (cachedCacheHost !== undefined && cachedCacheHost !== queueOwner);// Even an in-flight cached client can fall back after queue initialization// fails. Check at transport time so it cannot overtake preserved mutations.- if (graphqlDraftQueueBlocked() && typeof init?.body === 'string') {+ if (+ (retiredQueue || graphqlDraftQueueBlocked()) &&+ typeof init?.body === 'string'+ ) {const payload = JSON.parse(init.body) as {query?: string;operationName?: string;@@ -293,8 +301,13 @@ export async function dssGraphqlFetch(selection.name.value))- )+ ) {+ if (retiredQueue)+ throw new Error(+ 'Draft sync client was replaced. Retry using the recovered queue.'+ );assertEmailDraftQueueAvailable();+ }}}return Telemetry.span('graphql.transport', async (span) => {@@ -456,6 +469,34 @@ function getUncachedRealtimeClient(): Client {}let cacheInitializationFailed = false;+const cacheRecovery = createCacheRecovery(() =>+ Telemetry.span('graphql.cache_recovery', async (span) => {+ const session = cacheSessionGeneration;+ cachedClient = undefined;+ getGraphqlSoupClient();+ const host = cachedCacheHost;+ if (!host || host.disabled)+ throw new Error('Local cache could not restart.');+ await host.currentRevision();+ span.event('engine_ready');+ // Opening the engine is insufficient: inspect the preserved queue before+ // making draft writes available again.+ await host.inspectMutations?.();+ span.event('queue_readable');+ if (+ session !== cacheSessionGeneration ||+ host !== cachedCacheHost ||+ host.disabled+ )+ throw new Error('Cache recovery was superseded.');+ cacheInitializationFailed = false;+ setCacheAvailability((version) => version + 1);+ })+);+let cacheSessionGeneration = 0;++export const graphqlCacheRecoveryState = cacheRecovery.state;+export const retryGraphqlCacheInitialization = cacheRecovery.retry;// Changes when the session abandons its cache so reactive readers of the// availability getters below (query options, effects) move to network paths.const [cacheAvailability, setCacheAvailability] = createSignal(0);@@ -486,6 +527,9 @@ export function setGraphqlSoupSessionActive(active: boolean): void {}function disposeSessionClients(): void {+ cacheSessionGeneration += 1;+ cacheRecovery.reset();+ cacheInitializationFailed = false;const cleanup = cachedCacheCleanup;cachedCacheCleanup = undefined;cachedCacheHost = undefined;@@ -530,12 +574,12 @@ export function graphqlDraftQueueBlocked(): boolean {export function assertEmailDraftQueueAvailable(): void {if (graphqlDraftQueueBlocked()) {throw new Error(- 'Draft sync is unavailable while queued changes are preserved. Reload or update Macro to resume the queue before saving or discarding.'+ 'Draft sync is unavailable while queued changes are preserved. Retry draft synchronization to resume the queue. If recovery requires an update, update Macro before saving or discarding.');}}-function fallbackAfterInitializationFailure(): void {+function fallbackAfterInitializationFailure(error: unknown): void {const cleanup = cachedCacheCleanup;cachedCacheCleanup = undefined;cachedCacheHost = undefined;@@ -549,6 +593,7 @@ function fallbackAfterInitializationFailure(): void {} catch {// Initialization-failure cleanup cannot alter GraphQL transport fallback.}+ cacheRecovery.failed(error);setCacheAvailability((version) => version + 1);}@@ -565,7 +610,7 @@ export function getGraphqlCacheHost(): CacheHost | undefined {* engine by the identity witness on `QueryRoot.user.id` (a response for a* different user wipes and rebinds the cache). See @graphql-cache/scope.* Failures fall back to uncached reads. Draft mutations remain blocked until- * a reload or native update can resume the preserved queue.+ * recovery has reopened and inspected the preserved queue.*/export function getGraphqlSoupClient(): Client {if (!sessionActive()) return graphqlSoupClient;@@ -633,17 +678,17 @@ export function getGraphqlSoupClient(): Client {const onInitializationError = (error: Error) => {if (!host || cachedCacheHost !== host) return;// Another context holds the database: a tab on another deployed build,- // or a closing tab whose worker still has the files open. This page- // simply runs uncached until it reloads.+ // or a closing tab whose worker still has the files open. Retry later+ // without stealing the lock or changing the cache scope.if (isOwnerLockUnavailableError(error)) {- fallbackAfterInitializationFailure();+ fallbackAfterInitializationFailure(error);console.info(- `[graphql-cache] ${error.message}; using the network until reload`+ `[graphql-cache] ${error.message}; using the network while waiting to retry`);return;}reportCacheError(error, 'initialization');- fallbackAfterInitializationFailure();+ fallbackAfterInitializationFailure(error);toast.failure(error instanceof NativeCacheUpgradeRequiredError? 'Macro update required'@@ -652,7 +697,9 @@ export function getGraphqlSoupClient(): Client {subtext:error instanceof NativeCacheUpgradeRequiredError? error.message- : 'Macro will continue without local caching for this session.',+ : cacheRecovery.state() === 'unavailable'+ ? 'Drafts remain on this device. Reconnect or retry draft synchronization.'+ : 'Queued changes are preserved. Update or reload Macro to recover local storage.',});console.warn(@@ -714,10 +761,12 @@ export function getGraphqlSoupClient(): Client {graphqlSoupSubscriptionExchange(graphqlWsClient),fetchExchange,],- fetch: dssGraphqlFetch,+ fetch: (input, init) => dssGraphqlFetch(input, init, host),});cachedCacheHost = host;- cacheInitializationFailed = false;+ // A replacement stays blocked until its persisted queue is readable.+ if (cacheRecovery.state() !== 'recovering')+ cacheInitializationFailed = false;unregisterHost = registerCacheHost(host);subscriptionsLifecycle.replace(client, host);cachedCacheCleanup = cleanup;@@ -729,6 +778,7 @@ export function getGraphqlSoupClient(): Client {cachedCacheHost = undefined;cachedCacheCleanup = undefined;cacheInitializationFailed = true;+ cacheRecovery.failed(error);setCacheAvailability((version) => version + 1);console.warn('graphql cache init failed; using uncached client', error);return isFeatureEnabled(enableGraphqlSoup)diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/email-send.graphql b/apps/web/src/lib/service-clients/service-storage/graphql/email-send.graphqlindex 8ae1d98076..c687d662e4 100644--- a/apps/web/src/lib/service-clients/service-storage/graphql/email-send.graphql+++ b/apps/web/src/lib/service-clients/service-storage/graphql/email-send.graphql@@ -1,8 +1,41 @@-mutation SendEmailMessage($input: SendEmailMessageInput!) {- sendEmailMessage(input: $input) {- messageId- threadId- linkId- sendTime+fragment EmailSendAttemptFields on EmailSendAttemptPayload {+ attemptId+ status+ sendTime+ threadId+ message { ...EmailThreadMessageFields }+}++mutation SendEmailMessage($input: SendEmailAttemptInput!) {+ sendEmailMessage: sendEmailAttempt(input: $input) {+ attempt { ...EmailSendAttemptFields }+ thread { ...EmailDraftThreadFields }+ }+}++mutation CancelEmailSend($input: EmailSendAttemptInput!) {+ cancelEmailSend(input: $input) {+ attempt { ...EmailSendAttemptFields }+ thread { ...EmailDraftThreadFields }+ }+}++query EmailSendAttempt($input: EmailSendAttemptInput!) {+ user {+ id+ emailSendAttempt(input: $input) { ...EmailSendAttemptFields }+ }+}++query PendingEmailSends($after: String) {+ user {+ id+ pendingEmailSends(after: $after) {+ attempts {+ linkId+ attempt { ...EmailSendAttemptFields }+ }+ nextCursor+ }}}diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/email-thread.graphql b/apps/web/src/lib/service-clients/service-storage/graphql/email-thread.graphqlindex 34caa8c91d..1b04dbe7a9 100644--- a/apps/web/src/lib/service-clients/service-storage/graphql/email-thread.graphql+++ b/apps/web/src/lib/service-clients/service-storage/graphql/email-thread.graphql@@ -42,6 +42,7 @@ fragment EmailThreadPageFields on GraphqlSoupEmailThread {}fragment EmailThreadMessageFields on GraphqlSoupEmailMessage {+ draftGenerationoperationStatus { state revision remoteVersion issue }__typenameid@@ -59,6 +60,7 @@ fragment EmailThreadMessageFields on GraphqlSoupEmailMessage {isDrafthasAttachmentsscheduledSendTime+ scheduledSendStatusfrom {namediff --git a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.tsindex 395a0482a7..778c2ad7c5 100644--- a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts+++ b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts@@ -212,6 +212,8 @@ export type DeleteCalendarEventInput = {/** Input for deleting an email draft. */export type DeleteEmailDraftInput = {+ /** Generation from the last loaded draft. */+ draftGeneration?: number | null | undefined;/*** Draft handle to delete: a client-generated ID or a server ID, resolved* like a save's. A handle that is already gone (or was never bound — a@@ -282,6 +284,29 @@ export type EmailMessageOperationState =/** A write may have succeeded and needs reconciliation. */| 'UNCERTAIN';+/** Identifies one send action independently of its server message identity. */+export type EmailSendAttemptInput = {+ /** Stable UUID generated for the explicit Send action. */+ attemptId: string | number;+ /** Sending inbox captured at Send, never inferred during replay. */+ linkId: string | number;+};++/** Authoritative delivery state; acceptance is not proof of provider delivery. */+export type EmailSendStatus =+ /** Durably accepted; preparation may be retried and cancellation remains safe. */+ | 'ACCEPTED'+ /** This attempt cannot deliver. */+ | 'CANCELLED'+ /** Delivery may have occurred and is being reconciled without resending. */+ | 'DELIVERY_UNCONFIRMED'+ /** Delivery failed before acceptance; cancellation can restore the draft. */+ | 'FAILED'+ /** Submission began, or a legacy claim has an unknown outcome; cancellation is unsafe. */+ | 'SENDING'+ /** Provider delivery was recorded. */+ | 'SENT';+/** One property's option delta within an options update. */export type EntityPropertyOptionDeltaInput = {/** Options to add to the currently stored value. */@@ -1574,6 +1599,17 @@ export type GraphqlReminderLiteral =| { completed?: never; entity?: never; fired?: never; id?: never; /** Opt the query into reminders. */include: boolean; };+/** The persisted state of a scheduled delivery. */+export type GraphqlScheduledSendStatus =+ /** Delivery was definitely rejected; the draft can be restored. */+ | 'FAILED'+ /** Waiting for its send time or safely retrying preparation. */+ | 'PENDING'+ /** Provider submission has started. */+ | 'SENDING'+ /** Delivery may have succeeded; reconciliation is required. */+ | 'UNCONFIRMED';+/** A typed value accepted when setting an entity property. */export type GraphqlSetPropertyValue ={ /** A Boolean value. */@@ -1893,6 +1929,8 @@ export type SaveEmailDraftInput = {bodyText?: string | null | undefined;/** Cc recipients. */cc?: Array<SaveEmailDraftContactInput> | null | undefined;+ /** Generation from the last loaded draft. Omitted by legacy clients. */+ draftGeneration?: number | null | undefined;/*** Draft handle: a client-generated ID, or a server ID from a fetched* draft. Resolved scoped to the caller's inboxes, and bound to the@@ -1927,15 +1965,26 @@ export type SaveEmailDraftInput = {to?: Array<SaveEmailDraftContactInput> | null | undefined;};-/**- * Online delivery command. The draft handle is required so a response lost- * after enqueue cannot turn a retry into a second, unrelated message.- */-export type SendEmailMessageInput = {- /** Complete latest draft revision, including inbox and sender address. */- draft: SaveEmailDraftInput;- /** Per-message override for the inbox's signature policy. */+/** Immutable content approved by the user. */+export type SendEmailAttemptInput = {+ /** Completed draft attachment IDs. */+ attachmentIds: Array<string | number>;+ /** Stable attempt and sending inbox. */+ attempt: EmailSendAttemptInput;+ /** Original attachment IDs for forwarded attachments. */+ forwardedAttachmentIds: Array<string | number>;+ /** Per-message signature preference. */includeSignature?: boolean | null | undefined;+ /** Full message snapshot; optional send time preserves Send Later across retries. */+ message: SaveEmailDraftInput;+ /** Editor HTML before the watermark, encoded like message HTML. */+ restoreBodyHtml?: string | null | undefined;+ /** Editor document before the watermark. */+ restoreBodyMacro?: string | null | undefined;+ /** Editor plain text before the watermark. */+ restoreBodyText?: string | null | undefined;+ /** Saved signature HTML captured at Send; empty means no signature. */+ signatureHtml?: string | null | undefined;};/** Input for archive-based Done and its inverse. No client label lookup is needed. */@@ -4264,12 +4313,12 @@ export type SaveEmailDraftMutationVariables = Exact<{}>;-export type SaveEmailDraftMutation = { saveEmailDraft: { draftId: string, draft: { __typename: 'GraphqlSoupEmailMessage', id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }, thread: { __typename: 'GraphqlSoupEmailThread', providerId: string | null, ownerId: string, inboxVisible: boolean, linkId: string, latestInboundMessageTs: string | null, latestOutboundMessageTs: string | null, latestNonSpamMessageTs: string | null, reminderReturnedAt: string | null, snippet: string | null, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null, isRead: boolean, isDraft: boolean, isImportant: boolean, isSignal: boolean, projectId: string | null, createdAt: string, updatedAt: string, viewedAt: string | null, cacheProjection: string | null, frecencyScore: number | null, id: string, entityType: GraphqlSoupEntityType, displayName: string | null, isFavorited: boolean, emailName: string | null, viewerPermission:+export type SaveEmailDraftMutation = { saveEmailDraft: { draftId: string, draft: { __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }, thread: { __typename: 'GraphqlSoupEmailThread', providerId: string | null, ownerId: string, inboxVisible: boolean, linkId: string, latestInboundMessageTs: string | null, latestOutboundMessageTs: string | null, latestNonSpamMessageTs: string | null, reminderReturnedAt: string | null, snippet: string | null, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null, isRead: boolean, isDraft: boolean, isImportant: boolean, isSignal: boolean, projectId: string | null, createdAt: string, updatedAt: string, viewedAt: string | null, cacheProjection: string | null, frecencyScore: number | null, id: string, entityType: GraphqlSoupEntityType, displayName: string | null, isFavorited: boolean, emailName: string | null, viewerPermission:| { __typename: 'GraphqlAccessLevelPermission', accessLevel: GraphqlEntityAccessLevel }| { __typename: 'GraphqlChannelRolePermission' }| { __typename: 'GraphqlChannelViewOnlyPermission' }| { __typename: 'GraphqlTeamRolePermission' }- | null, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:+ | null, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:| { __typename: 'GraphqlAgentSessionMentionedMetadata', agentSessionMentionedMentionedBy: string | null, agentSessionMentionedActionId: string, agentSessionMentionedSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionSettledMetadata', agentSessionSettledTurn: number, agentSessionSettledActor: string | null, agentSessionSettledStopReason: string, agentSessionSettledExcerpt: string | null, agentSessionSettledSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionWaitingForInputMetadata', agentSessionWaitingForInputTurn: number, agentSessionWaitingForInputQuestion: string, agentSessionWaitingForInputSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }@@ -4319,7 +4368,7 @@ export type EmailDraftThreadFieldsFragment = { __typename: 'GraphqlSoupEmailThre| { __typename: 'GraphqlChannelRolePermission' }| { __typename: 'GraphqlChannelViewOnlyPermission' }| { __typename: 'GraphqlTeamRolePermission' }- | null, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:+ | null, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:| { __typename: 'GraphqlAgentSessionMentionedMetadata', agentSessionMentionedMentionedBy: string | null, agentSessionMentionedActionId: string, agentSessionMentionedSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionSettledMetadata', agentSessionSettledTurn: number, agentSessionSettledActor: string | null, agentSessionSettledStopReason: string, agentSessionSettledExcerpt: string | null, agentSessionSettledSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionWaitingForInputMetadata', agentSessionWaitingForInputTurn: number, agentSessionWaitingForInputQuestion: string, agentSessionWaitingForInputSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }@@ -4370,7 +4419,7 @@ export type DeleteEmailDraftMutation = { deleteEmailDraft: { draftId: string, de| { __typename: 'GraphqlChannelRolePermission' }| { __typename: 'GraphqlChannelViewOnlyPermission' }| { __typename: 'GraphqlTeamRolePermission' }- | null, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:+ | null, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:| { __typename: 'GraphqlAgentSessionMentionedMetadata', agentSessionMentionedMentionedBy: string | null, agentSessionMentionedActionId: string, agentSessionMentionedSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionSettledMetadata', agentSessionSettledTurn: number, agentSessionSettledActor: string | null, agentSessionSettledStopReason: string, agentSessionSettledExcerpt: string | null, agentSessionSettledSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionWaitingForInputMetadata', agentSessionWaitingForInputTurn: number, agentSessionWaitingForInputQuestion: string, agentSessionWaitingForInputSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }@@ -4427,12 +4476,123 @@ export type MarkEmailThreadUnreadMutationVariables = Exact<{export type MarkEmailThreadUnreadMutation = { markEmailThreadUnread: { __typename: 'GraphqlSoupEmailThread', id: string, isRead: boolean } };+export type EmailSendAttemptFieldsFragment = { attemptId: string, status: EmailSendStatus, sendTime: string | null, threadId: string | null, message: { __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> } | null };+export type SendEmailMessageMutationVariables = Exact<{- input: SendEmailMessageInput;+ input: SendEmailAttemptInput;+}>;+++export type SendEmailMessageMutation = { sendEmailMessage: { attempt: { attemptId: string, status: EmailSendStatus, sendTime: string | null, threadId: string | null, message: { __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> } | null }, thread: { __typename: 'GraphqlSoupEmailThread', providerId: string | null, ownerId: string, inboxVisible: boolean, linkId: string, latestInboundMessageTs: string | null, latestOutboundMessageTs: string | null, latestNonSpamMessageTs: string | null, reminderReturnedAt: string | null, snippet: string | null, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null, isRead: boolean, isDraft: boolean, isImportant: boolean, isSignal: boolean, projectId: string | null, createdAt: string, updatedAt: string, viewedAt: string | null, cacheProjection: string | null, frecencyScore: number | null, id: string, entityType: GraphqlSoupEntityType, displayName: string | null, isFavorited: boolean, emailName: string | null, viewerPermission:+ | { __typename: 'GraphqlAccessLevelPermission', accessLevel: GraphqlEntityAccessLevel }+ | { __typename: 'GraphqlChannelRolePermission' }+ | { __typename: 'GraphqlChannelViewOnlyPermission' }+ | { __typename: 'GraphqlTeamRolePermission' }+ | null, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:+ | { __typename: 'GraphqlAgentSessionMentionedMetadata', agentSessionMentionedMentionedBy: string | null, agentSessionMentionedActionId: string, agentSessionMentionedSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }+ | { __typename: 'GraphqlAgentSessionSettledMetadata', agentSessionSettledTurn: number, agentSessionSettledActor: string | null, agentSessionSettledStopReason: string, agentSessionSettledExcerpt: string | null, agentSessionSettledSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }+ | { __typename: 'GraphqlAgentSessionWaitingForInputMetadata', agentSessionWaitingForInputTurn: number, agentSessionWaitingForInputQuestion: string, agentSessionWaitingForInputSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }+ | { __typename: 'GraphqlAiResponseMetadata', aiResponseSummary: string, aiResponseMessageId: string }+ | { __typename: 'GraphqlCalendarEventReminderMetadata', calendarEventReminderEventId: string, calendarEventReminderOccurrenceKey: string, calendarEventReminderTitle: string, calendarEventReminderStartsAt: string | null, calendarEventReminderEndsAt: string | null, calendarEventReminderStartDate: string | null, calendarEventReminderTimeZone: string | null, calendarEventReminderMinutesBefore: number }+ | { __typename: 'GraphqlCallStartedMetadata', callStartedChannelName: string | null, callStartedSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlChannelInviteMetadata', channelInviteInvitedBy: string, channelInviteChannelName: string, channelInviteMessageContent: string | null, channelInviteSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlChannelMentionMetadata', channelMentionHasAttachments: boolean, channelMentionSenderDisplayName: string | null, channelMentionChannelName: string, channelMentionSenderProfilePictureUrl: string | null, channelMentionMessageId: string, channelMentionMessageContent: string, channelMentionThreadId: string | null, channelMentionChannelType: GraphqlNotificationChannelType }+ | { __typename: 'GraphqlChannelMessageReactionMetadata', channelMessageReactionMessageId: string, channelMessageReactionThreadId: string | null, channelMessageReactionMessageContent: string, channelMessageReactionEmoji: string, channelMessageReactionChannelType: GraphqlNotificationChannelType, channelMessageReactionChannelName: string, channelMessageReactionSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlChannelMessageSendMetadata', channelMessageSendMessageContent: string, channelMessageSendHasAttachments: boolean, channelMessageSendSenderDisplayName: string | null, channelMessageSendChannelName: string, channelMessageSendSenderProfilePictureUrl: string | null, channelMessageSendSender: string | null, channelMessageSendMessageId: string, channelMessageSendChannelType: GraphqlNotificationChannelType }+ | { __typename: 'GraphqlChannelReplyMetadata', channelReplyHasAttachments: boolean, channelReplySenderDisplayName: string | null, channelReplyChannelName: string, channelReplySenderProfilePictureUrl: string | null, channelReplyThreadId: string, channelReplyMessageId: string, channelReplyUserId: string | null, channelReplyMessageContent: string, channelReplyThreadParentSenderId: string | null, channelReplyChannelType: GraphqlNotificationChannelType }+ | { __typename: 'GraphqlCommentedOnDocumentMetadata', commentedOnDocumentDocumentName: string, commentedOnDocumentOwner: string, commentedOnDocumentFileType: string | null, commentedOnDocumentSubType: GraphqlNotificationDocumentSubType | null, commentedOnDocumentCommentId: string, commentedOnDocumentThreadId: string, commentedOnDocumentText: string, commentedOnDocumentSenderProfilePictureUrl: string | null, commentedOnDocumentSenderDisplayName: string | null }+ | { __typename: 'GraphqlCrmDiscussionMetadata', crmDiscussionRecordName: string, crmDiscussionReason: GraphqlCrmDiscussionReason, crmDiscussionMessageId: string, crmDiscussionThreadId: string, crmDiscussionText: string, crmDiscussionSenderDisplayName: string | null, crmDiscussionSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlDocumentMentionMetadata', documentMentionDocumentName: string, documentMentionOwner: string, documentMentionFileType: string | null, documentMentionSubType: GraphqlNotificationDocumentSubType | null, documentMentionMessageId: string, documentMentionMessageContent: string, documentMentionHasAttachments: boolean, documentMentionThreadId: string | null, documentMentionSenderDisplayName: string | null, documentMentionChannelType: GraphqlNotificationChannelType, documentMentionChannelName: string, documentMentionSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlEntityAccessGrantedMetadata', entityAccessGrantedRequestId: string, entityAccessGrantedRevision: number, entityAccessGrantedEntityName: string, entityAccessGrantedFileType: string | null, entityAccessGrantedAccessLevel: string }+ | { __typename: 'GraphqlEntityAccessRequestedMetadata', entityAccessRequestedRequestId: string, entityAccessRequestedRevision: number, entityAccessRequestedEntityName: string, entityAccessRequestedFileType: string | null, entityAccessRequestedAccessLevel: string }+ | { __typename: 'GraphqlGithubPrCheckRunMetadata', githubPrCheckRunForeignEntityId: string, githubPrCheckRunGithubKey: string, githubPrCheckRunOwner: string, githubPrCheckRunRepo: string, githubPrCheckRunNumber: string, githubPrCheckRunUrl: string, githubPrCheckRunDisplayName: string, githubPrCheckRunTitle: string, githubPrCheckRunSenderGithubLogin: string | null, githubPrCheckRunSenderGithubUserId: string | null, githubPrCheckRunSenderGithubAvatarUrl: string | null, githubPrCheckRunCheckRunGithubId: string, githubPrCheckRunCheckName: string, githubPrCheckRunCheckStatus: string, githubPrCheckRunConclusion: string, githubPrCheckRunState: GraphqlGithubPrCheckRunState, githubPrCheckRunCheckUrl: string, githubPrCheckRunCompletedAt: string }+ | { __typename: 'GraphqlGithubPrCommentMetadata', githubPrCommentForeignEntityId: string, githubPrCommentGithubKey: string, githubPrCommentOwner: string, githubPrCommentRepo: string, githubPrCommentNumber: string, githubPrCommentUrl: string, githubPrCommentDisplayName: string, githubPrCommentTitle: string, githubPrCommentSenderGithubLogin: string | null, githubPrCommentSenderGithubUserId: string | null, githubPrCommentSenderGithubAvatarUrl: string | null, githubPrCommentCommentKind: GraphqlGithubPrCommentKind, githubPrCommentCommentGithubId: string | null, githubPrCommentCommentUrl: string | null, githubPrCommentCommentSnippet: string }+ | { __typename: 'GraphqlGithubPrMentionMetadata', githubPrMentionForeignEntityId: string, githubPrMentionGithubKey: string, githubPrMentionOwner: string, githubPrMentionRepo: string, githubPrMentionNumber: string, githubPrMentionUrl: string, githubPrMentionDisplayName: string, githubPrMentionTitle: string, githubPrMentionSenderGithubLogin: string | null, githubPrMentionSenderGithubUserId: string | null, githubPrMentionSenderGithubAvatarUrl: string | null, githubPrMentionLocation: GraphqlGithubPrMentionLocation, githubPrMentionCommentGithubId: string | null, githubPrMentionCommentUrl: string | null, githubPrMentionTextSnippet: string }+ | { __typename: 'GraphqlGithubPrReviewMetadata', githubPrReviewForeignEntityId: string, githubPrReviewGithubKey: string, githubPrReviewOwner: string, githubPrReviewRepo: string, githubPrReviewNumber: string, githubPrReviewUrl: string, githubPrReviewDisplayName: string, githubPrReviewTitle: string, githubPrReviewSenderGithubLogin: string | null, githubPrReviewSenderGithubUserId: string | null, githubPrReviewSenderGithubAvatarUrl: string | null, githubPrReviewReviewGithubId: string | null, githubPrReviewReviewUrl: string | null, githubPrReviewState: GraphqlGithubPrReviewState, githubPrReviewReviewSnippet: string | null }+ | { __typename: 'GraphqlGithubPrStatusChangedMetadata', githubPrStatusChangedForeignEntityId: string, githubPrStatusChangedGithubKey: string, githubPrStatusChangedOwner: string, githubPrStatusChangedRepo: string, githubPrStatusChangedNumber: string, githubPrStatusChangedUrl: string, githubPrStatusChangedDisplayName: string, githubPrStatusChangedTitle: string, githubPrStatusChangedSenderGithubLogin: string | null, githubPrStatusChangedSenderGithubUserId: string | null, githubPrStatusChangedSenderGithubAvatarUrl: string | null, githubPrStatusChangedStatus: GraphqlGithubPrEventStatus, githubPrStatusChangedAction: GraphqlGithubPrEventAction, githubPrStatusChangedPreviousStatus: GraphqlGithubPrEventStatus | null, githubPrStatusChangedHeadBranch: string | null, githubPrStatusChangedBaseBranch: string | null, githubPrStatusChangedMergedAt: string | null }+ | { __typename: 'GraphqlGithubReviewRequestedMetadata', githubReviewRequestedForeignEntityId: string, githubReviewRequestedGithubKey: string, githubReviewRequestedOwner: string, githubReviewRequestedRepo: string, githubReviewRequestedNumber: string, githubReviewRequestedUrl: string, githubReviewRequestedDisplayName: string, githubReviewRequestedTitle: string, githubReviewRequestedSenderGithubLogin: string | null, githubReviewRequestedSenderGithubUserId: string | null, githubReviewRequestedSenderGithubAvatarUrl: string | null, githubReviewRequestedRequestedReviewerGithubLogin: string | null, githubReviewRequestedRequestedReviewerGithubUserId: string | null }+ | { __typename: 'GraphqlInboxReauthRequiredMetadata', inboxReauthRequiredEmailAddress: string }+ | { __typename: 'GraphqlInitiativeDiscussionMetadata', initiativeDiscussionProjectName: string, initiativeDiscussionOwner: string, initiativeDiscussionReason: GraphqlInitiativeDiscussionReason, initiativeDiscussionMessageId: string, initiativeDiscussionThreadId: string, initiativeDiscussionText: string, initiativeDiscussionSenderDisplayName: string | null, initiativeDiscussionSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlInviteToTeamMetadata', inviteToTeamTeamName: string, inviteToTeamTeamId: string, inviteToTeamTeamInviteId: string, inviteToTeamInvitedBy: string, inviteToTeamRole: string | null, inviteToTeamSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlMentionedInDocumentCommentMetadata', mentionedInDocumentCommentDocumentName: string, mentionedInDocumentCommentOwner: string, mentionedInDocumentCommentFileType: string | null, mentionedInDocumentCommentSubType: GraphqlNotificationDocumentSubType | null, mentionedInDocumentCommentMentionId: string, mentionedInDocumentCommentCommentId: string, mentionedInDocumentCommentThreadId: string, mentionedInDocumentCommentText: string, mentionedInDocumentCommentSenderProfilePictureUrl: string | null, mentionedInDocumentCommentSenderDisplayName: string | null }+ | { __typename: 'GraphqlNewEmailMetadata', newEmailSender: string | null, newEmailToEmail: string, newEmailThreadId: string, newEmailSubject: string, newEmailSnippet: string }+ | { __typename: 'GraphqlReminderMetadata', reminderReminderId: string, reminderDescription: string, reminderScheduledFor: string | null }+ | { __typename: 'GraphqlRepliedToDocumentCommentThreadMetadata', repliedToDocumentCommentThreadDocumentName: string, repliedToDocumentCommentThreadOwner: string, repliedToDocumentCommentThreadFileType: string | null, repliedToDocumentCommentThreadSubType: GraphqlNotificationDocumentSubType | null, repliedToDocumentCommentThreadCommentId: string, repliedToDocumentCommentThreadThreadId: string, repliedToDocumentCommentThreadText: string, repliedToDocumentCommentThreadSenderProfilePictureUrl: string | null, repliedToDocumentCommentThreadSenderDisplayName: string | null }+ | { __typename: 'GraphqlTaskAssignedMetadata', taskAssignedTaskId: string, taskAssignedTaskName: string | null, taskAssignedSubType: GraphqlNotificationDocumentSubType | null, taskAssignedAssignedBy: string, taskAssignedSenderProfilePictureUrl: string | null }+ }>, mailDraftState: { baseline: { messageCount: number, inboxVisible: boolean, isRead: boolean, isSignal: boolean, hasCalendarAttachment: boolean, latestInboundMessageTs: string | null, latestNonSpamMessageTs: string | null, latestOutboundMessageTs: string | null, previewTs: string | null, preview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null }, drafts: Array<{ id: string, macroDraft: boolean, facts: { messageCount: number, inboxVisible: boolean, isRead: boolean, isSignal: boolean, hasCalendarAttachment: boolean, latestInboundMessageTs: string | null, latestNonSpamMessageTs: string | null, latestOutboundMessageTs: string | null, previewTs: string | null, preview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null } }> } | null, mailAllPreview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null, mailDraftPreview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null, mailSentPreview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null, participants: Array<{ contactId: string, linkId: string, name: string | null, email: string | null, sfsPhotoUrl: string | null }>, attachments: Array<{ id: string, messageId: string, providerAttachmentId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, contentId: string | null, createdAt: string }>, labels: Array<{ __typename: 'GraphqlSoupEmailLabel', id: string, linkId: string, providerLabelId: string, name: string, createdAt: string, messageListVisibility: string, labelListVisibility: string, type: string }>, properties: Array<{ id: string, propertyDefinitionId: string, displayName: string, dataType: GraphqlPropertyDataType, isMultiSelect: boolean, specificEntityType: GraphqlPropertyEntityType | null, isSystem: boolean, isMetadata: boolean, value:+ | { __typename: 'GraphqlBooleanPropertyValue', boolValue: boolean }+ | { __typename: 'GraphqlDatePropertyValue', dateValue: string }+ | { __typename: 'GraphqlEntityReferencePropertyValue', references: Array<{ entityId: string, entityType: GraphqlPropertyEntityType, specificMessageId: string | null }> }+ | { __typename: 'GraphqlLinkPropertyValue', urls: Array<string> }+ | { __typename: 'GraphqlNumberPropertyValue', numberValue: number }+ | { __typename: 'GraphqlSelectOptionPropertyValue', optionIds: Array<string> }+ | { __typename: 'GraphqlStringPropertyValue', stringValue: string }+ | null }> } | null } };++export type CancelEmailSendMutationVariables = Exact<{+ input: EmailSendAttemptInput;+}>;+++export type CancelEmailSendMutation = { cancelEmailSend: { attempt: { attemptId: string, status: EmailSendStatus, sendTime: string | null, threadId: string | null, message: { __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> } | null }, thread: { __typename: 'GraphqlSoupEmailThread', providerId: string | null, ownerId: string, inboxVisible: boolean, linkId: string, latestInboundMessageTs: string | null, latestOutboundMessageTs: string | null, latestNonSpamMessageTs: string | null, reminderReturnedAt: string | null, snippet: string | null, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null, isRead: boolean, isDraft: boolean, isImportant: boolean, isSignal: boolean, projectId: string | null, createdAt: string, updatedAt: string, viewedAt: string | null, cacheProjection: string | null, frecencyScore: number | null, id: string, entityType: GraphqlSoupEntityType, displayName: string | null, isFavorited: boolean, emailName: string | null, viewerPermission:+ | { __typename: 'GraphqlAccessLevelPermission', accessLevel: GraphqlEntityAccessLevel }+ | { __typename: 'GraphqlChannelRolePermission' }+ | { __typename: 'GraphqlChannelViewOnlyPermission' }+ | { __typename: 'GraphqlTeamRolePermission' }+ | null, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:+ | { __typename: 'GraphqlAgentSessionMentionedMetadata', agentSessionMentionedMentionedBy: string | null, agentSessionMentionedActionId: string, agentSessionMentionedSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }+ | { __typename: 'GraphqlAgentSessionSettledMetadata', agentSessionSettledTurn: number, agentSessionSettledActor: string | null, agentSessionSettledStopReason: string, agentSessionSettledExcerpt: string | null, agentSessionSettledSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }+ | { __typename: 'GraphqlAgentSessionWaitingForInputMetadata', agentSessionWaitingForInputTurn: number, agentSessionWaitingForInputQuestion: string, agentSessionWaitingForInputSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }+ | { __typename: 'GraphqlAiResponseMetadata', aiResponseSummary: string, aiResponseMessageId: string }+ | { __typename: 'GraphqlCalendarEventReminderMetadata', calendarEventReminderEventId: string, calendarEventReminderOccurrenceKey: string, calendarEventReminderTitle: string, calendarEventReminderStartsAt: string | null, calendarEventReminderEndsAt: string | null, calendarEventReminderStartDate: string | null, calendarEventReminderTimeZone: string | null, calendarEventReminderMinutesBefore: number }+ | { __typename: 'GraphqlCallStartedMetadata', callStartedChannelName: string | null, callStartedSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlChannelInviteMetadata', channelInviteInvitedBy: string, channelInviteChannelName: string, channelInviteMessageContent: string | null, channelInviteSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlChannelMentionMetadata', channelMentionHasAttachments: boolean, channelMentionSenderDisplayName: string | null, channelMentionChannelName: string, channelMentionSenderProfilePictureUrl: string | null, channelMentionMessageId: string, channelMentionMessageContent: string, channelMentionThreadId: string | null, channelMentionChannelType: GraphqlNotificationChannelType }+ | { __typename: 'GraphqlChannelMessageReactionMetadata', channelMessageReactionMessageId: string, channelMessageReactionThreadId: string | null, channelMessageReactionMessageContent: string, channelMessageReactionEmoji: string, channelMessageReactionChannelType: GraphqlNotificationChannelType, channelMessageReactionChannelName: string, channelMessageReactionSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlChannelMessageSendMetadata', channelMessageSendMessageContent: string, channelMessageSendHasAttachments: boolean, channelMessageSendSenderDisplayName: string | null, channelMessageSendChannelName: string, channelMessageSendSenderProfilePictureUrl: string | null, channelMessageSendSender: string | null, channelMessageSendMessageId: string, channelMessageSendChannelType: GraphqlNotificationChannelType }+ | { __typename: 'GraphqlChannelReplyMetadata', channelReplyHasAttachments: boolean, channelReplySenderDisplayName: string | null, channelReplyChannelName: string, channelReplySenderProfilePictureUrl: string | null, channelReplyThreadId: string, channelReplyMessageId: string, channelReplyUserId: string | null, channelReplyMessageContent: string, channelReplyThreadParentSenderId: string | null, channelReplyChannelType: GraphqlNotificationChannelType }+ | { __typename: 'GraphqlCommentedOnDocumentMetadata', commentedOnDocumentDocumentName: string, commentedOnDocumentOwner: string, commentedOnDocumentFileType: string | null, commentedOnDocumentSubType: GraphqlNotificationDocumentSubType | null, commentedOnDocumentCommentId: string, commentedOnDocumentThreadId: string, commentedOnDocumentText: string, commentedOnDocumentSenderProfilePictureUrl: string | null, commentedOnDocumentSenderDisplayName: string | null }+ | { __typename: 'GraphqlCrmDiscussionMetadata', crmDiscussionRecordName: string, crmDiscussionReason: GraphqlCrmDiscussionReason, crmDiscussionMessageId: string, crmDiscussionThreadId: string, crmDiscussionText: string, crmDiscussionSenderDisplayName: string | null, crmDiscussionSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlDocumentMentionMetadata', documentMentionDocumentName: string, documentMentionOwner: string, documentMentionFileType: string | null, documentMentionSubType: GraphqlNotificationDocumentSubType | null, documentMentionMessageId: string, documentMentionMessageContent: string, documentMentionHasAttachments: boolean, documentMentionThreadId: string | null, documentMentionSenderDisplayName: string | null, documentMentionChannelType: GraphqlNotificationChannelType, documentMentionChannelName: string, documentMentionSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlEntityAccessGrantedMetadata', entityAccessGrantedRequestId: string, entityAccessGrantedRevision: number, entityAccessGrantedEntityName: string, entityAccessGrantedFileType: string | null, entityAccessGrantedAccessLevel: string }+ | { __typename: 'GraphqlEntityAccessRequestedMetadata', entityAccessRequestedRequestId: string, entityAccessRequestedRevision: number, entityAccessRequestedEntityName: string, entityAccessRequestedFileType: string | null, entityAccessRequestedAccessLevel: string }+ | { __typename: 'GraphqlGithubPrCheckRunMetadata', githubPrCheckRunForeignEntityId: string, githubPrCheckRunGithubKey: string, githubPrCheckRunOwner: string, githubPrCheckRunRepo: string, githubPrCheckRunNumber: string, githubPrCheckRunUrl: string, githubPrCheckRunDisplayName: string, githubPrCheckRunTitle: string, githubPrCheckRunSenderGithubLogin: string | null, githubPrCheckRunSenderGithubUserId: string | null, githubPrCheckRunSenderGithubAvatarUrl: string | null, githubPrCheckRunCheckRunGithubId: string, githubPrCheckRunCheckName: string, githubPrCheckRunCheckStatus: string, githubPrCheckRunConclusion: string, githubPrCheckRunState: GraphqlGithubPrCheckRunState, githubPrCheckRunCheckUrl: string, githubPrCheckRunCompletedAt: string }+ | { __typename: 'GraphqlGithubPrCommentMetadata', githubPrCommentForeignEntityId: string, githubPrCommentGithubKey: string, githubPrCommentOwner: string, githubPrCommentRepo: string, githubPrCommentNumber: string, githubPrCommentUrl: string, githubPrCommentDisplayName: string, githubPrCommentTitle: string, githubPrCommentSenderGithubLogin: string | null, githubPrCommentSenderGithubUserId: string | null, githubPrCommentSenderGithubAvatarUrl: string | null, githubPrCommentCommentKind: GraphqlGithubPrCommentKind, githubPrCommentCommentGithubId: string | null, githubPrCommentCommentUrl: string | null, githubPrCommentCommentSnippet: string }+ | { __typename: 'GraphqlGithubPrMentionMetadata', githubPrMentionForeignEntityId: string, githubPrMentionGithubKey: string, githubPrMentionOwner: string, githubPrMentionRepo: string, githubPrMentionNumber: string, githubPrMentionUrl: string, githubPrMentionDisplayName: string, githubPrMentionTitle: string, githubPrMentionSenderGithubLogin: string | null, githubPrMentionSenderGithubUserId: string | null, githubPrMentionSenderGithubAvatarUrl: string | null, githubPrMentionLocation: GraphqlGithubPrMentionLocation, githubPrMentionCommentGithubId: string | null, githubPrMentionCommentUrl: string | null, githubPrMentionTextSnippet: string }+ | { __typename: 'GraphqlGithubPrReviewMetadata', githubPrReviewForeignEntityId: string, githubPrReviewGithubKey: string, githubPrReviewOwner: string, githubPrReviewRepo: string, githubPrReviewNumber: string, githubPrReviewUrl: string, githubPrReviewDisplayName: string, githubPrReviewTitle: string, githubPrReviewSenderGithubLogin: string | null, githubPrReviewSenderGithubUserId: string | null, githubPrReviewSenderGithubAvatarUrl: string | null, githubPrReviewReviewGithubId: string | null, githubPrReviewReviewUrl: string | null, githubPrReviewState: GraphqlGithubPrReviewState, githubPrReviewReviewSnippet: string | null }+ | { __typename: 'GraphqlGithubPrStatusChangedMetadata', githubPrStatusChangedForeignEntityId: string, githubPrStatusChangedGithubKey: string, githubPrStatusChangedOwner: string, githubPrStatusChangedRepo: string, githubPrStatusChangedNumber: string, githubPrStatusChangedUrl: string, githubPrStatusChangedDisplayName: string, githubPrStatusChangedTitle: string, githubPrStatusChangedSenderGithubLogin: string | null, githubPrStatusChangedSenderGithubUserId: string | null, githubPrStatusChangedSenderGithubAvatarUrl: string | null, githubPrStatusChangedStatus: GraphqlGithubPrEventStatus, githubPrStatusChangedAction: GraphqlGithubPrEventAction, githubPrStatusChangedPreviousStatus: GraphqlGithubPrEventStatus | null, githubPrStatusChangedHeadBranch: string | null, githubPrStatusChangedBaseBranch: string | null, githubPrStatusChangedMergedAt: string | null }+ | { __typename: 'GraphqlGithubReviewRequestedMetadata', githubReviewRequestedForeignEntityId: string, githubReviewRequestedGithubKey: string, githubReviewRequestedOwner: string, githubReviewRequestedRepo: string, githubReviewRequestedNumber: string, githubReviewRequestedUrl: string, githubReviewRequestedDisplayName: string, githubReviewRequestedTitle: string, githubReviewRequestedSenderGithubLogin: string | null, githubReviewRequestedSenderGithubUserId: string | null, githubReviewRequestedSenderGithubAvatarUrl: string | null, githubReviewRequestedRequestedReviewerGithubLogin: string | null, githubReviewRequestedRequestedReviewerGithubUserId: string | null }+ | { __typename: 'GraphqlInboxReauthRequiredMetadata', inboxReauthRequiredEmailAddress: string }+ | { __typename: 'GraphqlInitiativeDiscussionMetadata', initiativeDiscussionProjectName: string, initiativeDiscussionOwner: string, initiativeDiscussionReason: GraphqlInitiativeDiscussionReason, initiativeDiscussionMessageId: string, initiativeDiscussionThreadId: string, initiativeDiscussionText: string, initiativeDiscussionSenderDisplayName: string | null, initiativeDiscussionSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlInviteToTeamMetadata', inviteToTeamTeamName: string, inviteToTeamTeamId: string, inviteToTeamTeamInviteId: string, inviteToTeamInvitedBy: string, inviteToTeamRole: string | null, inviteToTeamSenderProfilePictureUrl: string | null }+ | { __typename: 'GraphqlMentionedInDocumentCommentMetadata', mentionedInDocumentCommentDocumentName: string, mentionedInDocumentCommentOwner: string, mentionedInDocumentCommentFileType: string | null, mentionedInDocumentCommentSubType: GraphqlNotificationDocumentSubType | null, mentionedInDocumentCommentMentionId: string, mentionedInDocumentCommentCommentId: string, mentionedInDocumentCommentThreadId: string, mentionedInDocumentCommentText: string, mentionedInDocumentCommentSenderProfilePictureUrl: string | null, mentionedInDocumentCommentSenderDisplayName: string | null }+ | { __typename: 'GraphqlNewEmailMetadata', newEmailSender: string | null, newEmailToEmail: string, newEmailThreadId: string, newEmailSubject: string, newEmailSnippet: string }+ | { __typename: 'GraphqlReminderMetadata', reminderReminderId: string, reminderDescription: string, reminderScheduledFor: string | null }+ | { __typename: 'GraphqlRepliedToDocumentCommentThreadMetadata', repliedToDocumentCommentThreadDocumentName: string, repliedToDocumentCommentThreadOwner: string, repliedToDocumentCommentThreadFileType: string | null, repliedToDocumentCommentThreadSubType: GraphqlNotificationDocumentSubType | null, repliedToDocumentCommentThreadCommentId: string, repliedToDocumentCommentThreadThreadId: string, repliedToDocumentCommentThreadText: string, repliedToDocumentCommentThreadSenderProfilePictureUrl: string | null, repliedToDocumentCommentThreadSenderDisplayName: string | null }+ | { __typename: 'GraphqlTaskAssignedMetadata', taskAssignedTaskId: string, taskAssignedTaskName: string | null, taskAssignedSubType: GraphqlNotificationDocumentSubType | null, taskAssignedAssignedBy: string, taskAssignedSenderProfilePictureUrl: string | null }+ }>, mailDraftState: { baseline: { messageCount: number, inboxVisible: boolean, isRead: boolean, isSignal: boolean, hasCalendarAttachment: boolean, latestInboundMessageTs: string | null, latestNonSpamMessageTs: string | null, latestOutboundMessageTs: string | null, previewTs: string | null, preview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null }, drafts: Array<{ id: string, macroDraft: boolean, facts: { messageCount: number, inboxVisible: boolean, isRead: boolean, isSignal: boolean, hasCalendarAttachment: boolean, latestInboundMessageTs: string | null, latestNonSpamMessageTs: string | null, latestOutboundMessageTs: string | null, previewTs: string | null, preview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null } }> } | null, mailAllPreview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null, mailDraftPreview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null, mailSentPreview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null, participants: Array<{ contactId: string, linkId: string, name: string | null, email: string | null, sfsPhotoUrl: string | null }>, attachments: Array<{ id: string, messageId: string, providerAttachmentId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, contentId: string | null, createdAt: string }>, labels: Array<{ __typename: 'GraphqlSoupEmailLabel', id: string, linkId: string, providerLabelId: string, name: string, createdAt: string, messageListVisibility: string, labelListVisibility: string, type: string }>, properties: Array<{ id: string, propertyDefinitionId: string, displayName: string, dataType: GraphqlPropertyDataType, isMultiSelect: boolean, specificEntityType: GraphqlPropertyEntityType | null, isSystem: boolean, isMetadata: boolean, value:+ | { __typename: 'GraphqlBooleanPropertyValue', boolValue: boolean }+ | { __typename: 'GraphqlDatePropertyValue', dateValue: string }+ | { __typename: 'GraphqlEntityReferencePropertyValue', references: Array<{ entityId: string, entityType: GraphqlPropertyEntityType, specificMessageId: string | null }> }+ | { __typename: 'GraphqlLinkPropertyValue', urls: Array<string> }+ | { __typename: 'GraphqlNumberPropertyValue', numberValue: number }+ | { __typename: 'GraphqlSelectOptionPropertyValue', optionIds: Array<string> }+ | { __typename: 'GraphqlStringPropertyValue', stringValue: string }+ | null }> } | null } };++export type EmailSendAttemptQueryVariables = Exact<{+ input: EmailSendAttemptInput;+}>;+++export type EmailSendAttemptQuery = { user: { id: string, emailSendAttempt: { attemptId: string, status: EmailSendStatus, sendTime: string | null, threadId: string | null, message: { __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> } | null } | null } };++export type PendingEmailSendsQueryVariables = Exact<{+ after?: string | null | undefined;}>;-export type SendEmailMessageMutation = { sendEmailMessage: { messageId: string, threadId: string, linkId: string, sendTime: string | null } };+export type PendingEmailSendsQuery = { user: { id: string, pendingEmailSends: { nextCursor: string | null, attempts: Array<{ linkId: string, attempt: { attemptId: string, status: EmailSendStatus, sendTime: string | null, threadId: string | null, message: { __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> } | null } }> } } };export type EmailThreadPageQueryVariables = Exact<{threadId: string | number;@@ -4446,7 +4606,7 @@ export type EmailThreadPageQuery = { user: { id: string, emailThread: { __typena| { __typename: 'GraphqlChannelRolePermission' }| { __typename: 'GraphqlChannelViewOnlyPermission' }| { __typename: 'GraphqlTeamRolePermission' }- | null, labels: Array<{ __typename: 'GraphqlSoupEmailLabel', id: string, linkId: string, providerLabelId: string, name: string, createdAt: string, messageListVisibility: string, labelListVisibility: string, type: string }>, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:+ | null, labels: Array<{ __typename: 'GraphqlSoupEmailLabel', id: string, linkId: string, providerLabelId: string, name: string, createdAt: string, messageListVisibility: string, labelListVisibility: string, type: string }>, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:| { __typename: 'GraphqlAgentSessionMentionedMetadata', agentSessionMentionedMentionedBy: string | null, agentSessionMentionedActionId: string, agentSessionMentionedSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionSettledMetadata', agentSessionSettledTurn: number, agentSessionSettledActor: string | null, agentSessionSettledStopReason: string, agentSessionSettledExcerpt: string | null, agentSessionSettledSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionWaitingForInputMetadata', agentSessionWaitingForInputTurn: number, agentSessionWaitingForInputQuestion: string, agentSessionWaitingForInputSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }@@ -4492,7 +4652,7 @@ export type EmailThreadPageFieldsFragment = { __typename: 'GraphqlSoupEmailThrea| { __typename: 'GraphqlChannelRolePermission' }| { __typename: 'GraphqlChannelViewOnlyPermission' }| { __typename: 'GraphqlTeamRolePermission' }- | null, labels: Array<{ __typename: 'GraphqlSoupEmailLabel', id: string, linkId: string, providerLabelId: string, name: string, createdAt: string, messageListVisibility: string, labelListVisibility: string, type: string }>, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:+ | null, labels: Array<{ __typename: 'GraphqlSoupEmailLabel', id: string, linkId: string, providerLabelId: string, name: string, createdAt: string, messageListVisibility: string, labelListVisibility: string, type: string }>, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:| { __typename: 'GraphqlAgentSessionMentionedMetadata', agentSessionMentionedMentionedBy: string | null, agentSessionMentionedActionId: string, agentSessionMentionedSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionSettledMetadata', agentSessionSettledTurn: number, agentSessionSettledActor: string | null, agentSessionSettledStopReason: string, agentSessionSettledExcerpt: string | null, agentSessionSettledSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionWaitingForInputMetadata', agentSessionWaitingForInputTurn: number, agentSessionWaitingForInputQuestion: string, agentSessionWaitingForInputSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }@@ -4533,7 +4693,7 @@ export type EmailThreadPageFieldsFragment = { __typename: 'GraphqlSoupEmailThrea| { __typename: 'GraphqlStringPropertyValue', stringValue: string }| null }> };-export type EmailThreadMessageFieldsFragment = { __typename: 'GraphqlSoupEmailMessage', id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> };+export type EmailThreadMessageFieldsFragment = { __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> };export type EmailThreadIdentityFieldsFragment = { id: string, cacheProjection: string | null };@@ -14006,7 +14166,7 @@ export type SoupBackfillQuery = { user: { id: string, emailLinks: Array<{ id: st| { __typename: 'GraphqlChannelRolePermission' }| { __typename: 'GraphqlChannelViewOnlyPermission' }| { __typename: 'GraphqlTeamRolePermission' }- | null, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:+ | null, messages: Array<{ __typename: 'GraphqlSoupEmailMessage', draftGeneration: number, id: string, providerId: string | null, threadId: string, replyingToId: string | null, linkId: string, subject: string | null, snippet: string | null, internalDateTs: string | null, sentAt: string | null, isRead: boolean, isStarred: boolean, isSent: boolean, isDraft: boolean, hasAttachments: boolean, scheduledSendTime: string | null, scheduledSendStatus: GraphqlScheduledSendStatus | null, bodyText: string | null, bodyHtmlSanitized: string | null, bodyMacro: string | null, calendarInvitations: unknown, bodyReplyless: string | null, createdAt: string, updatedAt: string, operationStatus: { state: EmailMessageOperationState, revision: string, remoteVersion: string | null, issue: EmailMessageOperationIssue | null } | null, from: { email: string, name: string | null, photoUrl: string | null } | null, to: Array<{ email: string, name: string | null, photoUrl: string | null }>, cc: Array<{ email: string, name: string | null, photoUrl: string | null }>, bcc: Array<{ email: string, name: string | null, photoUrl: string | null }>, labels: Array<{ providerLabelId: string, name: string }>, attachments: Array<{ __typename: 'GraphqlSoupEmailMessageAttachment', id: string, providerId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, sfsId: string | null, contentId: string | null, referenceUrl: string | null }>, attachmentsDraft: Array<{ __typename: 'GraphqlSoupEmailDraftAttachment', id: string, draftId: string, fileName: string, contentType: string, sha: string, size: number, s3Key: string, uploadPending: boolean, contentId: string | null, isInline: boolean }>, attachmentsForwarded: Array<{ __typename: 'GraphqlSoupEmailForwardedAttachment', attachmentId: string, draftId: string, providerAttachmentId: string | null, messageProviderId: string, filename: string | null, mimeType: string | null, sizeBytes: number | null }> }>, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:| { __typename: 'GraphqlAgentSessionMentionedMetadata', agentSessionMentionedMentionedBy: string | null, agentSessionMentionedActionId: string, agentSessionMentionedSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionSettledMetadata', agentSessionSettledTurn: number, agentSessionSettledActor: string | null, agentSessionSettledStopReason: string, agentSessionSettledExcerpt: string | null, agentSessionSettledSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }| { __typename: 'GraphqlAgentSessionWaitingForInputMetadata', agentSessionWaitingForInputTurn: number, agentSessionWaitingForInputQuestion: string, agentSessionWaitingForInputSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }@@ -19320,10 +19480,11 @@ export const DatabaseRowFieldsFragmentDoc = {"kind":"Document","definitions":[{"export const SoupNotificationMetadataFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}}]} as unknown as DocumentNode<SoupNotificationMetadataFieldsFragment, unknown>;export const SoupNotificationFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}}]} as unknown as DocumentNode<SoupNotificationFieldsFragment, unknown>;export const SoupItemFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}}]} as unknown as DocumentNode<SoupItemFieldsFragment, unknown>;-export const EmailThreadMessageFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<EmailThreadMessageFieldsFragment, unknown>;-export const EmailDraftThreadFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftThreadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<EmailDraftThreadFieldsFragment, unknown>;+export const EmailThreadMessageFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<EmailThreadMessageFieldsFragment, unknown>;+export const EmailDraftThreadFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftThreadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<EmailDraftThreadFieldsFragment, unknown>;export const EmailReadStateFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailReadStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}}]}}]} as unknown as DocumentNode<EmailReadStateFieldsFragment, unknown>;-export const EmailThreadPageFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadPageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"Variable","name":{"kind":"Name","value":"offset"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<EmailThreadPageFieldsFragment, unknown>;+export const EmailSendAttemptFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailSendAttemptFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"EmailSendAttemptPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attemptId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"sendTime"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"message"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<EmailSendAttemptFieldsFragment, unknown>;+export const EmailThreadPageFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadPageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"Variable","name":{"kind":"Name","value":"offset"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<EmailThreadPageFieldsFragment, unknown>;export const EmailThreadIdentityFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]}]}}]} as unknown as DocumentNode<EmailThreadIdentityFieldsFragment, unknown>;export const EmailQuickAccessFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailQuickAccessFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}}]}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}}]}}]} as unknown as DocumentNode<EmailQuickAccessFieldsFragment, unknown>;export const SoupPatchFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPatchFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SoupPatch"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SoupUpdated"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"item"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCacheDeletion"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"graphqlTypeName"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}}]} as unknown as DocumentNode<SoupPatchFieldsFragment, unknown>;@@ -19380,12 +19541,15 @@ export const TrashDatabaseDocument = {"kind":"Document","definitions":[{"kind":"export const DatabaseRowsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"DatabaseRows"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"DatabaseRowFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextCursor"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"DatabaseRowFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}}]}}]}}]} as unknown as DocumentNode<DatabaseRowsQuery, DatabaseRowsQueryVariables>;export const DeleteEntityPropertyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteEntityProperty"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"entityType"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyTargetEntityType"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"entityId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"entityPropertyId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteEntityProperty"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"entityType"},"value":{"kind":"Variable","name":{"kind":"Name","value":"entityType"}}},{"kind":"Argument","name":{"kind":"Name","value":"entityId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"entityId"}}},{"kind":"Argument","name":{"kind":"Name","value":"entityPropertyId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"entityPropertyId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"graphqlTypeName"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}}]}}]}}]} as unknown as DocumentNode<DeleteEntityPropertyMutation, DeleteEntityPropertyMutationVariables>;export const SetEmailThreadArchivedDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetEmailThreadArchived"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SetEmailThreadArchivedInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setEmailThreadArchived"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}}]}}]}}]} as unknown as DocumentNode<SetEmailThreadArchivedMutation, SetEmailThreadArchivedMutationVariables>;-export const SaveEmailDraftDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SaveEmailDraft"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SaveEmailDraftInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"saveEmailDraft"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"draft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"thread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftThreadFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftThreadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<SaveEmailDraftMutation, SaveEmailDraftMutationVariables>;-export const DeleteEmailDraftDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteEmailDraft"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DeleteEmailDraftInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteEmailDraft"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"deleted"}},{"kind":"Field","name":{"kind":"Name","value":"threadDeleted"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"thread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftThreadFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftThreadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<DeleteEmailDraftMutation, DeleteEmailDraftMutationVariables>;+export const SaveEmailDraftDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SaveEmailDraft"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SaveEmailDraftInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"saveEmailDraft"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"draft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"thread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftThreadFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftThreadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<SaveEmailDraftMutation, SaveEmailDraftMutationVariables>;+export const DeleteEmailDraftDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteEmailDraft"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DeleteEmailDraftInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteEmailDraft"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"deleted"}},{"kind":"Field","name":{"kind":"Name","value":"threadDeleted"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"thread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftThreadFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftThreadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<DeleteEmailDraftMutation, DeleteEmailDraftMutationVariables>;export const MarkEmailThreadSeenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MarkEmailThreadSeen"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"MarkEmailThreadSeenInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markEmailThreadSeen"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailReadStateFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailReadStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}}]}}]} as unknown as DocumentNode<MarkEmailThreadSeenMutation, MarkEmailThreadSeenMutationVariables>;export const MarkEmailThreadUnreadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MarkEmailThreadUnread"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"MarkEmailThreadUnreadInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markEmailThreadUnread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailReadStateFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailReadStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}}]}}]} as unknown as DocumentNode<MarkEmailThreadUnreadMutation, MarkEmailThreadUnreadMutationVariables>;-export const SendEmailMessageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SendEmailMessage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SendEmailMessageInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sendEmailMessage"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"sendTime"}}]}}]}}]} as unknown as DocumentNode<SendEmailMessageMutation, SendEmailMessageMutationVariables>;-export const EmailThreadPageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"EmailThreadPage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"offset"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailThread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadPageFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadPageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"Variable","name":{"kind":"Name","value":"offset"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<EmailThreadPageQuery, EmailThreadPageQueryVariables>;+export const SendEmailMessageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SendEmailMessage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SendEmailAttemptInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sendEmailMessage"},"name":{"kind":"Name","value":"sendEmailAttempt"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attempt"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailSendAttemptFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"thread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftThreadFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailSendAttemptFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"EmailSendAttemptPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attemptId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"sendTime"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"message"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftThreadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<SendEmailMessageMutation, SendEmailMessageMutationVariables>;+export const CancelEmailSendDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CancelEmailSend"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"EmailSendAttemptInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cancelEmailSend"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attempt"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailSendAttemptFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"thread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftThreadFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailSendAttemptFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"EmailSendAttemptPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attemptId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"sendTime"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"message"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftThreadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<CancelEmailSendMutation, CancelEmailSendMutationVariables>;+export const EmailSendAttemptDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"EmailSendAttempt"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"EmailSendAttemptInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailSendAttempt"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailSendAttemptFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailSendAttemptFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"EmailSendAttemptPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attemptId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"sendTime"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"message"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<EmailSendAttemptQuery, EmailSendAttemptQueryVariables>;+export const PendingEmailSendsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"PendingEmailSends"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"pendingEmailSends"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attempts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"attempt"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailSendAttemptFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextCursor"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailSendAttemptFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"EmailSendAttemptPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attemptId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"sendTime"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"message"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<PendingEmailSendsQuery, PendingEmailSendsQueryVariables>;+export const EmailThreadPageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"EmailThreadPage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"offset"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailThread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"threadId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"threadId"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadPageFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadPageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"Variable","name":{"kind":"Name","value":"offset"}}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<EmailThreadPageQuery, EmailThreadPageQueryVariables>;export const RenameEntitiesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RenameEntities"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RenameEntityInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"renameEntities"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"inputs"},"value":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EntityMutationPayloadFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPatchFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SoupPatch"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SoupUpdated"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"item"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCacheDeletion"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"graphqlTypeName"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EntityMutationResultFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityMutationResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMutationSuccess"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"effects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPatchFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMutationError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EntityMutationPayloadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"EntityMutationPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"results"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EntityMutationResultFields"}}]}}]}}]} as unknown as DocumentNode<RenameEntitiesMutation, RenameEntitiesMutationVariables>;export const MoveEntitiesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MoveEntities"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"MoveEntityInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"moveEntities"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"inputs"},"value":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EntityMutationPayloadFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPatchFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SoupPatch"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SoupUpdated"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"item"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCacheDeletion"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"graphqlTypeName"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EntityMutationResultFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityMutationResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMutationSuccess"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"effects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPatchFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMutationError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EntityMutationPayloadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"EntityMutationPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"results"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EntityMutationResultFields"}}]}}]}}]} as unknown as DocumentNode<MoveEntitiesMutation, MoveEntitiesMutationVariables>;export const UpdateEntitySharePoliciesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateEntitySharePolicies"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateEntitySharePolicyInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateEntitySharePolicies"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"inputs"},"value":{"kind":"Variable","name":{"kind":"Name","value":"inputs"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EntityMutationPayloadFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPatchFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SoupPatch"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SoupUpdated"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"item"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCacheDeletion"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"graphqlTypeName"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EntityMutationResultFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityMutationResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMutationSuccess"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"effects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPatchFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMutationError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EntityMutationPayloadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"EntityMutationPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"results"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EntityMutationResultFields"}}]}}]}}]} as unknown as DocumentNode<UpdateEntitySharePoliciesMutation, UpdateEntitySharePoliciesMutationVariables>;@@ -19419,7 +19583,7 @@ export const SetEntityPropertyDocument = {"kind":"Document","definitions":[{"kinexport const SoupMembershipDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SoupMembership"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]}}]} as unknown as DocumentNode<SoupMembershipQuery, SoupMembershipQueryVariables>;export const SoupUpdatesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"subscription","name":{"kind":"Name","value":"SoupUpdates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"soupUpdates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPatchFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPatchFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SoupPatch"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SoupUpdated"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"item"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCacheDeletion"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"graphqlTypeName"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}}]}}]}}]} as unknown as DocumentNode<SoupUpdatesSubscription, SoupUpdatesSubscriptionVariables>;export const SoupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Soup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailLinks"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailAccountFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextCursor"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailAccountFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEmailLink"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroId"}},{"kind":"Field","name":{"kind":"Name","value":"provider"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isPrimary"}},{"kind":"Field","name":{"kind":"Name","value":"needsReauth"}},{"kind":"Field","name":{"kind":"Name","value":"draftIsSignal"}},{"kind":"Field","name":{"kind":"Name","value":"settings"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"signature"}},{"kind":"Field","name":{"kind":"Name","value":"signatureOnRepliesForwards"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}}]} as unknown as DocumentNode<SoupQuery, SoupQueryVariables>;-export const SoupBackfillDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SoupBackfill"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"Field","name":{"kind":"Name","value":"emailLinks"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailAccountFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextCursor"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailAccountFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEmailLink"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroId"}},{"kind":"Field","name":{"kind":"Name","value":"provider"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isPrimary"}},{"kind":"Field","name":{"kind":"Name","value":"needsReauth"}},{"kind":"Field","name":{"kind":"Name","value":"draftIsSignal"}},{"kind":"Field","name":{"kind":"Name","value":"settings"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"signature"}},{"kind":"Field","name":{"kind":"Name","value":"signatureOnRepliesForwards"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<SoupBackfillQuery, SoupBackfillQueryVariables>;+export const SoupBackfillDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SoupBackfill"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"Field","name":{"kind":"Name","value":"emailLinks"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailAccountFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextCursor"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailAccountFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEmailLink"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroId"}},{"kind":"Field","name":{"kind":"Name","value":"provider"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isPrimary"}},{"kind":"Field","name":{"kind":"Name","value":"needsReauth"}},{"kind":"Field","name":{"kind":"Name","value":"draftIsSignal"}},{"kind":"Field","name":{"kind":"Name","value":"settings"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"signature"}},{"kind":"Field","name":{"kind":"Name","value":"signatureOnRepliesForwards"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<SoupBackfillQuery, SoupBackfillQueryVariables>;export const SoupMailBackfillDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SoupMailBackfill"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"Field","name":{"kind":"Name","value":"emailLinks"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailAccountFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextCursor"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailAccountFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEmailLink"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroId"}},{"kind":"Field","name":{"kind":"Name","value":"provider"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isPrimary"}},{"kind":"Field","name":{"kind":"Name","value":"needsReauth"}},{"kind":"Field","name":{"kind":"Name","value":"draftIsSignal"}},{"kind":"Field","name":{"kind":"Name","value":"settings"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"signature"}},{"kind":"Field","name":{"kind":"Name","value":"signatureOnRepliesForwards"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}}]} as unknown as DocumentNode<SoupMailBackfillQuery, SoupMailBackfillQueryVariables>;export const SoupSharedMailBackfillDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SoupSharedMailBackfill"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"Field","name":{"kind":"Name","value":"emailLinks"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailAccountFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"scopeIds"},"name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextCursor"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailAccountFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEmailLink"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroId"}},{"kind":"Field","name":{"kind":"Name","value":"provider"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isPrimary"}},{"kind":"Field","name":{"kind":"Name","value":"needsReauth"}},{"kind":"Field","name":{"kind":"Name","value":"draftIsSignal"}},{"kind":"Field","name":{"kind":"Name","value":"settings"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"signature"}},{"kind":"Field","name":{"kind":"Name","value":"signatureOnRepliesForwards"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}}]} as unknown as DocumentNode<SoupSharedMailBackfillQuery, SoupSharedMailBackfillQueryVariables>;export const MailAccountsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MailAccounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailLinks"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailAccountFields"}},{"kind":"Field","name":{"kind":"Name","value":"sendAs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailAccountFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEmailLink"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroId"}},{"kind":"Field","name":{"kind":"Name","value":"provider"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isPrimary"}},{"kind":"Field","name":{"kind":"Name","value":"needsReauth"}},{"kind":"Field","name":{"kind":"Name","value":"draftIsSignal"}},{"kind":"Field","name":{"kind":"Name","value":"settings"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"signature"}},{"kind":"Field","name":{"kind":"Name","value":"signatureOnRepliesForwards"}}]}}]}}]} as unknown as DocumentNode<MailAccountsQuery, MailAccountsQueryVariables>;diff --git a/apps/web/src/routes/use-sync-login-cookie.test.ts b/apps/web/src/routes/use-sync-login-cookie.test.tsindex 91b4889337..877075eee8 100644--- a/apps/web/src/routes/use-sync-login-cookie.test.ts+++ b/apps/web/src/routes/use-sync-login-cookie.test.ts@@ -1,6 +1,7 @@/** @vitest-environment jsdom */import { hasLoginCookie, syncLoginStorage } from '@core/util/cookies';import { ThrownResultError } from '@core/util/result';+import { setEmailOutboxSession } from '@queries/email/outbox-session';import { setGraphqlSoupSessionActive } from '@service-storage/graphql-soup';import { createRoot, createSignal } from 'solid-js';import { afterEach, beforeEach, expect, it, vi } from 'vitest';@@ -13,6 +14,9 @@ vi.mock('@queries/auth/user-info', () => ({vi.mock('@service-storage/graphql-soup', () => ({setGraphqlSoupSessionActive: vi.fn(),}));+vi.mock('@queries/email/outbox-session', () => ({+ setEmailOutboxSession: vi.fn(),+}));let dispose: (() => void) | undefined;beforeEach(() => {@@ -35,21 +39,24 @@ it('disables the cache and clears stale login hints on a 401 with retained identget isSuccess() {return error() === null;},- data: { authenticated: true },+ data: { authenticated: true, id: 'account' },});createRoot((cleanup) => {dispose = cleanup;useSyncLoginCookie();});expect(setGraphqlSoupSessionActive).toHaveBeenLastCalledWith(true);+ expect(setEmailOutboxSession).toHaveBeenLastCalledWith('account');setError(new ThrownResultError([{ code: 'UNAUTHORIZED', message: '' }]));expect(setGraphqlSoupSessionActive).toHaveBeenLastCalledWith(false);+ expect(setEmailOutboxSession).toHaveBeenLastCalledWith(undefined);expect(hasLoginCookie()).toBe(false);setError(null);expect(setGraphqlSoupSessionActive).toHaveBeenLastCalledWith(true);+ expect(setEmailOutboxSession).toHaveBeenLastCalledWith('account');expect(hasLoginCookie()).toBe(true);});@@ -68,6 +75,7 @@ it.each([null, 'NETWORK_ERROR', 'INTERNAL_SERVER_ERROR'])(useSyncLoginCookie();});expect(setGraphqlSoupSessionActive).not.toHaveBeenCalled();+ expect(setEmailOutboxSession).not.toHaveBeenCalled();expect(hasLoginCookie()).toBe(true);});@@ -83,5 +91,6 @@ it('keeps a successful signed-out response off the cache', () => {useSyncLoginCookie();});expect(setGraphqlSoupSessionActive).toHaveBeenCalledWith(false);+ expect(setEmailOutboxSession).toHaveBeenCalledWith(undefined);expect(hasLoginCookie()).toBe(false);});diff --git a/apps/web/src/routes/use-sync-login-cookie.ts b/apps/web/src/routes/use-sync-login-cookie.tsindex 90c206816e..2db0eaeff5 100644--- a/apps/web/src/routes/use-sync-login-cookie.ts+++ b/apps/web/src/routes/use-sync-login-cookie.ts@@ -5,6 +5,7 @@ import {} from '@core/util/cookies';import { thrownResultErrorHasCode } from '@core/util/result';import { useUserInfoQuery } from '@queries/auth/user-info';+import { setEmailOutboxSession } from '@queries/email/outbox-session';import { setGraphqlSoupSessionActive } from '@service-storage/graphql-soup';import { createEffect, on } from 'solid-js';@@ -19,14 +20,16 @@ export function useSyncLoginCookie() {if (thrownResultErrorHasCode(query.error, 'UNAUTHORIZED')) return false;// Loading and transient failures must preserve offline session state.if (!query.isSuccess) return undefined;- return query.data.authenticated ?? false;+ return query.data.authenticated ? query.data.id : false;},- (authenticated) => {- if (authenticated === undefined) return;+ (accountId) => {+ if (accountId === undefined) return;+ const authenticated = accountId !== false;const { value, ...options } = getLoginCookieOptions(authenticated);updateCookie('login', value, options);syncLoginStorage(authenticated);setGraphqlSoupSessionActive(authenticated);+ setEmailOutboxSession(accountId || undefined);}));diff --git a/apps/web/tauri/Cargo.lock b/apps/web/tauri/Cargo.lockindex db5a09680c..c915d6aab1 100644--- a/apps/web/tauri/Cargo.lock+++ b/apps/web/tauri/Cargo.lock@@ -5649,9 +5649,9 @@ dependencies = [[[package]]name = "rustls"-version = "0.23.45"+version = "0.23.46"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634"+checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"dependencies = ["aws-lc-rs","once_cell",@@ -5713,9 +5713,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"[[package]]name = "rustls-webpki"-version = "0.103.15"+version = "0.103.16"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"+checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"dependencies = ["aws-lc-rs","ring",@@ -8483,9 +8483,9 @@ dependencies = [[[package]]name = "webpki-root-certs"-version = "1.0.7"+version = "1.0.10"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f31141ce3fc3e300ae89b78c0dd67f9708061d1d2eda54b8209346fd6be9a92c"+checksum = "58ec80e73fd8baf57bf0d9615554c75348bda990d6d5bbeab964dd068319fecb"dependencies = ["rustls-pki-types",]@@ -8496,14 +8496,14 @@ version = "0.26.11"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"dependencies = [- "webpki-roots 1.0.7",+ "webpki-roots 1.0.10",][[package]]name = "webpki-roots"-version = "1.0.7"+version = "1.0.10"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d"+checksum = "1c1c8e20c8a38fc7d65abfe74eb7280e4aa667e8eec8bc84996d2874810748d9"dependencies = ["rustls-pki-types",]diff --git a/apps/web/tauri/src-tauri/gen/apple/NotificationServiceExtension/Info.plist b/apps/web/tauri/src-tauri/gen/apple/NotificationServiceExtension/Info.plistindex ed7a26e260..20ecf02b15 100644--- a/apps/web/tauri/src-tauri/gen/apple/NotificationServiceExtension/Info.plist+++ b/apps/web/tauri/src-tauri/gen/apple/NotificationServiceExtension/Info.plist@@ -17,9 +17,9 @@<key>CFBundlePackageType</key><string>XPC!</string><key>CFBundleShortVersionString</key>- <string>2.0.10</string>+ <string>2.0.11</string><key>CFBundleVersion</key>- <string>189</string>+ <string>190</string><key>NSExtension</key><dict><key>NSExtensionPointIdentifier</key>diff --git a/apps/web/tauri/src-tauri/gen/apple/ShareExtension/Info.plist b/apps/web/tauri/src-tauri/gen/apple/ShareExtension/Info.plistindex e4c43daf43..33e5a09e4a 100644--- a/apps/web/tauri/src-tauri/gen/apple/ShareExtension/Info.plist+++ b/apps/web/tauri/src-tauri/gen/apple/ShareExtension/Info.plist@@ -17,9 +17,9 @@<key>CFBundlePackageType</key><string>XPC!</string><key>CFBundleShortVersionString</key>- <string>2.0.10</string>+ <string>2.0.11</string><key>CFBundleVersion</key>- <string>189</string>+ <string>190</string><key>LSApplicationQueriesSchemes</key><array><string>macro</string>diff --git a/apps/web/tauri/src-tauri/gen/apple/app_iOS/Info.plist b/apps/web/tauri/src-tauri/gen/apple/app_iOS/Info.plistindex dd4f3f3612..c4fb85da82 100644--- a/apps/web/tauri/src-tauri/gen/apple/app_iOS/Info.plist+++ b/apps/web/tauri/src-tauri/gen/apple/app_iOS/Info.plist@@ -15,7 +15,7 @@<key>CFBundlePackageType</key><string>APPL</string><key>CFBundleShortVersionString</key>- <string>2.0.10</string>+ <string>2.0.11</string><key>CFBundleURLTypes</key><array><dict>@@ -28,7 +28,7 @@</dict></array><key>CFBundleVersion</key>- <string>189</string>+ <string>190</string><key>ITSAppUsesNonExemptEncryption</key><false/><key>LSApplicationQueriesSchemes</key>diff --git a/apps/web/tauri/src-tauri/gen/apple/project.yml b/apps/web/tauri/src-tauri/gen/apple/project.ymlindex 82b03bdebe..08da265e2c 100644--- a/apps/web/tauri/src-tauri/gen/apple/project.yml+++ b/apps/web/tauri/src-tauri/gen/apple/project.yml@@ -58,8 +58,8 @@ targets:- UIInterfaceOrientationPortraitUpsideDown- UIInterfaceOrientationLandscapeLeft- UIInterfaceOrientationLandscapeRight- CFBundleShortVersionString: 2.0.10- CFBundleVersion: "189"+ CFBundleShortVersionString: 2.0.11+ CFBundleVersion: "190"# Exempt encryption only (HTTPS / OS crypto): answers App Store# Connect's export-compliance questionnaire for every build. Keep in# sync with src-tauri/Info.ios.plist.@@ -145,8 +145,8 @@ targets:path: ShareExtension/Info.plistproperties:CFBundleDisplayName: Share to Macro- CFBundleShortVersionString: 2.0.10- CFBundleVersion: "189"+ CFBundleShortVersionString: 2.0.11+ CFBundleVersion: "190"LSApplicationQueriesSchemes:- macroNSExtension:@@ -180,8 +180,8 @@ targets:path: NotificationServiceExtension/Info.plistproperties:CFBundleDisplayName: NotificationServiceExtension- CFBundleShortVersionString: 2.0.10- CFBundleVersion: "189"+ CFBundleShortVersionString: 2.0.11+ CFBundleVersion: "190"NSExtension:NSExtensionPointIdentifier: com.apple.usernotifications.serviceNSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).NotificationServicediff --git a/apps/web/tauri/src-tauri/tauri.android.conf.json b/apps/web/tauri/src-tauri/tauri.android.conf.jsonindex 7ddcad1204..f6bd31cc11 100644--- a/apps/web/tauri/src-tauri/tauri.android.conf.json+++ b/apps/web/tauri/src-tauri/tauri.android.conf.json@@ -2,7 +2,7 @@"version": "2.5.0","bundle": {"android": {- "versionCode": 13+ "versionCode": 14}},"$schema": "https://schema.tauri.app/config/2",diff --git a/apps/web/tauri/src-tauri/tauri.ios.conf.json b/apps/web/tauri/src-tauri/tauri.ios.conf.jsonindex 2aa2cf6eb7..9ff87160fe 100644--- a/apps/web/tauri/src-tauri/tauri.ios.conf.json+++ b/apps/web/tauri/src-tauri/tauri.ios.conf.json@@ -1,9 +1,9 @@{"productName": "macro",- "version": "2.0.10",+ "version": "2.0.11","bundle": {"iOS": {- "bundleVersion": "189"+ "bundleVersion": "190"}}}diff --git a/crates/agent_code_mode/src/domain/documentation.json b/crates/agent_code_mode/src/domain/documentation.jsonindex 17a225ff1e..c253805c54 100644--- a/crates/agent_code_mode/src/domain/documentation.json+++ b/crates/agent_code_mode/src/domain/documentation.json@@ -104,8 +104,8 @@{"name": "email","description": "Search, read, draft, and send email.",- "overview": "<!-- src/entities/email/draft/type-aliases/DraftOptions.md -->\n# Type Alias: DraftOptions\n\n> **DraftOptions** = `Omit`\\<[`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md), `\"db_id\"` \\| `\"provider_id\"` \\| `\"provider_thread_id\"` \\| `\"replying_to_id\"` \\| `\"thread_db_id\"` \\| `\"body_text\"` \\| `\"body_html\"` \\| `\"body_macro\"` \\| `\"headers_json\"` \\| `\"include_signature\"`\\> & \\{ `bodyHtml?`: `string`; `bodyMacro?`: `string`; `bodyText?`: `string`; `headers?`: [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\\[`\"headers_json\"`\\]; `includeSignature?`: `boolean`; `replyingTo?`: [`EmailMessage`](../../message/classes/EmailMessage.md); `thread?`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}\n\nDraft content; relationships use message and thread handles.\n\n## Type Declaration\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `bodyHtml?` | `string` | HTML body. |\n| `bodyMacro?` | `string` | Macro body. |\n| `bodyText?` | `string` | Plain text body. |\n| `headers?` | [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\\[`\"headers_json\"`\\] | Extra headers. |\n| `includeSignature?` | `boolean` | Include the inbox signature. |\n| `replyingTo?` | [`EmailMessage`](../../message/classes/EmailMessage.md) | Message being replied to. |\n| `thread?` | [`EmailThread`](../../thread/classes/EmailThread.md) | Thread receiving this draft. |\n\n\n<!-- src/entities/email/filter/interfaces/EmailFilterOptions.md -->\n# Interface: EmailFilterOptions\n\nSender importance rule.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-emailaddress\"></a> `emailAddress?` | `string` | Match an address. |\n| <a id=\"property-emaildomain\"></a> `emailDomain?` | `string` | Match a domain. |\n| <a id=\"property-isimportant\"></a> `isImportant` | `boolean` | Whether matches are important. |\n\n\n<!-- src/entities/email/message/interfaces/SendEmailOptions.md -->\n# Interface: SendEmailOptions\n\nOptions for sending a fresh email message.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Bcc recipients. |\n| <a id=\"property-bodytext\"></a> `bodyText` | `string` | Plain-text body. |\n| <a id=\"property-cc\"></a> `cc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Cc recipients. |\n| <a id=\"property-subject\"></a> `subject` | `string` | Subject line. |\n| <a id=\"property-to\"></a> `to` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Recipients. |\n\n\n<!-- src/entities/email/namespace/classes/EmailNamespace.md -->\n# Class: EmailNamespace\n\n## Constructors\n\n### Constructor\n\n> **new EmailNamespace**(`client`): `EmailNamespace`\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n\n#### Returns\n\n`EmailNamespace`\n\n## Methods\n\n### attachment()\n\n> **attachment**(`id`): [`EmailAttachment`](../../attachment/classes/EmailAttachment.md)\n\nA handle to an email attachment by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailAttachment`](../../attachment/classes/EmailAttachment.md)\n\n***\n\n### blockedSenders()\n\n> **blockedSenders**(): `Promise`\\<`string`[]\\>\n\nThe email addresses currently blocked.\n\n#### Returns\n\n`Promise`\\<`string`[]\\>\n\n***\n\n### blockSender()\n\n> **blockSender**(`email`): `Promise`\\<`void`\\>\n\nBlock an email sender.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `email` | `string` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### byId()\n\n> **byId**(`id`): [`EmailThread`](../../thread/classes/EmailThread.md)\n\nA handle to an email thread by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailThread`](../../thread/classes/EmailThread.md)\n\n***\n\n### connectionProviders()\n\n> **connectionProviders**(): `Promise`\\<[`EmailConnectionProviders`](../../../../../generated/auth/types.gen/type-aliases/EmailConnectionProviders.md)\\>\n\nProviders the server currently permits this caller to connect.\n\n#### Returns\n\n`Promise`\\<[`EmailConnectionProviders`](../../../../../generated/auth/types.gen/type-aliases/EmailConnectionProviders.md)\\>\n\n***\n\n### contacts()\n\n> **contacts**(): `Promise`\\<\\{\\[`key`: `string`\\]: [`ContactInfoWithInteraction`](../../../../../generated/email/types.gen/type-aliases/ContactInfoWithInteraction.md)[]; \\}\\>\n\nAddress book contacts grouped by the service's interaction buckets.\n\n#### Returns\n\n`Promise`\\<\\{\\[`key`: `string`\\]: [`ContactInfoWithInteraction`](../../../../../generated/email/types.gen/type-aliases/ContactInfoWithInteraction.md)[]; \\}\\>\n\n***\n\n### createDraft()\n\n> **createDraft**(`options`, `inbox?`): `Promise`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\nCreate a draft without sending it; the inbox defaults to the caller's primary.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`DraftOptions`](../../draft/type-aliases/DraftOptions.md) |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\n***\n\n### createLabel()\n\n> **createLabel**(`name`): `Promise`\\<[`Label`](../../label/classes/Label.md)\\>\n\nCreate a user label. Returns the created label.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `name` | `string` |\n\n#### Returns\n\n`Promise`\\<[`Label`](../../label/classes/Label.md)\\>\n\n***\n\n### deleteLabel()\n\n> **deleteLabel**(`label`): `Promise`\\<`void`\\>\n\nDelete a label.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### draftById()\n\n> **draftById**(`id`): [`EmailDraft`](../../draft/classes/EmailDraft.md)\n\nConstruct a lazy draft handle.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailDraft`](../../draft/classes/EmailDraft.md)\n\n***\n\n### filters()\n\n> **filters**(`inbox?`): `Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)[]\\>\n\nImportance filters.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)[]\\>\n\n***\n\n### inbox()\n\n> **inbox**(`opts?`): `AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nThe threads in the inbox, most recent first, auto-paginated.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts?` | [`InboxOptions`](../interfaces/InboxOptions.md) |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n***\n\n### label()\n\n> **label**(`id`): [`Label`](../../label/classes/Label.md)\n\nA handle to a label by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`Label`](../../label/classes/Label.md)\n\n***\n\n### labels()\n\n> **labels**(): `Promise`\\<[`Label`](../../label/classes/Label.md)[]\\>\n\nAll labels across the user's inboxes.\n\n#### Returns\n\n`Promise`\\<[`Label`](../../label/classes/Label.md)[]\\>\n\n***\n\n### link()\n\n> **link**(`id`): [`Link`](../../link/classes/Link.md)\n\nA handle to a connected inbox (email link) by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`Link`](../../link/classes/Link.md)\n\n***\n\n### links()\n\n> **links**(): `Promise`\\<[`Link`](../../link/classes/Link.md)[]\\>\n\nThe caller's connected inboxes (email links).\n\n#### Returns\n\n`Promise`\\<[`Link`](../../link/classes/Link.md)[]\\>\n\n***\n\n### message()\n\n> **message**(`id`): [`EmailMessage`](../../message/classes/EmailMessage.md)\n\nA handle to an email message by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailMessage`](../../message/classes/EmailMessage.md)\n\n***\n\n### recoverDraftTransfer()\n\n> **recoverDraftTransfer**(`operationId`): `Promise`\\<[`TransferRecoveryResponse`](../../../../../generated/email/types.gen/type-aliases/TransferRecoveryResponse.md)\\>\n\nRecover a draft move using its original operation UUID; never starts a new move.\nAn empty committed result fences the old move so it cannot commit later.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `operationId` | `string` |\n\n#### Returns\n\n`Promise`\\<[`TransferRecoveryResponse`](../../../../../generated/email/types.gen/type-aliases/TransferRecoveryResponse.md)\\>\n\n***\n\n### reminders()\n\n> **reminders**(`options?`): `AsyncGenerator`\\<\\{ `followup`: [`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md); `thread`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}, `any`, `any`\\>\n\nFollow-up reminders with thread handles, automatically paginated.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `Omit`\\<\\{ `attachments?`: `string`[] \\| `null`; `calendar?`: `boolean` \\| `null`; `cursor?`: `string` \\| `null`; `done?`: `boolean` \\| `null`; `inboxIds?`: `string`[] \\| `null`; `limit?`: `number` \\| `null`; `noInboxes?`: `boolean` \\| `null`; `read?`: `boolean` \\| `null`; `tags?`: `string`[] \\| `null`; \\}, `\"cursor\"` \\| `\"inboxIds\"`\\> & \\{ `inboxes?`: [`Link`](../../link/classes/Link.md)[]; \\} |\n\n#### Returns\n\n`AsyncGenerator`\\<\\{ `followup`: [`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md); `thread`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}, `any`, `any`\\>\n\n***\n\n### scheduled()\n\n> **scheduled**(`options?`): `AsyncGenerator`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\nScheduled drafts, fetched lazily in bounded pages.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | \\{ `inbox?`: [`Link`](../../link/classes/Link.md); `pageSize?`: `number`; \\} |\n| `options.inbox?` | [`Link`](../../link/classes/Link.md) |\n| `options.pageSize?` | `number` |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\n***\n\n### search()\n\n> **search**(`query`, `opts?`): `AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nSearch email threads by subject and content.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `query` | `string` |\n| `opts?` | [`SearchOpts`](../../../search/interfaces/SearchOpts.md) |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n***\n\n### send()\n\n> **send**(`opts`): `Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\nSend a new email message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`SendEmailOptions`](../../message/interfaces/SendEmailOptions.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\n***\n\n### unblockSender()\n\n> **unblockSender**(`email`): `Promise`\\<`void`\\>\n\nUnblock a previously blocked sender.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `email` | `string` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### upsertFilter()\n\n> **upsertFilter**(`options`, `inbox?`): `Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)\\>\n\nCreate or replace a filter matching an address or domain.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`EmailFilterOptions`](../../filter/interfaces/EmailFilterOptions.md) |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)\\>\n\n\n<!-- src/entities/email/namespace/interfaces/InboxOptions.md -->\n# Interface: InboxOptions\n\nOptions for listing inbox threads.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-pagesize\"></a> `pageSize?` | `number` | Page size (default 20, max 500). |\n| <a id=\"property-sort\"></a> `sort?` | [`ApiSortMethod`](../../../../../generated/email/types.gen/type-aliases/ApiSortMethod.md) | Sort order. Defaults to `viewed_updated`. |\n",- "documentation": "# Macro SDK: email\n\nGenerated by TypeDoc. Paths below refer to the canonical Markdown hierarchy. Other entity handles are documented in their named section; request core for shared SDK helpers.\n\n<!-- generated/auth/types.gen/type-aliases/EmailConnectionProviders.md -->\n# Type Alias: EmailConnectionProviders\n\n> **EmailConnectionProviders** = \\{ `gmail`: `boolean`; `outlook`: `boolean`; `outlook_admin_consent_url?`: `string` \\| `null`; \\}\n\nActual deployment availability for the provider selector.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-gmail\"></a> `gmail` | `boolean` | - |\n| <a id=\"property-outlook\"></a> `outlook` | `boolean` | - |\n| <a id=\"property-outlook_admin_consent_url\"></a> `outlook_admin_consent_url?` | `string` \\| `null` | Where a Microsoft 365 administrator approves Macro for their whole directory. Present when Outlook is configured and the request named an `original_url` for the administrator's browser to return to. |\n\n\n<!-- generated/email/types.gen/type-aliases/AccessLevel.md -->\n# Type Alias: AccessLevel\n\n> **AccessLevel** = `\"view\"` \\| `\"comment\"` \\| `\"edit\"` \\| `\"owner\"`\n\nOrdered from least to most access top -> bottom\n\n\n<!-- generated/email/types.gen/type-aliases/ApiAttachmentDraft.md -->\n# Type Alias: ApiAttachmentDraft\n\n> **ApiAttachmentDraft** = \\{ `content_id?`: `string` \\| `null`; `content_type`: `string`; `draft_id`: `string`; `file_name`: `string`; `id`: `string`; `is_inline`: `boolean`; `s3_key`: `string`; `sha`: `string`; `size`: `number`; `upload_pending`: `boolean`; \\}\n\nAPI representation of a draft attachment on a message.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-content_id\"></a> `content_id?` | `string` \\| `null` |\n| <a id=\"property-content_type\"></a> `content_type` | `string` |\n| <a id=\"property-draft_id\"></a> `draft_id` | `string` |\n| <a id=\"property-file_name\"></a> `file_name` | `string` |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-is_inline\"></a> `is_inline` | `boolean` |\n| <a id=\"property-s3_key\"></a> `s3_key` | `string` |\n| <a id=\"property-sha\"></a> `sha` | `string` |\n| <a id=\"property-size\"></a> `size` | `number` |\n| <a id=\"property-upload_pending\"></a> `upload_pending` | `boolean` |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiAttachmentForwarded.md -->\n# Type Alias: ApiAttachmentForwarded\n\n> **ApiAttachmentForwarded** = \\{ `attachment_id`: `string`; `draft_id`: `string`; `filename?`: `string` \\| `null`; `message_provider_id`: `string`; `mime_type?`: `string` \\| `null`; `provider_attachment_id?`: `string` \\| `null`; `size_bytes?`: `number` \\| `null`; \\}\n\nAPI representation of a forwarded attachment on a message.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-attachment_id\"></a> `attachment_id` | `string` |\n| <a id=\"property-draft_id\"></a> `draft_id` | `string` |\n| <a id=\"property-filename\"></a> `filename?` | `string` \\| `null` |\n| <a id=\"property-message_provider_id\"></a> `message_provider_id` | `string` |\n| <a id=\"property-mime_type\"></a> `mime_type?` | `string` \\| `null` |\n| <a id=\"property-provider_attachment_id\"></a> `provider_attachment_id?` | `string` \\| `null` |\n| <a id=\"property-size_bytes\"></a> `size_bytes?` | `number` \\| `null` |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiContactInfo.md -->\n# Type Alias: ApiContactInfo\n\n> **ApiContactInfo** = \\{ `email`: `string`; `name?`: `string` \\| `null`; `photo_url?`: `string` \\| `null`; \\}\n\nAPI representation of a contact (sender or recipient).\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-email\"></a> `email` | `string` |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` |\n| <a id=\"property-photo_url\"></a> `photo_url?` | `string` \\| `null` |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiDraftContactInfo.md -->\n# Type Alias: ApiDraftContactInfo\n\n> **ApiDraftContactInfo** = \\{ `email`: `string`; `name?`: `string` \\| `null`; `photo_url?`: `string` \\| `null`; \\}\n\nContact info for draft request/response (backward-compatible with MessageToSend shape).\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-email\"></a> `email` | `string` | Email address. |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` | Display name. |\n| <a id=\"property-photo_url\"></a> `photo_url?` | `string` \\| `null` | Profile photo URL. |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiDraftInput.md -->\n# Type Alias: ApiDraftInput\n\n> **ApiDraftInput** = \\{ `bcc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null`; `body_html?`: `string` \\| `null`; `body_macro?`: `string` \\| `null`; `body_text?`: `string` \\| `null`; `cc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null`; `db_id?`: `string` \\| `null`; `headers_json?`: `null` \\| [`Value`](Value.md); `include_signature?`: `boolean` \\| `null`; `provider_id?`: `string` \\| `null`; `provider_thread_id?`: `string` \\| `null`; `replying_to_id?`: `string` \\| `null`; `subject`: `string`; `thread_db_id?`: `string` \\| `null`; `to?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null`; \\}\n\nThe draft input matching the current `MessageToSend` JSON shape for backward compat.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc?` | [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null` | Bcc recipients. |\n| <a id=\"property-body_html\"></a> `body_html?` | `string` \\| `null` | HTML body (base64 URL_SAFE_NO_PAD encoded). Sanitized before storage. |\n| <a id=\"property-body_macro\"></a> `body_macro?` | `string` \\| `null` | Macro body format. |\n| <a id=\"property-body_text\"></a> `body_text?` | `string` \\| `null` | Plain text body. |\n| <a id=\"property-cc\"></a> `cc?` | [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null` | Cc recipients. |\n| <a id=\"property-db_id\"></a> `db_id?` | `string` \\| `null` | Existing message DB ID (for updating an existing draft). |\n| <a id=\"property-headers_json\"></a> `headers_json?` | `null` \\| [`Value`](Value.md) | - |\n| <a id=\"property-include_signature\"></a> `include_signature?` | `boolean` \\| `null` | Per-message override for whether to include the signature on send: `Some(false)` to exclude (user dismissed it). Omit to use the inbox's default policy. Ignored for drafts. |\n| <a id=\"property-provider_id\"></a> `provider_id?` | `string` \\| `null` | Provider message ID. |\n| <a id=\"property-provider_thread_id\"></a> `provider_thread_id?` | `string` \\| `null` | Provider thread ID. |\n| <a id=\"property-replying_to_id\"></a> `replying_to_id?` | `string` \\| `null` | ID of the message this draft is replying to. |\n| <a id=\"property-subject\"></a> `subject` | `string` | Subject line. |\n| <a id=\"property-thread_db_id\"></a> `thread_db_id?` | `string` \\| `null` | Thread DB ID. |\n| <a id=\"property-to\"></a> `to?` | [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null` | To recipients. |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiEmailFilter.md -->\n# Type Alias: ApiEmailFilter\n\n> **ApiEmailFilter** = \\{ `created_at`: `string`; `email_address?`: `string` \\| `null`; `email_domain?`: `string` \\| `null`; `id`: `string`; `is_important`: `boolean`; \\}\n\nA single email filter in API responses.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` |\n| <a id=\"property-email_address\"></a> `email_address?` | `string` \\| `null` |\n| <a id=\"property-email_domain\"></a> `email_domain?` | `string` \\| `null` |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-is_important\"></a> `is_important` | `boolean` |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiLabel.md -->\n# Type Alias: ApiLabel\n\n> **ApiLabel** = \\{ `createdAt`: `string`; `id`: `string`; `labelListVisibility`: [`ApiLabelListVisibility`](ApiLabelListVisibility.md); `linkId`: `string`; `messageListVisibility`: [`ApiMessageListVisibility`](ApiMessageListVisibility.md); `name`: `string`; `providerLabelId`: `string`; `type`: [`ApiLabelType`](ApiLabelType.md); \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-createdat\"></a> `createdAt` | `string` |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-labellistvisibility\"></a> `labelListVisibility` | [`ApiLabelListVisibility`](ApiLabelListVisibility.md) |\n| <a id=\"property-linkid\"></a> `linkId` | `string` |\n| <a id=\"property-messagelistvisibility\"></a> `messageListVisibility` | [`ApiMessageListVisibility`](ApiMessageListVisibility.md) |\n| <a id=\"property-name\"></a> `name` | `string` |\n| <a id=\"property-providerlabelid\"></a> `providerLabelId` | `string` |\n| <a id=\"property-type\"></a> `type` | [`ApiLabelType`](ApiLabelType.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiLabelListVisibility.md -->\n# Type Alias: ApiLabelListVisibility\n\n> **ApiLabelListVisibility** = `\"LabelShow\"` \\| `\"LabelShowIfUnread\"` \\| `\"LabelHide\"`\n\n\n<!-- generated/email/types.gen/type-aliases/ApiLabelType.md -->\n# Type Alias: ApiLabelType\n\n> **ApiLabelType** = `\"System\"` \\| `\"User\"`\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessage.md -->\n# Type Alias: ApiMessage\n\n> **ApiMessage** = \\{ `attachments`: [`ApiMessageAttachment`](ApiMessageAttachment.md)[]; `attachments_draft`: [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[]; `attachments_forwarded`: [`ApiAttachmentForwarded`](ApiAttachmentForwarded.md)[]; `bcc`: [`ApiContactInfo`](ApiContactInfo.md)[]; `body_html_sanitized?`: `string` \\| `null`; `body_macro?`: `string` \\| `null`; `body_replyless?`: `string` \\| `null`; `body_text?`: `string` \\| `null`; `calendar_invitations?`: [`CalendarInvitation`](CalendarInvitation.md)[]; `cc`: [`ApiContactInfo`](ApiContactInfo.md)[]; `created_at`: `string`; `db_id`: `string`; `from?`: `null` \\| [`ApiContactInfo`](ApiContactInfo.md); `global_id?`: `string` \\| `null`; `has_attachments`: `boolean`; `headers_json?`: `unknown`; `internal_date_ts?`: `string` \\| `null`; `is_draft`: `boolean`; `is_read`: `boolean`; `is_sent`: `boolean`; `is_starred`: `boolean`; `labels`: [`ApiMessageLabel`](ApiMessageLabel.md)[]; `link_id`: `string`; `operation_status?`: `null` \\| [`ApiMessageOperation`](ApiMessageOperation.md); `provider_history_id?`: `string` \\| `null`; `provider_id?`: `string` \\| `null`; `provider_thread_id?`: `string` \\| `null`; `replying_to_id?`: `string` \\| `null`; `scheduled_send_time?`: `string` \\| `null`; `sent_at?`: `string` \\| `null`; `size_estimate?`: `number` \\| `null`; `snippet?`: `string` \\| `null`; `subject?`: `string` \\| `null`; `thread_db_id`: `string`; `to`: [`ApiContactInfo`](ApiContactInfo.md)[]; `updated_at`: `string`; \\}\n\nAPI representation of a fully assembled email message.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-attachments\"></a> `attachments` | [`ApiMessageAttachment`](ApiMessageAttachment.md)[] |\n| <a id=\"property-attachments_draft\"></a> `attachments_draft` | [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[] |\n| <a id=\"property-attachments_forwarded\"></a> `attachments_forwarded` | [`ApiAttachmentForwarded`](ApiAttachmentForwarded.md)[] |\n| <a id=\"property-bcc\"></a> `bcc` | [`ApiContactInfo`](ApiContactInfo.md)[] |\n| <a id=\"property-body_html_sanitized\"></a> `body_html_sanitized?` | `string` \\| `null` |\n| <a id=\"property-body_macro\"></a> `body_macro?` | `string` \\| `null` |\n| <a id=\"property-body_replyless\"></a> `body_replyless?` | `string` \\| `null` |\n| <a id=\"property-body_text\"></a> `body_text?` | `string` \\| `null` |\n| <a id=\"property-calendar_invitations\"></a> `calendar_invitations?` | [`CalendarInvitation`](CalendarInvitation.md)[] |\n| <a id=\"property-cc\"></a> `cc` | [`ApiContactInfo`](ApiContactInfo.md)[] |\n| <a id=\"property-created_at\"></a> `created_at` | `string` |\n| <a id=\"property-db_id\"></a> `db_id` | `string` |\n| <a id=\"property-from\"></a> `from?` | `null` \\| [`ApiContactInfo`](ApiContactInfo.md) |\n| <a id=\"property-global_id\"></a> `global_id?` | `string` \\| `null` |\n| <a id=\"property-has_attachments\"></a> `has_attachments` | `boolean` |\n| <a id=\"property-headers_json\"></a> `headers_json?` | `unknown` |\n| <a id=\"property-internal_date_ts\"></a> `internal_date_ts?` | `string` \\| `null` |\n| <a id=\"property-is_draft\"></a> `is_draft` | `boolean` |\n| <a id=\"property-is_read\"></a> `is_read` | `boolean` |\n| <a id=\"property-is_sent\"></a> `is_sent` | `boolean` |\n| <a id=\"property-is_starred\"></a> `is_starred` | `boolean` |\n| <a id=\"property-labels\"></a> `labels` | [`ApiMessageLabel`](ApiMessageLabel.md)[] |\n| <a id=\"property-link_id\"></a> `link_id` | `string` |\n| <a id=\"property-operation_status\"></a> `operation_status?` | `null` \\| [`ApiMessageOperation`](ApiMessageOperation.md) |\n| <a id=\"property-provider_history_id\"></a> `provider_history_id?` | `string` \\| `null` |\n| <a id=\"property-provider_id\"></a> `provider_id?` | `string` \\| `null` |\n| <a id=\"property-provider_thread_id\"></a> `provider_thread_id?` | `string` \\| `null` |\n| <a id=\"property-replying_to_id\"></a> `replying_to_id?` | `string` \\| `null` |\n| <a id=\"property-scheduled_send_time\"></a> `scheduled_send_time?` | `string` \\| `null` |\n| <a id=\"property-sent_at\"></a> `sent_at?` | `string` \\| `null` |\n| <a id=\"property-size_estimate\"></a> `size_estimate?` | `number` \\| `null` |\n| <a id=\"property-snippet\"></a> `snippet?` | `string` \\| `null` |\n| <a id=\"property-subject\"></a> `subject?` | `string` \\| `null` |\n| <a id=\"property-thread_db_id\"></a> `thread_db_id` | `string` |\n| <a id=\"property-to\"></a> `to` | [`ApiContactInfo`](ApiContactInfo.md)[] |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageAttachment.md -->\n# Type Alias: ApiMessageAttachment\n\n> **ApiMessageAttachment** = \\{ `content_id?`: `string` \\| `null`; `data_url?`: `string` \\| `null`; `db_id`: `string`; `filename?`: `string` \\| `null`; `mime_type?`: `string` \\| `null`; `provider_id?`: `string` \\| `null`; `reference_url?`: `string` \\| `null`; `sfs_id?`: `string` \\| `null`; `size_bytes?`: `number` \\| `null`; \\}\n\nAPI representation of a provider attachment on a message.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-content_id\"></a> `content_id?` | `string` \\| `null` |\n| <a id=\"property-data_url\"></a> `data_url?` | `string` \\| `null` |\n| <a id=\"property-db_id\"></a> `db_id` | `string` |\n| <a id=\"property-filename\"></a> `filename?` | `string` \\| `null` |\n| <a id=\"property-mime_type\"></a> `mime_type?` | `string` \\| `null` |\n| <a id=\"property-provider_id\"></a> `provider_id?` | `string` \\| `null` |\n| <a id=\"property-reference_url\"></a> `reference_url?` | `string` \\| `null` |\n| <a id=\"property-sfs_id\"></a> `sfs_id?` | `string` \\| `null` |\n| <a id=\"property-size_bytes\"></a> `size_bytes?` | `number` \\| `null` |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageLabel.md -->\n# Type Alias: ApiMessageLabel\n\n> **ApiMessageLabel** = \\{ `created_at`: `string`; `id?`: `string` \\| `null`; `label_list_visibility?`: `null` \\| [`ApiLabelListVisibility`](ApiLabelListVisibility.md); `link_id`: `string`; `message_list_visibility?`: `null` \\| [`ApiMessageListVisibility`](ApiMessageListVisibility.md); `name?`: `string` \\| `null`; `provider_label_id`: `string`; `type_?`: `null` \\| [`ApiLabelType`](ApiLabelType.md); \\}\n\nAPI representation of a label on a message.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` |\n| <a id=\"property-id\"></a> `id?` | `string` \\| `null` |\n| <a id=\"property-label_list_visibility\"></a> `label_list_visibility?` | `null` \\| [`ApiLabelListVisibility`](ApiLabelListVisibility.md) |\n| <a id=\"property-link_id\"></a> `link_id` | `string` |\n| <a id=\"property-message_list_visibility\"></a> `message_list_visibility?` | `null` \\| [`ApiMessageListVisibility`](ApiMessageListVisibility.md) |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` |\n| <a id=\"property-provider_label_id\"></a> `provider_label_id` | `string` |\n| <a id=\"property-type_\"></a> `type_?` | `null` \\| [`ApiLabelType`](ApiLabelType.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageListVisibility.md -->\n# Type Alias: ApiMessageListVisibility\n\n> **ApiMessageListVisibility** = `\"Show\"` \\| `\"Hide\"`\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageOperation.md -->\n# Type Alias: ApiMessageOperation\n\n> **ApiMessageOperation** = \\{ `issue?`: `null` \\| [`ApiMessageOperationIssue`](ApiMessageOperationIssue.md); `remote_version?`: `string` \\| `null`; `revision`: `string`; `state`: [`ApiMessageOperationState`](ApiMessageOperationState.md); \\}\n\nVersions are opaque decimal strings so clients never truncate an i64.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-issue\"></a> `issue?` | `null` \\| [`ApiMessageOperationIssue`](ApiMessageOperationIssue.md) |\n| <a id=\"property-remote_version\"></a> `remote_version?` | `string` \\| `null` |\n| <a id=\"property-revision\"></a> `revision` | `string` |\n| <a id=\"property-state\"></a> `state` | [`ApiMessageOperationState`](ApiMessageOperationState.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageOperationIssue.md -->\n# Type Alias: ApiMessageOperationIssue\n\n> **ApiMessageOperationIssue** = `\"ACCEPTING_REMOTE\"` \\| `\"DRAFT_CONFLICT\"` \\| `\"CREATION_UNKNOWN\"` \\| `\"ATTACHMENT_UNKNOWN\"` \\| `\"SEND_UNKNOWN\"` \\| `\"SEND_REJECTED\"` \\| `\"ACCESS_REVOKED\"` \\| `\"INVALID_CONTENT\"` \\| `\"MOVE_PENDING\"` \\| `\"MOVE_CONFLICT\"` \\| `\"MOVE_SOURCE_SENT\"` \\| `\"MOVE_REAUTHORIZATION\"` \\| `\"MOVE_ORIGINAL_REMAINS\"`\n\nProvider-neutral state exposed to clients.\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageOperationState.md -->\n# Type Alias: ApiMessageOperationState\n\n> **ApiMessageOperationState** = `\"PENDING\"` \\| `\"SYNCHRONIZED\"` \\| `\"CONFLICT\"` \\| `\"UNCERTAIN\"` \\| `\"SUBMITTING\"` \\| `\"CONFIRMING\"` \\| `\"SENT\"` \\| `\"DELETED\"` \\| `\"CANCELLED\"` \\| `\"FAILED\"`\n\nProvider-neutral state exposed to clients.\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageResolutionAction.md -->\n# Type Alias: ApiMessageResolutionAction\n\n> **ApiMessageResolutionAction** = `\"keep_local\"` \\| `\"use_provider\"` \\| `\"recheck\"` \\| `\"retry_send\"` \\| `\"keep_original\"`\n\nA deliberate resolution of a particular observed operation version.\n\n\n<!-- generated/email/types.gen/type-aliases/ApiSortMethod.md -->\n# Type Alias: ApiSortMethod\n\n> **ApiSortMethod** = `\"viewed_at\"` \\| `\"updated_at\"` \\| `\"created_at\"` \\| `\"viewed_updated\"`\n\ncommon types of sorts based on timestamps\n\n\n<!-- generated/email/types.gen/type-aliases/ApiThread.md -->\n# Type Alias: ApiThread\n\n> **ApiThread** = \\{ `access_level`: [`AccessLevel`](AccessLevel.md); `created_at`: `string`; `db_id`: `string`; `inbox_visible`: `boolean`; `is_read`: `boolean`; `latest_inbound_message_ts?`: `string` \\| `null`; `latest_non_spam_message_ts?`: `string` \\| `null`; `latest_outbound_message_ts?`: `string` \\| `null`; `link_id`: `string`; `messages`: [`ApiMessage`](ApiMessage.md)[]; `project_id?`: `string` \\| `null`; `provider_id?`: `string` \\| `null`; `updated_at`: `string`; \\}\n\nAPI representation of a fully assembled email thread.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-access_level\"></a> `access_level` | [`AccessLevel`](AccessLevel.md) |\n| <a id=\"property-created_at\"></a> `created_at` | `string` |\n| <a id=\"property-db_id\"></a> `db_id` | `string` |\n| <a id=\"property-inbox_visible\"></a> `inbox_visible` | `boolean` |\n| <a id=\"property-is_read\"></a> `is_read` | `boolean` |\n| <a id=\"property-latest_inbound_message_ts\"></a> `latest_inbound_message_ts?` | `string` \\| `null` |\n| <a id=\"property-latest_non_spam_message_ts\"></a> `latest_non_spam_message_ts?` | `string` \\| `null` |\n| <a id=\"property-latest_outbound_message_ts\"></a> `latest_outbound_message_ts?` | `string` \\| `null` |\n| <a id=\"property-link_id\"></a> `link_id` | `string` |\n| <a id=\"property-messages\"></a> `messages` | [`ApiMessage`](ApiMessage.md)[] |\n| <a id=\"property-project_id\"></a> `project_id?` | `string` \\| `null` |\n| <a id=\"property-provider_id\"></a> `provider_id?` | `string` \\| `null` |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/Attachment.md -->\n# Type Alias: Attachment\n\n> **Attachment** = \\{ `content_id?`: `string` \\| `null`; `data_url?`: `string` \\| `null`; `db_id`: `string`; `filename?`: `string` \\| `null`; `mime_type?`: `string` \\| `null`; `provider_id?`: `string` \\| `null`; `reference_url?`: `string` \\| `null`; `sfs_id?`: `string` \\| `null`; `size_bytes?`: `number` \\| `null`; \\}\n\nAttachments of a message, as sent to us by the provider.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-content_id\"></a> `content_id?` | `string` \\| `null` | - |\n| <a id=\"property-data_url\"></a> `data_url?` | `string` \\| `null` | - |\n| <a id=\"property-db_id\"></a> `db_id` | `string` | - |\n| <a id=\"property-filename\"></a> `filename?` | `string` \\| `null` | - |\n| <a id=\"property-mime_type\"></a> `mime_type?` | `string` \\| `null` | - |\n| <a id=\"property-provider_id\"></a> `provider_id?` | `string` \\| `null` | - |\n| <a id=\"property-reference_url\"></a> `reference_url?` | `string` \\| `null` | Cloud reference: open this provider page instead of downloading bytes. |\n| <a id=\"property-sfs_id\"></a> `sfs_id?` | `string` \\| `null` | - |\n| <a id=\"property-size_bytes\"></a> `size_bytes?` | `number` \\| `null` | - |\n\n\n<!-- generated/email/types.gen/type-aliases/AttendeeResponseStatus.md -->\n# Type Alias: AttendeeResponseStatus\n\n> **AttendeeResponseStatus** = `\"needs_action\"` \\| `\"accepted\"` \\| `\"declined\"` \\| `\"tentative\"`\n\nRSVP state for an attendee.\n\n\n<!-- generated/email/types.gen/type-aliases/CalendarAttendee.md -->\n# Type Alias: CalendarAttendee\n\n> **CalendarAttendee** = \\{ `comment?`: `string` \\| `null`; `displayName?`: `string` \\| `null`; `email`: `string`; `isOptional`: `boolean`; `isOrganizer`: `boolean`; `isSelf`: `boolean`; `responseStatus`: [`AttendeeResponseStatus`](AttendeeResponseStatus.md); \\}\n\nAn attendee on a calendar event.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-comment\"></a> `comment?` | `string` \\| `null` | Optional attendee comment. |\n| <a id=\"property-displayname\"></a> `displayName?` | `string` \\| `null` | Provider display name. |\n| <a id=\"property-email\"></a> `email` | `string` | Normalized email address. |\n| <a id=\"property-isoptional\"></a> `isOptional` | `boolean` | Whether attendance is optional. |\n| <a id=\"property-isorganizer\"></a> `isOrganizer` | `boolean` | Whether this attendee is the organizer. |\n| <a id=\"property-isself\"></a> `isSelf` | `boolean` | Whether this attendee is one of the viewing requester's inboxes. |\n| <a id=\"property-responsestatus\"></a> `responseStatus` | [`AttendeeResponseStatus`](AttendeeResponseStatus.md) | RSVP state. |\n\n\n<!-- generated/email/types.gen/type-aliases/CalendarEvent.md -->\n# Type Alias: CalendarEvent\n\n> **CalendarEvent** = \\{ `attendees`: [`CalendarAttendee`](CalendarAttendee.md)[]; `calendarId?`: `string` \\| `null`; `conferenceProvider?`: `null` \\| [`ConferenceProvider`](ConferenceProvider.md); `conferenceUrl?`: `string` \\| `null`; `createdAt`: `string`; `creatorEmail?`: `string` \\| `null`; `creatorName?`: `string` \\| `null`; `description?`: `string` \\| `null`; `eventType?`: [`EventType`](EventType.md); `guestPolicy`: [`GuestPolicy`](GuestPolicy.md); `icalUid`: `string`; `id`: `string`; `isReadOnly`: `boolean`; `location?`: `string` \\| `null`; `organizerEmail?`: `string` \\| `null`; `organizerName?`: `string` \\| `null`; `ownerId`: `string`; `recurrenceLines`: `string`[]; `reminders?`: [`EventReminders`](EventReminders.md); `sequence`: `number`; `sources?`: [`CalendarEventSourceContent`](CalendarEventSourceContent.md)[]; `status`: [`EventStatus`](EventStatus.md); `time`: [`EventTime`](EventTime.md); `title`: `string`; `transparency`: [`EventTransparency`](EventTransparency.md); `updatedAt`: `string`; `viewerCan`: [`ViewerCapabilities`](ViewerCapabilities.md); `visibility`: [`EventVisibility`](EventVisibility.md); \\}\n\nA stable, first-class Macro calendar event entity.\n\nContent fields hold the canonical source's values: the account's primary\ncalendar copy when one is synced, else the freshest remaining copy.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-attendees\"></a> `attendees` | [`CalendarAttendee`](CalendarAttendee.md)[] | Attendees, keyed by email during persistence. |\n| <a id=\"property-calendarid\"></a> `calendarId?` | `string` \\| `null` | Calendar the canonical source belongs to, when known. Absent only in projections stored before calendars were attributed. |\n| <a id=\"property-conferenceprovider\"></a> `conferenceProvider?` | `null` \\| [`ConferenceProvider`](ConferenceProvider.md) | - |\n| <a id=\"property-conferenceurl\"></a> `conferenceUrl?` | `string` \\| `null` | Direct join URL when known. |\n| <a id=\"property-createdat\"></a> `createdAt` | `string` | Entity creation time. |\n| <a id=\"property-creatoremail\"></a> `creatorEmail?` | `string` \\| `null` | Provider-reported creator email. Distinct from the organizer when someone writes onto a calendar they do not own. Omitted from stored projections when unknown so events ingested before this field still compare equal. |\n| <a id=\"property-creatorname\"></a> `creatorName?` | `string` \\| `null` | Provider-reported creator display name. |\n| <a id=\"property-description\"></a> `description?` | `string` \\| `null` | Optional event body. |\n| <a id=\"property-eventtype\"></a> `eventType?` | [`EventType`](EventType.md) | Provider event type. Skipped when it is the regular type so projections stored before event types were modeled still compare equal. |\n| <a id=\"property-guestpolicy\"></a> `guestPolicy` | [`GuestPolicy`](GuestPolicy.md) | What the organizer lets guests do: the canonical copy's values, or Google's defaults for an event synced before the policy was modeled. |\n| <a id=\"property-icaluid\"></a> `icalUid` | `string` | RFC 5545 UID used to reconcile provider and email sources. |\n| <a id=\"property-id\"></a> `id` | `string` | Macro entity identifier. |\n| <a id=\"property-isreadonly\"></a> `isReadOnly` | `boolean` | Whether the canonical source's calendar prohibits editing it. |\n| <a id=\"property-location\"></a> `location?` | `string` \\| `null` | Optional physical or virtual location label. |\n| <a id=\"property-organizeremail\"></a> `organizerEmail?` | `string` \\| `null` | Organizer email. |\n| <a id=\"property-organizername\"></a> `organizerName?` | `string` \\| `null` | Organizer display name. |\n| <a id=\"property-ownerid\"></a> `ownerId` | `string` | Macro user who owns this event entity. |\n| <a id=\"property-recurrencelines\"></a> `recurrenceLines` | `string`[] | Raw RFC 5545 recurrence properties (`RRULE`, `RDATE`, `EXDATE`). |\n| <a id=\"property-reminders\"></a> `reminders?` | [`EventReminders`](EventReminders.md) | Per-user reminder configuration. Skipped when it is the provider default so projections stored before reminders were modeled still compare equal. |\n| <a id=\"property-sequence\"></a> `sequence` | `number` | Provider/iCalendar sequence number. |\n| <a id=\"property-sources\"></a> `sources?` | [`CalendarEventSourceContent`](CalendarEventSourceContent.md)[] | Content of every active copy of this event, canonical first: the primary calendar's copy, then the freshest. A client picks the copy whose calendar it is showing and falls back to the first. Populated only on the read path, so stored projections omit it. |\n| <a id=\"property-status\"></a> `status` | [`EventStatus`](EventStatus.md) | Event status. |\n| <a id=\"property-time\"></a> `time` | [`EventTime`](EventTime.md) | Timed or all-day shape. |\n| <a id=\"property-title\"></a> `title` | `string` | Display title. |\n| <a id=\"property-transparency\"></a> `transparency` | [`EventTransparency`](EventTransparency.md) | Availability behavior. |\n| <a id=\"property-updatedat\"></a> `updatedAt` | `string` | Entity update time. |\n| <a id=\"property-viewercan\"></a> `viewerCan` | [`ViewerCapabilities`](ViewerCapabilities.md) | What the viewing requester may do with the event. Resolved only on the read path, alongside each attendee's `is_self`; nothing when no viewer is known. Source projections never store it. |\n| <a id=\"property-visibility\"></a> `visibility` | [`EventVisibility`](EventVisibility.md) | Event visibility. |\n\n\n<!-- generated/email/types.gen/type-aliases/CalendarEventSourceContent.md -->\n# Type Alias: CalendarEventSourceContent\n\n> **CalendarEventSourceContent** = \\{ `calendarId`: `string`; `creatorEmail?`: `string` \\| `null`; `creatorName?`: `string` \\| `null`; `description?`: `string` \\| `null`; `eventType`: [`EventType`](EventType.md); `isReadOnly`: `boolean`; `location?`: `string` \\| `null`; `reminders`: [`EventReminders`](EventReminders.md); `title`: `string`; `transparency`: [`EventTransparency`](EventTransparency.md); `visibility`: [`EventVisibility`](EventVisibility.md); \\}\n\nThe content one provider copy of an event carries.\n\nGoogle keeps these fields per calendar copy: a shared calendar's copy of a\nmember's event can have its own title, type, reminders, and access role.\nThe entity holds its canonical source's values. Every other copy's values\nare read from here so a client can show the copy that belongs to the\ncalendar being viewed.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-calendarid\"></a> `calendarId` | `string` | Calendar this copy lives on. |\n| <a id=\"property-creatoremail\"></a> `creatorEmail?` | `string` \\| `null` | Provider-reported creator email. |\n| <a id=\"property-creatorname\"></a> `creatorName?` | `string` \\| `null` | Provider-reported creator display name. |\n| <a id=\"property-description\"></a> `description?` | `string` \\| `null` | Optional event body. |\n| <a id=\"property-eventtype\"></a> `eventType` | [`EventType`](EventType.md) | Provider event type. |\n| <a id=\"property-isreadonly\"></a> `isReadOnly` | `boolean` | Whether the calendar's access role prohibits editing this copy. |\n| <a id=\"property-location\"></a> `location?` | `string` \\| `null` | Optional physical or virtual location label. |\n| <a id=\"property-reminders\"></a> `reminders` | [`EventReminders`](EventReminders.md) | Reminder configuration of this copy. |\n| <a id=\"property-title\"></a> `title` | `string` | Display title. |\n| <a id=\"property-transparency\"></a> `transparency` | [`EventTransparency`](EventTransparency.md) | Availability behavior. |\n| <a id=\"property-visibility\"></a> `visibility` | [`EventVisibility`](EventVisibility.md) | Event visibility. |\n\n\n<!-- generated/email/types.gen/type-aliases/CalendarInvitation.md -->\n# Type Alias: CalendarInvitation\n\n> **CalendarInvitation** = \\{ `attendees`: [`InvitationParticipant`](InvitationParticipant.md)[]; `comment?`: `string` \\| `null`; `conference_url?`: `string` \\| `null`; `description?`: `string` \\| `null`; `dtstamp?`: `string` \\| `null`; `end?`: `null` \\| [`InvitationDateTime`](InvitationDateTime.md); `id`: `string`; `last_modified?`: `string` \\| `null`; `location?`: `string` \\| `null`; `method`: [`InvitationMethod`](InvitationMethod.md); `organizer?`: `null` \\| [`InvitationParticipant`](InvitationParticipant.md); `recurrence_id?`: `null` \\| [`InvitationDateTime`](InvitationDateTime.md); `recurrence_id_raw?`: `string` \\| `null`; `sequence`: `number`; `start?`: `null` \\| [`InvitationDateTime`](InvitationDateTime.md); `status?`: `string` \\| `null`; `title?`: `string` \\| `null`; `uid`: `string`; \\}\n\nDisplay snapshot of one meaningful VEVENT, owned by the email domain.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-attendees\"></a> `attendees` | [`InvitationParticipant`](InvitationParticipant.md)[] | Historical attendee identities and participation metadata. |\n| <a id=\"property-comment\"></a> `comment?` | `string` \\| `null` | Reply or counter-proposal comment. |\n| <a id=\"property-conference_url\"></a> `conference_url?` | `string` \\| `null` | Validated HTTP(S) conferencing URL; never fetched during rendering. |\n| <a id=\"property-description\"></a> `description?` | `string` \\| `null` | Plaintext description, retaining passwords and dial-in instructions. |\n| <a id=\"property-dtstamp\"></a> `dtstamp?` | `string` \\| `null` | Scheduling timestamp in its original spelling. |\n| <a id=\"property-end\"></a> `end?` | `null` \\| [`InvitationDateTime`](InvitationDateTime.md) | - |\n| <a id=\"property-id\"></a> `id` | `string` | Content-derived component identity, stable across repeated extraction. |\n| <a id=\"property-last_modified\"></a> `last_modified?` | `string` \\| `null` | Last modification timestamp in its original spelling. |\n| <a id=\"property-location\"></a> `location?` | `string` \\| `null` | Plaintext event location. |\n| <a id=\"property-method\"></a> `method` | [`InvitationMethod`](InvitationMethod.md) | Original scheduling method. |\n| <a id=\"property-organizer\"></a> `organizer?` | `null` \\| [`InvitationParticipant`](InvitationParticipant.md) | - |\n| <a id=\"property-recurrence_id\"></a> `recurrence_id?` | `null` \\| [`InvitationDateTime`](InvitationDateTime.md) | - |\n| <a id=\"property-recurrence_id_raw\"></a> `recurrence_id_raw?` | `string` \\| `null` | Original recurrence identifier spelling and parameters. |\n| <a id=\"property-sequence\"></a> `sequence` | `number` | Scheduling revision, distinct from delivery order. |\n| <a id=\"property-start\"></a> `start?` | `null` \\| [`InvitationDateTime`](InvitationDateTime.md) | - |\n| <a id=\"property-status\"></a> `status?` | `string` \\| `null` | Original event status. |\n| <a id=\"property-title\"></a> `title?` | `string` \\| `null` | Event summary. |\n| <a id=\"property-uid\"></a> `uid` | `string` | iCalendar UID; never a Google provider event ID. |\n\n\n<!-- generated/email/types.gen/type-aliases/CalendarOccurrence.md -->\n# Type Alias: CalendarOccurrence\n\n> **CalendarOccurrence** = \\{ `eventId`: `string`; `isCancelled`: `boolean`; `occurrenceKey`: `string`; `recurrenceId?`: `string` \\| `null`; `time`: [`EventTime`](EventTime.md); \\}\n\nA materialized recurrence instance optimized for range queries.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-eventid\"></a> `eventId` | `string` | Owning event entity. |\n| <a id=\"property-iscancelled\"></a> `isCancelled` | `boolean` | Whether the instance was cancelled. |\n| <a id=\"property-occurrencekey\"></a> `occurrenceKey` | `string` | Stable key within the event. |\n| <a id=\"property-recurrenceid\"></a> `recurrenceId?` | `string` \\| `null` | Provider recurrence identifier, when applicable. |\n| <a id=\"property-time\"></a> `time` | [`EventTime`](EventTime.md) | Instance time. |\n\n\n<!-- generated/email/types.gen/type-aliases/ConferenceProvider.md -->\n# Type Alias: ConferenceProvider\n\n> **ConferenceProvider** = `\"microsoft_teams\"` \\| `\"google_meet\"` \\| `\"other\"`\n\nThe conferencing system backing an event's join URL.\n\nCalendars can create Google Meet or Microsoft Teams according to their\ncapabilities. Imported third-party conferences are labeled separately.\nOmitting a conference change preserves the current conference; explicit\nchanges still require provider and calendar capability validation.\n\n\n<!-- generated/email/types.gen/type-aliases/ContactInfo.md -->\n# Type Alias: ContactInfo\n\n> **ContactInfo** = \\{ `email`: `string`; `name?`: `string` \\| `null`; `photo_url?`: `string` \\| `null`; \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-email\"></a> `email` | `string` |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` |\n| <a id=\"property-photo_url\"></a> `photo_url?` | `string` \\| `null` |\n\n\n<!-- generated/email/types.gen/type-aliases/ContactInfoLegacy.md -->\n# Type Alias: ContactInfoLegacy\n\n> **ContactInfoLegacy** = \\{ `email`: `string`; `email_address`: `string`; `name?`: `string` \\| `null`; `photo_url?`: `string` \\| `null`; \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-email\"></a> `email` | `string` |\n| <a id=\"property-email_address\"></a> `email_address` | `string` |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` |\n| <a id=\"property-photo_url\"></a> `photo_url?` | `string` \\| `null` |\n\n\n<!-- generated/email/types.gen/type-aliases/ContactInfoWithInteraction.md -->\n# Type Alias: ContactInfoWithInteraction\n\n> **ContactInfoWithInteraction** = [`ContactInfoLegacy`](ContactInfoLegacy.md) & \\{ `last_interaction`: `string`; \\}\n\n## Type Declaration\n\n| Name | Type |\n| ------ | ------ |\n| `last_interaction` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/EventReminderOverride.md -->\n# Type Alias: EventReminderOverride\n\n> **EventReminderOverride** = \\{ `method`: `string`; `minutes`: `number`; \\}\n\nOne reminder: how it alerts and how many minutes before the event start\n(before midnight in the calendar's zone for all-day events) it fires.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-method\"></a> `method` | `string` | Provider method, stored verbatim; only `popup` fires Macro notifications. |\n| <a id=\"property-minutes\"></a> `minutes` | `number` | Minutes before the event start. |\n\n\n<!-- generated/email/types.gen/type-aliases/EventReminders.md -->\n# Type Alias: EventReminders\n\n> **EventReminders** = \\{ `overrides?`: [`EventReminderOverride`](EventReminderOverride.md)[]; `useDefault`: `boolean`; \\}\n\nPer-user reminder configuration for an event, mirroring Google's model:\neither the calendar's default reminders apply, or the explicit overrides\nreplace them entirely.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-overrides\"></a> `overrides?` | [`EventReminderOverride`](EventReminderOverride.md)[] | Explicit reminders replacing the defaults when `use_default` is off. |\n| <a id=\"property-usedefault\"></a> `useDefault` | `boolean` | Whether the calendar's default reminders apply. |\n\n\n<!-- generated/email/types.gen/type-aliases/EventStatus.md -->\n# Type Alias: EventStatus\n\n> **EventStatus** = `\"confirmed\"` \\| `\"tentative\"` \\| `\"cancelled\"`\n\nCanonical event status.\n\n\n<!-- generated/email/types.gen/type-aliases/EventTime.md -->\n# Type Alias: EventTime\n\n> **EventTime** = \\{ `endsAt`: `string`; `kind`: `\"timed\"`; `startsAt`: `string`; `timeZone?`: `string` \\| `null`; \\} \\| \\{ `endDate`: `string`; `kind`: `\"allDay\"`; `startDate`: `string`; \\}\n\nThe mutually exclusive time shape of a calendar event.\n\nFields are renamed per variant rather than with `rename_all_fields`\nbecause utoipa only honors variant-level serde renames when it\nderives the OpenAPI schema.\n\n## Union Members\n\n### Type Literal\n\n\\{ `endsAt`: `string`; `kind`: `\"timed\"`; `startsAt`: `string`; `timeZone?`: `string` \\| `null`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `endsAt` | `string` | Exclusive end instant; equal to the start for an imported point event. |\n| `kind` | `\"timed\"` | - |\n| `startsAt` | `string` | Inclusive start instant. |\n| `timeZone?` | `string` \\| `null` | Original IANA time-zone identifier, when supplied. |\n\n***\n\n### Type Literal\n\n\\{ `endDate`: `string`; `kind`: `\"allDay\"`; `startDate`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `endDate` | `string` | Exclusive local end date. |\n| `kind` | `\"allDay\"` | - |\n| `startDate` | `string` | Inclusive local start date. |\n\n\n<!-- generated/email/types.gen/type-aliases/EventTransparency.md -->\n# Type Alias: EventTransparency\n\n> **EventTransparency** = `\"opaque\"` \\| `\"transparent\"`\n\nWhether an event blocks availability.\n\n\n<!-- generated/email/types.gen/type-aliases/EventType.md -->\n# Type Alias: EventType\n\n> **EventType** = `\"default\"` \\| `\"out_of_office\"` \\| `\"focus_time\"` \\| `\"working_location\"` \\| `\"birthday\"` \\| `\"from_gmail\"`\n\nGoogle's event type: ordinary meetings versus the status-style entries\n(working location, out of office, focus time, birthdays) Google renders\nand notifies differently. Immutable at the provider after creation.\n\n\n<!-- generated/email/types.gen/type-aliases/EventVisibility.md -->\n# Type Alias: EventVisibility\n\n> **EventVisibility** = `\"default\"` \\| `\"public\"` \\| `\"private\"` \\| `\"confidential\"`\n\nVisibility of event details.\n\n\n<!-- generated/email/types.gen/type-aliases/GetAttachmentResponse.md -->\n# Type Alias: GetAttachmentResponse\n\n> **GetAttachmentResponse** = \\{ `attachment`: [`Attachment`](Attachment.md); \\}\n\nThe response returned from the get attachment endpoint\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-attachment\"></a> `attachment` | [`Attachment`](Attachment.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/GetAttachmentResponses.md -->\n# Type Alias: GetAttachmentResponses\n\n> **GetAttachmentResponses** = \\{ `200`: [`GetAttachmentResponse`](GetAttachmentResponse.md); \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-200\"></a> `200` | [`GetAttachmentResponse`](GetAttachmentResponse.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/GetMessageResponses.md -->\n# Type Alias: GetMessageResponses\n\n> **GetMessageResponses** = \\{ `200`: [`ParsedMessage`](ParsedMessage.md); \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-200\"></a> `200` | [`ParsedMessage`](ParsedMessage.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/GuestPolicy.md -->\n# Type Alias: GuestPolicy\n\n> **GuestPolicy** = \\{ `canInviteOthers`: `boolean`; `canModify`: `boolean`; `canSeeOtherGuests`: `boolean`; \\}\n\nThe switches an organizer sets on an event to bound what its guests may\ndo. Google omits a switch from the payload while it holds its default.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-caninviteothers\"></a> `canInviteOthers` | `boolean` | Whether guests may invite others. |\n| <a id=\"property-canmodify\"></a> `canModify` | `boolean` | Whether guests may change the event, including its guest list. |\n| <a id=\"property-canseeotherguests\"></a> `canSeeOtherGuests` | `boolean` | Whether guests may see the guest list. |\n\n\n<!-- generated/email/types.gen/type-aliases/InvitationDateTime.md -->\n# Type Alias: InvitationDateTime\n\n> **InvitationDateTime** = \\{ `kind`: `\"date\"`; `value`: `string`; \\} \\| \\{ `kind`: `\"zoned\"`; `time_zone`: `string`; `value`: `string`; \\} \\| \\{ `kind`: `\"unresolved\"`; `time_zone?`: `string` \\| `null`; `value`: `string`; \\}\n\nPreserve date-only and unresolved times without manufacturing UTC instants.\n\n## Union Members\n\n### Type Literal\n\n\\{ `kind`: `\"date\"`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"date\"` | - |\n| `value` | `string` | ISO calendar date. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"zoned\"`; `time_zone`: `string`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"zoned\"` | - |\n| `time_zone` | `string` | IANA zone of the original TZID, or UTC. |\n| `value` | `string` | RFC3339 instant. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"unresolved\"`; `time_zone?`: `string` \\| `null`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"unresolved\"` | - |\n| `time_zone?` | `string` \\| `null` | Original TZID if present. |\n| `value` | `string` | ISO local wall time, without an offset. |\n\n\n<!-- generated/email/types.gen/type-aliases/InvitationMethod.md -->\n# Type Alias: InvitationMethod\n\n> **InvitationMethod** = `\"request\"` \\| `\"reply\"` \\| `\"cancel\"` \\| `\"counter\"` \\| `\"publish\"` \\| `\"unknown\"`\n\nOriginal scheduling method, including methods unsupported for actions.\n\n\n<!-- generated/email/types.gen/type-aliases/InvitationParticipant.md -->\n# Type Alias: InvitationParticipant\n\n> **InvitationParticipant** = \\{ `email`: `string`; `name?`: `string` \\| `null`; `participation_status?`: `string` \\| `null`; \\}\n\nScheduling participant; saved responses are historical, not current RSVP.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-email\"></a> `email` | `string` | Participant calendar address. |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` | Sender-supplied display name. |\n| <a id=\"property-participation_status\"></a> `participation_status?` | `string` \\| `null` | Original PARTSTAT, retaining extensions. |\n\n\n<!-- generated/email/types.gen/type-aliases/InvitationResolution.md -->\n# Type Alias: InvitationResolution\n\n> **InvitationResolution** = \\{ `kind`: `\"disconnected\"`; \\} \\| \\{ `kind`: `\"still_syncing\"`; \\} \\| \\{ `kind`: `\"cancelled\"`; \\} \\| \\{ `kind`: `\"unavailable\"`; \\} \\| \\{ `kind`: `\"no_match\"`; \\} \\| \\{ `kind`: `\"ambiguous\"`; \\} \\| \\{ `can_join`: `boolean`; `can_respond`: `boolean`; `event`: [`CalendarEvent`](CalendarEvent.md); `is_stale`: `boolean`; `kind`: `\"resolved\"`; `occurrence`: [`CalendarOccurrence`](CalendarOccurrence.md); `responding_email`: `string`; \\}\n\nRefreshable result, distinct from the immutable email contents.\n\n## Union Members\n\n### Type Literal\n\n\\{ `kind`: `\"disconnected\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"still_syncing\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"cancelled\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"unavailable\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"no_match\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"ambiguous\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `can_join`: `boolean`; `can_respond`: `boolean`; `event`: [`CalendarEvent`](CalendarEvent.md); `is_stale`: `boolean`; `kind`: `\"resolved\"`; `occurrence`: [`CalendarOccurrence`](CalendarOccurrence.md); `responding_email`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `can_join` | `boolean` | Whether the conference link belongs to the reconciled scheduling target. |\n| `can_respond` | `boolean` | Whether a response is currently allowed. |\n| `event` | [`CalendarEvent`](CalendarEvent.md) | Current occurrence-specific content. |\n| `is_stale` | `boolean` | Whether the provider projection trails the email revision. |\n| `kind` | `\"resolved\"` | - |\n| `occurrence` | [`CalendarOccurrence`](CalendarOccurrence.md) | Original occurrence identity and current time. |\n| `responding_email` | `string` | Connected address that would respond. |\n\n\n<!-- generated/email/types.gen/type-aliases/LabelInfo.md -->\n# Type Alias: LabelInfo\n\n> **LabelInfo** = \\{ `name`: `string`; `provider_id`: `string`; \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-name\"></a> `name` | `string` |\n| <a id=\"property-provider_id\"></a> `provider_id` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/Link.md -->\n# Type Alias: Link\n\n> **Link** = \\{ `calendar_disabled`: `boolean`; `created_at`: `string`; `email_address`: `string`; `fusionauth_user_id`: `string`; `has_calendar_data`: `boolean`; `id`: `string`; `is_primary`: `boolean`; `is_sync_active`: `boolean`; `macro_id`: `string`; `needs_calendar_permission`: `boolean`; `needs_reauth`: `boolean`; `photo_url?`: `string` \\| `null`; `provider`: [`UserProvider`](UserProvider.md); `settings`: [`Settings`](Settings.md); `sync_status`: [`SyncStatus`](SyncStatus.md); `updated_at`: `string`; \\}\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-calendar_disabled\"></a> `calendar_disabled` | `boolean` | Whether the user turned calendar off for this inbox, which also removed its calendar data. `needs_calendar_permission` is true either way, so this is what separates \"never granted\" from \"deliberately off\" — unprompted calendar nags must stay quiet for the latter. |\n| <a id=\"property-created_at\"></a> `created_at` | `string` | - |\n| <a id=\"property-email_address\"></a> `email_address` | `string` | - |\n| <a id=\"property-fusionauth_user_id\"></a> `fusionauth_user_id` | `string` | - |\n| <a id=\"property-has_calendar_data\"></a> `has_calendar_data` | `boolean` | Whether Macro holds calendar data for this inbox. Drives the turn-off control on its own, so removing that data never depends on the recorded scopes still matching the set Macro requests today — a set that changes as the integration narrows, stranding data behind a capability check that no longer recognizes an older grant. |\n| <a id=\"property-id\"></a> `id` | `string` | - |\n| <a id=\"property-is_primary\"></a> `is_primary` | `boolean` | - |\n| <a id=\"property-is_sync_active\"></a> `is_sync_active` | `boolean` | - |\n| <a id=\"property-macro_id\"></a> `macro_id` | `string` | - |\n| <a id=\"property-needs_calendar_permission\"></a> `needs_calendar_permission` | `boolean` | Whether the link's Google grant is missing the calendar scope. True for inboxes connected before the calendar capability existed (and for grants where the user declined it); drives the per-inbox calendar upgrade prompt. Re-running the connect flow records the new grant. |\n| <a id=\"property-needs_reauth\"></a> `needs_reauth` | `boolean` | Whether the link's Google grant needs to be reconnected. Drives the per-inbox reconnect prompt independently of the sync-status badge. |\n| <a id=\"property-photo_url\"></a> `photo_url?` | `string` \\| `null` | The inbox's own profile photo (its self-contact's SFS photo), if synced. |\n| <a id=\"property-provider\"></a> `provider` | [`UserProvider`](UserProvider.md) | - |\n| <a id=\"property-settings\"></a> `settings` | [`Settings`](Settings.md) | - |\n| <a id=\"property-sync_status\"></a> `sync_status` | [`SyncStatus`](SyncStatus.md) | - |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` | - |\n\n\n<!-- generated/email/types.gen/type-aliases/MailboxAction.md -->\n# Type Alias: MailboxAction\n\n> **MailboxAction** = \\{ `kind`: `\"read\"`; `value`: `boolean`; \\} \\| \\{ `kind`: `\"flagged\"`; `value`: `boolean`; \\} \\| \\{ `kind`: `\"archived\"`; `value`: `boolean`; \\} \\| \\{ `kind`: `\"trashed\"`; `value`: `boolean`; \\} \\| \\{ `kind`: `\"junk\"`; `value`: `boolean`; \\} \\| \\{ `kind`: `\"category\"`; `value`: \\{ `name`: `string`; `present`: `boolean`; \\}; \\}\n\nDesired organization state. Categories never stand in for folders or flags.\n\n## Union Members\n\n### Type Literal\n\n\\{ `kind`: `\"read\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"read\"` | - |\n| `value` | `boolean` | Mark correspondence read or unread. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"flagged\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"flagged\"` | - |\n| `value` | `boolean` | Set the follow-up star. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"archived\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"archived\"` | - |\n| `value` | `boolean` | Archive inbox messages, or restore received correspondence to the inbox. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"trashed\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"trashed\"` | - |\n| `value` | `boolean` | Move to recoverable trash, or restore correspondence to Inbox (drafts to Drafts). |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"junk\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"junk\"` | - |\n| `value` | `boolean` | Move to junk, or restore to the inbox. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"category\"`; `value`: \\{ `name`: `string`; `present`: `boolean`; \\}; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"category\"` | - |\n| `value` | \\{ `name`: `string`; `present`: `boolean`; \\} | Add/remove a category while preserving other provider assignments. |\n| `value.name` | `string` | - |\n| `value.present` | `boolean` | - |\n\n\n<!-- generated/email/types.gen/type-aliases/MailboxOperation.md -->\n# Type Alias: MailboxOperation\n\n> **MailboxOperation** = \\{ `action`: [`MailboxAction`](MailboxAction.md); `id`: `string`; `state`: [`MailboxOperationState`](MailboxOperationState.md); `updated_at`: `string`; \\}\n\nDurable outcome of an accepted organization action.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-action\"></a> `action` | [`MailboxAction`](MailboxAction.md) |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-state\"></a> `state` | [`MailboxOperationState`](MailboxOperationState.md) |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/MailboxOperationState.md -->\n# Type Alias: MailboxOperationState\n\n> **MailboxOperationState** = `\"pending\"` \\| `\"applied\"` \\| `\"failed\"` \\| `\"cancelled\"`\n\n\n<!-- generated/email/types.gen/type-aliases/MailboxSettingsChange.md -->\n# Type Alias: MailboxSettingsChange\n\n> **MailboxSettingsChange** = `\"create_label\"` \\| `\"delete_label\"` \\| `\"sender_block\"`\n\n\n<!-- generated/email/types.gen/type-aliases/MailboxSettingsOperation.md -->\n# Type Alias: MailboxSettingsOperation\n\n> **MailboxSettingsOperation** = \\{ `enabled`: `boolean`; `id`: `string`; `kind`: [`MailboxSettingsChange`](MailboxSettingsChange.md); `needs_attention`: `boolean`; `resource`: `string`; \\}\n\nAn accepted inbox configuration change awaiting provider confirmation.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-enabled\"></a> `enabled` | `boolean` |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-kind\"></a> `kind` | [`MailboxSettingsChange`](MailboxSettingsChange.md) |\n| <a id=\"property-needs_attention\"></a> `needs_attention` | `boolean` |\n| <a id=\"property-resource\"></a> `resource` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/MessageOperationResponse.md -->\n# Type Alias: MessageOperationResponse\n\n> **MessageOperationResponse** = \\{ `operation?`: `null` \\| [`ApiMessageOperation`](ApiMessageOperation.md); \\}\n\nAuthorized polling response. Gmail has no asynchronous draft operation.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-operation\"></a> `operation?` | `null` \\| [`ApiMessageOperation`](ApiMessageOperation.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/ParsedMessage.md -->\n# Type Alias: ParsedMessage\n\n> **ParsedMessage** = \\{ `bcc`: [`ContactInfo`](ContactInfo.md)[]; `body_parsed?`: `string` \\| `null`; `cc`: [`ContactInfo`](ContactInfo.md)[]; `db_id`: `string`; `from?`: `null` \\| [`ContactInfo`](ContactInfo.md); `internal_date_ts?`: `string` \\| `null`; `labels`: [`LabelInfo`](LabelInfo.md)[]; `link_id`: `string`; `subject?`: `string` \\| `null`; `thread_db_id`: `string`; `to`: [`ContactInfo`](ContactInfo.md)[]; \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc` | [`ContactInfo`](ContactInfo.md)[] |\n| <a id=\"property-body_parsed\"></a> `body_parsed?` | `string` \\| `null` |\n| <a id=\"property-cc\"></a> `cc` | [`ContactInfo`](ContactInfo.md)[] |\n| <a id=\"property-db_id\"></a> `db_id` | `string` |\n| <a id=\"property-from\"></a> `from?` | `null` \\| [`ContactInfo`](ContactInfo.md) |\n| <a id=\"property-internal_date_ts\"></a> `internal_date_ts?` | `string` \\| `null` |\n| <a id=\"property-labels\"></a> `labels` | [`LabelInfo`](LabelInfo.md)[] |\n| <a id=\"property-link_id\"></a> `link_id` | `string` |\n| <a id=\"property-subject\"></a> `subject?` | `string` \\| `null` |\n| <a id=\"property-thread_db_id\"></a> `thread_db_id` | `string` |\n| <a id=\"property-to\"></a> `to` | [`ContactInfo`](ContactInfo.md)[] |\n\n\n<!-- generated/email/types.gen/type-aliases/ResolveMessageOperationRequest.md -->\n# Type Alias: ResolveMessageOperationRequest\n\n> **ResolveMessageOperationRequest** = \\{ `accept_duplicate_risk?`: `boolean`; `action`: [`ApiMessageResolutionAction`](ApiMessageResolutionAction.md); `remote_version?`: `string` \\| `null`; `revision`: `string`; \\}\n\nStale versions fail without altering the current operation.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-accept_duplicate_risk\"></a> `accept_duplicate_risk?` | `boolean` |\n| <a id=\"property-action\"></a> `action` | [`ApiMessageResolutionAction`](ApiMessageResolutionAction.md) |\n| <a id=\"property-remote_version\"></a> `remote_version?` | `string` \\| `null` |\n| <a id=\"property-revision\"></a> `revision` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/Settings.md -->\n# Type Alias: Settings\n\n> **Settings** = \\{ `signature?`: `string` \\| `null`; `signature_on_replies_forwards?`: `boolean` \\| `null`; \\}\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-signature\"></a> `signature?` | `string` \\| `null` | The user's email signature content (HTML). On a patch, omit or send `null` to leave unchanged (both deserialize to `None`); pass an empty string to clear it. The column cannot be set to SQL NULL via patch. |\n| <a id=\"property-signature_on_replies_forwards\"></a> `signature_on_replies_forwards?` | `boolean` \\| `null` | - |\n\n\n<!-- generated/email/types.gen/type-aliases/SyncStatus.md -->\n# Type Alias: SyncStatus\n\n> **SyncStatus** = `\"SYNCING\"` \\| `\"UP_TO_DATE\"` \\| `\"ERROR\"` \\| `\"NEEDS_REAUTH\"` \\| `\"INACTIVE\"`\n\nCoarse sync state for an inbox, used to render a one-line hint in the\nmulti-inbox settings list. Derived from the link's `is_sync_active` flag, its\nreauth health, and its most recent backfill job.\n\n\n<!-- generated/email/types.gen/type-aliases/ThreadStateField.md -->\n# Type Alias: ThreadStateField\n\n> **ThreadStateField** = `\"read\"` \\| `\"starred\"` \\| `\"trashed\"` \\| `\"junk\"`\n\nSemantic mailbox facts, independent of folder/category names.\n\n\n<!-- generated/email/types.gen/type-aliases/TransferDraftRequest.md -->\n# Type Alias: TransferDraftRequest\n\n> **TransferDraftRequest** = \\{ `destination_link_id`: `string`; `operation_id`: `string`; \\}\n\nReuse the same operation ID when retrying after a lost response.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-destination_link_id\"></a> `destination_link_id` | `string` |\n| <a id=\"property-operation_id\"></a> `operation_id` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/TransferDraftResponse.md -->\n# Type Alias: TransferDraftResponse\n\n> **TransferDraftResponse** = \\{ `attachments`: [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[]; `message_id`: `string`; `source_id`: `string`; `source_thread_id`: `string`; `thread_id`: `string`; \\}\n\nA new identity prevents delayed writes from mutating the moved copy.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-attachments\"></a> `attachments` | [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[] |\n| <a id=\"property-message_id\"></a> `message_id` | `string` |\n| <a id=\"property-source_id\"></a> `source_id` | `string` |\n| <a id=\"property-source_thread_id\"></a> `source_thread_id` | `string` |\n| <a id=\"property-thread_id\"></a> `thread_id` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/TransferRecoveryResponse.md -->\n# Type Alias: TransferRecoveryResponse\n\n> **TransferRecoveryResponse** = \\{ `committed?`: `null` \\| [`TransferDraftResponse`](TransferDraftResponse.md); \\}\n\nA null result confirms that the move cannot commit, even if its request was delayed.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-committed\"></a> `committed?` | `null` \\| [`TransferDraftResponse`](TransferDraftResponse.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/UpdateThreadStateRequest.md -->\n# Type Alias: UpdateThreadStateRequest\n\n> **UpdateThreadStateRequest** = \\{ `field`: [`ThreadStateField`](ThreadStateField.md); `value`: `boolean`; \\}\n\nDesired state for every applicable message in an authorized thread.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-field\"></a> `field` | [`ThreadStateField`](ThreadStateField.md) |\n| <a id=\"property-value\"></a> `value` | `boolean` |\n\n\n<!-- generated/email/types.gen/type-aliases/UserProvider.md -->\n# Type Alias: UserProvider\n\n> **UserProvider** = `\"GMAIL\"` \\| `\"OUTLOOK\"`\n\n\n<!-- generated/email/types.gen/type-aliases/Value.md -->\n# Type Alias: Value\n\n> **Value** = `unknown`\n\n\n<!-- generated/email/types.gen/type-aliases/ViewerCapabilities.md -->\n# Type Alias: ViewerCapabilities\n\n> **ViewerCapabilities** = \\{ `editDetails`: `boolean`; `inviteGuests`: `boolean`; `removeGuests`: `boolean`; `rsvp`: `boolean`; `setGuestPolicy`: `boolean`; \\}\n\nWhat the viewing requester may do with an event.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-editdetails\"></a> `editDetails` | `boolean` | Change the event's details (title, time, description, conference). |\n| <a id=\"property-inviteguests\"></a> `inviteGuests` | `boolean` | Add guests. |\n| <a id=\"property-removeguests\"></a> `removeGuests` | `boolean` | Remove guests. |\n| <a id=\"property-rsvp\"></a> `rsvp` | `boolean` | Answer the invitation. |\n| <a id=\"property-setguestpolicy\"></a> `setGuestPolicy` | `boolean` | Change the event's guest policy. |\n\n\n<!-- generated/properties/types.gen/type-aliases/BulkUpdateEntityPropertyOptionsResponse.md -->\n# Type Alias: BulkUpdateEntityPropertyOptionsResponse\n\n> **BulkUpdateEntityPropertyOptionsResponse** = \\{ `properties`: [`EntityPropertyOptionSelectionResponse`](EntityPropertyOptionSelectionResponse.md)[]; \\}\n\nResponse for a bulk option update: each property's reconciled final ids.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-properties\"></a> `properties` | [`EntityPropertyOptionSelectionResponse`](EntityPropertyOptionSelectionResponse.md)[] | The final option ids per updated property. |\n\n\n<!-- generated/properties/types.gen/type-aliases/DataType.md -->\n# Type Alias: DataType\n\n> **DataType** = `\"BOOLEAN\"` \\| `\"DATE\"` \\| `\"NUMBER\"` \\| `\"STRING\"` \\| `\"SELECT_NUMBER\"` \\| `\"SELECT_STRING\"` \\| `\"TAG\"` \\| `\"ENTITY\"` \\| `\"LINK\"`\n\nData type for property values, determining storage and validation.\n\n\n<!-- generated/properties/types.gen/type-aliases/EntityProperty.md -->\n# Type Alias: EntityProperty\n\n> **EntityProperty** = \\{ `created_at`: `string`; `entity_id`: `string`; `entity_type`: [`EntityType`](EntityType.md); `id`: `string`; `property_definition_id`: `string`; `updated_at`: `string`; \\}\n\nAssignment of a property definition to a specific entity (service representation).\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` |\n| <a id=\"property-entity_id\"></a> `entity_id` | `string` |\n| <a id=\"property-entity_type\"></a> `entity_type` | [`EntityType`](EntityType.md) |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-property_definition_id\"></a> `property_definition_id` | `string` |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` |\n\n\n<!-- generated/properties/types.gen/type-aliases/EntityPropertyOptionSelectionResponse.md -->\n# Type Alias: EntityPropertyOptionSelectionResponse\n\n> **EntityPropertyOptionSelectionResponse** = \\{ `option_ids`: `string`[]; `property_id`: `string`; \\}\n\nThe reconciled final option ids stored for one property after a bulk update.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-option_ids\"></a> `option_ids` | `string`[] | The final option ids the server persisted, in stored order. |\n| <a id=\"property-property_id\"></a> `property_id` | `string` | The property definition the options belong to. |\n\n\n<!-- generated/properties/types.gen/type-aliases/EntityPropertyWithDefinition.md -->\n# Type Alias: EntityPropertyWithDefinition\n\n> **EntityPropertyWithDefinition** = \\{ `definition`: [`PropertyDefinition`](PropertyDefinition.md); `options?`: [`PropertyOption`](PropertyOption.md)[] \\| `null`; `property`: [`EntityProperty`](EntityProperty.md); `value?`: `null` \\| [`PropertyValue`](PropertyValue.md); \\}\n\nEntity property with its definition, value, and options (service representation).\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-definition\"></a> `definition` | [`PropertyDefinition`](PropertyDefinition.md) |\n| <a id=\"property-options\"></a> `options?` | [`PropertyOption`](PropertyOption.md)[] \\| `null` |\n| <a id=\"property-property\"></a> `property` | [`EntityProperty`](EntityProperty.md) |\n| <a id=\"property-value\"></a> `value?` | `null` \\| [`PropertyValue`](PropertyValue.md) |\n\n\n<!-- generated/properties/types.gen/type-aliases/EntityReference.md -->\n# Type Alias: EntityReference\n\n> **EntityReference** = \\{ `entity_id`: `string`; `entity_type`: [`EntityType`](EntityType.md); `specific_message_id?`: `string` \\| `null`; \\}\n\nEntity reference for entity-type property values.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-entity_id\"></a> `entity_id` | `string` | - |\n| <a id=\"property-entity_type\"></a> `entity_type` | [`EntityType`](EntityType.md) | - |\n| <a id=\"property-specific_message_id\"></a> `specific_message_id?` | `string` \\| `null` | For CHANNEL, CHAT, THREAD entity types - optional specific message ID. This allows referencing a specific message within a thread/channel/chat. |\n\n\n<!-- generated/properties/types.gen/type-aliases/EntityType.md -->\n# Type Alias: EntityType\n\n> **EntityType** = `\"CALENDAR_EVENT\"` \\| `\"CALL_RECORD\"` \\| `\"CHANNEL\"` \\| `\"CHAT\"` \\| `\"COMPANY\"` \\| `\"DATABASE_ROW\"` \\| `\"CONTACT\"` \\| `\"DOCUMENT\"` \\| `\"INITIATIVE\"` \\| `\"PROJECT\"` \\| `\"TASK\"` \\| `\"THREAD\"` \\| `\"USER\"`\n\nType of entity that can be referenced by entity properties.\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyDefinition.md -->\n# Type Alias: PropertyDefinition\n\n> **PropertyDefinition** = \\{ `created_at`: `string`; `data_type`: [`DataType`](DataType.md); `display_name`: `string`; `id`: `string`; `is_metadata`: `boolean`; `is_multi_select`: `boolean`; `is_system`: `boolean`; `owner`: [`PropertyOwner`](PropertyOwner.md); `specific_entity_type`: `null` \\| [`EntityType`](EntityType.md); `updated_at`: `string`; \\}\n\nProperty definition model (service representation).\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` | - |\n| <a id=\"property-data_type\"></a> `data_type` | [`DataType`](DataType.md) | - |\n| <a id=\"property-display_name\"></a> `display_name` | `string` | - |\n| <a id=\"property-id\"></a> `id` | `string` | - |\n| <a id=\"property-is_metadata\"></a> `is_metadata` | `boolean` | Flag to indicate if this is a system-generated metadata property. Not stored in database - computed at service layer. |\n| <a id=\"property-is_multi_select\"></a> `is_multi_select` | `boolean` | - |\n| <a id=\"property-is_system\"></a> `is_system` | `boolean` | Flag to indicate if this is a system property (stored in DB). |\n| <a id=\"property-owner\"></a> `owner` | [`PropertyOwner`](PropertyOwner.md) | - |\n| <a id=\"property-specific_entity_type\"></a> `specific_entity_type` | `null` \\| [`EntityType`](EntityType.md) | - |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` | - |\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyOption.md -->\n# Type Alias: PropertyOption\n\n> **PropertyOption** = \\{ `color`: `string` \\| `null`; `created_at`: `string`; `display_order`: `number`; `id`: `string`; `property_definition_id`: `string`; `updated_at`: `string`; `value`: [`PropertyOptionValue`](PropertyOptionValue.md); \\}\n\nA selectable option for select-type properties (service representation).\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-color\"></a> `color` | `string` \\| `null` |\n| <a id=\"property-created_at\"></a> `created_at` | `string` |\n| <a id=\"property-display_order\"></a> `display_order` | `number` |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-property_definition_id\"></a> `property_definition_id` | `string` |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` |\n| <a id=\"property-value\"></a> `value` | [`PropertyOptionValue`](PropertyOptionValue.md) |\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyOptionValue.md -->\n# Type Alias: PropertyOptionValue\n\n> **PropertyOptionValue** = \\{ `type`: `\"string\"`; `value`: `string`; \\} \\| \\{ `type`: `\"number\"`; `value`: `number`; \\}\n\nThe value of a property option - either a string or a number.\n\n## Union Members\n\n### Type Literal\n\n\\{ `type`: `\"string\"`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"string\"` | - |\n| `value` | `string` | String value for SelectString properties |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"number\"`; `value`: `number`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"number\"` | - |\n| `value` | `number` | Number value for SelectNumber properties |\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyOwner.md -->\n# Type Alias: PropertyOwner\n\n> **PropertyOwner** = \\{ `scope`: `\"user\"`; `user_id`: `string`; \\} \\| \\{ `scope`: `\"team\"`; `team_id`: `string`; \\} \\| \\{ `database_id`: `string`; `scope`: `\"database\"`; \\} \\| \\{ `scope`: `\"system\"`; \\}\n\nDefines who owns a property - user-scoped, team-scoped, database-scoped, or system.\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyTargetEntityType.md -->\n# Type Alias: PropertyTargetEntityType\n\n> **PropertyTargetEntityType** = `\"CALL_RECORD\"` \\| `\"CHANNEL\"` \\| `\"CHAT\"` \\| `\"COMPANY\"` \\| `\"DATABASE_ROW\"` \\| `\"DOCUMENT\"` \\| `\"INITIATIVE\"` \\| `\"PROJECT\"` \\| `\"THREAD\"` \\| `\"USER\"`\n\nCanonical type of an entity receiving properties.\n\nTasks are documents at API boundaries. `Task` intentionally does not exist\nhere; task classification is resolved by the properties domain from the\ndocument subtype.\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyTargetReference.md -->\n# Type Alias: PropertyTargetReference\n\n> **PropertyTargetReference** = \\{ `entity_id`: `string`; `entity_type`: [`PropertyTargetEntityType`](PropertyTargetEntityType.md); \\}\n\nCanonical reference to an entity receiving properties.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-entity_id\"></a> `entity_id` | `string` | Entity identifier. |\n| <a id=\"property-entity_type\"></a> `entity_type` | [`PropertyTargetEntityType`](PropertyTargetEntityType.md) | Canonical entity type. |\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyValue.md -->\n# Type Alias: PropertyValue\n\n> **PropertyValue** = \\{ `type`: `\"Boolean\"`; `value`: `boolean`; \\} \\| \\{ `type`: `\"Number\"`; `value`: `number`; \\} \\| \\{ `type`: `\"String\"`; `value`: `string`; \\} \\| \\{ `type`: `\"Date\"`; `value`: `string`; \\} \\| \\{ `type`: `\"SelectOption\"`; `value`: `string`[]; \\} \\| \\{ `type`: `\"EntityReference\"`; `value`: [`EntityReference`](EntityReference.md)[]; \\} \\| \\{ `type`: `\"Link\"`; `value`: `string`[]; \\}\n\nProperty value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to/from JSONB in the database.\n\n## Union Members\n\n### Type Literal\n\n\\{ `type`: `\"Boolean\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"Boolean\"` | - |\n| `value` | `boolean` | Boolean value Serializes as: {\"type\": \"Boolean\", \"value\": true} |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"Number\"`; `value`: `number`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"Number\"` | - |\n| `value` | `number` | Numeric value Serializes as: {\"type\": \"Number\", \"value\": 42.5} |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"String\"`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"String\"` | - |\n| `value` | `string` | String value Serializes as: {\"type\": \"String\", \"value\": \"text\"} |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"Date\"`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"Date\"` | - |\n| `value` | `string` | Date/timestamp value Serializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"} |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"SelectOption\"`; `value`: `string`[]; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"SelectOption\"` | - |\n| `value` | `string`[] | Select option(s) - always an array (check is_multi_select to determine if single or multi) Single-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1) Multi-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+) |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"EntityReference\"`; `value`: [`EntityReference`](EntityReference.md)[]; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"EntityReference\"` | - |\n| `value` | [`EntityReference`](EntityReference.md)[] | Entity reference(s) - always an array (check is_multi_select to determine if single or multi) Single-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1) Multi-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+) |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"Link\"`; `value`: `string`[]; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"Link\"` | - |\n| `value` | `string`[] | Link value(s) - always an array (check is_multi_select to determine if single or multi) Single-select: {\"type\": \"Link\", \"value\": [\"https://example.com\"]} (length 0 or 1) Multi-select: {\"type\": \"Link\", \"value\": [\"https://example.com\", \"https://other.com\"]} (length 0+) |\n\n\n<!-- generated/properties/types.gen/type-aliases/SetPropertyValue.md -->\n# Type Alias: SetPropertyValue\n\n> **SetPropertyValue** = \\{ `type`: `\"boolean\"`; `value`: `boolean`; \\} \\| \\{ `type`: `\"date\"`; `value`: `string`; \\} \\| \\{ `type`: `\"number\"`; `value`: `number`; \\} \\| \\{ `type`: `\"string\"`; `value`: `string`; \\} \\| \\{ `option_id`: `string`; `type`: `\"select_option\"`; \\} \\| \\{ `option_ids`: `string`[]; `type`: `\"multi_select_option\"`; \\} \\| \\{ `reference`: [`EntityReference`](EntityReference.md); `type`: `\"entity_reference\"`; \\} \\| \\{ `references`: [`EntityReference`](EntityReference.md)[]; `type`: `\"multi_entity_reference\"`; \\} \\| \\{ `type`: `\"link\"`; `url`: `string`; \\} \\| \\{ `type`: `\"multi_link\"`; `urls`: `string`[]; \\}\n\nType-safe enum for setting entity property values - provides compile-time validation.\n\n\n<!-- generated/storage/types.gen/type-aliases/AccessLevel.md -->\n# Type Alias: AccessLevel\n\n> **AccessLevel** = `\"view\"` \\| `\"comment\"` \\| `\"edit\"` \\| `\"owner\"`\n\nOrdered from least to most access top -> bottom\n\n\n<!-- generated/storage/types.gen/type-aliases/EmailFollowup.md -->\n# Type Alias: EmailFollowup\n\n> **EmailFollowup** = \\{ `condition`: [`EmailReminderCondition`](EmailReminderCondition.md); `linkId`: `string`; `remindAt`: `string`; `reminderId`: `string`; `revision`: `string`; `state`: [`FollowupState`](FollowupState.md); `threadId`: `string`; \\}\n\nPublic status shown on email and in the Reminders editor.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-condition\"></a> `condition` | [`EmailReminderCondition`](EmailReminderCondition.md) | Condition, defaulting to no reply for new follow-ups. |\n| <a id=\"property-linkid\"></a> `linkId` | `string` | Canonical owned/delegated inbox. |\n| <a id=\"property-remindat\"></a> `remindAt` | `string` | Confirmed schedule. |\n| <a id=\"property-reminderid\"></a> `reminderId` | `string` | Identity of the snooze and its delivery records. |\n| <a id=\"property-revision\"></a> `revision` | `string` | Last accepted operation; edits/removal compare this to prevent stale undo. |\n| <a id=\"property-state\"></a> `state` | [`FollowupState`](FollowupState.md) | Durable lifecycle progress. |\n| <a id=\"property-threadid\"></a> `threadId` | `string` | Conversation identity. |\n\n\n<!-- generated/storage/types.gen/type-aliases/EmailFollowupCommand.md -->\n# Type Alias: EmailFollowupCommand\n\n> **EmailFollowupCommand** = \\{ `condition`: [`EmailReminderCondition`](EmailReminderCondition.md); `expectedRevision?`: `string` \\| `null`; `operationId`: `string`; `remindAt`: `string`; `type`: `\"set\"`; \\} \\| \\{ `expectedRevision`: `string`; `operationId`: `string`; `type`: `\"remove\"`; `undo?`: `boolean`; \\}\n\nIdempotent email command. Reusing an operation ID with different data fails.\n\n## Union Members\n\n### Type Literal\n\n\\{ `condition`: [`EmailReminderCondition`](EmailReminderCondition.md); `expectedRevision?`: `string` \\| `null`; `operationId`: `string`; `remindAt`: `string`; `type`: `\"set\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `condition` | [`EmailReminderCondition`](EmailReminderCondition.md) | Reply condition. |\n| `expectedRevision?` | `string` \\| `null` | None for creation, the current revision for edits. |\n| `operationId` | `string` | Unique request identity retained across network retries. |\n| `remindAt` | `string` | One future instant; conditional recurrence is deliberately absent. |\n| `type` | `\"set\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `expectedRevision`: `string`; `operationId`: `string`; `type`: `\"remove\"`; `undo?`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `expectedRevision` | `string` | Reject removal if a newer edit has replaced this operation. |\n| `operationId` | `string` | Unique request identity. |\n| `type` | `\"remove\"` | - |\n| `undo?` | `boolean` | Undo restores original visibility; ordinary Remove returns to inbox. |\n\n\n<!-- generated/storage/types.gen/type-aliases/EmailFollowupResponse.md -->\n# Type Alias: EmailFollowupResponse\n\n> **EmailFollowupResponse** = \\{ `followup?`: `null` \\| [`EmailFollowup`](EmailFollowup.md); \\}\n\nLookup response, including an email with no follow-up yet.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-followup\"></a> `followup?` | `null` \\| [`EmailFollowup`](EmailFollowup.md) |\n\n\n<!-- generated/storage/types.gen/type-aliases/EmailReminderCondition.md -->\n# Type Alias: EmailReminderCondition\n\n> **EmailReminderCondition** = `\"if_no_reply\"` \\| `\"regardless\"`\n\nWhen an email follow-up should return the conversation.\n\n\n<!-- generated/storage/types.gen/type-aliases/EntityPermission.md -->\n# Type Alias: EntityPermission\n\n> **EntityPermission** = \\{ `access_level`: [`AccessLevel`](AccessLevel.md); `type`: `\"access_level\"`; \\} \\| \\{ `type`: `\"channel_view_only\"`; \\} \\| \\{ `role`: [`ParticipantRole`](ParticipantRole.md); `type`: `\"channel_role\"`; \\} \\| \\{ `role`: [`TeamRole`](TeamRole.md); `type`: `\"team_role\"`; \\}\n\nA user's permission for an entity, discriminated by entity kind.\n\nItems (documents, chats, projects, threads) use access levels.\nChannels use view-only permission or participant roles.\n\n## Union Members\n\n### Type Literal\n\n\\{ `access_level`: [`AccessLevel`](AccessLevel.md); `type`: `\"access_level\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `access_level` | [`AccessLevel`](AccessLevel.md) | The access level the user has. |\n| `type` | `\"access_level\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"channel_view_only\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `role`: [`ParticipantRole`](ParticipantRole.md); `type`: `\"channel_role\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `role` | [`ParticipantRole`](ParticipantRole.md) | The role the user has in the channel. |\n| `type` | `\"channel_role\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `role`: [`TeamRole`](TeamRole.md); `type`: `\"team_role\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `role` | [`TeamRole`](TeamRole.md) | The role the user has in the team. |\n| `type` | `\"team_role\"` | - |\n\n\n<!-- generated/storage/types.gen/type-aliases/FollowupState.md -->\n# Type Alias: FollowupState\n\n> **FollowupState** = `\"archiving\"` \\| `\"pending\"` \\| `\"returning\"` \\| `\"returned\"` \\| `\"cancelled\"` \\| `\"removed\"`\n\nDurable progress of an email operation.\n\n\n<!-- generated/storage/types.gen/type-aliases/ParticipantRole.md -->\n# Type Alias: ParticipantRole\n\n> **ParticipantRole** = `\"owner\"` \\| `\"admin\"` \\| `\"member\"`\n\nThe role a user has within a channel.\n\n\n<!-- generated/storage/types.gen/type-aliases/TeamRole.md -->\n# Type Alias: TeamRole\n\n> **TeamRole** = `\"member\"` \\| `\"admin\"` \\| `\"owner\"`\n\nThe role a user has within a team.\n\nOrdered least to most privileged so comparisons reflect access strength.\n\n\n<!-- src/entities/email/attachment/classes/EmailAttachment.md -->\n# Class: EmailAttachment\n\nA file attached to an email message. A thin handle keyed by attachment id;\nthe record loads lazily on first field access.\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`EmailAttachmentData`](../type-aliases/EmailAttachmentData.md)\\>\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-contentid\"></a> `contentId` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The attachment's Content-ID header value (for inline attachments). | - |\n| <a id=\"property-dataurl\"></a> `dataUrl` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | A URL to the attachment's raw data, when available. | - |\n| <a id=\"property-filename\"></a> `filename` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The attachment's original filename. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-mimetype\"></a> `mimeType` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The attachment's MIME type. | - |\n| <a id=\"property-sfsid\"></a> `sfsId` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The attachment's static-file-service id, when it has been stored there. | - |\n| <a id=\"property-size\"></a> `size` | `readonly` | () => `Promise`\\<`number` \\| `undefined`\\> | The attachment's size in bytes. | - |\n\n## Methods\n\n### toDocument()\n\n> **toDocument**(): `Promise`\\<[`Document`](../../../documents/document/classes/Document.md)\\>\n\nThe Macro document holding this attachment's content. Get-or-create: the\nserver returns the existing document's id, or downloads the attachment\nfrom the provider and uploads it as a new document first (deduplicated\nbehind a server-side lock).\n\n#### Returns\n\n`Promise`\\<[`Document`](../../../documents/document/classes/Document.md)\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`Attachment`](../../../../../generated/email/types.gen/type-aliases/Attachment.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`Attachment`](../../../../../generated/email/types.gen/type-aliases/Attachment.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`Attachment`](../../../../../generated/email/types.gen/type-aliases/Attachment.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `EmailAttachment`\n\nA handle to an attachment by id. Fields load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`EmailAttachment`\n\n***\n\n### from()\n\n> `static` **from**(`client`, `data`): `EmailAttachment`\n\nBuild an attachment from an already-fetched record (pre-seeded, no fetch).\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `data` | [`Attachment`](../../../../../generated/email/types.gen/type-aliases/Attachment.md) |\n\n#### Returns\n\n`EmailAttachment`\n\n\n<!-- src/entities/email/attachment/type-aliases/EmailAttachmentData.md -->\n# Type Alias: EmailAttachmentData\n\n> **EmailAttachmentData** = [`GetAttachmentResponses`](../../../../../generated/email/types.gen/type-aliases/GetAttachmentResponses.md)\\[`200`\\]\\[`\"attachment\"`\\]\n\nThe API's representation of an email attachment (`Attachment`).\n\n\n<!-- src/entities/email/draft/classes/DraftAttachment.md -->\n# Class: DraftAttachment\n\nAn uploaded or forwarded attachment belonging to a draft.\n\n## Properties\n\n| Property | Modifier | Type | Description |\n| ------ | ------ | ------ | ------ |\n| <a id=\"property-draft\"></a> `draft` | `readonly` | [`EmailDraft`](EmailDraft.md) | Parent draft. |\n| <a id=\"property-forwarded\"></a> `forwarded` | `readonly` | `boolean` | Whether this attachment was forwarded. |\n| <a id=\"property-id\"></a> `id` | `readonly` | `string` | Attachment identity. |\n\n## Methods\n\n### complete()\n\n> **complete**(): `Promise`\\<`void`\\>\n\nComplete verification after uploading the file.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### remove()\n\n> **remove**(): `Promise`\\<`void`\\>\n\nRemove this attachment from its draft.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `draftId`: `string`; `forwarded`: `boolean`; `id`: `string`; \\}\n\nSerialize identity without credentials.\n\n#### Returns\n\n\\{ `draftId`: `string`; `forwarded`: `boolean`; `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `draftId` | `string` |\n| `forwarded` | `boolean` |\n| `id` | `string` |\n\n***\n\n### byId()\n\n> `static` **byId**(`_client`, `draft`, `id`, `forwarded?`): `DraftAttachment`\n\nConstruct a draft scoped attachment handle.\n\n#### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `_client` | `MacroClient` | `undefined` |\n| `draft` | [`EmailDraft`](EmailDraft.md) | `undefined` |\n| `id` | `string` | `undefined` |\n| `forwarded?` | `boolean` | `false` |\n\n#### Returns\n\n`DraftAttachment`\n\n\n<!-- src/entities/email/draft/classes/EmailDraft.md -->\n# Class: EmailDraft\n\nA draft email. Sending remains an explicit separate operation.\n\n## Extends\n\n- [`EmailMessage`](../../message/classes/EmailMessage.md)\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The Bcc recipients. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`bcc`](../../message/classes/EmailMessage.md#property-bcc) |\n| <a id=\"property-body\"></a> `body` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The parsed message body, as the API returns it. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`body`](../../message/classes/EmailMessage.md#property-body) |\n| <a id=\"property-cc\"></a> `cc` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The Cc recipients. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`cc`](../../message/classes/EmailMessage.md#property-cc) |\n| <a id=\"property-from\"></a> `from` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md) \\| `undefined`\\> | The sender. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`from`](../../message/classes/EmailMessage.md#property-from) |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`EmailMessage`](../../message/classes/EmailMessage.md).[`id`](../../message/classes/EmailMessage.md#property-id) |\n| <a id=\"property-labels\"></a> `labels` | `readonly` | () => `Promise`\\<[`LabelInfo`](../../../../../generated/email/types.gen/type-aliases/LabelInfo.md)[]\\> | Labels on this message. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`labels`](../../message/classes/EmailMessage.md#property-labels) |\n| <a id=\"property-link\"></a> `link` | `readonly` | () => `Promise`\\<[`Link`](../../link/classes/Link.md)\\> | The inbox (email link) this message belongs to. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`link`](../../message/classes/EmailMessage.md#property-link) |\n| <a id=\"property-sentat\"></a> `sentAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The provider-internal date of the message. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`sentAt`](../../message/classes/EmailMessage.md#property-sentat) |\n| <a id=\"property-subject\"></a> `subject` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The message's subject line. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`subject`](../../message/classes/EmailMessage.md#property-subject) |\n| <a id=\"property-to\"></a> `to` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The To recipients. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`to`](../../message/classes/EmailMessage.md#property-to) |\n\n## Methods\n\n### addAttachment()\n\n> **addAttachment**(`options`): `Promise`\\<\\{ `attachment`: [`DraftAttachment`](DraftAttachment.md); `contentType`: `string`; `uploadUrl`: `string`; \\}\\>\n\nReserve an attachment upload. Upload to the returned URL, then call complete().\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | \\{ `fileName`: `string`; `sha`: `string`; `size`: `number`; `uploadId?`: `string`; \\} |\n| `options.fileName` | `string` |\n| `options.sha` | `string` |\n| `options.size` | `number` |\n| `options.uploadId?` | `string` |\n\n#### Returns\n\n`Promise`\\<\\{ `attachment`: [`DraftAttachment`](DraftAttachment.md); `contentType`: `string`; `uploadUrl`: `string`; \\}\\>\n\n***\n\n### addLabel()\n\n> **addLabel**(`label`): `Promise`\\<`void`\\>\n\nAdd a label to this message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`addLabel`](../../message/classes/EmailMessage.md#addlabel)\n\n***\n\n### completeDraftAttachment()\n\n> **completeDraftAttachment**(`attachmentId`): `Promise`\\<`void`\\>\n\nVerify an uploaded draft attachment before it can be sent.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attachmentId` | `string` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`completeDraftAttachment`](../../message/classes/EmailMessage.md#completedraftattachment)\n\n***\n\n### delete()\n\n> **delete**(): `Promise`\\<`void`\\>\n\nDelete the draft.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### forwardAttachment()\n\n> **forwardAttachment**(`attachment`): `Promise`\\<[`DraftAttachment`](DraftAttachment.md)\\>\n\nForward an existing attachment into this draft.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attachment` | [`EmailAttachment`](../../attachment/classes/EmailAttachment.md) |\n\n#### Returns\n\n`Promise`\\<[`DraftAttachment`](DraftAttachment.md)\\>\n\n***\n\n### operationStatus()\n\n> **operationStatus**(): `Promise`\\<[`MessageOperationResponse`](../../../../../generated/email/types.gen/type-aliases/MessageOperationResponse.md)\\>\n\nRead the draft's durable send, upload, or conflict status without retrying it.\n\n#### Returns\n\n`Promise`\\<[`MessageOperationResponse`](../../../../../generated/email/types.gen/type-aliases/MessageOperationResponse.md)\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`operationStatus`](../../message/classes/EmailMessage.md#operationstatus)\n\n***\n\n### removeAttachment()\n\n> **removeAttachment**(`attachment`): `Promise`\\<`void`\\>\n\nRemove a draft attachment.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attachment` | [`DraftAttachment`](DraftAttachment.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### removeLabel()\n\n> **removeLabel**(`label`): `Promise`\\<`void`\\>\n\nRemove a label from this message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`removeLabel`](../../message/classes/EmailMessage.md#removelabel)\n\n***\n\n### resolveOperation()\n\n> **resolveOperation**(`request`): `Promise`\\<`void`\\>\n\nResolve the displayed operation revision after the user chooses an action.\nRetrying an uncertain send requires explicit duplicate-risk acceptance.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `request` | [`ResolveMessageOperationRequest`](../../../../../generated/email/types.gen/type-aliases/ResolveMessageOperationRequest.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`resolveOperation`](../../message/classes/EmailMessage.md#resolveoperation)\n\n***\n\n### schedule()\n\n> **schedule**(`sendTime`, `options?`): `Promise`\\<`void`\\>\n\nSchedule this draft for sending.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `sendTime` | `string` |\n| `options?` | \\{ `includeSignature?`: `boolean`; \\} |\n| `options.includeSignature?` | `boolean` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### thread()\n\n> **thread**(): `Promise`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nThe thread this message belongs to.\n\n#### Returns\n\n`Promise`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`thread`](../../message/classes/EmailMessage.md#thread)\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`toJSON`](../../message/classes/EmailMessage.md#tojson)\n\n***\n\n### transferDraft()\n\n> **transferDraft**(`request`): `Promise`\\<[`TransferDraftResponse`](../../../../../generated/email/types.gen/type-aliases/TransferDraftResponse.md)\\>\n\nMove a draft to another inbox using a caller-persisted operation UUID.\nContinue editing the returned message_id; the original identity is retired.\nOn an interrupted response, use email.recoverDraftTransfer(operation_id).\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `request` | [`TransferDraftRequest`](../../../../../generated/email/types.gen/type-aliases/TransferDraftRequest.md) |\n\n#### Returns\n\n`Promise`\\<[`TransferDraftResponse`](../../../../../generated/email/types.gen/type-aliases/TransferDraftResponse.md)\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`transferDraft`](../../message/classes/EmailMessage.md#transferdraft)\n\n***\n\n### unschedule()\n\n> **unschedule**(): `Promise`\\<`void`\\>\n\nRemove a scheduled send.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### update()\n\n> **update**(`options`): `Promise`\\<`void`\\>\n\nReplace draft content without changing its identity or sending it.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`DraftOptions`](../type-aliases/DraftOptions.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### verifyAttachment()\n\n> **verifyAttachment**(`attachment`): `Promise`\\<`void`\\>\n\nComplete verification of an uploaded attachment.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attachment` | [`DraftAttachment`](DraftAttachment.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `EmailDraft`\n\nConstruct a lazy draft handle.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`EmailDraft`\n\n#### Overrides\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`byId`](../../message/classes/EmailMessage.md#byid)\n\n***\n\n### from()\n\n> `static` **from**(`client`, `data`): [`EmailMessage`](../../message/classes/EmailMessage.md)\n\nBuild a message from an already-fetched record (pre-seeded, no fetch).\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `data` | [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md) |\n\n#### Returns\n\n[`EmailMessage`](../../message/classes/EmailMessage.md)\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`from`](../../message/classes/EmailMessage.md#from)\n\n***\n\n### send()\n\n> `static` **send**(`client`, `opts`): `Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\nSend a new email message. Returns a handle when the API reports the created message's id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `opts` | [`SendEmailOptions`](../../message/interfaces/SendEmailOptions.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`send`](../../message/classes/EmailMessage.md#send)\n\n\n<!-- src/entities/email/draft/functions/draftBody.md -->\n# Function: draftBody()\n\n> **draftBody**(`options`): [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\n\nTranslate draft content to the generated contract.\n\n## Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`DraftOptions`](../type-aliases/DraftOptions.md) |\n\n## Returns\n\n[`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\n\n\n<!-- src/entities/email/draft/type-aliases/DraftOptions.md -->\n# Type Alias: DraftOptions\n\n> **DraftOptions** = `Omit`\\<[`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md), `\"db_id\"` \\| `\"provider_id\"` \\| `\"provider_thread_id\"` \\| `\"replying_to_id\"` \\| `\"thread_db_id\"` \\| `\"body_text\"` \\| `\"body_html\"` \\| `\"body_macro\"` \\| `\"headers_json\"` \\| `\"include_signature\"`\\> & \\{ `bodyHtml?`: `string`; `bodyMacro?`: `string`; `bodyText?`: `string`; `headers?`: [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\\[`\"headers_json\"`\\]; `includeSignature?`: `boolean`; `replyingTo?`: [`EmailMessage`](../../message/classes/EmailMessage.md); `thread?`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}\n\nDraft content; relationships use message and thread handles.\n\n## Type Declaration\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `bodyHtml?` | `string` | HTML body. |\n| `bodyMacro?` | `string` | Macro body. |\n| `bodyText?` | `string` | Plain text body. |\n| `headers?` | [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\\[`\"headers_json\"`\\] | Extra headers. |\n| `includeSignature?` | `boolean` | Include the inbox signature. |\n| `replyingTo?` | [`EmailMessage`](../../message/classes/EmailMessage.md) | Message being replied to. |\n| `thread?` | [`EmailThread`](../../thread/classes/EmailThread.md) | Thread receiving this draft. |\n\n\n<!-- src/entities/email/filter/classes/EmailFilter.md -->\n# Class: EmailFilter\n\nAn importance filter matched by sender address or domain.\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`ApiEmailFilter`](../../../../../generated/email/types.gen/type-aliases/ApiEmailFilter.md)\\>\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-emailaddress\"></a> `emailAddress` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | Matched address. | - |\n| <a id=\"property-emaildomain\"></a> `emailDomain` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | Matched domain. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-isimportant\"></a> `isImportant` | `readonly` | () => `Promise`\\<`boolean`\\> | Importance assigned by this filter. | - |\n\n## Methods\n\n### delete()\n\n> **delete**(): `Promise`\\<`void`\\>\n\nDelete this filter.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### setImportant()\n\n> **setImportant**(`isImportant`): `Promise`\\<`void`\\>\n\nChange the importance for the same sender selector.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `isImportant` | `boolean` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`ApiEmailFilter`](../../../../../generated/email/types.gen/type-aliases/ApiEmailFilter.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`ApiEmailFilter`](../../../../../generated/email/types.gen/type-aliases/ApiEmailFilter.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`ApiEmailFilter`](../../../../../generated/email/types.gen/type-aliases/ApiEmailFilter.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`, `inbox?`): `EmailFilter`\n\nConstruct a lazy filter handle.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`EmailFilter`\n\n***\n\n### from()\n\n> `static` **from**(`client`, `record`, `inbox?`): `EmailFilter`\n\nSeed from a server record.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `record` | [`ApiEmailFilter`](../../../../../generated/email/types.gen/type-aliases/ApiEmailFilter.md) |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`EmailFilter`\n\n\n<!-- src/entities/email/filter/interfaces/EmailFilterOptions.md -->\n# Interface: EmailFilterOptions\n\nSender importance rule.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-emailaddress\"></a> `emailAddress?` | `string` | Match an address. |\n| <a id=\"property-emaildomain\"></a> `emailDomain?` | `string` | Match a domain. |\n| <a id=\"property-isimportant\"></a> `isImportant` | `boolean` | Whether matches are important. |\n\n\n<!-- src/entities/email/label/classes/Label.md -->\n# Class: Label\n\nAn email label. A free-to-construct handle: there is no single-label GET,\nso the detail record loads lazily on first field access by listing all\nlabels and finding this one (mirroring Link).\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`ApiLabel`](../../../../../generated/email/types.gen/type-aliases/ApiLabel.md)\\>\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-createdat\"></a> `createdAt` | `readonly` | () => `Promise`\\<`string`\\> | When the label was created. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-labellistvisibility\"></a> `labelListVisibility` | `readonly` | () => `Promise`\\<[`ApiLabelListVisibility`](../../../../../generated/email/types.gen/type-aliases/ApiLabelListVisibility.md)\\> | Whether the label is shown in the label list. | - |\n| <a id=\"property-linkid\"></a> `linkId` | `readonly` | () => `Promise`\\<`string`\\> | The inbox (email link) this label belongs to. | - |\n| <a id=\"property-messagelistvisibility\"></a> `messageListVisibility` | `readonly` | () => `Promise`\\<[`ApiMessageListVisibility`](../../../../../generated/email/types.gen/type-aliases/ApiMessageListVisibility.md)\\> | Whether the label is shown in the message list. | - |\n| <a id=\"property-name\"></a> `name` | `readonly` | () => `Promise`\\<`string`\\> | The label's display name. | - |\n| <a id=\"property-type\"></a> `type` | `readonly` | () => `Promise`\\<[`ApiLabelType`](../../../../../generated/email/types.gen/type-aliases/ApiLabelType.md)\\> | Whether this is a system label or a user-created one. | - |\n\n## Methods\n\n### delete()\n\n> **delete**(): `Promise`\\<`void`\\>\n\nDelete this label.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`ApiLabel`](../../../../../generated/email/types.gen/type-aliases/ApiLabel.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`ApiLabel`](../../../../../generated/email/types.gen/type-aliases/ApiLabel.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`ApiLabel`](../../../../../generated/email/types.gen/type-aliases/ApiLabel.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `Label`\n\nA handle to a label by id. Details load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`Label`\n\n***\n\n### create()\n\n> `static` **create**(`client`, `name`): `Promise`\\<`Label`\\>\n\nCreate a user label.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `name` | `string` |\n\n#### Returns\n\n`Promise`\\<`Label`\\>\n\n***\n\n### list()\n\n> `static` **list**(`client`): `Promise`\\<`Label`[]\\>\n\nAll labels across the user's inboxes.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n\n#### Returns\n\n`Promise`\\<`Label`[]\\>\n\n\n<!-- src/entities/email/link/classes/Link.md -->\n# Class: Link\n\nAn email link: a connected inbox (e.g. Gmail or Outlook) that threads and\nmessages sync through. A free-to-construct handle, resolved from the\ncaller's connected links.\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`Link`](../../../../../generated/email/types.gen/type-aliases/Link.md)\\>\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-emailaddress\"></a> `emailAddress` | `readonly` | () => `Promise`\\<`string`\\> | The inbox's email address. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-isprimary\"></a> `isPrimary` | `readonly` | () => `Promise`\\<`boolean`\\> | Whether this is the user's primary inbox. | - |\n| <a id=\"property-issyncactive\"></a> `isSyncActive` | `readonly` | () => `Promise`\\<`boolean`\\> | Whether syncing is currently active for this inbox. | - |\n| <a id=\"property-needsreauth\"></a> `needsReauth` | `readonly` | () => `Promise`\\<`boolean`\\> | Whether the inbox needs to be re-authenticated. | - |\n| <a id=\"property-photourl\"></a> `photoUrl` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The inbox's avatar URL, if any. | - |\n| <a id=\"property-provider\"></a> `provider` | `readonly` | () => `Promise`\\<[`UserProvider`](../../../../../generated/email/types.gen/type-aliases/UserProvider.md)\\> | The email provider (e.g. `GMAIL` or `OUTLOOK`). | - |\n| <a id=\"property-syncstatus\"></a> `syncStatus` | `readonly` | () => `Promise`\\<[`SyncStatus`](../../../../../generated/email/types.gen/type-aliases/SyncStatus.md)\\> | The inbox's sync status. | - |\n\n## Methods\n\n### settingsOperations()\n\n> **settingsOperations**(): `Promise`\\<[`MailboxSettingsOperation`](../../../../../generated/email/types.gen/type-aliases/MailboxSettingsOperation.md)[]\\>\n\nRead category and sender-policy changes for this inbox.\n\n#### Returns\n\n`Promise`\\<[`MailboxSettingsOperation`](../../../../../generated/email/types.gen/type-aliases/MailboxSettingsOperation.md)[]\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`Link`](../../../../../generated/email/types.gen/type-aliases/Link.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`Link`](../../../../../generated/email/types.gen/type-aliases/Link.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`Link`](../../../../../generated/email/types.gen/type-aliases/Link.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `Link`\n\nA handle to an email link by id. Details load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`Link`\n\n***\n\n### list()\n\n> `static` **list**(`client`): `Promise`\\<`Link`[]\\>\n\nThe caller's connected email links.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n\n#### Returns\n\n`Promise`\\<`Link`[]\\>\n\n\n<!-- src/entities/email/message/classes/EmailMessage.md -->\n# Class: EmailMessage\n\nA message in an email thread. A thin handle keyed by message id; the\nrecord loads lazily on first field access.\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`EmailMessageData`](../type-aliases/EmailMessageData.md)\\>\n\n## Extended by\n\n- [`EmailDraft`](../../draft/classes/EmailDraft.md)\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The Bcc recipients. | - |\n| <a id=\"property-body\"></a> `body` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The parsed message body, as the API returns it. | - |\n| <a id=\"property-cc\"></a> `cc` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The Cc recipients. | - |\n| <a id=\"property-from\"></a> `from` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md) \\| `undefined`\\> | The sender. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-labels\"></a> `labels` | `readonly` | () => `Promise`\\<[`LabelInfo`](../../../../../generated/email/types.gen/type-aliases/LabelInfo.md)[]\\> | Labels on this message. | - |\n| <a id=\"property-link\"></a> `link` | `readonly` | () => `Promise`\\<[`Link`](../../link/classes/Link.md)\\> | The inbox (email link) this message belongs to. | - |\n| <a id=\"property-sentat\"></a> `sentAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The provider-internal date of the message. | - |\n| <a id=\"property-subject\"></a> `subject` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The message's subject line. | - |\n| <a id=\"property-to\"></a> `to` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The To recipients. | - |\n\n## Methods\n\n### addLabel()\n\n> **addLabel**(`label`): `Promise`\\<`void`\\>\n\nAdd a label to this message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### completeDraftAttachment()\n\n> **completeDraftAttachment**(`attachmentId`): `Promise`\\<`void`\\>\n\nVerify an uploaded draft attachment before it can be sent.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attachmentId` | `string` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### operationStatus()\n\n> **operationStatus**(): `Promise`\\<[`MessageOperationResponse`](../../../../../generated/email/types.gen/type-aliases/MessageOperationResponse.md)\\>\n\nRead the draft's durable send, upload, or conflict status without retrying it.\n\n#### Returns\n\n`Promise`\\<[`MessageOperationResponse`](../../../../../generated/email/types.gen/type-aliases/MessageOperationResponse.md)\\>\n\n***\n\n### removeLabel()\n\n> **removeLabel**(`label`): `Promise`\\<`void`\\>\n\nRemove a label from this message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### resolveOperation()\n\n> **resolveOperation**(`request`): `Promise`\\<`void`\\>\n\nResolve the displayed operation revision after the user chooses an action.\nRetrying an uncertain send requires explicit duplicate-risk acceptance.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `request` | [`ResolveMessageOperationRequest`](../../../../../generated/email/types.gen/type-aliases/ResolveMessageOperationRequest.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### thread()\n\n> **thread**(): `Promise`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nThe thread this message belongs to.\n\n#### Returns\n\n`Promise`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### transferDraft()\n\n> **transferDraft**(`request`): `Promise`\\<[`TransferDraftResponse`](../../../../../generated/email/types.gen/type-aliases/TransferDraftResponse.md)\\>\n\nMove a draft to another inbox using a caller-persisted operation UUID.\nContinue editing the returned message_id; the original identity is retired.\nOn an interrupted response, use email.recoverDraftTransfer(operation_id).\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `request` | [`TransferDraftRequest`](../../../../../generated/email/types.gen/type-aliases/TransferDraftRequest.md) |\n\n#### Returns\n\n`Promise`\\<[`TransferDraftResponse`](../../../../../generated/email/types.gen/type-aliases/TransferDraftResponse.md)\\>\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `EmailMessage`\n\nA handle to a message by id. Fields load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`EmailMessage`\n\n***\n\n### from()\n\n> `static` **from**(`client`, `data`): `EmailMessage`\n\nBuild a message from an already-fetched record (pre-seeded, no fetch).\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `data` | [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md) |\n\n#### Returns\n\n`EmailMessage`\n\n***\n\n### send()\n\n> `static` **send**(`client`, `opts`): `Promise`\\<`EmailMessage` \\| `undefined`\\>\n\nSend a new email message. Returns a handle when the API reports the created message's id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `opts` | [`SendEmailOptions`](../interfaces/SendEmailOptions.md) |\n\n#### Returns\n\n`Promise`\\<`EmailMessage` \\| `undefined`\\>\n\n\n<!-- src/entities/email/message/interfaces/SendEmailOptions.md -->\n# Interface: SendEmailOptions\n\nOptions for sending a fresh email message.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Bcc recipients. |\n| <a id=\"property-bodytext\"></a> `bodyText` | `string` | Plain-text body. |\n| <a id=\"property-cc\"></a> `cc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Cc recipients. |\n| <a id=\"property-subject\"></a> `subject` | `string` | Subject line. |\n| <a id=\"property-to\"></a> `to` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Recipients. |\n\n\n<!-- src/entities/email/message/type-aliases/EmailMessageData.md -->\n# Type Alias: EmailMessageData\n\n> **EmailMessageData** = [`GetMessageResponses`](../../../../../generated/email/types.gen/type-aliases/GetMessageResponses.md)\\[`200`\\]\n\nThe API's representation of an email message (`ParsedMessage`).\n\n\n<!-- src/entities/email/namespace/classes/EmailNamespace.md -->\n# Class: EmailNamespace\n\n## Constructors\n\n### Constructor\n\n> **new EmailNamespace**(`client`): `EmailNamespace`\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n\n#### Returns\n\n`EmailNamespace`\n\n## Methods\n\n### attachment()\n\n> **attachment**(`id`): [`EmailAttachment`](../../attachment/classes/EmailAttachment.md)\n\nA handle to an email attachment by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailAttachment`](../../attachment/classes/EmailAttachment.md)\n\n***\n\n### blockedSenders()\n\n> **blockedSenders**(): `Promise`\\<`string`[]\\>\n\nThe email addresses currently blocked.\n\n#### Returns\n\n`Promise`\\<`string`[]\\>\n\n***\n\n### blockSender()\n\n> **blockSender**(`email`): `Promise`\\<`void`\\>\n\nBlock an email sender.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `email` | `string` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### byId()\n\n> **byId**(`id`): [`EmailThread`](../../thread/classes/EmailThread.md)\n\nA handle to an email thread by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailThread`](../../thread/classes/EmailThread.md)\n\n***\n\n### connectionProviders()\n\n> **connectionProviders**(): `Promise`\\<[`EmailConnectionProviders`](../../../../../generated/auth/types.gen/type-aliases/EmailConnectionProviders.md)\\>\n\nProviders the server currently permits this caller to connect.\n\n#### Returns\n\n`Promise`\\<[`EmailConnectionProviders`](../../../../../generated/auth/types.gen/type-aliases/EmailConnectionProviders.md)\\>\n\n***\n\n### contacts()\n\n> **contacts**(): `Promise`\\<\\{\\[`key`: `string`\\]: [`ContactInfoWithInteraction`](../../../../../generated/email/types.gen/type-aliases/ContactInfoWithInteraction.md)[]; \\}\\>\n\nAddress book contacts grouped by the service's interaction buckets.\n\n#### Returns\n\n`Promise`\\<\\{\\[`key`: `string`\\]: [`ContactInfoWithInteraction`](../../../../../generated/email/types.gen/type-aliases/ContactInfoWithInteraction.md)[]; \\}\\>\n\n***\n\n### createDraft()\n\n> **createDraft**(`options`, `inbox?`): `Promise`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\nCreate a draft without sending it; the inbox defaults to the caller's primary.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`DraftOptions`](../../draft/type-aliases/DraftOptions.md) |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\n***\n\n### createLabel()\n\n> **createLabel**(`name`): `Promise`\\<[`Label`](../../label/classes/Label.md)\\>\n\nCreate a user label. Returns the created label.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `name` | `string` |\n\n#### Returns\n\n`Promise`\\<[`Label`](../../label/classes/Label.md)\\>\n\n***\n\n### deleteLabel()\n\n> **deleteLabel**(`label`): `Promise`\\<`void`\\>\n\nDelete a label.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### draftById()\n\n> **draftById**(`id`): [`EmailDraft`](../../draft/classes/EmailDraft.md)\n\nConstruct a lazy draft handle.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailDraft`](../../draft/classes/EmailDraft.md)\n\n***\n\n### filters()\n\n> **filters**(`inbox?`): `Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)[]\\>\n\nImportance filters.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)[]\\>\n\n***\n\n### inbox()\n\n> **inbox**(`opts?`): `AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nThe threads in the inbox, most recent first, auto-paginated.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts?` | [`InboxOptions`](../interfaces/InboxOptions.md) |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n***\n\n### label()\n\n> **label**(`id`): [`Label`](../../label/classes/Label.md)\n\nA handle to a label by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`Label`](../../label/classes/Label.md)\n\n***\n\n### labels()\n\n> **labels**(): `Promise`\\<[`Label`](../../label/classes/Label.md)[]\\>\n\nAll labels across the user's inboxes.\n\n#### Returns\n\n`Promise`\\<[`Label`](../../label/classes/Label.md)[]\\>\n\n***\n\n### link()\n\n> **link**(`id`): [`Link`](../../link/classes/Link.md)\n\nA handle to a connected inbox (email link) by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`Link`](../../link/classes/Link.md)\n\n***\n\n### links()\n\n> **links**(): `Promise`\\<[`Link`](../../link/classes/Link.md)[]\\>\n\nThe caller's connected inboxes (email links).\n\n#### Returns\n\n`Promise`\\<[`Link`](../../link/classes/Link.md)[]\\>\n\n***\n\n### message()\n\n> **message**(`id`): [`EmailMessage`](../../message/classes/EmailMessage.md)\n\nA handle to an email message by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailMessage`](../../message/classes/EmailMessage.md)\n\n***\n\n### recoverDraftTransfer()\n\n> **recoverDraftTransfer**(`operationId`): `Promise`\\<[`TransferRecoveryResponse`](../../../../../generated/email/types.gen/type-aliases/TransferRecoveryResponse.md)\\>\n\nRecover a draft move using its original operation UUID; never starts a new move.\nAn empty committed result fences the old move so it cannot commit later.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `operationId` | `string` |\n\n#### Returns\n\n`Promise`\\<[`TransferRecoveryResponse`](../../../../../generated/email/types.gen/type-aliases/TransferRecoveryResponse.md)\\>\n\n***\n\n### reminders()\n\n> **reminders**(`options?`): `AsyncGenerator`\\<\\{ `followup`: [`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md); `thread`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}, `any`, `any`\\>\n\nFollow-up reminders with thread handles, automatically paginated.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `Omit`\\<\\{ `attachments?`: `string`[] \\| `null`; `calendar?`: `boolean` \\| `null`; `cursor?`: `string` \\| `null`; `done?`: `boolean` \\| `null`; `inboxIds?`: `string`[] \\| `null`; `limit?`: `number` \\| `null`; `noInboxes?`: `boolean` \\| `null`; `read?`: `boolean` \\| `null`; `tags?`: `string`[] \\| `null`; \\}, `\"cursor\"` \\| `\"inboxIds\"`\\> & \\{ `inboxes?`: [`Link`](../../link/classes/Link.md)[]; \\} |\n\n#### Returns\n\n`AsyncGenerator`\\<\\{ `followup`: [`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md); `thread`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}, `any`, `any`\\>\n\n***\n\n### scheduled()\n\n> **scheduled**(`options?`): `AsyncGenerator`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\nScheduled drafts, fetched lazily in bounded pages.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | \\{ `inbox?`: [`Link`](../../link/classes/Link.md); `pageSize?`: `number`; \\} |\n| `options.inbox?` | [`Link`](../../link/classes/Link.md) |\n| `options.pageSize?` | `number` |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\n***\n\n### search()\n\n> **search**(`query`, `opts?`): `AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nSearch email threads by subject and content.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `query` | `string` |\n| `opts?` | [`SearchOpts`](../../../search/interfaces/SearchOpts.md) |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n***\n\n### send()\n\n> **send**(`opts`): `Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\nSend a new email message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`SendEmailOptions`](../../message/interfaces/SendEmailOptions.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\n***\n\n### unblockSender()\n\n> **unblockSender**(`email`): `Promise`\\<`void`\\>\n\nUnblock a previously blocked sender.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `email` | `string` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### upsertFilter()\n\n> **upsertFilter**(`options`, `inbox?`): `Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)\\>\n\nCreate or replace a filter matching an address or domain.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`EmailFilterOptions`](../../filter/interfaces/EmailFilterOptions.md) |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)\\>\n\n\n<!-- src/entities/email/namespace/interfaces/InboxOptions.md -->\n# Interface: InboxOptions\n\nOptions for listing inbox threads.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-pagesize\"></a> `pageSize?` | `number` | Page size (default 20, max 500). |\n| <a id=\"property-sort\"></a> `sort?` | [`ApiSortMethod`](../../../../../generated/email/types.gen/type-aliases/ApiSortMethod.md) | Sort order. Defaults to `viewed_updated`. |\n\n\n<!-- src/entities/email/thread/classes/EmailThread.md -->\n# Class: EmailThread\n\nAn email thread. A free-to-construct handle: the detail record (including\nup to the first 100 messages) loads lazily on first field access.\n\n## Extends\n\n- [`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md)\\<`ThreadDetail`\\>\n\n## Properties\n\n| Property | Modifier | Type | Default value | Description | Overrides | Inherited from |\n| ------ | ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-access\"></a> `access` | `readonly` | [`EntityAccess`](../../../sharing/access/classes/EntityAccess.md) | `...` | Access requests and direct user grants. | - | - |\n| <a id=\"property-accesslevel\"></a> `accessLevel` | `readonly` | () => `Promise`\\<[`AccessLevel`](../../../../../generated/email/types.gen/type-aliases/AccessLevel.md)\\> | `...` | The viewer's access level to this thread. | - | - |\n| <a id=\"property-createdat\"></a> `createdAt` | `readonly` | () => `Promise`\\<`string`\\> | `...` | When the thread was created. | - | - |\n| <a id=\"property-entitytype\"></a> `entityType` | `readonly` | `\"email_thread\"` | `'email_thread'` | Favorites identify email threads as `email_thread`. | [`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`entityType`](../../../entity/classes/PropertiedEntity.md#property-entitytype) | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | `undefined` | - | - | [`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`id`](../../../entity/classes/PropertiedEntity.md#property-id) |\n| <a id=\"property-inboxvisible\"></a> `inboxVisible` | `readonly` | () => `Promise`\\<`boolean`\\> | `...` | Whether the thread is visible in the inbox (i.e. not archived). | - | - |\n| <a id=\"property-isread\"></a> `isRead` | `readonly` | () => `Promise`\\<`boolean`\\> | `...` | Whether the thread has been read. | - | - |\n| <a id=\"property-latestinboundat\"></a> `latestInboundAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | Timestamp of the latest inbound message, if any. | - | - |\n| <a id=\"property-latestnonspamat\"></a> `latestNonSpamAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | Timestamp of the latest non-spam message, if any. | - | - |\n| <a id=\"property-latestoutboundat\"></a> `latestOutboundAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | Timestamp of the latest outbound message, if any. | - | - |\n| <a id=\"property-link\"></a> `link` | `readonly` | () => `Promise`\\<[`Link`](../../link/classes/Link.md)\\> | `...` | The inbox (email link) that owns this thread. | - | - |\n| <a id=\"property-project\"></a> `project` | `readonly` | () => `Promise`\\<[`Project`](../../../projects/project/classes/Project.md) \\| `undefined`\\> | `...` | The project this thread is attached to, if any. | - | - |\n| <a id=\"property-providerid\"></a> `providerId` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | The provider-internal thread id (e.g. Gmail/Outlook), if any. | - | - |\n| <a id=\"property-updatedat\"></a> `updatedAt` | `readonly` | () => `Promise`\\<`string`\\> | `...` | When the thread was last updated. | - | - |\n| <a id=\"property-search\"></a> `search` | `static` | (`client`, `query`, `searchOpts?`) => `AsyncGenerator`\\<`EmailThread`\\> | `...` | Search email threads by subject and content, most relevant first, auto-paginated. | - | - |\n\n## Methods\n\n### addLabel()\n\n> **addLabel**(`label`): `Promise`\\<`void`\\>\n\nAdd a label to every message in the thread.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### archive()\n\n> **archive**(`archived?`): `Promise`\\<`void`\\>\n\nArchive the thread (or unarchive with `false`).\n\n#### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `archived?` | `boolean` | `true` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### attachments()\n\n> **attachments**(): `Promise`\\<[`EmailAttachment`](../../attachment/classes/EmailAttachment.md)[]\\>\n\nThe attachments across this thread's first 100 messages, pre-seeded from the thread detail.\n\n#### Returns\n\n`Promise`\\<[`EmailAttachment`](../../attachment/classes/EmailAttachment.md)[]\\>\n\n***\n\n### calendarInvitations()\n\n> **calendarInvitations**(): `Promise`\\<\\{\\[`key`: `string`\\]: [`InvitationResolution`](../../../../../generated/email/types.gen/type-aliases/InvitationResolution.md); \\}\\>\n\nCalendar invitations resolved from this thread's messages.\n\n#### Returns\n\n`Promise`\\<\\{\\[`key`: `string`\\]: [`InvitationResolution`](../../../../../generated/email/types.gen/type-aliases/InvitationResolution.md); \\}\\>\n\n***\n\n### deleteProperty()\n\n> **deleteProperty**(`assignment`): `Promise`\\<`void`\\>\n\nRemove a property from this entity, given its [properties](#properties) entry.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `assignment` | [`EntityPropertyWithDefinition`](../../../../../generated/properties/types.gen/type-aliases/EntityPropertyWithDefinition.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`deleteProperty`](../../../entity/classes/PropertiedEntity.md#deleteproperty)\n\n***\n\n### favorite()\n\n> **favorite**(): `Promise`\\<`EmailThread`\\>\n\nAdd this entity to the user's favorites. Returns this handle for chaining.\nPlain unwrap: favoriting alters the user's favorites collection, not this\nentity's own detail, so there's nothing cached to invalidate.\n\n#### Returns\n\n`Promise`\\<`EmailThread`\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`favorite`](../../../entity/classes/PropertiedEntity.md#favorite)\n\n***\n\n### followup()\n\n> **followup**(): `Promise`\\<[`EmailFollowupResponse`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowupResponse.md)\\>\n\nRead follow-up state for this thread.\n\n#### Returns\n\n`Promise`\\<[`EmailFollowupResponse`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowupResponse.md)\\>\n\n***\n\n### markSeen()\n\n> **markSeen**(): `Promise`\\<`void`\\>\n\nMark the thread as seen.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### messages()\n\n> **messages**(`opts?`): `Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md)[]\\>\n\nThe messages in this thread, pre-seeded from the list endpoint.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts?` | \\{ `limit?`: `number`; `since?`: `string`; \\} |\n| `opts.limit?` | `number` |\n| `opts.since?` | `string` |\n\n#### Returns\n\n`Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md)[]\\>\n\n***\n\n### moveToProject()\n\n> **moveToProject**(`project`): `Promise`\\<`void`\\>\n\nAttach the thread to a project, or clear the project with `null`.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `project` | [`Project`](../../../projects/project/classes/Project.md) \\| `null` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### operations()\n\n> **operations**(): `Promise`\\<[`MailboxOperation`](../../../../../generated/email/types.gen/type-aliases/MailboxOperation.md)[]\\>\n\nRead pending or failed mailbox changes without initiating a retry.\n\n#### Returns\n\n`Promise`\\<[`MailboxOperation`](../../../../../generated/email/types.gen/type-aliases/MailboxOperation.md)[]\\>\n\n***\n\n### participants()\n\n> **participants**(): `Promise`\\<[`ApiContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiContactInfo.md)[]\\>\n\nEveryone on the thread (senders and recipients), deduped by email.\nDerived from the thread's first 100 messages.\n\n#### Returns\n\n`Promise`\\<[`ApiContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiContactInfo.md)[]\\>\n\n***\n\n### permission()\n\n> **permission**(): `Promise`\\<\\{ `permission`: [`EntityPermission`](../../../../../generated/storage/types.gen/type-aliases/EntityPermission.md); `status`: `\"access\"`; \\} \\| \\{ `status`: `\"no_access\"`; \\}\\>\n\nRead the caller's effective permission on this entity.\n\n#### Returns\n\n`Promise`\\<\\{ `permission`: [`EntityPermission`](../../../../../generated/storage/types.gen/type-aliases/EntityPermission.md); `status`: `\"access\"`; \\} \\| \\{ `status`: `\"no_access\"`; \\}\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`permission`](../../../entity/classes/PropertiedEntity.md#permission)\n\n***\n\n### properties()\n\n> **properties**(`opts?`): `Promise`\\<[`EntityPropertyWithDefinition`](../../../../../generated/properties/types.gen/type-aliases/EntityPropertyWithDefinition.md)[]\\>\n\nThe properties set on this entity, each with its definition, value, and options.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts?` | \\{ `includeMetadata?`: `boolean`; \\} |\n| `opts.includeMetadata?` | `boolean` |\n\n#### Returns\n\n`Promise`\\<[`EntityPropertyWithDefinition`](../../../../../generated/properties/types.gen/type-aliases/EntityPropertyWithDefinition.md)[]\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`properties`](../../../entity/classes/PropertiedEntity.md#properties)\n\n***\n\n### propertyReference()\n\n> **propertyReference**(): [`PropertyTargetReference`](../../../../../generated/properties/types.gen/type-aliases/PropertyTargetReference.md)\n\nThis entity's reference for bulk property operations.\n\n#### Returns\n\n[`PropertyTargetReference`](../../../../../generated/properties/types.gen/type-aliases/PropertyTargetReference.md)\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`propertyReference`](../../../entity/classes/PropertiedEntity.md#propertyreference)\n\n***\n\n### removeLabel()\n\n> **removeLabel**(`label`): `Promise`\\<`void`\\>\n\nRemove a label from every message in the thread.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### reply()\n\n> **reply**(`opts`): `Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\nSend a reply within this thread. Returns a handle when the API reports the created message's id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`ReplyEmailOptions`](../interfaces/ReplyEmailOptions.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\n***\n\n### setFollowup()\n\n> **setFollowup**(`command`): `Promise`\\<[`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md)\\>\n\nSet or remove a follow-up using a persisted operation id and revision.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `command` | [`EmailFollowupCommand`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowupCommand.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md)\\>\n\n***\n\n### setProperty()\n\n> **setProperty**(`property`, `value?`): `Promise`\\<`void`\\>\n\nSet a property value on this entity, or attach the property without a\nvalue when `value` is omitted.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `property` | [`PropertyDefinition`](../../../properties/property-definition/classes/PropertyDefinition.md) |\n| `value?` | [`SetPropertyValue`](../../../../../generated/properties/types.gen/type-aliases/SetPropertyValue.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`setProperty`](../../../entity/classes/PropertiedEntity.md#setproperty)\n\n***\n\n### subject()\n\n> **subject**(): `Promise`\\<`string` \\| `undefined`\\>\n\nThe thread's subject, from its first message with one.\n\n#### Returns\n\n`Promise`\\<`string` \\| `undefined`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`ApiThread`](../../../../../generated/email/types.gen/type-aliases/ApiThread.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`ApiThread`](../../../../../generated/email/types.gen/type-aliases/ApiThread.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`ApiThread`](../../../../../generated/email/types.gen/type-aliases/ApiThread.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`toJSON`](../../../entity/classes/PropertiedEntity.md#tojson)\n\n***\n\n### unfavorite()\n\n> **unfavorite**(): `Promise`\\<`EmailThread`\\>\n\nRemove this entity from the user's favorites. Returns this handle for chaining.\n\n#### Returns\n\n`Promise`\\<`EmailThread`\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`unfavorite`](../../../entity/classes/PropertiedEntity.md#unfavorite)\n\n***\n\n### update()\n\n> **update**(`options`): `Promise`\\<`void`\\>\n\nChange project membership or share permissions for this thread.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | \\{ `project?`: [`Project`](../../../projects/project/classes/Project.md) \\| `null`; `sharePermission?`: [`SharePermissionOptions`](../../../sharing/permissions/type-aliases/SharePermissionOptions.md); \\} |\n| `options.project?` | [`Project`](../../../projects/project/classes/Project.md) \\| `null` |\n| `options.sharePermission?` | [`SharePermissionOptions`](../../../sharing/permissions/type-aliases/SharePermissionOptions.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### updatePropertyOptions()\n\n> **updatePropertyOptions**(`changes`): `Promise`\\<[`BulkUpdateEntityPropertyOptionsResponse`](../../../../../generated/properties/types.gen/type-aliases/BulkUpdateEntityPropertyOptionsResponse.md)\\>\n\nApply multi-select option deltas atomically across this entity's properties.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `changes` | [`PropertyOptionDelta`](../../../entity/interfaces/PropertyOptionDelta.md)[] |\n\n#### Returns\n\n`Promise`\\<[`BulkUpdateEntityPropertyOptionsResponse`](../../../../../generated/properties/types.gen/type-aliases/BulkUpdateEntityPropertyOptionsResponse.md)\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`updatePropertyOptions`](../../../entity/classes/PropertiedEntity.md#updatepropertyoptions)\n\n***\n\n### updateState()\n\n> **updateState**(`request`): `Promise`\\<`void`\\>\n\nUpdate provider-neutral read, trash, spam, or star state.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `request` | [`UpdateThreadStateRequest`](../../../../../generated/email/types.gen/type-aliases/UpdateThreadStateRequest.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `EmailThread`\n\nA handle to a thread by id. Details load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`EmailThread`\n\n\n<!-- src/entities/email/thread/interfaces/ReplyEmailOptions.md -->\n# Interface: ReplyEmailOptions\n\nOptions for replying within an email thread.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Bcc recipients. |\n| <a id=\"property-bodytext\"></a> `bodyText` | `string` | Plain-text body. |\n| <a id=\"property-cc\"></a> `cc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Cc recipients. |\n| <a id=\"property-replyingto\"></a> `replyingTo?` | [`EmailMessage`](../../message/classes/EmailMessage.md) | The message being replied to. |\n| <a id=\"property-subject\"></a> `subject?` | `string` | Subject line. Defaults to the subject of the thread's first message. |\n| <a id=\"property-to\"></a> `to` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Recipients. |\n"+ "overview": "<!-- src/entities/email/draft/type-aliases/DraftOptions.md -->\n# Type Alias: DraftOptions\n\n> **DraftOptions** = `Omit`\\<[`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md), `\"db_id\"` \\| `\"provider_id\"` \\| `\"provider_thread_id\"` \\| `\"replying_to_id\"` \\| `\"thread_db_id\"` \\| `\"body_text\"` \\| `\"body_html\"` \\| `\"body_macro\"` \\| `\"headers_json\"` \\| `\"include_signature\"` \\| `\"draft_generation\"`\\> & \\{ `bodyHtml?`: `string`; `bodyMacro?`: `string`; `bodyText?`: `string`; `draftGeneration?`: `number`; `headers?`: [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\\[`\"headers_json\"`\\]; `includeSignature?`: `boolean`; `replyingTo?`: [`EmailMessage`](../../message/classes/EmailMessage.md); `thread?`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}\n\nDraft content; relationships use message and thread handles.\n\n## Type Declaration\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `bodyHtml?` | `string` | HTML body. |\n| `bodyMacro?` | `string` | Macro body. |\n| `bodyText?` | `string` | Plain text body. |\n| `draftGeneration?` | `number` | Generation captured when editing began; defaults to the loaded draft. |\n| `headers?` | [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\\[`\"headers_json\"`\\] | Extra headers. |\n| `includeSignature?` | `boolean` | Include the inbox signature. |\n| `replyingTo?` | [`EmailMessage`](../../message/classes/EmailMessage.md) | Message being replied to. |\n| `thread?` | [`EmailThread`](../../thread/classes/EmailThread.md) | Thread receiving this draft. |\n\n\n<!-- src/entities/email/filter/interfaces/EmailFilterOptions.md -->\n# Interface: EmailFilterOptions\n\nSender importance rule.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-emailaddress\"></a> `emailAddress?` | `string` | Match an address. |\n| <a id=\"property-emaildomain\"></a> `emailDomain?` | `string` | Match a domain. |\n| <a id=\"property-isimportant\"></a> `isImportant` | `boolean` | Whether matches are important. |\n\n\n<!-- src/entities/email/message/interfaces/SendEmailOptions.md -->\n# Interface: SendEmailOptions\n\nOptions for sending a fresh email message.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Bcc recipients. |\n| <a id=\"property-bodytext\"></a> `bodyText` | `string` | Plain-text body. |\n| <a id=\"property-cc\"></a> `cc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Cc recipients. |\n| <a id=\"property-subject\"></a> `subject` | `string` | Subject line. |\n| <a id=\"property-to\"></a> `to` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Recipients. |\n\n\n<!-- src/entities/email/namespace/classes/EmailNamespace.md -->\n# Class: EmailNamespace\n\n## Constructors\n\n### Constructor\n\n> **new EmailNamespace**(`client`): `EmailNamespace`\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n\n#### Returns\n\n`EmailNamespace`\n\n## Methods\n\n### attachment()\n\n> **attachment**(`id`): [`EmailAttachment`](../../attachment/classes/EmailAttachment.md)\n\nA handle to an email attachment by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailAttachment`](../../attachment/classes/EmailAttachment.md)\n\n***\n\n### blockedSenders()\n\n> **blockedSenders**(): `Promise`\\<`string`[]\\>\n\nThe email addresses currently blocked.\n\n#### Returns\n\n`Promise`\\<`string`[]\\>\n\n***\n\n### blockSender()\n\n> **blockSender**(`email`): `Promise`\\<`void`\\>\n\nBlock an email sender.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `email` | `string` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### byId()\n\n> **byId**(`id`): [`EmailThread`](../../thread/classes/EmailThread.md)\n\nA handle to an email thread by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailThread`](../../thread/classes/EmailThread.md)\n\n***\n\n### connectionProviders()\n\n> **connectionProviders**(): `Promise`\\<[`EmailConnectionProviders`](../../../../../generated/auth/types.gen/type-aliases/EmailConnectionProviders.md)\\>\n\nProviders the server currently permits this caller to connect.\n\n#### Returns\n\n`Promise`\\<[`EmailConnectionProviders`](../../../../../generated/auth/types.gen/type-aliases/EmailConnectionProviders.md)\\>\n\n***\n\n### contacts()\n\n> **contacts**(): `Promise`\\<\\{\\[`key`: `string`\\]: [`ContactInfoWithInteraction`](../../../../../generated/email/types.gen/type-aliases/ContactInfoWithInteraction.md)[]; \\}\\>\n\nAddress book contacts grouped by the service's interaction buckets.\n\n#### Returns\n\n`Promise`\\<\\{\\[`key`: `string`\\]: [`ContactInfoWithInteraction`](../../../../../generated/email/types.gen/type-aliases/ContactInfoWithInteraction.md)[]; \\}\\>\n\n***\n\n### createDraft()\n\n> **createDraft**(`options`, `inbox?`): `Promise`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\nCreate a draft without sending it; the inbox defaults to the caller's primary.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`DraftOptions`](../../draft/type-aliases/DraftOptions.md) |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\n***\n\n### createLabel()\n\n> **createLabel**(`name`): `Promise`\\<[`Label`](../../label/classes/Label.md)\\>\n\nCreate a user label. Returns the created label.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `name` | `string` |\n\n#### Returns\n\n`Promise`\\<[`Label`](../../label/classes/Label.md)\\>\n\n***\n\n### deleteLabel()\n\n> **deleteLabel**(`label`): `Promise`\\<`void`\\>\n\nDelete a label.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### draftById()\n\n> **draftById**(`id`): [`EmailDraft`](../../draft/classes/EmailDraft.md)\n\nConstruct a lazy draft handle.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailDraft`](../../draft/classes/EmailDraft.md)\n\n***\n\n### filters()\n\n> **filters**(`inbox?`): `Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)[]\\>\n\nImportance filters.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)[]\\>\n\n***\n\n### inbox()\n\n> **inbox**(`opts?`): `AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nThe threads in the inbox, most recent first, auto-paginated.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts?` | [`InboxOptions`](../interfaces/InboxOptions.md) |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n***\n\n### label()\n\n> **label**(`id`): [`Label`](../../label/classes/Label.md)\n\nA handle to a label by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`Label`](../../label/classes/Label.md)\n\n***\n\n### labels()\n\n> **labels**(): `Promise`\\<[`Label`](../../label/classes/Label.md)[]\\>\n\nAll labels across the user's inboxes.\n\n#### Returns\n\n`Promise`\\<[`Label`](../../label/classes/Label.md)[]\\>\n\n***\n\n### link()\n\n> **link**(`id`): [`Link`](../../link/classes/Link.md)\n\nA handle to a connected inbox (email link) by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`Link`](../../link/classes/Link.md)\n\n***\n\n### links()\n\n> **links**(): `Promise`\\<[`Link`](../../link/classes/Link.md)[]\\>\n\nThe caller's connected inboxes (email links).\n\n#### Returns\n\n`Promise`\\<[`Link`](../../link/classes/Link.md)[]\\>\n\n***\n\n### message()\n\n> **message**(`id`): [`EmailMessage`](../../message/classes/EmailMessage.md)\n\nA handle to an email message by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailMessage`](../../message/classes/EmailMessage.md)\n\n***\n\n### recoverDraftTransfer()\n\n> **recoverDraftTransfer**(`operationId`): `Promise`\\<[`TransferRecoveryResponse`](../../../../../generated/email/types.gen/type-aliases/TransferRecoveryResponse.md)\\>\n\nRecover a draft move using its original operation UUID; never starts a new move.\nAn empty committed result fences the old move so it cannot commit later.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `operationId` | `string` |\n\n#### Returns\n\n`Promise`\\<[`TransferRecoveryResponse`](../../../../../generated/email/types.gen/type-aliases/TransferRecoveryResponse.md)\\>\n\n***\n\n### reminders()\n\n> **reminders**(`options?`): `AsyncGenerator`\\<\\{ `followup`: [`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md); `thread`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}, `any`, `any`\\>\n\nFollow-up reminders with thread handles, automatically paginated.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `Omit`\\<\\{ `attachments?`: `string`[] \\| `null`; `calendar?`: `boolean` \\| `null`; `cursor?`: `string` \\| `null`; `done?`: `boolean` \\| `null`; `inboxIds?`: `string`[] \\| `null`; `limit?`: `number` \\| `null`; `noInboxes?`: `boolean` \\| `null`; `read?`: `boolean` \\| `null`; `tags?`: `string`[] \\| `null`; \\}, `\"cursor\"` \\| `\"inboxIds\"`\\> & \\{ `inboxes?`: [`Link`](../../link/classes/Link.md)[]; \\} |\n\n#### Returns\n\n`AsyncGenerator`\\<\\{ `followup`: [`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md); `thread`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}, `any`, `any`\\>\n\n***\n\n### scheduled()\n\n> **scheduled**(`options?`): `AsyncGenerator`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\nScheduled drafts, fetched lazily in bounded pages.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | \\{ `inbox?`: [`Link`](../../link/classes/Link.md); `pageSize?`: `number`; \\} |\n| `options.inbox?` | [`Link`](../../link/classes/Link.md) |\n| `options.pageSize?` | `number` |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\n***\n\n### search()\n\n> **search**(`query`, `opts?`): `AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nSearch email threads by subject and content.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `query` | `string` |\n| `opts?` | [`SearchOpts`](../../../search/interfaces/SearchOpts.md) |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n***\n\n### send()\n\n> **send**(`opts`): `Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\nSend a new email message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`SendEmailOptions`](../../message/interfaces/SendEmailOptions.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\n***\n\n### unblockSender()\n\n> **unblockSender**(`email`): `Promise`\\<`void`\\>\n\nUnblock a previously blocked sender.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `email` | `string` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### upsertFilter()\n\n> **upsertFilter**(`options`, `inbox?`): `Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)\\>\n\nCreate or replace a filter matching an address or domain.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`EmailFilterOptions`](../../filter/interfaces/EmailFilterOptions.md) |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)\\>\n\n\n<!-- src/entities/email/namespace/interfaces/InboxOptions.md -->\n# Interface: InboxOptions\n\nOptions for listing inbox threads.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-pagesize\"></a> `pageSize?` | `number` | Page size (default 20, max 500). |\n| <a id=\"property-sort\"></a> `sort?` | [`ApiSortMethod`](../../../../../generated/email/types.gen/type-aliases/ApiSortMethod.md) | Sort order. Defaults to `viewed_updated`. |\n",+ "documentation": "# Macro SDK: email\n\nGenerated by TypeDoc. Paths below refer to the canonical Markdown hierarchy. Other entity handles are documented in their named section; request core for shared SDK helpers.\n\n<!-- generated/auth/types.gen/type-aliases/EmailConnectionProviders.md -->\n# Type Alias: EmailConnectionProviders\n\n> **EmailConnectionProviders** = \\{ `gmail`: `boolean`; `outlook`: `boolean`; `outlook_admin_consent_url?`: `string` \\| `null`; \\}\n\nActual deployment availability for the provider selector.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-gmail\"></a> `gmail` | `boolean` | - |\n| <a id=\"property-outlook\"></a> `outlook` | `boolean` | - |\n| <a id=\"property-outlook_admin_consent_url\"></a> `outlook_admin_consent_url?` | `string` \\| `null` | Where a Microsoft 365 administrator approves Macro for their whole directory. Present when Outlook is configured and the request named an `original_url` for the administrator's browser to return to. |\n\n\n<!-- generated/email/types.gen/type-aliases/AccessLevel.md -->\n# Type Alias: AccessLevel\n\n> **AccessLevel** = `\"view\"` \\| `\"comment\"` \\| `\"edit\"` \\| `\"owner\"`\n\nOrdered from least to most access top -> bottom\n\n\n<!-- generated/email/types.gen/type-aliases/ApiAttachmentDraft.md -->\n# Type Alias: ApiAttachmentDraft\n\n> **ApiAttachmentDraft** = \\{ `content_id?`: `string` \\| `null`; `content_type`: `string`; `draft_id`: `string`; `file_name`: `string`; `id`: `string`; `is_inline`: `boolean`; `s3_key`: `string`; `sha`: `string`; `size`: `number`; `upload_pending`: `boolean`; \\}\n\nAPI representation of a draft attachment on a message.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-content_id\"></a> `content_id?` | `string` \\| `null` |\n| <a id=\"property-content_type\"></a> `content_type` | `string` |\n| <a id=\"property-draft_id\"></a> `draft_id` | `string` |\n| <a id=\"property-file_name\"></a> `file_name` | `string` |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-is_inline\"></a> `is_inline` | `boolean` |\n| <a id=\"property-s3_key\"></a> `s3_key` | `string` |\n| <a id=\"property-sha\"></a> `sha` | `string` |\n| <a id=\"property-size\"></a> `size` | `number` |\n| <a id=\"property-upload_pending\"></a> `upload_pending` | `boolean` |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiAttachmentForwarded.md -->\n# Type Alias: ApiAttachmentForwarded\n\n> **ApiAttachmentForwarded** = \\{ `attachment_id`: `string`; `draft_id`: `string`; `filename?`: `string` \\| `null`; `message_provider_id`: `string`; `mime_type?`: `string` \\| `null`; `provider_attachment_id?`: `string` \\| `null`; `size_bytes?`: `number` \\| `null`; \\}\n\nAPI representation of a forwarded attachment on a message.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-attachment_id\"></a> `attachment_id` | `string` |\n| <a id=\"property-draft_id\"></a> `draft_id` | `string` |\n| <a id=\"property-filename\"></a> `filename?` | `string` \\| `null` |\n| <a id=\"property-message_provider_id\"></a> `message_provider_id` | `string` |\n| <a id=\"property-mime_type\"></a> `mime_type?` | `string` \\| `null` |\n| <a id=\"property-provider_attachment_id\"></a> `provider_attachment_id?` | `string` \\| `null` |\n| <a id=\"property-size_bytes\"></a> `size_bytes?` | `number` \\| `null` |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiContactInfo.md -->\n# Type Alias: ApiContactInfo\n\n> **ApiContactInfo** = \\{ `email`: `string`; `name?`: `string` \\| `null`; `photo_url?`: `string` \\| `null`; \\}\n\nAPI representation of a contact (sender or recipient).\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-email\"></a> `email` | `string` |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` |\n| <a id=\"property-photo_url\"></a> `photo_url?` | `string` \\| `null` |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiDraftContactInfo.md -->\n# Type Alias: ApiDraftContactInfo\n\n> **ApiDraftContactInfo** = \\{ `email`: `string`; `name?`: `string` \\| `null`; `photo_url?`: `string` \\| `null`; \\}\n\nContact info for draft request/response (backward-compatible with MessageToSend shape).\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-email\"></a> `email` | `string` | Email address. |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` | Display name. |\n| <a id=\"property-photo_url\"></a> `photo_url?` | `string` \\| `null` | Profile photo URL. |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiDraftInput.md -->\n# Type Alias: ApiDraftInput\n\n> **ApiDraftInput** = \\{ `bcc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null`; `body_html?`: `string` \\| `null`; `body_macro?`: `string` \\| `null`; `body_text?`: `string` \\| `null`; `cc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null`; `db_id?`: `string` \\| `null`; `draft_generation?`: `number`; `headers_json?`: `null` \\| [`Value`](Value.md); `include_signature?`: `boolean` \\| `null`; `provider_id?`: `string` \\| `null`; `provider_thread_id?`: `string` \\| `null`; `replying_to_id?`: `string` \\| `null`; `subject`: `string`; `thread_db_id?`: `string` \\| `null`; `to?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null`; \\}\n\nThe draft input matching the current `MessageToSend` JSON shape for backward compat.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc?` | [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null` | Bcc recipients. |\n| <a id=\"property-body_html\"></a> `body_html?` | `string` \\| `null` | HTML body (base64 URL_SAFE_NO_PAD encoded). Sanitized before storage. |\n| <a id=\"property-body_macro\"></a> `body_macro?` | `string` \\| `null` | Macro body format. |\n| <a id=\"property-body_text\"></a> `body_text?` | `string` \\| `null` | Plain text body. |\n| <a id=\"property-cc\"></a> `cc?` | [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null` | Cc recipients. |\n| <a id=\"property-db_id\"></a> `db_id?` | `string` \\| `null` | Existing message DB ID (for updating an existing draft). |\n| <a id=\"property-draft_generation\"></a> `draft_generation?` | `number` | Generation from the last loaded draft; legacy clients begin at zero. |\n| <a id=\"property-headers_json\"></a> `headers_json?` | `null` \\| [`Value`](Value.md) | - |\n| <a id=\"property-include_signature\"></a> `include_signature?` | `boolean` \\| `null` | Per-message override for whether to include the signature on send: `Some(false)` to exclude (user dismissed it). Omit to use the inbox's default policy. Ignored for drafts. |\n| <a id=\"property-provider_id\"></a> `provider_id?` | `string` \\| `null` | Provider message ID. |\n| <a id=\"property-provider_thread_id\"></a> `provider_thread_id?` | `string` \\| `null` | Provider thread ID. |\n| <a id=\"property-replying_to_id\"></a> `replying_to_id?` | `string` \\| `null` | ID of the message this draft is replying to. |\n| <a id=\"property-subject\"></a> `subject` | `string` | Subject line. |\n| <a id=\"property-thread_db_id\"></a> `thread_db_id?` | `string` \\| `null` | Thread DB ID. |\n| <a id=\"property-to\"></a> `to?` | [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \\| `null` | To recipients. |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiEmailFilter.md -->\n# Type Alias: ApiEmailFilter\n\n> **ApiEmailFilter** = \\{ `created_at`: `string`; `email_address?`: `string` \\| `null`; `email_domain?`: `string` \\| `null`; `id`: `string`; `is_important`: `boolean`; \\}\n\nA single email filter in API responses.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` |\n| <a id=\"property-email_address\"></a> `email_address?` | `string` \\| `null` |\n| <a id=\"property-email_domain\"></a> `email_domain?` | `string` \\| `null` |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-is_important\"></a> `is_important` | `boolean` |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiLabel.md -->\n# Type Alias: ApiLabel\n\n> **ApiLabel** = \\{ `createdAt`: `string`; `id`: `string`; `labelListVisibility`: [`ApiLabelListVisibility`](ApiLabelListVisibility.md); `linkId`: `string`; `messageListVisibility`: [`ApiMessageListVisibility`](ApiMessageListVisibility.md); `name`: `string`; `providerLabelId`: `string`; `type`: [`ApiLabelType`](ApiLabelType.md); \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-createdat\"></a> `createdAt` | `string` |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-labellistvisibility\"></a> `labelListVisibility` | [`ApiLabelListVisibility`](ApiLabelListVisibility.md) |\n| <a id=\"property-linkid\"></a> `linkId` | `string` |\n| <a id=\"property-messagelistvisibility\"></a> `messageListVisibility` | [`ApiMessageListVisibility`](ApiMessageListVisibility.md) |\n| <a id=\"property-name\"></a> `name` | `string` |\n| <a id=\"property-providerlabelid\"></a> `providerLabelId` | `string` |\n| <a id=\"property-type\"></a> `type` | [`ApiLabelType`](ApiLabelType.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiLabelListVisibility.md -->\n# Type Alias: ApiLabelListVisibility\n\n> **ApiLabelListVisibility** = `\"LabelShow\"` \\| `\"LabelShowIfUnread\"` \\| `\"LabelHide\"`\n\n\n<!-- generated/email/types.gen/type-aliases/ApiLabelType.md -->\n# Type Alias: ApiLabelType\n\n> **ApiLabelType** = `\"System\"` \\| `\"User\"`\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessage.md -->\n# Type Alias: ApiMessage\n\n> **ApiMessage** = \\{ `attachments`: [`ApiMessageAttachment`](ApiMessageAttachment.md)[]; `attachments_draft`: [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[]; `attachments_forwarded`: [`ApiAttachmentForwarded`](ApiAttachmentForwarded.md)[]; `bcc`: [`ApiContactInfo`](ApiContactInfo.md)[]; `body_html_sanitized?`: `string` \\| `null`; `body_macro?`: `string` \\| `null`; `body_replyless?`: `string` \\| `null`; `body_text?`: `string` \\| `null`; `calendar_invitations?`: [`CalendarInvitation`](CalendarInvitation.md)[]; `cc`: [`ApiContactInfo`](ApiContactInfo.md)[]; `created_at`: `string`; `db_id`: `string`; `draft_generation`: `number`; `from?`: `null` \\| [`ApiContactInfo`](ApiContactInfo.md); `global_id?`: `string` \\| `null`; `has_attachments`: `boolean`; `headers_json?`: `unknown`; `internal_date_ts?`: `string` \\| `null`; `is_draft`: `boolean`; `is_read`: `boolean`; `is_sent`: `boolean`; `is_starred`: `boolean`; `labels`: [`ApiMessageLabel`](ApiMessageLabel.md)[]; `link_id`: `string`; `operation_status?`: `null` \\| [`ApiMessageOperation`](ApiMessageOperation.md); `provider_history_id?`: `string` \\| `null`; `provider_id?`: `string` \\| `null`; `provider_thread_id?`: `string` \\| `null`; `replying_to_id?`: `string` \\| `null`; `scheduled_send_status?`: `null` \\| [`ScheduledSendStatus`](ScheduledSendStatus.md); `scheduled_send_time?`: `string` \\| `null`; `sent_at?`: `string` \\| `null`; `size_estimate?`: `number` \\| `null`; `snippet?`: `string` \\| `null`; `subject?`: `string` \\| `null`; `thread_db_id`: `string`; `to`: [`ApiContactInfo`](ApiContactInfo.md)[]; `updated_at`: `string`; \\}\n\nAPI representation of a fully assembled email message.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-attachments\"></a> `attachments` | [`ApiMessageAttachment`](ApiMessageAttachment.md)[] | - |\n| <a id=\"property-attachments_draft\"></a> `attachments_draft` | [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[] | - |\n| <a id=\"property-attachments_forwarded\"></a> `attachments_forwarded` | [`ApiAttachmentForwarded`](ApiAttachmentForwarded.md)[] | - |\n| <a id=\"property-bcc\"></a> `bcc` | [`ApiContactInfo`](ApiContactInfo.md)[] | - |\n| <a id=\"property-body_html_sanitized\"></a> `body_html_sanitized?` | `string` \\| `null` | - |\n| <a id=\"property-body_macro\"></a> `body_macro?` | `string` \\| `null` | - |\n| <a id=\"property-body_replyless\"></a> `body_replyless?` | `string` \\| `null` | - |\n| <a id=\"property-body_text\"></a> `body_text?` | `string` \\| `null` | - |\n| <a id=\"property-calendar_invitations\"></a> `calendar_invitations?` | [`CalendarInvitation`](CalendarInvitation.md)[] | - |\n| <a id=\"property-cc\"></a> `cc` | [`ApiContactInfo`](ApiContactInfo.md)[] | - |\n| <a id=\"property-created_at\"></a> `created_at` | `string` | - |\n| <a id=\"property-db_id\"></a> `db_id` | `string` | - |\n| <a id=\"property-draft_generation\"></a> `draft_generation` | `number` | Draft edit generation; changes at send and cancellation boundaries. |\n| <a id=\"property-from\"></a> `from?` | `null` \\| [`ApiContactInfo`](ApiContactInfo.md) | - |\n| <a id=\"property-global_id\"></a> `global_id?` | `string` \\| `null` | - |\n| <a id=\"property-has_attachments\"></a> `has_attachments` | `boolean` | - |\n| <a id=\"property-headers_json\"></a> `headers_json?` | `unknown` | - |\n| <a id=\"property-internal_date_ts\"></a> `internal_date_ts?` | `string` \\| `null` | - |\n| <a id=\"property-is_draft\"></a> `is_draft` | `boolean` | - |\n| <a id=\"property-is_read\"></a> `is_read` | `boolean` | - |\n| <a id=\"property-is_sent\"></a> `is_sent` | `boolean` | - |\n| <a id=\"property-is_starred\"></a> `is_starred` | `boolean` | - |\n| <a id=\"property-labels\"></a> `labels` | [`ApiMessageLabel`](ApiMessageLabel.md)[] | - |\n| <a id=\"property-link_id\"></a> `link_id` | `string` | - |\n| <a id=\"property-operation_status\"></a> `operation_status?` | `null` \\| [`ApiMessageOperation`](ApiMessageOperation.md) | - |\n| <a id=\"property-provider_history_id\"></a> `provider_history_id?` | `string` \\| `null` | - |\n| <a id=\"property-provider_id\"></a> `provider_id?` | `string` \\| `null` | - |\n| <a id=\"property-provider_thread_id\"></a> `provider_thread_id?` | `string` \\| `null` | - |\n| <a id=\"property-replying_to_id\"></a> `replying_to_id?` | `string` \\| `null` | - |\n| <a id=\"property-scheduled_send_status\"></a> `scheduled_send_status?` | `null` \\| [`ScheduledSendStatus`](ScheduledSendStatus.md) | - |\n| <a id=\"property-scheduled_send_time\"></a> `scheduled_send_time?` | `string` \\| `null` | - |\n| <a id=\"property-sent_at\"></a> `sent_at?` | `string` \\| `null` | - |\n| <a id=\"property-size_estimate\"></a> `size_estimate?` | `number` \\| `null` | - |\n| <a id=\"property-snippet\"></a> `snippet?` | `string` \\| `null` | - |\n| <a id=\"property-subject\"></a> `subject?` | `string` \\| `null` | - |\n| <a id=\"property-thread_db_id\"></a> `thread_db_id` | `string` | - |\n| <a id=\"property-to\"></a> `to` | [`ApiContactInfo`](ApiContactInfo.md)[] | - |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` | - |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageAttachment.md -->\n# Type Alias: ApiMessageAttachment\n\n> **ApiMessageAttachment** = \\{ `content_id?`: `string` \\| `null`; `data_url?`: `string` \\| `null`; `db_id`: `string`; `filename?`: `string` \\| `null`; `mime_type?`: `string` \\| `null`; `provider_id?`: `string` \\| `null`; `reference_url?`: `string` \\| `null`; `sfs_id?`: `string` \\| `null`; `size_bytes?`: `number` \\| `null`; \\}\n\nAPI representation of a provider attachment on a message.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-content_id\"></a> `content_id?` | `string` \\| `null` |\n| <a id=\"property-data_url\"></a> `data_url?` | `string` \\| `null` |\n| <a id=\"property-db_id\"></a> `db_id` | `string` |\n| <a id=\"property-filename\"></a> `filename?` | `string` \\| `null` |\n| <a id=\"property-mime_type\"></a> `mime_type?` | `string` \\| `null` |\n| <a id=\"property-provider_id\"></a> `provider_id?` | `string` \\| `null` |\n| <a id=\"property-reference_url\"></a> `reference_url?` | `string` \\| `null` |\n| <a id=\"property-sfs_id\"></a> `sfs_id?` | `string` \\| `null` |\n| <a id=\"property-size_bytes\"></a> `size_bytes?` | `number` \\| `null` |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageLabel.md -->\n# Type Alias: ApiMessageLabel\n\n> **ApiMessageLabel** = \\{ `created_at`: `string`; `id?`: `string` \\| `null`; `label_list_visibility?`: `null` \\| [`ApiLabelListVisibility`](ApiLabelListVisibility.md); `link_id`: `string`; `message_list_visibility?`: `null` \\| [`ApiMessageListVisibility`](ApiMessageListVisibility.md); `name?`: `string` \\| `null`; `provider_label_id`: `string`; `type_?`: `null` \\| [`ApiLabelType`](ApiLabelType.md); \\}\n\nAPI representation of a label on a message.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` |\n| <a id=\"property-id\"></a> `id?` | `string` \\| `null` |\n| <a id=\"property-label_list_visibility\"></a> `label_list_visibility?` | `null` \\| [`ApiLabelListVisibility`](ApiLabelListVisibility.md) |\n| <a id=\"property-link_id\"></a> `link_id` | `string` |\n| <a id=\"property-message_list_visibility\"></a> `message_list_visibility?` | `null` \\| [`ApiMessageListVisibility`](ApiMessageListVisibility.md) |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` |\n| <a id=\"property-provider_label_id\"></a> `provider_label_id` | `string` |\n| <a id=\"property-type_\"></a> `type_?` | `null` \\| [`ApiLabelType`](ApiLabelType.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageListVisibility.md -->\n# Type Alias: ApiMessageListVisibility\n\n> **ApiMessageListVisibility** = `\"Show\"` \\| `\"Hide\"`\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageOperation.md -->\n# Type Alias: ApiMessageOperation\n\n> **ApiMessageOperation** = \\{ `issue?`: `null` \\| [`ApiMessageOperationIssue`](ApiMessageOperationIssue.md); `remote_version?`: `string` \\| `null`; `revision`: `string`; `state`: [`ApiMessageOperationState`](ApiMessageOperationState.md); \\}\n\nVersions are opaque decimal strings so clients never truncate an i64.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-issue\"></a> `issue?` | `null` \\| [`ApiMessageOperationIssue`](ApiMessageOperationIssue.md) |\n| <a id=\"property-remote_version\"></a> `remote_version?` | `string` \\| `null` |\n| <a id=\"property-revision\"></a> `revision` | `string` |\n| <a id=\"property-state\"></a> `state` | [`ApiMessageOperationState`](ApiMessageOperationState.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageOperationIssue.md -->\n# Type Alias: ApiMessageOperationIssue\n\n> **ApiMessageOperationIssue** = `\"ACCEPTING_REMOTE\"` \\| `\"DRAFT_CONFLICT\"` \\| `\"CREATION_UNKNOWN\"` \\| `\"ATTACHMENT_UNKNOWN\"` \\| `\"SEND_UNKNOWN\"` \\| `\"SEND_REJECTED\"` \\| `\"ACCESS_REVOKED\"` \\| `\"INVALID_CONTENT\"` \\| `\"MOVE_PENDING\"` \\| `\"MOVE_CONFLICT\"` \\| `\"MOVE_SOURCE_SENT\"` \\| `\"MOVE_REAUTHORIZATION\"` \\| `\"MOVE_ORIGINAL_REMAINS\"`\n\nProvider-neutral state exposed to clients.\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageOperationState.md -->\n# Type Alias: ApiMessageOperationState\n\n> **ApiMessageOperationState** = `\"PENDING\"` \\| `\"SYNCHRONIZED\"` \\| `\"CONFLICT\"` \\| `\"UNCERTAIN\"` \\| `\"SUBMITTING\"` \\| `\"CONFIRMING\"` \\| `\"SENT\"` \\| `\"DELETED\"` \\| `\"CANCELLED\"` \\| `\"FAILED\"`\n\nProvider-neutral state exposed to clients.\n\n\n<!-- generated/email/types.gen/type-aliases/ApiMessageResolutionAction.md -->\n# Type Alias: ApiMessageResolutionAction\n\n> **ApiMessageResolutionAction** = `\"keep_local\"` \\| `\"use_provider\"` \\| `\"recheck\"` \\| `\"retry_send\"` \\| `\"keep_original\"`\n\nA deliberate resolution of a particular observed operation version.\n\n\n<!-- generated/email/types.gen/type-aliases/ApiSortMethod.md -->\n# Type Alias: ApiSortMethod\n\n> **ApiSortMethod** = `\"viewed_at\"` \\| `\"updated_at\"` \\| `\"created_at\"` \\| `\"viewed_updated\"`\n\ncommon types of sorts based on timestamps\n\n\n<!-- generated/email/types.gen/type-aliases/ApiThread.md -->\n# Type Alias: ApiThread\n\n> **ApiThread** = \\{ `access_level`: [`AccessLevel`](AccessLevel.md); `created_at`: `string`; `db_id`: `string`; `inbox_visible`: `boolean`; `is_read`: `boolean`; `latest_inbound_message_ts?`: `string` \\| `null`; `latest_non_spam_message_ts?`: `string` \\| `null`; `latest_outbound_message_ts?`: `string` \\| `null`; `link_id`: `string`; `messages`: [`ApiMessage`](ApiMessage.md)[]; `project_id?`: `string` \\| `null`; `provider_id?`: `string` \\| `null`; `updated_at`: `string`; \\}\n\nAPI representation of a fully assembled email thread.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-access_level\"></a> `access_level` | [`AccessLevel`](AccessLevel.md) |\n| <a id=\"property-created_at\"></a> `created_at` | `string` |\n| <a id=\"property-db_id\"></a> `db_id` | `string` |\n| <a id=\"property-inbox_visible\"></a> `inbox_visible` | `boolean` |\n| <a id=\"property-is_read\"></a> `is_read` | `boolean` |\n| <a id=\"property-latest_inbound_message_ts\"></a> `latest_inbound_message_ts?` | `string` \\| `null` |\n| <a id=\"property-latest_non_spam_message_ts\"></a> `latest_non_spam_message_ts?` | `string` \\| `null` |\n| <a id=\"property-latest_outbound_message_ts\"></a> `latest_outbound_message_ts?` | `string` \\| `null` |\n| <a id=\"property-link_id\"></a> `link_id` | `string` |\n| <a id=\"property-messages\"></a> `messages` | [`ApiMessage`](ApiMessage.md)[] |\n| <a id=\"property-project_id\"></a> `project_id?` | `string` \\| `null` |\n| <a id=\"property-provider_id\"></a> `provider_id?` | `string` \\| `null` |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/Attachment.md -->\n# Type Alias: Attachment\n\n> **Attachment** = \\{ `content_id?`: `string` \\| `null`; `data_url?`: `string` \\| `null`; `db_id`: `string`; `filename?`: `string` \\| `null`; `mime_type?`: `string` \\| `null`; `provider_id?`: `string` \\| `null`; `reference_url?`: `string` \\| `null`; `sfs_id?`: `string` \\| `null`; `size_bytes?`: `number` \\| `null`; \\}\n\nAttachments of a message, as sent to us by the provider.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-content_id\"></a> `content_id?` | `string` \\| `null` | - |\n| <a id=\"property-data_url\"></a> `data_url?` | `string` \\| `null` | - |\n| <a id=\"property-db_id\"></a> `db_id` | `string` | - |\n| <a id=\"property-filename\"></a> `filename?` | `string` \\| `null` | - |\n| <a id=\"property-mime_type\"></a> `mime_type?` | `string` \\| `null` | - |\n| <a id=\"property-provider_id\"></a> `provider_id?` | `string` \\| `null` | - |\n| <a id=\"property-reference_url\"></a> `reference_url?` | `string` \\| `null` | Cloud reference: open this provider page instead of downloading bytes. |\n| <a id=\"property-sfs_id\"></a> `sfs_id?` | `string` \\| `null` | - |\n| <a id=\"property-size_bytes\"></a> `size_bytes?` | `number` \\| `null` | - |\n\n\n<!-- generated/email/types.gen/type-aliases/AttendeeResponseStatus.md -->\n# Type Alias: AttendeeResponseStatus\n\n> **AttendeeResponseStatus** = `\"needs_action\"` \\| `\"accepted\"` \\| `\"declined\"` \\| `\"tentative\"`\n\nRSVP state for an attendee.\n\n\n<!-- generated/email/types.gen/type-aliases/CalendarAttendee.md -->\n# Type Alias: CalendarAttendee\n\n> **CalendarAttendee** = \\{ `comment?`: `string` \\| `null`; `displayName?`: `string` \\| `null`; `email`: `string`; `isOptional`: `boolean`; `isOrganizer`: `boolean`; `isSelf`: `boolean`; `responseStatus`: [`AttendeeResponseStatus`](AttendeeResponseStatus.md); \\}\n\nAn attendee on a calendar event.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-comment\"></a> `comment?` | `string` \\| `null` | Optional attendee comment. |\n| <a id=\"property-displayname\"></a> `displayName?` | `string` \\| `null` | Provider display name. |\n| <a id=\"property-email\"></a> `email` | `string` | Normalized email address. |\n| <a id=\"property-isoptional\"></a> `isOptional` | `boolean` | Whether attendance is optional. |\n| <a id=\"property-isorganizer\"></a> `isOrganizer` | `boolean` | Whether this attendee is the organizer. |\n| <a id=\"property-isself\"></a> `isSelf` | `boolean` | Whether this attendee is one of the viewing requester's inboxes. |\n| <a id=\"property-responsestatus\"></a> `responseStatus` | [`AttendeeResponseStatus`](AttendeeResponseStatus.md) | RSVP state. |\n\n\n<!-- generated/email/types.gen/type-aliases/CalendarEvent.md -->\n# Type Alias: CalendarEvent\n\n> **CalendarEvent** = \\{ `attendees`: [`CalendarAttendee`](CalendarAttendee.md)[]; `calendarId?`: `string` \\| `null`; `conferenceProvider?`: `null` \\| [`ConferenceProvider`](ConferenceProvider.md); `conferenceUrl?`: `string` \\| `null`; `createdAt`: `string`; `creatorEmail?`: `string` \\| `null`; `creatorName?`: `string` \\| `null`; `description?`: `string` \\| `null`; `eventType?`: [`EventType`](EventType.md); `guestPolicy`: [`GuestPolicy`](GuestPolicy.md); `icalUid`: `string`; `id`: `string`; `isReadOnly`: `boolean`; `location?`: `string` \\| `null`; `organizerEmail?`: `string` \\| `null`; `organizerName?`: `string` \\| `null`; `ownerId`: `string`; `recurrenceLines`: `string`[]; `reminders?`: [`EventReminders`](EventReminders.md); `sequence`: `number`; `sources?`: [`CalendarEventSourceContent`](CalendarEventSourceContent.md)[]; `status`: [`EventStatus`](EventStatus.md); `time`: [`EventTime`](EventTime.md); `title`: `string`; `transparency`: [`EventTransparency`](EventTransparency.md); `updatedAt`: `string`; `viewerCan`: [`ViewerCapabilities`](ViewerCapabilities.md); `visibility`: [`EventVisibility`](EventVisibility.md); \\}\n\nA stable, first-class Macro calendar event entity.\n\nContent fields hold the canonical source's values: the account's primary\ncalendar copy when one is synced, else the freshest remaining copy.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-attendees\"></a> `attendees` | [`CalendarAttendee`](CalendarAttendee.md)[] | Attendees, keyed by email during persistence. |\n| <a id=\"property-calendarid\"></a> `calendarId?` | `string` \\| `null` | Calendar the canonical source belongs to, when known. Absent only in projections stored before calendars were attributed. |\n| <a id=\"property-conferenceprovider\"></a> `conferenceProvider?` | `null` \\| [`ConferenceProvider`](ConferenceProvider.md) | - |\n| <a id=\"property-conferenceurl\"></a> `conferenceUrl?` | `string` \\| `null` | Direct join URL when known. |\n| <a id=\"property-createdat\"></a> `createdAt` | `string` | Entity creation time. |\n| <a id=\"property-creatoremail\"></a> `creatorEmail?` | `string` \\| `null` | Provider-reported creator email. Distinct from the organizer when someone writes onto a calendar they do not own. Omitted from stored projections when unknown so events ingested before this field still compare equal. |\n| <a id=\"property-creatorname\"></a> `creatorName?` | `string` \\| `null` | Provider-reported creator display name. |\n| <a id=\"property-description\"></a> `description?` | `string` \\| `null` | Optional event body. |\n| <a id=\"property-eventtype\"></a> `eventType?` | [`EventType`](EventType.md) | Provider event type. Skipped when it is the regular type so projections stored before event types were modeled still compare equal. |\n| <a id=\"property-guestpolicy\"></a> `guestPolicy` | [`GuestPolicy`](GuestPolicy.md) | What the organizer lets guests do: the canonical copy's values, or Google's defaults for an event synced before the policy was modeled. |\n| <a id=\"property-icaluid\"></a> `icalUid` | `string` | RFC 5545 UID used to reconcile provider and email sources. |\n| <a id=\"property-id\"></a> `id` | `string` | Macro entity identifier. |\n| <a id=\"property-isreadonly\"></a> `isReadOnly` | `boolean` | Whether the canonical source's calendar prohibits editing it. |\n| <a id=\"property-location\"></a> `location?` | `string` \\| `null` | Optional physical or virtual location label. |\n| <a id=\"property-organizeremail\"></a> `organizerEmail?` | `string` \\| `null` | Organizer email. |\n| <a id=\"property-organizername\"></a> `organizerName?` | `string` \\| `null` | Organizer display name. |\n| <a id=\"property-ownerid\"></a> `ownerId` | `string` | Macro user who owns this event entity. |\n| <a id=\"property-recurrencelines\"></a> `recurrenceLines` | `string`[] | Raw RFC 5545 recurrence properties (`RRULE`, `RDATE`, `EXDATE`). |\n| <a id=\"property-reminders\"></a> `reminders?` | [`EventReminders`](EventReminders.md) | Per-user reminder configuration. Skipped when it is the provider default so projections stored before reminders were modeled still compare equal. |\n| <a id=\"property-sequence\"></a> `sequence` | `number` | Provider/iCalendar sequence number. |\n| <a id=\"property-sources\"></a> `sources?` | [`CalendarEventSourceContent`](CalendarEventSourceContent.md)[] | Content of every active copy of this event, canonical first: the primary calendar's copy, then the freshest. A client picks the copy whose calendar it is showing and falls back to the first. Populated only on the read path, so stored projections omit it. |\n| <a id=\"property-status\"></a> `status` | [`EventStatus`](EventStatus.md) | Event status. |\n| <a id=\"property-time\"></a> `time` | [`EventTime`](EventTime.md) | Timed or all-day shape. |\n| <a id=\"property-title\"></a> `title` | `string` | Display title. |\n| <a id=\"property-transparency\"></a> `transparency` | [`EventTransparency`](EventTransparency.md) | Availability behavior. |\n| <a id=\"property-updatedat\"></a> `updatedAt` | `string` | Entity update time. |\n| <a id=\"property-viewercan\"></a> `viewerCan` | [`ViewerCapabilities`](ViewerCapabilities.md) | What the viewing requester may do with the event. Resolved only on the read path, alongside each attendee's `is_self`; nothing when no viewer is known. Source projections never store it. |\n| <a id=\"property-visibility\"></a> `visibility` | [`EventVisibility`](EventVisibility.md) | Event visibility. |\n\n\n<!-- generated/email/types.gen/type-aliases/CalendarEventSourceContent.md -->\n# Type Alias: CalendarEventSourceContent\n\n> **CalendarEventSourceContent** = \\{ `calendarId`: `string`; `creatorEmail?`: `string` \\| `null`; `creatorName?`: `string` \\| `null`; `description?`: `string` \\| `null`; `eventType`: [`EventType`](EventType.md); `isReadOnly`: `boolean`; `location?`: `string` \\| `null`; `reminders`: [`EventReminders`](EventReminders.md); `title`: `string`; `transparency`: [`EventTransparency`](EventTransparency.md); `visibility`: [`EventVisibility`](EventVisibility.md); \\}\n\nThe content one provider copy of an event carries.\n\nGoogle keeps these fields per calendar copy: a shared calendar's copy of a\nmember's event can have its own title, type, reminders, and access role.\nThe entity holds its canonical source's values. Every other copy's values\nare read from here so a client can show the copy that belongs to the\ncalendar being viewed.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-calendarid\"></a> `calendarId` | `string` | Calendar this copy lives on. |\n| <a id=\"property-creatoremail\"></a> `creatorEmail?` | `string` \\| `null` | Provider-reported creator email. |\n| <a id=\"property-creatorname\"></a> `creatorName?` | `string` \\| `null` | Provider-reported creator display name. |\n| <a id=\"property-description\"></a> `description?` | `string` \\| `null` | Optional event body. |\n| <a id=\"property-eventtype\"></a> `eventType` | [`EventType`](EventType.md) | Provider event type. |\n| <a id=\"property-isreadonly\"></a> `isReadOnly` | `boolean` | Whether the calendar's access role prohibits editing this copy. |\n| <a id=\"property-location\"></a> `location?` | `string` \\| `null` | Optional physical or virtual location label. |\n| <a id=\"property-reminders\"></a> `reminders` | [`EventReminders`](EventReminders.md) | Reminder configuration of this copy. |\n| <a id=\"property-title\"></a> `title` | `string` | Display title. |\n| <a id=\"property-transparency\"></a> `transparency` | [`EventTransparency`](EventTransparency.md) | Availability behavior. |\n| <a id=\"property-visibility\"></a> `visibility` | [`EventVisibility`](EventVisibility.md) | Event visibility. |\n\n\n<!-- generated/email/types.gen/type-aliases/CalendarInvitation.md -->\n# Type Alias: CalendarInvitation\n\n> **CalendarInvitation** = \\{ `attendees`: [`InvitationParticipant`](InvitationParticipant.md)[]; `comment?`: `string` \\| `null`; `conference_url?`: `string` \\| `null`; `description?`: `string` \\| `null`; `dtstamp?`: `string` \\| `null`; `end?`: `null` \\| [`InvitationDateTime`](InvitationDateTime.md); `id`: `string`; `last_modified?`: `string` \\| `null`; `location?`: `string` \\| `null`; `method`: [`InvitationMethod`](InvitationMethod.md); `organizer?`: `null` \\| [`InvitationParticipant`](InvitationParticipant.md); `recurrence_id?`: `null` \\| [`InvitationDateTime`](InvitationDateTime.md); `recurrence_id_raw?`: `string` \\| `null`; `sequence`: `number`; `start?`: `null` \\| [`InvitationDateTime`](InvitationDateTime.md); `status?`: `string` \\| `null`; `title?`: `string` \\| `null`; `uid`: `string`; \\}\n\nDisplay snapshot of one meaningful VEVENT, owned by the email domain.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-attendees\"></a> `attendees` | [`InvitationParticipant`](InvitationParticipant.md)[] | Historical attendee identities and participation metadata. |\n| <a id=\"property-comment\"></a> `comment?` | `string` \\| `null` | Reply or counter-proposal comment. |\n| <a id=\"property-conference_url\"></a> `conference_url?` | `string` \\| `null` | Validated HTTP(S) conferencing URL; never fetched during rendering. |\n| <a id=\"property-description\"></a> `description?` | `string` \\| `null` | Plaintext description, retaining passwords and dial-in instructions. |\n| <a id=\"property-dtstamp\"></a> `dtstamp?` | `string` \\| `null` | Scheduling timestamp in its original spelling. |\n| <a id=\"property-end\"></a> `end?` | `null` \\| [`InvitationDateTime`](InvitationDateTime.md) | - |\n| <a id=\"property-id\"></a> `id` | `string` | Content-derived component identity, stable across repeated extraction. |\n| <a id=\"property-last_modified\"></a> `last_modified?` | `string` \\| `null` | Last modification timestamp in its original spelling. |\n| <a id=\"property-location\"></a> `location?` | `string` \\| `null` | Plaintext event location. |\n| <a id=\"property-method\"></a> `method` | [`InvitationMethod`](InvitationMethod.md) | Original scheduling method. |\n| <a id=\"property-organizer\"></a> `organizer?` | `null` \\| [`InvitationParticipant`](InvitationParticipant.md) | - |\n| <a id=\"property-recurrence_id\"></a> `recurrence_id?` | `null` \\| [`InvitationDateTime`](InvitationDateTime.md) | - |\n| <a id=\"property-recurrence_id_raw\"></a> `recurrence_id_raw?` | `string` \\| `null` | Original recurrence identifier spelling and parameters. |\n| <a id=\"property-sequence\"></a> `sequence` | `number` | Scheduling revision, distinct from delivery order. |\n| <a id=\"property-start\"></a> `start?` | `null` \\| [`InvitationDateTime`](InvitationDateTime.md) | - |\n| <a id=\"property-status\"></a> `status?` | `string` \\| `null` | Original event status. |\n| <a id=\"property-title\"></a> `title?` | `string` \\| `null` | Event summary. |\n| <a id=\"property-uid\"></a> `uid` | `string` | iCalendar UID; never a Google provider event ID. |\n\n\n<!-- generated/email/types.gen/type-aliases/CalendarOccurrence.md -->\n# Type Alias: CalendarOccurrence\n\n> **CalendarOccurrence** = \\{ `eventId`: `string`; `isCancelled`: `boolean`; `occurrenceKey`: `string`; `recurrenceId?`: `string` \\| `null`; `time`: [`EventTime`](EventTime.md); \\}\n\nA materialized recurrence instance optimized for range queries.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-eventid\"></a> `eventId` | `string` | Owning event entity. |\n| <a id=\"property-iscancelled\"></a> `isCancelled` | `boolean` | Whether the instance was cancelled. |\n| <a id=\"property-occurrencekey\"></a> `occurrenceKey` | `string` | Stable key within the event. |\n| <a id=\"property-recurrenceid\"></a> `recurrenceId?` | `string` \\| `null` | Provider recurrence identifier, when applicable. |\n| <a id=\"property-time\"></a> `time` | [`EventTime`](EventTime.md) | Instance time. |\n\n\n<!-- generated/email/types.gen/type-aliases/ConferenceProvider.md -->\n# Type Alias: ConferenceProvider\n\n> **ConferenceProvider** = `\"microsoft_teams\"` \\| `\"google_meet\"` \\| `\"other\"`\n\nThe conferencing system backing an event's join URL.\n\nCalendars can create Google Meet or Microsoft Teams according to their\ncapabilities. Imported third-party conferences are labeled separately.\nOmitting a conference change preserves the current conference; explicit\nchanges still require provider and calendar capability validation.\n\n\n<!-- generated/email/types.gen/type-aliases/ContactInfo.md -->\n# Type Alias: ContactInfo\n\n> **ContactInfo** = \\{ `email`: `string`; `name?`: `string` \\| `null`; `photo_url?`: `string` \\| `null`; \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-email\"></a> `email` | `string` |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` |\n| <a id=\"property-photo_url\"></a> `photo_url?` | `string` \\| `null` |\n\n\n<!-- generated/email/types.gen/type-aliases/ContactInfoLegacy.md -->\n# Type Alias: ContactInfoLegacy\n\n> **ContactInfoLegacy** = \\{ `email`: `string`; `email_address`: `string`; `name?`: `string` \\| `null`; `photo_url?`: `string` \\| `null`; \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-email\"></a> `email` | `string` |\n| <a id=\"property-email_address\"></a> `email_address` | `string` |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` |\n| <a id=\"property-photo_url\"></a> `photo_url?` | `string` \\| `null` |\n\n\n<!-- generated/email/types.gen/type-aliases/ContactInfoWithInteraction.md -->\n# Type Alias: ContactInfoWithInteraction\n\n> **ContactInfoWithInteraction** = [`ContactInfoLegacy`](ContactInfoLegacy.md) & \\{ `last_interaction`: `string`; \\}\n\n## Type Declaration\n\n| Name | Type |\n| ------ | ------ |\n| `last_interaction` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/EventReminderOverride.md -->\n# Type Alias: EventReminderOverride\n\n> **EventReminderOverride** = \\{ `method`: `string`; `minutes`: `number`; \\}\n\nOne reminder: how it alerts and how many minutes before the event start\n(before midnight in the calendar's zone for all-day events) it fires.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-method\"></a> `method` | `string` | Provider method, stored verbatim; only `popup` fires Macro notifications. |\n| <a id=\"property-minutes\"></a> `minutes` | `number` | Minutes before the event start. |\n\n\n<!-- generated/email/types.gen/type-aliases/EventReminders.md -->\n# Type Alias: EventReminders\n\n> **EventReminders** = \\{ `overrides?`: [`EventReminderOverride`](EventReminderOverride.md)[]; `useDefault`: `boolean`; \\}\n\nPer-user reminder configuration for an event, mirroring Google's model:\neither the calendar's default reminders apply, or the explicit overrides\nreplace them entirely.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-overrides\"></a> `overrides?` | [`EventReminderOverride`](EventReminderOverride.md)[] | Explicit reminders replacing the defaults when `use_default` is off. |\n| <a id=\"property-usedefault\"></a> `useDefault` | `boolean` | Whether the calendar's default reminders apply. |\n\n\n<!-- generated/email/types.gen/type-aliases/EventStatus.md -->\n# Type Alias: EventStatus\n\n> **EventStatus** = `\"confirmed\"` \\| `\"tentative\"` \\| `\"cancelled\"`\n\nCanonical event status.\n\n\n<!-- generated/email/types.gen/type-aliases/EventTime.md -->\n# Type Alias: EventTime\n\n> **EventTime** = \\{ `endsAt`: `string`; `kind`: `\"timed\"`; `startsAt`: `string`; `timeZone?`: `string` \\| `null`; \\} \\| \\{ `endDate`: `string`; `kind`: `\"allDay\"`; `startDate`: `string`; \\}\n\nThe mutually exclusive time shape of a calendar event.\n\nFields are renamed per variant rather than with `rename_all_fields`\nbecause utoipa only honors variant-level serde renames when it\nderives the OpenAPI schema.\n\n## Union Members\n\n### Type Literal\n\n\\{ `endsAt`: `string`; `kind`: `\"timed\"`; `startsAt`: `string`; `timeZone?`: `string` \\| `null`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `endsAt` | `string` | Exclusive end instant; equal to the start for an imported point event. |\n| `kind` | `\"timed\"` | - |\n| `startsAt` | `string` | Inclusive start instant. |\n| `timeZone?` | `string` \\| `null` | Original IANA time-zone identifier, when supplied. |\n\n***\n\n### Type Literal\n\n\\{ `endDate`: `string`; `kind`: `\"allDay\"`; `startDate`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `endDate` | `string` | Exclusive local end date. |\n| `kind` | `\"allDay\"` | - |\n| `startDate` | `string` | Inclusive local start date. |\n\n\n<!-- generated/email/types.gen/type-aliases/EventTransparency.md -->\n# Type Alias: EventTransparency\n\n> **EventTransparency** = `\"opaque\"` \\| `\"transparent\"`\n\nWhether an event blocks availability.\n\n\n<!-- generated/email/types.gen/type-aliases/EventType.md -->\n# Type Alias: EventType\n\n> **EventType** = `\"default\"` \\| `\"out_of_office\"` \\| `\"focus_time\"` \\| `\"working_location\"` \\| `\"birthday\"` \\| `\"from_gmail\"`\n\nGoogle's event type: ordinary meetings versus the status-style entries\n(working location, out of office, focus time, birthdays) Google renders\nand notifies differently. Immutable at the provider after creation.\n\n\n<!-- generated/email/types.gen/type-aliases/EventVisibility.md -->\n# Type Alias: EventVisibility\n\n> **EventVisibility** = `\"default\"` \\| `\"public\"` \\| `\"private\"` \\| `\"confidential\"`\n\nVisibility of event details.\n\n\n<!-- generated/email/types.gen/type-aliases/GetAttachmentResponse.md -->\n# Type Alias: GetAttachmentResponse\n\n> **GetAttachmentResponse** = \\{ `attachment`: [`Attachment`](Attachment.md); \\}\n\nThe response returned from the get attachment endpoint\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-attachment\"></a> `attachment` | [`Attachment`](Attachment.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/GetAttachmentResponses.md -->\n# Type Alias: GetAttachmentResponses\n\n> **GetAttachmentResponses** = \\{ `200`: [`GetAttachmentResponse`](GetAttachmentResponse.md); \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-200\"></a> `200` | [`GetAttachmentResponse`](GetAttachmentResponse.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/GetMessageResponses.md -->\n# Type Alias: GetMessageResponses\n\n> **GetMessageResponses** = \\{ `200`: [`ParsedMessage`](ParsedMessage.md); \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-200\"></a> `200` | [`ParsedMessage`](ParsedMessage.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/GuestPolicy.md -->\n# Type Alias: GuestPolicy\n\n> **GuestPolicy** = \\{ `canInviteOthers`: `boolean`; `canModify`: `boolean`; `canSeeOtherGuests`: `boolean`; \\}\n\nThe switches an organizer sets on an event to bound what its guests may\ndo. Google omits a switch from the payload while it holds its default.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-caninviteothers\"></a> `canInviteOthers` | `boolean` | Whether guests may invite others. |\n| <a id=\"property-canmodify\"></a> `canModify` | `boolean` | Whether guests may change the event, including its guest list. |\n| <a id=\"property-canseeotherguests\"></a> `canSeeOtherGuests` | `boolean` | Whether guests may see the guest list. |\n\n\n<!-- generated/email/types.gen/type-aliases/InvitationDateTime.md -->\n# Type Alias: InvitationDateTime\n\n> **InvitationDateTime** = \\{ `kind`: `\"date\"`; `value`: `string`; \\} \\| \\{ `kind`: `\"zoned\"`; `time_zone`: `string`; `value`: `string`; \\} \\| \\{ `kind`: `\"unresolved\"`; `time_zone?`: `string` \\| `null`; `value`: `string`; \\}\n\nPreserve date-only and unresolved times without manufacturing UTC instants.\n\n## Union Members\n\n### Type Literal\n\n\\{ `kind`: `\"date\"`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"date\"` | - |\n| `value` | `string` | ISO calendar date. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"zoned\"`; `time_zone`: `string`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"zoned\"` | - |\n| `time_zone` | `string` | IANA zone of the original TZID, or UTC. |\n| `value` | `string` | RFC3339 instant. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"unresolved\"`; `time_zone?`: `string` \\| `null`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"unresolved\"` | - |\n| `time_zone?` | `string` \\| `null` | Original TZID if present. |\n| `value` | `string` | ISO local wall time, without an offset. |\n\n\n<!-- generated/email/types.gen/type-aliases/InvitationMethod.md -->\n# Type Alias: InvitationMethod\n\n> **InvitationMethod** = `\"request\"` \\| `\"reply\"` \\| `\"cancel\"` \\| `\"counter\"` \\| `\"publish\"` \\| `\"unknown\"`\n\nOriginal scheduling method, including methods unsupported for actions.\n\n\n<!-- generated/email/types.gen/type-aliases/InvitationParticipant.md -->\n# Type Alias: InvitationParticipant\n\n> **InvitationParticipant** = \\{ `email`: `string`; `name?`: `string` \\| `null`; `participation_status?`: `string` \\| `null`; \\}\n\nScheduling participant; saved responses are historical, not current RSVP.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-email\"></a> `email` | `string` | Participant calendar address. |\n| <a id=\"property-name\"></a> `name?` | `string` \\| `null` | Sender-supplied display name. |\n| <a id=\"property-participation_status\"></a> `participation_status?` | `string` \\| `null` | Original PARTSTAT, retaining extensions. |\n\n\n<!-- generated/email/types.gen/type-aliases/InvitationResolution.md -->\n# Type Alias: InvitationResolution\n\n> **InvitationResolution** = \\{ `kind`: `\"disconnected\"`; \\} \\| \\{ `kind`: `\"still_syncing\"`; \\} \\| \\{ `kind`: `\"cancelled\"`; \\} \\| \\{ `kind`: `\"unavailable\"`; \\} \\| \\{ `kind`: `\"no_match\"`; \\} \\| \\{ `kind`: `\"ambiguous\"`; \\} \\| \\{ `can_join`: `boolean`; `can_respond`: `boolean`; `event`: [`CalendarEvent`](CalendarEvent.md); `is_stale`: `boolean`; `kind`: `\"resolved\"`; `occurrence`: [`CalendarOccurrence`](CalendarOccurrence.md); `responding_email`: `string`; \\}\n\nRefreshable result, distinct from the immutable email contents.\n\n## Union Members\n\n### Type Literal\n\n\\{ `kind`: `\"disconnected\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"still_syncing\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"cancelled\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"unavailable\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"no_match\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"ambiguous\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `can_join`: `boolean`; `can_respond`: `boolean`; `event`: [`CalendarEvent`](CalendarEvent.md); `is_stale`: `boolean`; `kind`: `\"resolved\"`; `occurrence`: [`CalendarOccurrence`](CalendarOccurrence.md); `responding_email`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `can_join` | `boolean` | Whether the conference link belongs to the reconciled scheduling target. |\n| `can_respond` | `boolean` | Whether a response is currently allowed. |\n| `event` | [`CalendarEvent`](CalendarEvent.md) | Current occurrence-specific content. |\n| `is_stale` | `boolean` | Whether the provider projection trails the email revision. |\n| `kind` | `\"resolved\"` | - |\n| `occurrence` | [`CalendarOccurrence`](CalendarOccurrence.md) | Original occurrence identity and current time. |\n| `responding_email` | `string` | Connected address that would respond. |\n\n\n<!-- generated/email/types.gen/type-aliases/LabelInfo.md -->\n# Type Alias: LabelInfo\n\n> **LabelInfo** = \\{ `name`: `string`; `provider_id`: `string`; \\}\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-name\"></a> `name` | `string` |\n| <a id=\"property-provider_id\"></a> `provider_id` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/Link.md -->\n# Type Alias: Link\n\n> **Link** = \\{ `calendar_disabled`: `boolean`; `created_at`: `string`; `email_address`: `string`; `fusionauth_user_id`: `string`; `has_calendar_data`: `boolean`; `id`: `string`; `is_primary`: `boolean`; `is_sync_active`: `boolean`; `macro_id`: `string`; `needs_calendar_permission`: `boolean`; `needs_reauth`: `boolean`; `photo_url?`: `string` \\| `null`; `provider`: [`UserProvider`](UserProvider.md); `settings`: [`Settings`](Settings.md); `sync_status`: [`SyncStatus`](SyncStatus.md); `updated_at`: `string`; \\}\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-calendar_disabled\"></a> `calendar_disabled` | `boolean` | Whether the user turned calendar off for this inbox, which also removed its calendar data. `needs_calendar_permission` is true either way, so this is what separates \"never granted\" from \"deliberately off\" — unprompted calendar nags must stay quiet for the latter. |\n| <a id=\"property-created_at\"></a> `created_at` | `string` | - |\n| <a id=\"property-email_address\"></a> `email_address` | `string` | - |\n| <a id=\"property-fusionauth_user_id\"></a> `fusionauth_user_id` | `string` | - |\n| <a id=\"property-has_calendar_data\"></a> `has_calendar_data` | `boolean` | Whether Macro holds calendar data for this inbox. Drives the turn-off control on its own, so removing that data never depends on the recorded scopes still matching the set Macro requests today — a set that changes as the integration narrows, stranding data behind a capability check that no longer recognizes an older grant. |\n| <a id=\"property-id\"></a> `id` | `string` | - |\n| <a id=\"property-is_primary\"></a> `is_primary` | `boolean` | - |\n| <a id=\"property-is_sync_active\"></a> `is_sync_active` | `boolean` | - |\n| <a id=\"property-macro_id\"></a> `macro_id` | `string` | - |\n| <a id=\"property-needs_calendar_permission\"></a> `needs_calendar_permission` | `boolean` | Whether the link's Google grant is missing the calendar scope. True for inboxes connected before the calendar capability existed (and for grants where the user declined it); drives the per-inbox calendar upgrade prompt. Re-running the connect flow records the new grant. |\n| <a id=\"property-needs_reauth\"></a> `needs_reauth` | `boolean` | Whether the link's Google grant needs to be reconnected. Drives the per-inbox reconnect prompt independently of the sync-status badge. |\n| <a id=\"property-photo_url\"></a> `photo_url?` | `string` \\| `null` | The inbox's own profile photo (its self-contact's SFS photo), if synced. |\n| <a id=\"property-provider\"></a> `provider` | [`UserProvider`](UserProvider.md) | - |\n| <a id=\"property-settings\"></a> `settings` | [`Settings`](Settings.md) | - |\n| <a id=\"property-sync_status\"></a> `sync_status` | [`SyncStatus`](SyncStatus.md) | - |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` | - |\n\n\n<!-- generated/email/types.gen/type-aliases/MailboxAction.md -->\n# Type Alias: MailboxAction\n\n> **MailboxAction** = \\{ `kind`: `\"read\"`; `value`: `boolean`; \\} \\| \\{ `kind`: `\"flagged\"`; `value`: `boolean`; \\} \\| \\{ `kind`: `\"archived\"`; `value`: `boolean`; \\} \\| \\{ `kind`: `\"trashed\"`; `value`: `boolean`; \\} \\| \\{ `kind`: `\"junk\"`; `value`: `boolean`; \\} \\| \\{ `kind`: `\"category\"`; `value`: \\{ `name`: `string`; `present`: `boolean`; \\}; \\}\n\nDesired organization state. Categories never stand in for folders or flags.\n\n## Union Members\n\n### Type Literal\n\n\\{ `kind`: `\"read\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"read\"` | - |\n| `value` | `boolean` | Mark correspondence read or unread. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"flagged\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"flagged\"` | - |\n| `value` | `boolean` | Set the follow-up star. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"archived\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"archived\"` | - |\n| `value` | `boolean` | Archive inbox messages, or restore received correspondence to the inbox. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"trashed\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"trashed\"` | - |\n| `value` | `boolean` | Move to recoverable trash, or restore correspondence to Inbox (drafts to Drafts). |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"junk\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"junk\"` | - |\n| `value` | `boolean` | Move to junk, or restore to the inbox. |\n\n***\n\n### Type Literal\n\n\\{ `kind`: `\"category\"`; `value`: \\{ `name`: `string`; `present`: `boolean`; \\}; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `kind` | `\"category\"` | - |\n| `value` | \\{ `name`: `string`; `present`: `boolean`; \\} | Add/remove a category while preserving other provider assignments. |\n| `value.name` | `string` | - |\n| `value.present` | `boolean` | - |\n\n\n<!-- generated/email/types.gen/type-aliases/MailboxOperation.md -->\n# Type Alias: MailboxOperation\n\n> **MailboxOperation** = \\{ `action`: [`MailboxAction`](MailboxAction.md); `id`: `string`; `state`: [`MailboxOperationState`](MailboxOperationState.md); `updated_at`: `string`; \\}\n\nDurable outcome of an accepted organization action.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-action\"></a> `action` | [`MailboxAction`](MailboxAction.md) |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-state\"></a> `state` | [`MailboxOperationState`](MailboxOperationState.md) |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/MailboxOperationState.md -->\n# Type Alias: MailboxOperationState\n\n> **MailboxOperationState** = `\"pending\"` \\| `\"applied\"` \\| `\"failed\"` \\| `\"cancelled\"`\n\n\n<!-- generated/email/types.gen/type-aliases/MailboxSettingsChange.md -->\n# Type Alias: MailboxSettingsChange\n\n> **MailboxSettingsChange** = `\"create_label\"` \\| `\"delete_label\"` \\| `\"sender_block\"`\n\n\n<!-- generated/email/types.gen/type-aliases/MailboxSettingsOperation.md -->\n# Type Alias: MailboxSettingsOperation\n\n> **MailboxSettingsOperation** = \\{ `enabled`: `boolean`; `id`: `string`; `kind`: [`MailboxSettingsChange`](MailboxSettingsChange.md); `needs_attention`: `boolean`; `resource`: `string`; \\}\n\nAn accepted inbox configuration change awaiting provider confirmation.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-enabled\"></a> `enabled` | `boolean` |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-kind\"></a> `kind` | [`MailboxSettingsChange`](MailboxSettingsChange.md) |\n| <a id=\"property-needs_attention\"></a> `needs_attention` | `boolean` |\n| <a id=\"property-resource\"></a> `resource` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/MessageOperationResponse.md -->\n# Type Alias: MessageOperationResponse\n\n> **MessageOperationResponse** = \\{ `operation?`: `null` \\| [`ApiMessageOperation`](ApiMessageOperation.md); \\}\n\nAuthorized polling response. Gmail has no asynchronous draft operation.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-operation\"></a> `operation?` | `null` \\| [`ApiMessageOperation`](ApiMessageOperation.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/ParsedMessage.md -->\n# Type Alias: ParsedMessage\n\n> **ParsedMessage** = \\{ `bcc`: [`ContactInfo`](ContactInfo.md)[]; `body_parsed?`: `string` \\| `null`; `cc`: [`ContactInfo`](ContactInfo.md)[]; `db_id`: `string`; `draft_generation?`: `number`; `from?`: `null` \\| [`ContactInfo`](ContactInfo.md); `internal_date_ts?`: `string` \\| `null`; `labels`: [`LabelInfo`](LabelInfo.md)[]; `link_id`: `string`; `subject?`: `string` \\| `null`; `thread_db_id`: `string`; `to`: [`ContactInfo`](ContactInfo.md)[]; \\}\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc` | [`ContactInfo`](ContactInfo.md)[] | - |\n| <a id=\"property-body_parsed\"></a> `body_parsed?` | `string` \\| `null` | - |\n| <a id=\"property-cc\"></a> `cc` | [`ContactInfo`](ContactInfo.md)[] | - |\n| <a id=\"property-db_id\"></a> `db_id` | `string` | - |\n| <a id=\"property-draft_generation\"></a> `draft_generation?` | `number` | Draft edit generation captured with this message snapshot. |\n| <a id=\"property-from\"></a> `from?` | `null` \\| [`ContactInfo`](ContactInfo.md) | - |\n| <a id=\"property-internal_date_ts\"></a> `internal_date_ts?` | `string` \\| `null` | - |\n| <a id=\"property-labels\"></a> `labels` | [`LabelInfo`](LabelInfo.md)[] | - |\n| <a id=\"property-link_id\"></a> `link_id` | `string` | - |\n| <a id=\"property-subject\"></a> `subject?` | `string` \\| `null` | - |\n| <a id=\"property-thread_db_id\"></a> `thread_db_id` | `string` | - |\n| <a id=\"property-to\"></a> `to` | [`ContactInfo`](ContactInfo.md)[] | - |\n\n\n<!-- generated/email/types.gen/type-aliases/ResolveMessageOperationRequest.md -->\n# Type Alias: ResolveMessageOperationRequest\n\n> **ResolveMessageOperationRequest** = \\{ `accept_duplicate_risk?`: `boolean`; `action`: [`ApiMessageResolutionAction`](ApiMessageResolutionAction.md); `remote_version?`: `string` \\| `null`; `revision`: `string`; \\}\n\nStale versions fail without altering the current operation.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-accept_duplicate_risk\"></a> `accept_duplicate_risk?` | `boolean` |\n| <a id=\"property-action\"></a> `action` | [`ApiMessageResolutionAction`](ApiMessageResolutionAction.md) |\n| <a id=\"property-remote_version\"></a> `remote_version?` | `string` \\| `null` |\n| <a id=\"property-revision\"></a> `revision` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/ScheduledSendStatus.md -->\n# Type Alias: ScheduledSendStatus\n\n> **ScheduledSendStatus** = `\"pending\"` \\| `\"sending\"` \\| `\"failed\"` \\| `\"unconfirmed\"`\n\nThe user-visible delivery state of an unsent scheduled message.\n\n\n<!-- generated/email/types.gen/type-aliases/Settings.md -->\n# Type Alias: Settings\n\n> **Settings** = \\{ `signature?`: `string` \\| `null`; `signature_on_replies_forwards?`: `boolean` \\| `null`; \\}\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-signature\"></a> `signature?` | `string` \\| `null` | The user's email signature content (HTML). On a patch, omit or send `null` to leave unchanged (both deserialize to `None`); pass an empty string to clear it. The column cannot be set to SQL NULL via patch. |\n| <a id=\"property-signature_on_replies_forwards\"></a> `signature_on_replies_forwards?` | `boolean` \\| `null` | - |\n\n\n<!-- generated/email/types.gen/type-aliases/SyncStatus.md -->\n# Type Alias: SyncStatus\n\n> **SyncStatus** = `\"SYNCING\"` \\| `\"UP_TO_DATE\"` \\| `\"ERROR\"` \\| `\"NEEDS_REAUTH\"` \\| `\"INACTIVE\"`\n\nCoarse sync state for an inbox, used to render a one-line hint in the\nmulti-inbox settings list. Derived from the link's `is_sync_active` flag, its\nreauth health, and its most recent backfill job.\n\n\n<!-- generated/email/types.gen/type-aliases/ThreadStateField.md -->\n# Type Alias: ThreadStateField\n\n> **ThreadStateField** = `\"read\"` \\| `\"starred\"` \\| `\"trashed\"` \\| `\"junk\"`\n\nSemantic mailbox facts, independent of folder/category names.\n\n\n<!-- generated/email/types.gen/type-aliases/TransferDraftRequest.md -->\n# Type Alias: TransferDraftRequest\n\n> **TransferDraftRequest** = \\{ `destination_link_id`: `string`; `draft_generation?`: `number`; `operation_id`: `string`; \\}\n\nReuse the same operation ID when retrying after a lost response.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-destination_link_id\"></a> `destination_link_id` | `string` | - |\n| <a id=\"property-draft_generation\"></a> `draft_generation?` | `number` | Generation captured with the source draft. |\n| <a id=\"property-operation_id\"></a> `operation_id` | `string` | - |\n\n\n<!-- generated/email/types.gen/type-aliases/TransferDraftResponse.md -->\n# Type Alias: TransferDraftResponse\n\n> **TransferDraftResponse** = \\{ `attachments`: [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[]; `message_id`: `string`; `source_id`: `string`; `source_thread_id`: `string`; `thread_id`: `string`; \\}\n\nA new identity prevents delayed writes from mutating the moved copy.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-attachments\"></a> `attachments` | [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[] |\n| <a id=\"property-message_id\"></a> `message_id` | `string` |\n| <a id=\"property-source_id\"></a> `source_id` | `string` |\n| <a id=\"property-source_thread_id\"></a> `source_thread_id` | `string` |\n| <a id=\"property-thread_id\"></a> `thread_id` | `string` |\n\n\n<!-- generated/email/types.gen/type-aliases/TransferRecoveryResponse.md -->\n# Type Alias: TransferRecoveryResponse\n\n> **TransferRecoveryResponse** = \\{ `committed?`: `null` \\| [`TransferDraftResponse`](TransferDraftResponse.md); \\}\n\nA null result confirms that the move cannot commit, even if its request was delayed.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-committed\"></a> `committed?` | `null` \\| [`TransferDraftResponse`](TransferDraftResponse.md) |\n\n\n<!-- generated/email/types.gen/type-aliases/UpdateThreadStateRequest.md -->\n# Type Alias: UpdateThreadStateRequest\n\n> **UpdateThreadStateRequest** = \\{ `field`: [`ThreadStateField`](ThreadStateField.md); `value`: `boolean`; \\}\n\nDesired state for every applicable message in an authorized thread.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-field\"></a> `field` | [`ThreadStateField`](ThreadStateField.md) |\n| <a id=\"property-value\"></a> `value` | `boolean` |\n\n\n<!-- generated/email/types.gen/type-aliases/UserProvider.md -->\n# Type Alias: UserProvider\n\n> **UserProvider** = `\"GMAIL\"` \\| `\"OUTLOOK\"`\n\n\n<!-- generated/email/types.gen/type-aliases/Value.md -->\n# Type Alias: Value\n\n> **Value** = `unknown`\n\n\n<!-- generated/email/types.gen/type-aliases/ViewerCapabilities.md -->\n# Type Alias: ViewerCapabilities\n\n> **ViewerCapabilities** = \\{ `editDetails`: `boolean`; `inviteGuests`: `boolean`; `removeGuests`: `boolean`; `rsvp`: `boolean`; `setGuestPolicy`: `boolean`; \\}\n\nWhat the viewing requester may do with an event.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-editdetails\"></a> `editDetails` | `boolean` | Change the event's details (title, time, description, conference). |\n| <a id=\"property-inviteguests\"></a> `inviteGuests` | `boolean` | Add guests. |\n| <a id=\"property-removeguests\"></a> `removeGuests` | `boolean` | Remove guests. |\n| <a id=\"property-rsvp\"></a> `rsvp` | `boolean` | Answer the invitation. |\n| <a id=\"property-setguestpolicy\"></a> `setGuestPolicy` | `boolean` | Change the event's guest policy. |\n\n\n<!-- generated/properties/types.gen/type-aliases/BulkUpdateEntityPropertyOptionsResponse.md -->\n# Type Alias: BulkUpdateEntityPropertyOptionsResponse\n\n> **BulkUpdateEntityPropertyOptionsResponse** = \\{ `properties`: [`EntityPropertyOptionSelectionResponse`](EntityPropertyOptionSelectionResponse.md)[]; \\}\n\nResponse for a bulk option update: each property's reconciled final ids.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-properties\"></a> `properties` | [`EntityPropertyOptionSelectionResponse`](EntityPropertyOptionSelectionResponse.md)[] | The final option ids per updated property. |\n\n\n<!-- generated/properties/types.gen/type-aliases/DataType.md -->\n# Type Alias: DataType\n\n> **DataType** = `\"BOOLEAN\"` \\| `\"DATE\"` \\| `\"NUMBER\"` \\| `\"STRING\"` \\| `\"SELECT_NUMBER\"` \\| `\"SELECT_STRING\"` \\| `\"TAG\"` \\| `\"ENTITY\"` \\| `\"LINK\"`\n\nData type for property values, determining storage and validation.\n\n\n<!-- generated/properties/types.gen/type-aliases/EntityProperty.md -->\n# Type Alias: EntityProperty\n\n> **EntityProperty** = \\{ `created_at`: `string`; `entity_id`: `string`; `entity_type`: [`EntityType`](EntityType.md); `id`: `string`; `property_definition_id`: `string`; `updated_at`: `string`; \\}\n\nAssignment of a property definition to a specific entity (service representation).\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` |\n| <a id=\"property-entity_id\"></a> `entity_id` | `string` |\n| <a id=\"property-entity_type\"></a> `entity_type` | [`EntityType`](EntityType.md) |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-property_definition_id\"></a> `property_definition_id` | `string` |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` |\n\n\n<!-- generated/properties/types.gen/type-aliases/EntityPropertyOptionSelectionResponse.md -->\n# Type Alias: EntityPropertyOptionSelectionResponse\n\n> **EntityPropertyOptionSelectionResponse** = \\{ `option_ids`: `string`[]; `property_id`: `string`; \\}\n\nThe reconciled final option ids stored for one property after a bulk update.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-option_ids\"></a> `option_ids` | `string`[] | The final option ids the server persisted, in stored order. |\n| <a id=\"property-property_id\"></a> `property_id` | `string` | The property definition the options belong to. |\n\n\n<!-- generated/properties/types.gen/type-aliases/EntityPropertyWithDefinition.md -->\n# Type Alias: EntityPropertyWithDefinition\n\n> **EntityPropertyWithDefinition** = \\{ `definition`: [`PropertyDefinition`](PropertyDefinition.md); `options?`: [`PropertyOption`](PropertyOption.md)[] \\| `null`; `property`: [`EntityProperty`](EntityProperty.md); `value?`: `null` \\| [`PropertyValue`](PropertyValue.md); \\}\n\nEntity property with its definition, value, and options (service representation).\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-definition\"></a> `definition` | [`PropertyDefinition`](PropertyDefinition.md) |\n| <a id=\"property-options\"></a> `options?` | [`PropertyOption`](PropertyOption.md)[] \\| `null` |\n| <a id=\"property-property\"></a> `property` | [`EntityProperty`](EntityProperty.md) |\n| <a id=\"property-value\"></a> `value?` | `null` \\| [`PropertyValue`](PropertyValue.md) |\n\n\n<!-- generated/properties/types.gen/type-aliases/EntityReference.md -->\n# Type Alias: EntityReference\n\n> **EntityReference** = \\{ `entity_id`: `string`; `entity_type`: [`EntityType`](EntityType.md); `specific_message_id?`: `string` \\| `null`; \\}\n\nEntity reference for entity-type property values.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-entity_id\"></a> `entity_id` | `string` | - |\n| <a id=\"property-entity_type\"></a> `entity_type` | [`EntityType`](EntityType.md) | - |\n| <a id=\"property-specific_message_id\"></a> `specific_message_id?` | `string` \\| `null` | For CHANNEL, CHAT, THREAD entity types - optional specific message ID. This allows referencing a specific message within a thread/channel/chat. |\n\n\n<!-- generated/properties/types.gen/type-aliases/EntityType.md -->\n# Type Alias: EntityType\n\n> **EntityType** = `\"CALENDAR_EVENT\"` \\| `\"CALL_RECORD\"` \\| `\"CHANNEL\"` \\| `\"CHAT\"` \\| `\"COMPANY\"` \\| `\"DATABASE_ROW\"` \\| `\"CONTACT\"` \\| `\"DOCUMENT\"` \\| `\"INITIATIVE\"` \\| `\"PROJECT\"` \\| `\"TASK\"` \\| `\"THREAD\"` \\| `\"USER\"`\n\nType of entity that can be referenced by entity properties.\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyDefinition.md -->\n# Type Alias: PropertyDefinition\n\n> **PropertyDefinition** = \\{ `created_at`: `string`; `data_type`: [`DataType`](DataType.md); `display_name`: `string`; `id`: `string`; `is_metadata`: `boolean`; `is_multi_select`: `boolean`; `is_system`: `boolean`; `owner`: [`PropertyOwner`](PropertyOwner.md); `specific_entity_type`: `null` \\| [`EntityType`](EntityType.md); `updated_at`: `string`; \\}\n\nProperty definition model (service representation).\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` | - |\n| <a id=\"property-data_type\"></a> `data_type` | [`DataType`](DataType.md) | - |\n| <a id=\"property-display_name\"></a> `display_name` | `string` | - |\n| <a id=\"property-id\"></a> `id` | `string` | - |\n| <a id=\"property-is_metadata\"></a> `is_metadata` | `boolean` | Flag to indicate if this is a system-generated metadata property. Not stored in database - computed at service layer. |\n| <a id=\"property-is_multi_select\"></a> `is_multi_select` | `boolean` | - |\n| <a id=\"property-is_system\"></a> `is_system` | `boolean` | Flag to indicate if this is a system property (stored in DB). |\n| <a id=\"property-owner\"></a> `owner` | [`PropertyOwner`](PropertyOwner.md) | - |\n| <a id=\"property-specific_entity_type\"></a> `specific_entity_type` | `null` \\| [`EntityType`](EntityType.md) | - |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` | - |\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyOption.md -->\n# Type Alias: PropertyOption\n\n> **PropertyOption** = \\{ `color`: `string` \\| `null`; `created_at`: `string`; `display_order`: `number`; `id`: `string`; `property_definition_id`: `string`; `updated_at`: `string`; `value`: [`PropertyOptionValue`](PropertyOptionValue.md); \\}\n\nA selectable option for select-type properties (service representation).\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-color\"></a> `color` | `string` \\| `null` |\n| <a id=\"property-created_at\"></a> `created_at` | `string` |\n| <a id=\"property-display_order\"></a> `display_order` | `number` |\n| <a id=\"property-id\"></a> `id` | `string` |\n| <a id=\"property-property_definition_id\"></a> `property_definition_id` | `string` |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` |\n| <a id=\"property-value\"></a> `value` | [`PropertyOptionValue`](PropertyOptionValue.md) |\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyOptionValue.md -->\n# Type Alias: PropertyOptionValue\n\n> **PropertyOptionValue** = \\{ `type`: `\"string\"`; `value`: `string`; \\} \\| \\{ `type`: `\"number\"`; `value`: `number`; \\}\n\nThe value of a property option - either a string or a number.\n\n## Union Members\n\n### Type Literal\n\n\\{ `type`: `\"string\"`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"string\"` | - |\n| `value` | `string` | String value for SelectString properties |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"number\"`; `value`: `number`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"number\"` | - |\n| `value` | `number` | Number value for SelectNumber properties |\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyOwner.md -->\n# Type Alias: PropertyOwner\n\n> **PropertyOwner** = \\{ `scope`: `\"user\"`; `user_id`: `string`; \\} \\| \\{ `scope`: `\"team\"`; `team_id`: `string`; \\} \\| \\{ `database_id`: `string`; `scope`: `\"database\"`; \\} \\| \\{ `scope`: `\"system\"`; \\}\n\nDefines who owns a property - user-scoped, team-scoped, database-scoped, or system.\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyTargetEntityType.md -->\n# Type Alias: PropertyTargetEntityType\n\n> **PropertyTargetEntityType** = `\"CALL_RECORD\"` \\| `\"CHANNEL\"` \\| `\"CHAT\"` \\| `\"COMPANY\"` \\| `\"DATABASE_ROW\"` \\| `\"DOCUMENT\"` \\| `\"INITIATIVE\"` \\| `\"PROJECT\"` \\| `\"THREAD\"` \\| `\"USER\"`\n\nCanonical type of an entity receiving properties.\n\nTasks are documents at API boundaries. `Task` intentionally does not exist\nhere; task classification is resolved by the properties domain from the\ndocument subtype.\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyTargetReference.md -->\n# Type Alias: PropertyTargetReference\n\n> **PropertyTargetReference** = \\{ `entity_id`: `string`; `entity_type`: [`PropertyTargetEntityType`](PropertyTargetEntityType.md); \\}\n\nCanonical reference to an entity receiving properties.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-entity_id\"></a> `entity_id` | `string` | Entity identifier. |\n| <a id=\"property-entity_type\"></a> `entity_type` | [`PropertyTargetEntityType`](PropertyTargetEntityType.md) | Canonical entity type. |\n\n\n<!-- generated/properties/types.gen/type-aliases/PropertyValue.md -->\n# Type Alias: PropertyValue\n\n> **PropertyValue** = \\{ `type`: `\"Boolean\"`; `value`: `boolean`; \\} \\| \\{ `type`: `\"Number\"`; `value`: `number`; \\} \\| \\{ `type`: `\"String\"`; `value`: `string`; \\} \\| \\{ `type`: `\"Date\"`; `value`: `string`; \\} \\| \\{ `type`: `\"SelectOption\"`; `value`: `string`[]; \\} \\| \\{ `type`: `\"EntityReference\"`; `value`: [`EntityReference`](EntityReference.md)[]; \\} \\| \\{ `type`: `\"Link\"`; `value`: `string`[]; \\}\n\nProperty value (service representation).\n\nRepresents the actual value stored for an entity property.\nThis is serialized to/from JSONB in the database.\n\n## Union Members\n\n### Type Literal\n\n\\{ `type`: `\"Boolean\"`; `value`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"Boolean\"` | - |\n| `value` | `boolean` | Boolean value Serializes as: {\"type\": \"Boolean\", \"value\": true} |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"Number\"`; `value`: `number`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"Number\"` | - |\n| `value` | `number` | Numeric value Serializes as: {\"type\": \"Number\", \"value\": 42.5} |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"String\"`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"String\"` | - |\n| `value` | `string` | String value Serializes as: {\"type\": \"String\", \"value\": \"text\"} |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"Date\"`; `value`: `string`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"Date\"` | - |\n| `value` | `string` | Date/timestamp value Serializes as: {\"type\": \"Date\", \"value\": \"2025-01-01T00:00:00Z\"} |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"SelectOption\"`; `value`: `string`[]; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"SelectOption\"` | - |\n| `value` | `string`[] | Select option(s) - always an array (check is_multi_select to determine if single or multi) Single-select: {\"type\": \"SelectOption\", \"value\": [\"uuid\"]} (length 0 or 1) Multi-select: {\"type\": \"SelectOption\", \"value\": [\"uuid1\", \"uuid2\", ...]} (length 0+) |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"EntityReference\"`; `value`: [`EntityReference`](EntityReference.md)[]; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"EntityReference\"` | - |\n| `value` | [`EntityReference`](EntityReference.md)[] | Entity reference(s) - always an array (check is_multi_select to determine if single or multi) Single-select: {\"type\": \"EntityReference\", \"value\": [{...}]} (length 0 or 1) Multi-select: {\"type\": \"EntityReference\", \"value\": [{...}, {...}, ...]} (length 0+) |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"Link\"`; `value`: `string`[]; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `\"Link\"` | - |\n| `value` | `string`[] | Link value(s) - always an array (check is_multi_select to determine if single or multi) Single-select: {\"type\": \"Link\", \"value\": [\"https://example.com\"]} (length 0 or 1) Multi-select: {\"type\": \"Link\", \"value\": [\"https://example.com\", \"https://other.com\"]} (length 0+) |\n\n\n<!-- generated/properties/types.gen/type-aliases/SetPropertyValue.md -->\n# Type Alias: SetPropertyValue\n\n> **SetPropertyValue** = \\{ `type`: `\"boolean\"`; `value`: `boolean`; \\} \\| \\{ `type`: `\"date\"`; `value`: `string`; \\} \\| \\{ `type`: `\"number\"`; `value`: `number`; \\} \\| \\{ `type`: `\"string\"`; `value`: `string`; \\} \\| \\{ `option_id`: `string`; `type`: `\"select_option\"`; \\} \\| \\{ `option_ids`: `string`[]; `type`: `\"multi_select_option\"`; \\} \\| \\{ `reference`: [`EntityReference`](EntityReference.md); `type`: `\"entity_reference\"`; \\} \\| \\{ `references`: [`EntityReference`](EntityReference.md)[]; `type`: `\"multi_entity_reference\"`; \\} \\| \\{ `type`: `\"link\"`; `url`: `string`; \\} \\| \\{ `type`: `\"multi_link\"`; `urls`: `string`[]; \\}\n\nType-safe enum for setting entity property values - provides compile-time validation.\n\n\n<!-- generated/storage/types.gen/type-aliases/AccessLevel.md -->\n# Type Alias: AccessLevel\n\n> **AccessLevel** = `\"view\"` \\| `\"comment\"` \\| `\"edit\"` \\| `\"owner\"`\n\nOrdered from least to most access top -> bottom\n\n\n<!-- generated/storage/types.gen/type-aliases/EmailFollowup.md -->\n# Type Alias: EmailFollowup\n\n> **EmailFollowup** = \\{ `condition`: [`EmailReminderCondition`](EmailReminderCondition.md); `linkId`: `string`; `remindAt`: `string`; `reminderId`: `string`; `revision`: `string`; `state`: [`FollowupState`](FollowupState.md); `threadId`: `string`; \\}\n\nPublic status shown on email and in the Reminders editor.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-condition\"></a> `condition` | [`EmailReminderCondition`](EmailReminderCondition.md) | Condition, defaulting to no reply for new follow-ups. |\n| <a id=\"property-linkid\"></a> `linkId` | `string` | Canonical owned/delegated inbox. |\n| <a id=\"property-remindat\"></a> `remindAt` | `string` | Confirmed schedule. |\n| <a id=\"property-reminderid\"></a> `reminderId` | `string` | Identity of the snooze and its delivery records. |\n| <a id=\"property-revision\"></a> `revision` | `string` | Last accepted operation; edits/removal compare this to prevent stale undo. |\n| <a id=\"property-state\"></a> `state` | [`FollowupState`](FollowupState.md) | Durable lifecycle progress. |\n| <a id=\"property-threadid\"></a> `threadId` | `string` | Conversation identity. |\n\n\n<!-- generated/storage/types.gen/type-aliases/EmailFollowupCommand.md -->\n# Type Alias: EmailFollowupCommand\n\n> **EmailFollowupCommand** = \\{ `condition`: [`EmailReminderCondition`](EmailReminderCondition.md); `expectedRevision?`: `string` \\| `null`; `operationId`: `string`; `remindAt`: `string`; `type`: `\"set\"`; \\} \\| \\{ `expectedRevision`: `string`; `operationId`: `string`; `type`: `\"remove\"`; `undo?`: `boolean`; \\}\n\nIdempotent email command. Reusing an operation ID with different data fails.\n\n## Union Members\n\n### Type Literal\n\n\\{ `condition`: [`EmailReminderCondition`](EmailReminderCondition.md); `expectedRevision?`: `string` \\| `null`; `operationId`: `string`; `remindAt`: `string`; `type`: `\"set\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `condition` | [`EmailReminderCondition`](EmailReminderCondition.md) | Reply condition. |\n| `expectedRevision?` | `string` \\| `null` | None for creation, the current revision for edits. |\n| `operationId` | `string` | Unique request identity retained across network retries. |\n| `remindAt` | `string` | One future instant; conditional recurrence is deliberately absent. |\n| `type` | `\"set\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `expectedRevision`: `string`; `operationId`: `string`; `type`: `\"remove\"`; `undo?`: `boolean`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `expectedRevision` | `string` | Reject removal if a newer edit has replaced this operation. |\n| `operationId` | `string` | Unique request identity. |\n| `type` | `\"remove\"` | - |\n| `undo?` | `boolean` | Undo restores original visibility; ordinary Remove returns to inbox. |\n\n\n<!-- generated/storage/types.gen/type-aliases/EmailFollowupResponse.md -->\n# Type Alias: EmailFollowupResponse\n\n> **EmailFollowupResponse** = \\{ `followup?`: `null` \\| [`EmailFollowup`](EmailFollowup.md); \\}\n\nLookup response, including an email with no follow-up yet.\n\n## Properties\n\n| Property | Type |\n| ------ | ------ |\n| <a id=\"property-followup\"></a> `followup?` | `null` \\| [`EmailFollowup`](EmailFollowup.md) |\n\n\n<!-- generated/storage/types.gen/type-aliases/EmailReminderCondition.md -->\n# Type Alias: EmailReminderCondition\n\n> **EmailReminderCondition** = `\"if_no_reply\"` \\| `\"regardless\"`\n\nWhen an email follow-up should return the conversation.\n\n\n<!-- generated/storage/types.gen/type-aliases/EntityPermission.md -->\n# Type Alias: EntityPermission\n\n> **EntityPermission** = \\{ `access_level`: [`AccessLevel`](AccessLevel.md); `type`: `\"access_level\"`; \\} \\| \\{ `type`: `\"channel_view_only\"`; \\} \\| \\{ `role`: [`ParticipantRole`](ParticipantRole.md); `type`: `\"channel_role\"`; \\} \\| \\{ `role`: [`TeamRole`](TeamRole.md); `type`: `\"team_role\"`; \\}\n\nA user's permission for an entity, discriminated by entity kind.\n\nItems (documents, chats, projects, threads) use access levels.\nChannels use view-only permission or participant roles.\n\n## Union Members\n\n### Type Literal\n\n\\{ `access_level`: [`AccessLevel`](AccessLevel.md); `type`: `\"access_level\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `access_level` | [`AccessLevel`](AccessLevel.md) | The access level the user has. |\n| `type` | `\"access_level\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"channel_view_only\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `role`: [`ParticipantRole`](ParticipantRole.md); `type`: `\"channel_role\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `role` | [`ParticipantRole`](ParticipantRole.md) | The role the user has in the channel. |\n| `type` | `\"channel_role\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `role`: [`TeamRole`](TeamRole.md); `type`: `\"team_role\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `role` | [`TeamRole`](TeamRole.md) | The role the user has in the team. |\n| `type` | `\"team_role\"` | - |\n\n\n<!-- generated/storage/types.gen/type-aliases/FollowupState.md -->\n# Type Alias: FollowupState\n\n> **FollowupState** = `\"archiving\"` \\| `\"pending\"` \\| `\"returning\"` \\| `\"returned\"` \\| `\"cancelled\"` \\| `\"removed\"`\n\nDurable progress of an email operation.\n\n\n<!-- generated/storage/types.gen/type-aliases/ParticipantRole.md -->\n# Type Alias: ParticipantRole\n\n> **ParticipantRole** = `\"owner\"` \\| `\"admin\"` \\| `\"member\"`\n\nThe role a user has within a channel.\n\n\n<!-- generated/storage/types.gen/type-aliases/TeamRole.md -->\n# Type Alias: TeamRole\n\n> **TeamRole** = `\"member\"` \\| `\"admin\"` \\| `\"owner\"`\n\nThe role a user has within a team.\n\nOrdered least to most privileged so comparisons reflect access strength.\n\n\n<!-- src/entities/email/attachment/classes/EmailAttachment.md -->\n# Class: EmailAttachment\n\nA file attached to an email message. A thin handle keyed by attachment id;\nthe record loads lazily on first field access.\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`EmailAttachmentData`](../type-aliases/EmailAttachmentData.md)\\>\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-contentid\"></a> `contentId` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The attachment's Content-ID header value (for inline attachments). | - |\n| <a id=\"property-dataurl\"></a> `dataUrl` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | A URL to the attachment's raw data, when available. | - |\n| <a id=\"property-filename\"></a> `filename` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The attachment's original filename. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-mimetype\"></a> `mimeType` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The attachment's MIME type. | - |\n| <a id=\"property-sfsid\"></a> `sfsId` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The attachment's static-file-service id, when it has been stored there. | - |\n| <a id=\"property-size\"></a> `size` | `readonly` | () => `Promise`\\<`number` \\| `undefined`\\> | The attachment's size in bytes. | - |\n\n## Methods\n\n### toDocument()\n\n> **toDocument**(): `Promise`\\<[`Document`](../../../documents/document/classes/Document.md)\\>\n\nThe Macro document holding this attachment's content. Get-or-create: the\nserver returns the existing document's id, or downloads the attachment\nfrom the provider and uploads it as a new document first (deduplicated\nbehind a server-side lock).\n\n#### Returns\n\n`Promise`\\<[`Document`](../../../documents/document/classes/Document.md)\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`Attachment`](../../../../../generated/email/types.gen/type-aliases/Attachment.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`Attachment`](../../../../../generated/email/types.gen/type-aliases/Attachment.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`Attachment`](../../../../../generated/email/types.gen/type-aliases/Attachment.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `EmailAttachment`\n\nA handle to an attachment by id. Fields load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`EmailAttachment`\n\n***\n\n### from()\n\n> `static` **from**(`client`, `data`): `EmailAttachment`\n\nBuild an attachment from an already-fetched record (pre-seeded, no fetch).\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `data` | [`Attachment`](../../../../../generated/email/types.gen/type-aliases/Attachment.md) |\n\n#### Returns\n\n`EmailAttachment`\n\n\n<!-- src/entities/email/attachment/type-aliases/EmailAttachmentData.md -->\n# Type Alias: EmailAttachmentData\n\n> **EmailAttachmentData** = [`GetAttachmentResponses`](../../../../../generated/email/types.gen/type-aliases/GetAttachmentResponses.md)\\[`200`\\]\\[`\"attachment\"`\\]\n\nThe API's representation of an email attachment (`Attachment`).\n\n\n<!-- src/entities/email/draft/classes/DraftAttachment.md -->\n# Class: DraftAttachment\n\nAn uploaded or forwarded attachment belonging to a draft.\n\n## Properties\n\n| Property | Modifier | Type | Description |\n| ------ | ------ | ------ | ------ |\n| <a id=\"property-draft\"></a> `draft` | `readonly` | [`EmailDraft`](EmailDraft.md) | Parent draft. |\n| <a id=\"property-draftgeneration\"></a> `draftGeneration` | `readonly` | `number` | Draft generation captured when the attachment was reserved. |\n| <a id=\"property-forwarded\"></a> `forwarded` | `readonly` | `boolean` | Whether this attachment was forwarded. |\n| <a id=\"property-id\"></a> `id` | `readonly` | `string` | Attachment identity. |\n\n## Methods\n\n### complete()\n\n> **complete**(): `Promise`\\<`void`\\>\n\nComplete verification after uploading the file.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### remove()\n\n> **remove**(): `Promise`\\<`void`\\>\n\nRemove this attachment from its draft.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `draftGeneration`: `number`; `draftId`: `string`; `forwarded`: `boolean`; `id`: `string`; \\}\n\nSerialize identity without credentials.\n\n#### Returns\n\n\\{ `draftGeneration`: `number`; `draftId`: `string`; `forwarded`: `boolean`; `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `draftGeneration` | `number` |\n| `draftId` | `string` |\n| `forwarded` | `boolean` |\n| `id` | `string` |\n\n***\n\n### byId()\n\n> `static` **byId**(`_client`, `draft`, `id`, `forwarded?`, `draftGeneration?`): `DraftAttachment`\n\nConstruct a draft scoped attachment handle.\n\n#### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `_client` | `MacroClient` | `undefined` |\n| `draft` | [`EmailDraft`](EmailDraft.md) | `undefined` |\n| `id` | `string` | `undefined` |\n| `forwarded?` | `boolean` | `false` |\n| `draftGeneration?` | `number` | `0` |\n\n#### Returns\n\n`DraftAttachment`\n\n\n<!-- src/entities/email/draft/classes/EmailDraft.md -->\n# Class: EmailDraft\n\nA draft email. Sending remains an explicit separate operation.\n\n## Extends\n\n- [`EmailMessage`](../../message/classes/EmailMessage.md)\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The Bcc recipients. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`bcc`](../../message/classes/EmailMessage.md#property-bcc) |\n| <a id=\"property-body\"></a> `body` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The parsed message body, as the API returns it. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`body`](../../message/classes/EmailMessage.md#property-body) |\n| <a id=\"property-cc\"></a> `cc` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The Cc recipients. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`cc`](../../message/classes/EmailMessage.md#property-cc) |\n| <a id=\"property-draftgeneration\"></a> `draftGeneration` | `readonly` | () => `Promise`\\<`number` \\| `undefined`\\> | Edit generation to capture with content before saving or transferring it. | - |\n| <a id=\"property-from\"></a> `from` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md) \\| `undefined`\\> | The sender. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`from`](../../message/classes/EmailMessage.md#property-from) |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`EmailMessage`](../../message/classes/EmailMessage.md).[`id`](../../message/classes/EmailMessage.md#property-id) |\n| <a id=\"property-labels\"></a> `labels` | `readonly` | () => `Promise`\\<[`LabelInfo`](../../../../../generated/email/types.gen/type-aliases/LabelInfo.md)[]\\> | Labels on this message. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`labels`](../../message/classes/EmailMessage.md#property-labels) |\n| <a id=\"property-link\"></a> `link` | `readonly` | () => `Promise`\\<[`Link`](../../link/classes/Link.md)\\> | The inbox (email link) this message belongs to. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`link`](../../message/classes/EmailMessage.md#property-link) |\n| <a id=\"property-sentat\"></a> `sentAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The provider-internal date of the message. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`sentAt`](../../message/classes/EmailMessage.md#property-sentat) |\n| <a id=\"property-subject\"></a> `subject` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The message's subject line. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`subject`](../../message/classes/EmailMessage.md#property-subject) |\n| <a id=\"property-to\"></a> `to` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The To recipients. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`to`](../../message/classes/EmailMessage.md#property-to) |\n\n## Methods\n\n### addAttachment()\n\n> **addAttachment**(`options`): `Promise`\\<\\{ `attachment`: [`DraftAttachment`](DraftAttachment.md); `contentType`: `string`; `uploadUrl`: `string`; \\}\\>\n\nReserve an attachment upload. Upload to the returned URL, then call complete().\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | \\{ `fileName`: `string`; `sha`: `string`; `size`: `number`; `uploadId?`: `string`; \\} |\n| `options.fileName` | `string` |\n| `options.sha` | `string` |\n| `options.size` | `number` |\n| `options.uploadId?` | `string` |\n\n#### Returns\n\n`Promise`\\<\\{ `attachment`: [`DraftAttachment`](DraftAttachment.md); `contentType`: `string`; `uploadUrl`: `string`; \\}\\>\n\n***\n\n### addLabel()\n\n> **addLabel**(`label`): `Promise`\\<`void`\\>\n\nAdd a label to this message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`addLabel`](../../message/classes/EmailMessage.md#addlabel)\n\n***\n\n### completeDraftAttachment()\n\n> **completeDraftAttachment**(`attachmentId`, `draftGeneration?`): `Promise`\\<`void`\\>\n\nVerify an uploaded attachment using the draft generation captured when its upload began.\n\n#### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `attachmentId` | `string` | `undefined` |\n| `draftGeneration?` | `number` | `0` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`completeDraftAttachment`](../../message/classes/EmailMessage.md#completedraftattachment)\n\n***\n\n### delete()\n\n> **delete**(): `Promise`\\<`void`\\>\n\nDelete the draft.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### forwardAttachment()\n\n> **forwardAttachment**(`attachment`): `Promise`\\<[`DraftAttachment`](DraftAttachment.md)\\>\n\nForward an existing attachment into this draft.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attachment` | [`EmailAttachment`](../../attachment/classes/EmailAttachment.md) |\n\n#### Returns\n\n`Promise`\\<[`DraftAttachment`](DraftAttachment.md)\\>\n\n***\n\n### operationStatus()\n\n> **operationStatus**(): `Promise`\\<[`MessageOperationResponse`](../../../../../generated/email/types.gen/type-aliases/MessageOperationResponse.md)\\>\n\nRead the draft's durable send, upload, or conflict status without retrying it.\n\n#### Returns\n\n`Promise`\\<[`MessageOperationResponse`](../../../../../generated/email/types.gen/type-aliases/MessageOperationResponse.md)\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`operationStatus`](../../message/classes/EmailMessage.md#operationstatus)\n\n***\n\n### removeAttachment()\n\n> **removeAttachment**(`attachment`): `Promise`\\<`void`\\>\n\nRemove a draft attachment.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attachment` | [`DraftAttachment`](DraftAttachment.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### removeLabel()\n\n> **removeLabel**(`label`): `Promise`\\<`void`\\>\n\nRemove a label from this message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`removeLabel`](../../message/classes/EmailMessage.md#removelabel)\n\n***\n\n### resolveOperation()\n\n> **resolveOperation**(`request`): `Promise`\\<`void`\\>\n\nResolve the displayed operation revision after the user chooses an action.\nRetrying an uncertain send requires explicit duplicate-risk acceptance.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `request` | [`ResolveMessageOperationRequest`](../../../../../generated/email/types.gen/type-aliases/ResolveMessageOperationRequest.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`resolveOperation`](../../message/classes/EmailMessage.md#resolveoperation)\n\n***\n\n### schedule()\n\n> **schedule**(`sendTime`, `options?`): `Promise`\\<`void`\\>\n\nSchedule this draft for sending.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `sendTime` | `string` |\n| `options?` | \\{ `includeSignature?`: `boolean`; \\} |\n| `options.includeSignature?` | `boolean` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### thread()\n\n> **thread**(): `Promise`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nThe thread this message belongs to.\n\n#### Returns\n\n`Promise`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`thread`](../../message/classes/EmailMessage.md#thread)\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`toJSON`](../../message/classes/EmailMessage.md#tojson)\n\n***\n\n### transferDraft()\n\n> **transferDraft**(`request`): `Promise`\\<[`TransferDraftResponse`](../../../../../generated/email/types.gen/type-aliases/TransferDraftResponse.md)\\>\n\nMove a draft to another inbox using a caller-persisted operation UUID.\nContinue editing the returned message_id; the original identity is retired.\nOn an interrupted response, use email.recoverDraftTransfer(operation_id).\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `request` | [`TransferDraftRequest`](../../../../../generated/email/types.gen/type-aliases/TransferDraftRequest.md) |\n\n#### Returns\n\n`Promise`\\<[`TransferDraftResponse`](../../../../../generated/email/types.gen/type-aliases/TransferDraftResponse.md)\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`transferDraft`](../../message/classes/EmailMessage.md#transferdraft)\n\n***\n\n### unschedule()\n\n> **unschedule**(): `Promise`\\<`void`\\>\n\nRemove a scheduled send.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### update()\n\n> **update**(`options`): `Promise`\\<`void`\\>\n\nReplace draft content without changing its identity or sending it.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`DraftOptions`](../type-aliases/DraftOptions.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### verifyAttachment()\n\n> **verifyAttachment**(`attachment`): `Promise`\\<`void`\\>\n\nComplete verification of an uploaded attachment.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attachment` | [`DraftAttachment`](DraftAttachment.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `EmailDraft`\n\nConstruct a lazy draft handle.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`EmailDraft`\n\n#### Overrides\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`byId`](../../message/classes/EmailMessage.md#byid)\n\n***\n\n### from()\n\n> `static` **from**(`client`, `data`): [`EmailMessage`](../../message/classes/EmailMessage.md)\n\nBuild a message from an already-fetched record (pre-seeded, no fetch).\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `data` | [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md) |\n\n#### Returns\n\n[`EmailMessage`](../../message/classes/EmailMessage.md)\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`from`](../../message/classes/EmailMessage.md#from)\n\n***\n\n### send()\n\n> `static` **send**(`client`, `opts`): `Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\nSend a new email message. Returns a handle when the API reports the created message's id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `opts` | [`SendEmailOptions`](../../message/interfaces/SendEmailOptions.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\n#### Inherited from\n\n[`EmailMessage`](../../message/classes/EmailMessage.md).[`send`](../../message/classes/EmailMessage.md#send)\n\n\n<!-- src/entities/email/draft/functions/draftBody.md -->\n# Function: draftBody()\n\n> **draftBody**(`options`): [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\n\nTranslate draft content to the generated contract.\n\n## Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`DraftOptions`](../type-aliases/DraftOptions.md) |\n\n## Returns\n\n[`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\n\n\n<!-- src/entities/email/draft/type-aliases/DraftOptions.md -->\n# Type Alias: DraftOptions\n\n> **DraftOptions** = `Omit`\\<[`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md), `\"db_id\"` \\| `\"provider_id\"` \\| `\"provider_thread_id\"` \\| `\"replying_to_id\"` \\| `\"thread_db_id\"` \\| `\"body_text\"` \\| `\"body_html\"` \\| `\"body_macro\"` \\| `\"headers_json\"` \\| `\"include_signature\"` \\| `\"draft_generation\"`\\> & \\{ `bodyHtml?`: `string`; `bodyMacro?`: `string`; `bodyText?`: `string`; `draftGeneration?`: `number`; `headers?`: [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\\[`\"headers_json\"`\\]; `includeSignature?`: `boolean`; `replyingTo?`: [`EmailMessage`](../../message/classes/EmailMessage.md); `thread?`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}\n\nDraft content; relationships use message and thread handles.\n\n## Type Declaration\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `bodyHtml?` | `string` | HTML body. |\n| `bodyMacro?` | `string` | Macro body. |\n| `bodyText?` | `string` | Plain text body. |\n| `draftGeneration?` | `number` | Generation captured when editing began; defaults to the loaded draft. |\n| `headers?` | [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\\[`\"headers_json\"`\\] | Extra headers. |\n| `includeSignature?` | `boolean` | Include the inbox signature. |\n| `replyingTo?` | [`EmailMessage`](../../message/classes/EmailMessage.md) | Message being replied to. |\n| `thread?` | [`EmailThread`](../../thread/classes/EmailThread.md) | Thread receiving this draft. |\n\n\n<!-- src/entities/email/filter/classes/EmailFilter.md -->\n# Class: EmailFilter\n\nAn importance filter matched by sender address or domain.\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`ApiEmailFilter`](../../../../../generated/email/types.gen/type-aliases/ApiEmailFilter.md)\\>\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-emailaddress\"></a> `emailAddress` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | Matched address. | - |\n| <a id=\"property-emaildomain\"></a> `emailDomain` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | Matched domain. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-isimportant\"></a> `isImportant` | `readonly` | () => `Promise`\\<`boolean`\\> | Importance assigned by this filter. | - |\n\n## Methods\n\n### delete()\n\n> **delete**(): `Promise`\\<`void`\\>\n\nDelete this filter.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### setImportant()\n\n> **setImportant**(`isImportant`): `Promise`\\<`void`\\>\n\nChange the importance for the same sender selector.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `isImportant` | `boolean` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`ApiEmailFilter`](../../../../../generated/email/types.gen/type-aliases/ApiEmailFilter.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`ApiEmailFilter`](../../../../../generated/email/types.gen/type-aliases/ApiEmailFilter.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`ApiEmailFilter`](../../../../../generated/email/types.gen/type-aliases/ApiEmailFilter.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`, `inbox?`): `EmailFilter`\n\nConstruct a lazy filter handle.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`EmailFilter`\n\n***\n\n### from()\n\n> `static` **from**(`client`, `record`, `inbox?`): `EmailFilter`\n\nSeed from a server record.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `record` | [`ApiEmailFilter`](../../../../../generated/email/types.gen/type-aliases/ApiEmailFilter.md) |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`EmailFilter`\n\n\n<!-- src/entities/email/filter/interfaces/EmailFilterOptions.md -->\n# Interface: EmailFilterOptions\n\nSender importance rule.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-emailaddress\"></a> `emailAddress?` | `string` | Match an address. |\n| <a id=\"property-emaildomain\"></a> `emailDomain?` | `string` | Match a domain. |\n| <a id=\"property-isimportant\"></a> `isImportant` | `boolean` | Whether matches are important. |\n\n\n<!-- src/entities/email/label/classes/Label.md -->\n# Class: Label\n\nAn email label. A free-to-construct handle: there is no single-label GET,\nso the detail record loads lazily on first field access by listing all\nlabels and finding this one (mirroring Link).\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`ApiLabel`](../../../../../generated/email/types.gen/type-aliases/ApiLabel.md)\\>\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-createdat\"></a> `createdAt` | `readonly` | () => `Promise`\\<`string`\\> | When the label was created. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-labellistvisibility\"></a> `labelListVisibility` | `readonly` | () => `Promise`\\<[`ApiLabelListVisibility`](../../../../../generated/email/types.gen/type-aliases/ApiLabelListVisibility.md)\\> | Whether the label is shown in the label list. | - |\n| <a id=\"property-linkid\"></a> `linkId` | `readonly` | () => `Promise`\\<`string`\\> | The inbox (email link) this label belongs to. | - |\n| <a id=\"property-messagelistvisibility\"></a> `messageListVisibility` | `readonly` | () => `Promise`\\<[`ApiMessageListVisibility`](../../../../../generated/email/types.gen/type-aliases/ApiMessageListVisibility.md)\\> | Whether the label is shown in the message list. | - |\n| <a id=\"property-name\"></a> `name` | `readonly` | () => `Promise`\\<`string`\\> | The label's display name. | - |\n| <a id=\"property-type\"></a> `type` | `readonly` | () => `Promise`\\<[`ApiLabelType`](../../../../../generated/email/types.gen/type-aliases/ApiLabelType.md)\\> | Whether this is a system label or a user-created one. | - |\n\n## Methods\n\n### delete()\n\n> **delete**(): `Promise`\\<`void`\\>\n\nDelete this label.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`ApiLabel`](../../../../../generated/email/types.gen/type-aliases/ApiLabel.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`ApiLabel`](../../../../../generated/email/types.gen/type-aliases/ApiLabel.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`ApiLabel`](../../../../../generated/email/types.gen/type-aliases/ApiLabel.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `Label`\n\nA handle to a label by id. Details load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`Label`\n\n***\n\n### create()\n\n> `static` **create**(`client`, `name`): `Promise`\\<`Label`\\>\n\nCreate a user label.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `name` | `string` |\n\n#### Returns\n\n`Promise`\\<`Label`\\>\n\n***\n\n### list()\n\n> `static` **list**(`client`): `Promise`\\<`Label`[]\\>\n\nAll labels across the user's inboxes.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n\n#### Returns\n\n`Promise`\\<`Label`[]\\>\n\n\n<!-- src/entities/email/link/classes/Link.md -->\n# Class: Link\n\nAn email link: a connected inbox (e.g. Gmail or Outlook) that threads and\nmessages sync through. A free-to-construct handle, resolved from the\ncaller's connected links.\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`Link`](../../../../../generated/email/types.gen/type-aliases/Link.md)\\>\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-emailaddress\"></a> `emailAddress` | `readonly` | () => `Promise`\\<`string`\\> | The inbox's email address. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-isprimary\"></a> `isPrimary` | `readonly` | () => `Promise`\\<`boolean`\\> | Whether this is the user's primary inbox. | - |\n| <a id=\"property-issyncactive\"></a> `isSyncActive` | `readonly` | () => `Promise`\\<`boolean`\\> | Whether syncing is currently active for this inbox. | - |\n| <a id=\"property-needsreauth\"></a> `needsReauth` | `readonly` | () => `Promise`\\<`boolean`\\> | Whether the inbox needs to be re-authenticated. | - |\n| <a id=\"property-photourl\"></a> `photoUrl` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The inbox's avatar URL, if any. | - |\n| <a id=\"property-provider\"></a> `provider` | `readonly` | () => `Promise`\\<[`UserProvider`](../../../../../generated/email/types.gen/type-aliases/UserProvider.md)\\> | The email provider (e.g. `GMAIL` or `OUTLOOK`). | - |\n| <a id=\"property-syncstatus\"></a> `syncStatus` | `readonly` | () => `Promise`\\<[`SyncStatus`](../../../../../generated/email/types.gen/type-aliases/SyncStatus.md)\\> | The inbox's sync status. | - |\n\n## Methods\n\n### settingsOperations()\n\n> **settingsOperations**(): `Promise`\\<[`MailboxSettingsOperation`](../../../../../generated/email/types.gen/type-aliases/MailboxSettingsOperation.md)[]\\>\n\nRead category and sender-policy changes for this inbox.\n\n#### Returns\n\n`Promise`\\<[`MailboxSettingsOperation`](../../../../../generated/email/types.gen/type-aliases/MailboxSettingsOperation.md)[]\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`Link`](../../../../../generated/email/types.gen/type-aliases/Link.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`Link`](../../../../../generated/email/types.gen/type-aliases/Link.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`Link`](../../../../../generated/email/types.gen/type-aliases/Link.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `Link`\n\nA handle to an email link by id. Details load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`Link`\n\n***\n\n### list()\n\n> `static` **list**(`client`): `Promise`\\<`Link`[]\\>\n\nThe caller's connected email links.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n\n#### Returns\n\n`Promise`\\<`Link`[]\\>\n\n\n<!-- src/entities/email/message/classes/EmailMessage.md -->\n# Class: EmailMessage\n\nA message in an email thread. A thin handle keyed by message id; the\nrecord loads lazily on first field access.\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`EmailMessageData`](../type-aliases/EmailMessageData.md)\\>\n\n## Extended by\n\n- [`EmailDraft`](../../draft/classes/EmailDraft.md)\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The Bcc recipients. | - |\n| <a id=\"property-body\"></a> `body` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The parsed message body, as the API returns it. | - |\n| <a id=\"property-cc\"></a> `cc` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The Cc recipients. | - |\n| <a id=\"property-from\"></a> `from` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md) \\| `undefined`\\> | The sender. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-labels\"></a> `labels` | `readonly` | () => `Promise`\\<[`LabelInfo`](../../../../../generated/email/types.gen/type-aliases/LabelInfo.md)[]\\> | Labels on this message. | - |\n| <a id=\"property-link\"></a> `link` | `readonly` | () => `Promise`\\<[`Link`](../../link/classes/Link.md)\\> | The inbox (email link) this message belongs to. | - |\n| <a id=\"property-sentat\"></a> `sentAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The provider-internal date of the message. | - |\n| <a id=\"property-subject\"></a> `subject` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | The message's subject line. | - |\n| <a id=\"property-to\"></a> `to` | `readonly` | () => `Promise`\\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\\> | The To recipients. | - |\n\n## Methods\n\n### addLabel()\n\n> **addLabel**(`label`): `Promise`\\<`void`\\>\n\nAdd a label to this message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### completeDraftAttachment()\n\n> **completeDraftAttachment**(`attachmentId`, `draftGeneration?`): `Promise`\\<`void`\\>\n\nVerify an uploaded attachment using the draft generation captured when its upload began.\n\n#### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `attachmentId` | `string` | `undefined` |\n| `draftGeneration?` | `number` | `0` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### operationStatus()\n\n> **operationStatus**(): `Promise`\\<[`MessageOperationResponse`](../../../../../generated/email/types.gen/type-aliases/MessageOperationResponse.md)\\>\n\nRead the draft's durable send, upload, or conflict status without retrying it.\n\n#### Returns\n\n`Promise`\\<[`MessageOperationResponse`](../../../../../generated/email/types.gen/type-aliases/MessageOperationResponse.md)\\>\n\n***\n\n### removeLabel()\n\n> **removeLabel**(`label`): `Promise`\\<`void`\\>\n\nRemove a label from this message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### resolveOperation()\n\n> **resolveOperation**(`request`): `Promise`\\<`void`\\>\n\nResolve the displayed operation revision after the user chooses an action.\nRetrying an uncertain send requires explicit duplicate-risk acceptance.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `request` | [`ResolveMessageOperationRequest`](../../../../../generated/email/types.gen/type-aliases/ResolveMessageOperationRequest.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### thread()\n\n> **thread**(): `Promise`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nThe thread this message belongs to.\n\n#### Returns\n\n`Promise`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### transferDraft()\n\n> **transferDraft**(`request`): `Promise`\\<[`TransferDraftResponse`](../../../../../generated/email/types.gen/type-aliases/TransferDraftResponse.md)\\>\n\nMove a draft to another inbox using a caller-persisted operation UUID.\nContinue editing the returned message_id; the original identity is retired.\nOn an interrupted response, use email.recoverDraftTransfer(operation_id).\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `request` | [`TransferDraftRequest`](../../../../../generated/email/types.gen/type-aliases/TransferDraftRequest.md) |\n\n#### Returns\n\n`Promise`\\<[`TransferDraftResponse`](../../../../../generated/email/types.gen/type-aliases/TransferDraftResponse.md)\\>\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `EmailMessage`\n\nA handle to a message by id. Fields load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`EmailMessage`\n\n***\n\n### from()\n\n> `static` **from**(`client`, `data`): `EmailMessage`\n\nBuild a message from an already-fetched record (pre-seeded, no fetch).\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `data` | [`ParsedMessage`](../../../../../generated/email/types.gen/type-aliases/ParsedMessage.md) |\n\n#### Returns\n\n`EmailMessage`\n\n***\n\n### send()\n\n> `static` **send**(`client`, `opts`): `Promise`\\<`EmailMessage` \\| `undefined`\\>\n\nSend a new email message. Returns a handle when the API reports the created message's id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `opts` | [`SendEmailOptions`](../interfaces/SendEmailOptions.md) |\n\n#### Returns\n\n`Promise`\\<`EmailMessage` \\| `undefined`\\>\n\n\n<!-- src/entities/email/message/interfaces/SendEmailOptions.md -->\n# Interface: SendEmailOptions\n\nOptions for sending a fresh email message.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Bcc recipients. |\n| <a id=\"property-bodytext\"></a> `bodyText` | `string` | Plain-text body. |\n| <a id=\"property-cc\"></a> `cc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Cc recipients. |\n| <a id=\"property-subject\"></a> `subject` | `string` | Subject line. |\n| <a id=\"property-to\"></a> `to` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Recipients. |\n\n\n<!-- src/entities/email/message/type-aliases/EmailMessageData.md -->\n# Type Alias: EmailMessageData\n\n> **EmailMessageData** = [`GetMessageResponses`](../../../../../generated/email/types.gen/type-aliases/GetMessageResponses.md)\\[`200`\\]\n\nThe API's representation of an email message (`ParsedMessage`).\n\n\n<!-- src/entities/email/namespace/classes/EmailNamespace.md -->\n# Class: EmailNamespace\n\n## Constructors\n\n### Constructor\n\n> **new EmailNamespace**(`client`): `EmailNamespace`\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n\n#### Returns\n\n`EmailNamespace`\n\n## Methods\n\n### attachment()\n\n> **attachment**(`id`): [`EmailAttachment`](../../attachment/classes/EmailAttachment.md)\n\nA handle to an email attachment by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailAttachment`](../../attachment/classes/EmailAttachment.md)\n\n***\n\n### blockedSenders()\n\n> **blockedSenders**(): `Promise`\\<`string`[]\\>\n\nThe email addresses currently blocked.\n\n#### Returns\n\n`Promise`\\<`string`[]\\>\n\n***\n\n### blockSender()\n\n> **blockSender**(`email`): `Promise`\\<`void`\\>\n\nBlock an email sender.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `email` | `string` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### byId()\n\n> **byId**(`id`): [`EmailThread`](../../thread/classes/EmailThread.md)\n\nA handle to an email thread by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailThread`](../../thread/classes/EmailThread.md)\n\n***\n\n### connectionProviders()\n\n> **connectionProviders**(): `Promise`\\<[`EmailConnectionProviders`](../../../../../generated/auth/types.gen/type-aliases/EmailConnectionProviders.md)\\>\n\nProviders the server currently permits this caller to connect.\n\n#### Returns\n\n`Promise`\\<[`EmailConnectionProviders`](../../../../../generated/auth/types.gen/type-aliases/EmailConnectionProviders.md)\\>\n\n***\n\n### contacts()\n\n> **contacts**(): `Promise`\\<\\{\\[`key`: `string`\\]: [`ContactInfoWithInteraction`](../../../../../generated/email/types.gen/type-aliases/ContactInfoWithInteraction.md)[]; \\}\\>\n\nAddress book contacts grouped by the service's interaction buckets.\n\n#### Returns\n\n`Promise`\\<\\{\\[`key`: `string`\\]: [`ContactInfoWithInteraction`](../../../../../generated/email/types.gen/type-aliases/ContactInfoWithInteraction.md)[]; \\}\\>\n\n***\n\n### createDraft()\n\n> **createDraft**(`options`, `inbox?`): `Promise`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\nCreate a draft without sending it; the inbox defaults to the caller's primary.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`DraftOptions`](../../draft/type-aliases/DraftOptions.md) |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\n***\n\n### createLabel()\n\n> **createLabel**(`name`): `Promise`\\<[`Label`](../../label/classes/Label.md)\\>\n\nCreate a user label. Returns the created label.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `name` | `string` |\n\n#### Returns\n\n`Promise`\\<[`Label`](../../label/classes/Label.md)\\>\n\n***\n\n### deleteLabel()\n\n> **deleteLabel**(`label`): `Promise`\\<`void`\\>\n\nDelete a label.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### draftById()\n\n> **draftById**(`id`): [`EmailDraft`](../../draft/classes/EmailDraft.md)\n\nConstruct a lazy draft handle.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailDraft`](../../draft/classes/EmailDraft.md)\n\n***\n\n### filters()\n\n> **filters**(`inbox?`): `Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)[]\\>\n\nImportance filters.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)[]\\>\n\n***\n\n### inbox()\n\n> **inbox**(`opts?`): `AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nThe threads in the inbox, most recent first, auto-paginated.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts?` | [`InboxOptions`](../interfaces/InboxOptions.md) |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n***\n\n### label()\n\n> **label**(`id`): [`Label`](../../label/classes/Label.md)\n\nA handle to a label by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`Label`](../../label/classes/Label.md)\n\n***\n\n### labels()\n\n> **labels**(): `Promise`\\<[`Label`](../../label/classes/Label.md)[]\\>\n\nAll labels across the user's inboxes.\n\n#### Returns\n\n`Promise`\\<[`Label`](../../label/classes/Label.md)[]\\>\n\n***\n\n### link()\n\n> **link**(`id`): [`Link`](../../link/classes/Link.md)\n\nA handle to a connected inbox (email link) by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`Link`](../../link/classes/Link.md)\n\n***\n\n### links()\n\n> **links**(): `Promise`\\<[`Link`](../../link/classes/Link.md)[]\\>\n\nThe caller's connected inboxes (email links).\n\n#### Returns\n\n`Promise`\\<[`Link`](../../link/classes/Link.md)[]\\>\n\n***\n\n### message()\n\n> **message**(`id`): [`EmailMessage`](../../message/classes/EmailMessage.md)\n\nA handle to an email message by id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`EmailMessage`](../../message/classes/EmailMessage.md)\n\n***\n\n### recoverDraftTransfer()\n\n> **recoverDraftTransfer**(`operationId`): `Promise`\\<[`TransferRecoveryResponse`](../../../../../generated/email/types.gen/type-aliases/TransferRecoveryResponse.md)\\>\n\nRecover a draft move using its original operation UUID; never starts a new move.\nAn empty committed result fences the old move so it cannot commit later.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `operationId` | `string` |\n\n#### Returns\n\n`Promise`\\<[`TransferRecoveryResponse`](../../../../../generated/email/types.gen/type-aliases/TransferRecoveryResponse.md)\\>\n\n***\n\n### reminders()\n\n> **reminders**(`options?`): `AsyncGenerator`\\<\\{ `followup`: [`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md); `thread`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}, `any`, `any`\\>\n\nFollow-up reminders with thread handles, automatically paginated.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `Omit`\\<\\{ `attachments?`: `string`[] \\| `null`; `calendar?`: `boolean` \\| `null`; `cursor?`: `string` \\| `null`; `done?`: `boolean` \\| `null`; `inboxIds?`: `string`[] \\| `null`; `limit?`: `number` \\| `null`; `noInboxes?`: `boolean` \\| `null`; `read?`: `boolean` \\| `null`; `tags?`: `string`[] \\| `null`; \\}, `\"cursor\"` \\| `\"inboxIds\"`\\> & \\{ `inboxes?`: [`Link`](../../link/classes/Link.md)[]; \\} |\n\n#### Returns\n\n`AsyncGenerator`\\<\\{ `followup`: [`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md); `thread`: [`EmailThread`](../../thread/classes/EmailThread.md); \\}, `any`, `any`\\>\n\n***\n\n### scheduled()\n\n> **scheduled**(`options?`): `AsyncGenerator`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\nScheduled drafts, fetched lazily in bounded pages.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | \\{ `inbox?`: [`Link`](../../link/classes/Link.md); `pageSize?`: `number`; \\} |\n| `options.inbox?` | [`Link`](../../link/classes/Link.md) |\n| `options.pageSize?` | `number` |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailDraft`](../../draft/classes/EmailDraft.md)\\>\n\n***\n\n### search()\n\n> **search**(`query`, `opts?`): `AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\nSearch email threads by subject and content.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `query` | `string` |\n| `opts?` | [`SearchOpts`](../../../search/interfaces/SearchOpts.md) |\n\n#### Returns\n\n`AsyncGenerator`\\<[`EmailThread`](../../thread/classes/EmailThread.md)\\>\n\n***\n\n### send()\n\n> **send**(`opts`): `Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\nSend a new email message.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`SendEmailOptions`](../../message/interfaces/SendEmailOptions.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\n***\n\n### unblockSender()\n\n> **unblockSender**(`email`): `Promise`\\<`void`\\>\n\nUnblock a previously blocked sender.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `email` | `string` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### upsertFilter()\n\n> **upsertFilter**(`options`, `inbox?`): `Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)\\>\n\nCreate or replace a filter matching an address or domain.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | [`EmailFilterOptions`](../../filter/interfaces/EmailFilterOptions.md) |\n| `inbox?` | [`Link`](../../link/classes/Link.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailFilter`](../../filter/classes/EmailFilter.md)\\>\n\n\n<!-- src/entities/email/namespace/interfaces/InboxOptions.md -->\n# Interface: InboxOptions\n\nOptions for listing inbox threads.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-pagesize\"></a> `pageSize?` | `number` | Page size (default 20, max 500). |\n| <a id=\"property-sort\"></a> `sort?` | [`ApiSortMethod`](../../../../../generated/email/types.gen/type-aliases/ApiSortMethod.md) | Sort order. Defaults to `viewed_updated`. |\n\n\n<!-- src/entities/email/thread/classes/EmailThread.md -->\n# Class: EmailThread\n\nAn email thread. A free-to-construct handle: the detail record (including\nup to the first 100 messages) loads lazily on first field access.\n\n## Extends\n\n- [`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md)\\<`ThreadDetail`\\>\n\n## Properties\n\n| Property | Modifier | Type | Default value | Description | Overrides | Inherited from |\n| ------ | ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-access\"></a> `access` | `readonly` | [`EntityAccess`](../../../sharing/access/classes/EntityAccess.md) | `...` | Access requests and direct user grants. | - | - |\n| <a id=\"property-accesslevel\"></a> `accessLevel` | `readonly` | () => `Promise`\\<[`AccessLevel`](../../../../../generated/email/types.gen/type-aliases/AccessLevel.md)\\> | `...` | The viewer's access level to this thread. | - | - |\n| <a id=\"property-createdat\"></a> `createdAt` | `readonly` | () => `Promise`\\<`string`\\> | `...` | When the thread was created. | - | - |\n| <a id=\"property-entitytype\"></a> `entityType` | `readonly` | `\"email_thread\"` | `'email_thread'` | Favorites identify email threads as `email_thread`. | [`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`entityType`](../../../entity/classes/PropertiedEntity.md#property-entitytype) | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | `undefined` | - | - | [`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`id`](../../../entity/classes/PropertiedEntity.md#property-id) |\n| <a id=\"property-inboxvisible\"></a> `inboxVisible` | `readonly` | () => `Promise`\\<`boolean`\\> | `...` | Whether the thread is visible in the inbox (i.e. not archived). | - | - |\n| <a id=\"property-isread\"></a> `isRead` | `readonly` | () => `Promise`\\<`boolean`\\> | `...` | Whether the thread has been read. | - | - |\n| <a id=\"property-latestinboundat\"></a> `latestInboundAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | Timestamp of the latest inbound message, if any. | - | - |\n| <a id=\"property-latestnonspamat\"></a> `latestNonSpamAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | Timestamp of the latest non-spam message, if any. | - | - |\n| <a id=\"property-latestoutboundat\"></a> `latestOutboundAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | Timestamp of the latest outbound message, if any. | - | - |\n| <a id=\"property-link\"></a> `link` | `readonly` | () => `Promise`\\<[`Link`](../../link/classes/Link.md)\\> | `...` | The inbox (email link) that owns this thread. | - | - |\n| <a id=\"property-project\"></a> `project` | `readonly` | () => `Promise`\\<[`Project`](../../../projects/project/classes/Project.md) \\| `undefined`\\> | `...` | The project this thread is attached to, if any. | - | - |\n| <a id=\"property-providerid\"></a> `providerId` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | The provider-internal thread id (e.g. Gmail/Outlook), if any. | - | - |\n| <a id=\"property-updatedat\"></a> `updatedAt` | `readonly` | () => `Promise`\\<`string`\\> | `...` | When the thread was last updated. | - | - |\n| <a id=\"property-search\"></a> `search` | `static` | (`client`, `query`, `searchOpts?`) => `AsyncGenerator`\\<`EmailThread`\\> | `...` | Search email threads by subject and content, most relevant first, auto-paginated. | - | - |\n\n## Methods\n\n### addLabel()\n\n> **addLabel**(`label`): `Promise`\\<`void`\\>\n\nAdd a label to every message in the thread.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### archive()\n\n> **archive**(`archived?`): `Promise`\\<`void`\\>\n\nArchive the thread (or unarchive with `false`).\n\n#### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `archived?` | `boolean` | `true` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### attachments()\n\n> **attachments**(): `Promise`\\<[`EmailAttachment`](../../attachment/classes/EmailAttachment.md)[]\\>\n\nThe attachments across this thread's first 100 messages, pre-seeded from the thread detail.\n\n#### Returns\n\n`Promise`\\<[`EmailAttachment`](../../attachment/classes/EmailAttachment.md)[]\\>\n\n***\n\n### calendarInvitations()\n\n> **calendarInvitations**(): `Promise`\\<\\{\\[`key`: `string`\\]: [`InvitationResolution`](../../../../../generated/email/types.gen/type-aliases/InvitationResolution.md); \\}\\>\n\nCalendar invitations resolved from this thread's messages.\n\n#### Returns\n\n`Promise`\\<\\{\\[`key`: `string`\\]: [`InvitationResolution`](../../../../../generated/email/types.gen/type-aliases/InvitationResolution.md); \\}\\>\n\n***\n\n### deleteProperty()\n\n> **deleteProperty**(`assignment`): `Promise`\\<`void`\\>\n\nRemove a property from this entity, given its [properties](#properties) entry.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `assignment` | [`EntityPropertyWithDefinition`](../../../../../generated/properties/types.gen/type-aliases/EntityPropertyWithDefinition.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`deleteProperty`](../../../entity/classes/PropertiedEntity.md#deleteproperty)\n\n***\n\n### favorite()\n\n> **favorite**(): `Promise`\\<`EmailThread`\\>\n\nAdd this entity to the user's favorites. Returns this handle for chaining.\nPlain unwrap: favoriting alters the user's favorites collection, not this\nentity's own detail, so there's nothing cached to invalidate.\n\n#### Returns\n\n`Promise`\\<`EmailThread`\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`favorite`](../../../entity/classes/PropertiedEntity.md#favorite)\n\n***\n\n### followup()\n\n> **followup**(): `Promise`\\<[`EmailFollowupResponse`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowupResponse.md)\\>\n\nRead follow-up state for this thread.\n\n#### Returns\n\n`Promise`\\<[`EmailFollowupResponse`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowupResponse.md)\\>\n\n***\n\n### markSeen()\n\n> **markSeen**(): `Promise`\\<`void`\\>\n\nMark the thread as seen.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### messages()\n\n> **messages**(`opts?`): `Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md)[]\\>\n\nThe messages in this thread, pre-seeded from the list endpoint.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts?` | \\{ `limit?`: `number`; `since?`: `string`; \\} |\n| `opts.limit?` | `number` |\n| `opts.since?` | `string` |\n\n#### Returns\n\n`Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md)[]\\>\n\n***\n\n### moveToProject()\n\n> **moveToProject**(`project`): `Promise`\\<`void`\\>\n\nAttach the thread to a project, or clear the project with `null`.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `project` | [`Project`](../../../projects/project/classes/Project.md) \\| `null` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### operations()\n\n> **operations**(): `Promise`\\<[`MailboxOperation`](../../../../../generated/email/types.gen/type-aliases/MailboxOperation.md)[]\\>\n\nRead pending or failed mailbox changes without initiating a retry.\n\n#### Returns\n\n`Promise`\\<[`MailboxOperation`](../../../../../generated/email/types.gen/type-aliases/MailboxOperation.md)[]\\>\n\n***\n\n### participants()\n\n> **participants**(): `Promise`\\<[`ApiContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiContactInfo.md)[]\\>\n\nEveryone on the thread (senders and recipients), deduped by email.\nDerived from the thread's first 100 messages.\n\n#### Returns\n\n`Promise`\\<[`ApiContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiContactInfo.md)[]\\>\n\n***\n\n### permission()\n\n> **permission**(): `Promise`\\<\\{ `permission`: [`EntityPermission`](../../../../../generated/storage/types.gen/type-aliases/EntityPermission.md); `status`: `\"access\"`; \\} \\| \\{ `status`: `\"no_access\"`; \\}\\>\n\nRead the caller's effective permission on this entity.\n\n#### Returns\n\n`Promise`\\<\\{ `permission`: [`EntityPermission`](../../../../../generated/storage/types.gen/type-aliases/EntityPermission.md); `status`: `\"access\"`; \\} \\| \\{ `status`: `\"no_access\"`; \\}\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`permission`](../../../entity/classes/PropertiedEntity.md#permission)\n\n***\n\n### properties()\n\n> **properties**(`opts?`): `Promise`\\<[`EntityPropertyWithDefinition`](../../../../../generated/properties/types.gen/type-aliases/EntityPropertyWithDefinition.md)[]\\>\n\nThe properties set on this entity, each with its definition, value, and options.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts?` | \\{ `includeMetadata?`: `boolean`; \\} |\n| `opts.includeMetadata?` | `boolean` |\n\n#### Returns\n\n`Promise`\\<[`EntityPropertyWithDefinition`](../../../../../generated/properties/types.gen/type-aliases/EntityPropertyWithDefinition.md)[]\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`properties`](../../../entity/classes/PropertiedEntity.md#properties)\n\n***\n\n### propertyReference()\n\n> **propertyReference**(): [`PropertyTargetReference`](../../../../../generated/properties/types.gen/type-aliases/PropertyTargetReference.md)\n\nThis entity's reference for bulk property operations.\n\n#### Returns\n\n[`PropertyTargetReference`](../../../../../generated/properties/types.gen/type-aliases/PropertyTargetReference.md)\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`propertyReference`](../../../entity/classes/PropertiedEntity.md#propertyreference)\n\n***\n\n### removeLabel()\n\n> **removeLabel**(`label`): `Promise`\\<`void`\\>\n\nRemove a label from every message in the thread.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `label` | [`Label`](../../label/classes/Label.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### reply()\n\n> **reply**(`opts`): `Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\nSend a reply within this thread. Returns a handle when the API reports the created message's id.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`ReplyEmailOptions`](../interfaces/ReplyEmailOptions.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailMessage`](../../message/classes/EmailMessage.md) \\| `undefined`\\>\n\n***\n\n### setFollowup()\n\n> **setFollowup**(`command`): `Promise`\\<[`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md)\\>\n\nSet or remove a follow-up using a persisted operation id and revision.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `command` | [`EmailFollowupCommand`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowupCommand.md) |\n\n#### Returns\n\n`Promise`\\<[`EmailFollowup`](../../../../../generated/storage/types.gen/type-aliases/EmailFollowup.md)\\>\n\n***\n\n### setProperty()\n\n> **setProperty**(`property`, `value?`): `Promise`\\<`void`\\>\n\nSet a property value on this entity, or attach the property without a\nvalue when `value` is omitted.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `property` | [`PropertyDefinition`](../../../properties/property-definition/classes/PropertyDefinition.md) |\n| `value?` | [`SetPropertyValue`](../../../../../generated/properties/types.gen/type-aliases/SetPropertyValue.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`setProperty`](../../../entity/classes/PropertiedEntity.md#setproperty)\n\n***\n\n### subject()\n\n> **subject**(): `Promise`\\<`string` \\| `undefined`\\>\n\nThe thread's subject, from its first message with one.\n\n#### Returns\n\n`Promise`\\<`string` \\| `undefined`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`ApiThread`](../../../../../generated/email/types.gen/type-aliases/ApiThread.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`ApiThread`](../../../../../generated/email/types.gen/type-aliases/ApiThread.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`ApiThread`](../../../../../generated/email/types.gen/type-aliases/ApiThread.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`toJSON`](../../../entity/classes/PropertiedEntity.md#tojson)\n\n***\n\n### unfavorite()\n\n> **unfavorite**(): `Promise`\\<`EmailThread`\\>\n\nRemove this entity from the user's favorites. Returns this handle for chaining.\n\n#### Returns\n\n`Promise`\\<`EmailThread`\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`unfavorite`](../../../entity/classes/PropertiedEntity.md#unfavorite)\n\n***\n\n### update()\n\n> **update**(`options`): `Promise`\\<`void`\\>\n\nChange project membership or share permissions for this thread.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options` | \\{ `project?`: [`Project`](../../../projects/project/classes/Project.md) \\| `null`; `sharePermission?`: [`SharePermissionOptions`](../../../sharing/permissions/type-aliases/SharePermissionOptions.md); \\} |\n| `options.project?` | [`Project`](../../../projects/project/classes/Project.md) \\| `null` |\n| `options.sharePermission?` | [`SharePermissionOptions`](../../../sharing/permissions/type-aliases/SharePermissionOptions.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### updatePropertyOptions()\n\n> **updatePropertyOptions**(`changes`): `Promise`\\<[`BulkUpdateEntityPropertyOptionsResponse`](../../../../../generated/properties/types.gen/type-aliases/BulkUpdateEntityPropertyOptionsResponse.md)\\>\n\nApply multi-select option deltas atomically across this entity's properties.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `changes` | [`PropertyOptionDelta`](../../../entity/interfaces/PropertyOptionDelta.md)[] |\n\n#### Returns\n\n`Promise`\\<[`BulkUpdateEntityPropertyOptionsResponse`](../../../../../generated/properties/types.gen/type-aliases/BulkUpdateEntityPropertyOptionsResponse.md)\\>\n\n#### Inherited from\n\n[`PropertiedEntity`](../../../entity/classes/PropertiedEntity.md).[`updatePropertyOptions`](../../../entity/classes/PropertiedEntity.md#updatepropertyoptions)\n\n***\n\n### updateState()\n\n> **updateState**(`request`): `Promise`\\<`void`\\>\n\nUpdate provider-neutral read, trash, spam, or star state.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `request` | [`UpdateThreadStateRequest`](../../../../../generated/email/types.gen/type-aliases/UpdateThreadStateRequest.md) |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `EmailThread`\n\nA handle to a thread by id. Details load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`EmailThread`\n\n\n<!-- src/entities/email/thread/interfaces/ReplyEmailOptions.md -->\n# Interface: ReplyEmailOptions\n\nOptions for replying within an email thread.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-bcc\"></a> `bcc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Bcc recipients. |\n| <a id=\"property-bodytext\"></a> `bodyText` | `string` | Plain-text body. |\n| <a id=\"property-cc\"></a> `cc?` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Cc recipients. |\n| <a id=\"property-replyingto\"></a> `replyingTo?` | [`EmailMessage`](../../message/classes/EmailMessage.md) | The message being replied to. |\n| <a id=\"property-subject\"></a> `subject?` | `string` | Subject line. Defaults to the subject of the thread's first message. |\n| <a id=\"property-to\"></a> `to` | [`ApiDraftContactInfo`](../../../../../generated/email/types.gen/type-aliases/ApiDraftContactInfo.md)[] | Recipients. |\n"},{"name": "favorites",diff --git a/crates/client/cache-core/AGENTS.md b/crates/client/cache-core/AGENTS.mdindex 7e07073083..94c4729ce8 100644--- a/crates/client/cache-core/AGENTS.md+++ b/crates/client/cache-core/AGENTS.md@@ -56,6 +56,8 @@ GraphQL response shape for callers. A concrete `Storage` impl (e.g.## Gotchas+- Email send persistence and cancellation belong to the frontend email journal, not the normalized cache or its mutation queue.+- Opaque JSON scalars must preserve floating-point values on reparse — `serde_json`is pulled in with the `float_roundtrip` feature; don't drop it.- Patches structural query changes in place instead of resending full resultsdiff --git a/crates/client/cache-core/src/link_patch.rs b/crates/client/cache-core/src/link_patch.rsindex 0d11b03190..6b417909f5 100644--- a/crates/client/cache-core/src/link_patch.rs+++ b/crates/client/cache-core/src/link_patch.rs@@ -238,6 +238,10 @@ pub enum LinkPatchError {/// A path step encountered a value of the wrong shape.#[error("link patch path encountered an incompatible cache value")]WrongShape,+ /// A nullable parent has no relation to update. Its query revalidation+ /// can discover the relation after the mutation commits.+ #[error("link patch path traverses a null parent")]+ NullParent,/// A traversed list exceeds the defensive limit.#[error("link patch traversed list length {actual} exceeds limit {maximum}")]ListTooLarge { actual: usize, maximum: usize },@@ -434,6 +438,10 @@ fn is_json_scalar(value: &Json) -> bool {/// Applies an already ordered patch set against effective records and writes/// only changed parent fields into `updates`.///+/// Null parents are always skipped: an absent optional relation cannot be+/// patched, but does not make the accompanying mutation invalid.+/// Query-rooted recipes also skip records or fields that have not been cached.+/// Explicit record-rooted recipes still require their target to exist./// When `skip_not_applicable` is true, stale/missing recipes are ignored. This/// mode is used during hydration and successful settlement, where stale query/// fields must never be recreated. Returns whether every recipe was applied.@@ -458,7 +466,14 @@ pub fn apply_link_patches(updates,patch,) {- if skip_not_applicable {+ if skip_not_applicable+ || matches!(error, LinkPatchError::NullParent)+ || (patch.record_root.is_none()+ && matches!(+ error,+ LinkPatchError::MissingParent(_) | LinkPatchError::MissingField { .. }+ ))+ {all_applied = false;continue;}@@ -892,6 +907,10 @@ fn resolve_from_value(});}+ if matches!(cursor.value, CacheValue::Null) {+ return Err(LinkPatchError::NullParent);+ }+if let CacheValue::Ref(key) = cursor.value {return resolve_from_record(schema,diff --git a/crates/client/cache-core/tests/email_draft_optimistic.rs b/crates/client/cache-core/tests/email_draft_optimistic.rsindex 967556abd4..1f46b3bc96 100644--- a/crates/client/cache-core/tests/email_draft_optimistic.rs+++ b/crates/client/cache-core/tests/email_draft_optimistic.rs@@ -13,7 +13,7 @@ use cache_core::engine::{BeginOptimisticWrite, Engine, ReadResult};use cache_core::link_patch::{LinkOperation, LinkPathSegment, OptimisticLinkPatch};use cache_core::queue::{MutationClaimRequest, MutationClaimToken};use cache_core::store::InMemoryStorage;-use cache_core::value::EntityKey;+use cache_core::value::{EntityKey, canonical_json};use pollster::block_on;use serde_json::{Value as Json, json};@@ -306,6 +306,184 @@ mutation DeleteEmailDraft($input: DeleteEmailDraftInput!) {}"#;+#[test]+fn restored_draft_enqueues_without_a_previously_loaded_thread_query() {+ block_on(async {+ let mut engine = Engine::new(InMemoryStorage::new());+ engine+ .write_query(+ None,+ "query { user { id } }",+ None,+ &serde_json::Map::new(),+ &json!({"user": {"id": "user-1"}}),+ None,+ )+ .await+ .unwrap();+ let response = mutation_response();+ let (transaction, _) = engine+ .begin_optimistic_write(+ None,+ BeginOptimisticWrite {+ client_metadata: None,+ uuid: "11111111-1111-4111-8111-111111111110",+ query: MUTATION,+ operation_name: Some("SaveEmailDraft"),+ variables: &mutation_variables(),+ data: &response,+ link_patches: &[messages_patch()],+ revalidations: &[],+ created_at_ms: 0,+ identity_bindings: &[],+ },+ )+ .await+ .expect("an uncached thread lookup must not reject a draft save");++ let mut engine = Engine::new(engine.into_storage());+ let selection = cache_core::record_selection::RecordSelection::parse(+ cache_core::meta::bundled_schema_ref(),+ "fragment Draft on GraphqlSoupEmailMessage { id bodyHtmlSanitized }",+ "Draft",+ )+ .unwrap();+ let records = engine+ .read_records_by_keys(+ &selection,+ &[EntityKey("GraphqlSoupEmailMessage:draft-1".into())],+ )+ .await+ .unwrap();+ assert_eq!(+ records.value[0].record["bodyHtmlSanitized"],+ "<p>offline</p>"+ );+ assert!(matches!(+ engine+ .read_query(None, PAGE_QUERY, Some("EmailThreadPage"), &page_variables())+ .await+ .unwrap(),+ ReadResult::Miss+ ));+ let claim = claim_head(&mut engine).await;+ let committed = engine+ .commit_optimistic_write(+ transaction,+ claim,+ MUTATION,+ Some("SaveEmailDraft"),+ &mutation_variables(),+ &mutation_response(),+ )+ .await+ .unwrap();+ assert!(committed.revalidations.iter().any(|query| {+ query.query == PAGE_QUERY+ && query.variables_json == canonical_json(&Json::Object(page_variables()))+ }));+ });+}++#[test]+fn restored_draft_enqueues_and_survives_restart_with_a_null_thread_lookup() {+ block_on(async {+ let mut engine = Engine::new(InMemoryStorage::new());+ let absent_thread = json!({"user": {"id": "user-1", "emailThread": null}});+ engine+ .write_query(+ None,+ PAGE_QUERY,+ Some("EmailThreadPage"),+ &page_variables(),+ &absent_thread,+ None,+ )+ .await+ .unwrap();+ let (transaction, _) = engine+ .begin_optimistic_write(+ None,+ BeginOptimisticWrite {+ client_metadata: None,+ uuid: "11111111-1111-4111-8111-111111111109",+ query: MUTATION,+ operation_name: Some("SaveEmailDraft"),+ variables: &mutation_variables(),+ data: &mutation_response(),+ link_patches: &[messages_patch()],+ revalidations: &[],+ created_at_ms: 0,+ identity_bindings: &[],+ },+ )+ .await+ .expect("a null thread lookup must not prevent durable draft restoration");++ let mut engine = Engine::new(engine.into_storage());+ let selection = cache_core::record_selection::RecordSelection::parse(+ cache_core::meta::bundled_schema_ref(),+ "fragment Draft on GraphqlSoupEmailMessage { id bodyHtmlSanitized }",+ "Draft",+ )+ .unwrap();+ let records = engine+ .read_records_by_keys(+ &selection,+ &[EntityKey("GraphqlSoupEmailMessage:draft-1".into())],+ )+ .await+ .unwrap();+ assert_eq!(+ records.value[0].record["bodyHtmlSanitized"],+ "<p>offline</p>"+ );+ let ReadResult::Hit { data } = engine+ .read_query(None, PAGE_QUERY, Some("EmailThreadPage"), &page_variables())+ .await+ .unwrap()+ else {+ panic!("null lookup should remain readable until revalidation")+ };+ assert_eq!(data, absent_thread);++ let claim = claim_head(&mut engine).await;+ let committed = engine+ .commit_optimistic_write(+ transaction,+ claim,+ MUTATION,+ Some("SaveEmailDraft"),+ &mutation_variables(),+ &mutation_response(),+ )+ .await+ .unwrap();+ assert!(committed.revalidations.iter().any(|query| {+ query.query == PAGE_QUERY+ && query.variables_json == canonical_json(&Json::Object(page_variables()))+ }));+ engine+ .write_query(+ None,+ PAGE_QUERY,+ Some("EmailThreadPage"),+ &page_variables(),+ &thread_page(),+ None,+ )+ .await+ .unwrap();+ assert!(matches!(+ engine+ .read_query(None, PAGE_QUERY, Some("EmailThreadPage"), &page_variables())+ .await+ .unwrap(),+ ReadResult::Hit { data } if data["user"]["emailThread"]["id"] == "thread-1"+ ));+ });+}+fn delete_variables() -> serde_json::Map<String, Json> {match json!({ "input": { "draftId": "draft-1" } }) {Json::Object(map) => map,diff --git a/crates/client/cache-core/tests/link_patch_null.rs b/crates/client/cache-core/tests/link_patch_null.rsnew file mode 100644index 0000000000..6a1439f572--- /dev/null+++ b/crates/client/cache-core/tests/link_patch_null.rs@@ -0,0 +1,108 @@+//! Optional null parents do not invalidate mutations; malformed shapes still do.++use cache_core::link_patch::{+ LinkOperation, LinkPatchError, LinkPathSegment, OptimisticLinkPatch, apply_link_patches,+};+use cache_core::value::{CacheValue, EntityKey, Record};+use std::collections::{BTreeMap, HashMap};++fn patch() -> OptimisticLinkPatch {+ OptimisticLinkPatch {+ query: "query { user { emailThread { messages { id } } } }".into(),+ record_root: None,+ operation_name: None,+ variables_json: "{}".into(),+ path: ["user", "emailThread", "messages"]+ .into_iter()+ .map(|field| LinkPathSegment::Field {+ field: field.into(),+ })+ .collect(),+ operation: LinkOperation::Remove {+ entity_key: EntityKey("GraphqlSoupEmailMessage:draft".into()),+ },+ }+}++fn records(thread: CacheValue) -> HashMap<EntityKey<'static>, Record> {+ HashMap::from([(+ EntityKey::root(),+ Record {+ fields: BTreeMap::from([(+ "user".into(),+ CacheValue::Object(BTreeMap::from([("emailThread".into(), thread)])),+ )]),+ },+ )])+}++#[test]+fn strict_patch_skips_a_null_parent_without_inventing_a_thread() {+ let mut effective = records(CacheValue::Null);+ let before = effective.clone();+ let mut updates = BTreeMap::new();+ let applied = apply_link_patches(+ cache_core::meta::bundled_schema_ref(),+ &mut effective,+ &mut updates,+ &[patch()],+ false,+ )+ .unwrap();+ assert!(!applied);+ assert_eq!(effective, before);+ assert!(updates.is_empty());+}++#[test]+fn strict_query_patch_skips_an_uncached_normalized_relation() {+ let user = EntityKey("GraphqlUser:user".into());+ for user_record in [None, Some(Record::default())] {+ let mut effective = HashMap::from([(+ EntityKey::root(),+ Record {+ fields: BTreeMap::from([("user".into(), CacheValue::Ref(user.clone()))]),+ },+ )]);+ if let Some(record) = user_record {+ effective.insert(user.clone(), record);+ }+ let before = effective.clone();+ let mut updates = BTreeMap::new();+ let applied = apply_link_patches(+ cache_core::meta::bundled_schema_ref(),+ &mut effective,+ &mut updates,+ &[patch()],+ false,+ )+ .unwrap();+ assert!(!applied);+ assert_eq!(effective, before);+ assert!(updates.is_empty());+ }+}++#[test]+fn strict_patch_still_rejects_scalar_parents_and_null_target_lists() {+ for thread in [+ CacheValue::String("malformed thread".into()),+ CacheValue::Object(BTreeMap::from([("messages".into(), CacheValue::Null)])),+ ] {+ let mut effective = records(thread);+ let before = effective.clone();+ let mut updates = BTreeMap::new();+ assert_eq!(+ apply_link_patches(+ cache_core::meta::bundled_schema_ref(),+ &mut effective,+ &mut updates,+ &[patch()],+ false+ ),+ Err(LinkPatchError::WrongShape)+ );+ assert_eq!(effective, before);+ assert!(updates.is_empty());+ }+}diff --git a/crates/client/cache-core/tests/property_assignment_optimistic.rs b/crates/client/cache-core/tests/property_assignment_optimistic.rsindex 22dac0bfc9..03d01fced6 100644--- a/crates/client/cache-core/tests/property_assignment_optimistic.rs+++ b/crates/client/cache-core/tests/property_assignment_optimistic.rs@@ -406,3 +406,78 @@ fn later_edit_rebases_over_new_server_id_without_duplicate_properties() {assert_eq!(properties(&data)[0]["value"]["optionIds"], json!(["low"]));});}++#[test]+fn skipped_uncached_query_links_keep_the_recovery_query_after_commit() {+ block_on(async {+ for cache_user in [false, true] {+ let mut engine = Engine::new(InMemoryStorage::new());+ if cache_user {+ engine+ .write_query(+ None,+ "query { user { id } }",+ None,+ &serde_json::Map::new(),+ &json!({"user":{"id":"user-1"}}),+ None,+ )+ .await+ .unwrap();+ }+ let recovery = QueryRevalidation {+ query: "query { user { emailThread { messages { id } } } }".into(),+ operation_name: None,+ variables_json: "{}".into(),+ only_on_link_failure: true,+ };+ let recipe = OptimisticLinkPatch {+ query: recovery.query.clone(),+ record_root: None,+ operation_name: None,+ variables_json: "{}".into(),+ path: ["user", "emailThread", "messages"]+ .into_iter()+ .map(|field| LinkPathSegment::Field {+ field: field.into(),+ })+ .collect(),+ operation: LinkOperation::Remove {+ entity_key: EntityKey("GraphqlSoupEmailMessage:draft".into()),+ },+ };+ let txn = engine+ .begin_optimistic_write(+ None,+ BeginOptimisticWrite {+ client_metadata: None,+ identity_bindings: &[],+ uuid: UUID,+ query: MUTATION,+ operation_name: Some("Set"),+ variables: &variables(),+ data: &response("temporary-1", "urgent"),+ link_patches: &[recipe],+ revalidations: std::slice::from_ref(&recovery),+ created_at_ms: 1,+ },+ )+ .await+ .unwrap()+ .0;+ let token = claim(&mut engine, 2).await;+ let committed = engine+ .commit_optimistic_write(+ txn,+ token,+ MUTATION,+ Some("Set"),+ &variables(),+ &response("server-1", "urgent"),+ )+ .await+ .unwrap();+ assert!(committed.revalidations.contains(&recovery));+ }+ });+}diff --git a/crates/client/cache-turso/AGENTS.md b/crates/client/cache-turso/AGENTS.mdindex 13492ff997..0bd583ed93 100644--- a/crates/client/cache-turso/AGENTS.md+++ b/crates/client/cache-turso/AGENTS.md@@ -39,6 +39,8 @@ GraphQL cache — native for tests/Tauri, OPFS-backed on wasm32.## Gotchas+- Email send persistence and cancellation belong to the frontend email journal, not the normalized cache or its mutation queue.+- Quick Access projection version upgrades rebuild derived rows from retained normalized records; preserve the mutation queue and storage generation (covered by `src/storage/test/search_projection.rs`).- `#![forbid(unsafe_code)]` and `#![deny(missing_docs)]` — this crate is held todiff --git a/crates/client/cache-wasm/AGENTS.md b/crates/client/cache-wasm/AGENTS.mdindex 474ff05179..74e50d43b5 100644--- a/crates/client/cache-wasm/AGENTS.md+++ b/crates/client/cache-wasm/AGENTS.md@@ -46,6 +46,8 @@ wasm-bindgen shell exposing `cache-core` + `cache-turso` + `turso-opfs` as a## Gotchas+- Email send persistence and cancellation belong to the frontend email journal, not the normalized cache or its mutation queue.+- The engine is guarded by an async mutex so overlapping JS calls serializeinstead of causing reentrancy — don't bypass it with a second entry point.- Compiles to an empty shell off-wasm specifically so plain `cargo test` acrossdiff --git a/crates/client/cache-wasm/Cargo.toml b/crates/client/cache-wasm/Cargo.tomlindex 85c1e60a12..5731e2ce55 100644--- a/crates/client/cache-wasm/Cargo.toml+++ b/crates/client/cache-wasm/Cargo.toml@@ -2,8 +2,8 @@edition = "2024"name = "cache-wasm"publish = false-# Rebuild with thread-local email participant cache semantics.-version = "0.6.49"+# Rebuild with draft link patches and compressed normalized records.+version = "0.6.52"[features]default = []diff --git a/crates/code_execution/src/outbound/deno/sdk.mjs b/crates/code_execution/src/outbound/deno/sdk.mjsindex 0620de13db..a9bdc65df1 100644--- a/crates/code_execution/src/outbound/deno/sdk.mjs+++ b/crates/code_execution/src/outbound/deno/sdk.mjs@@ -1,5 +1,5 @@// Generated by packages/code-mode-sdk/scripts/generate.ts.-async function bO($,O,j){if(!Number.isInteger(O)||O<1)throw RangeError(`concurrency limit must be a positive integer, got ${O}`);let x=Array($.length),S=0,K=async()=>{while(S<$.length){let X=S;S+=1,x[X]=await j($[X])}},Z=Array.from({length:Math.min(O,$.length)},K);return await Promise.all(Z),x}class J${loader;value;inflight;constructor($,O){this.loader=$;this.value=O}get(){if(this.value!==void 0)return Promise.resolve(this.value);return this.inflight??=this.loader().then(($)=>{return this.value=$,$}),this.inflight}peek(){return this.value}clear(){this.value=void 0,this.inflight=void 0}}async function*a($){let O;do{let j=await $(O),x=j.nextCursor??void 0;if(O!==void 0&&x!==void 0&&JSON.stringify(x)===JSON.stringify(O))throw Error("Pagination cursor did not advance");yield*j.items,O=x}while(O!==void 0)}class b extends Error{constructor($){super($);this.name="MacroError"}}class SO extends b{status;data;constructor($,O){super(`Macro API error ${$}`);this.status=$;this.data=O;this.name="MacroApiError"}}class w extends b{constructor($){super($);this.name="MacroNotFoundError"}}function Q($){if($.error!==void 0)throw new SO($.response?.status??0,$.error);return $.data}class A{client;id;detail;constructor($,O,j){this.client=$;this.id=O;this.detail=new J$(()=>this.fetch(),j)}field($){return async()=>(await this.detail.get())[$]??void 0}mappedField($,O){return async()=>O((await this.detail.get())[$]??void 0)}toJSON(){let $=this.detail.peek();return $===void 0?{id:this.id}:{id:this.id,detail:$}}async mutate($){let O=Q(await $(this.client));return this.detail.clear(),O}}class F$ extends A{async permission(){return Q(await this.client.storage.getEntityPermission({path:{entity_type:this.entityType,entity_id:this.id}}))}async favorite(){return Q(await this.client.storage.addFavorite({body:{entityId:this.id,entityType:this.entityType}})),this}async unfavorite(){return Q(await this.client.storage.removeFavoriteByEntity({path:{entity_type:this.entityType,entity_id:this.id}})),this}}class S$ extends F${propertyReference(){return{entity_type:this.propertyEntityType,entity_id:this.id}}async properties($){let{properties:O}=Q(await this.client.properties.getEntityProperties({path:{entity_type:this.propertyEntityType,entity_id:this.id},query:$?.includeMetadata!==void 0?{include_metadata:$.includeMetadata}:void 0}));return O}async setProperty($,O){Q(await this.client.properties.setEntityProperty({path:{...this.propertyReference(),property_id:$.id},body:{value:O??null}}))}async updatePropertyOptions($){return Q(await this.client.properties.bulkUpdateEntityPropertyOptions({path:this.propertyReference(),body:{properties:$.map((O)=>({property_id:O.property.id,...O.add?{add_option_ids:O.add.map((j)=>j.id)}:{},...O.remove?{remove_option_ids:O.remove.map((j)=>j.id)}:{}}))}}))}async deleteProperty($){Q(await this.client.properties.deleteEntityProperty({path:{entity_property_id:$.property.id}}))}}function l$($,O){return`<${$}>${JSON.stringify(O)}</${$}>`}function H6($){return typeof $==="object"&&$!==null&&typeof $.toMention==="function"}var R6={toMention:()=>({tag:l$("m-group-mention",{groupAlias:"here"}),mention:{entity_type:"group",entity_id:"here"}})};function D6($,...O){let j="",x=[];for(let[S,K]of $.entries()){j+=K;let Z=O[S];if(Z===void 0)continue;if(H6(Z)){let X=Z.toMention();j+=X.tag,x.push(X.mention)}else j+=String(Z)}return{content:j,mentions:C6(x)}}function C6($){let O=new Set;return $.filter((j)=>{let x=`${j.entity_type}:${j.entity_id}`;if(O.has(x))return!1;return O.add(x),!0})}function $$($){return typeof $==="string"?{content:$,mentions:[]}:$}class V$ extends A{static byId($,O){return new V$($,O)}static from($,O){return new V$($,O.id,O)}async fetch(){let $=Q(await this.client.storage.listHarnesses()).find((O)=>O.id===this.id);if(!$)throw new w(`Harness ${this.id} is unavailable`);return $}name=this.field("name");connected=this.field("connected");kind=this.field("kind");async delete(){await this.mutate(($)=>$.storage.deleteHarness({path:{harness_id:this.id}}))}}class U$ extends A{static byId($,O){return new U$($,O)}static from($,O){return new U$($,O.bot.id,O)}async fetch(){let $=Q(await this.client.storage.listAgents()).find((O)=>O.bot.id===this.id);if(!$)throw new w(`Agent ${this.id} is unavailable`);return $}name=this.mappedField("bot",($)=>$.name);instructions=this.field("instructions");defaultModel=this.field("default_model");channels=this.mappedField("channel_ids",($)=>$.map((O)=>f.byId(this.client,O)));host=this.mappedField("harness_id",($)=>$?V$.byId(this.client,$):void 0);async update($){await this.mutate((O)=>O.storage.updateAgent({path:{agent_id:this.id},body:Fx($)}))}}function Fx($){let{channels:O,team:j,host:x,autoAcceptPermissions:S,avatarUrl:K,channelScope:Z,defaultModel:X,isCoding:G,...L}=$;return{...L,channel_ids:O?.map((Y)=>Y.id),team_id:j?.id,harness_id:x?.id,auto_accept_permissions:S,avatar_url:K,channel_scope:Z,default_model:X,is_coding:G}}async function Xj($,O,j){let{channelId:x,thread:S}=_6(O);if(await M6($)){let{id:Z}=Q(await $.storage.entityMessageCreate({path:{parent_type:"channel",parent_id:x},body:{content:j.content,mentions:j.mentions,attachments:[],thread_id:S?.rootId??null,nonce:crypto.randomUUID()}}));return Z}if(S)throw new b("a user-owned bot can only post via the channel webhook endpoint, which "+"does not support threads — use a team-owned bot, or requestedAs(user), "+"to reply in a thread");let{message_id:K}=Q(await $.storage.postChannelBotWebhook({path:{channel_id:x},body:{content:j.content},headers:{"x-macro-bot-scope":"user"}}));return K}function _6($){return"rootId"in $?{channelId:$.channelId,thread:$}:{channelId:$.id}}async function M6($){if($.authConfig.type!=="bot"||$.hasActingUser())return!0;let{owner:O}=await $.selfBot();return O?.type==="team"}class g${client;channelId;rootId;constructor($,O,j){this.client=$;this.channelId=O;this.rootId=j}toJSON(){return{channelId:this.channelId,rootId:this.rootId}}channel(){return f.byId(this.client,this.channelId)}root(){return e.byId(this.client,this.channelId,this.rootId)}async replies(){let{replies:$}=Q(await this.client.storage.entityMessageGetThread({path:{parent_type:"channel",parent_id:this.channelId,id:this.rootId}}));return $.map((O)=>e.from(this.client,this.channelId,O))}async reply($){let O=await Xj(this.client,this,$$($));return e.byId(this.client,this.channelId,O)}}class e extends F${channelId;mentions;entityType="channel_message";constructor($,O,j,x=[],S){super($,j,S);this.channelId=O;this.mentions=x}get path(){return{parent_type:"channel",parent_id:this.channelId,id:this.id}}async fetch(){return Q(await this.client.storage.entityMessageGetMessage({path:this.path}))}static byId($,O,j,x=[]){return new e($,O,j,x)}static from($,O,j){return new e($,O,j.id,j.mentions,j)}content=this.field("content");createdAt=this.field("created_at");editedAt=this.field("edited_at");updatedAt=this.field("updated_at");async author(){return M.byId(this.client,(await this.detail.get()).sender_id)}channel(){return f.byId(this.client,this.channelId)}thread(){return new g$(this.client,this.channelId,this.id)}async react($){return await this.mutate((O)=>O.storage.entityMessageReact({path:this.path,body:{add:!0,emoji:$}})),this}async unreact($){return await this.mutate((O)=>O.storage.entityMessageReact({path:this.path,body:{add:!1,emoji:$}})),this}async edit($){let{content:O,mentions:j}=$$($);return await this.mutate((x)=>x.storage.entityMessageEdit({path:this.path,body:{content:O,mentions:j}})),this}async delete(){await this.mutate(($)=>$.storage.entityMessageDeleteMessage({path:this.path}))}async reply($){return this.thread().reply($)}}class Gj{client;channel;record;constructor($,O,j){this.client=$;this.channel=O;this.record=j}agent(){return U$.byId(this.client,this.record.botId)}sessions(){return this.record.sessions.map(($)=>({session:i.byId(this.client,$.sessionId),isCurrent:$.isCurrent,createdAt:$.createdAt}))}turns(){return this.record.turns.map(($)=>new Ex(this.client,this,$))}async startFresh($){Q(await this.client.agentHarness.startFreshAgentConversation({path:{channel_id:this.channel.id,bot_id:this.record.botId},body:{sessionId:$.id}}))}toJSON(){return{channelId:this.channel.id,agentId:this.record.botId}}}class Ex{client;conversation;record;constructor($,O,j){this.client=$;this.conversation=O;this.record=j}source(){return e.byId(this.client,this.conversation.channel.id,this.record.sourceMessageId)}session(){return i.byId(this.client,this.record.sessionId)}async retry($){Q(await this.client.agentHarness.retryAgentConversationTurn({path:{channel_id:this.conversation.channel.id,bot_id:this.conversation.agent().id,source:this.record.sourceMessageId},body:{actionId:$}}))}toJSON(){return{channelId:this.conversation.channel.id,sourceMessageId:this.record.sourceMessageId}}}class W$ extends A{parent;toJSON(){return{...super.toJSON(),parentType:this.parent.type,parentId:this.parent.entity.id}}constructor($,O,j){super($,j);this.parent=O}static byId($,O,j){return new W$($,O,j)}get path(){return{parent_type:this.parent.type,parent_id:this.parent.entity.id,id:this.id}}async fetch(){return Q(await this.client.storage.entityMessageGetThread({path:this.path})).state}resolved=this.field("resolved");async update($){let O={resolved:$.resolved,detach_anchor:$.detachAnchor,nonce:$.nonce};await this.mutate((j)=>j.storage.entityMessagePatchThread({path:this.path,body:O}))}async delete($){await this.mutate((O)=>O.storage.entityMessageDeleteThread({path:this.path,query:{nonce:$}}))}}async function E$($,O,j,x){for(let K of[...x?.messages??[],...x?.around?[x.around]:[]]){let Z="channelId"in K?{type:"channel",id:K.channelId}:("documentId"in K)?{type:"document",id:K.documentId}:("callId"in K)?{type:"call",id:K.callId}:K.parent;if(Z.type!==O.type||Z.id!==O.entity.id)throw Error("Timeline message belongs to another resource")}let S=Q(await $.storage.messageTimelineEntries({path:{parent_type:O.type,parent_id:O.entity.id},query:{selection:x?JSON.stringify({cursor:x.cursor,around:x.around?.id,ids:x.messages?.map((K)=>K.id),activity_after:x.activityAfter,activity_before:x.activityBefore,anchored:x.anchored,direction:x.direction,include_deleted_threads:x.includeDeletedThreads,limit:x.limit}):void 0}}));return{entries:S.entries.map((K)=>{if(K.type==="activity")return{type:"activity",activity:{...K.activity,actor:M.byId($,K.activity.actor_id)}};return{type:"message",message:j(K.message)}}),nextCursor:S.next_cursor??void 0,previousCursor:S.previous_cursor??void 0}}var A6=50;function j$($){let{filters:O,type:j,make:x,includeCrm:S}=$;return(K,Z,X)=>{let G=X?.searchOn??"name_content",L=X?.pageSize??A6;return a(async(Y)=>{let{results:J,next_cursor:T}=Q(await K.search.unifiedSearch({body:{query:Z,match_type:"partial",search_on:G,...O?{filters:O}:{},...S?{include_crm:!0}:{}},query:{page_size:L,...Y?{cursor:Y}:{}}}));return{items:J.filter((W)=>W.type===j).map((W)=>x(K,W)),nextCursor:T}})}}class ZO{client;channel;record;constructor($,O,j){this.client=$;this.channel=O;this.record=j}get id(){return this.record.id}user(){return M.byId(this.client,this.record.user_id)}createdAt(){return this.record.created_at}async recordInteraction($){return new ZO(this.client,this.channel,Q(await this.client.storage.postActivity({body:{activity_type:$,channel_id:this.channel.id}})))}toJSON(){return this.record}}class f extends S${async recordActivity($){return new ZO(this.client,this,Q(await this.client.storage.postActivity({body:{activity_type:$,channel_id:this.id}})))}async setPicture($){await this.mutate((O)=>O.storage.setChannelPicture({path:{channel_id:this.id},body:{profile_picture_id:$?.id??null}}))}messageThreadById($){return W$.byId(this.client,{type:"channel",entity:this},$)}timelinePage($){return E$(this.client,{type:"channel",entity:this},(O)=>e.from(this.client,this.id,O),$)}async agentConversations(){return Q(await this.client.agentHarness.listAgentConversations({path:{channel_id:this.id}})).conversations.map(($)=>new Gj(this.client,this,$))}entityType="channel";propertyEntityType="CHANNEL";async fetch(){return Q(await this.client.storage.getChannel({path:{channel_id:this.id}}))}static byId($,O){return new f($,O)}static async dm($,O){let{channel_id:j}=Q(await $.storage.getOrCreateDm({body:{recipient_id:O.id}}));return new f($,j)}static async private($,O){let{channel_id:j}=Q(await $.storage.getOrCreatePrivate({body:{recipients:O.map((x)=>x.id)}}));return new f($,j)}static async create($,O){let{id:j}=Q(await $.storage.createChannel({body:{channel_type:O.type,name:O.name??null,participants:(O.participants??[]).map((x)=>x.id),team_id:O.team?.id??null}}));return new f($,j)}name=this.field("channel_name");type=this.field("channel_type");async send($,O){let j=await Xj(this.client,O?.thread??this,$$($));return e.byId(this.client,this.id,j)}messages($){return this.timeline({limit:$?.pageSize})}messagesAfter($,O){return this.timeline({activity_after:$ instanceof Date?$.toISOString():$,limit:O?.pageSize})}timeline($){return a(async(O)=>{let j=Q(await this.client.storage.messageTimeline({path:{parent_type:"channel",parent_id:this.id},query:{selection:JSON.stringify({...$,cursor:O})}}));return{items:j.items.map((x)=>e.from(this.client,this.id,x)),nextCursor:j.next_cursor}})}message($){return e.byId(this.client,this.id,$)}async rename($){await this.mutate((O)=>O.storage.patchChannel({path:{channel_id:this.id},body:{channel_name:$}}))}async delete(){await this.mutate(($)=>$.storage.deleteChannel({path:{channel_id:this.id}}))}async join(){await this.mutate(($)=>$.storage.joinChannel({path:{channel_id:this.id}}))}async joinCode(){let{join_code:$}=Q(await this.client.storage.getChannelJoinLink({path:{channel_id:this.id}}));return $}async leave(){await this.mutate(($)=>$.storage.leaveChannel({path:{channel_id:this.id}}))}async participants(){return Q(await this.client.storage.getChannelParticipants({path:{channel_id:this.id}}))}async addParticipants($){await this.mutate((O)=>O.storage.addParticipants({path:{channel_id:this.id},body:{participants:$.map((j)=>j.id)}}))}async removeParticipants($){await this.mutate((O)=>O.storage.removeParticipants({path:{channel_id:this.id},body:{participants:$.map((j)=>j.id)}}))}async typing($,O){Q(await this.client.storage.entityMessageTyping({path:{parent_type:"channel",parent_id:this.id},body:{active:$==="start",thread_id:O?.thread?.rootId??null}}))}attachments($){return a(async(O)=>{let j=Q(await this.client.storage.getChannelAttachments({path:{channel_id:this.id},query:{...$?.pageSize?{limit:$.pageSize}:{},...$?.type?{attachment_type:$.type}:{},...O?{cursor:O}:{}}}));return{items:j.items,nextCursor:j.next_cursor}})}webUrl(){return`${this.client.webAppUrl}/app/channel/${this.id}`}static search=j$({type:"channel",make:($,O)=>new f($,O.channel_id)})}class M extends S${entityType="user";propertyEntityType="USER";async fetch(){let{names:$}=Q(await this.client.auth.getUserNamesWithEmail({body:{user_ids:[this.id]}})),O=$.find((j)=>j.id===this.id);if(!O)throw new w(`user ${this.id} not found`);return O}static byId($,O){return new M($,O)}static async me($){let{user_id:O}=Q(await $.auth.getUserInfo());return new M($,O)}async name(){let $=await this.detail.get();return[$.first_name,$.last_name].filter(Boolean).join(" ")||void 0}email(){let $=this.id.startsWith("macro|")?this.id.slice(6):void 0;return $?.includes("@")?$:void 0}dm(){return f.dm(this.client,this)}toMention(){return{tag:l$("m-user-mention",{userId:this.id}),mention:{entity_type:"user",entity_id:this.id}}}}class o{client;entityType;entity;constructor($,O,j){this.client=$;this.entityType=O;this.entity=j}get path(){return{entity_type:this.entityType,entity_id:this.entity.id}}async state($){let O=Q(await this.client.storage.accessRequestsState({path:this.path,query:{offset:$}}));return{accessLevel:O.accessLevel??void 0,canReview:O.canReview,owner:O.owner?M.byId(this.client,O.owner):void 0,pendingCount:O.pendingCount,supportedLevels:O.supportedLevels,nextOffset:O.nextOffset??void 0,mine:O.mine?WO.from(this.client,this,O.mine):void 0,requests:O.requests.map((j)=>WO.from(this.client,this,j))}}async submit($,O){return WO.from(this.client,this,Q(await this.client.storage.accessRequestsSubmit({path:this.path,body:{requestedLevel:$,revision:O}})))}async cancel($){Q(await this.client.storage.accessRequestsCancel({path:this.path,query:{revision:$}}))}async direct(){return Q(await this.client.storage.accessRequestsDirect({path:this.path})).map(($)=>({user:M.byId(this.client,$.userId),accessLevel:$.accessLevel}))}async grant($,O){Q(await this.client.storage.accessRequestsSetDirect({path:{...this.path,user_id:$.id},body:{accessLevel:O}}))}async remove($){Q(await this.client.storage.accessRequestsRemoveDirect({path:{...this.path,user_id:$.id}}))}async resolve($,O){let j=$.access.toJSON();if(j.entity_type!==this.entityType||j.entity_id!==this.entity.id)throw Error("Access request belongs to another entity");return Q(await this.client.storage.accessRequestsResolve({path:{...this.path,request_id:$.id},body:O}))}toJSON(){return this.path}}class WO extends A{access;resolvedRecord;constructor($,O,j){super($,j.id,j);this.access=O}static from($,O,j){return new WO($,O,j)}async fetch(){if(this.resolvedRecord)return this.resolvedRecord;let $;do{let O=await this.access.state($),j=[O.mine,...O.requests].find((x)=>x?.id===this.id);if(j)return j.detail.get();$=O.nextOffset}while($!==void 0);throw new w(`Access request ${this.id} is unavailable`)}revision=this.field("revision");status=this.field("status");requestedLevel=this.field("requestedLevel");requester=this.mappedField("requesterId",($)=>M.byId(this.client,$));async resolve($){this.resolvedRecord=await this.access.resolve(this,{revision:await this.revision(),grantedLevel:$}),this.detail.clear()}}function r$($){return{...$,channelSharePermissions:$.channelSharePermissions===void 0||$.channelSharePermissions===null?$.channelSharePermissions:$.channelSharePermissions.map((O)=>({channelId:O.channel.id,accessLevel:O.accessLevel,operation:O.operation}))}}class B$ extends A{parent;constructor($,O,j,x){super($,j,x);this.parent=O}static byId($,O,j){return new B$($,O,j)}static fromRecord($,O,j){return new B$($,O,j.id,j)}static async create($,O,j){return B$.createForSession($,O.session(),j,O)}static async createForSession($,O,j,x){let S=Q(await $.agentHarness.createSessionReview({path:{session_id:O.id},body:{...j,executionId:x?.id??null}}));return B$.fromRecord($,O,S)}static async list($,O){return Q(await $.agentHarness.listExecutionReviews({path:{session_id:O.session().id,execution_id:O.id}})).map((x)=>B$.fromRecord($,O.session(),x))}async fetch(){return Q(await this.client.agentHarness.getSessionReview({path:{session_id:this.parent.id,review_id:this.id}}))}title=this.field("title");kind=this.field("kind");session(){return this.parent}async reference(){return{kind:await this.kind(),id:this.id}}async items(){return(await this.detail.get()).items.map(($)=>new wx($,{edit:(O)=>this.decide({action:"edit",item:$.id,draft:O}),submit:()=>this.decide({action:"submit",items:[$.id]}),dismiss:()=>this.decide({action:"dismiss",items:[$.id]})}))}async refresh(){return this.detail.clear(),await this.detail.get(),this}async submitAll(){await this.decide({action:"submit",items:[]})}async dismissAll(){await this.decide({action:"dismiss",items:[]})}async decide($){let O=(await this.detail.get()).revision;await this.mutate((j)=>j.agentHarness.decideSessionReview({path:{session_id:this.parent.id,review_id:this.id},body:{...$,revision:O}}))}}class wx{snapshot;actions;constructor($,O){this.snapshot=$;this.actions=O}get id(){return this.snapshot.id}get status(){return this.snapshot.status}get draft(){return this.snapshot.draft}get result(){return this.snapshot.result}async edit($){await this.actions.edit($)}async submit(){await this.actions.submit()}async dismiss(){await this.actions.dismiss()}}class kO extends A{parent;constructor($,O,j){super($,O);this.parent=j}static byId($,O,j){return new kO($,j,O)}async fetch(){return Q(await this.client.agentHarness.getCodeExecution({path:{session_id:this.parent.id,execution_id:this.id}}))}reviews={create:($)=>B$.create(this.client,this,$),list:()=>B$.list(this.client,this)};session(){return this.parent}status=this.field("status");source=this.field("source");calls=this.field("calls");error=this.field("error");async result(){return(await this.detail.get()).result}async refresh(){return this.detail.clear(),await this.detail.get(),this}}class Kj{client;sessionId;dto;constructor($,O,j){this.client=$;this.sessionId=O;this.dto=j}static from($,O,j){return new Kj($,O,j)}get actionId(){return this.dto.actionId}get kind(){return this.dto.kind}get prompt(){return this.dto.prompt??void 0}get attachments(){return this.dto.attachments??[]}get actorUserId(){return this.dto.actorUserId??void 0}get createdAt(){return this.dto.createdAt}async edit($){return Q(await this.client.agentHarness.editQueuedAction({path:{session_id:this.sessionId,action_id:this.actionId},body:{prompt:$}})),this.dto={...this.dto,prompt:$},this}async steer(){Q(await this.client.agentHarness.steerQueuedAction({path:{session_id:this.sessionId,action_id:this.actionId}}))}async remove(){Q(await this.client.agentHarness.removeQueuedAction({path:{session_id:this.sessionId,action_id:this.actionId}}))}}class gO{client;session;id;constructor($,O,j){this.client=$;this.session=O;this.id=j}static byId($,O,j){return new gO($,O,j)}async answer($){return Q(await this.client.agentHarness.answerAgentSessionToolApproval({path:{session_id:this.session.id,approval_id:this.id},body:{answer:$}}))}toJSON(){return{id:this.id,sessionId:this.session.id}}}class i extends A{access=new o(this.client,"agent_session",this);toolApprovalById($){return gO.byId(this.client,this,$)}async sharePermissions(){return Q(await this.client.agentHarness.getAgentSessionPermissions({path:{session_id:this.id}}))}async updateSharePermissions($){return this.mutate((O)=>O.agentHarness.updateAgentSessionPermissions({path:{session_id:this.id},body:r$($)}))}static byId($,O){return new i($,O)}static async createManaged($,O){let{session:j}=Q(await $.agentHarness.createAgentSession({body:{prompt:O?.prompt,instructions:O?.instructions,model:O?.model,repoUrl:O?.repoUrl,repoBranch:O?.repoBranch}}));return new i($,j.id,j)}static async repositories($){let{repositories:O}=Q(await $.agentHarness.listAgentRepositories());return O.map((j)=>({url:j.url,defaultBranch:j.defaultBranch??void 0}))}static async repositoryBranches($,O){let{branches:j}=Q(await $.agentHarness.listAgentRepositoryBranches({query:{repoUrl:O}}));return j}async fetch(){return Q(await this.client.agentHarness.getAgentSession({path:{session_id:this.id}}))}name=this.field("name");isArchived=this.field("isArchived");model=this.field("model");harness=this.field("harness");repoUrl=this.field("repoUrl");workspace=this.field("workspace");instructions=this.field("instructions");status=this.field("status");sandboxSize=this.field("sandboxSize");createdAt=this.field("createdAt");modifiedAt=this.field("modifiedAt");static async forPullRequest($,O){let{sessionIds:j}=Q(await $.agentHarness.agentSessionsForPullRequest({body:{url:O}}));return j.map((x)=>i.byId($,x))}async pullRequests(){let{pullRequests:$}=Q(await this.client.agentHarness.listAgentSessionPullRequests({path:{session_id:this.id}}));return $.map((O)=>({githubKey:O.githubKey,url:O.url,source:O.source,linkedBy:O.linkedBy?M.byId(this.client,O.linkedBy):void 0,createdAt:O.createdAt}))}async linkPullRequest($){Q(await this.client.agentHarness.linkAgentSessionPullRequest({path:{session_id:this.id},body:{url:$}}))}async unlinkPullRequest($){Q(await this.client.agentHarness.unlinkAgentSessionPullRequest({path:{session_id:this.id},query:{url:$}}))}async rename($){await this.mutate((O)=>O.agentHarness.renameAgentSession({path:{session_id:this.id},body:{name:$}}))}async archive(){await this.setArchived(!0)}async unarchive(){await this.setArchived(!1)}async setArchived($){await this.mutate((O)=>O.agentHarness.setAgentSessionArchived({path:{session_id:this.id},body:{isArchived:$}}))}async setSandboxSize($){let{size:O}=await this.mutate((j)=>j.agentHarness.putAgentSessionSandboxSize({path:{session_id:this.id},body:{size:$}}));return O}static async defaultSandboxSize($){return Q(await $.agentHarness.getAgentSandboxSize()).size}static async setDefaultSandboxSize($,O){return Q(await $.agentHarness.putAgentSandboxSize({body:{size:O}})).size}static async codingPreferences($){return Q(await $.agentHarness.getAgentCodingPreferences())}static async setCodingPreferences($,O){return Q(await $.agentHarness.putAgentCodingPreferences({body:O}))}async control($){return this.mutate((O)=>O.agentHarness.controlAgentSession({path:{session_id:this.id},body:$}))}prompt($,O){return this.control({type:"prompt",prompt:$,...O&&O.length>0?{attachments:O}:{}})}async queue(){let{entries:$}=Q(await this.client.agentHarness.getAgentSessionQueue({path:{session_id:this.id}}));return $.map((O)=>Kj.from(this.client,this.id,O))}async changes(){return Q(await this.client.agentHarness.getAgentSessionChanges({path:{session_id:this.id}}))}async changesPatch(){return Q(await this.client.agentHarness.getAgentSessionChangesPatch({path:{session_id:this.id}})).patch}async refreshChanges(){return this.mutate(($)=>$.agentHarness.refreshAgentSessionChanges({path:{session_id:this.id}}))}async foldedLog(){let{bot:$,messages:O}=Q(await this.client.agentHarness.getAgentSessionFoldedLog({path:{session_id:this.id}}));return{bot:$,messages:O}}async log(){return Q(await this.client.agentHarness.getAgentSessionLog({path:{session_id:this.id}}))}reviews={create:($)=>B$.createForSession(this.client,this,$),byId:($)=>B$.byId(this.client,this,$)};codeExecutions={byId:($)=>kO.byId(this.client,this,$)};async delete(){await this.mutate(($)=>$.agentHarness.deleteAgentSession({path:{session_id:this.id}}))}}class qx{client;constructor($){this.client=$}byId($){return i.byId(this.client,$)}createManaged($){return i.createManaged(this.client,$)}repositories(){return i.repositories(this.client)}repositoryBranches($){return i.repositoryBranches(this.client,$)}forPullRequest($){return i.forPullRequest(this.client,$)}defaultSandboxSize(){return i.defaultSandboxSize(this.client)}setDefaultSandboxSize($){return i.setDefaultSandboxSize(this.client,$)}codingPreferences(){return i.codingPreferences(this.client)}setCodingPreferences($){return i.setCodingPreferences(this.client,$)}}class fx{client;constructor($){this.client=$}byId($){return U$.byId(this.client,$)}async list(){return Q(await this.client.storage.listAgents()).map(($)=>U$.from(this.client,$))}async create($){return U$.from(this.client,Q(await this.client.storage.createAgent({body:Fx($)})))}}class bx{client;async usage($={}){let{users:O,...j}=$;return Q(await this.client.cognition.getUsageHandler({body:{...j,include_users:O?.map((x)=>x.id)}}))}constructor($){this.client=$}async structuredCompletion($){return Q(await this.client.cognition.structuredCompletion({body:$}))}async decide($){return Q(await this.client.cognition.decisions({body:$}))}}class p$ extends A{static byId($,O){return new p$($,O)}static from($,O){return new p$($,O.id,{id:O.id,name:O.name,createdAt:O.createdAt})}async fetch(){let $=Q(await this.client.storage.listUserApiKeys()).keys.find((O)=>O.id===this.id);if(!$)throw new w(`API key ${this.id} is unavailable`);return $}name=this.field("name");createdAt=this.field("createdAt");async delete(){await this.mutate(($)=>$.storage.deleteUserApiKey({path:{id:this.id}}))}}class kx{client;constructor($){this.client=$}byId($){return p$.byId(this.client,$)}async list(){return Q(await this.client.storage.listUserApiKeys()).keys.map(($)=>p$.from(this.client,$))}async create($){let O=Q(await this.client.storage.createUserApiKey({body:{name:$}}));return{key:p$.from(this.client,O),secret:O.key}}async tokenForEmail($){return Q(await this.client.auth.macroApiToken({query:{email:$}}))}}class yO{client;constructor($){this.client=$}async me(){if(this.client.authConfig.type!=="bot")throw new b("bots.me() requires bot auth — a user API key has no bot identity");return Q(await this.client.storage.getSelfBot())}async channels(){if(this.client.authConfig.type!=="bot")throw new b("bots.channels() requires bot auth — a user API key has no bot identity");let $=await this.me();return Q(await this.client.storage.listBotChannels({path:{bot_id:$.id}}))}async myPrincipalId(){if(this.client.authConfig.type!=="bot")throw new b("bots.myPrincipalId() requires bot auth — a user API key has no bot identity");return this.client.myPrincipalId()}}class z$ extends A{async fetch(){let{links:$}=Q(await this.client.email.listLinks()),O=$.find((j)=>j.id===this.id);if(!O)throw new w(`email link ${this.id} not found`);return O}static byId($,O){return new z$($,O)}static async list($){let{links:O}=Q(await $.email.listLinks());return O.map((j)=>new z$($,j.id,j))}emailAddress=this.field("email_address");provider=this.field("provider");isPrimary=this.field("is_primary");isSyncActive=this.field("is_sync_active");syncStatus=this.field("sync_status");needsReauth=this.field("needs_reauth");photoUrl=this.field("photo_url");async settingsOperations(){return Q(await this.client.email.mailboxSettingsOperations({headers:{"X-Email-Link-Id":this.id}}))}}class y$ extends A{async setContributesToAvailability($){await this.mutate((O)=>O.calendar.setAvailabilityCalendar({path:{calendar_id:this.id},body:{contributesToAvailability:$}}))}async fetch(){let{calendars:$}=Q(await this.client.calendar.listCalendars()),O=$.find((j)=>j.id===this.id);if(!O)throw new w(`calendar ${this.id} not found`);return O}static byId($,O){return new y$($,O)}static async list($){let{calendars:O}=Q(await $.calendar.listCalendars());return O.map((j)=>new y$($,j.id,j))}name=this.field("name");emailAddress=this.field("emailAddress");isPrimary=this.field("isPrimary");isWritable=this.field("isWritable");isSubscription=this.field("isSubscription");color=this.field("color");syncError=this.field("syncError");emailLink=this.mappedField("emailLinkId",($)=>z$.byId(this.client,$))}class vO{client;id;constructor($,O){this.client=$;this.id=O}async status(){return Q(await this.client.calendar.calendarReplacementStatus({path:{operation_id:this.id}}))}async confirm(){return Q(await this.client.calendar.confirmCalendarReplacement({path:{operation_id:this.id}}))}async discard(){Q(await this.client.calendar.discardCalendarReplacement({path:{operation_id:this.id}}))}}class L$ extends A{async fetch(){throw new b(`calendar event ${this.id} has no fetch-by-id endpoint; read the record returned by calendar.createEvent / event.update / event.rsvp instead`)}static byId($,O){return new L$($,O)}static fromRecord($,O){return new L$($,O.id,O)}title=this.field("title");description=this.field("description");location=this.field("location");time=this.field("time");status=this.field("status");attendees=this.field("attendees");transparency=this.field("transparency");isReadOnly=this.field("isReadOnly");recurrenceLines=this.field("recurrenceLines");guestPolicy=this.field("guestPolicy");viewerCan=this.field("viewerCan");calendar=this.mappedField("calendarId",($)=>$?y$.byId(this.client,$):void 0);record(){return this.detail.get()}async update($){let O=await this.mutate((j)=>j.calendar.updateCalendarEvent({path:{event_id:this.id},body:P6($)}));return L$.fromRecord(this.client,O)}async delete($={}){await this.mutate((O)=>O.calendar.deleteCalendarEvent({path:{event_id:this.id},query:{calendarId:$.calendar?.id,scope:$.scope,recurrenceId:$.recurrenceId}}))}async prepareReplacement($){let O=Q(await this.client.calendar.prepareCalendarReplacement({path:{event_id:this.id},body:{removeConference:$.removeConference,recurrenceId:$.recurrenceId,calendarId:$.calendar?.id}}));return new vO(this.client,O.operationId)}async providerUrl($={}){return Q(await this.client.calendar.calendarEventProviderUrl({path:{event_id:this.id},query:{recurrenceId:$.recurrenceId,calendarId:$.calendar?.id}})).url??void 0}async inviteGuests($){let O=await this.mutate((j)=>j.calendar.inviteCalendarEventGuests({path:{event_id:this.id},body:{guests:$.guests,scope:$.scope,recurrenceId:$.recurrenceId,calendarId:$.calendar?.id}}));return L$.fromRecord(this.client,O)}async ics(){return Q(await this.client.storage.eventIcs({path:{event_id:this.id}}))}async rsvp($){let O=await this.mutate((j)=>j.calendar.rsvpCalendarEvent({path:{event_id:this.id},body:{response:$.response,scope:$.scope,recurrenceId:$.recurrenceId,calendarId:$.calendar?.id}}));return L$.fromRecord(this.client,O)}}function P6($){return{title:$.title,description:$.description,location:$.location,time:$.time,attendees:$.attendees,recurrenceLines:$.recurrenceLines,visibility:$.visibility,transparency:$.transparency,reminders:$.reminders,conference:$.conference,outOfOffice:$.outOfOffice,scope:$.scope,recurrenceId:$.recurrenceId,calendarId:$.calendar?.id}}class gx{client;async availabilityCalendars(){return Q(await this.client.calendar.getAvailabilityCalendars()).calendars.map(($)=>({calendar:y$.byId(this.client,$.calendarId),name:$.name,isPrimary:$.isPrimary,contributesToAvailability:$.contributesToAvailability}))}async teamSharing(){return Q(await this.client.calendar.getTeamSharing()).sharing}async setTeamSharing($){return Q(await this.client.calendar.setTeamSharing({body:{sharing:$}})).sharing}occurrences($){return a(async(O)=>{let j=Q(await this.client.storage.listOccurrences({query:{...$,cursor:O}}));return{items:j.items.map((x)=>({event:L$.fromRecord(this.client,x.event),occurrence:x.occurrence})),nextCursor:j.nextCursor}})}async teamPage($){let O=Q(await this.client.storage.listTeamCalendar({query:$}));return{items:O.items.map(({ownerId:j,...x})=>({...x,owner:M.byId(this.client,j)})),members:O.members.map((j)=>({user:M.byId(this.client,j.userId),sharing:j.sharing,coverage:j.coverage})),nextCursor:O.nextCursor??void 0}}async teamOutOfOffice($){let O=Q(await this.client.storage.listTeamOutOfOffice({query:$}));return{items:O.items.map((j)=>({event:L$.byId(this.client,j.eventId),owner:M.byId(this.client,j.ownerId),occurrenceKey:j.occurrenceKey,time:j.time,title:j.title??void 0})),hasMore:O.hasMore}}constructor($){this.client=$}calendars(){return y$.list(this.client)}calendar($){return y$.byId(this.client,$)}event($){return L$.byId(this.client,$)}replacement($){return new vO(this.client,$)}async createEvent($){let O=Q(await this.client.calendar.createCalendarEvent({body:F6($)}));return L$.fromRecord(this.client,O)}}function F6($){return{title:$.title,time:$.time,description:$.description,location:$.location,attendees:$.attendees,recurrenceLines:$.recurrenceLines,visibility:$.visibility,transparency:$.transparency,reminders:$.reminders,conference:$.conference,macroCall:$.macroCall,outOfOffice:$.outOfOffice,calendarId:$.calendar?.id,emailLinkId:$.emailLink?.id}}class I$ extends A{lookupToken;constructor($,O,j){super($,O,j);this.lookupToken=j?.shareToken}static byId($,O){return new I$($,O)}static from($,O){return new I$($,O.id,O)}async fetch(){if(this.lookupToken)return Q(await this.client.storage.meetingLookup({path:{token:this.lookupToken}}));let $=Q(await this.client.storage.meetingList()).meetings.find((O)=>O.id===this.id);if(!$)throw new w(`Meeting ${this.id} is unavailable`);return this.lookupToken=$.shareToken,$}title=this.field("title");scheduledStart=this.field("scheduledStart");scheduledEnd=this.field("scheduledEnd");channel=this.mappedField("channelId",($)=>$?f.byId(this.client,$):void 0);call=this.mappedField("callId",($)=>$?K$.byId(this.client,$):void 0);async update($){await this.mutate((O)=>O.storage.meetingUpdate({path:{meeting_id:this.id},body:$}))}async cancel(){await this.mutate(($)=>$.storage.meetingCancel({path:{meeting_id:this.id}}))}async invitePermissions(){return Q(await this.client.storage.meetingInvitePermissions({path:{token:(await this.detail.get()).shareToken}}))}async invite($){Q(await this.client.storage.meetingInvite({path:{token:(await this.detail.get()).shareToken},body:{email:$}}))}async inviteUsers($){Q(await this.client.storage.meetingInviteUsers({path:{token:(await this.detail.get()).shareToken},body:{userIds:$.map((O)=>O.id)}}))}async webUrl(){return`${this.client.webAppUrl}/app/meet/join/${encodeURIComponent((await this.detail.get()).shareToken)}`}}class v$ extends A{callId;constructor($,O,j,x){super($,j,x);this.callId=O}get path(){return{parent_type:"call",parent_id:this.callId,id:this.id}}async fetch(){return Q(await this.client.storage.entityMessageGetMessage({path:this.path}))}static byId($,O,j){return new v$($,O,j)}static from($,O,j){return new v$($,O,j.id,j)}content=this.field("content");createdAt=this.field("created_at");updatedAt=this.field("updated_at");call(){return K$.byId(this.client,this.callId)}async author(){return M.byId(this.client,(await this.detail.get()).sender_id)}async reply($){let O=Q(await this.client.storage.entityMessageCreate({path:{parent_type:"call",parent_id:this.callId},body:{...$$($),thread_id:this.callId}}));return v$.from(this.client,this.callId,O)}async edit($){let{content:O,mentions:j}=$$($);return await this.mutate((x)=>x.storage.entityMessageEdit({path:this.path,body:{content:O,mentions:j}})),this}async delete(){await this.mutate(($)=>$.storage.entityMessageDeleteMessage({path:this.path}))}}class K$ extends F${messageThreadById($){return W$.byId(this.client,{type:"call",entity:this},$)}timelinePage($){return E$(this.client,{type:"call",entity:this},(O)=>v$.from(this.client,this.id,O),$)}access=new o(this.client,"call",this);async meeting(){return I$.from(this.client,Q(await this.client.storage.meetingShare({path:{call_id:this.id}})))}async editTranscript($){await this.mutate((O)=>O.storage.editCallTranscript({path:{call_id:this.id},body:{assignments:$}}))}async toggleTeamShare(){return this.mutate(($)=>$.storage.toggleShareWithTeam({path:{call_id:this.id}}))}entityType="call";async fetch(){return Q(await this.client.storage.getCallRecord({path:{call_id:this.id}}))}static byId($,O){return new K$($,O)}message($){return v$.byId(this.client,this.id,$)}name=this.field("customName");channel=this.mappedField("channelId",($)=>$?f.byId(this.client,$):void 0);channelName=this.field("channelName");creator=this.mappedField("createdBy",($)=>M.byId(this.client,$));isActive=this.field("isActive");status=this.field("status");roomName=this.field("roomName");startedAt=this.field("startedAt");endedAt=this.field("endedAt");durationMs=this.field("durationMs");summary=this.field("summary");transcript=this.field("transcript");participants=this.field("participants");guests=this.field("guests");teamShareAccessLevel=this.field("teamShareAccessLevel");shareWithTeam=this.field("shareWithTeam");recordingUrl=this.field("recordingUrl");recordingPreviewUrl=this.field("recordingPreviewUrl");recordingStartedAt=this.field("recordingStartedAt");async rename($){await this.mutate((O)=>O.storage.editCallRecord({path:{call_id:this.id},body:{customName:$??""}}))}async setTeamShare($){await this.mutate((O)=>O.storage.editCallRecord({path:{call_id:this.id},body:{sharePermission:{teamShareAccessLevel:$?"view":null}}}))}async delete(){await this.mutate(($)=>$.storage.deleteCallRecord({path:{call_id:this.id}}))}static search=j$({filters:{call_filters:{}},type:"call",make:($,O)=>new K$($,O.call_id)})}class yx{client;constructor($){this.client=$}byId($){return K$.byId(this.client,$)}search($,O){return K$.search(this.client,$,O)}}class vx{client;constructor($){this.client=$}async list(){let{labels:$}=Q(await this.client.storage.listChannelLabels());return $}async create($,O=[]){return Q(await this.client.storage.createChannelLabel({body:{name:$,channelIds:O.map((j)=>j.id)}}))}async createSmartTag($,O){return Q(await this.client.storage.createChannelLabel({body:{name:$,rule:O}}))}async previewSmartTag($){return Q(await this.client.storage.previewSmartTag({body:$}))}async updateSmartTag($,O,j){return Q(await this.client.storage.renameChannelLabel({path:{label_id:$.id},body:{name:O,rule:j}}))}async rename($,O){return Q(await this.client.storage.renameChannelLabel({path:{label_id:$.id},body:{name:O}}))}async delete($){Q(await this.client.storage.deleteChannelLabel({path:{label_id:$.id}}))}async setLabel($,O){Q(await this.client.storage.setChannelLabel({path:{channel_id:$.id},body:{labelId:O?.id??null}}))}}class hx{client;async activity(){return Q(await this.client.storage.getActivity()).map(($)=>new ZO(this.client,f.byId(this.client,$.channel_id),$))}labels;constructor($){this.client=$;this.labels=new vx($)}byId($){return f.byId(this.client,$)}async dm($){return f.dm(this.client,$)}async private($){return f.private(this.client,$)}async create($){return f.create(this.client,$)}async list(){let{items:$}=Q(await this.client.storage.getChannels());return $.map((O)=>f.byId(this.client,O.id.toString()))}async*search($,O){if(!O?.searchOn||O.searchOn==="name"){let{items:j}=Q(await this.client.storage.getChannels()),x=$.toLowerCase();for(let S of j)if(S.name?.toLowerCase().includes(x))yield f.byId(this.client,S.id.toString())}else yield*f.search(this.client,$,O)}}class n extends S${async sharePermissions(){return Q(await this.client.storage.getProjectPermissionsV2({path:{id:this.id}}))}async accessLevel(){return Q(await this.client.storage.getProjectUserAccessLevel({path:{id:this.id}}))}access=new o(this.client,"project",this);entityType="project";propertyEntityType="PROJECT";async fetch(){let{data:$}=Q(await this.client.storage.getProjectHandler({path:{id:this.id}}));return $.projectMetadata}static byId($,O){return new n($,O)}static async create($,O){let{data:j}=Q(await $.storage.createProjectHandler({body:{name:O.name,projectParentId:O.parent?.id??null}}));return new n($,j.id,j)}name=this.field("name");parent=this.mappedField("parentId",($)=>$?n.byId(this.client,$):void 0);createdAt=this.field("createdAt");async items(){let{data:$}=Q(await this.client.storage.getProjectContentHandler({path:{id:this.id}}));return $.map((O)=>O.item)}async rename($){await this.mutate((O)=>O.storage.editProjectV2({path:{id:this.id},body:{name:$}}))}async delete($){await this.mutate((O)=>$?.permanent?O.storage.permanentlyDeleteProject({path:{id:this.id}}):O.storage.deleteProjectHandler({path:{id:this.id}}))}async restore(){await this.mutate(($)=>$.storage.revertDeleteProject({path:{id:this.id}}))}static search=j$({filters:{project_filters:{}},type:"project",make:($,O)=>new n($,O.id)})}class hO{client;chat;id;message;constructor($,O,j,x){this.client=$;this.chat=O;this.id=j;this.message=x}static byId($,O,j,x){return new hO($,O,j,x)}async stop(){Q(await this.client.cognition.stopChatStream({body:{chat_id:this.chat.id,stream_id:this.id}}))}toJSON(){return{id:this.id,chatId:this.chat.id,messageId:this.message.id}}}class mO extends A{chat;constructor($,O,j){super($,j);this.chat=O}static byId($,O,j){return new mO($,O,j)}async fetch(){let $=Q(await this.client.cognition.getChat({path:{chat_id:this.chat.id}})).chat.messages.find((O)=>O.id===this.id);if(!$)throw new w(`Chat message ${this.id} is not yet available`);return $}content=this.field("content");role=this.field("role");async refresh(){this.detail.clear(),await this.detail.get()}toJSON(){return{...super.toJSON(),chatId:this.chat.id}}}class Z$ extends S${async send($){let{attachments:O,additionalInstructions:j,...x}=$,S=await this.mutate((Z)=>Z.cognition.sendChatMessage({body:{...x,chat_id:this.id,additional_instructions:j,attachments:O?.map((X)=>({entity_id:X.entity.id,entity_type:X.type}))}})),K=Z$.byId(this.client,S.chat_id);return hO.byId(this.client,K,S.stream_id,mO.byId(this.client,K,S.message_id))}access=new o(this.client,"chat",this);entityType="chat";propertyEntityType="CHAT";async fetch(){let{chat:$}=Q(await this.client.cognition.getChat({path:{chat_id:this.id}}));return $}static byId($,O){return new Z$($,O)}static async create($,O){let{id:j}=Q(await $.cognition.createChat({body:{name:O?.name??null,projectId:O?.project?.id??null}}));return new Z$($,j)}name=this.field("name");model=this.field("model");project=this.mappedField("projectId",($)=>$?n.byId(this.client,$):void 0);createdAt=this.field("createdAt");updatedAt=this.field("updatedAt");messages=this.field("messages");async rename($){await this.mutate((O)=>O.cognition.patchChat({path:{chat_id:this.id},body:{name:$}}))}async delete($){await this.mutate((O)=>$?.permanent?O.cognition.permanentlyDeleteChat({path:{chat_id:this.id}}):O.cognition.deleteChat({path:{chat_id:this.id}}))}async copy(){let{id:$}=await this.mutate((O)=>O.cognition.copyChat({path:{chat_id:this.id}}));return new Z$(this.client,$)}async restore(){await this.mutate(($)=>$.cognition.revertDeleteChat({path:{chat_id:this.id}}))}async history(){let{conversation:$}=Q(await this.client.cognition.getChatHistoryHandler({path:{chat_id:this.id}}));return $}webUrl(){return`${this.client.webAppUrl}/app/chat/${this.id}`}static search=j$({filters:{chat_filters:{}},type:"chat",make:($,O)=>new Z$($,O.chat_id)});toMention(){return{tag:l$("m-document-mention",{documentId:this.id,documentName:this.detail.peek()?.name??"",blockName:"chat",blockParams:{}}),mention:{entity_type:"chat",entity_id:this.id}}}}class mx{client;constructor($){this.client=$}byId($){return Z$.byId(this.client,$)}create($){return Z$.create(this.client,$)}search($,O){return Z$.search(this.client,$,O)}}class T$ extends A{async fetch(){let O=Q(await this.client.auth.getUserTeams()).find((j)=>j.id===this.id);if(!O)throw new w(`team ${this.id} not found`);return O}static byId($,O){return new T$($,O)}static async current($){let O=Q(await $.auth.getTeam());if(!O)throw new w("caller has no current team");return new T$($,O.team.id,O.team)}static async list($){return Q(await $.auth.getUserTeams()).map((j)=>new T$($,j.id,j))}name=this.field("name");slug=this.field("slug");defaultLinkShare=this.field("default_link_share");owner=this.mappedField("owner_id",($)=>M.byId(this.client,$));async members(){let $=Q(await this.client.auth.getTeam());if(!$||$.team.id!==this.id)throw new b("members are only available for the current team (see Team.current)");return $.members.map((O)=>({user:M.byId(this.client,O.user_id),role:O.role}))}}var E6=8;class _$ extends A{parent;constructor($,O,j,x){super($,j,x);this.parent=O}get path(){return{parent_type:this.parent.type,parent_id:this.parent.id,id:this.id}}async fetch(){return Q(await this.client.storage.entityMessageGetMessage({path:this.path}))}static byId($,O,j){return new _$($,O,j)}static from($,O,j){return new _$($,O,j.id,j)}text=this.field("content");createdAt=this.field("created_at");updatedAt=this.field("updated_at");deletedAt=this.field("deleted_at");async threadId(){return(await this.detail.get()).thread_id??this.id}async author(){return M.byId(this.client,(await this.detail.get()).sender_id)}async reply($){return cO(this.client,this.parent,$,{threadId:await this.threadId()})}async edit($){let{content:O,mentions:j}=$$($);return await this.mutate((x)=>x.storage.entityMessageEdit({path:this.path,body:{content:O,mentions:j}})),this}async delete(){await this.mutate(($)=>$.storage.entityMessageDeleteMessage({path:this.path}))}}async function Yj($,O){let j={parent_type:O.type,parent_id:O.id},x=a(async(K)=>{let Z=Q(await $.storage.messageTimeline({path:j,query:{selection:JSON.stringify({limit:100,cursor:K})}}));return{items:Z.items,nextCursor:Z.next_cursor}}),S=[];for await(let K of x)S.push(K);return bO(S,E6,async(K)=>{let{state:Z,root:X,replies:G}=Q(await $.storage.entityMessageGetThread({path:{...j,id:K.id}}));return{thread:Z,comments:[X,...G].map((L)=>_$.from($,O,L))}})}async function cO($,O,j,x){let S=Q(await $.storage.entityMessageCreate({path:{parent_type:O.type,parent_id:O.id},body:{...$$(j),thread_id:x?.threadId??null}}));return _$.from($,O,S)}class w$ extends F${messageThreadById($){return W$.byId(this.client,{type:"crm_contact",entity:this},$)}timelinePage($){return E$(this.client,{type:"crm_contact",entity:this},(O)=>_$.from(this.client,{type:"crm_contact",id:this.id},O),$)}entityType="crm_contact";async fetch(){return Q(await this.client.storage.getContact({path:{contact_id:this.id}}))}static byId($,O){return new w$($,O)}static from($,O){return new w$($,O.id,O)}name=this.field("name");email=this.field("email");company=this.mappedField("companyId",($)=>q$.byId(this.client,$));hidden=this.field("hidden");createdAt=this.field("createdAt");updatedAt=this.field("updatedAt");firstInteraction=this.field("firstInteraction");lastInteraction=this.field("lastInteraction");async hide(){await this.setHidden(!0)}async unhide(){await this.setHidden(!1)}async setHidden($){await this.mutate((O)=>O.storage.setContactHidden({path:{contact_id:this.id},body:{hidden:$}}))}async rename($){await this.mutate((O)=>O.storage.setCrmContactName({path:{contact_id:this.id},body:{name:$}}))}get commentParent(){return{type:"crm_contact",id:this.id}}async comments(){return Yj(this.client,this.commentParent)}async comment($,O){return cO(this.client,this.commentParent,$,O)}commentById($){return _$.byId(this.client,this.commentParent,$)}}class q$ extends S${messageThreadById($){return W$.byId(this.client,{type:"crm_company",entity:this},$)}timelinePage($){return E$(this.client,{type:"crm_company",entity:this},(O)=>_$.from(this.client,{type:"crm_company",id:this.id},O),$)}entityType="crm_company";propertyEntityType="COMPANY";async fetch(){return Q(await this.client.storage.getCompany({path:{company_id:this.id}}))}static byId($,O){return new q$($,O)}static from($,O){return new q$($,O.id,O)}name=this.field("name");description=this.field("description");hidden=this.field("hidden");emailSync=this.field("emailSync");team=this.mappedField("teamId",($)=>T$.byId(this.client,$));createdAt=this.field("createdAt");updatedAt=this.field("updatedAt");async domain(){let{domains:$}=await this.detail.get();return $[0]?.domain}async domains(){let{domains:$}=await this.detail.get();return $.map((O)=>O.domain)}async contacts(){return Q(await this.client.storage.listCompanyContacts({path:{company_id:this.id}})).map((O)=>w$.from(this.client,O))}static search=j$({filters:{crm_company_filters:{}},type:"company",includeCrm:!0,make:($,O)=>new q$($,O.id)});async hide(){await this.setHidden(!0)}async unhide(){await this.setHidden(!1)}async setHidden($){await this.mutate((O)=>O.storage.setCompanyHidden({path:{company_id:this.id},body:{hidden:$}}))}async setEmailSync($){await this.mutate((O)=>O.storage.setEmailSync({path:{company_id:this.id},body:{email_sync:$}}))}async rename($){await this.mutate((O)=>O.storage.setCrmCompanyName({path:{company_id:this.id},body:{name:$}}))}async createContact($){let O=await this.mutate((j)=>j.storage.createCrmContact({path:{company_id:this.id},body:$}));return w$.from(this.client,O)}get commentParent(){return{type:"crm_company",id:this.id}}async comments(){return Yj(this.client,this.commentParent)}async comment($,O){return cO(this.client,this.commentParent,$,O)}commentById($){return _$.byId(this.client,this.commentParent,$)}}class a$ extends A{tableDetail=new J$(async()=>Q(await this.client.storage.getCrmPipelineTable({path:{id:this.id}})));static byId($,O){return new a$($,O)}static from($,O){return new a$($,O.id,O)}async fetch(){return Q(await this.client.storage.getCrmPipeline({path:{id:this.id}}))}name=this.field("name");recordType=this.field("recordType");accessLevel=this.field("grant");sharing=this.field("sharing");owner=this.mappedField("userId",($)=>M.byId(this.client,$));team=this.mappedField("teamId",($)=>T$.byId(this.client,$));async rename($){await this.mutate((O)=>O.storage.renameCrmPipeline({path:{id:this.id},body:{name:$}}))}async setSharing($){if($===void 0)throw Error("Sharing is required");await this.mutate((O)=>O.storage.shareCrmPipeline({path:{id:this.id},body:{sharing:$}}))}async setTrashed($){await this.mutate((O)=>O.storage.trashCrmPipeline({path:{id:this.id},body:{trashed:$}}))}async sharePermissions(){return Q(await this.client.storage.getCrmPipelinePermissions({path:{id:this.id}}))}async updateSharePermissions($){return this.mutate((O)=>O.storage.updateCrmPipelinePermissions({path:{id:this.id},body:r$($)}))}async table(){return Qj.from(this.client,this,await this.tableRecord())}tableRecord(){return this.tableDetail.get()}rows(){return a(async($)=>{let O=Q(await this.client.storage.getCrmPipelineRows({path:{id:this.id},query:{after:$}}));return{items:O.rows.map((j)=>XO.from(this.client,this,j)),nextCursor:O.next}})}queryRows($={}){if($.rows?.some((O)=>O.pipeline.id!==this.id))throw Error("Rows belong to another pipeline");return a(async(O)=>{let j=Q(await this.client.storage.queryCrmPipelineRows({path:{id:this.id},body:{after:O,query:$.query,rowIds:$.rows?.map((x)=>x.id)}}));return{items:j.rows.map((x)=>XO.from(this.client,this,x)),nextCursor:j.next}})}async applyOps($,O){if(O?.baseVersions?.some((S)=>S.table.pipeline.id!==this.id))throw Error("Table belongs to another pipeline");let j={ops:$,baseVersions:O?.baseVersions?Object.fromEntries(O.baseVersions.map((S)=>[S.table.id,S.version])):void 0},x=await this.mutate((S)=>S.storage.applyCrmPipelineOps({path:{id:this.id},body:j}));return this.tableDetail.clear(),x}}class Qj extends A{pipeline;toJSON(){return{...super.toJSON(),pipelineId:this.pipeline.id}}constructor($,O,j){super($,j.table.id,j);this.pipeline=O}static from($,O,j){return new Qj($,O,j)}fetch(){return this.pipeline.tableRecord()}async columns(){return(await this.pipeline.tableRecord()).columns.map(($)=>Jj.from(this.client,this,$))}async version(){return(await this.pipeline.tableRecord()).table.version}rowById($){return XO.byId(this.client,this.pipeline,$)}rows(){return this.pipeline.rows()}}class XO extends A{pipeline;toJSON(){return{...super.toJSON(),pipelineId:this.pipeline.id}}constructor($,O,j,x){super($,j,x);this.pipeline=O}static byId($,O,j){return new XO($,O,j)}static from($,O,j){return new XO($,O,j.rowId,j)}async fetch(){for await(let $ of this.pipeline.queryRows({rows:[this]}))if($.id===this.id)return $.detail.get();throw new w(`Pipeline row ${this.id} is unavailable`)}cells=this.field("cells");async refresh(){this.detail.clear(),await this.detail.get()}}class Jj extends A{table;toJSON(){return{...super.toJSON(),pipelineId:this.table.pipeline.id,tableId:this.table.id}}constructor($,O,j){super($,j.column.id,j);this.table=O}static from($,O,j){return new Jj($,O,j)}async fetch(){let $=(await this.table.pipeline.tableRecord()).columns.find((O)=>O.column.id===this.id);if(!$)throw new w(`Pipeline column ${this.id} is unavailable`);return $}async writable(){return(await this.fetch()).writable}async name(){return(await this.fetch()).column.display_name??(await this.fetch()).definition.definition.display_name}}class cx{client;constructor($){this.client=$}byId($){return a$.byId(this.client,$)}async list(){return Q(await this.client.storage.listCrmPipelines()).map(($)=>a$.from(this.client,$))}async create($){return a$.from(this.client,Q(await this.client.storage.createCrmPipeline({body:$})))}}class ux{client;pipelines;constructor($){this.client=$;this.pipelines=new cx($)}companyById($){return q$.byId(this.client,$)}contactById($){return w$.byId(this.client,$)}async contactByEmail($){let{contact:O}=Q(await this.client.storage.getContactByEmail({query:{email:$}}));return O?w$.from(this.client,O):void 0}async searchContacts($,O={}){let{contacts:j}=Q(await this.client.storage.searchContacts({query:{query:$,limit:O.limit}}));return j.map((x)=>w$.from(this.client,x))}async createCompany($){return q$.from(this.client,Q(await this.client.storage.createCrmCompany({body:$})))}async settings(){return Q(await this.client.storage.getCrmTeamSettings())}async updateSettings($){return Q(await this.client.storage.putCrmTeamSettings({body:$}))}async setStages($){return Q(await this.client.storage.putCrmTeamStages({body:$}))}async resetStages(){Q(await this.client.storage.resetCrmTeamStages())}searchCompanies($){return q$.search(this.client,$)}}var G$=Symbol.for("@ts-pattern/matcher"),P1=Symbol.for("@ts-pattern/isVariadic");var dx=($)=>Boolean($&&typeof $=="object"),Vj=($)=>$&&!!$[G$],s=($,O,j)=>{if(Vj($)){let x=$[G$](),{matched:S,selections:K}=x.match(O);return S&&K&&Object.keys(K).forEach((Z)=>j(Z,K[Z])),S}if(dx($)){if(!dx(O))return!1;if(Array.isArray($)){if(!Array.isArray(O))return!1;let x=[],S=[],K=[];for(let Z of $.keys()){let X=$[Z];Vj(X)&&X[P1]?K.push(X):K.length?S.push(X):x.push(X)}if(K.length){if(K.length>1)throw Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(O.length<x.length+S.length)return!1;let Z=O.slice(0,x.length),X=S.length===0?[]:O.slice(-S.length),G=O.slice(x.length,S.length===0?1/0:-S.length);return x.every((L,Y)=>s(L,Z[Y],j))&&S.every((L,Y)=>s(L,X[Y],j))&&(K.length===0||s(K[0],G,j))}return $.length===O.length&&$.every((Z,X)=>s(Z,O[X],j))}return Reflect.ownKeys($).every((x)=>{let S=$[x];return((x in O)||Vj(K=S)&&K[G$]().matcherType==="optional")&&s(S,O[x],j);var K})}return Object.is(O,$)},X$=($)=>{var O,j,x;return dx($)?Vj($)?(O=(j=(x=$[G$]()).getSelectionKeys)==null?void 0:j.call(x))!=null?O:[]:Array.isArray($)?uO($,X$):uO(Object.values($),X$):[]},uO=($,O)=>$.reduce((j,x)=>j.concat(O(x)),[]);function w6(...$){if($.length===1){let[O]=$;return(j)=>s(O,j,()=>{})}if($.length===2){let[O,j]=$;return s(O,j,()=>{})}throw Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${$.length}.`)}function t($){return Object.assign($,{optional:()=>px($),and:(O)=>u($,O),or:(O)=>F1($,O),select:(O)=>O===void 0?dO($):dO(O,$)})}function lx($){return Object.assign(((O)=>Object.assign(O,{[Symbol.iterator](){let j=0,x=[{value:Object.assign(O,{[P1]:!0}),done:!1},{done:!0,value:void 0}];return{next:()=>{var S;return(S=x[j++])!=null?S:x.at(-1)}}}}))($),{optional:()=>lx(px($)),select:(O)=>lx(O===void 0?dO($):dO(O,$))})}function px($){return t({[G$]:()=>({match:(O)=>{let j={},x=(S,K)=>{j[S]=K};return O===void 0?(X$($).forEach((S)=>x(S,void 0)),{matched:!0,selections:j}):{matched:s($,O,x),selections:j}},getSelectionKeys:()=>X$($),matcherType:"optional"})})}var q6=($,O)=>{for(let j of $)if(!O(j))return!1;return!0},f6=($,O)=>{for(let[j,x]of $.entries())if(!O(x,j))return!1;return!0},b6=($,O)=>{let j=Reflect.ownKeys($);for(let x of j)if(!O(x,$[x]))return!1;return!0};function u(...$){return t({[G$]:()=>({match:(O)=>{let j={},x=(S,K)=>{j[S]=K};return{matched:$.every((S)=>s(S,O,x)),selections:j}},getSelectionKeys:()=>uO($,X$),matcherType:"and"})})}function F1(...$){return t({[G$]:()=>({match:(O)=>{let j={},x=(S,K)=>{j[S]=K};return uO($,X$).forEach((S)=>x(S,void 0)),{matched:$.some((S)=>s(S,O,x)),selections:j}},getSelectionKeys:()=>uO($,X$),matcherType:"or"})})}function m($){return{[G$]:()=>({match:(O)=>({matched:Boolean($(O))})})}}function dO(...$){let O=typeof $[0]=="string"?$[0]:void 0,j=$.length===2?$[1]:typeof $[0]=="string"?void 0:$[0];return t({[G$]:()=>({match:(x)=>{let S={[O!=null?O:"@ts-pattern/anonymous-select-key"]:x};return{matched:j===void 0||s(j,x,(K,Z)=>{S[K]=Z}),selections:S}},getSelectionKeys:()=>[O!=null?O:"@ts-pattern/anonymous-select-key"].concat(j===void 0?[]:X$(j))})})}function E1($){return!0}function f$($){return typeof $=="number"}function i$($){return typeof $=="string"}function n$($){return typeof $=="bigint"}var w1=t(m(E1)),k6=t(m(E1)),g6=w1,s$=($)=>Object.assign(t($),{startsWith:(O)=>{return s$(u($,(j=O,m((x)=>i$(x)&&x.startsWith(j)))));var j},endsWith:(O)=>{return s$(u($,(j=O,m((x)=>i$(x)&&x.endsWith(j)))));var j},minLength:(O)=>s$(u($,((j)=>m((x)=>i$(x)&&x.length>=j))(O))),length:(O)=>s$(u($,((j)=>m((x)=>i$(x)&&x.length===j))(O))),maxLength:(O)=>s$(u($,((j)=>m((x)=>i$(x)&&x.length<=j))(O))),includes:(O)=>{return s$(u($,(j=O,m((x)=>i$(x)&&x.includes(j)))));var j},regex:(O)=>{return s$(u($,(j=O,m((x)=>i$(x)&&Boolean(x.match(j))))));var j}}),A1=s$(m(i$)),b$=($)=>Object.assign(t($),{between:(O,j)=>b$(u($,((x,S)=>m((K)=>f$(K)&&x<=K&&S>=K))(O,j))),lt:(O)=>b$(u($,((j)=>m((x)=>f$(x)&&x<j))(O))),gt:(O)=>b$(u($,((j)=>m((x)=>f$(x)&&x>j))(O))),lte:(O)=>b$(u($,((j)=>m((x)=>f$(x)&&x<=j))(O))),gte:(O)=>b$(u($,((j)=>m((x)=>f$(x)&&x>=j))(O))),int:()=>b$(u($,m((O)=>f$(O)&&Number.isInteger(O)))),finite:()=>b$(u($,m((O)=>f$(O)&&Number.isFinite(O)))),positive:()=>b$(u($,m((O)=>f$(O)&&O>0))),negative:()=>b$(u($,m((O)=>f$(O)&&O<0)))}),y6=b$(m(f$)),t$=($)=>Object.assign(t($),{between:(O,j)=>t$(u($,((x,S)=>m((K)=>n$(K)&&x<=K&&S>=K))(O,j))),lt:(O)=>t$(u($,((j)=>m((x)=>n$(x)&&x<j))(O))),gt:(O)=>t$(u($,((j)=>m((x)=>n$(x)&&x>j))(O))),lte:(O)=>t$(u($,((j)=>m((x)=>n$(x)&&x<=j))(O))),gte:(O)=>t$(u($,((j)=>m((x)=>n$(x)&&x>=j))(O))),positive:()=>t$(u($,m((O)=>n$(O)&&O>0))),negative:()=>t$(u($,m((O)=>n$(O)&&O<0)))}),v6=t$(m(n$)),h6=t(m(function($){return typeof $=="boolean"})),m6=t(m(function($){return typeof $=="symbol"})),c6=t(m(function($){return $==null})),u6=t(m(function($){return $!=null})),x$={__proto__:null,matcher:G$,optional:px,array:function(...$){return lx({[G$]:()=>({match:(O)=>{if(!Array.isArray(O))return{matched:!1};if($.length===0)return{matched:!0};let j=$[0],x={};if(O.length===0)return X$(j).forEach((K)=>{x[K]=[]}),{matched:!0,selections:x};let S=(K,Z)=>{x[K]=(x[K]||[]).concat([Z])};return{matched:O.every((K)=>s(j,K,S)),selections:x}},getSelectionKeys:()=>$.length===0?[]:X$($[0])})})},set:function(...$){return t({[G$]:()=>({match:(O)=>{if(!(O instanceof Set))return{matched:!1};let j={};if(O.size===0)return{matched:!0,selections:j};if($.length===0)return{matched:!0};let x=(K,Z)=>{j[K]=(j[K]||[]).concat([Z])},S=$[0];return{matched:q6(O,(K)=>s(S,K,x)),selections:j}},getSelectionKeys:()=>$.length===0?[]:X$($[0])})})},map:function(...$){return t({[G$]:()=>({match:(O)=>{if(!(O instanceof Map))return{matched:!1};let j={};if(O.size===0)return{matched:!0,selections:j};let x=(X,G)=>{j[X]=(j[X]||[]).concat([G])};if($.length===0)return{matched:!0};var S;if($.length===1)throw Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(S=$[0])==null?void 0:S.toString()}`);let[K,Z]=$;return{matched:f6(O,(X,G)=>{let L=s(K,G,x),Y=s(Z,X,x);return L&&Y}),selections:j}},getSelectionKeys:()=>$.length===0?[]:[...X$($[0]),...X$($[1])]})})},record:function(...$){return t({[G$]:()=>({match:(O)=>{if(O===null||typeof O!="object"||Array.isArray(O))return{matched:!1};var j;if($.length===0)throw Error(`\`P.record\` wasn't given enough arguments. Expected (value) or (key, value), received ${(j=$[0])==null?void 0:j.toString()}`);let x={},S=(X,G)=>{x[X]=(x[X]||[]).concat([G])},[K,Z]=$.length===1?[A1,$[0]]:$;return{matched:b6(O,(X,G)=>{let L=typeof X!="string"||Number.isNaN(Number(X))?null:Number(X),Y=L!==null&&s(K,L,S),J=s(K,X,S),T=s(Z,G,S);return(J||Y)&&T}),selections:x}},getSelectionKeys:()=>$.length===0?[]:[...X$($[0]),...X$($[1])]})})},intersection:u,union:F1,not:function($){return t({[G$]:()=>({match:(O)=>({matched:!s($,O,()=>{})}),getSelectionKeys:()=>[],matcherType:"not"})})},when:m,select:dO,any:w1,unknown:k6,_:g6,string:A1,number:y6,bigint:v6,boolean:h6,symbol:m6,nullish:c6,nonNullable:u6,instanceOf:function($){return t(m(function(O){return(j)=>j instanceof O}($)))},shape:function($){return t(m(w6($)))}};class q1 extends Error{constructor($){let O;try{O=JSON.stringify($)}catch(j){O=$}super(`Pattern matching error: no pattern matches value ${O}`),this.input=void 0,this.input=$}}var rx={matched:!1,value:void 0};function c($){return new Wj($,rx)}class Wj{constructor($,O){this.input=void 0,this.state=void 0,this.input=$,this.state=O}with(...$){if(this.state.matched)return this;let O=$[$.length-1],j=[$[0]],x;$.length===3&&typeof $[1]=="function"?x=$[1]:$.length>2&&j.push(...$.slice(1,$.length-1));let S=!1,K={},Z=(G,L)=>{S=!0,K[G]=L},X=!j.some((G)=>s(G,this.input,Z))||x&&!Boolean(x(this.input))?rx:{matched:!0,value:O(S?"@ts-pattern/anonymous-select-key"in K?K["@ts-pattern/anonymous-select-key"]:K:this.input,this.input)};return new Wj(this.input,X)}when($,O){if(this.state.matched)return this;let j=Boolean($(this.input));return new Wj(this.input,j?{matched:!0,value:O(this.input,this.input)}:rx)}otherwise($){return this.state.matched?this.state.value:$(this.input)}exhaustive($=d6){return this.state.matched?this.state.value:$(this.input)}run(){return this.exhaustive()}returnType(){return this}narrow(){return this}}function d6($){throw new q1($)}var ax,l6=new Uint8Array(16);function Bj(){if(!ax){if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ax=crypto.getRandomValues.bind(crypto)}return ax(l6)}var O$=[];for(let $=0;$<256;++$)O$.push(($+256).toString(16).slice(1));function f1($,O=0){return(O$[$[O+0]]+O$[$[O+1]]+O$[$[O+2]]+O$[$[O+3]]+"-"+O$[$[O+4]]+O$[$[O+5]]+"-"+O$[$[O+6]]+O$[$[O+7]]+"-"+O$[$[O+8]]+O$[$[O+9]]+"-"+O$[$[O+10]]+O$[$[O+11]]+O$[$[O+12]]+O$[$[O+13]]+O$[$[O+14]]+O$[$[O+15]]).toLowerCase()}var ix={};function r6($,O,j){let x;if($)x=b1($.random??$.rng?.()??Bj(),$.msecs,$.seq,O,j);else{let S=Date.now(),K=Bj();p6(ix,S,K),x=b1(K,ix.msecs,ix.seq,O,j)}return O??f1(x)}function p6($,O,j){if($.msecs??=-1/0,$.seq??=0,O>$.msecs)$.seq=j[6]<<23|j[7]<<16|j[8]<<8|j[9],$.msecs=O;else if($.seq=$.seq+1|0,$.seq===0)$.msecs++;return $}function b1($,O,j,x,S=0){if($.length<16)throw Error("Random bytes length must be >= 16");if(!x)x=new Uint8Array(16),S=0;else if(S<0||S+16>x.length)throw RangeError(`UUID byte range ${S}:${S+15} is out of buffer bounds`);return O??=Date.now(),j??=$[6]*127<<24|$[7]<<16|$[8]<<8|$[9],x[S++]=O/1099511627776&255,x[S++]=O/4294967296&255,x[S++]=O/16777216&255,x[S++]=O/65536&255,x[S++]=O/256&255,x[S++]=O&255,x[S++]=112|j>>>28&15,x[S++]=j>>>20&255,x[S++]=128|j>>>14&63,x[S++]=j>>>6&255,x[S++]=j<<2&255|$[10]&3,x[S++]=$[11],x[S++]=$[12],x[S++]=$[13],x[S++]=$[14],x[S++]=$[15],x}var h$=r6;class M${table;id;constructor($,O){this.table=$;this.id=O}static byId($,O){return new M$($,O)}async detail(){let{columns:$}=await this.table.detail(),O=$.find((j)=>j.column.id===this.id);if(!O)throw new w(`column ${this.id} is not on table ${this.table.id}`);return O}async name(){let $=await this.detail();return $.column.display_name??$.definition.definition.display_name}async rename($){return await this.table.database.renameColumn(this,$),this}async inferType($){return await this.table.database.inferColumnType(this,$),this}changeType($){return this.table.database.changeColumnType(this,$)}convertIntoNewColumn($){return this.table.database.convertColumnIntoNewColumn(this,$)}casts(){return this.table.database.columnCasts(this)}async delete(){await this.table.database.deleteColumn(this)}async dataType(){return(await this.detail()).definition.definition.data_type}async isMultiSelect(){return(await this.detail()).definition.definition.is_multi_select}async position(){return(await this.detail()).column.position}async definition(){return(await this.detail()).definition}async config(){return(await this.detail()).column.config??void 0}async addOptions($){return await this.table.database.addColumnOptions(this,$),this}toJSON(){return{id:this.id,tableId:this.table.id}}}class A${table;id;constructor($,O){this.table=$;this.id=O}static byId($,O){return new A$($,O)}history(){return this.table.database.rowHistory(this)}toJSON(){return{id:this.id,tableId:this.table.id}}}class Lj{table;id;constructor($,O){this.table=$;this.id=O}static byId($,O){return new Lj($,O)}async detail(){let{views:$}=await this.table.detail(),O=$.find((j)=>j.id===this.id);if(!O)throw new w(`view ${this.id} is not on table ${this.table.id}`);return O}async name(){return(await this.detail()).name}async position(){return(await this.detail()).position}async layout(){return(await this.detail()).layout}async query(){return(await this.detail()).query}positions(){return this.table.database.viewPositions(this)}toJSON(){return{id:this.id,tableId:this.table.id}}}class Y${database;id;constructor($,O){this.database=$;this.id=O}static byId($,O){return new Y$($,O)}async detail(){let{tables:$}=await this.database.schema(),O=$.find((j)=>j.table.id===this.id);if(!O)throw new w(`table ${this.id} is not in database ${this.database.id}`);return O}async name(){return(await this.detail()).table.name}async rename($){return await this.database.renameTable(this,$),this}async version(){return(await this.detail()).table.version}async position(){return(await this.detail()).table.position}async columns(){let{columns:$}=await this.detail();return $.map((O)=>M$.byId(this,O.column.id))}addColumn($){return this.database.addColumn(this,$)}async reorderColumns($){return await this.database.reorderColumns(this,$),this}row($){return A$.byId(this,$)}async views(){let{views:$}=await this.detail();return $.map((O)=>Lj.byId(this,O.id))}createWebhook(){return this.database.createWebhook(this)}async delete(){await this.database.deleteTable(this)}toJSON(){return{id:this.id,databaseId:this.database.id}}}async function Nj($,O,j,x={}){let S=Q(await $.storage.queryDatabases({body:{sql:j,databaseId:x.database?.id,baseVersions:Object.fromEntries((x.baseVersions??[]).map(({table:Y,version:J})=>[Y.id,J]))}})),K=new Map;for(let Y of[x.database,...(x.baseVersions??[]).map(({table:J})=>J.database)]){if(!Y)continue;let J=K.get(Y.id);if(J)J.add(Y);else K.set(Y.id,new Set([Y]))}let Z=(Y)=>{let J=K.get(Y)?.values().next().value;if(J)return J;let T=O($,Y);return K.set(Y,new Set([T])),T},X=(Y)=>{let J=S.tableDatabases[Y];if(!J)throw Error(`SQL response is missing the owner of table ${Y}`);return Y$.byId(Z(J),Y)},G=new Set(Object.keys(S.newVersions).map((Y)=>X(Y).database.id));if(S.statement.kind==="schema")G.add(S.statement.databaseId);for(let Y of G)for(let J of K.get(Y)??[])J.invalidateSchema();let L=c(S.statement).with({kind:"select"},(Y)=>Y).with({kind:"schema"},({databaseId:Y,summary:J})=>({kind:"schema",database:Z(Y),summary:J})).with({kind:"insert"},{kind:"update"},{kind:"delete"},({kind:Y,tableId:J,tableName:T})=>({kind:Y,table:X(J),tableName:T})).with({kind:"alterColumnType"},({tableId:Y,tableName:J,columnId:T,columnName:z,to:W})=>{let V=X(Y);return{kind:"alterColumnType",table:V,tableName:J,column:M$.byId(V,T),columnName:z,to:W}}).exhaustive();return{result:S.result?a6(S.result,X,S.tableDatabases):void 0,changesApplied:S.changesApplied,insertedRows:L.kind==="insert"?S.insertedRowIds.map((Y)=>A$.byId(L.table,Y)):[],newVersions:Object.entries(S.newVersions).map(([Y,J])=>({table:X(Y),version:J})),readVersions:Object.entries(S.readVersions).map(([Y,J])=>({table:X(Y),version:J})),truncatedTables:S.truncatedTables,statement:L}}function a6($,O,j){let x=$.sourceTable&&j[$.sourceTable]?O($.sourceTable):void 0;return{columns:$.columns.map(({relatedTable:S,...K})=>({...K,relatedTable:S&&j[S]?O(S):void 0})),rows:$.rows,sourceTable:x,rowHandles:x?$.rowIds.map((S)=>A$.byId(x,S)):[]}}class Uj{table;id;createdBy;record;constructor($,O,j,x){this.table=$;this.id=O;this.createdBy=j;this.record=x}static fromRecord($,O,j){return new Uj($,j.id,O,j)}get tokenPrefix(){return this.record.tokenPrefix}get createdAt(){return this.record.createdAt}delete(){return this.table.database.deleteWebhook(this)}toJSON(){return{id:this.id,tableId:this.table.id,tokenPrefix:this.tokenPrefix}}}class tx extends SO{op;row;column;taken;constructor($,O){super($,O);this.name="MacroOpRefusedError",this.message=O.message,this.op=O.op,this.row=O.row,this.column=O.column,this.taken=O.taken}}function zj($){return c($).with({type:"relation"},({table:O})=>({type:"relation",database:O.database.id,table:O.id})).with({type:x$.not("relation")},(O)=>O).exhaustive()}var i6={USER:"People",DOCUMENT:"Documents",TASK:"Tasks",COMPANY:"Companies",CONTACT:"Contacts",CALL_RECORD:"Calls",CHANNEL:"Channels",CHAT:"Chats",PROJECT:"Projects",THREAD:"Emails",CALENDAR_EVENT:"Events",INITIATIVE:"Initiatives"};function n6($){return c($).with({type:"text"},()=>"Text").with({type:"number"},()=>"Number").with({type:"boolean"},()=>"Checkbox").with({type:"date"},()=>"Date").with({type:"link"},()=>"URL").with({type:"select",multi:!0},()=>"Multi-select").with({type:"select",multi:!1},()=>"Select").with({type:"select_number",multi:!0},()=>"Multi-number select").with({type:"select_number",multi:!1},()=>"Number select").with({type:"tag"},()=>"Tag").with({type:"entity"},({target:O})=>i6[O]).with({type:"relation"},()=>"Relation").exhaustive(()=>"Column")}function nx($){return $.map((O)=>({id:h$(),label:O}))}function k1($,O,j){return $?.kind===O&&"change"in $&&$.change.kind===j}function sx($){return c($).with({kind:"reorder_tables"},({kind:O})=>O).with({kind:x$.union("table","column","rows","view")},({kind:O,change:j})=>`${O}.${j.kind}`).exhaustive(()=>"unknown")}function m$($,O,j){let[x]=$;if($.length!==1||!k1(x,O,j))throw new b(`expected one ${O}.${j} result, got ${$.map(sx).join(", ")||"none"}`);return x}class Q$ extends A{access=new o(this.client,"database",this);async fetch(){return Q(await this.client.storage.getDatabase({path:{id:this.id}}))}assertOwns($,O){if(O.id!==this.id)throw new b(`${$} does not belong to database ${this.id}`)}static byId($,O){return new Q$($,O)}static async create($,O){let j=Q(await $.storage.createDatabase({body:{name:O.name}}));return new Q$($,j.id)}static async list($){return Q(await $.storage.listDatabases()).map((j)=>new Q$($,j.database.id))}query($,O){return Nj(this.client,Q$.byId,$,{...O,database:this})}invalidateSchema(){this.detail.clear()}schema(){return this.detail.get()}name=this.mappedField("database",($)=>$.name);owner=this.mappedField("database",($)=>M.byId(this.client,$.owner_id));createdAt=this.mappedField("database",($)=>$.created_at);trashedAt=this.mappedField("database",($)=>$.trashed_at??void 0);grant=this.field("grant");tables=this.mappedField("tables",($)=>$.map((O)=>Y$.byId(this,O.table.id)));async table($){let{tables:O}=await this.schema(),j=O.find((x)=>x.table.name===$);return j?Y$.byId(this,j.table.id):void 0}async createTable($){let{table:O}=m$(await this.applyOps([{kind:"table",table:h$(),change:{kind:"create",name:$.name}}]),"table","created");return Y$.byId(this,O)}async applyOps($,O={}){let j={ops:$};if(O.baseVersions!==void 0){for(let{table:S}of O.baseVersions)this.assertOwns(`table ${S.id}`,S.database);j.baseVersions=Object.fromEntries(O.baseVersions.map(({table:S,version:K})=>[S.id,K]))}let{results:x}=await this.mutate(async(S)=>{let K=await S.storage.applyDatabaseOps({path:{id:this.id},body:j});if(K.error!==void 0&&"op"in K.error)throw new tx(K.response?.status??0,K.error);return K});return x}async reorderTables($){for(let x of $)this.assertOwns(`table ${x.id}`,x.database);let O=await this.applyOps([{kind:"reorder_tables",order:$.map((x)=>x.id)}]),[j]=O;if(O.length!==1||j?.kind!=="reorder_tables")throw new b(`expected one reorder_tables result, got ${O.map(sx).join(", ")||"none"}`);return j.tables.map(({table:x})=>Y$.byId(this,x))}async deleteTable($){this.assertOwns(`table ${$.id}`,$.database),m$(await this.applyOps([{kind:"table",table:$.id,change:{kind:"delete"}}]),"table","deleted")}async columnCasts($){return this.assertOwns(`column ${$.id}`,$.table.database),Q(await this.client.storage.listDatabaseColumnCasts({path:{id:this.id,table_id:$.table.id,column_id:$.id}}))}async viewPositions($){this.assertOwns(`view ${$.id}`,$.table.database);let{positions:O}=Q(await this.client.storage.getDatabaseViewPositions({path:{id:this.id,view_id:$.id}}));return O}async rowHistory($){this.assertOwns(`row ${$.id}`,$.table.database);let{changes:O}=Q(await this.client.storage.getDatabaseRowHistory({path:{id:this.id,table_id:$.table.id,row_id:$.id}}));return O}async importTable($){let O=await this.mutate((j)=>j.storage.importDatabaseTable({path:{id:this.id},body:$}));return Y$.byId(this,O.id)}webhookOf($){return Uj.fromRecord(Y$.byId(this,$.tableId),M.byId(this.client,$.createdBy),$)}async webhooks(){let{webhooks:$}=Q(await this.client.storage.listDatabaseWebhooks({path:{id:this.id}}));return $.map((O)=>this.webhookOf(O))}async createWebhook($){this.assertOwns("table",$.database);let O=Q(await this.client.storage.createDatabaseWebhook({path:{id:this.id},body:{tableId:$.id}}));return{webhook:this.webhookOf(O.webhook),token:O.token}}async deleteWebhook($){this.assertOwns("webhook",$.table.database),Q(await this.client.storage.deleteDatabaseWebhook({path:{id:this.id,webhook_id:$.id}}))}async sharePermissions(){return Q(await this.client.storage.getDatabasePermissions({path:{id:this.id}}))}updateSharePermissions($){return this.mutate((O)=>O.storage.updateDatabasePermissions({path:{id:this.id},body:$}))}async changeColumnType($,O){this.assertOwns(`column ${$.id}`,$.table.database);let j=await $.table.version();return m$(await this.applyOps([{kind:"column",table:$.table.id,column:$.id,change:{kind:"change_type",to:zj(O.to)}}],{baseVersions:[{table:$.table,version:j}]}),"column","type_changed")}async columnConversion($,O){return this.assertOwns(`column ${$.id}`,$.table.database),Q(await this.client.storage.convertDatabaseColumn({path:{id:this.id,table_id:$.table.id,column_id:$.id},body:{to:zj(O)}}))}async convertColumnIntoNewColumn($,O){let j=await this.columnConversion($,O.to),x=O.name??`${await $.name()} (${n6(O.to)})`,S=h$(),K=[{kind:"column",table:$.table.id,column:S,change:{kind:"create",definition:{source:"new",name:x,type:zj(O.to),options:nx(j.options)},after:$.id}}];if(j.cells.length>0)K.push({kind:"rows",table:$.table.id,change:{kind:"update",changes:{kind:"per_row",rows:j.cells.map(({row:X,value:G})=>({row:X,cells:[{column:S,value:G}]}))}}});let[Z]=await this.applyOps(K,{baseVersions:[{table:$.table,version:j.tableVersion}]});if(!k1(Z,"column","created"))throw new b(`expected a column.created result, got ${Z?sx(Z):"none"}`);return M$.byId($.table,Z.column)}async deleteColumn($){this.assertOwns(`column ${$.id}`,$.table.database);let O=await $.table.version(),{tableVersion:j}=m$(await this.applyOps([{kind:"column",table:$.table.id,column:$.id,change:{kind:"delete"}}],{baseVersions:[{table:$.table,version:O}]}),"column","deleted");return j}async reorderColumns($,O){this.assertOwns(`table ${$.id}`,$.database);for(let S of O)if(S.table.id!==$.id)throw new b(`column ${S.id} does not belong to table ${$.id}`);let j=await $.version(),{tableVersion:x}=m$(await this.applyOps([{kind:"table",table:$.id,change:{kind:"reorder_columns",order:O.map((S)=>S.id)}}],{baseVersions:[{table:$,version:j}]}),"table","columns_reordered");if(x===void 0)throw new b(`table ${$.id} reordered its columns without a version`);return x}async renameTable($,O){this.assertOwns(`table ${$.id}`,$.database);let j=await $.name(),{tableVersion:x}=m$(await this.applyOps([{kind:"table",table:$.id,change:{kind:"rename",name:O,previousName:j}}]),"table","renamed");if(x===void 0)throw new b(`table ${$.id} was renamed without a version`);return x}async renameColumn($,O){this.assertOwns(`column ${$.id}`,$.table.database);let j=await $.name(),{tableVersion:x}=m$(await this.applyOps([{kind:"column",table:$.table.id,column:$.id,change:{kind:"rename",name:O,previousName:j}}]),"column","renamed");return x}async inferColumnType($,O){return this.assertOwns(`column ${$.id}`,$.table.database),this.mutate((j)=>j.storage.inferDatabaseColumnType({path:{id:this.id,table_id:$.table.id,column_id:$.id},body:{dataType:O.dataType,baseVersion:O.baseVersion,...O.specificEntityType!==void 0?{specificEntityType:O.specificEntityType}:{}}}))}async addColumn($,O){if(this.assertOwns(`table ${$.id}`,$.database),O.after!==void 0&&O.after.table.id!==$.id)throw new b(`column ${O.after.id} does not belong to table ${$.id}`);let j="property"in O?{source:"existing",property:O.property.id}:{source:"new",name:O.name,type:zj(O.type),...O.options!==void 0?{options:nx(O.options)}:{},...O.inferType!==void 0?{inferType:O.inferType}:{}},{column:x}=m$(await this.applyOps([{kind:"column",table:$.id,column:h$(),change:{kind:"create",definition:j,...O.after!==void 0?{after:O.after.id}:{}}}]),"column","created");return M$.byId($,x)}async addColumnOptions($,O){return this.assertOwns(`column ${$.id}`,$.table.database),m$(await this.applyOps([{kind:"column",table:$.table.id,column:$.id,change:{kind:"add_options",options:nx(O)}}]),"column","options_added")}}class ex{client;constructor($){this.client=$}query($,O){return Nj(this.client,Q$.byId,$,O)}byId($){return Q$.byId(this.client,$)}create($){return Q$.create(this.client,$)}list(){return Q$.list(this.client)}}class GO extends A{document;toJSON(){return{...super.toJSON(),documentId:this.document.id}}constructor($,O,j,x){super($,j,x);this.document=O}static byId($,O,j){return new GO($,O,j)}static from($,O,j){return new GO($,O,j.uuid,j)}async fetch(){let $=Q(await this.client.storage.getDocumentAnchors({path:{document_id:this.document.id}})).data.find((O)=>O.uuid===this.id);if(!$)throw new w(`Annotation ${this.id} is unavailable`);return $}kind=this.field("anchorType");page=this.field("page");async edit($){if(await this.kind()!=="placeable")throw Error("Only placeable comment annotations can be edited");await this.mutate((O)=>O.storage.editAnchor({body:{...$,uuid:this.id,anchorType:"free-comment",fileType:"pdf"}}))}async delete(){if(await this.kind()!=="highlight")throw Error("Only standalone highlights can be deleted with this endpoint");await this.mutate(($)=>$.storage.deleteAnchor({body:{uuid:this.id,anchorType:"highlight",fileType:"pdf"}}))}}class c$ extends A{documentId;constructor($,O,j,x){super($,j,x);this.documentId=O}get path(){return{parent_type:"document",parent_id:this.documentId,id:this.id}}async fetch(){return Q(await this.client.storage.entityMessageGetMessage({path:this.path}))}static byId($,O,j){return new c$($,O,j)}static from($,O,j){return new c$($,O,j.id,j)}text=this.field("content");createdAt=this.field("created_at");updatedAt=this.field("updated_at");async threadId(){return(await this.detail.get()).thread_id??this.id}document(){return q.byId(this.client,this.documentId)}async author(){return M.byId(this.client,(await this.detail.get()).sender_id)}async reply($){return this.document().comment($,{threadId:await this.threadId()})}async edit($){let{content:O,mentions:j}=$$($);return await this.mutate((x)=>x.storage.entityMessageEdit({path:this.path,body:{content:O,mentions:j}})),this}async delete(){await this.mutate(($)=>$.storage.entityMessageDeleteMessage({path:this.path}))}}class lO{client;document;id;detail;constructor($,O,j){this.client=$;this.document=O;this.id=j;this.detail=new J$(async()=>Q(await this.client.storage.getDocumentVersion({path:{document_id:O.id,document_version_id:j}})).data)}static byId($,O,j){return new lO($,O,j)}read(){return this.detail.get()}toJSON(){return{id:this.id,documentId:this.document.id}}}var s6=8;class q extends S${async anchors(){return Q(await this.client.storage.getDocumentAnchors({path:{document_id:this.id}})).data.map(($)=>GO.from(this.client,this,$))}async createHighlight($){return GO.from(this.client,this,Q(await this.client.storage.createAnchor({path:{document_id:this.id},body:{...$,fileType:"pdf",anchorType:"highlight"}})))}version($){return lO.byId(this.client,this,$)}async sharePermissions(){return Q(await this.client.storage.getDocumentPermissionsV2({path:{document_id:this.id}})).documentPermissions}async permissionsToken(){return Q(await this.client.storage.getDocumentPermissionsToken({path:{document_id:this.id}})).token}async prepareSave($){return Q(await this.client.storage.presaveDocumentHandler({path:{document_id:this.id},body:{newBom:$}})).data}async save($){return(await this.mutate((O)=>O.storage.saveDocumentHandler({path:{document_id:this.id},body:$}))).data}async simpleSave(){return(await this.mutate(($)=>$.storage.simpleSave({path:{document_id:this.id}}))).data}messageThreadById($){return W$.byId(this.client,{type:"document",entity:this},$)}timelinePage($){return E$(this.client,{type:"document",entity:this},(O)=>c$.from(this.client,this.id,O),$)}access=new o(this.client,"document",this);async fetch(){let{data:$}=Q(await this.client.storage.getDocument({path:{document_id:this.id}}));return $.documentMetadata}static byId($,O){return new q($,O)}static async create($,O){let{documentId:j}=Q(await $.storage.createMarkdownHandler({body:{documentName:O.name,markdown:O.markdown??null,projectId:O.project?.id??null}}));return new q($,j)}static async createSnippet($,O){let{documentId:j}=Q(await $.storage.createSnippetHandler({body:{snippetName:O.name,markdown:O.markdown??null,projectId:O.project?.id??null}}));return new q($,j)}static async createSkill($,O){let{documentId:j}=Q(await $.storage.createSkillHandler({body:{skillName:O.name,markdown:O.markdown??null,projectId:O.project?.id??null}}));return new q($,j)}static recent($,O){let j=O?.pageSize??50;return a(async(x)=>{let S=Q(await $.storage.getUserDocumentsHandler({query:{limit:j,offset:x?Number(x):0,...O?.fileType!==void 0?{file_type:O.fileType}:{}}})),K=S.data?.next_offset;return{items:(S.data?.documents??[]).map((Z)=>new q($,Z.documentId)),nextCursor:K!=null?String(K):null}})}static async recentlyDeleted($){let{data:O}=Q(await $.storage.recentlyDeleted({}));return O.items.filter((j)=>j.type==="document").map((j)=>new q($,j.id))}entityType="document";propertyEntityType="DOCUMENT";name=this.field("documentName");fileType=this.field("fileType");project=this.mappedField("projectId",($)=>$?n.byId(this.client,$):void 0);owner=this.mappedField("owner",($)=>M.byId(this.client,$));branchedFrom=this.mappedField("branchedFromId",($)=>$?q.byId(this.client,$):void 0);createdAt=this.field("createdAt");updatedAt=this.field("updatedAt");deletedAt=this.field("deletedAt");async content(){let{text:$}=Q(await this.client.storage.getDocumentTextContent({path:{document_id:this.id}}));if($!==null)return $;let{presigned_url:O}=Q(await this.client.storage.exportDocument({path:{document_id:this.id}})),j=await fetch(O);if(!j.ok)throw new SO(j.status,{message:"failed to download document content"});return j.text()}async rename($){await this.mutate((O)=>O.storage.editDocument({path:{document_id:this.id},body:{documentName:$}}))}async move($){await this.mutate((O)=>O.storage.editDocument({path:{document_id:this.id},body:{projectId:$?.id??""}}))}async delete($){await this.mutate((O)=>$?.permanent?O.storage.permanentlyDeleteDocument({path:{document_id:this.id}}):O.storage.deleteDocument({path:{document_id:this.id}}))}async restore(){await this.mutate(($)=>$.storage.revertDeleteDocument({path:{document_id:this.id}}))}async copy($){let{data:O}=Q(await this.client.storage.copyDocument({path:{document_id:this.id},query:$.versionId!==void 0?{version_id:$.versionId}:void 0,body:{documentName:$.name}}));return new q(this.client,O.documentMetadata.documentId)}async comments(){let $={parent_type:"document",parent_id:this.id},O=a(async(x)=>{let S=Q(await this.client.storage.messageTimeline({path:$,query:{selection:JSON.stringify({limit:100,cursor:x})}}));return{items:S.items,nextCursor:S.next_cursor}}),j=[];for await(let x of O)j.push(x);return bO(j,s6,async(x)=>{let{state:S,root:K,replies:Z}=Q(await this.client.storage.entityMessageGetThread({path:{...$,id:x.id}}));return{thread:S,comments:[K,...Z].map((X)=>c$.from(this.client,this.id,X))}})}async comment($,O){let j=await this.mutate((x)=>x.storage.entityMessageCreate({path:{parent_type:"document",parent_id:this.id},body:{...$$($),thread_id:O?.threadId??null}}));return c$.from(this.client,this.id,j)}async shortId(){return Q(await this.client.storage.getDocumentShortId({path:{document_id:this.id}}))}async teamShare(){return Q(await this.client.storage.getDocumentTeamShare({path:{document_id:this.id}}))}async setTeamShare($){await this.mutate((O)=>O.storage.setDocumentTeamShare({path:{document_id:this.id},body:{shareWithTeam:$}}))}async githubPullRequests(){let{pullRequests:$}=Q(await this.client.storage.getDocumentGithubPullRequests({path:{document_id:this.id}}));return $}async branchName(){let{branchName:$}=Q(await this.client.storage.getDocumentBranchName({path:{document_id:this.id}}));return $}webUrl(){return`${this.client.webAppUrl}/app/md/${this.id}`}static search=j$({filters:{document_filters:{}},type:"document",make:($,O)=>new q($,O.document_id)});toMention(){let $=this.detail.peek();return{tag:l$("m-document-mention",{documentId:this.id,documentName:$?.documentName??"",blockName:$?.fileType??"md"}),mention:{entity_type:"document",entity_id:this.id}}}}class Ij{id;name;constructor($,O){this.id=$;this.name=O}static async list($){let{skills:O}=Q(await $.storage.getSystemSkillsHandler());return O.map((j)=>new Ij(j.id,j.name))}}class ox{client;async byTeamSlug($){let O=Q(await this.client.storage.getDocumentByTeamSlug({path:{slug:$}}));if(typeof O!=="object"||O===null||!("data"in O)||typeof O.data!=="object"||O.data===null||!("documentMetadata"in O.data)||typeof O.data.documentMetadata!=="object"||O.data.documentMetadata===null||!("documentId"in O.data.documentMetadata)||typeof O.data.documentMetadata.documentId!=="string")throw Error("Invalid team task document response");return q.byId(this.client,O.data.documentMetadata.documentId)}async validatePermissionsToken($){let O=Q(await this.client.storage.validateDocumentPermissionsToken({body:{token:$}}));return{document:q.byId(this.client,O.document_id),user:O.user_id?M.byId(this.client,O.user_id):void 0,accessLevel:O.access_level,expiresAt:O.exp,issuer:O.iss}}async createUpload($){let O={documentName:$.name,sha:$.sha,fileType:$.fileType,mimeType:$.mimeType,projectId:$.project?.id,teamId:$.team?.id,branchedFromId:$.branchedFrom?.id,emailAttachmentId:$.attachment?.id,isTask:$.isTask},j=Q(await this.client.storage.createDocument({body:O})).data;return{document:q.byId(this.client,j.documentMetadata.documentId),uploadUrl:j.presignedUrl??void 0,contentType:j.contentType,content:j.documentMetadata.content}}constructor($){this.client=$}byId($){return q.byId(this.client,$)}create($){return q.create(this.client,$)}createSnippet($){return q.createSnippet(this.client,$)}createSkill($){return q.createSkill(this.client,$)}systemSkills(){return Ij.list(this.client)}search($,O){return q.search(this.client,$,O)}recent($){return q.recent(this.client,$)}recentlyDeleted(){return q.recentlyDeleted(this.client)}}class KO extends A{async fetch(){let{attachment:$}=Q(await this.client.email.getAttachment({path:{id:this.id}}));return $}static byId($,O){return new KO($,O)}static from($,O){return new KO($,O.db_id,O)}filename=this.field("filename");mimeType=this.field("mime_type");size=this.field("size_bytes");dataUrl=this.field("data_url");sfsId=this.field("sfs_id");contentId=this.field("content_id");async toDocument(){let{document_id:$}=Q(await this.client.email.getAttachmentDocumentId({path:{id:this.id}}));return q.byId(this.client,$)}}class H$ extends S${access=new o(this.client,"email_thread",this);async followup(){return Q(await this.client.storage.getEmailFollowup({path:{thread_id:this.id}}))}async setFollowup($){return Q(await this.client.storage.setEmailFollowup({path:{thread_id:this.id},body:$}))}async calendarInvitations(){return Q(await this.client.email.getThreadCalendarInvitations({path:{thread_id:this.id}}))}async update($){await this.mutate((O)=>O.storage.editThreadV2({path:{thread_id:this.id},body:{projectId:$.project===void 0?void 0:$.project?.id??null,sharePermission:$.sharePermission?r$($.sharePermission):void 0}}))}entityType="email_thread";propertyEntityType="THREAD";async fetch(){let{thread:$}=Q(await this.client.email.getThread({path:{thread_id:this.id},query:{limit:100}}));return $}static byId($,O){return new H$($,O)}createdAt=this.field("created_at");updatedAt=this.field("updated_at");isRead=this.field("is_read");inboxVisible=this.field("inbox_visible");accessLevel=this.field("access_level");providerId=this.field("provider_id");link=this.mappedField("link_id",($)=>z$.byId(this.client,$));project=this.mappedField("project_id",($)=>$?n.byId(this.client,$):void 0);latestInboundAt=this.field("latest_inbound_message_ts");latestOutboundAt=this.field("latest_outbound_message_ts");latestNonSpamAt=this.field("latest_non_spam_message_ts");async subject(){let{messages:$}=await this.detail.get();for(let O of $)if(O.subject)return O.subject;return}async participants(){let{messages:$}=await this.detail.get(),O=new Map;for(let j of $)for(let x of[j.from,...j.to,...j.cc,...j.bcc])if(x&&!O.has(x.email))O.set(x.email,x);return[...O.values()]}async messages($){return Q(await this.client.email.getThreadMessagesHandler({path:{id:this.id},query:{...$?.since?{since:$.since}:{},...$?.limit?{limit:$.limit}:{}}})).map((j)=>R$.from(this.client,j))}async attachments(){let{messages:$}=await this.detail.get();return $.flatMap((O)=>O.attachments.map((j)=>KO.from(this.client,j)))}async reply($){let O=$.subject??await this.subject()??"",{message:j}=await this.mutate((x)=>x.email.sendMessage({body:{message:{thread_db_id:this.id,replying_to_id:$.replyingTo?.id??null,to:$.to,cc:$.cc??null,bcc:$.bcc??null,subject:O,body_text:$.bodyText}}}));return j.db_id?R$.byId(this.client,j.db_id):void 0}async archive($=!0){await this.mutate((O)=>O.email.archiveThread({path:{id:this.id},body:{value:$}}))}async updateState($){await this.mutate((O)=>O.email.updateThreadState({path:{id:this.id},body:$}))}async operations(){return Q(await this.client.email.threadOperations({path:{id:this.id}}))}async markSeen(){await this.mutate(($)=>$.email.threadSeen({path:{id:this.id}}))}async addLabel($){await this.mutate((O)=>O.email.addRemoveThreadLabel({path:{id:this.id},body:{label_id:$.id,value:!0}}))}async removeLabel($){await this.mutate((O)=>O.email.addRemoveThreadLabel({path:{id:this.id},body:{label_id:$.id,value:!1}}))}async moveToProject($){await this.mutate((O)=>O.email.updateThreadProject({path:{thread_id:this.id},body:{projectId:$?.id??null}}))}static search=j$({filters:{email_filters:{}},type:"email",make:($,O)=>new H$($,O.thread_id)})}class R$ extends A{async fetch(){return Q(await this.client.email.getMessage({path:{id:this.id}}))}static byId($,O){return new R$($,O)}static from($,O){return new R$($,O.db_id,O)}static async send($,O){let{message:j}=Q(await $.email.sendMessage({body:{message:{to:O.to,cc:O.cc??null,bcc:O.bcc??null,subject:O.subject,body_text:O.bodyText}}}));return j.db_id?R$.byId($,j.db_id):void 0}subject=this.field("subject");from=this.field("from");to=this.field("to");cc=this.field("cc");bcc=this.field("bcc");body=this.field("body_parsed");sentAt=this.field("internal_date_ts");labels=this.field("labels");link=this.mappedField("link_id",($)=>z$.byId(this.client,$));async operationStatus(){return Q(await this.client.email.messageOperationStatus({path:{id:this.id}}))}async resolveOperation($){await this.mutate((O)=>O.email.resolveMessageOperation({path:{id:this.id},body:$}))}async completeDraftAttachment($){let O=await this.link();await this.mutate((j)=>j.email.completeDraftAttachment({path:{id:this.id,attachment_id:$},headers:{"X-Email-Link-Id":O.id}}))}async transferDraft($){let O=await this.link();return this.mutate((j)=>j.email.transferDraft({path:{id:this.id},body:$,headers:{"X-Email-Link-Id":O.id}}))}async addLabel($){await this.mutate((O)=>O.email.addRemoveLabel({body:{label_id:$.id,message_ids:[this.id],value:!0}}))}async removeLabel($){await this.mutate((O)=>O.email.addRemoveLabel({body:{label_id:$.id,message_ids:[this.id],value:!1}}))}async thread(){return H$.byId(this.client,(await this.detail.get()).thread_db_id)}}class YO extends R${async inboxHeaders(){return{"X-Email-Link-Id":(await this.link()).id}}static byId($,O){return new YO($,O)}async update($){let O=await this.inboxHeaders();await this.mutate((j)=>j.email.createDraft({headers:O,body:{draft:{...$0($),db_id:this.id}}}))}async delete(){let $=await this.inboxHeaders();await this.mutate((O)=>O.email.deleteDraft({path:{id:this.id},headers:$}))}async schedule($,O){let j=await this.inboxHeaders();await this.mutate((x)=>x.email.upsertScheduledMessage({path:{id:this.id},headers:j,body:{send_time:$,include_signature:O?.includeSignature}}))}async unschedule(){let $=await this.inboxHeaders();await this.mutate((O)=>O.email.deleteScheduledDraft({path:{message_id:this.id},headers:$}))}async addAttachment($){let O={file_name:$.fileName,sha:$.sha,size:$.size,upload_id:$.uploadId},j=await this.inboxHeaders(),x=await this.mutate((S)=>S.email.addDraftAttachment({path:{id:this.id},headers:j,body:O}));return{attachment:rO.byId(this.client,this,x.attachment_id),uploadUrl:x.upload_url,contentType:x.content_type}}async forwardAttachment($){let O=await this.inboxHeaders(),j=await this.mutate((x)=>x.email.addForwardedAttachment({path:{id:this.id},headers:O,body:{attachment_id:$.id}}));return rO.byId(this.client,this,j.attachment_id,!0)}async removeAttachment($){if($.draft.id!==this.id)throw Error("Attachment belongs to another draft");let O=await this.inboxHeaders();if($.forwarded)await this.mutate((j)=>j.email.removeForwardedAttachment({path:{id:this.id,attachment_id:$.id},headers:O}));else await this.mutate((j)=>j.email.removeDraftAttachment({path:{id:this.id,attachment_id:$.id},headers:O}))}async verifyAttachment($){if($.draft.id!==this.id||$.forwarded)throw Error("Expected an uploaded attachment on this draft");await this.completeDraftAttachment($.id)}}class rO{draft;id;forwarded;constructor($,O,j){this.draft=$;this.id=O;this.forwarded=j}static byId($,O,j,x=!1){return new rO(O,j,x)}complete(){return this.draft.verifyAttachment(this)}remove(){return this.draft.removeAttachment(this)}toJSON(){return{id:this.id,draftId:this.draft.id,forwarded:this.forwarded}}}function $0($){let{bodyText:O,bodyHtml:j,bodyMacro:x,headers:S,includeSignature:K,thread:Z,replyingTo:X,...G}=$;return{...G,body_text:O,body_html:j===void 0?void 0:btoa(Array.from(new TextEncoder().encode(j),(L)=>String.fromCharCode(L)).join("")).replaceAll("+","-").replaceAll("/","_").replaceAll("=",""),body_macro:x,headers_json:S,include_signature:K,thread_db_id:Z?.id,replying_to_id:X?.id}}class QO extends A{inbox;constructor($,O,j,x){super($,O,j);this.inbox=x}get headers(){return this.inbox?{"X-Email-Link-Id":this.inbox.id}:void 0}static byId($,O,j){return new QO($,O,void 0,j)}static from($,O,j){return new QO($,O.id,O,j)}async fetch(){let $=Q(await this.client.email.listEmailFilters({headers:this.headers})).filters.find((O)=>O.id===this.id);if(!$)throw new w(`Email filter ${this.id} is unavailable`);return $}emailAddress=this.field("email_address");emailDomain=this.field("email_domain");isImportant=this.field("is_important");async setImportant($){let O=await this.detail.get();await this.mutate((j)=>j.email.upsertEmailFilter({headers:this.headers,body:{email_address:O.email_address,email_domain:O.email_domain,is_important:$}}))}async delete(){await this.mutate(($)=>$.email.deleteEmailFilter({path:{id:this.id},headers:this.headers}))}}class e$ extends A{async fetch(){let{labels:$}=Q(await this.client.email.listLabels()),O=$.find((j)=>j.id===this.id);if(!O)throw new w(`label ${this.id} not found`);return O}static byId($,O){return new e$($,O)}static async list($){let{labels:O}=Q(await $.email.listLabels());return O.map((j)=>new e$($,j.id,j))}static async create($,O){let{label:j}=Q(await $.email.createLabel({body:{label_name:O}}));if(!j.id)throw new b("created label has no id");return new e$($,j.id)}async delete(){Q(await this.client.email.deleteLabel({path:{id:this.id}}))}name=this.field("name");linkId=this.field("linkId");type=this.field("type");createdAt=this.field("createdAt");labelListVisibility=this.field("labelListVisibility");messageListVisibility=this.field("messageListVisibility")}class O0{client;async createDraft($,O){let j=Q(await this.client.email.createDraft({body:{draft:$0($)},headers:O?{"X-Email-Link-Id":O.id}:void 0}));if(!j.draft.db_id)throw Error("Draft response has no message id");return YO.byId(this.client,j.draft.db_id)}draftById($){return YO.byId(this.client,$)}async*scheduled($){let O=$?.pageSize??100;if(!Number.isInteger(O)||O<1)throw Error("pageSize must be positive");let j=Math.min(O,1000);for(let x=0;;x+=j){let S=Q(await this.client.email.getScheduledMessages({query:{offset:x,limit:j},headers:$?.inbox?{"X-Email-Link-Id":$.inbox.id}:void 0}));for(let K of S.messages)yield YO.byId(this.client,K.db_id);if(S.messages.length<j)return}}async filters($){return Q(await this.client.email.listEmailFilters({headers:$?{"X-Email-Link-Id":$.id}:void 0})).filters.map((O)=>QO.from(this.client,O,$))}async upsertFilter($,O){return QO.from(this.client,Q(await this.client.email.upsertEmailFilter({headers:O?{"X-Email-Link-Id":O.id}:void 0,body:{email_address:$.emailAddress,email_domain:$.emailDomain,is_important:$.isImportant}})).filter,O)}async contacts(){return Q(await this.client.email.listContacts()).contacts}reminders($){let{inboxes:O,...j}=$??{};return a(async(x)=>{let S=Q(await this.client.storage.listEmailReminders({query:{...j,inboxIds:O?.map((K)=>K.id),cursor:x}}));return{items:S.items.map(({threadId:K,...Z})=>({...Z,thread:H$.byId(this.client,K)})),nextCursor:S.nextCursor}})}constructor($){this.client=$}byId($){return H$.byId(this.client,$)}message($){return R$.byId(this.client,$)}attachment($){return KO.byId(this.client,$)}link($){return z$.byId(this.client,$)}links(){return z$.list(this.client)}async connectionProviders(){return Q(await this.client.auth.emailConnectionProviders())}async recoverDraftTransfer($){return Q(await this.client.email.recoverDraftTransfer({path:{id:$}}))}send($){return R$.send(this.client,$)}search($,O){return H$.search(this.client,$,O)}inbox($){return a(async(O)=>{let j=Q(await this.client.email.previewsInboxCursor({path:{view:"inbox"},query:{...$?.pageSize?{limit:$.pageSize}:{},...$?.sort?{sort_method:$.sort}:{},...O?{cursor:O}:{}}}));return{items:j.items.map((x)=>H$.byId(this.client,x.id)),nextCursor:j.next_cursor}})}label($){return e$.byId(this.client,$)}labels(){return e$.list(this.client)}createLabel($){return e$.create(this.client,$)}async deleteLabel($){Q(await this.client.email.deleteLabel({path:{id:$.id}}))}async blockSender($){Q(await this.client.email.blockSender({body:{email_address:$}}))}async unblockSender($){Q(await this.client.email.unblockSender({body:{email_address:$}}))}async blockedSenders(){return Q(await this.client.email.listBlockedSenders()).blocked_emails}}class BO{client;id;constructor($,O){this.client=$;this.id=O}static byId($,O){return new BO($,O)}async delete(){Q(await this.client.storage.deleteEntityMention({path:{mention_id:this.id}}))}toJSON(){return{id:this.id}}}class j0{client;constructor($){this.client=$}byId($){return BO.byId(this.client,$)}async create($,O){let j=Q(await this.client.storage.createEntityMention({body:{source_entity_id:$.entity.id,source_entity_type:$.type,entity_id:O.entity.id,entity_type:O.type}}));return BO.byId(this.client,j.id)}}class x0{client;constructor($){this.client=$}async list($={}){let{favorites:O}=Q(await this.client.storage.listFavorites({query:{entityType:$.entityTypes,entityId:$.entityIds}}));return O}async add($){return Q(await this.client.storage.addFavorite({body:{entityId:$.id,entityType:$.entityType}}))}async remove($){Q(await this.client.storage.removeFavoriteByEntity({path:{entity_type:$.entityType,entity_id:$.id}}))}async reorder($){Q(await this.client.storage.reorderFavorites({body:{favorites:$}}))}}class o$ extends F${entityType="foreign_entity";async fetch(){return Q(await this.client.storage.getForeignEntity({path:{id:this.id}}))}static byId($,O){return new o$($,O)}static fromRecord($,O){return new o$($,O.id,O)}foreignEntityId=this.field("foreignEntityId");source=this.field("foreignEntitySource");storedForId=this.field("storedForId");storedForAuthEntity=this.field("storedForAuthEntity");createdAt=this.field("createdAt");updatedAt=this.field("updatedAt");async metadata(){return(await this.detail.get()).metadata}}function g1({login:$,...O}){return{...O,login:$??void 0}}class S0{client;constructor($){this.client=$}byId($){return o$.byId(this.client,$)}async bySource($,O){return o$.fromRecord(this.client,Q(await this.client.storage.getForeignEntityBySource({path:{source:$,foreign_entity_id:O}})))}async githubPullRequestFacets(){let{repositories:$,authors:O,assignees:j,labels:x}=Q(await this.client.storage.getGithubPullRequestFacets());return{repositories:$,authors:O.map(g1),assignees:j.map(g1),labels:x.map(({color:S,...K})=>({...K,color:S??void 0}))}}}class u${form;id;constructor($,O){this.form=$;this.id=O}static byId($,O){return new u$($,O)}async detail(){let O=(await this.form.schema()).sections.flatMap((j)=>j.kind==="questions"?j.questions:[]).find((j)=>j.id===this.id);if(!O)throw new w(`question ${this.id} is not on form ${this.form.id}`);return O}async title(){return(await this.detail()).title}async column(){return M$.byId(await this.form.table(),(await this.detail()).column)}async options(){return(await this.detail()).options.map(($)=>JO.byId(this,$.id))}}class JO{question;id;constructor($,O){this.question=$;this.id=O}static byId($,O){return new JO($,O)}async detail(){let $=(await this.question.detail()).options.find((O)=>O.id===this.id);if(!$)throw new w(`option ${this.id} is not on question ${this.question.id}`);return $}async label(){return(await this.detail()).label}async color(){return(await this.detail()).color??void 0}}class LO{form;id;detail;constructor($,O,j){this.form=$;this.id=O;this.detail=new J$(()=>this.load(),j)}async load(){let $=await this.form.myResponse();if($.response.id!==this.id)throw new w(`response ${this.id} is not your current response`);return $}static byId($,O,j){return new LO($,O,j)}async status(){return(await this.detail.get()).status}async row(){return(await this.detail.get()).row}async answers(){return(await this.detail.get()).answers}async booking(){return(await this.detail.get()).booking}async refresh(){let $=await this.load();return this.detail=new J$(()=>this.load(),$),this}}class d${form;id;constructor($,O){this.form=$;this.id=O}static byId($,O){return new d$($,O)}async detail(){let $=(await this.form.schema()).sections.find((O)=>O.id===this.id);if(!$)throw new w(`section ${this.id} is not on form ${this.form.id}`);return $}async title(){return(await this.detail()).title}async questions(){let $=await this.detail();return $.kind==="questions"?$.questions.map((O)=>u$.byId(this.form,O.id)):[]}}class Tj{entityType;id;constructor($,O){this.entityType=$;this.id=O}static byId($,O){return new Tj($,O)}}class k$ extends A{async fetch(){return Q(await this.client.storage.getForm({path:{id:this.id}}))}static byId($,O){return new k$($,O)}static async create($,O){let j=Q(await $.storage.createForm({body:{name:O.name,source:O.table?{kind:"table",databaseId:O.table.database.id,tableId:O.table.id}:{kind:"new"}}}));return new k$($,j.form.id,j)}static async list($,O){if(!O)return Q(await $.storage.listAccessibleForms()).map(({form:S})=>new k$($,S.id));return Q(await $.storage.listForms({query:{databaseId:O.id}})).map((x)=>new k$($,x.id))}schema(){return this.detail.get()}name=this.mappedField("form",($)=>$.name);description=this.mappedField("form",($)=>$.description);owner=this.mappedField("form",($)=>M.byId(this.client,$.ownerId));database=this.mappedField("form",($)=>Q$.byId(this.client,$.databaseId));table=this.mappedField("form",($)=>Y$.byId(Q$.byId(this.client,$.databaseId),$.tableId));audience=this.mappedField("form",($)=>$.audience);status=this.mappedField("form",($)=>$.status);closesAt=this.mappedField("form",($)=>$.closesAt??void 0);access=this.field("access");async sections(){return(await this.detail.get()).sections.map(($)=>d$.byId(this,$.id))}async questions(){return(await this.detail.get()).sections.flatMap(($)=>$.kind==="questions"?$.questions.map((O)=>u$.byId(this,O.id)):[])}async update($){return await this.mutate((O)=>O.storage.updateForm({path:{id:this.id},body:$})),this}assertOwns($){if($.form.id!==this.id)throw new b(`question or section does not belong to form ${this.id}`)}async replaceLayout($){let O=await this.table(),j=(Z)=>{if(Z.table.id!==O.id||Z.table.database.id!==O.database.id)throw new b(`column does not belong to form ${this.id}'s table`);return Z.id},x=(Z)=>({conjunction:Z.conjunction,conditions:Z.conditions.map((X)=>c(X).with({kind:"group"},(G)=>({kind:"group",...x(G)})).with({kind:"condition"},(G)=>({kind:"condition",column:j(G.column),test:c(G.test).with({kind:"options"},(L)=>({...L,options:L.options.map((Y)=>Y.id)})).with({kind:"entities"},(L)=>({...L,entities:L.entities.map((Y)=>Y.id)})).with({kind:x$.union("presence","text","number","date","checkbox")},(L)=>L).exhaustive()})).exhaustive())}),S={sections:$.map((Z)=>{if(Z.section)this.assertOwns(Z.section);let X={id:Z.section?.id??h$(),title:Z.title,description:Z.description??""};return c(Z).with({kind:"booking"},(G)=>({...X,kind:"booking",target:G.target})).with({kind:"gate"},(G)=>({...X,kind:"gate",rules:x(G.rules),message:G.message})).with({kind:"questions"},(G)=>({...X,kind:"questions",questions:G.questions.map((L)=>{if(L.question)this.assertOwns(L.question);return{id:L.question?.id??h$(),column:j(L.column),helpText:L.helpText??"",required:L.required??!1,widget:L.widget??null}})})).exhaustive()})},K=await this.mutate((Z)=>Z.storage.putFormLayout({path:{id:this.id},body:S}));return{form:this,publicationError:K.publicationError}}wireAnswers($){return $.map(({question:O,value:j})=>{this.assertOwns(O);let x=c(j).with({type:"rows"},(S)=>({type:"rows",value:S.value.map((K)=>K.id)})).with({type:"options"},(S)=>({type:"options",value:S.value.map((K)=>{if(K.question.id!==O.id||K.question.form.id!==this.id)throw new b("option does not belong to the answered question");return{id:K.id}})})).with({type:"entities"},(S)=>({type:"entities",value:S.value.map(({entityType:K,entity:Z})=>({entityType:K,entityId:Z.id}))})).with({type:x$.union("text","number","boolean","date","link","clear")},(S)=>S).exhaustive();return{question:O.id,value:x}})}unlockedBooking($){return $?{...$,section:d$.byId(this,$.section)}:void 0}async outcome($,O){return c($).with({outcome:"stopped"},(j)=>({...j,section:d$.byId(this,j.section)})).with({outcome:"submitted"},async(j)=>{let x=A$.byId(await this.table(),j.row),S=this.unlockedBooking(j.booking);return{outcome:"submitted",response:LO.byId(this,j.response,{status:"submitted",row:x,answers:O,booking:S}),row:x,...S?{booking:S}:{}}}).exhaustive()}async submit($){let O={answers:this.wireAnswers($)};return this.outcome(Q(await this.client.storage.submitFormResponse({path:{id:this.id},body:O})),$)}async editResponse($){let O={answers:this.wireAnswers($)};return this.outcome(Q(await this.client.storage.editMyFormResponse({path:{id:this.id},body:O})),$)}async myResponse(){let $=Q(await this.client.storage.getMyFormResponse({path:{id:this.id}})),O=await this.table(),j=await Promise.all($.answers.map(async(K)=>{let Z=u$.byId(this,K.question),X=await c(K.value).with({type:"options"},(G)=>({type:"options",value:G.value.map((L)=>{if(!("id"in L))throw new b("stored form answers must reference options by id");return JO.byId(Z,L.id)})})).with({type:"entities"},(G)=>({type:"entities",value:G.value.map((L)=>({entityType:L.entityType,entity:Tj.byId(L.entityType,L.entityId)}))})).with({type:"rows"},async(G)=>{let L=await Z.detail();if(L.kind.type!=="relation")throw new b("row answer requires a relation question");let Y=Y$.byId(Q$.byId(this.client,L.kind.database),L.kind.table);return{type:"rows",value:G.value.map((J)=>A$.byId(Y,J))}}).with({type:x$.union("text","number","boolean","date","link","clear")},(G)=>G).exhaustive(()=>{throw new b(`answer to question ${Z.id} has a type this SDK doesn't know`)});return{question:Z,value:X}})),x=$.response.row?A$.byId(O,$.response.row):void 0,S=this.unlockedBooking($.booking);return{...S?{booking:S}:{},response:LO.byId(this,$.response.id,{status:$.response.status,row:x,answers:j,booking:S}),status:$.response.status,stoppedAtSection:$.response.stoppedAtSection?d$.byId(this,$.response.stoppedAtSection):void 0,row:x,submittedAt:$.response.submittedAt,updatedAt:$.response.updatedAt,answers:j}}async responseSummary(){let $=Q(await this.client.storage.getFormResponseSummary({path:{id:this.id}}));return{...$,stoppedBySection:$.stoppedBySection.map((O)=>({section:d$.byId(this,O.section),count:O.count}))}}async tally(){return Q(await this.client.storage.getFormTally({path:{id:this.id}})).questions.map((O)=>{let j=u$.byId(this,O.question);return{question:j,responses:O.responses,buckets:O.buckets.flatMap((x)=>c(x.value).with({kind:"option"},(S)=>[{count:x.count,value:{kind:"option",option:JO.byId(j,S.option)}}]).with({kind:"checkbox"},(S)=>[{count:x.count,value:S}]).exhaustive((S)=>{return console.warn("macro sdk: unknown form tally bucket",S),[]}))}})}async sharePermissions(){return Q(await this.client.storage.getFormPermissions({path:{id:this.id}}))}updateSharePermissions($){return this.mutate((O)=>O.storage.updateFormPermissions({path:{id:this.id},body:$}))}webUrl(){return`${this.client.webAppUrl}/app/form/${this.id}`}respondUrl(){return`${this.client.webAppUrl}/app/form/${this.id}/respond`}}class Z0{client;constructor($){this.client=$}byId($){return k$.byId(this.client,$)}create($){return k$.create(this.client,$)}list($){return k$.list(this.client,$)}}class NO extends A{static byId($,O){return new NO($,O)}async fetch(){return Q(await this.client.storage.getGithubPullRequest({path:{id:this.id}}))}title=this.field("title");url=this.field("url");status=this.field("status");async changes(){let $=Q(await this.client.storage.getGithubPullRequestChanges({path:{id:this.id}}));return{changeset:$.changeset?new X0(this.client,this,$.changeset):void 0,error:$.error??void 0}}}class X0{client;pullRequest;record;constructor($,O,j){this.client=$;this.pullRequest=O;this.record=j}get id(){return this.record.id}async patch(){return Q(await this.client.storage.getGithubPullRequestChangesPatch({path:{id:this.pullRequest.id},query:{changeset:this.id}})).patch}toJSON(){return{pullRequestId:this.pullRequest.id,...this.record}}}class G0{client;constructor($){this.client=$}byId($){return NO.byId(this.client,$)}forEntity($){return NO.byId(this.client,$.id)}}class UO extends A{static byId($,O){return new UO($,O)}async fetch(){return Q(await this.client.storage.getHarnessPairing({path:{code:this.id}}))}name=this.field("requested_name");expiresAt=this.field("expires_at");async approve($){let O={name:$?.name,team_id:$?.team?.id,allow_permission_bypass:$?.allowPermissionBypass};return V$.from(this.client,await this.mutate((j)=>j.storage.approveHarnessPairing({path:{code:this.id},body:O})))}}class pO{client;id;constructor($,O){this.client=$;this.id=O}static byId($,O){return new pO($,O)}async claim($){let O=Q(await this.client.storage.claimHarnessPairing({path:{pairing_id:this.id},body:{device_secret:$}}));return"harness"in O?{harness:V$.from(this.client,O.harness),token:O.token}:void 0}toJSON(){return{id:this.id}}}class K0{client;constructor($){this.client=$}byId($){return V$.byId(this.client,$)}async list(){return Q(await this.client.storage.listHarnesses()).map(($)=>V$.from(this.client,$))}async me(){return V$.from(this.client,Q(await this.client.storage.getSelfHarness()))}async deleteSelf(){Q(await this.client.storage.deleteSelfHarness())}async agents(){return Q(await this.client.storage.listHarnessAgents()).map(($)=>U$.byId(this.client,$.bot_id))}async sessions(){return Q(await this.client.storage.listHarnessSessions()).map(($)=>i.byId(this.client,$.session_id))}pairing($){return UO.byId(this.client,$)}async createPairing($){let O=Q(await this.client.storage.createHarnessPairing({body:$}));return{pairing:UO.byId(this.client,O.code),device:pO.byId(this.client,O.pairing_id),deviceSecret:O.device_secret,expiresAt:O.expires_at,pollIntervalSeconds:O.poll_interval_seconds}}}var t6="00000001-0000-0000-0000-000000000002",e6="00000001-0000-0000-0002-000000000004";function o6($){let O=$.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/pull\/([1-9][0-9]*)\/?(?:[?#].*)?$/i);if(!O)throw Error(`Expected a GitHub pull request URL like https://github.com/owner/repo/pull/1, got ${$}`);return`${O[1]}/${O[2]}/pull/${O[3]}`}class D$ extends q{static byId($,O){return new D$($,O)}static async create($,O){let{documentId:j}=Q(await $.storage.createTaskHandler({body:{taskName:O.name,markdown:O.markdown??null,projectId:O.project?.id??null,teamId:O.team?.id??null,shareWithTeam:O.shareWithTeam??!0}}));return new D$($,j)}static async forPullRequest($,O){let j=o6(O),{pullRequests:x}=Q(await $.storage.getGithubPullRequestTasks({body:{githubKeys:[j]}}));return(x[0]?.taskIds??[]).map((S)=>new D$($,S))}async completed(){let{subType:$}=await this.detail.get();if($!=="task")return;let j=(await this.properties()).find((x)=>x.definition.id===t6)?.value;return j?.type==="SelectOption"&&j.value.includes(e6)}webUrl(){return`${this.client.webAppUrl}/app/task/${this.id}`}static search=j$({filters:{document_filters:{sub_types:["task"],task_filters:{}}},type:"document",make:($,O)=>new D$($,O.document_id)})}class $O extends A{access=new o(this.client,"initiative",this);static byId($,O){return new $O($,O)}static from($,O){return new $O($,O.id,O)}async fetch(){return Q(await this.client.storage.getInitiative({path:{initiative_id:this.id}}))}name=this.field("name");owner=this.mappedField("ownerId",($)=>M.byId(this.client,$));members=this.mappedField("memberIds",($)=>$.map((O)=>M.byId(this.client,O)));tasks=this.mappedField("taskIds",($)=>$.map((O)=>D$.byId(this.client,O)));accessLevel=this.field("userAccessLevel");sharePermissions=this.field("sharePermission");async update($){await this.mutate((O)=>O.storage.updateInitiative({path:{initiative_id:this.id},body:{name:$.name,memberIds:$.members?.map((j)=>j.id),sharePermission:$.sharePermission?r$($.sharePermission):void 0}}))}async delete(){await this.mutate(($)=>$.storage.deleteInitiative({path:{initiative_id:this.id}}))}}class Y0{client;constructor($){this.client=$}byId($){return $O.byId(this.client,$)}async list(){return Q(await this.client.storage.listInitiatives()).initiatives.map(($)=>$O.byId(this.client,$.id))}async create($){return $O.from(this.client,Q(await this.client.storage.createInitiative({body:{name:$.name,description:$.description,memberIds:$.members?.map((O)=>O.id),shareWithTeam:$.shareWithTeam,propertyValues:$.propertyValues}})))}}class Q0{client;constructor($){this.client=$}byId($){return I$.byId(this.client,$)}async create($){return I$.from(this.client,Q(await this.client.storage.meetingCreate({body:$})))}async list(){return Q(await this.client.storage.meetingList()).meetings.map(($)=>I$.from(this.client,$))}async active(){return Q(await this.client.storage.meetingListActive()).meetings.map(($)=>I$.from(this.client,$))}async lookup($){return I$.from(this.client,Q(await this.client.storage.meetingLookup({path:{token:$}})))}}class VO extends A{async fetch(){return Q(await this.client.notification.getTypedNotificationById({path:{notification_id:this.id}}))}static byId($,O){return new VO($,O)}static from($,O){return new VO($,O.id,O)}static list($,O){return a(async(j)=>{let x=Q(await $.notification.listTypedNotifications({query:{...O?.pageSize?{limit:O.pageSize}:{},...O?.states!==void 0?{states:O.states.join(",")}:{},...j?{cursor:j}:{}}}));return{items:x.items.map((S)=>VO.from($,S)),nextCursor:x.next_cursor}})}type=this.field("notification_event_type");createdAt=this.field("created_at");updatedAt=this.field("updated_at");state=this.field("state");done=this.mappedField("state",($)=>$==="done");sent=this.field("sent");viewedAt=this.field("viewed_at");deletedAt=this.field("deleted_at");owner=this.mappedField("owner_id",($)=>M.byId(this.client,$));sender=this.mappedField("sender_id",($)=>$?M.byId(this.client,$):void 0);metadata=this.field("notification_metadata");async seen(){return await this.state()!=="unseen"}async markSeen(){await this.mutate(($)=>$.notification.bulkMarkNotificationsSeen({body:{notificationIds:[this.id]}}))}async markDone(){await this.mutate(($)=>$.notification.bulkMarkNotificationsDone({body:{notificationIds:[this.id]}}))}async markUndone(){await this.mutate(($)=>$.notification.bulkMarkNotificationsUndone({body:{notificationIds:[this.id]}}))}async delete(){await this.mutate(($)=>$.notification.deleteUserNotificationV2({path:{notification_id:this.id}}))}}class J0{client;constructor($){this.client=$}byId($){return VO.byId(this.client,$)}list($){return VO.list(this.client,$)}async markSeen($){Q(await this.client.notification.bulkMarkNotificationsSeen({body:{notificationIds:$}}))}async markDone($){Q(await this.client.notification.bulkMarkNotificationsDone({body:{notificationIds:$}}))}async delete($){Q(await this.client.notification.bulkDeleteUserNotificationsV2({body:{notificationIds:$}}))}async preferences(){return Q(await this.client.notification.getNotificationTypePreferences())}async enableType($){Q(await this.client.notification.enableNotificationType({path:{notification_event_type:$}}))}async disableType($){Q(await this.client.notification.disableNotificationType({path:{notification_event_type:$}}))}}class V0{client;constructor($){this.client=$}async list(){let{data:$}=Q(await this.client.storage.getPinsHandler({}));return $?.recent??[]}async add($,O){Q(await this.client.storage.addPinHandler({path:{pinned_item_id:$.id},body:{pinType:$.entityType,pinIndex:O.index}}))}async remove($){Q(await this.client.storage.removePinHandler({path:{pinned_item_id:$.id},body:{pinType:$.entityType}}))}async reorder($){Q(await this.client.storage.reorderPinsHandler({body:$}))}}class W0{client;constructor($){this.client=$}byId($){return n.byId(this.client,$)}create($){return n.create(this.client,$)}search($,O){return n.search(this.client,$,O)}}class zO{client;definitionId;id;record;constructor($,O,j,x){this.client=$;this.definitionId=O;this.id=j;this.record=x}static from($,O,j){return new zO($,O,j.id,j)}get value(){return this.record.value}get color(){return this.record.color??void 0}get displayOrder(){return this.record.display_order}get createdAt(){return this.record.created_at}get updatedAt(){return this.record.updated_at}async update($){return this.record=Q(await this.client.properties.updatePropertyOption({path:{definition_id:this.definitionId,option_id:this.id},body:$})),this}async delete(){Q(await this.client.properties.deletePropertyOption({path:{definition_id:this.definitionId,option_id:this.id}}))}}class OO{client;id;detail;constructor($,O,j){this.client=$;this.id=O;this.detail=new J$(()=>this.fetch(),j)}async fetch(){return Q(await this.client.properties.getPropertyDefinition({path:{definition_id:this.id}}))}static async create($,O){let j=Q(await $.properties.createPropertyDefinition({body:{display_name:O.displayName,scope:O.scope,data_type:O.dataType}}));return new OO($,j.id,j)}static byId($,O){return new OO($,O)}static fromRecord($,O){return new OO($,O.id,O)}get displayName(){return this.detail.get().then(($)=>$.display_name)}get dataType(){return this.detail.get().then(($)=>$.data_type)}get owner(){return this.detail.get().then(($)=>$.owner)}get isSystem(){return this.detail.get().then(($)=>$.is_system)}get isMultiSelect(){return this.detail.get().then(($)=>$.is_multi_select)}get createdAt(){return this.detail.get().then(($)=>$.created_at)}get updatedAt(){return this.detail.get().then(($)=>$.updated_at)}async delete(){return Q(await this.client.properties.deletePropertyDefinition({path:{definition_id:this.id}}))}async options(){return Q(await this.client.properties.getPropertyOptions({path:{definition_id:this.id}})).map((O)=>zO.from(this.client,this.id,O))}async addOption($){let O=Q(await this.client.properties.addPropertyOption({path:{definition_id:this.id},body:$}));return zO.from(this.client,this.id,O)}async updateOption($,O){let j=Q(await this.client.properties.updatePropertyOption({path:{definition_id:this.id,option_id:$.id},body:O}));return zO.from(this.client,this.id,j)}async deleteOption($){return Q(await this.client.properties.deletePropertyOption({path:{definition_id:this.id,option_id:$.id}}))}}class B0{client;constructor($){this.client=$}async list($){return Q(await this.client.properties.listProperties({query:{scope:$?.scope??"all",...$?.forEntityType!==void 0?{for_entity_type:$.forEntityType}:{}}})).map((j)=>{let x="definition"in j?j.definition:j;return OO.fromRecord(this.client,x)})}create($){return OO.create(this.client,$)}definition($){return OO.byId(this.client,$)}async bulkEntityProperties($){return Q(await this.client.properties.getBulkEntityProperties({body:$}))}async updateEntityPropertyOptions($,O){return Q(await this.client.properties.bulkUpdateEntitiesPropertyOptions({body:{entities:$.map((x)=>x.propertyReference()),property_id:O.property.id,...O.add?{add_option_ids:O.add.map((x)=>x.id)}:{},...O.remove?{remove_option_ids:O.remove.map((x)=>x.id)}:{}}})).results}async addEntityPropertyOption($){return Q(await this.client.properties.addEntityPropertyOption({path:{...$.entity.propertyReference(),property_id:$.property.id,option_id:$.option.id}}))}async removeEntityPropertyOption($){return Q(await this.client.properties.removeEntityPropertyOption({path:{...$.entity.propertyReference(),property_id:$.property.id,option_id:$.option.id}}))}async tags(){return Q(await this.client.properties.listTags({}))}}function L0($){return c($).with({type:"cron"},(O)=>O).with({type:"events"},(O)=>({type:"events",filters:O.filters.map(({entities:j,...x})=>({...x,ids:j?.map((S)=>S.entity.id)}))})).exhaustive()}function $7($){return c($).with({type:"multiple"},(O)=>({type:"multiple",triggers:O.triggers.map(L0)})).with({type:"cron"},L0).with({type:"events"},L0).exhaustive()}class jO extends A{static byId($,O){return new jO($,O)}static from($,O){if(!O.id)throw Error("Routine response has no id");return new jO($,O.id,O)}async fetch(){return Q(await this.client.scheduledAction.getScheduledAction({path:{id:this.id}}))}name=this.field("name");trigger=this.field("trigger");enabled=this.field("enabled");nextRunAt=this.field("next_run_at");revision=this.field("configuration_revision");owner=this.mappedField("owner",($)=>M.byId(this.client,$));async update($){await this.mutate((O)=>O.scheduledAction.updateScheduledAction({path:{id:this.id},body:U0($)}))}async setEnabled($){await this.mutate((O)=>O.scheduledAction.setScheduledActionEnabled({path:{id:this.id},body:{enabled:$}}))}async execute(){let $=Q(await this.client.scheduledAction.executeScheduledActionNow({path:{id:this.id}}));if($.resource)return c($.resource).with({type:"agent"},(O)=>i.byId(this.client,O.id)).with({type:"chat"},(O)=>Z$.byId(this.client,O.id)).exhaustive();return $.chat_id?Z$.byId(this.client,$.chat_id):void 0}async history(){return Q(await this.client.scheduledAction.listScheduledActionHistory({path:{id:this.id}})).map(($)=>new N0(this,$))}async delete(){await this.mutate(($)=>$.scheduledAction.deleteScheduledAction({path:{id:this.id}}))}}class N0{routine;record;constructor($,O){this.routine=$;this.record=O}get id(){return this.record.id??void 0}toJSON(){return{routine:this.routine.id,...this.record}}}function U0($){let O={prompt:$.prompt,user_prompt:$.userPrompt,model:$.model,agent:$.agent?{bot_id:$.agent.id}:void 0};return{kind:"Agent",name:$.name,enabled:$.enabled,trigger:$7($.trigger),task:{...O}}}class z0{client;constructor($){this.client=$}byId($){return jO.byId(this.client,$)}async create($){return jO.from(this.client,Q(await this.client.scheduledAction.createScheduledAction({body:{...U0($),enabled:$.enabled??!0}})))}async list($){return Q(await this.client.scheduledAction.listScheduledActions({query:{include_events:$?.includeEvents}})).map((O)=>jO.from(this.client,O))}}class I0{client;constructor($){this.client=$}byId($){return D$.byId(this.client,$)}create($){return D$.create(this.client,$)}forPullRequest($){return D$.forPullRequest(this.client,$)}search($,O){return D$.search(this.client,$,O)}}class T0{client;constructor($){this.client=$}byId($){return T$.byId(this.client,$)}current(){return T$.current(this.client)}list(){return T$.list(this.client)}}class H0{client;constructor($){this.client=$}async get($){return Q(await this.client.unfurl.getUnfurl({query:{url:$}}))}async bulk($){return Q(await this.client.unfurl.getUnfurlBulk({body:{url_list:$}}))}}class R0{client;constructor($){this.client=$}byId($){return M.byId(this.client,$)}me(){return M.me(this.client)}}class xO extends A{signingSecret;constructor($,O,j,x){super($,O,j);this.signingSecret=x}async fetch(){return Q(await this.client.storage.getWebhook({path:{webhook_id:this.id}}))}static async create($,O){let j=Q(await $.storage.createWebhook({body:{endpoint_url:O.url,namespace:O.namespace,name:O.name,filters:O.filters,scope:O.scope??"user",...O.headers!==void 0?{headers:O.headers}:{}}}));return new xO($,j.id,j,j.signing_secret)}static byId($,O){return new xO($,O)}static fromRecord($,O){return new xO($,O.id,O)}name=this.field("name");namespace=this.field("namespace");endpointUrl=this.field("endpoint_url");status=this.field("status");isValid=this.field("is_valid");filters=this.field("filters");createdAt=this.field("created_at");workspaceId=this.field("workspace_id");createdBy=this.mappedField("created_by_user_id",($)=>M.byId(this.client,$));async scope(){let $=await this.detail.get();return $.workspace_id===$.created_by_user_id?"user":"team"}async update($){await this.mutate((O)=>O.storage.patchWebhook({path:{webhook_id:this.id},body:$}))}async rename($){await this.update({name:$})}async setUrl($){await this.update({endpoint_url:$})}async setFilters($){await this.update({filters:$})}async pause(){await this.update({status:"paused"})}async resume(){await this.update({status:"active"})}async delete(){await this.mutate(($)=>$.storage.deleteWebhook({path:{webhook_id:this.id}}))}async validate(){return this.mutate(($)=>$.storage.validateWebhook({path:{webhook_id:this.id}}))}}class D0{client;constructor($){this.client=$}create($){return xO.create(this.client,$)}byId($){return xO.byId(this.client,$)}async list(){let{webhooks:$}=Q(await this.client.storage.listWebhooks());return $.map((O)=>xO.fromRecord(this.client,O))}}function C0($){if("properties"in $.data)return $.data.properties;if($.tag==="calendarEvent")return $.data.extra.properties;return[]}function y1($,O,j){let x=[];for(let S of C0(O)){if(S.definition.data_type!=="TAG"||S.value?.type!=="SelectOption")continue;for(let K of S.value.value){let Z=j.get(K);if(Z&&!x.some((X)=>X.label===Z.label&&X.scope===Z.scope))x.push(Z)}}switch(O.tag){case"document":return{type:"document",id:O.data.id,entity:q.byId($,O.data.id),snapshot:O,tags:x,name:O.data.name,fileType:O.data.fileType,subType:O.data.subType?.type};case"chat":return{type:"ai_chat",id:O.data.id,entity:Z$.byId($,O.data.id),snapshot:O,tags:x,name:O.data.name};case"project":return{type:"project",id:O.data.id,entity:n.byId($,O.data.id),snapshot:O,tags:x,name:O.data.name};case"emailThread":return{type:"email",id:O.data.id,entity:H$.byId($,O.data.id),snapshot:O,tags:x,subject:O.data.name,snippet:O.data.snippet,senderName:O.data.senderName,senderEmail:O.data.senderEmail,inboxVisible:O.data.inboxVisible,isRead:O.data.isRead,isDraft:O.data.isDraft};case"channel":return{type:"channel",id:O.data.channel.id,entity:f.byId($,O.data.channel.id),snapshot:O,tags:x,name:O.data.channel.name};case"channelThread":return{type:"channel_thread",id:O.data.id,entity:new g$($,O.data.channel_id,O.data.id),snapshot:O,tags:x,channelId:O.data.channel_id};case"call":return{type:"call",id:O.data.callId,entity:K$.byId($,O.data.callId),snapshot:O,tags:x,createdBy:O.data.createdBy};case"calendarEvent":return{type:"calendar_event",id:O.data.id,entity:L$.byId($,O.data.id),snapshot:O,tags:x,title:O.data.title,status:O.data.status,location:O.data.location,conferenceUrl:O.data.conferenceUrl,conferenceProvider:O.data.conferenceProvider,time:O.data.time};case"foreignEntity":return{type:"foreign_entity",id:O.data.id,entity:o$.byId($,O.data.id),snapshot:O,tags:x,foreignEntityId:O.data.foreignEntityId,foreignEntitySource:O.data.foreignEntitySource,metadata:O.data.metadata};default:throw Error(`Unexpected workspace entity type: ${O.tag}`)}}var v1="00000000-0000-0000-0000-000000000000",_0={document:["df","id"],project:["pf","pid"],ai_chat:["cf","cid"],email:["ef","ThreadId"],channel:["chanf","ChannelId"],channel_thread:["cthf","ThreadId"],call:["callf","CallId"],calendar_event:["calf","id"],foreign_entity:["fef","id"]},Hj=($)=>$.replace(/[A-Z]/g,(O)=>O.toLowerCase()),h1=($,O)=>$==null?O:{"&":[$,O]};function M0($,O){if(!$||typeof $!=="object"||Array.isArray($))throw Error(`Invalid workspace ${O}: expected a filter expression.`);let j=Object.entries($),x=j[0];if(j.length!==1||x===void 0)throw Error(`Invalid workspace ${O}: use exactly one of l, &, |, !.`);let[S,K]=x;if(S==="l")return;if(S==="!"){M0(K,`${O}.!`);return}if(S!=="&"&&S!=="|")throw Error(`Invalid workspace ${O}: use l, &, | or !.`);if(!Array.isArray(K)||K.length!==2)throw Error(`Invalid workspace ${O}.${S}: expected exactly two expressions. Use {l: {...}} for a single condition; nest binary operators for three or more.`);K.forEach((Z,X)=>{M0(Z,`${O}.${S}[${X}]`)})}class Rj{client;tagSets;constructor($){this.client=$}sets(){return this.tagSets??=this.client.properties.listTags({}).then(Q),this.tagSets}async tagMap(){let $=new Map;for(let O of await this.sets())for(let j of O.options)if(j.value.type==="string")$.set(j.id,{label:j.value.value,scope:O.scope==="user"?"personal":"team"});return $}async body($){for(let[S,K,Z]of[["sortBy",$.sortBy,["recently_viewed","recently_updated","recently_created"]],["emailPreset",$.emailPreset,["signal"]],["tagsMatch",$.tagsMatch,["any","all"]]])if(K!==void 0&&!Z.includes(K))throw Error(`Invalid workspace ${S}: ${K}`);if($.includeTypes!==void 0&&(!Array.isArray($.includeTypes)||$.includeTypes.some((S)=>!Object.hasOwn(_0,S))))throw Error(`Invalid workspace includeTypes. Supported values: ${Object.keys(_0).join(", ")}. Tasks use document with df: {l: {dst: 'task'}}.`);for(let S of["df","pf","cf","ef","chanf","cthf","callf","fef","calf","propf"])if($[S]!=null)M0($[S],S);if($.tags?.some((S)=>S.scope!==void 0&&S.scope!=="personal"&&S.scope!=="team"))throw Error("Invalid workspace tag scope");if($.limit!==void 0&&!Number.isFinite($.limit))throw Error("Workspace limit must be finite");let O={df:$.df,pf:$.pf,cf:$.cf,ef:$.ef,chanf:$.chanf,cthf:$.cthf,callf:$.callf,fef:$.fef,calf:$.calf,propf:$.propf,ccf:{l:{id:v1}},favorites_only:$.favoritesOnly,expand:!0,limit:Math.max(1,Math.min(500,Math.trunc($.limit??50))),sort_method:$.sortBy==="recently_viewed"?"viewed_at":$.sortBy==="recently_created"?"created_at":"updated_at",sort_direction:"desc",emailView:$.emailView??"inbox"};if($.emailPreset==="signal")O.ef={"&":[{l:{Importance:!0}},{l:{Shared:"exclude"}}]};let j=$.inbox?.trim();if(j){let{links:S}=Q(await this.client.email.listLinks()),K=S.filter((X)=>Hj(X.email_address)===Hj(j)),Z=K[0];if(!Z)throw Error(`No connected inbox matches "${j}". Connected inboxes: ${S.map((X)=>X.email_address).join(", ")}.`);if(K.length>1)throw Error(`Multiple connected inboxes match "${j}"; cannot pick one.`);O.ef=h1(O.ef,{l:{Owner:Z.id}})}let x=$.includeTypes??($.emailPreset==="signal"?["email"]:void 0);if(x?.length){for(let[S,[K,Z]]of Object.entries(_0))if(!x.includes(S))O[K]={l:{[Z]:v1}}}if($.tags?.length){let S=(await this.sets()).flatMap((G)=>{let L=G.definition;if(!L)return[];return G.options.flatMap((Y)=>Y.value.type==="string"?[{id:Y.id,definitionId:L.id,label:Y.value.value,scope:G.scope==="user"?"personal":"team"}]:[])}),K=new Map;for(let G of $.tags){let L=S.filter((Y)=>Hj(Y.label)===Hj(G.label.trim())&&(!G.scope||Y.scope===G.scope));if(!L.length)throw Error(`Unknown tag "${G.label}". Available tags: ${S.map((Y)=>`${Y.label} (${Y.scope})`).join(", ")}.`);if($.tagsMatch==="all"&&L.length>1)throw Error(`Tag "${G.label}" is ambiguous; specify personal or team scope.`);for(let Y of L)K.set(Y.id,Y)}let X=[...K.values()].map((G)=>({l:{pd:G.definitionId,v:{so:G.id}}})).reduce((G,L)=>G===void 0?L:{[$.tagsMatch==="all"?"&":"|"]:[G,L]},void 0);O.propf=h1(O.propf,X)}return O}}class A0{client;constructor($){this.client=$}async page($={}){let O=new Rj(this.client);return this.fetch(O,await O.body($),$.cursor)}async*list($={}){let O=new Rj(this.client),j=await O.body($);yield*a((x)=>this.fetch(O,j,x))}async fetch($,O,j){let x=Q(await this.client.storage.postItemsSoupAst({body:O,query:j?{cursor:j}:void 0})),K=x.items.some((Z)=>C0(Z).some((X)=>X.definition.data_type==="TAG"))?await $.tagMap():new Map;return{items:x.items.map((Z)=>y1(this.client,Z,K)),nextCursor:x.next_cursor,hasMore:x.next_cursor!=null}}}function m1({onRequest:$,onSseError:O,onSseEvent:j,responseTransformer:x,responseValidator:S,sseDefaultRetryDelay:K,sseMaxRetryAttempts:Z,sseMaxRetryDelay:X,sseSleepFn:G,url:L,...Y}){let J,T=G??((V)=>new Promise((B)=>setTimeout(B,V)));return{stream:async function*(){let V=K??3000,B=0,I=Y.signal??new AbortController().signal;while(!0){if(I.aborted)break;B++;let P=Y.headers instanceof Headers?Y.headers:new Headers(Y.headers);if(J!==void 0)P.set("Last-Event-ID",J);try{let D={redirect:"follow",...Y,body:Y.serializedBody,headers:P,signal:I},C=new Request(L,D);if($)C=await $(L,D);let N=await(Y.fetch??globalThis.fetch)(C);if(!N.ok)throw Error(`SSE failed: ${N.status} ${N.statusText}`);if(!N.body)throw Error("No body in SSE response");let H=N.body.pipeThrough(new TextDecoderStream).getReader(),U="",k=()=>{try{H.cancel()}catch{}};I.addEventListener("abort",k);try{while(!0){let{done:d,value:l}=await H.read();if(d)break;U+=l,U=U.replace(/\r\n?/g,`+async function bO($,O,j){if(!Number.isInteger(O)||O<1)throw RangeError(`concurrency limit must be a positive integer, got ${O}`);let x=Array($.length),S=0,K=async()=>{while(S<$.length){let X=S;S+=1,x[X]=await j($[X])}},Z=Array.from({length:Math.min(O,$.length)},K);return await Promise.all(Z),x}class J${loader;value;inflight;constructor($,O){this.loader=$;this.value=O}get(){if(this.value!==void 0)return Promise.resolve(this.value);return this.inflight??=this.loader().then(($)=>{return this.value=$,$}),this.inflight}peek(){return this.value}clear(){this.value=void 0,this.inflight=void 0}}async function*a($){let O;do{let j=await $(O),x=j.nextCursor??void 0;if(O!==void 0&&x!==void 0&&JSON.stringify(x)===JSON.stringify(O))throw Error("Pagination cursor did not advance");yield*j.items,O=x}while(O!==void 0)}class b extends Error{constructor($){super($);this.name="MacroError"}}class SO extends b{status;data;constructor($,O){super(`Macro API error ${$}`);this.status=$;this.data=O;this.name="MacroApiError"}}class w extends b{constructor($){super($);this.name="MacroNotFoundError"}}function Q($){if($.error!==void 0)throw new SO($.response?.status??0,$.error);return $.data}class A{client;id;detail;constructor($,O,j){this.client=$;this.id=O;this.detail=new J$(()=>this.fetch(),j)}field($){return async()=>(await this.detail.get())[$]??void 0}mappedField($,O){return async()=>O((await this.detail.get())[$]??void 0)}toJSON(){let $=this.detail.peek();return $===void 0?{id:this.id}:{id:this.id,detail:$}}async mutate($){let O=Q(await $(this.client));return this.detail.clear(),O}}class F$ extends A{async permission(){return Q(await this.client.storage.getEntityPermission({path:{entity_type:this.entityType,entity_id:this.id}}))}async favorite(){return Q(await this.client.storage.addFavorite({body:{entityId:this.id,entityType:this.entityType}})),this}async unfavorite(){return Q(await this.client.storage.removeFavoriteByEntity({path:{entity_type:this.entityType,entity_id:this.id}})),this}}class S$ extends F${propertyReference(){return{entity_type:this.propertyEntityType,entity_id:this.id}}async properties($){let{properties:O}=Q(await this.client.properties.getEntityProperties({path:{entity_type:this.propertyEntityType,entity_id:this.id},query:$?.includeMetadata!==void 0?{include_metadata:$.includeMetadata}:void 0}));return O}async setProperty($,O){Q(await this.client.properties.setEntityProperty({path:{...this.propertyReference(),property_id:$.id},body:{value:O??null}}))}async updatePropertyOptions($){return Q(await this.client.properties.bulkUpdateEntityPropertyOptions({path:this.propertyReference(),body:{properties:$.map((O)=>({property_id:O.property.id,...O.add?{add_option_ids:O.add.map((j)=>j.id)}:{},...O.remove?{remove_option_ids:O.remove.map((j)=>j.id)}:{}}))}}))}async deleteProperty($){Q(await this.client.properties.deleteEntityProperty({path:{entity_property_id:$.property.id}}))}}function l$($,O){return`<${$}>${JSON.stringify(O)}</${$}>`}function H6($){return typeof $==="object"&&$!==null&&typeof $.toMention==="function"}var R6={toMention:()=>({tag:l$("m-group-mention",{groupAlias:"here"}),mention:{entity_type:"group",entity_id:"here"}})};function D6($,...O){let j="",x=[];for(let[S,K]of $.entries()){j+=K;let Z=O[S];if(Z===void 0)continue;if(H6(Z)){let X=Z.toMention();j+=X.tag,x.push(X.mention)}else j+=String(Z)}return{content:j,mentions:C6(x)}}function C6($){let O=new Set;return $.filter((j)=>{let x=`${j.entity_type}:${j.entity_id}`;if(O.has(x))return!1;return O.add(x),!0})}function $$($){return typeof $==="string"?{content:$,mentions:[]}:$}class V$ extends A{static byId($,O){return new V$($,O)}static from($,O){return new V$($,O.id,O)}async fetch(){let $=Q(await this.client.storage.listHarnesses()).find((O)=>O.id===this.id);if(!$)throw new w(`Harness ${this.id} is unavailable`);return $}name=this.field("name");connected=this.field("connected");kind=this.field("kind");async delete(){await this.mutate(($)=>$.storage.deleteHarness({path:{harness_id:this.id}}))}}class U$ extends A{static byId($,O){return new U$($,O)}static from($,O){return new U$($,O.bot.id,O)}async fetch(){let $=Q(await this.client.storage.listAgents()).find((O)=>O.bot.id===this.id);if(!$)throw new w(`Agent ${this.id} is unavailable`);return $}name=this.mappedField("bot",($)=>$.name);instructions=this.field("instructions");defaultModel=this.field("default_model");channels=this.mappedField("channel_ids",($)=>$.map((O)=>f.byId(this.client,O)));host=this.mappedField("harness_id",($)=>$?V$.byId(this.client,$):void 0);async update($){await this.mutate((O)=>O.storage.updateAgent({path:{agent_id:this.id},body:Fx($)}))}}function Fx($){let{channels:O,team:j,host:x,autoAcceptPermissions:S,avatarUrl:K,channelScope:Z,defaultModel:X,isCoding:G,...L}=$;return{...L,channel_ids:O?.map((Y)=>Y.id),team_id:j?.id,harness_id:x?.id,auto_accept_permissions:S,avatar_url:K,channel_scope:Z,default_model:X,is_coding:G}}async function Xj($,O,j){let{channelId:x,thread:S}=_6(O);if(await M6($)){let{id:Z}=Q(await $.storage.entityMessageCreate({path:{parent_type:"channel",parent_id:x},body:{content:j.content,mentions:j.mentions,attachments:[],thread_id:S?.rootId??null,nonce:crypto.randomUUID()}}));return Z}if(S)throw new b("a user-owned bot can only post via the channel webhook endpoint, which "+"does not support threads — use a team-owned bot, or requestedAs(user), "+"to reply in a thread");let{message_id:K}=Q(await $.storage.postChannelBotWebhook({path:{channel_id:x},body:{content:j.content},headers:{"x-macro-bot-scope":"user"}}));return K}function _6($){return"rootId"in $?{channelId:$.channelId,thread:$}:{channelId:$.id}}async function M6($){if($.authConfig.type!=="bot"||$.hasActingUser())return!0;let{owner:O}=await $.selfBot();return O?.type==="team"}class g${client;channelId;rootId;constructor($,O,j){this.client=$;this.channelId=O;this.rootId=j}toJSON(){return{channelId:this.channelId,rootId:this.rootId}}channel(){return f.byId(this.client,this.channelId)}root(){return e.byId(this.client,this.channelId,this.rootId)}async replies(){let{replies:$}=Q(await this.client.storage.entityMessageGetThread({path:{parent_type:"channel",parent_id:this.channelId,id:this.rootId}}));return $.map((O)=>e.from(this.client,this.channelId,O))}async reply($){let O=await Xj(this.client,this,$$($));return e.byId(this.client,this.channelId,O)}}class e extends F${channelId;mentions;entityType="channel_message";constructor($,O,j,x=[],S){super($,j,S);this.channelId=O;this.mentions=x}get path(){return{parent_type:"channel",parent_id:this.channelId,id:this.id}}async fetch(){return Q(await this.client.storage.entityMessageGetMessage({path:this.path}))}static byId($,O,j,x=[]){return new e($,O,j,x)}static from($,O,j){return new e($,O,j.id,j.mentions,j)}content=this.field("content");createdAt=this.field("created_at");editedAt=this.field("edited_at");updatedAt=this.field("updated_at");async author(){return M.byId(this.client,(await this.detail.get()).sender_id)}channel(){return f.byId(this.client,this.channelId)}thread(){return new g$(this.client,this.channelId,this.id)}async react($){return await this.mutate((O)=>O.storage.entityMessageReact({path:this.path,body:{add:!0,emoji:$}})),this}async unreact($){return await this.mutate((O)=>O.storage.entityMessageReact({path:this.path,body:{add:!1,emoji:$}})),this}async edit($){let{content:O,mentions:j}=$$($);return await this.mutate((x)=>x.storage.entityMessageEdit({path:this.path,body:{content:O,mentions:j}})),this}async delete(){await this.mutate(($)=>$.storage.entityMessageDeleteMessage({path:this.path}))}async reply($){return this.thread().reply($)}}class Gj{client;channel;record;constructor($,O,j){this.client=$;this.channel=O;this.record=j}agent(){return U$.byId(this.client,this.record.botId)}sessions(){return this.record.sessions.map(($)=>({session:i.byId(this.client,$.sessionId),isCurrent:$.isCurrent,createdAt:$.createdAt}))}turns(){return this.record.turns.map(($)=>new Ex(this.client,this,$))}async startFresh($){Q(await this.client.agentHarness.startFreshAgentConversation({path:{channel_id:this.channel.id,bot_id:this.record.botId},body:{sessionId:$.id}}))}toJSON(){return{channelId:this.channel.id,agentId:this.record.botId}}}class Ex{client;conversation;record;constructor($,O,j){this.client=$;this.conversation=O;this.record=j}source(){return e.byId(this.client,this.conversation.channel.id,this.record.sourceMessageId)}session(){return i.byId(this.client,this.record.sessionId)}async retry($){Q(await this.client.agentHarness.retryAgentConversationTurn({path:{channel_id:this.conversation.channel.id,bot_id:this.conversation.agent().id,source:this.record.sourceMessageId},body:{actionId:$}}))}toJSON(){return{channelId:this.conversation.channel.id,sourceMessageId:this.record.sourceMessageId}}}class W$ extends A{parent;toJSON(){return{...super.toJSON(),parentType:this.parent.type,parentId:this.parent.entity.id}}constructor($,O,j){super($,j);this.parent=O}static byId($,O,j){return new W$($,O,j)}get path(){return{parent_type:this.parent.type,parent_id:this.parent.entity.id,id:this.id}}async fetch(){return Q(await this.client.storage.entityMessageGetThread({path:this.path})).state}resolved=this.field("resolved");async update($){let O={resolved:$.resolved,detach_anchor:$.detachAnchor,nonce:$.nonce};await this.mutate((j)=>j.storage.entityMessagePatchThread({path:this.path,body:O}))}async delete($){await this.mutate((O)=>O.storage.entityMessageDeleteThread({path:this.path,query:{nonce:$}}))}}async function E$($,O,j,x){for(let K of[...x?.messages??[],...x?.around?[x.around]:[]]){let Z="channelId"in K?{type:"channel",id:K.channelId}:("documentId"in K)?{type:"document",id:K.documentId}:("callId"in K)?{type:"call",id:K.callId}:K.parent;if(Z.type!==O.type||Z.id!==O.entity.id)throw Error("Timeline message belongs to another resource")}let S=Q(await $.storage.messageTimelineEntries({path:{parent_type:O.type,parent_id:O.entity.id},query:{selection:x?JSON.stringify({cursor:x.cursor,around:x.around?.id,ids:x.messages?.map((K)=>K.id),activity_after:x.activityAfter,activity_before:x.activityBefore,anchored:x.anchored,direction:x.direction,include_deleted_threads:x.includeDeletedThreads,limit:x.limit}):void 0}}));return{entries:S.entries.map((K)=>{if(K.type==="activity")return{type:"activity",activity:{...K.activity,actor:M.byId($,K.activity.actor_id)}};return{type:"message",message:j(K.message)}}),nextCursor:S.next_cursor??void 0,previousCursor:S.previous_cursor??void 0}}var A6=50;function j$($){let{filters:O,type:j,make:x,includeCrm:S}=$;return(K,Z,X)=>{let G=X?.searchOn??"name_content",L=X?.pageSize??A6;return a(async(Y)=>{let{results:J,next_cursor:T}=Q(await K.search.unifiedSearch({body:{query:Z,match_type:"partial",search_on:G,...O?{filters:O}:{},...S?{include_crm:!0}:{}},query:{page_size:L,...Y?{cursor:Y}:{}}}));return{items:J.filter((W)=>W.type===j).map((W)=>x(K,W)),nextCursor:T}})}}class ZO{client;channel;record;constructor($,O,j){this.client=$;this.channel=O;this.record=j}get id(){return this.record.id}user(){return M.byId(this.client,this.record.user_id)}createdAt(){return this.record.created_at}async recordInteraction($){return new ZO(this.client,this.channel,Q(await this.client.storage.postActivity({body:{activity_type:$,channel_id:this.channel.id}})))}toJSON(){return this.record}}class f extends S${async recordActivity($){return new ZO(this.client,this,Q(await this.client.storage.postActivity({body:{activity_type:$,channel_id:this.id}})))}async setPicture($){await this.mutate((O)=>O.storage.setChannelPicture({path:{channel_id:this.id},body:{profile_picture_id:$?.id??null}}))}messageThreadById($){return W$.byId(this.client,{type:"channel",entity:this},$)}timelinePage($){return E$(this.client,{type:"channel",entity:this},(O)=>e.from(this.client,this.id,O),$)}async agentConversations(){return Q(await this.client.agentHarness.listAgentConversations({path:{channel_id:this.id}})).conversations.map(($)=>new Gj(this.client,this,$))}entityType="channel";propertyEntityType="CHANNEL";async fetch(){return Q(await this.client.storage.getChannel({path:{channel_id:this.id}}))}static byId($,O){return new f($,O)}static async dm($,O){let{channel_id:j}=Q(await $.storage.getOrCreateDm({body:{recipient_id:O.id}}));return new f($,j)}static async private($,O){let{channel_id:j}=Q(await $.storage.getOrCreatePrivate({body:{recipients:O.map((x)=>x.id)}}));return new f($,j)}static async create($,O){let{id:j}=Q(await $.storage.createChannel({body:{channel_type:O.type,name:O.name??null,participants:(O.participants??[]).map((x)=>x.id),team_id:O.team?.id??null}}));return new f($,j)}name=this.field("channel_name");type=this.field("channel_type");async send($,O){let j=await Xj(this.client,O?.thread??this,$$($));return e.byId(this.client,this.id,j)}messages($){return this.timeline({limit:$?.pageSize})}messagesAfter($,O){return this.timeline({activity_after:$ instanceof Date?$.toISOString():$,limit:O?.pageSize})}timeline($){return a(async(O)=>{let j=Q(await this.client.storage.messageTimeline({path:{parent_type:"channel",parent_id:this.id},query:{selection:JSON.stringify({...$,cursor:O})}}));return{items:j.items.map((x)=>e.from(this.client,this.id,x)),nextCursor:j.next_cursor}})}message($){return e.byId(this.client,this.id,$)}async rename($){await this.mutate((O)=>O.storage.patchChannel({path:{channel_id:this.id},body:{channel_name:$}}))}async delete(){await this.mutate(($)=>$.storage.deleteChannel({path:{channel_id:this.id}}))}async join(){await this.mutate(($)=>$.storage.joinChannel({path:{channel_id:this.id}}))}async joinCode(){let{join_code:$}=Q(await this.client.storage.getChannelJoinLink({path:{channel_id:this.id}}));return $}async leave(){await this.mutate(($)=>$.storage.leaveChannel({path:{channel_id:this.id}}))}async participants(){return Q(await this.client.storage.getChannelParticipants({path:{channel_id:this.id}}))}async addParticipants($){await this.mutate((O)=>O.storage.addParticipants({path:{channel_id:this.id},body:{participants:$.map((j)=>j.id)}}))}async removeParticipants($){await this.mutate((O)=>O.storage.removeParticipants({path:{channel_id:this.id},body:{participants:$.map((j)=>j.id)}}))}async typing($,O){Q(await this.client.storage.entityMessageTyping({path:{parent_type:"channel",parent_id:this.id},body:{active:$==="start",thread_id:O?.thread?.rootId??null}}))}attachments($){return a(async(O)=>{let j=Q(await this.client.storage.getChannelAttachments({path:{channel_id:this.id},query:{...$?.pageSize?{limit:$.pageSize}:{},...$?.type?{attachment_type:$.type}:{},...O?{cursor:O}:{}}}));return{items:j.items,nextCursor:j.next_cursor}})}webUrl(){return`${this.client.webAppUrl}/app/channel/${this.id}`}static search=j$({type:"channel",make:($,O)=>new f($,O.channel_id)})}class M extends S${entityType="user";propertyEntityType="USER";async fetch(){let{names:$}=Q(await this.client.auth.getUserNamesWithEmail({body:{user_ids:[this.id]}})),O=$.find((j)=>j.id===this.id);if(!O)throw new w(`user ${this.id} not found`);return O}static byId($,O){return new M($,O)}static async me($){let{user_id:O}=Q(await $.auth.getUserInfo());return new M($,O)}async name(){let $=await this.detail.get();return[$.first_name,$.last_name].filter(Boolean).join(" ")||void 0}email(){let $=this.id.startsWith("macro|")?this.id.slice(6):void 0;return $?.includes("@")?$:void 0}dm(){return f.dm(this.client,this)}toMention(){return{tag:l$("m-user-mention",{userId:this.id}),mention:{entity_type:"user",entity_id:this.id}}}}class o{client;entityType;entity;constructor($,O,j){this.client=$;this.entityType=O;this.entity=j}get path(){return{entity_type:this.entityType,entity_id:this.entity.id}}async state($){let O=Q(await this.client.storage.accessRequestsState({path:this.path,query:{offset:$}}));return{accessLevel:O.accessLevel??void 0,canReview:O.canReview,owner:O.owner?M.byId(this.client,O.owner):void 0,pendingCount:O.pendingCount,supportedLevels:O.supportedLevels,nextOffset:O.nextOffset??void 0,mine:O.mine?WO.from(this.client,this,O.mine):void 0,requests:O.requests.map((j)=>WO.from(this.client,this,j))}}async submit($,O){return WO.from(this.client,this,Q(await this.client.storage.accessRequestsSubmit({path:this.path,body:{requestedLevel:$,revision:O}})))}async cancel($){Q(await this.client.storage.accessRequestsCancel({path:this.path,query:{revision:$}}))}async direct(){return Q(await this.client.storage.accessRequestsDirect({path:this.path})).map(($)=>({user:M.byId(this.client,$.userId),accessLevel:$.accessLevel}))}async grant($,O){Q(await this.client.storage.accessRequestsSetDirect({path:{...this.path,user_id:$.id},body:{accessLevel:O}}))}async remove($){Q(await this.client.storage.accessRequestsRemoveDirect({path:{...this.path,user_id:$.id}}))}async resolve($,O){let j=$.access.toJSON();if(j.entity_type!==this.entityType||j.entity_id!==this.entity.id)throw Error("Access request belongs to another entity");return Q(await this.client.storage.accessRequestsResolve({path:{...this.path,request_id:$.id},body:O}))}toJSON(){return this.path}}class WO extends A{access;resolvedRecord;constructor($,O,j){super($,j.id,j);this.access=O}static from($,O,j){return new WO($,O,j)}async fetch(){if(this.resolvedRecord)return this.resolvedRecord;let $;do{let O=await this.access.state($),j=[O.mine,...O.requests].find((x)=>x?.id===this.id);if(j)return j.detail.get();$=O.nextOffset}while($!==void 0);throw new w(`Access request ${this.id} is unavailable`)}revision=this.field("revision");status=this.field("status");requestedLevel=this.field("requestedLevel");requester=this.mappedField("requesterId",($)=>M.byId(this.client,$));async resolve($){this.resolvedRecord=await this.access.resolve(this,{revision:await this.revision(),grantedLevel:$}),this.detail.clear()}}function r$($){return{...$,channelSharePermissions:$.channelSharePermissions===void 0||$.channelSharePermissions===null?$.channelSharePermissions:$.channelSharePermissions.map((O)=>({channelId:O.channel.id,accessLevel:O.accessLevel,operation:O.operation}))}}class B$ extends A{parent;constructor($,O,j,x){super($,j,x);this.parent=O}static byId($,O,j){return new B$($,O,j)}static fromRecord($,O,j){return new B$($,O,j.id,j)}static async create($,O,j){return B$.createForSession($,O.session(),j,O)}static async createForSession($,O,j,x){let S=Q(await $.agentHarness.createSessionReview({path:{session_id:O.id},body:{...j,executionId:x?.id??null}}));return B$.fromRecord($,O,S)}static async list($,O){return Q(await $.agentHarness.listExecutionReviews({path:{session_id:O.session().id,execution_id:O.id}})).map((x)=>B$.fromRecord($,O.session(),x))}async fetch(){return Q(await this.client.agentHarness.getSessionReview({path:{session_id:this.parent.id,review_id:this.id}}))}title=this.field("title");kind=this.field("kind");session(){return this.parent}async reference(){return{kind:await this.kind(),id:this.id}}async items(){return(await this.detail.get()).items.map(($)=>new wx($,{edit:(O)=>this.decide({action:"edit",item:$.id,draft:O}),submit:()=>this.decide({action:"submit",items:[$.id]}),dismiss:()=>this.decide({action:"dismiss",items:[$.id]})}))}async refresh(){return this.detail.clear(),await this.detail.get(),this}async submitAll(){await this.decide({action:"submit",items:[]})}async dismissAll(){await this.decide({action:"dismiss",items:[]})}async decide($){let O=(await this.detail.get()).revision;await this.mutate((j)=>j.agentHarness.decideSessionReview({path:{session_id:this.parent.id,review_id:this.id},body:{...$,revision:O}}))}}class wx{snapshot;actions;constructor($,O){this.snapshot=$;this.actions=O}get id(){return this.snapshot.id}get status(){return this.snapshot.status}get draft(){return this.snapshot.draft}get result(){return this.snapshot.result}async edit($){await this.actions.edit($)}async submit(){await this.actions.submit()}async dismiss(){await this.actions.dismiss()}}class kO extends A{parent;constructor($,O,j){super($,O);this.parent=j}static byId($,O,j){return new kO($,j,O)}async fetch(){return Q(await this.client.agentHarness.getCodeExecution({path:{session_id:this.parent.id,execution_id:this.id}}))}reviews={create:($)=>B$.create(this.client,this,$),list:()=>B$.list(this.client,this)};session(){return this.parent}status=this.field("status");source=this.field("source");calls=this.field("calls");error=this.field("error");async result(){return(await this.detail.get()).result}async refresh(){return this.detail.clear(),await this.detail.get(),this}}class Kj{client;sessionId;dto;constructor($,O,j){this.client=$;this.sessionId=O;this.dto=j}static from($,O,j){return new Kj($,O,j)}get actionId(){return this.dto.actionId}get kind(){return this.dto.kind}get prompt(){return this.dto.prompt??void 0}get attachments(){return this.dto.attachments??[]}get actorUserId(){return this.dto.actorUserId??void 0}get createdAt(){return this.dto.createdAt}async edit($){return Q(await this.client.agentHarness.editQueuedAction({path:{session_id:this.sessionId,action_id:this.actionId},body:{prompt:$}})),this.dto={...this.dto,prompt:$},this}async steer(){Q(await this.client.agentHarness.steerQueuedAction({path:{session_id:this.sessionId,action_id:this.actionId}}))}async remove(){Q(await this.client.agentHarness.removeQueuedAction({path:{session_id:this.sessionId,action_id:this.actionId}}))}}class gO{client;session;id;constructor($,O,j){this.client=$;this.session=O;this.id=j}static byId($,O,j){return new gO($,O,j)}async answer($){return Q(await this.client.agentHarness.answerAgentSessionToolApproval({path:{session_id:this.session.id,approval_id:this.id},body:{answer:$}}))}toJSON(){return{id:this.id,sessionId:this.session.id}}}class i extends A{access=new o(this.client,"agent_session",this);toolApprovalById($){return gO.byId(this.client,this,$)}async sharePermissions(){return Q(await this.client.agentHarness.getAgentSessionPermissions({path:{session_id:this.id}}))}async updateSharePermissions($){return this.mutate((O)=>O.agentHarness.updateAgentSessionPermissions({path:{session_id:this.id},body:r$($)}))}static byId($,O){return new i($,O)}static async createManaged($,O){let{session:j}=Q(await $.agentHarness.createAgentSession({body:{prompt:O?.prompt,instructions:O?.instructions,model:O?.model,repoUrl:O?.repoUrl,repoBranch:O?.repoBranch}}));return new i($,j.id,j)}static async repositories($){let{repositories:O}=Q(await $.agentHarness.listAgentRepositories());return O.map((j)=>({url:j.url,defaultBranch:j.defaultBranch??void 0}))}static async repositoryBranches($,O){let{branches:j}=Q(await $.agentHarness.listAgentRepositoryBranches({query:{repoUrl:O}}));return j}async fetch(){return Q(await this.client.agentHarness.getAgentSession({path:{session_id:this.id}}))}name=this.field("name");isArchived=this.field("isArchived");model=this.field("model");harness=this.field("harness");repoUrl=this.field("repoUrl");workspace=this.field("workspace");instructions=this.field("instructions");status=this.field("status");sandboxSize=this.field("sandboxSize");createdAt=this.field("createdAt");modifiedAt=this.field("modifiedAt");static async forPullRequest($,O){let{sessionIds:j}=Q(await $.agentHarness.agentSessionsForPullRequest({body:{url:O}}));return j.map((x)=>i.byId($,x))}async pullRequests(){let{pullRequests:$}=Q(await this.client.agentHarness.listAgentSessionPullRequests({path:{session_id:this.id}}));return $.map((O)=>({githubKey:O.githubKey,url:O.url,source:O.source,linkedBy:O.linkedBy?M.byId(this.client,O.linkedBy):void 0,createdAt:O.createdAt}))}async linkPullRequest($){Q(await this.client.agentHarness.linkAgentSessionPullRequest({path:{session_id:this.id},body:{url:$}}))}async unlinkPullRequest($){Q(await this.client.agentHarness.unlinkAgentSessionPullRequest({path:{session_id:this.id},query:{url:$}}))}async rename($){await this.mutate((O)=>O.agentHarness.renameAgentSession({path:{session_id:this.id},body:{name:$}}))}async archive(){await this.setArchived(!0)}async unarchive(){await this.setArchived(!1)}async setArchived($){await this.mutate((O)=>O.agentHarness.setAgentSessionArchived({path:{session_id:this.id},body:{isArchived:$}}))}async setSandboxSize($){let{size:O}=await this.mutate((j)=>j.agentHarness.putAgentSessionSandboxSize({path:{session_id:this.id},body:{size:$}}));return O}static async defaultSandboxSize($){return Q(await $.agentHarness.getAgentSandboxSize()).size}static async setDefaultSandboxSize($,O){return Q(await $.agentHarness.putAgentSandboxSize({body:{size:O}})).size}static async codingPreferences($){return Q(await $.agentHarness.getAgentCodingPreferences())}static async setCodingPreferences($,O){return Q(await $.agentHarness.putAgentCodingPreferences({body:O}))}async control($){return this.mutate((O)=>O.agentHarness.controlAgentSession({path:{session_id:this.id},body:$}))}prompt($,O){return this.control({type:"prompt",prompt:$,...O&&O.length>0?{attachments:O}:{}})}async queue(){let{entries:$}=Q(await this.client.agentHarness.getAgentSessionQueue({path:{session_id:this.id}}));return $.map((O)=>Kj.from(this.client,this.id,O))}async changes(){return Q(await this.client.agentHarness.getAgentSessionChanges({path:{session_id:this.id}}))}async changesPatch(){return Q(await this.client.agentHarness.getAgentSessionChangesPatch({path:{session_id:this.id}})).patch}async refreshChanges(){return this.mutate(($)=>$.agentHarness.refreshAgentSessionChanges({path:{session_id:this.id}}))}async foldedLog(){let{bot:$,messages:O}=Q(await this.client.agentHarness.getAgentSessionFoldedLog({path:{session_id:this.id}}));return{bot:$,messages:O}}async log(){return Q(await this.client.agentHarness.getAgentSessionLog({path:{session_id:this.id}}))}reviews={create:($)=>B$.createForSession(this.client,this,$),byId:($)=>B$.byId(this.client,this,$)};codeExecutions={byId:($)=>kO.byId(this.client,this,$)};async delete(){await this.mutate(($)=>$.agentHarness.deleteAgentSession({path:{session_id:this.id}}))}}class qx{client;constructor($){this.client=$}byId($){return i.byId(this.client,$)}createManaged($){return i.createManaged(this.client,$)}repositories(){return i.repositories(this.client)}repositoryBranches($){return i.repositoryBranches(this.client,$)}forPullRequest($){return i.forPullRequest(this.client,$)}defaultSandboxSize(){return i.defaultSandboxSize(this.client)}setDefaultSandboxSize($){return i.setDefaultSandboxSize(this.client,$)}codingPreferences(){return i.codingPreferences(this.client)}setCodingPreferences($){return i.setCodingPreferences(this.client,$)}}class fx{client;constructor($){this.client=$}byId($){return U$.byId(this.client,$)}async list(){return Q(await this.client.storage.listAgents()).map(($)=>U$.from(this.client,$))}async create($){return U$.from(this.client,Q(await this.client.storage.createAgent({body:Fx($)})))}}class bx{client;async usage($={}){let{users:O,...j}=$;return Q(await this.client.cognition.getUsageHandler({body:{...j,include_users:O?.map((x)=>x.id)}}))}constructor($){this.client=$}async structuredCompletion($){return Q(await this.client.cognition.structuredCompletion({body:$}))}async decide($){return Q(await this.client.cognition.decisions({body:$}))}}class p$ extends A{static byId($,O){return new p$($,O)}static from($,O){return new p$($,O.id,{id:O.id,name:O.name,createdAt:O.createdAt})}async fetch(){let $=Q(await this.client.storage.listUserApiKeys()).keys.find((O)=>O.id===this.id);if(!$)throw new w(`API key ${this.id} is unavailable`);return $}name=this.field("name");createdAt=this.field("createdAt");async delete(){await this.mutate(($)=>$.storage.deleteUserApiKey({path:{id:this.id}}))}}class kx{client;constructor($){this.client=$}byId($){return p$.byId(this.client,$)}async list(){return Q(await this.client.storage.listUserApiKeys()).keys.map(($)=>p$.from(this.client,$))}async create($){let O=Q(await this.client.storage.createUserApiKey({body:{name:$}}));return{key:p$.from(this.client,O),secret:O.key}}async tokenForEmail($){return Q(await this.client.auth.macroApiToken({query:{email:$}}))}}class yO{client;constructor($){this.client=$}async me(){if(this.client.authConfig.type!=="bot")throw new b("bots.me() requires bot auth — a user API key has no bot identity");return Q(await this.client.storage.getSelfBot())}async channels(){if(this.client.authConfig.type!=="bot")throw new b("bots.channels() requires bot auth — a user API key has no bot identity");let $=await this.me();return Q(await this.client.storage.listBotChannels({path:{bot_id:$.id}}))}async myPrincipalId(){if(this.client.authConfig.type!=="bot")throw new b("bots.myPrincipalId() requires bot auth — a user API key has no bot identity");return this.client.myPrincipalId()}}class z$ extends A{async fetch(){let{links:$}=Q(await this.client.email.listLinks()),O=$.find((j)=>j.id===this.id);if(!O)throw new w(`email link ${this.id} not found`);return O}static byId($,O){return new z$($,O)}static async list($){let{links:O}=Q(await $.email.listLinks());return O.map((j)=>new z$($,j.id,j))}emailAddress=this.field("email_address");provider=this.field("provider");isPrimary=this.field("is_primary");isSyncActive=this.field("is_sync_active");syncStatus=this.field("sync_status");needsReauth=this.field("needs_reauth");photoUrl=this.field("photo_url");async settingsOperations(){return Q(await this.client.email.mailboxSettingsOperations({headers:{"X-Email-Link-Id":this.id}}))}}class y$ extends A{async setContributesToAvailability($){await this.mutate((O)=>O.calendar.setAvailabilityCalendar({path:{calendar_id:this.id},body:{contributesToAvailability:$}}))}async fetch(){let{calendars:$}=Q(await this.client.calendar.listCalendars()),O=$.find((j)=>j.id===this.id);if(!O)throw new w(`calendar ${this.id} not found`);return O}static byId($,O){return new y$($,O)}static async list($){let{calendars:O}=Q(await $.calendar.listCalendars());return O.map((j)=>new y$($,j.id,j))}name=this.field("name");emailAddress=this.field("emailAddress");isPrimary=this.field("isPrimary");isWritable=this.field("isWritable");isSubscription=this.field("isSubscription");color=this.field("color");syncError=this.field("syncError");emailLink=this.mappedField("emailLinkId",($)=>z$.byId(this.client,$))}class vO{client;id;constructor($,O){this.client=$;this.id=O}async status(){return Q(await this.client.calendar.calendarReplacementStatus({path:{operation_id:this.id}}))}async confirm(){return Q(await this.client.calendar.confirmCalendarReplacement({path:{operation_id:this.id}}))}async discard(){Q(await this.client.calendar.discardCalendarReplacement({path:{operation_id:this.id}}))}}class L$ extends A{async fetch(){throw new b(`calendar event ${this.id} has no fetch-by-id endpoint; read the record returned by calendar.createEvent / event.update / event.rsvp instead`)}static byId($,O){return new L$($,O)}static fromRecord($,O){return new L$($,O.id,O)}title=this.field("title");description=this.field("description");location=this.field("location");time=this.field("time");status=this.field("status");attendees=this.field("attendees");transparency=this.field("transparency");isReadOnly=this.field("isReadOnly");recurrenceLines=this.field("recurrenceLines");guestPolicy=this.field("guestPolicy");viewerCan=this.field("viewerCan");calendar=this.mappedField("calendarId",($)=>$?y$.byId(this.client,$):void 0);record(){return this.detail.get()}async update($){let O=await this.mutate((j)=>j.calendar.updateCalendarEvent({path:{event_id:this.id},body:P6($)}));return L$.fromRecord(this.client,O)}async delete($={}){await this.mutate((O)=>O.calendar.deleteCalendarEvent({path:{event_id:this.id},query:{calendarId:$.calendar?.id,scope:$.scope,recurrenceId:$.recurrenceId}}))}async prepareReplacement($){let O=Q(await this.client.calendar.prepareCalendarReplacement({path:{event_id:this.id},body:{removeConference:$.removeConference,recurrenceId:$.recurrenceId,calendarId:$.calendar?.id}}));return new vO(this.client,O.operationId)}async providerUrl($={}){return Q(await this.client.calendar.calendarEventProviderUrl({path:{event_id:this.id},query:{recurrenceId:$.recurrenceId,calendarId:$.calendar?.id}})).url??void 0}async inviteGuests($){let O=await this.mutate((j)=>j.calendar.inviteCalendarEventGuests({path:{event_id:this.id},body:{guests:$.guests,scope:$.scope,recurrenceId:$.recurrenceId,calendarId:$.calendar?.id}}));return L$.fromRecord(this.client,O)}async ics(){return Q(await this.client.storage.eventIcs({path:{event_id:this.id}}))}async rsvp($){let O=await this.mutate((j)=>j.calendar.rsvpCalendarEvent({path:{event_id:this.id},body:{response:$.response,scope:$.scope,recurrenceId:$.recurrenceId,calendarId:$.calendar?.id}}));return L$.fromRecord(this.client,O)}}function P6($){return{title:$.title,description:$.description,location:$.location,time:$.time,attendees:$.attendees,recurrenceLines:$.recurrenceLines,visibility:$.visibility,transparency:$.transparency,reminders:$.reminders,conference:$.conference,outOfOffice:$.outOfOffice,scope:$.scope,recurrenceId:$.recurrenceId,calendarId:$.calendar?.id}}class gx{client;async availabilityCalendars(){return Q(await this.client.calendar.getAvailabilityCalendars()).calendars.map(($)=>({calendar:y$.byId(this.client,$.calendarId),name:$.name,isPrimary:$.isPrimary,contributesToAvailability:$.contributesToAvailability}))}async teamSharing(){return Q(await this.client.calendar.getTeamSharing()).sharing}async setTeamSharing($){return Q(await this.client.calendar.setTeamSharing({body:{sharing:$}})).sharing}occurrences($){return a(async(O)=>{let j=Q(await this.client.storage.listOccurrences({query:{...$,cursor:O}}));return{items:j.items.map((x)=>({event:L$.fromRecord(this.client,x.event),occurrence:x.occurrence})),nextCursor:j.nextCursor}})}async teamPage($){let O=Q(await this.client.storage.listTeamCalendar({query:$}));return{items:O.items.map(({ownerId:j,...x})=>({...x,owner:M.byId(this.client,j)})),members:O.members.map((j)=>({user:M.byId(this.client,j.userId),sharing:j.sharing,coverage:j.coverage})),nextCursor:O.nextCursor??void 0}}async teamOutOfOffice($){let O=Q(await this.client.storage.listTeamOutOfOffice({query:$}));return{items:O.items.map((j)=>({event:L$.byId(this.client,j.eventId),owner:M.byId(this.client,j.ownerId),occurrenceKey:j.occurrenceKey,time:j.time,title:j.title??void 0})),hasMore:O.hasMore}}constructor($){this.client=$}calendars(){return y$.list(this.client)}calendar($){return y$.byId(this.client,$)}event($){return L$.byId(this.client,$)}replacement($){return new vO(this.client,$)}async createEvent($){let O=Q(await this.client.calendar.createCalendarEvent({body:F6($)}));return L$.fromRecord(this.client,O)}}function F6($){return{title:$.title,time:$.time,description:$.description,location:$.location,attendees:$.attendees,recurrenceLines:$.recurrenceLines,visibility:$.visibility,transparency:$.transparency,reminders:$.reminders,conference:$.conference,macroCall:$.macroCall,outOfOffice:$.outOfOffice,calendarId:$.calendar?.id,emailLinkId:$.emailLink?.id}}class I$ extends A{lookupToken;constructor($,O,j){super($,O,j);this.lookupToken=j?.shareToken}static byId($,O){return new I$($,O)}static from($,O){return new I$($,O.id,O)}async fetch(){if(this.lookupToken)return Q(await this.client.storage.meetingLookup({path:{token:this.lookupToken}}));let $=Q(await this.client.storage.meetingList()).meetings.find((O)=>O.id===this.id);if(!$)throw new w(`Meeting ${this.id} is unavailable`);return this.lookupToken=$.shareToken,$}title=this.field("title");scheduledStart=this.field("scheduledStart");scheduledEnd=this.field("scheduledEnd");channel=this.mappedField("channelId",($)=>$?f.byId(this.client,$):void 0);call=this.mappedField("callId",($)=>$?K$.byId(this.client,$):void 0);async update($){await this.mutate((O)=>O.storage.meetingUpdate({path:{meeting_id:this.id},body:$}))}async cancel(){await this.mutate(($)=>$.storage.meetingCancel({path:{meeting_id:this.id}}))}async invitePermissions(){return Q(await this.client.storage.meetingInvitePermissions({path:{token:(await this.detail.get()).shareToken}}))}async invite($){Q(await this.client.storage.meetingInvite({path:{token:(await this.detail.get()).shareToken},body:{email:$}}))}async inviteUsers($){Q(await this.client.storage.meetingInviteUsers({path:{token:(await this.detail.get()).shareToken},body:{userIds:$.map((O)=>O.id)}}))}async webUrl(){return`${this.client.webAppUrl}/app/meet/join/${encodeURIComponent((await this.detail.get()).shareToken)}`}}class v$ extends A{callId;constructor($,O,j,x){super($,j,x);this.callId=O}get path(){return{parent_type:"call",parent_id:this.callId,id:this.id}}async fetch(){return Q(await this.client.storage.entityMessageGetMessage({path:this.path}))}static byId($,O,j){return new v$($,O,j)}static from($,O,j){return new v$($,O,j.id,j)}content=this.field("content");createdAt=this.field("created_at");updatedAt=this.field("updated_at");call(){return K$.byId(this.client,this.callId)}async author(){return M.byId(this.client,(await this.detail.get()).sender_id)}async reply($){let O=Q(await this.client.storage.entityMessageCreate({path:{parent_type:"call",parent_id:this.callId},body:{...$$($),thread_id:this.callId}}));return v$.from(this.client,this.callId,O)}async edit($){let{content:O,mentions:j}=$$($);return await this.mutate((x)=>x.storage.entityMessageEdit({path:this.path,body:{content:O,mentions:j}})),this}async delete(){await this.mutate(($)=>$.storage.entityMessageDeleteMessage({path:this.path}))}}class K$ extends F${messageThreadById($){return W$.byId(this.client,{type:"call",entity:this},$)}timelinePage($){return E$(this.client,{type:"call",entity:this},(O)=>v$.from(this.client,this.id,O),$)}access=new o(this.client,"call",this);async meeting(){return I$.from(this.client,Q(await this.client.storage.meetingShare({path:{call_id:this.id}})))}async editTranscript($){await this.mutate((O)=>O.storage.editCallTranscript({path:{call_id:this.id},body:{assignments:$}}))}async toggleTeamShare(){return this.mutate(($)=>$.storage.toggleShareWithTeam({path:{call_id:this.id}}))}entityType="call";async fetch(){return Q(await this.client.storage.getCallRecord({path:{call_id:this.id}}))}static byId($,O){return new K$($,O)}message($){return v$.byId(this.client,this.id,$)}name=this.field("customName");channel=this.mappedField("channelId",($)=>$?f.byId(this.client,$):void 0);channelName=this.field("channelName");creator=this.mappedField("createdBy",($)=>M.byId(this.client,$));isActive=this.field("isActive");status=this.field("status");roomName=this.field("roomName");startedAt=this.field("startedAt");endedAt=this.field("endedAt");durationMs=this.field("durationMs");summary=this.field("summary");transcript=this.field("transcript");participants=this.field("participants");guests=this.field("guests");teamShareAccessLevel=this.field("teamShareAccessLevel");shareWithTeam=this.field("shareWithTeam");recordingUrl=this.field("recordingUrl");recordingPreviewUrl=this.field("recordingPreviewUrl");recordingStartedAt=this.field("recordingStartedAt");async rename($){await this.mutate((O)=>O.storage.editCallRecord({path:{call_id:this.id},body:{customName:$??""}}))}async setTeamShare($){await this.mutate((O)=>O.storage.editCallRecord({path:{call_id:this.id},body:{sharePermission:{teamShareAccessLevel:$?"view":null}}}))}async delete(){await this.mutate(($)=>$.storage.deleteCallRecord({path:{call_id:this.id}}))}static search=j$({filters:{call_filters:{}},type:"call",make:($,O)=>new K$($,O.call_id)})}class yx{client;constructor($){this.client=$}byId($){return K$.byId(this.client,$)}search($,O){return K$.search(this.client,$,O)}}class vx{client;constructor($){this.client=$}async list(){let{labels:$}=Q(await this.client.storage.listChannelLabels());return $}async create($,O=[]){return Q(await this.client.storage.createChannelLabel({body:{name:$,channelIds:O.map((j)=>j.id)}}))}async createSmartTag($,O){return Q(await this.client.storage.createChannelLabel({body:{name:$,rule:O}}))}async previewSmartTag($){return Q(await this.client.storage.previewSmartTag({body:$}))}async updateSmartTag($,O,j){return Q(await this.client.storage.renameChannelLabel({path:{label_id:$.id},body:{name:O,rule:j}}))}async rename($,O){return Q(await this.client.storage.renameChannelLabel({path:{label_id:$.id},body:{name:O}}))}async delete($){Q(await this.client.storage.deleteChannelLabel({path:{label_id:$.id}}))}async setLabel($,O){Q(await this.client.storage.setChannelLabel({path:{channel_id:$.id},body:{labelId:O?.id??null}}))}}class hx{client;async activity(){return Q(await this.client.storage.getActivity()).map(($)=>new ZO(this.client,f.byId(this.client,$.channel_id),$))}labels;constructor($){this.client=$;this.labels=new vx($)}byId($){return f.byId(this.client,$)}async dm($){return f.dm(this.client,$)}async private($){return f.private(this.client,$)}async create($){return f.create(this.client,$)}async list(){let{items:$}=Q(await this.client.storage.getChannels());return $.map((O)=>f.byId(this.client,O.id.toString()))}async*search($,O){if(!O?.searchOn||O.searchOn==="name"){let{items:j}=Q(await this.client.storage.getChannels()),x=$.toLowerCase();for(let S of j)if(S.name?.toLowerCase().includes(x))yield f.byId(this.client,S.id.toString())}else yield*f.search(this.client,$,O)}}class n extends S${async sharePermissions(){return Q(await this.client.storage.getProjectPermissionsV2({path:{id:this.id}}))}async accessLevel(){return Q(await this.client.storage.getProjectUserAccessLevel({path:{id:this.id}}))}access=new o(this.client,"project",this);entityType="project";propertyEntityType="PROJECT";async fetch(){let{data:$}=Q(await this.client.storage.getProjectHandler({path:{id:this.id}}));return $.projectMetadata}static byId($,O){return new n($,O)}static async create($,O){let{data:j}=Q(await $.storage.createProjectHandler({body:{name:O.name,projectParentId:O.parent?.id??null}}));return new n($,j.id,j)}name=this.field("name");parent=this.mappedField("parentId",($)=>$?n.byId(this.client,$):void 0);createdAt=this.field("createdAt");async items(){let{data:$}=Q(await this.client.storage.getProjectContentHandler({path:{id:this.id}}));return $.map((O)=>O.item)}async rename($){await this.mutate((O)=>O.storage.editProjectV2({path:{id:this.id},body:{name:$}}))}async delete($){await this.mutate((O)=>$?.permanent?O.storage.permanentlyDeleteProject({path:{id:this.id}}):O.storage.deleteProjectHandler({path:{id:this.id}}))}async restore(){await this.mutate(($)=>$.storage.revertDeleteProject({path:{id:this.id}}))}static search=j$({filters:{project_filters:{}},type:"project",make:($,O)=>new n($,O.id)})}class hO{client;chat;id;message;constructor($,O,j,x){this.client=$;this.chat=O;this.id=j;this.message=x}static byId($,O,j,x){return new hO($,O,j,x)}async stop(){Q(await this.client.cognition.stopChatStream({body:{chat_id:this.chat.id,stream_id:this.id}}))}toJSON(){return{id:this.id,chatId:this.chat.id,messageId:this.message.id}}}class mO extends A{chat;constructor($,O,j){super($,j);this.chat=O}static byId($,O,j){return new mO($,O,j)}async fetch(){let $=Q(await this.client.cognition.getChat({path:{chat_id:this.chat.id}})).chat.messages.find((O)=>O.id===this.id);if(!$)throw new w(`Chat message ${this.id} is not yet available`);return $}content=this.field("content");role=this.field("role");async refresh(){this.detail.clear(),await this.detail.get()}toJSON(){return{...super.toJSON(),chatId:this.chat.id}}}class Z$ extends S${async send($){let{attachments:O,additionalInstructions:j,...x}=$,S=await this.mutate((Z)=>Z.cognition.sendChatMessage({body:{...x,chat_id:this.id,additional_instructions:j,attachments:O?.map((X)=>({entity_id:X.entity.id,entity_type:X.type}))}})),K=Z$.byId(this.client,S.chat_id);return hO.byId(this.client,K,S.stream_id,mO.byId(this.client,K,S.message_id))}access=new o(this.client,"chat",this);entityType="chat";propertyEntityType="CHAT";async fetch(){let{chat:$}=Q(await this.client.cognition.getChat({path:{chat_id:this.id}}));return $}static byId($,O){return new Z$($,O)}static async create($,O){let{id:j}=Q(await $.cognition.createChat({body:{name:O?.name??null,projectId:O?.project?.id??null}}));return new Z$($,j)}name=this.field("name");model=this.field("model");project=this.mappedField("projectId",($)=>$?n.byId(this.client,$):void 0);createdAt=this.field("createdAt");updatedAt=this.field("updatedAt");messages=this.field("messages");async rename($){await this.mutate((O)=>O.cognition.patchChat({path:{chat_id:this.id},body:{name:$}}))}async delete($){await this.mutate((O)=>$?.permanent?O.cognition.permanentlyDeleteChat({path:{chat_id:this.id}}):O.cognition.deleteChat({path:{chat_id:this.id}}))}async copy(){let{id:$}=await this.mutate((O)=>O.cognition.copyChat({path:{chat_id:this.id}}));return new Z$(this.client,$)}async restore(){await this.mutate(($)=>$.cognition.revertDeleteChat({path:{chat_id:this.id}}))}async history(){let{conversation:$}=Q(await this.client.cognition.getChatHistoryHandler({path:{chat_id:this.id}}));return $}webUrl(){return`${this.client.webAppUrl}/app/chat/${this.id}`}static search=j$({filters:{chat_filters:{}},type:"chat",make:($,O)=>new Z$($,O.chat_id)});toMention(){return{tag:l$("m-document-mention",{documentId:this.id,documentName:this.detail.peek()?.name??"",blockName:"chat",blockParams:{}}),mention:{entity_type:"chat",entity_id:this.id}}}}class mx{client;constructor($){this.client=$}byId($){return Z$.byId(this.client,$)}create($){return Z$.create(this.client,$)}search($,O){return Z$.search(this.client,$,O)}}class T$ extends A{async fetch(){let O=Q(await this.client.auth.getUserTeams()).find((j)=>j.id===this.id);if(!O)throw new w(`team ${this.id} not found`);return O}static byId($,O){return new T$($,O)}static async current($){let O=Q(await $.auth.getTeam());if(!O)throw new w("caller has no current team");return new T$($,O.team.id,O.team)}static async list($){return Q(await $.auth.getUserTeams()).map((j)=>new T$($,j.id,j))}name=this.field("name");slug=this.field("slug");defaultLinkShare=this.field("default_link_share");owner=this.mappedField("owner_id",($)=>M.byId(this.client,$));async members(){let $=Q(await this.client.auth.getTeam());if(!$||$.team.id!==this.id)throw new b("members are only available for the current team (see Team.current)");return $.members.map((O)=>({user:M.byId(this.client,O.user_id),role:O.role}))}}var E6=8;class _$ extends A{parent;constructor($,O,j,x){super($,j,x);this.parent=O}get path(){return{parent_type:this.parent.type,parent_id:this.parent.id,id:this.id}}async fetch(){return Q(await this.client.storage.entityMessageGetMessage({path:this.path}))}static byId($,O,j){return new _$($,O,j)}static from($,O,j){return new _$($,O,j.id,j)}text=this.field("content");createdAt=this.field("created_at");updatedAt=this.field("updated_at");deletedAt=this.field("deleted_at");async threadId(){return(await this.detail.get()).thread_id??this.id}async author(){return M.byId(this.client,(await this.detail.get()).sender_id)}async reply($){return cO(this.client,this.parent,$,{threadId:await this.threadId()})}async edit($){let{content:O,mentions:j}=$$($);return await this.mutate((x)=>x.storage.entityMessageEdit({path:this.path,body:{content:O,mentions:j}})),this}async delete(){await this.mutate(($)=>$.storage.entityMessageDeleteMessage({path:this.path}))}}async function Yj($,O){let j={parent_type:O.type,parent_id:O.id},x=a(async(K)=>{let Z=Q(await $.storage.messageTimeline({path:j,query:{selection:JSON.stringify({limit:100,cursor:K})}}));return{items:Z.items,nextCursor:Z.next_cursor}}),S=[];for await(let K of x)S.push(K);return bO(S,E6,async(K)=>{let{state:Z,root:X,replies:G}=Q(await $.storage.entityMessageGetThread({path:{...j,id:K.id}}));return{thread:Z,comments:[X,...G].map((L)=>_$.from($,O,L))}})}async function cO($,O,j,x){let S=Q(await $.storage.entityMessageCreate({path:{parent_type:O.type,parent_id:O.id},body:{...$$(j),thread_id:x?.threadId??null}}));return _$.from($,O,S)}class w$ extends F${messageThreadById($){return W$.byId(this.client,{type:"crm_contact",entity:this},$)}timelinePage($){return E$(this.client,{type:"crm_contact",entity:this},(O)=>_$.from(this.client,{type:"crm_contact",id:this.id},O),$)}entityType="crm_contact";async fetch(){return Q(await this.client.storage.getContact({path:{contact_id:this.id}}))}static byId($,O){return new w$($,O)}static from($,O){return new w$($,O.id,O)}name=this.field("name");email=this.field("email");company=this.mappedField("companyId",($)=>q$.byId(this.client,$));hidden=this.field("hidden");createdAt=this.field("createdAt");updatedAt=this.field("updatedAt");firstInteraction=this.field("firstInteraction");lastInteraction=this.field("lastInteraction");async hide(){await this.setHidden(!0)}async unhide(){await this.setHidden(!1)}async setHidden($){await this.mutate((O)=>O.storage.setContactHidden({path:{contact_id:this.id},body:{hidden:$}}))}async rename($){await this.mutate((O)=>O.storage.setCrmContactName({path:{contact_id:this.id},body:{name:$}}))}get commentParent(){return{type:"crm_contact",id:this.id}}async comments(){return Yj(this.client,this.commentParent)}async comment($,O){return cO(this.client,this.commentParent,$,O)}commentById($){return _$.byId(this.client,this.commentParent,$)}}class q$ extends S${messageThreadById($){return W$.byId(this.client,{type:"crm_company",entity:this},$)}timelinePage($){return E$(this.client,{type:"crm_company",entity:this},(O)=>_$.from(this.client,{type:"crm_company",id:this.id},O),$)}entityType="crm_company";propertyEntityType="COMPANY";async fetch(){return Q(await this.client.storage.getCompany({path:{company_id:this.id}}))}static byId($,O){return new q$($,O)}static from($,O){return new q$($,O.id,O)}name=this.field("name");description=this.field("description");hidden=this.field("hidden");emailSync=this.field("emailSync");team=this.mappedField("teamId",($)=>T$.byId(this.client,$));createdAt=this.field("createdAt");updatedAt=this.field("updatedAt");async domain(){let{domains:$}=await this.detail.get();return $[0]?.domain}async domains(){let{domains:$}=await this.detail.get();return $.map((O)=>O.domain)}async contacts(){return Q(await this.client.storage.listCompanyContacts({path:{company_id:this.id}})).map((O)=>w$.from(this.client,O))}static search=j$({filters:{crm_company_filters:{}},type:"company",includeCrm:!0,make:($,O)=>new q$($,O.id)});async hide(){await this.setHidden(!0)}async unhide(){await this.setHidden(!1)}async setHidden($){await this.mutate((O)=>O.storage.setCompanyHidden({path:{company_id:this.id},body:{hidden:$}}))}async setEmailSync($){await this.mutate((O)=>O.storage.setEmailSync({path:{company_id:this.id},body:{email_sync:$}}))}async rename($){await this.mutate((O)=>O.storage.setCrmCompanyName({path:{company_id:this.id},body:{name:$}}))}async createContact($){let O=await this.mutate((j)=>j.storage.createCrmContact({path:{company_id:this.id},body:$}));return w$.from(this.client,O)}get commentParent(){return{type:"crm_company",id:this.id}}async comments(){return Yj(this.client,this.commentParent)}async comment($,O){return cO(this.client,this.commentParent,$,O)}commentById($){return _$.byId(this.client,this.commentParent,$)}}class a$ extends A{tableDetail=new J$(async()=>Q(await this.client.storage.getCrmPipelineTable({path:{id:this.id}})));static byId($,O){return new a$($,O)}static from($,O){return new a$($,O.id,O)}async fetch(){return Q(await this.client.storage.getCrmPipeline({path:{id:this.id}}))}name=this.field("name");recordType=this.field("recordType");accessLevel=this.field("grant");sharing=this.field("sharing");owner=this.mappedField("userId",($)=>M.byId(this.client,$));team=this.mappedField("teamId",($)=>T$.byId(this.client,$));async rename($){await this.mutate((O)=>O.storage.renameCrmPipeline({path:{id:this.id},body:{name:$}}))}async setSharing($){if($===void 0)throw Error("Sharing is required");await this.mutate((O)=>O.storage.shareCrmPipeline({path:{id:this.id},body:{sharing:$}}))}async setTrashed($){await this.mutate((O)=>O.storage.trashCrmPipeline({path:{id:this.id},body:{trashed:$}}))}async sharePermissions(){return Q(await this.client.storage.getCrmPipelinePermissions({path:{id:this.id}}))}async updateSharePermissions($){return this.mutate((O)=>O.storage.updateCrmPipelinePermissions({path:{id:this.id},body:r$($)}))}async table(){return Qj.from(this.client,this,await this.tableRecord())}tableRecord(){return this.tableDetail.get()}rows(){return a(async($)=>{let O=Q(await this.client.storage.getCrmPipelineRows({path:{id:this.id},query:{after:$}}));return{items:O.rows.map((j)=>XO.from(this.client,this,j)),nextCursor:O.next}})}queryRows($={}){if($.rows?.some((O)=>O.pipeline.id!==this.id))throw Error("Rows belong to another pipeline");return a(async(O)=>{let j=Q(await this.client.storage.queryCrmPipelineRows({path:{id:this.id},body:{after:O,query:$.query,rowIds:$.rows?.map((x)=>x.id)}}));return{items:j.rows.map((x)=>XO.from(this.client,this,x)),nextCursor:j.next}})}async applyOps($,O){if(O?.baseVersions?.some((S)=>S.table.pipeline.id!==this.id))throw Error("Table belongs to another pipeline");let j={ops:$,baseVersions:O?.baseVersions?Object.fromEntries(O.baseVersions.map((S)=>[S.table.id,S.version])):void 0},x=await this.mutate((S)=>S.storage.applyCrmPipelineOps({path:{id:this.id},body:j}));return this.tableDetail.clear(),x}}class Qj extends A{pipeline;toJSON(){return{...super.toJSON(),pipelineId:this.pipeline.id}}constructor($,O,j){super($,j.table.id,j);this.pipeline=O}static from($,O,j){return new Qj($,O,j)}fetch(){return this.pipeline.tableRecord()}async columns(){return(await this.pipeline.tableRecord()).columns.map(($)=>Jj.from(this.client,this,$))}async version(){return(await this.pipeline.tableRecord()).table.version}rowById($){return XO.byId(this.client,this.pipeline,$)}rows(){return this.pipeline.rows()}}class XO extends A{pipeline;toJSON(){return{...super.toJSON(),pipelineId:this.pipeline.id}}constructor($,O,j,x){super($,j,x);this.pipeline=O}static byId($,O,j){return new XO($,O,j)}static from($,O,j){return new XO($,O,j.rowId,j)}async fetch(){for await(let $ of this.pipeline.queryRows({rows:[this]}))if($.id===this.id)return $.detail.get();throw new w(`Pipeline row ${this.id} is unavailable`)}cells=this.field("cells");async refresh(){this.detail.clear(),await this.detail.get()}}class Jj extends A{table;toJSON(){return{...super.toJSON(),pipelineId:this.table.pipeline.id,tableId:this.table.id}}constructor($,O,j){super($,j.column.id,j);this.table=O}static from($,O,j){return new Jj($,O,j)}async fetch(){let $=(await this.table.pipeline.tableRecord()).columns.find((O)=>O.column.id===this.id);if(!$)throw new w(`Pipeline column ${this.id} is unavailable`);return $}async writable(){return(await this.fetch()).writable}async name(){return(await this.fetch()).column.display_name??(await this.fetch()).definition.definition.display_name}}class cx{client;constructor($){this.client=$}byId($){return a$.byId(this.client,$)}async list(){return Q(await this.client.storage.listCrmPipelines()).map(($)=>a$.from(this.client,$))}async create($){return a$.from(this.client,Q(await this.client.storage.createCrmPipeline({body:$})))}}class ux{client;pipelines;constructor($){this.client=$;this.pipelines=new cx($)}companyById($){return q$.byId(this.client,$)}contactById($){return w$.byId(this.client,$)}async contactByEmail($){let{contact:O}=Q(await this.client.storage.getContactByEmail({query:{email:$}}));return O?w$.from(this.client,O):void 0}async searchContacts($,O={}){let{contacts:j}=Q(await this.client.storage.searchContacts({query:{query:$,limit:O.limit}}));return j.map((x)=>w$.from(this.client,x))}async createCompany($){return q$.from(this.client,Q(await this.client.storage.createCrmCompany({body:$})))}async settings(){return Q(await this.client.storage.getCrmTeamSettings())}async updateSettings($){return Q(await this.client.storage.putCrmTeamSettings({body:$}))}async setStages($){return Q(await this.client.storage.putCrmTeamStages({body:$}))}async resetStages(){Q(await this.client.storage.resetCrmTeamStages())}searchCompanies($){return q$.search(this.client,$)}}var G$=Symbol.for("@ts-pattern/matcher"),P1=Symbol.for("@ts-pattern/isVariadic");var dx=($)=>Boolean($&&typeof $=="object"),Vj=($)=>$&&!!$[G$],s=($,O,j)=>{if(Vj($)){let x=$[G$](),{matched:S,selections:K}=x.match(O);return S&&K&&Object.keys(K).forEach((Z)=>j(Z,K[Z])),S}if(dx($)){if(!dx(O))return!1;if(Array.isArray($)){if(!Array.isArray(O))return!1;let x=[],S=[],K=[];for(let Z of $.keys()){let X=$[Z];Vj(X)&&X[P1]?K.push(X):K.length?S.push(X):x.push(X)}if(K.length){if(K.length>1)throw Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(O.length<x.length+S.length)return!1;let Z=O.slice(0,x.length),X=S.length===0?[]:O.slice(-S.length),G=O.slice(x.length,S.length===0?1/0:-S.length);return x.every((L,Y)=>s(L,Z[Y],j))&&S.every((L,Y)=>s(L,X[Y],j))&&(K.length===0||s(K[0],G,j))}return $.length===O.length&&$.every((Z,X)=>s(Z,O[X],j))}return Reflect.ownKeys($).every((x)=>{let S=$[x];return((x in O)||Vj(K=S)&&K[G$]().matcherType==="optional")&&s(S,O[x],j);var K})}return Object.is(O,$)},X$=($)=>{var O,j,x;return dx($)?Vj($)?(O=(j=(x=$[G$]()).getSelectionKeys)==null?void 0:j.call(x))!=null?O:[]:Array.isArray($)?uO($,X$):uO(Object.values($),X$):[]},uO=($,O)=>$.reduce((j,x)=>j.concat(O(x)),[]);function w6(...$){if($.length===1){let[O]=$;return(j)=>s(O,j,()=>{})}if($.length===2){let[O,j]=$;return s(O,j,()=>{})}throw Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${$.length}.`)}function t($){return Object.assign($,{optional:()=>px($),and:(O)=>u($,O),or:(O)=>F1($,O),select:(O)=>O===void 0?dO($):dO(O,$)})}function lx($){return Object.assign(((O)=>Object.assign(O,{[Symbol.iterator](){let j=0,x=[{value:Object.assign(O,{[P1]:!0}),done:!1},{done:!0,value:void 0}];return{next:()=>{var S;return(S=x[j++])!=null?S:x.at(-1)}}}}))($),{optional:()=>lx(px($)),select:(O)=>lx(O===void 0?dO($):dO(O,$))})}function px($){return t({[G$]:()=>({match:(O)=>{let j={},x=(S,K)=>{j[S]=K};return O===void 0?(X$($).forEach((S)=>x(S,void 0)),{matched:!0,selections:j}):{matched:s($,O,x),selections:j}},getSelectionKeys:()=>X$($),matcherType:"optional"})})}var q6=($,O)=>{for(let j of $)if(!O(j))return!1;return!0},f6=($,O)=>{for(let[j,x]of $.entries())if(!O(x,j))return!1;return!0},b6=($,O)=>{let j=Reflect.ownKeys($);for(let x of j)if(!O(x,$[x]))return!1;return!0};function u(...$){return t({[G$]:()=>({match:(O)=>{let j={},x=(S,K)=>{j[S]=K};return{matched:$.every((S)=>s(S,O,x)),selections:j}},getSelectionKeys:()=>uO($,X$),matcherType:"and"})})}function F1(...$){return t({[G$]:()=>({match:(O)=>{let j={},x=(S,K)=>{j[S]=K};return uO($,X$).forEach((S)=>x(S,void 0)),{matched:$.some((S)=>s(S,O,x)),selections:j}},getSelectionKeys:()=>uO($,X$),matcherType:"or"})})}function m($){return{[G$]:()=>({match:(O)=>({matched:Boolean($(O))})})}}function dO(...$){let O=typeof $[0]=="string"?$[0]:void 0,j=$.length===2?$[1]:typeof $[0]=="string"?void 0:$[0];return t({[G$]:()=>({match:(x)=>{let S={[O!=null?O:"@ts-pattern/anonymous-select-key"]:x};return{matched:j===void 0||s(j,x,(K,Z)=>{S[K]=Z}),selections:S}},getSelectionKeys:()=>[O!=null?O:"@ts-pattern/anonymous-select-key"].concat(j===void 0?[]:X$(j))})})}function E1($){return!0}function f$($){return typeof $=="number"}function i$($){return typeof $=="string"}function n$($){return typeof $=="bigint"}var w1=t(m(E1)),k6=t(m(E1)),g6=w1,s$=($)=>Object.assign(t($),{startsWith:(O)=>{return s$(u($,(j=O,m((x)=>i$(x)&&x.startsWith(j)))));var j},endsWith:(O)=>{return s$(u($,(j=O,m((x)=>i$(x)&&x.endsWith(j)))));var j},minLength:(O)=>s$(u($,((j)=>m((x)=>i$(x)&&x.length>=j))(O))),length:(O)=>s$(u($,((j)=>m((x)=>i$(x)&&x.length===j))(O))),maxLength:(O)=>s$(u($,((j)=>m((x)=>i$(x)&&x.length<=j))(O))),includes:(O)=>{return s$(u($,(j=O,m((x)=>i$(x)&&x.includes(j)))));var j},regex:(O)=>{return s$(u($,(j=O,m((x)=>i$(x)&&Boolean(x.match(j))))));var j}}),A1=s$(m(i$)),b$=($)=>Object.assign(t($),{between:(O,j)=>b$(u($,((x,S)=>m((K)=>f$(K)&&x<=K&&S>=K))(O,j))),lt:(O)=>b$(u($,((j)=>m((x)=>f$(x)&&x<j))(O))),gt:(O)=>b$(u($,((j)=>m((x)=>f$(x)&&x>j))(O))),lte:(O)=>b$(u($,((j)=>m((x)=>f$(x)&&x<=j))(O))),gte:(O)=>b$(u($,((j)=>m((x)=>f$(x)&&x>=j))(O))),int:()=>b$(u($,m((O)=>f$(O)&&Number.isInteger(O)))),finite:()=>b$(u($,m((O)=>f$(O)&&Number.isFinite(O)))),positive:()=>b$(u($,m((O)=>f$(O)&&O>0))),negative:()=>b$(u($,m((O)=>f$(O)&&O<0)))}),y6=b$(m(f$)),t$=($)=>Object.assign(t($),{between:(O,j)=>t$(u($,((x,S)=>m((K)=>n$(K)&&x<=K&&S>=K))(O,j))),lt:(O)=>t$(u($,((j)=>m((x)=>n$(x)&&x<j))(O))),gt:(O)=>t$(u($,((j)=>m((x)=>n$(x)&&x>j))(O))),lte:(O)=>t$(u($,((j)=>m((x)=>n$(x)&&x<=j))(O))),gte:(O)=>t$(u($,((j)=>m((x)=>n$(x)&&x>=j))(O))),positive:()=>t$(u($,m((O)=>n$(O)&&O>0))),negative:()=>t$(u($,m((O)=>n$(O)&&O<0)))}),v6=t$(m(n$)),h6=t(m(function($){return typeof $=="boolean"})),m6=t(m(function($){return typeof $=="symbol"})),c6=t(m(function($){return $==null})),u6=t(m(function($){return $!=null})),x$={__proto__:null,matcher:G$,optional:px,array:function(...$){return lx({[G$]:()=>({match:(O)=>{if(!Array.isArray(O))return{matched:!1};if($.length===0)return{matched:!0};let j=$[0],x={};if(O.length===0)return X$(j).forEach((K)=>{x[K]=[]}),{matched:!0,selections:x};let S=(K,Z)=>{x[K]=(x[K]||[]).concat([Z])};return{matched:O.every((K)=>s(j,K,S)),selections:x}},getSelectionKeys:()=>$.length===0?[]:X$($[0])})})},set:function(...$){return t({[G$]:()=>({match:(O)=>{if(!(O instanceof Set))return{matched:!1};let j={};if(O.size===0)return{matched:!0,selections:j};if($.length===0)return{matched:!0};let x=(K,Z)=>{j[K]=(j[K]||[]).concat([Z])},S=$[0];return{matched:q6(O,(K)=>s(S,K,x)),selections:j}},getSelectionKeys:()=>$.length===0?[]:X$($[0])})})},map:function(...$){return t({[G$]:()=>({match:(O)=>{if(!(O instanceof Map))return{matched:!1};let j={};if(O.size===0)return{matched:!0,selections:j};let x=(X,G)=>{j[X]=(j[X]||[]).concat([G])};if($.length===0)return{matched:!0};var S;if($.length===1)throw Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(S=$[0])==null?void 0:S.toString()}`);let[K,Z]=$;return{matched:f6(O,(X,G)=>{let L=s(K,G,x),Y=s(Z,X,x);return L&&Y}),selections:j}},getSelectionKeys:()=>$.length===0?[]:[...X$($[0]),...X$($[1])]})})},record:function(...$){return t({[G$]:()=>({match:(O)=>{if(O===null||typeof O!="object"||Array.isArray(O))return{matched:!1};var j;if($.length===0)throw Error(`\`P.record\` wasn't given enough arguments. Expected (value) or (key, value), received ${(j=$[0])==null?void 0:j.toString()}`);let x={},S=(X,G)=>{x[X]=(x[X]||[]).concat([G])},[K,Z]=$.length===1?[A1,$[0]]:$;return{matched:b6(O,(X,G)=>{let L=typeof X!="string"||Number.isNaN(Number(X))?null:Number(X),Y=L!==null&&s(K,L,S),J=s(K,X,S),T=s(Z,G,S);return(J||Y)&&T}),selections:x}},getSelectionKeys:()=>$.length===0?[]:[...X$($[0]),...X$($[1])]})})},intersection:u,union:F1,not:function($){return t({[G$]:()=>({match:(O)=>({matched:!s($,O,()=>{})}),getSelectionKeys:()=>[],matcherType:"not"})})},when:m,select:dO,any:w1,unknown:k6,_:g6,string:A1,number:y6,bigint:v6,boolean:h6,symbol:m6,nullish:c6,nonNullable:u6,instanceOf:function($){return t(m(function(O){return(j)=>j instanceof O}($)))},shape:function($){return t(m(w6($)))}};class q1 extends Error{constructor($){let O;try{O=JSON.stringify($)}catch(j){O=$}super(`Pattern matching error: no pattern matches value ${O}`),this.input=void 0,this.input=$}}var rx={matched:!1,value:void 0};function c($){return new Wj($,rx)}class Wj{constructor($,O){this.input=void 0,this.state=void 0,this.input=$,this.state=O}with(...$){if(this.state.matched)return this;let O=$[$.length-1],j=[$[0]],x;$.length===3&&typeof $[1]=="function"?x=$[1]:$.length>2&&j.push(...$.slice(1,$.length-1));let S=!1,K={},Z=(G,L)=>{S=!0,K[G]=L},X=!j.some((G)=>s(G,this.input,Z))||x&&!Boolean(x(this.input))?rx:{matched:!0,value:O(S?"@ts-pattern/anonymous-select-key"in K?K["@ts-pattern/anonymous-select-key"]:K:this.input,this.input)};return new Wj(this.input,X)}when($,O){if(this.state.matched)return this;let j=Boolean($(this.input));return new Wj(this.input,j?{matched:!0,value:O(this.input,this.input)}:rx)}otherwise($){return this.state.matched?this.state.value:$(this.input)}exhaustive($=d6){return this.state.matched?this.state.value:$(this.input)}run(){return this.exhaustive()}returnType(){return this}narrow(){return this}}function d6($){throw new q1($)}var ax,l6=new Uint8Array(16);function Bj(){if(!ax){if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ax=crypto.getRandomValues.bind(crypto)}return ax(l6)}var O$=[];for(let $=0;$<256;++$)O$.push(($+256).toString(16).slice(1));function f1($,O=0){return(O$[$[O+0]]+O$[$[O+1]]+O$[$[O+2]]+O$[$[O+3]]+"-"+O$[$[O+4]]+O$[$[O+5]]+"-"+O$[$[O+6]]+O$[$[O+7]]+"-"+O$[$[O+8]]+O$[$[O+9]]+"-"+O$[$[O+10]]+O$[$[O+11]]+O$[$[O+12]]+O$[$[O+13]]+O$[$[O+14]]+O$[$[O+15]]).toLowerCase()}var ix={};function r6($,O,j){let x;if($)x=b1($.random??$.rng?.()??Bj(),$.msecs,$.seq,O,j);else{let S=Date.now(),K=Bj();p6(ix,S,K),x=b1(K,ix.msecs,ix.seq,O,j)}return O??f1(x)}function p6($,O,j){if($.msecs??=-1/0,$.seq??=0,O>$.msecs)$.seq=j[6]<<23|j[7]<<16|j[8]<<8|j[9],$.msecs=O;else if($.seq=$.seq+1|0,$.seq===0)$.msecs++;return $}function b1($,O,j,x,S=0){if($.length<16)throw Error("Random bytes length must be >= 16");if(!x)x=new Uint8Array(16),S=0;else if(S<0||S+16>x.length)throw RangeError(`UUID byte range ${S}:${S+15} is out of buffer bounds`);return O??=Date.now(),j??=$[6]*127<<24|$[7]<<16|$[8]<<8|$[9],x[S++]=O/1099511627776&255,x[S++]=O/4294967296&255,x[S++]=O/16777216&255,x[S++]=O/65536&255,x[S++]=O/256&255,x[S++]=O&255,x[S++]=112|j>>>28&15,x[S++]=j>>>20&255,x[S++]=128|j>>>14&63,x[S++]=j>>>6&255,x[S++]=j<<2&255|$[10]&3,x[S++]=$[11],x[S++]=$[12],x[S++]=$[13],x[S++]=$[14],x[S++]=$[15],x}var h$=r6;class M${table;id;constructor($,O){this.table=$;this.id=O}static byId($,O){return new M$($,O)}async detail(){let{columns:$}=await this.table.detail(),O=$.find((j)=>j.column.id===this.id);if(!O)throw new w(`column ${this.id} is not on table ${this.table.id}`);return O}async name(){let $=await this.detail();return $.column.display_name??$.definition.definition.display_name}async rename($){return await this.table.database.renameColumn(this,$),this}async inferType($){return await this.table.database.inferColumnType(this,$),this}changeType($){return this.table.database.changeColumnType(this,$)}convertIntoNewColumn($){return this.table.database.convertColumnIntoNewColumn(this,$)}casts(){return this.table.database.columnCasts(this)}async delete(){await this.table.database.deleteColumn(this)}async dataType(){return(await this.detail()).definition.definition.data_type}async isMultiSelect(){return(await this.detail()).definition.definition.is_multi_select}async position(){return(await this.detail()).column.position}async definition(){return(await this.detail()).definition}async config(){return(await this.detail()).column.config??void 0}async addOptions($){return await this.table.database.addColumnOptions(this,$),this}toJSON(){return{id:this.id,tableId:this.table.id}}}class A${table;id;constructor($,O){this.table=$;this.id=O}static byId($,O){return new A$($,O)}history(){return this.table.database.rowHistory(this)}toJSON(){return{id:this.id,tableId:this.table.id}}}class Lj{table;id;constructor($,O){this.table=$;this.id=O}static byId($,O){return new Lj($,O)}async detail(){let{views:$}=await this.table.detail(),O=$.find((j)=>j.id===this.id);if(!O)throw new w(`view ${this.id} is not on table ${this.table.id}`);return O}async name(){return(await this.detail()).name}async position(){return(await this.detail()).position}async layout(){return(await this.detail()).layout}async query(){return(await this.detail()).query}positions(){return this.table.database.viewPositions(this)}toJSON(){return{id:this.id,tableId:this.table.id}}}class Y${database;id;constructor($,O){this.database=$;this.id=O}static byId($,O){return new Y$($,O)}async detail(){let{tables:$}=await this.database.schema(),O=$.find((j)=>j.table.id===this.id);if(!O)throw new w(`table ${this.id} is not in database ${this.database.id}`);return O}async name(){return(await this.detail()).table.name}async rename($){return await this.database.renameTable(this,$),this}async version(){return(await this.detail()).table.version}async position(){return(await this.detail()).table.position}async columns(){let{columns:$}=await this.detail();return $.map((O)=>M$.byId(this,O.column.id))}addColumn($){return this.database.addColumn(this,$)}async reorderColumns($){return await this.database.reorderColumns(this,$),this}row($){return A$.byId(this,$)}async views(){let{views:$}=await this.detail();return $.map((O)=>Lj.byId(this,O.id))}createWebhook(){return this.database.createWebhook(this)}async delete(){await this.database.deleteTable(this)}toJSON(){return{id:this.id,databaseId:this.database.id}}}async function Nj($,O,j,x={}){let S=Q(await $.storage.queryDatabases({body:{sql:j,databaseId:x.database?.id,baseVersions:Object.fromEntries((x.baseVersions??[]).map(({table:Y,version:J})=>[Y.id,J]))}})),K=new Map;for(let Y of[x.database,...(x.baseVersions??[]).map(({table:J})=>J.database)]){if(!Y)continue;let J=K.get(Y.id);if(J)J.add(Y);else K.set(Y.id,new Set([Y]))}let Z=(Y)=>{let J=K.get(Y)?.values().next().value;if(J)return J;let T=O($,Y);return K.set(Y,new Set([T])),T},X=(Y)=>{let J=S.tableDatabases[Y];if(!J)throw Error(`SQL response is missing the owner of table ${Y}`);return Y$.byId(Z(J),Y)},G=new Set(Object.keys(S.newVersions).map((Y)=>X(Y).database.id));if(S.statement.kind==="schema")G.add(S.statement.databaseId);for(let Y of G)for(let J of K.get(Y)??[])J.invalidateSchema();let L=c(S.statement).with({kind:"select"},(Y)=>Y).with({kind:"schema"},({databaseId:Y,summary:J})=>({kind:"schema",database:Z(Y),summary:J})).with({kind:"insert"},{kind:"update"},{kind:"delete"},({kind:Y,tableId:J,tableName:T})=>({kind:Y,table:X(J),tableName:T})).with({kind:"alterColumnType"},({tableId:Y,tableName:J,columnId:T,columnName:z,to:W})=>{let V=X(Y);return{kind:"alterColumnType",table:V,tableName:J,column:M$.byId(V,T),columnName:z,to:W}}).exhaustive();return{result:S.result?a6(S.result,X,S.tableDatabases):void 0,changesApplied:S.changesApplied,insertedRows:L.kind==="insert"?S.insertedRowIds.map((Y)=>A$.byId(L.table,Y)):[],newVersions:Object.entries(S.newVersions).map(([Y,J])=>({table:X(Y),version:J})),readVersions:Object.entries(S.readVersions).map(([Y,J])=>({table:X(Y),version:J})),truncatedTables:S.truncatedTables,statement:L}}function a6($,O,j){let x=$.sourceTable&&j[$.sourceTable]?O($.sourceTable):void 0;return{columns:$.columns.map(({relatedTable:S,...K})=>({...K,relatedTable:S&&j[S]?O(S):void 0})),rows:$.rows,sourceTable:x,rowHandles:x?$.rowIds.map((S)=>A$.byId(x,S)):[]}}class Uj{table;id;createdBy;record;constructor($,O,j,x){this.table=$;this.id=O;this.createdBy=j;this.record=x}static fromRecord($,O,j){return new Uj($,j.id,O,j)}get tokenPrefix(){return this.record.tokenPrefix}get createdAt(){return this.record.createdAt}delete(){return this.table.database.deleteWebhook(this)}toJSON(){return{id:this.id,tableId:this.table.id,tokenPrefix:this.tokenPrefix}}}class tx extends SO{op;row;column;taken;constructor($,O){super($,O);this.name="MacroOpRefusedError",this.message=O.message,this.op=O.op,this.row=O.row,this.column=O.column,this.taken=O.taken}}function zj($){return c($).with({type:"relation"},({table:O})=>({type:"relation",database:O.database.id,table:O.id})).with({type:x$.not("relation")},(O)=>O).exhaustive()}var i6={USER:"People",DOCUMENT:"Documents",TASK:"Tasks",COMPANY:"Companies",CONTACT:"Contacts",CALL_RECORD:"Calls",CHANNEL:"Channels",CHAT:"Chats",PROJECT:"Projects",THREAD:"Emails",CALENDAR_EVENT:"Events",INITIATIVE:"Initiatives"};function n6($){return c($).with({type:"text"},()=>"Text").with({type:"number"},()=>"Number").with({type:"boolean"},()=>"Checkbox").with({type:"date"},()=>"Date").with({type:"link"},()=>"URL").with({type:"select",multi:!0},()=>"Multi-select").with({type:"select",multi:!1},()=>"Select").with({type:"select_number",multi:!0},()=>"Multi-number select").with({type:"select_number",multi:!1},()=>"Number select").with({type:"tag"},()=>"Tag").with({type:"entity"},({target:O})=>i6[O]).with({type:"relation"},()=>"Relation").exhaustive(()=>"Column")}function nx($){return $.map((O)=>({id:h$(),label:O}))}function k1($,O,j){return $?.kind===O&&"change"in $&&$.change.kind===j}function sx($){return c($).with({kind:"reorder_tables"},({kind:O})=>O).with({kind:x$.union("table","column","rows","view")},({kind:O,change:j})=>`${O}.${j.kind}`).exhaustive(()=>"unknown")}function m$($,O,j){let[x]=$;if($.length!==1||!k1(x,O,j))throw new b(`expected one ${O}.${j} result, got ${$.map(sx).join(", ")||"none"}`);return x}class Q$ extends A{access=new o(this.client,"database",this);async fetch(){return Q(await this.client.storage.getDatabase({path:{id:this.id}}))}assertOwns($,O){if(O.id!==this.id)throw new b(`${$} does not belong to database ${this.id}`)}static byId($,O){return new Q$($,O)}static async create($,O){let j=Q(await $.storage.createDatabase({body:{name:O.name}}));return new Q$($,j.id)}static async list($){return Q(await $.storage.listDatabases()).map((j)=>new Q$($,j.database.id))}query($,O){return Nj(this.client,Q$.byId,$,{...O,database:this})}invalidateSchema(){this.detail.clear()}schema(){return this.detail.get()}name=this.mappedField("database",($)=>$.name);owner=this.mappedField("database",($)=>M.byId(this.client,$.owner_id));createdAt=this.mappedField("database",($)=>$.created_at);trashedAt=this.mappedField("database",($)=>$.trashed_at??void 0);grant=this.field("grant");tables=this.mappedField("tables",($)=>$.map((O)=>Y$.byId(this,O.table.id)));async table($){let{tables:O}=await this.schema(),j=O.find((x)=>x.table.name===$);return j?Y$.byId(this,j.table.id):void 0}async createTable($){let{table:O}=m$(await this.applyOps([{kind:"table",table:h$(),change:{kind:"create",name:$.name}}]),"table","created");return Y$.byId(this,O)}async applyOps($,O={}){let j={ops:$};if(O.baseVersions!==void 0){for(let{table:S}of O.baseVersions)this.assertOwns(`table ${S.id}`,S.database);j.baseVersions=Object.fromEntries(O.baseVersions.map(({table:S,version:K})=>[S.id,K]))}let{results:x}=await this.mutate(async(S)=>{let K=await S.storage.applyDatabaseOps({path:{id:this.id},body:j});if(K.error!==void 0&&"op"in K.error)throw new tx(K.response?.status??0,K.error);return K});return x}async reorderTables($){for(let x of $)this.assertOwns(`table ${x.id}`,x.database);let O=await this.applyOps([{kind:"reorder_tables",order:$.map((x)=>x.id)}]),[j]=O;if(O.length!==1||j?.kind!=="reorder_tables")throw new b(`expected one reorder_tables result, got ${O.map(sx).join(", ")||"none"}`);return j.tables.map(({table:x})=>Y$.byId(this,x))}async deleteTable($){this.assertOwns(`table ${$.id}`,$.database),m$(await this.applyOps([{kind:"table",table:$.id,change:{kind:"delete"}}]),"table","deleted")}async columnCasts($){return this.assertOwns(`column ${$.id}`,$.table.database),Q(await this.client.storage.listDatabaseColumnCasts({path:{id:this.id,table_id:$.table.id,column_id:$.id}}))}async viewPositions($){this.assertOwns(`view ${$.id}`,$.table.database);let{positions:O}=Q(await this.client.storage.getDatabaseViewPositions({path:{id:this.id,view_id:$.id}}));return O}async rowHistory($){this.assertOwns(`row ${$.id}`,$.table.database);let{changes:O}=Q(await this.client.storage.getDatabaseRowHistory({path:{id:this.id,table_id:$.table.id,row_id:$.id}}));return O}async importTable($){let O=await this.mutate((j)=>j.storage.importDatabaseTable({path:{id:this.id},body:$}));return Y$.byId(this,O.id)}webhookOf($){return Uj.fromRecord(Y$.byId(this,$.tableId),M.byId(this.client,$.createdBy),$)}async webhooks(){let{webhooks:$}=Q(await this.client.storage.listDatabaseWebhooks({path:{id:this.id}}));return $.map((O)=>this.webhookOf(O))}async createWebhook($){this.assertOwns("table",$.database);let O=Q(await this.client.storage.createDatabaseWebhook({path:{id:this.id},body:{tableId:$.id}}));return{webhook:this.webhookOf(O.webhook),token:O.token}}async deleteWebhook($){this.assertOwns("webhook",$.table.database),Q(await this.client.storage.deleteDatabaseWebhook({path:{id:this.id,webhook_id:$.id}}))}async sharePermissions(){return Q(await this.client.storage.getDatabasePermissions({path:{id:this.id}}))}updateSharePermissions($){return this.mutate((O)=>O.storage.updateDatabasePermissions({path:{id:this.id},body:$}))}async changeColumnType($,O){this.assertOwns(`column ${$.id}`,$.table.database);let j=await $.table.version();return m$(await this.applyOps([{kind:"column",table:$.table.id,column:$.id,change:{kind:"change_type",to:zj(O.to)}}],{baseVersions:[{table:$.table,version:j}]}),"column","type_changed")}async columnConversion($,O){return this.assertOwns(`column ${$.id}`,$.table.database),Q(await this.client.storage.convertDatabaseColumn({path:{id:this.id,table_id:$.table.id,column_id:$.id},body:{to:zj(O)}}))}async convertColumnIntoNewColumn($,O){let j=await this.columnConversion($,O.to),x=O.name??`${await $.name()} (${n6(O.to)})`,S=h$(),K=[{kind:"column",table:$.table.id,column:S,change:{kind:"create",definition:{source:"new",name:x,type:zj(O.to),options:nx(j.options)},after:$.id}}];if(j.cells.length>0)K.push({kind:"rows",table:$.table.id,change:{kind:"update",changes:{kind:"per_row",rows:j.cells.map(({row:X,value:G})=>({row:X,cells:[{column:S,value:G}]}))}}});let[Z]=await this.applyOps(K,{baseVersions:[{table:$.table,version:j.tableVersion}]});if(!k1(Z,"column","created"))throw new b(`expected a column.created result, got ${Z?sx(Z):"none"}`);return M$.byId($.table,Z.column)}async deleteColumn($){this.assertOwns(`column ${$.id}`,$.table.database);let O=await $.table.version(),{tableVersion:j}=m$(await this.applyOps([{kind:"column",table:$.table.id,column:$.id,change:{kind:"delete"}}],{baseVersions:[{table:$.table,version:O}]}),"column","deleted");return j}async reorderColumns($,O){this.assertOwns(`table ${$.id}`,$.database);for(let S of O)if(S.table.id!==$.id)throw new b(`column ${S.id} does not belong to table ${$.id}`);let j=await $.version(),{tableVersion:x}=m$(await this.applyOps([{kind:"table",table:$.id,change:{kind:"reorder_columns",order:O.map((S)=>S.id)}}],{baseVersions:[{table:$,version:j}]}),"table","columns_reordered");if(x===void 0)throw new b(`table ${$.id} reordered its columns without a version`);return x}async renameTable($,O){this.assertOwns(`table ${$.id}`,$.database);let j=await $.name(),{tableVersion:x}=m$(await this.applyOps([{kind:"table",table:$.id,change:{kind:"rename",name:O,previousName:j}}]),"table","renamed");if(x===void 0)throw new b(`table ${$.id} was renamed without a version`);return x}async renameColumn($,O){this.assertOwns(`column ${$.id}`,$.table.database);let j=await $.name(),{tableVersion:x}=m$(await this.applyOps([{kind:"column",table:$.table.id,column:$.id,change:{kind:"rename",name:O,previousName:j}}]),"column","renamed");return x}async inferColumnType($,O){return this.assertOwns(`column ${$.id}`,$.table.database),this.mutate((j)=>j.storage.inferDatabaseColumnType({path:{id:this.id,table_id:$.table.id,column_id:$.id},body:{dataType:O.dataType,baseVersion:O.baseVersion,...O.specificEntityType!==void 0?{specificEntityType:O.specificEntityType}:{}}}))}async addColumn($,O){if(this.assertOwns(`table ${$.id}`,$.database),O.after!==void 0&&O.after.table.id!==$.id)throw new b(`column ${O.after.id} does not belong to table ${$.id}`);let j="property"in O?{source:"existing",property:O.property.id}:{source:"new",name:O.name,type:zj(O.type),...O.options!==void 0?{options:nx(O.options)}:{},...O.inferType!==void 0?{inferType:O.inferType}:{}},{column:x}=m$(await this.applyOps([{kind:"column",table:$.id,column:h$(),change:{kind:"create",definition:j,...O.after!==void 0?{after:O.after.id}:{}}}]),"column","created");return M$.byId($,x)}async addColumnOptions($,O){return this.assertOwns(`column ${$.id}`,$.table.database),m$(await this.applyOps([{kind:"column",table:$.table.id,column:$.id,change:{kind:"add_options",options:nx(O)}}]),"column","options_added")}}class ex{client;constructor($){this.client=$}query($,O){return Nj(this.client,Q$.byId,$,O)}byId($){return Q$.byId(this.client,$)}create($){return Q$.create(this.client,$)}list(){return Q$.list(this.client)}}class GO extends A{document;toJSON(){return{...super.toJSON(),documentId:this.document.id}}constructor($,O,j,x){super($,j,x);this.document=O}static byId($,O,j){return new GO($,O,j)}static from($,O,j){return new GO($,O,j.uuid,j)}async fetch(){let $=Q(await this.client.storage.getDocumentAnchors({path:{document_id:this.document.id}})).data.find((O)=>O.uuid===this.id);if(!$)throw new w(`Annotation ${this.id} is unavailable`);return $}kind=this.field("anchorType");page=this.field("page");async edit($){if(await this.kind()!=="placeable")throw Error("Only placeable comment annotations can be edited");await this.mutate((O)=>O.storage.editAnchor({body:{...$,uuid:this.id,anchorType:"free-comment",fileType:"pdf"}}))}async delete(){if(await this.kind()!=="highlight")throw Error("Only standalone highlights can be deleted with this endpoint");await this.mutate(($)=>$.storage.deleteAnchor({body:{uuid:this.id,anchorType:"highlight",fileType:"pdf"}}))}}class c$ extends A{documentId;constructor($,O,j,x){super($,j,x);this.documentId=O}get path(){return{parent_type:"document",parent_id:this.documentId,id:this.id}}async fetch(){return Q(await this.client.storage.entityMessageGetMessage({path:this.path}))}static byId($,O,j){return new c$($,O,j)}static from($,O,j){return new c$($,O,j.id,j)}text=this.field("content");createdAt=this.field("created_at");updatedAt=this.field("updated_at");async threadId(){return(await this.detail.get()).thread_id??this.id}document(){return q.byId(this.client,this.documentId)}async author(){return M.byId(this.client,(await this.detail.get()).sender_id)}async reply($){return this.document().comment($,{threadId:await this.threadId()})}async edit($){let{content:O,mentions:j}=$$($);return await this.mutate((x)=>x.storage.entityMessageEdit({path:this.path,body:{content:O,mentions:j}})),this}async delete(){await this.mutate(($)=>$.storage.entityMessageDeleteMessage({path:this.path}))}}class lO{client;document;id;detail;constructor($,O,j){this.client=$;this.document=O;this.id=j;this.detail=new J$(async()=>Q(await this.client.storage.getDocumentVersion({path:{document_id:O.id,document_version_id:j}})).data)}static byId($,O,j){return new lO($,O,j)}read(){return this.detail.get()}toJSON(){return{id:this.id,documentId:this.document.id}}}var s6=8;class q extends S${async anchors(){return Q(await this.client.storage.getDocumentAnchors({path:{document_id:this.id}})).data.map(($)=>GO.from(this.client,this,$))}async createHighlight($){return GO.from(this.client,this,Q(await this.client.storage.createAnchor({path:{document_id:this.id},body:{...$,fileType:"pdf",anchorType:"highlight"}})))}version($){return lO.byId(this.client,this,$)}async sharePermissions(){return Q(await this.client.storage.getDocumentPermissionsV2({path:{document_id:this.id}})).documentPermissions}async permissionsToken(){return Q(await this.client.storage.getDocumentPermissionsToken({path:{document_id:this.id}})).token}async prepareSave($){return Q(await this.client.storage.presaveDocumentHandler({path:{document_id:this.id},body:{newBom:$}})).data}async save($){return(await this.mutate((O)=>O.storage.saveDocumentHandler({path:{document_id:this.id},body:$}))).data}async simpleSave(){return(await this.mutate(($)=>$.storage.simpleSave({path:{document_id:this.id}}))).data}messageThreadById($){return W$.byId(this.client,{type:"document",entity:this},$)}timelinePage($){return E$(this.client,{type:"document",entity:this},(O)=>c$.from(this.client,this.id,O),$)}access=new o(this.client,"document",this);async fetch(){let{data:$}=Q(await this.client.storage.getDocument({path:{document_id:this.id}}));return $.documentMetadata}static byId($,O){return new q($,O)}static async create($,O){let{documentId:j}=Q(await $.storage.createMarkdownHandler({body:{documentName:O.name,markdown:O.markdown??null,projectId:O.project?.id??null}}));return new q($,j)}static async createSnippet($,O){let{documentId:j}=Q(await $.storage.createSnippetHandler({body:{snippetName:O.name,markdown:O.markdown??null,projectId:O.project?.id??null}}));return new q($,j)}static async createSkill($,O){let{documentId:j}=Q(await $.storage.createSkillHandler({body:{skillName:O.name,markdown:O.markdown??null,projectId:O.project?.id??null}}));return new q($,j)}static recent($,O){let j=O?.pageSize??50;return a(async(x)=>{let S=Q(await $.storage.getUserDocumentsHandler({query:{limit:j,offset:x?Number(x):0,...O?.fileType!==void 0?{file_type:O.fileType}:{}}})),K=S.data?.next_offset;return{items:(S.data?.documents??[]).map((Z)=>new q($,Z.documentId)),nextCursor:K!=null?String(K):null}})}static async recentlyDeleted($){let{data:O}=Q(await $.storage.recentlyDeleted({}));return O.items.filter((j)=>j.type==="document").map((j)=>new q($,j.id))}entityType="document";propertyEntityType="DOCUMENT";name=this.field("documentName");fileType=this.field("fileType");project=this.mappedField("projectId",($)=>$?n.byId(this.client,$):void 0);owner=this.mappedField("owner",($)=>M.byId(this.client,$));branchedFrom=this.mappedField("branchedFromId",($)=>$?q.byId(this.client,$):void 0);createdAt=this.field("createdAt");updatedAt=this.field("updatedAt");deletedAt=this.field("deletedAt");async content(){let{text:$}=Q(await this.client.storage.getDocumentTextContent({path:{document_id:this.id}}));if($!==null)return $;let{presigned_url:O}=Q(await this.client.storage.exportDocument({path:{document_id:this.id}})),j=await fetch(O);if(!j.ok)throw new SO(j.status,{message:"failed to download document content"});return j.text()}async rename($){await this.mutate((O)=>O.storage.editDocument({path:{document_id:this.id},body:{documentName:$}}))}async move($){await this.mutate((O)=>O.storage.editDocument({path:{document_id:this.id},body:{projectId:$?.id??""}}))}async delete($){await this.mutate((O)=>$?.permanent?O.storage.permanentlyDeleteDocument({path:{document_id:this.id}}):O.storage.deleteDocument({path:{document_id:this.id}}))}async restore(){await this.mutate(($)=>$.storage.revertDeleteDocument({path:{document_id:this.id}}))}async copy($){let{data:O}=Q(await this.client.storage.copyDocument({path:{document_id:this.id},query:$.versionId!==void 0?{version_id:$.versionId}:void 0,body:{documentName:$.name}}));return new q(this.client,O.documentMetadata.documentId)}async comments(){let $={parent_type:"document",parent_id:this.id},O=a(async(x)=>{let S=Q(await this.client.storage.messageTimeline({path:$,query:{selection:JSON.stringify({limit:100,cursor:x})}}));return{items:S.items,nextCursor:S.next_cursor}}),j=[];for await(let x of O)j.push(x);return bO(j,s6,async(x)=>{let{state:S,root:K,replies:Z}=Q(await this.client.storage.entityMessageGetThread({path:{...$,id:x.id}}));return{thread:S,comments:[K,...Z].map((X)=>c$.from(this.client,this.id,X))}})}async comment($,O){let j=await this.mutate((x)=>x.storage.entityMessageCreate({path:{parent_type:"document",parent_id:this.id},body:{...$$($),thread_id:O?.threadId??null}}));return c$.from(this.client,this.id,j)}async shortId(){return Q(await this.client.storage.getDocumentShortId({path:{document_id:this.id}}))}async teamShare(){return Q(await this.client.storage.getDocumentTeamShare({path:{document_id:this.id}}))}async setTeamShare($){await this.mutate((O)=>O.storage.setDocumentTeamShare({path:{document_id:this.id},body:{shareWithTeam:$}}))}async githubPullRequests(){let{pullRequests:$}=Q(await this.client.storage.getDocumentGithubPullRequests({path:{document_id:this.id}}));return $}async branchName(){let{branchName:$}=Q(await this.client.storage.getDocumentBranchName({path:{document_id:this.id}}));return $}webUrl(){return`${this.client.webAppUrl}/app/md/${this.id}`}static search=j$({filters:{document_filters:{}},type:"document",make:($,O)=>new q($,O.document_id)});toMention(){let $=this.detail.peek();return{tag:l$("m-document-mention",{documentId:this.id,documentName:$?.documentName??"",blockName:$?.fileType??"md"}),mention:{entity_type:"document",entity_id:this.id}}}}class Ij{id;name;constructor($,O){this.id=$;this.name=O}static async list($){let{skills:O}=Q(await $.storage.getSystemSkillsHandler());return O.map((j)=>new Ij(j.id,j.name))}}class ox{client;async byTeamSlug($){let O=Q(await this.client.storage.getDocumentByTeamSlug({path:{slug:$}}));if(typeof O!=="object"||O===null||!("data"in O)||typeof O.data!=="object"||O.data===null||!("documentMetadata"in O.data)||typeof O.data.documentMetadata!=="object"||O.data.documentMetadata===null||!("documentId"in O.data.documentMetadata)||typeof O.data.documentMetadata.documentId!=="string")throw Error("Invalid team task document response");return q.byId(this.client,O.data.documentMetadata.documentId)}async validatePermissionsToken($){let O=Q(await this.client.storage.validateDocumentPermissionsToken({body:{token:$}}));return{document:q.byId(this.client,O.document_id),user:O.user_id?M.byId(this.client,O.user_id):void 0,accessLevel:O.access_level,expiresAt:O.exp,issuer:O.iss}}async createUpload($){let O={documentName:$.name,sha:$.sha,fileType:$.fileType,mimeType:$.mimeType,projectId:$.project?.id,teamId:$.team?.id,branchedFromId:$.branchedFrom?.id,emailAttachmentId:$.attachment?.id,isTask:$.isTask},j=Q(await this.client.storage.createDocument({body:O})).data;return{document:q.byId(this.client,j.documentMetadata.documentId),uploadUrl:j.presignedUrl??void 0,contentType:j.contentType,content:j.documentMetadata.content}}constructor($){this.client=$}byId($){return q.byId(this.client,$)}create($){return q.create(this.client,$)}createSnippet($){return q.createSnippet(this.client,$)}createSkill($){return q.createSkill(this.client,$)}systemSkills(){return Ij.list(this.client)}search($,O){return q.search(this.client,$,O)}recent($){return q.recent(this.client,$)}recentlyDeleted(){return q.recentlyDeleted(this.client)}}class KO extends A{async fetch(){let{attachment:$}=Q(await this.client.email.getAttachment({path:{id:this.id}}));return $}static byId($,O){return new KO($,O)}static from($,O){return new KO($,O.db_id,O)}filename=this.field("filename");mimeType=this.field("mime_type");size=this.field("size_bytes");dataUrl=this.field("data_url");sfsId=this.field("sfs_id");contentId=this.field("content_id");async toDocument(){let{document_id:$}=Q(await this.client.email.getAttachmentDocumentId({path:{id:this.id}}));return q.byId(this.client,$)}}class H$ extends S${access=new o(this.client,"email_thread",this);async followup(){return Q(await this.client.storage.getEmailFollowup({path:{thread_id:this.id}}))}async setFollowup($){return Q(await this.client.storage.setEmailFollowup({path:{thread_id:this.id},body:$}))}async calendarInvitations(){return Q(await this.client.email.getThreadCalendarInvitations({path:{thread_id:this.id}}))}async update($){await this.mutate((O)=>O.storage.editThreadV2({path:{thread_id:this.id},body:{projectId:$.project===void 0?void 0:$.project?.id??null,sharePermission:$.sharePermission?r$($.sharePermission):void 0}}))}entityType="email_thread";propertyEntityType="THREAD";async fetch(){let{thread:$}=Q(await this.client.email.getThread({path:{thread_id:this.id},query:{limit:100}}));return $}static byId($,O){return new H$($,O)}createdAt=this.field("created_at");updatedAt=this.field("updated_at");isRead=this.field("is_read");inboxVisible=this.field("inbox_visible");accessLevel=this.field("access_level");providerId=this.field("provider_id");link=this.mappedField("link_id",($)=>z$.byId(this.client,$));project=this.mappedField("project_id",($)=>$?n.byId(this.client,$):void 0);latestInboundAt=this.field("latest_inbound_message_ts");latestOutboundAt=this.field("latest_outbound_message_ts");latestNonSpamAt=this.field("latest_non_spam_message_ts");async subject(){let{messages:$}=await this.detail.get();for(let O of $)if(O.subject)return O.subject;return}async participants(){let{messages:$}=await this.detail.get(),O=new Map;for(let j of $)for(let x of[j.from,...j.to,...j.cc,...j.bcc])if(x&&!O.has(x.email))O.set(x.email,x);return[...O.values()]}async messages($){return Q(await this.client.email.getThreadMessagesHandler({path:{id:this.id},query:{...$?.since?{since:$.since}:{},...$?.limit?{limit:$.limit}:{}}})).map((j)=>R$.from(this.client,j))}async attachments(){let{messages:$}=await this.detail.get();return $.flatMap((O)=>O.attachments.map((j)=>KO.from(this.client,j)))}async reply($){let O=$.subject??await this.subject()??"",{message:j}=await this.mutate((x)=>x.email.sendMessage({body:{message:{thread_db_id:this.id,replying_to_id:$.replyingTo?.id??null,to:$.to,cc:$.cc??null,bcc:$.bcc??null,subject:O,body_text:$.bodyText}}}));return j.db_id?R$.byId(this.client,j.db_id):void 0}async archive($=!0){await this.mutate((O)=>O.email.archiveThread({path:{id:this.id},body:{value:$}}))}async updateState($){await this.mutate((O)=>O.email.updateThreadState({path:{id:this.id},body:$}))}async operations(){return Q(await this.client.email.threadOperations({path:{id:this.id}}))}async markSeen(){await this.mutate(($)=>$.email.threadSeen({path:{id:this.id}}))}async addLabel($){await this.mutate((O)=>O.email.addRemoveThreadLabel({path:{id:this.id},body:{label_id:$.id,value:!0}}))}async removeLabel($){await this.mutate((O)=>O.email.addRemoveThreadLabel({path:{id:this.id},body:{label_id:$.id,value:!1}}))}async moveToProject($){await this.mutate((O)=>O.email.updateThreadProject({path:{thread_id:this.id},body:{projectId:$?.id??null}}))}static search=j$({filters:{email_filters:{}},type:"email",make:($,O)=>new H$($,O.thread_id)})}class R$ extends A{async fetch(){return Q(await this.client.email.getMessage({path:{id:this.id}}))}static byId($,O){return new R$($,O)}static from($,O){return new R$($,O.db_id,O)}static async send($,O){let{message:j}=Q(await $.email.sendMessage({body:{message:{to:O.to,cc:O.cc??null,bcc:O.bcc??null,subject:O.subject,body_text:O.bodyText}}}));return j.db_id?R$.byId($,j.db_id):void 0}subject=this.field("subject");from=this.field("from");to=this.field("to");cc=this.field("cc");bcc=this.field("bcc");body=this.field("body_parsed");sentAt=this.field("internal_date_ts");labels=this.field("labels");link=this.mappedField("link_id",($)=>z$.byId(this.client,$));async operationStatus(){return Q(await this.client.email.messageOperationStatus({path:{id:this.id}}))}async resolveOperation($){await this.mutate((O)=>O.email.resolveMessageOperation({path:{id:this.id},body:$}))}async completeDraftAttachment($,O=0){let j=await this.link();await this.mutate((x)=>x.email.completeDraftAttachment({path:{id:this.id,attachment_id:$},query:{draft_generation:O},headers:{"X-Email-Link-Id":j.id}}))}async transferDraft($){let O=await this.detail.get();return this.mutate((j)=>j.email.transferDraft({path:{id:this.id},body:{...$,draft_generation:$.draft_generation??O.draft_generation??0},headers:{"X-Email-Link-Id":O.link_id}}))}async addLabel($){await this.mutate((O)=>O.email.addRemoveLabel({body:{label_id:$.id,message_ids:[this.id],value:!0}}))}async removeLabel($){await this.mutate((O)=>O.email.addRemoveLabel({body:{label_id:$.id,message_ids:[this.id],value:!1}}))}async thread(){return H$.byId(this.client,(await this.detail.get()).thread_db_id)}}class YO extends R${async draftContext(){let $=await this.detail.get();return{headers:{"X-Email-Link-Id":$.link_id},query:{draft_generation:$.draft_generation??0}}}static byId($,O){return new YO($,O)}draftGeneration=this.field("draft_generation");async update($){let{headers:O,query:j}=await this.draftContext();await this.mutate((x)=>x.email.createDraft({headers:O,body:{draft:{...$0($),db_id:this.id,draft_generation:$.draftGeneration??j.draft_generation}}}))}async delete(){let{headers:$,query:O}=await this.draftContext();await this.mutate((j)=>j.email.deleteDraft({path:{id:this.id},headers:$,query:O}))}async schedule($,O){let{headers:j,query:x}=await this.draftContext();await this.mutate((S)=>S.email.upsertScheduledMessage({path:{id:this.id},headers:j,query:x,body:{send_time:$,include_signature:O?.includeSignature}}))}async unschedule(){let{headers:$,query:O}=await this.draftContext();await this.mutate((j)=>j.email.deleteScheduledDraft({path:{message_id:this.id},headers:$,query:O}))}async addAttachment($){let O={file_name:$.fileName,sha:$.sha,size:$.size,upload_id:$.uploadId},{headers:j,query:x}=await this.draftContext(),S=await this.mutate((K)=>K.email.addDraftAttachment({path:{id:this.id},headers:j,query:x,body:O}));return{attachment:rO.byId(this.client,this,S.attachment_id,!1,x.draft_generation),uploadUrl:S.upload_url,contentType:S.content_type}}async forwardAttachment($){let{headers:O,query:j}=await this.draftContext(),x=await this.mutate((S)=>S.email.addForwardedAttachment({path:{id:this.id},headers:O,query:j,body:{attachment_id:$.id}}));return rO.byId(this.client,this,x.attachment_id,!0,j.draft_generation)}async removeAttachment($){if($.draft.id!==this.id)throw Error("Attachment belongs to another draft");let{headers:O}=await this.draftContext(),j={draft_generation:$.draftGeneration};if($.forwarded)await this.mutate((x)=>x.email.removeForwardedAttachment({path:{id:this.id,attachment_id:$.id},headers:O,query:j}));else await this.mutate((x)=>x.email.removeDraftAttachment({path:{id:this.id,attachment_id:$.id},headers:O,query:j}))}async verifyAttachment($){if($.draft.id!==this.id||$.forwarded)throw Error("Expected an uploaded attachment on this draft");await this.completeDraftAttachment($.id,$.draftGeneration)}}class rO{draft;id;forwarded;draftGeneration;constructor($,O,j,x){this.draft=$;this.id=O;this.forwarded=j;this.draftGeneration=x}static byId($,O,j,x=!1,S=0){return new rO(O,j,x,S)}complete(){return this.draft.verifyAttachment(this)}remove(){return this.draft.removeAttachment(this)}toJSON(){return{id:this.id,draftId:this.draft.id,forwarded:this.forwarded,draftGeneration:this.draftGeneration}}}function $0($){let{bodyText:O,bodyHtml:j,bodyMacro:x,headers:S,includeSignature:K,draftGeneration:Z,thread:X,replyingTo:G,...L}=$;return{...L,body_text:O,body_html:j===void 0?void 0:btoa(Array.from(new TextEncoder().encode(j),(Y)=>String.fromCharCode(Y)).join("")).replaceAll("+","-").replaceAll("/","_").replaceAll("=",""),body_macro:x,headers_json:S,include_signature:K,draft_generation:Z,thread_db_id:X?.id,replying_to_id:G?.id}}class QO extends A{inbox;constructor($,O,j,x){super($,O,j);this.inbox=x}get headers(){return this.inbox?{"X-Email-Link-Id":this.inbox.id}:void 0}static byId($,O,j){return new QO($,O,void 0,j)}static from($,O,j){return new QO($,O.id,O,j)}async fetch(){let $=Q(await this.client.email.listEmailFilters({headers:this.headers})).filters.find((O)=>O.id===this.id);if(!$)throw new w(`Email filter ${this.id} is unavailable`);return $}emailAddress=this.field("email_address");emailDomain=this.field("email_domain");isImportant=this.field("is_important");async setImportant($){let O=await this.detail.get();await this.mutate((j)=>j.email.upsertEmailFilter({headers:this.headers,body:{email_address:O.email_address,email_domain:O.email_domain,is_important:$}}))}async delete(){await this.mutate(($)=>$.email.deleteEmailFilter({path:{id:this.id},headers:this.headers}))}}class e$ extends A{async fetch(){let{labels:$}=Q(await this.client.email.listLabels()),O=$.find((j)=>j.id===this.id);if(!O)throw new w(`label ${this.id} not found`);return O}static byId($,O){return new e$($,O)}static async list($){let{labels:O}=Q(await $.email.listLabels());return O.map((j)=>new e$($,j.id,j))}static async create($,O){let{label:j}=Q(await $.email.createLabel({body:{label_name:O}}));if(!j.id)throw new b("created label has no id");return new e$($,j.id)}async delete(){Q(await this.client.email.deleteLabel({path:{id:this.id}}))}name=this.field("name");linkId=this.field("linkId");type=this.field("type");createdAt=this.field("createdAt");labelListVisibility=this.field("labelListVisibility");messageListVisibility=this.field("messageListVisibility")}class O0{client;async createDraft($,O){let j=Q(await this.client.email.createDraft({body:{draft:$0($)},headers:O?{"X-Email-Link-Id":O.id}:void 0}));if(!j.draft.db_id)throw Error("Draft response has no message id");return YO.byId(this.client,j.draft.db_id)}draftById($){return YO.byId(this.client,$)}async*scheduled($){let O=$?.pageSize??100;if(!Number.isInteger(O)||O<1)throw Error("pageSize must be positive");let j=Math.min(O,1000);for(let x=0;;x+=j){let S=Q(await this.client.email.getScheduledMessages({query:{offset:x,limit:j},headers:$?.inbox?{"X-Email-Link-Id":$.inbox.id}:void 0}));for(let K of S.messages)yield YO.byId(this.client,K.db_id);if(S.messages.length<j)return}}async filters($){return Q(await this.client.email.listEmailFilters({headers:$?{"X-Email-Link-Id":$.id}:void 0})).filters.map((O)=>QO.from(this.client,O,$))}async upsertFilter($,O){return QO.from(this.client,Q(await this.client.email.upsertEmailFilter({headers:O?{"X-Email-Link-Id":O.id}:void 0,body:{email_address:$.emailAddress,email_domain:$.emailDomain,is_important:$.isImportant}})).filter,O)}async contacts(){return Q(await this.client.email.listContacts()).contacts}reminders($){let{inboxes:O,...j}=$??{};return a(async(x)=>{let S=Q(await this.client.storage.listEmailReminders({query:{...j,inboxIds:O?.map((K)=>K.id),cursor:x}}));return{items:S.items.map(({threadId:K,...Z})=>({...Z,thread:H$.byId(this.client,K)})),nextCursor:S.nextCursor}})}constructor($){this.client=$}byId($){return H$.byId(this.client,$)}message($){return R$.byId(this.client,$)}attachment($){return KO.byId(this.client,$)}link($){return z$.byId(this.client,$)}links(){return z$.list(this.client)}async connectionProviders(){return Q(await this.client.auth.emailConnectionProviders())}async recoverDraftTransfer($){return Q(await this.client.email.recoverDraftTransfer({path:{id:$}}))}send($){return R$.send(this.client,$)}search($,O){return H$.search(this.client,$,O)}inbox($){return a(async(O)=>{let j=Q(await this.client.email.previewsInboxCursor({path:{view:"inbox"},query:{...$?.pageSize?{limit:$.pageSize}:{},...$?.sort?{sort_method:$.sort}:{},...O?{cursor:O}:{}}}));return{items:j.items.map((x)=>H$.byId(this.client,x.id)),nextCursor:j.next_cursor}})}label($){return e$.byId(this.client,$)}labels(){return e$.list(this.client)}createLabel($){return e$.create(this.client,$)}async deleteLabel($){Q(await this.client.email.deleteLabel({path:{id:$.id}}))}async blockSender($){Q(await this.client.email.blockSender({body:{email_address:$}}))}async unblockSender($){Q(await this.client.email.unblockSender({body:{email_address:$}}))}async blockedSenders(){return Q(await this.client.email.listBlockedSenders()).blocked_emails}}class BO{client;id;constructor($,O){this.client=$;this.id=O}static byId($,O){return new BO($,O)}async delete(){Q(await this.client.storage.deleteEntityMention({path:{mention_id:this.id}}))}toJSON(){return{id:this.id}}}class j0{client;constructor($){this.client=$}byId($){return BO.byId(this.client,$)}async create($,O){let j=Q(await this.client.storage.createEntityMention({body:{source_entity_id:$.entity.id,source_entity_type:$.type,entity_id:O.entity.id,entity_type:O.type}}));return BO.byId(this.client,j.id)}}class x0{client;constructor($){this.client=$}async list($={}){let{favorites:O}=Q(await this.client.storage.listFavorites({query:{entityType:$.entityTypes,entityId:$.entityIds}}));return O}async add($){return Q(await this.client.storage.addFavorite({body:{entityId:$.id,entityType:$.entityType}}))}async remove($){Q(await this.client.storage.removeFavoriteByEntity({path:{entity_type:$.entityType,entity_id:$.id}}))}async reorder($){Q(await this.client.storage.reorderFavorites({body:{favorites:$}}))}}class o$ extends F${entityType="foreign_entity";async fetch(){return Q(await this.client.storage.getForeignEntity({path:{id:this.id}}))}static byId($,O){return new o$($,O)}static fromRecord($,O){return new o$($,O.id,O)}foreignEntityId=this.field("foreignEntityId");source=this.field("foreignEntitySource");storedForId=this.field("storedForId");storedForAuthEntity=this.field("storedForAuthEntity");createdAt=this.field("createdAt");updatedAt=this.field("updatedAt");async metadata(){return(await this.detail.get()).metadata}}function g1({login:$,...O}){return{...O,login:$??void 0}}class S0{client;constructor($){this.client=$}byId($){return o$.byId(this.client,$)}async bySource($,O){return o$.fromRecord(this.client,Q(await this.client.storage.getForeignEntityBySource({path:{source:$,foreign_entity_id:O}})))}async githubPullRequestFacets(){let{repositories:$,authors:O,assignees:j,labels:x}=Q(await this.client.storage.getGithubPullRequestFacets());return{repositories:$,authors:O.map(g1),assignees:j.map(g1),labels:x.map(({color:S,...K})=>({...K,color:S??void 0}))}}}class u${form;id;constructor($,O){this.form=$;this.id=O}static byId($,O){return new u$($,O)}async detail(){let O=(await this.form.schema()).sections.flatMap((j)=>j.kind==="questions"?j.questions:[]).find((j)=>j.id===this.id);if(!O)throw new w(`question ${this.id} is not on form ${this.form.id}`);return O}async title(){return(await this.detail()).title}async column(){return M$.byId(await this.form.table(),(await this.detail()).column)}async options(){return(await this.detail()).options.map(($)=>JO.byId(this,$.id))}}class JO{question;id;constructor($,O){this.question=$;this.id=O}static byId($,O){return new JO($,O)}async detail(){let $=(await this.question.detail()).options.find((O)=>O.id===this.id);if(!$)throw new w(`option ${this.id} is not on question ${this.question.id}`);return $}async label(){return(await this.detail()).label}async color(){return(await this.detail()).color??void 0}}class LO{form;id;detail;constructor($,O,j){this.form=$;this.id=O;this.detail=new J$(()=>this.load(),j)}async load(){let $=await this.form.myResponse();if($.response.id!==this.id)throw new w(`response ${this.id} is not your current response`);return $}static byId($,O,j){return new LO($,O,j)}async status(){return(await this.detail.get()).status}async row(){return(await this.detail.get()).row}async answers(){return(await this.detail.get()).answers}async booking(){return(await this.detail.get()).booking}async refresh(){let $=await this.load();return this.detail=new J$(()=>this.load(),$),this}}class d${form;id;constructor($,O){this.form=$;this.id=O}static byId($,O){return new d$($,O)}async detail(){let $=(await this.form.schema()).sections.find((O)=>O.id===this.id);if(!$)throw new w(`section ${this.id} is not on form ${this.form.id}`);return $}async title(){return(await this.detail()).title}async questions(){let $=await this.detail();return $.kind==="questions"?$.questions.map((O)=>u$.byId(this.form,O.id)):[]}}class Tj{entityType;id;constructor($,O){this.entityType=$;this.id=O}static byId($,O){return new Tj($,O)}}class k$ extends A{async fetch(){return Q(await this.client.storage.getForm({path:{id:this.id}}))}static byId($,O){return new k$($,O)}static async create($,O){let j=Q(await $.storage.createForm({body:{name:O.name,source:O.table?{kind:"table",databaseId:O.table.database.id,tableId:O.table.id}:{kind:"new"}}}));return new k$($,j.form.id,j)}static async list($,O){if(!O)return Q(await $.storage.listAccessibleForms()).map(({form:S})=>new k$($,S.id));return Q(await $.storage.listForms({query:{databaseId:O.id}})).map((x)=>new k$($,x.id))}schema(){return this.detail.get()}name=this.mappedField("form",($)=>$.name);description=this.mappedField("form",($)=>$.description);owner=this.mappedField("form",($)=>M.byId(this.client,$.ownerId));database=this.mappedField("form",($)=>Q$.byId(this.client,$.databaseId));table=this.mappedField("form",($)=>Y$.byId(Q$.byId(this.client,$.databaseId),$.tableId));audience=this.mappedField("form",($)=>$.audience);status=this.mappedField("form",($)=>$.status);closesAt=this.mappedField("form",($)=>$.closesAt??void 0);access=this.field("access");async sections(){return(await this.detail.get()).sections.map(($)=>d$.byId(this,$.id))}async questions(){return(await this.detail.get()).sections.flatMap(($)=>$.kind==="questions"?$.questions.map((O)=>u$.byId(this,O.id)):[])}async update($){return await this.mutate((O)=>O.storage.updateForm({path:{id:this.id},body:$})),this}assertOwns($){if($.form.id!==this.id)throw new b(`question or section does not belong to form ${this.id}`)}async replaceLayout($){let O=await this.table(),j=(Z)=>{if(Z.table.id!==O.id||Z.table.database.id!==O.database.id)throw new b(`column does not belong to form ${this.id}'s table`);return Z.id},x=(Z)=>({conjunction:Z.conjunction,conditions:Z.conditions.map((X)=>c(X).with({kind:"group"},(G)=>({kind:"group",...x(G)})).with({kind:"condition"},(G)=>({kind:"condition",column:j(G.column),test:c(G.test).with({kind:"options"},(L)=>({...L,options:L.options.map((Y)=>Y.id)})).with({kind:"entities"},(L)=>({...L,entities:L.entities.map((Y)=>Y.id)})).with({kind:x$.union("presence","text","number","date","checkbox")},(L)=>L).exhaustive()})).exhaustive())}),S={sections:$.map((Z)=>{if(Z.section)this.assertOwns(Z.section);let X={id:Z.section?.id??h$(),title:Z.title,description:Z.description??""};return c(Z).with({kind:"booking"},(G)=>({...X,kind:"booking",target:G.target})).with({kind:"gate"},(G)=>({...X,kind:"gate",rules:x(G.rules),message:G.message})).with({kind:"questions"},(G)=>({...X,kind:"questions",questions:G.questions.map((L)=>{if(L.question)this.assertOwns(L.question);return{id:L.question?.id??h$(),column:j(L.column),helpText:L.helpText??"",required:L.required??!1,widget:L.widget??null}})})).exhaustive()})},K=await this.mutate((Z)=>Z.storage.putFormLayout({path:{id:this.id},body:S}));return{form:this,publicationError:K.publicationError}}wireAnswers($){return $.map(({question:O,value:j})=>{this.assertOwns(O);let x=c(j).with({type:"rows"},(S)=>({type:"rows",value:S.value.map((K)=>K.id)})).with({type:"options"},(S)=>({type:"options",value:S.value.map((K)=>{if(K.question.id!==O.id||K.question.form.id!==this.id)throw new b("option does not belong to the answered question");return{id:K.id}})})).with({type:"entities"},(S)=>({type:"entities",value:S.value.map(({entityType:K,entity:Z})=>({entityType:K,entityId:Z.id}))})).with({type:x$.union("text","number","boolean","date","link","clear")},(S)=>S).exhaustive();return{question:O.id,value:x}})}unlockedBooking($){return $?{...$,section:d$.byId(this,$.section)}:void 0}async outcome($,O){return c($).with({outcome:"stopped"},(j)=>({...j,section:d$.byId(this,j.section)})).with({outcome:"submitted"},async(j)=>{let x=A$.byId(await this.table(),j.row),S=this.unlockedBooking(j.booking);return{outcome:"submitted",response:LO.byId(this,j.response,{status:"submitted",row:x,answers:O,booking:S}),row:x,...S?{booking:S}:{}}}).exhaustive()}async submit($){let O={answers:this.wireAnswers($)};return this.outcome(Q(await this.client.storage.submitFormResponse({path:{id:this.id},body:O})),$)}async editResponse($){let O={answers:this.wireAnswers($)};return this.outcome(Q(await this.client.storage.editMyFormResponse({path:{id:this.id},body:O})),$)}async myResponse(){let $=Q(await this.client.storage.getMyFormResponse({path:{id:this.id}})),O=await this.table(),j=await Promise.all($.answers.map(async(K)=>{let Z=u$.byId(this,K.question),X=await c(K.value).with({type:"options"},(G)=>({type:"options",value:G.value.map((L)=>{if(!("id"in L))throw new b("stored form answers must reference options by id");return JO.byId(Z,L.id)})})).with({type:"entities"},(G)=>({type:"entities",value:G.value.map((L)=>({entityType:L.entityType,entity:Tj.byId(L.entityType,L.entityId)}))})).with({type:"rows"},async(G)=>{let L=await Z.detail();if(L.kind.type!=="relation")throw new b("row answer requires a relation question");let Y=Y$.byId(Q$.byId(this.client,L.kind.database),L.kind.table);return{type:"rows",value:G.value.map((J)=>A$.byId(Y,J))}}).with({type:x$.union("text","number","boolean","date","link","clear")},(G)=>G).exhaustive(()=>{throw new b(`answer to question ${Z.id} has a type this SDK doesn't know`)});return{question:Z,value:X}})),x=$.response.row?A$.byId(O,$.response.row):void 0,S=this.unlockedBooking($.booking);return{...S?{booking:S}:{},response:LO.byId(this,$.response.id,{status:$.response.status,row:x,answers:j,booking:S}),status:$.response.status,stoppedAtSection:$.response.stoppedAtSection?d$.byId(this,$.response.stoppedAtSection):void 0,row:x,submittedAt:$.response.submittedAt,updatedAt:$.response.updatedAt,answers:j}}async responseSummary(){let $=Q(await this.client.storage.getFormResponseSummary({path:{id:this.id}}));return{...$,stoppedBySection:$.stoppedBySection.map((O)=>({section:d$.byId(this,O.section),count:O.count}))}}async tally(){return Q(await this.client.storage.getFormTally({path:{id:this.id}})).questions.map((O)=>{let j=u$.byId(this,O.question);return{question:j,responses:O.responses,buckets:O.buckets.flatMap((x)=>c(x.value).with({kind:"option"},(S)=>[{count:x.count,value:{kind:"option",option:JO.byId(j,S.option)}}]).with({kind:"checkbox"},(S)=>[{count:x.count,value:S}]).exhaustive((S)=>{return console.warn("macro sdk: unknown form tally bucket",S),[]}))}})}async sharePermissions(){return Q(await this.client.storage.getFormPermissions({path:{id:this.id}}))}updateSharePermissions($){return this.mutate((O)=>O.storage.updateFormPermissions({path:{id:this.id},body:$}))}webUrl(){return`${this.client.webAppUrl}/app/form/${this.id}`}respondUrl(){return`${this.client.webAppUrl}/app/form/${this.id}/respond`}}class Z0{client;constructor($){this.client=$}byId($){return k$.byId(this.client,$)}create($){return k$.create(this.client,$)}list($){return k$.list(this.client,$)}}class NO extends A{static byId($,O){return new NO($,O)}async fetch(){return Q(await this.client.storage.getGithubPullRequest({path:{id:this.id}}))}title=this.field("title");url=this.field("url");status=this.field("status");async changes(){let $=Q(await this.client.storage.getGithubPullRequestChanges({path:{id:this.id}}));return{changeset:$.changeset?new X0(this.client,this,$.changeset):void 0,error:$.error??void 0}}}class X0{client;pullRequest;record;constructor($,O,j){this.client=$;this.pullRequest=O;this.record=j}get id(){return this.record.id}async patch(){return Q(await this.client.storage.getGithubPullRequestChangesPatch({path:{id:this.pullRequest.id},query:{changeset:this.id}})).patch}toJSON(){return{pullRequestId:this.pullRequest.id,...this.record}}}class G0{client;constructor($){this.client=$}byId($){return NO.byId(this.client,$)}forEntity($){return NO.byId(this.client,$.id)}}class UO extends A{static byId($,O){return new UO($,O)}async fetch(){return Q(await this.client.storage.getHarnessPairing({path:{code:this.id}}))}name=this.field("requested_name");expiresAt=this.field("expires_at");async approve($){let O={name:$?.name,team_id:$?.team?.id,allow_permission_bypass:$?.allowPermissionBypass};return V$.from(this.client,await this.mutate((j)=>j.storage.approveHarnessPairing({path:{code:this.id},body:O})))}}class pO{client;id;constructor($,O){this.client=$;this.id=O}static byId($,O){return new pO($,O)}async claim($){let O=Q(await this.client.storage.claimHarnessPairing({path:{pairing_id:this.id},body:{device_secret:$}}));return"harness"in O?{harness:V$.from(this.client,O.harness),token:O.token}:void 0}toJSON(){return{id:this.id}}}class K0{client;constructor($){this.client=$}byId($){return V$.byId(this.client,$)}async list(){return Q(await this.client.storage.listHarnesses()).map(($)=>V$.from(this.client,$))}async me(){return V$.from(this.client,Q(await this.client.storage.getSelfHarness()))}async deleteSelf(){Q(await this.client.storage.deleteSelfHarness())}async agents(){return Q(await this.client.storage.listHarnessAgents()).map(($)=>U$.byId(this.client,$.bot_id))}async sessions(){return Q(await this.client.storage.listHarnessSessions()).map(($)=>i.byId(this.client,$.session_id))}pairing($){return UO.byId(this.client,$)}async createPairing($){let O=Q(await this.client.storage.createHarnessPairing({body:$}));return{pairing:UO.byId(this.client,O.code),device:pO.byId(this.client,O.pairing_id),deviceSecret:O.device_secret,expiresAt:O.expires_at,pollIntervalSeconds:O.poll_interval_seconds}}}var t6="00000001-0000-0000-0000-000000000002",e6="00000001-0000-0000-0002-000000000004";function o6($){let O=$.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/pull\/([1-9][0-9]*)\/?(?:[?#].*)?$/i);if(!O)throw Error(`Expected a GitHub pull request URL like https://github.com/owner/repo/pull/1, got ${$}`);return`${O[1]}/${O[2]}/pull/${O[3]}`}class D$ extends q{static byId($,O){return new D$($,O)}static async create($,O){let{documentId:j}=Q(await $.storage.createTaskHandler({body:{taskName:O.name,markdown:O.markdown??null,projectId:O.project?.id??null,teamId:O.team?.id??null,shareWithTeam:O.shareWithTeam??!0}}));return new D$($,j)}static async forPullRequest($,O){let j=o6(O),{pullRequests:x}=Q(await $.storage.getGithubPullRequestTasks({body:{githubKeys:[j]}}));return(x[0]?.taskIds??[]).map((S)=>new D$($,S))}async completed(){let{subType:$}=await this.detail.get();if($!=="task")return;let j=(await this.properties()).find((x)=>x.definition.id===t6)?.value;return j?.type==="SelectOption"&&j.value.includes(e6)}webUrl(){return`${this.client.webAppUrl}/app/task/${this.id}`}static search=j$({filters:{document_filters:{sub_types:["task"],task_filters:{}}},type:"document",make:($,O)=>new D$($,O.document_id)})}class $O extends A{access=new o(this.client,"initiative",this);static byId($,O){return new $O($,O)}static from($,O){return new $O($,O.id,O)}async fetch(){return Q(await this.client.storage.getInitiative({path:{initiative_id:this.id}}))}name=this.field("name");owner=this.mappedField("ownerId",($)=>M.byId(this.client,$));members=this.mappedField("memberIds",($)=>$.map((O)=>M.byId(this.client,O)));tasks=this.mappedField("taskIds",($)=>$.map((O)=>D$.byId(this.client,O)));accessLevel=this.field("userAccessLevel");sharePermissions=this.field("sharePermission");async update($){await this.mutate((O)=>O.storage.updateInitiative({path:{initiative_id:this.id},body:{name:$.name,memberIds:$.members?.map((j)=>j.id),sharePermission:$.sharePermission?r$($.sharePermission):void 0}}))}async delete(){await this.mutate(($)=>$.storage.deleteInitiative({path:{initiative_id:this.id}}))}}class Y0{client;constructor($){this.client=$}byId($){return $O.byId(this.client,$)}async list(){return Q(await this.client.storage.listInitiatives()).initiatives.map(($)=>$O.byId(this.client,$.id))}async create($){return $O.from(this.client,Q(await this.client.storage.createInitiative({body:{name:$.name,description:$.description,memberIds:$.members?.map((O)=>O.id),shareWithTeam:$.shareWithTeam,propertyValues:$.propertyValues}})))}}class Q0{client;constructor($){this.client=$}byId($){return I$.byId(this.client,$)}async create($){return I$.from(this.client,Q(await this.client.storage.meetingCreate({body:$})))}async list(){return Q(await this.client.storage.meetingList()).meetings.map(($)=>I$.from(this.client,$))}async active(){return Q(await this.client.storage.meetingListActive()).meetings.map(($)=>I$.from(this.client,$))}async lookup($){return I$.from(this.client,Q(await this.client.storage.meetingLookup({path:{token:$}})))}}class VO extends A{async fetch(){return Q(await this.client.notification.getTypedNotificationById({path:{notification_id:this.id}}))}static byId($,O){return new VO($,O)}static from($,O){return new VO($,O.id,O)}static list($,O){return a(async(j)=>{let x=Q(await $.notification.listTypedNotifications({query:{...O?.pageSize?{limit:O.pageSize}:{},...O?.states!==void 0?{states:O.states.join(",")}:{},...j?{cursor:j}:{}}}));return{items:x.items.map((S)=>VO.from($,S)),nextCursor:x.next_cursor}})}type=this.field("notification_event_type");createdAt=this.field("created_at");updatedAt=this.field("updated_at");state=this.field("state");done=this.mappedField("state",($)=>$==="done");sent=this.field("sent");viewedAt=this.field("viewed_at");deletedAt=this.field("deleted_at");owner=this.mappedField("owner_id",($)=>M.byId(this.client,$));sender=this.mappedField("sender_id",($)=>$?M.byId(this.client,$):void 0);metadata=this.field("notification_metadata");async seen(){return await this.state()!=="unseen"}async markSeen(){await this.mutate(($)=>$.notification.bulkMarkNotificationsSeen({body:{notificationIds:[this.id]}}))}async markDone(){await this.mutate(($)=>$.notification.bulkMarkNotificationsDone({body:{notificationIds:[this.id]}}))}async markUndone(){await this.mutate(($)=>$.notification.bulkMarkNotificationsUndone({body:{notificationIds:[this.id]}}))}async delete(){await this.mutate(($)=>$.notification.deleteUserNotificationV2({path:{notification_id:this.id}}))}}class J0{client;constructor($){this.client=$}byId($){return VO.byId(this.client,$)}list($){return VO.list(this.client,$)}async markSeen($){Q(await this.client.notification.bulkMarkNotificationsSeen({body:{notificationIds:$}}))}async markDone($){Q(await this.client.notification.bulkMarkNotificationsDone({body:{notificationIds:$}}))}async delete($){Q(await this.client.notification.bulkDeleteUserNotificationsV2({body:{notificationIds:$}}))}async preferences(){return Q(await this.client.notification.getNotificationTypePreferences())}async enableType($){Q(await this.client.notification.enableNotificationType({path:{notification_event_type:$}}))}async disableType($){Q(await this.client.notification.disableNotificationType({path:{notification_event_type:$}}))}}class V0{client;constructor($){this.client=$}async list(){let{data:$}=Q(await this.client.storage.getPinsHandler({}));return $?.recent??[]}async add($,O){Q(await this.client.storage.addPinHandler({path:{pinned_item_id:$.id},body:{pinType:$.entityType,pinIndex:O.index}}))}async remove($){Q(await this.client.storage.removePinHandler({path:{pinned_item_id:$.id},body:{pinType:$.entityType}}))}async reorder($){Q(await this.client.storage.reorderPinsHandler({body:$}))}}class W0{client;constructor($){this.client=$}byId($){return n.byId(this.client,$)}create($){return n.create(this.client,$)}search($,O){return n.search(this.client,$,O)}}class zO{client;definitionId;id;record;constructor($,O,j,x){this.client=$;this.definitionId=O;this.id=j;this.record=x}static from($,O,j){return new zO($,O,j.id,j)}get value(){return this.record.value}get color(){return this.record.color??void 0}get displayOrder(){return this.record.display_order}get createdAt(){return this.record.created_at}get updatedAt(){return this.record.updated_at}async update($){return this.record=Q(await this.client.properties.updatePropertyOption({path:{definition_id:this.definitionId,option_id:this.id},body:$})),this}async delete(){Q(await this.client.properties.deletePropertyOption({path:{definition_id:this.definitionId,option_id:this.id}}))}}class OO{client;id;detail;constructor($,O,j){this.client=$;this.id=O;this.detail=new J$(()=>this.fetch(),j)}async fetch(){return Q(await this.client.properties.getPropertyDefinition({path:{definition_id:this.id}}))}static async create($,O){let j=Q(await $.properties.createPropertyDefinition({body:{display_name:O.displayName,scope:O.scope,data_type:O.dataType}}));return new OO($,j.id,j)}static byId($,O){return new OO($,O)}static fromRecord($,O){return new OO($,O.id,O)}get displayName(){return this.detail.get().then(($)=>$.display_name)}get dataType(){return this.detail.get().then(($)=>$.data_type)}get owner(){return this.detail.get().then(($)=>$.owner)}get isSystem(){return this.detail.get().then(($)=>$.is_system)}get isMultiSelect(){return this.detail.get().then(($)=>$.is_multi_select)}get createdAt(){return this.detail.get().then(($)=>$.created_at)}get updatedAt(){return this.detail.get().then(($)=>$.updated_at)}async delete(){return Q(await this.client.properties.deletePropertyDefinition({path:{definition_id:this.id}}))}async options(){return Q(await this.client.properties.getPropertyOptions({path:{definition_id:this.id}})).map((O)=>zO.from(this.client,this.id,O))}async addOption($){let O=Q(await this.client.properties.addPropertyOption({path:{definition_id:this.id},body:$}));return zO.from(this.client,this.id,O)}async updateOption($,O){let j=Q(await this.client.properties.updatePropertyOption({path:{definition_id:this.id,option_id:$.id},body:O}));return zO.from(this.client,this.id,j)}async deleteOption($){return Q(await this.client.properties.deletePropertyOption({path:{definition_id:this.id,option_id:$.id}}))}}class B0{client;constructor($){this.client=$}async list($){return Q(await this.client.properties.listProperties({query:{scope:$?.scope??"all",...$?.forEntityType!==void 0?{for_entity_type:$.forEntityType}:{}}})).map((j)=>{let x="definition"in j?j.definition:j;return OO.fromRecord(this.client,x)})}create($){return OO.create(this.client,$)}definition($){return OO.byId(this.client,$)}async bulkEntityProperties($){return Q(await this.client.properties.getBulkEntityProperties({body:$}))}async updateEntityPropertyOptions($,O){return Q(await this.client.properties.bulkUpdateEntitiesPropertyOptions({body:{entities:$.map((x)=>x.propertyReference()),property_id:O.property.id,...O.add?{add_option_ids:O.add.map((x)=>x.id)}:{},...O.remove?{remove_option_ids:O.remove.map((x)=>x.id)}:{}}})).results}async addEntityPropertyOption($){return Q(await this.client.properties.addEntityPropertyOption({path:{...$.entity.propertyReference(),property_id:$.property.id,option_id:$.option.id}}))}async removeEntityPropertyOption($){return Q(await this.client.properties.removeEntityPropertyOption({path:{...$.entity.propertyReference(),property_id:$.property.id,option_id:$.option.id}}))}async tags(){return Q(await this.client.properties.listTags({}))}}function L0($){return c($).with({type:"cron"},(O)=>O).with({type:"events"},(O)=>({type:"events",filters:O.filters.map(({entities:j,...x})=>({...x,ids:j?.map((S)=>S.entity.id)}))})).exhaustive()}function $7($){return c($).with({type:"multiple"},(O)=>({type:"multiple",triggers:O.triggers.map(L0)})).with({type:"cron"},L0).with({type:"events"},L0).exhaustive()}class jO extends A{static byId($,O){return new jO($,O)}static from($,O){if(!O.id)throw Error("Routine response has no id");return new jO($,O.id,O)}async fetch(){return Q(await this.client.scheduledAction.getScheduledAction({path:{id:this.id}}))}name=this.field("name");trigger=this.field("trigger");enabled=this.field("enabled");nextRunAt=this.field("next_run_at");revision=this.field("configuration_revision");owner=this.mappedField("owner",($)=>M.byId(this.client,$));async update($){await this.mutate((O)=>O.scheduledAction.updateScheduledAction({path:{id:this.id},body:U0($)}))}async setEnabled($){await this.mutate((O)=>O.scheduledAction.setScheduledActionEnabled({path:{id:this.id},body:{enabled:$}}))}async execute(){let $=Q(await this.client.scheduledAction.executeScheduledActionNow({path:{id:this.id}}));if($.resource)return c($.resource).with({type:"agent"},(O)=>i.byId(this.client,O.id)).with({type:"chat"},(O)=>Z$.byId(this.client,O.id)).exhaustive();return $.chat_id?Z$.byId(this.client,$.chat_id):void 0}async history(){return Q(await this.client.scheduledAction.listScheduledActionHistory({path:{id:this.id}})).map(($)=>new N0(this,$))}async delete(){await this.mutate(($)=>$.scheduledAction.deleteScheduledAction({path:{id:this.id}}))}}class N0{routine;record;constructor($,O){this.routine=$;this.record=O}get id(){return this.record.id??void 0}toJSON(){return{routine:this.routine.id,...this.record}}}function U0($){let O={prompt:$.prompt,user_prompt:$.userPrompt,model:$.model,agent:$.agent?{bot_id:$.agent.id}:void 0};return{kind:"Agent",name:$.name,enabled:$.enabled,trigger:$7($.trigger),task:{...O}}}class z0{client;constructor($){this.client=$}byId($){return jO.byId(this.client,$)}async create($){return jO.from(this.client,Q(await this.client.scheduledAction.createScheduledAction({body:{...U0($),enabled:$.enabled??!0}})))}async list($){return Q(await this.client.scheduledAction.listScheduledActions({query:{include_events:$?.includeEvents}})).map((O)=>jO.from(this.client,O))}}class I0{client;constructor($){this.client=$}byId($){return D$.byId(this.client,$)}create($){return D$.create(this.client,$)}forPullRequest($){return D$.forPullRequest(this.client,$)}search($,O){return D$.search(this.client,$,O)}}class T0{client;constructor($){this.client=$}byId($){return T$.byId(this.client,$)}current(){return T$.current(this.client)}list(){return T$.list(this.client)}}class H0{client;constructor($){this.client=$}async get($){return Q(await this.client.unfurl.getUnfurl({query:{url:$}}))}async bulk($){return Q(await this.client.unfurl.getUnfurlBulk({body:{url_list:$}}))}}class R0{client;constructor($){this.client=$}byId($){return M.byId(this.client,$)}me(){return M.me(this.client)}}class xO extends A{signingSecret;constructor($,O,j,x){super($,O,j);this.signingSecret=x}async fetch(){return Q(await this.client.storage.getWebhook({path:{webhook_id:this.id}}))}static async create($,O){let j=Q(await $.storage.createWebhook({body:{endpoint_url:O.url,namespace:O.namespace,name:O.name,filters:O.filters,scope:O.scope??"user",...O.headers!==void 0?{headers:O.headers}:{}}}));return new xO($,j.id,j,j.signing_secret)}static byId($,O){return new xO($,O)}static fromRecord($,O){return new xO($,O.id,O)}name=this.field("name");namespace=this.field("namespace");endpointUrl=this.field("endpoint_url");status=this.field("status");isValid=this.field("is_valid");filters=this.field("filters");createdAt=this.field("created_at");workspaceId=this.field("workspace_id");createdBy=this.mappedField("created_by_user_id",($)=>M.byId(this.client,$));async scope(){let $=await this.detail.get();return $.workspace_id===$.created_by_user_id?"user":"team"}async update($){await this.mutate((O)=>O.storage.patchWebhook({path:{webhook_id:this.id},body:$}))}async rename($){await this.update({name:$})}async setUrl($){await this.update({endpoint_url:$})}async setFilters($){await this.update({filters:$})}async pause(){await this.update({status:"paused"})}async resume(){await this.update({status:"active"})}async delete(){await this.mutate(($)=>$.storage.deleteWebhook({path:{webhook_id:this.id}}))}async validate(){return this.mutate(($)=>$.storage.validateWebhook({path:{webhook_id:this.id}}))}}class D0{client;constructor($){this.client=$}create($){return xO.create(this.client,$)}byId($){return xO.byId(this.client,$)}async list(){let{webhooks:$}=Q(await this.client.storage.listWebhooks());return $.map((O)=>xO.fromRecord(this.client,O))}}function C0($){if("properties"in $.data)return $.data.properties;if($.tag==="calendarEvent")return $.data.extra.properties;return[]}function y1($,O,j){let x=[];for(let S of C0(O)){if(S.definition.data_type!=="TAG"||S.value?.type!=="SelectOption")continue;for(let K of S.value.value){let Z=j.get(K);if(Z&&!x.some((X)=>X.label===Z.label&&X.scope===Z.scope))x.push(Z)}}switch(O.tag){case"document":return{type:"document",id:O.data.id,entity:q.byId($,O.data.id),snapshot:O,tags:x,name:O.data.name,fileType:O.data.fileType,subType:O.data.subType?.type};case"chat":return{type:"ai_chat",id:O.data.id,entity:Z$.byId($,O.data.id),snapshot:O,tags:x,name:O.data.name};case"project":return{type:"project",id:O.data.id,entity:n.byId($,O.data.id),snapshot:O,tags:x,name:O.data.name};case"emailThread":return{type:"email",id:O.data.id,entity:H$.byId($,O.data.id),snapshot:O,tags:x,subject:O.data.name,snippet:O.data.snippet,senderName:O.data.senderName,senderEmail:O.data.senderEmail,inboxVisible:O.data.inboxVisible,isRead:O.data.isRead,isDraft:O.data.isDraft};case"channel":return{type:"channel",id:O.data.channel.id,entity:f.byId($,O.data.channel.id),snapshot:O,tags:x,name:O.data.channel.name};case"channelThread":return{type:"channel_thread",id:O.data.id,entity:new g$($,O.data.channel_id,O.data.id),snapshot:O,tags:x,channelId:O.data.channel_id};case"call":return{type:"call",id:O.data.callId,entity:K$.byId($,O.data.callId),snapshot:O,tags:x,createdBy:O.data.createdBy};case"calendarEvent":return{type:"calendar_event",id:O.data.id,entity:L$.byId($,O.data.id),snapshot:O,tags:x,title:O.data.title,status:O.data.status,location:O.data.location,conferenceUrl:O.data.conferenceUrl,conferenceProvider:O.data.conferenceProvider,time:O.data.time};case"foreignEntity":return{type:"foreign_entity",id:O.data.id,entity:o$.byId($,O.data.id),snapshot:O,tags:x,foreignEntityId:O.data.foreignEntityId,foreignEntitySource:O.data.foreignEntitySource,metadata:O.data.metadata};default:throw Error(`Unexpected workspace entity type: ${O.tag}`)}}var v1="00000000-0000-0000-0000-000000000000",_0={document:["df","id"],project:["pf","pid"],ai_chat:["cf","cid"],email:["ef","ThreadId"],channel:["chanf","ChannelId"],channel_thread:["cthf","ThreadId"],call:["callf","CallId"],calendar_event:["calf","id"],foreign_entity:["fef","id"]},Hj=($)=>$.replace(/[A-Z]/g,(O)=>O.toLowerCase()),h1=($,O)=>$==null?O:{"&":[$,O]};function M0($,O){if(!$||typeof $!=="object"||Array.isArray($))throw Error(`Invalid workspace ${O}: expected a filter expression.`);let j=Object.entries($),x=j[0];if(j.length!==1||x===void 0)throw Error(`Invalid workspace ${O}: use exactly one of l, &, |, !.`);let[S,K]=x;if(S==="l")return;if(S==="!"){M0(K,`${O}.!`);return}if(S!=="&"&&S!=="|")throw Error(`Invalid workspace ${O}: use l, &, | or !.`);if(!Array.isArray(K)||K.length!==2)throw Error(`Invalid workspace ${O}.${S}: expected exactly two expressions. Use {l: {...}} for a single condition; nest binary operators for three or more.`);K.forEach((Z,X)=>{M0(Z,`${O}.${S}[${X}]`)})}class Rj{client;tagSets;constructor($){this.client=$}sets(){return this.tagSets??=this.client.properties.listTags({}).then(Q),this.tagSets}async tagMap(){let $=new Map;for(let O of await this.sets())for(let j of O.options)if(j.value.type==="string")$.set(j.id,{label:j.value.value,scope:O.scope==="user"?"personal":"team"});return $}async body($){for(let[S,K,Z]of[["sortBy",$.sortBy,["recently_viewed","recently_updated","recently_created"]],["emailPreset",$.emailPreset,["signal"]],["tagsMatch",$.tagsMatch,["any","all"]]])if(K!==void 0&&!Z.includes(K))throw Error(`Invalid workspace ${S}: ${K}`);if($.includeTypes!==void 0&&(!Array.isArray($.includeTypes)||$.includeTypes.some((S)=>!Object.hasOwn(_0,S))))throw Error(`Invalid workspace includeTypes. Supported values: ${Object.keys(_0).join(", ")}. Tasks use document with df: {l: {dst: 'task'}}.`);for(let S of["df","pf","cf","ef","chanf","cthf","callf","fef","calf","propf"])if($[S]!=null)M0($[S],S);if($.tags?.some((S)=>S.scope!==void 0&&S.scope!=="personal"&&S.scope!=="team"))throw Error("Invalid workspace tag scope");if($.limit!==void 0&&!Number.isFinite($.limit))throw Error("Workspace limit must be finite");let O={df:$.df,pf:$.pf,cf:$.cf,ef:$.ef,chanf:$.chanf,cthf:$.cthf,callf:$.callf,fef:$.fef,calf:$.calf,propf:$.propf,ccf:{l:{id:v1}},favorites_only:$.favoritesOnly,expand:!0,limit:Math.max(1,Math.min(500,Math.trunc($.limit??50))),sort_method:$.sortBy==="recently_viewed"?"viewed_at":$.sortBy==="recently_created"?"created_at":"updated_at",sort_direction:"desc",emailView:$.emailView??"inbox"};if($.emailPreset==="signal")O.ef={"&":[{l:{Importance:!0}},{l:{Shared:"exclude"}}]};let j=$.inbox?.trim();if(j){let{links:S}=Q(await this.client.email.listLinks()),K=S.filter((X)=>Hj(X.email_address)===Hj(j)),Z=K[0];if(!Z)throw Error(`No connected inbox matches "${j}". Connected inboxes: ${S.map((X)=>X.email_address).join(", ")}.`);if(K.length>1)throw Error(`Multiple connected inboxes match "${j}"; cannot pick one.`);O.ef=h1(O.ef,{l:{Owner:Z.id}})}let x=$.includeTypes??($.emailPreset==="signal"?["email"]:void 0);if(x?.length){for(let[S,[K,Z]]of Object.entries(_0))if(!x.includes(S))O[K]={l:{[Z]:v1}}}if($.tags?.length){let S=(await this.sets()).flatMap((G)=>{let L=G.definition;if(!L)return[];return G.options.flatMap((Y)=>Y.value.type==="string"?[{id:Y.id,definitionId:L.id,label:Y.value.value,scope:G.scope==="user"?"personal":"team"}]:[])}),K=new Map;for(let G of $.tags){let L=S.filter((Y)=>Hj(Y.label)===Hj(G.label.trim())&&(!G.scope||Y.scope===G.scope));if(!L.length)throw Error(`Unknown tag "${G.label}". Available tags: ${S.map((Y)=>`${Y.label} (${Y.scope})`).join(", ")}.`);if($.tagsMatch==="all"&&L.length>1)throw Error(`Tag "${G.label}" is ambiguous; specify personal or team scope.`);for(let Y of L)K.set(Y.id,Y)}let X=[...K.values()].map((G)=>({l:{pd:G.definitionId,v:{so:G.id}}})).reduce((G,L)=>G===void 0?L:{[$.tagsMatch==="all"?"&":"|"]:[G,L]},void 0);O.propf=h1(O.propf,X)}return O}}class A0{client;constructor($){this.client=$}async page($={}){let O=new Rj(this.client);return this.fetch(O,await O.body($),$.cursor)}async*list($={}){let O=new Rj(this.client),j=await O.body($);yield*a((x)=>this.fetch(O,j,x))}async fetch($,O,j){let x=Q(await this.client.storage.postItemsSoupAst({body:O,query:j?{cursor:j}:void 0})),K=x.items.some((Z)=>C0(Z).some((X)=>X.definition.data_type==="TAG"))?await $.tagMap():new Map;return{items:x.items.map((Z)=>y1(this.client,Z,K)),nextCursor:x.next_cursor,hasMore:x.next_cursor!=null}}}function m1({onRequest:$,onSseError:O,onSseEvent:j,responseTransformer:x,responseValidator:S,sseDefaultRetryDelay:K,sseMaxRetryAttempts:Z,sseMaxRetryDelay:X,sseSleepFn:G,url:L,...Y}){let J,T=G??((V)=>new Promise((B)=>setTimeout(B,V)));return{stream:async function*(){let V=K??3000,B=0,I=Y.signal??new AbortController().signal;while(!0){if(I.aborted)break;B++;let P=Y.headers instanceof Headers?Y.headers:new Headers(Y.headers);if(J!==void 0)P.set("Last-Event-ID",J);try{let D={redirect:"follow",...Y,body:Y.serializedBody,headers:P,signal:I},C=new Request(L,D);if($)C=await $(L,D);let N=await(Y.fetch??globalThis.fetch)(C);if(!N.ok)throw Error(`SSE failed: ${N.status} ${N.statusText}`);if(!N.body)throw Error("No body in SSE response");let H=N.body.pipeThrough(new TextDecoderStream).getReader(),U="",k=()=>{try{H.cancel()}catch{}};I.addEventListener("abort",k);try{while(!0){let{done:d,value:l}=await H.read();if(d)break;U+=l,U=U.replace(/\r\n?/g,``);let g=U.split(``);U=g.pop()??"";for(let r of g){let p=r.split(`diff --git a/crates/complete_graph/AGENTS.md b/crates/complete_graph/AGENTS.mdindex 99534031fe..f3acccdfa4 100644--- a/crates/complete_graph/AGENTS.md+++ b/crates/complete_graph/AGENTS.md@@ -113,6 +113,10 @@ The exported `static_assets/schema.graphql` feeds both the client codegenkeep persisted client caches; a change that makes stored records unsafe needs abump of `CACHE_SCHEMA_COMPATIBILITY_EPOCH` in `crates/client/cache-core/src/codec.rs`.+Email send admission, cancellation and status are exposed by `graphql_email`;+`GraphqlUser.pendingEmailSends` lists authorized inbox attempts with cursor pagination.+Keep this viewer-scoped listing independent of normalized-cache initialization.+Never remove or narrow anything deployed clients send without a dateddeprecation (`Remove after YYYY-MM-DD`, at least 30 days out).`cargo x graphql-schema-compat` checks the SDL against `origin/main`, and CI runsdiff --git a/crates/complete_graph/Cargo.toml b/crates/complete_graph/Cargo.tomlindex 962b550471..27c24eb8c8 100644--- a/crates/complete_graph/Cargo.toml+++ b/crates/complete_graph/Cargo.toml@@ -54,6 +54,7 @@ soup_realtime = { path = "../soup_realtime", default-features = false, features"ports",] }tokio = { workspace = true }+tracing = { workspace = true }uuid = { workspace = true }workspace-hack = { version = "0.1", path = "../workspace-hack" }@@ -76,5 +77,4 @@ models_soup = { path = "../models_soup" }rootcause = { workspace = true }scheduled_action = { path = "../scheduled_action" }serde = { workspace = true }-tracing = { workspace = true }uuid = { workspace = true }diff --git a/crates/complete_graph/src/schema.rs b/crates/complete_graph/src/schema.rsindex a86319b7fa..6e5073331e 100644--- a/crates/complete_graph/src/schema.rs+++ b/crates/complete_graph/src/schema.rs@@ -8,6 +8,7 @@ use crate::realtime::AgentSessionLogSubscriptions;use agent_session::domain::model::AgentSessionId;use async_graphql::{Context, ID, MergedObject, MergedSubscription, Object, Schema, Subscription};use axum::extract::FromRef;+use email::domain::send_attempt::EmailSendService;use email::{domain::ports::{EmailService, EmailUserService, NoOpEmailService},inbound::axum::previews_router::EmailRouterState,@@ -92,7 +93,7 @@ pub struct CompleteMutationRoot<C: ChannelActivityMutationService,N: NotificationMutationService,A: ChannelActivityAuthorizer,- ES: EmailService,+ ES: EmailService + EmailSendService,>(PropertiesMutationRoot<W>,EntityMutationRoot<M, E>,@@ -100,6 +101,7 @@ pub struct CompleteMutationRoot<ChannelMutationRoot<C, A>,NotificationMutationRoot<N>,GraphqlEmailMutation<ES, SoupEmailThreadMutationOutput<E>>,+ graphql_email::GraphqlEmailSendMutation<ES, SoupEmailThreadMutationOutput<E>>,InitiativeMutationRoot<E>,CalendarMutationRoot,WorkFeedMutationRoot<E>,@@ -113,7 +115,7 @@ impl<C: ChannelActivityMutationService,N: NotificationMutationService,A: ChannelActivityAuthorizer,- ES: EmailService,+ ES: EmailService + EmailSendService,> CompleteMutationRoot<W, M, F, E, C, N, A, ES>{/// Construct the composed mutation root.@@ -125,6 +127,7 @@ impl<ChannelMutationRoot::<C, A>::new(),NotificationMutationRoot::<N>::new(),GraphqlEmailMutation::<ES, SoupEmailThreadMutationOutput<E>>::new(),+ graphql_email::GraphqlEmailSendMutation::<ES, SoupEmailThreadMutationOutput<E>>::default(),InitiativeMutationRoot::<E>::default(),CalendarMutationRoot,WorkFeedMutationRoot::<E>::default(),@@ -366,7 +369,7 @@ pub fn build_schema_with_service<S, E, EAS, Auth, St, W, M, FM, C, N, NR, PR, ER>whereS: SoupService + Clone,- E: EmailService + EmailUserService,+ E: EmailService + EmailUserService + EmailSendService,EAS: EntityAccessService,Auth: MacroAuthorizationService,St: Clone + Send + Sync + 'static,@@ -427,7 +430,7 @@ whereNS: WebSocketNotificationSubscriptionService<NotificationSubscriptionUpdate<NotifEvent>>+ Clone,AS: ActivitySubscriptionService,- E: EmailService + EmailUserService,+ E: EmailService + EmailUserService + EmailSendService,EAS: EntityAccessService,Auth: MacroAuthorizationService,St: Clone + Send + Sync + 'static,@@ -486,7 +489,7 @@ pub fn build_schema_from_arc<S, E, EAS, Auth, St, W, M, FM, C, N, NR, PR, ER, FR>whereS: SoupService,- E: EmailService + EmailUserService,+ E: EmailService + EmailUserService + EmailSendService,EAS: EntityAccessService,Auth: MacroAuthorizationService,St: Clone + Send + Sync + 'static,@@ -541,7 +544,7 @@ whereR: SoupRealtimeSubscriptionService,NS: WebSocketNotificationSubscriptionService<NotificationSubscriptionUpdate<NotifEvent>>,AS: ActivitySubscriptionService,- E: EmailService + EmailUserService,+ E: EmailService + EmailUserService + EmailSendService,EAS: EntityAccessService,Auth: MacroAuthorizationService,St: Clone + Send + Sync + 'static,@@ -574,7 +577,7 @@ impl<S, E, EAS, Auth, St, NR, PR, ER, FR, AR, AcR>SoupQueryRoot<S, E, EAS, Auth, St, NR, PR, ER, FR, AR, AcR>whereS: SoupService + Clone,- E: EmailService + EmailUserService,+ E: EmailService + EmailUserService + EmailSendService,EAS: EntityAccessService,Auth: MacroAuthorizationService,St: Clone + Send + Sync + 'static,@@ -681,7 +684,7 @@ impl<S, E, EAS, Auth, St, NR, PR, ER, FR, AR, AcR>GraphqlUser<S, E, EAS, Auth, St, NR, PR, ER, FR, AR, AcR>whereS: SoupService,- E: EmailService + EmailUserService,+ E: EmailService + EmailUserService + EmailSendService,EAS: EntityAccessService,Auth: MacroAuthorizationService,St: Clone + Send + Sync + 'static,@@ -851,6 +854,28 @@ whereOk(GraphqlEmailQuery::new(service, self.user_id.clone()))}+ /// Inspect a queued send after reconnect or restart without resending it.+ async fn pending_email_sends(+ &self,+ ctx: &Context<'_>,+ after: Option<String>,+ ) -> async_graphql::Result<graphql_email::PendingEmailSends> {+ let state = ctx.data::<St>()?;+ let service = EmailRouterState::<E>::from_ref(state).service();+ graphql_email::load_pending_sends(service.as_ref(), self.user_id.clone(), after).await+ }++ /// Inspect a queued send after reconnect or restart without resending it.+ async fn email_send_attempt(+ &self,+ ctx: &Context<'_>,+ input: graphql_email::EmailSendAttemptInput,+ ) -> async_graphql::Result<Option<graphql_email::EmailSendAttemptPayload>> {+ let state = ctx.data::<St>()?;+ let service = EmailRouterState::<E>::from_ref(state).service();+ graphql_email::load_send_attempt(service.as_ref(), self.user_id.clone(), input).await+ }+/// Fetch one accessible email thread by its canonical identifier.async fn email_thread(&self,@@ -859,6 +884,15 @@ where) -> async_graphql::Result<Option<GraphqlSoupEmailThread<SoupEdges<NR, PR, ER, FR, AR, AcR>>>>{let thread_id = parse_id(input.thread_id, "threadId")?;+ let state = ctx.data::<St>()?;+ let service = EmailRouterState::<E>::from_ref(state).service();+ let thread_id = service+ .resolve_thread_read_id(self.user_id.clone(), thread_id)+ .await+ .map_err(|error| {+ tracing::error!(error = ?error, %thread_id, user_id = %self.user_id, "failed to resolve email thread");+ graphql_email::draft_mutation_error(&error)+ })?;resolve_soup_email_thread::<SoupEdges<NR, PR, ER, FR, AR, AcR>>(ctx,self.user_id.clone(),diff --git a/crates/complete_graph/src/schema/test.rs b/crates/complete_graph/src/schema/test.rsindex 6cf13f91e6..94718592ab 100644--- a/crates/complete_graph/src/schema/test.rs+++ b/crates/complete_graph/src/schema/test.rs@@ -1,6 +1,6 @@use std::collections::HashMap;use std::sync::Mutex;-use std::sync::atomic::{AtomicUsize, Ordering};+use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};use axum::http::{Request as HttpRequest, header};use email::domain::models::{@@ -338,6 +338,8 @@ impl SoupService for CountingSoupService {/// the lazy extraction actually runs.#[derive(Clone, Default)]struct CountingEmailService {+ thread_read_fails: Arc<Mutex<bool>>,+ thread_read_redirect: Arc<Mutex<Option<(Uuid, Uuid)>>>,thread_is_read: Arc<Mutex<bool>>,thread_archived: Arc<Mutex<bool>>,archive_mutation_calls: Arc<Mutex<Vec<(MacroUserIdStr<'static>, Uuid, bool)>>>,@@ -394,6 +396,42 @@ fn test_email_err() -> EmailErr {EmailErr::RepoErr(anyhow::anyhow!("counting email service"))}+impl email::domain::send_attempt::EmailSendService for CountingEmailService {+ async fn pending_email_sends(+ &self,+ _: MacroUserIdStr<'static>,+ _: Option<email::domain::send_attempt::SendAttemptCursor>,+ ) -> Result<email::domain::send_attempt::SendAttemptPage, EmailErr> {+ Err(test_email_err())+ }++ async fn send_email(+ &self,+ _: MacroUserIdStr<'static>,+ _: Uuid,+ _: email::domain::send_attempt::SendAttemptId,+ _: email::domain::send_attempt::SendSnapshot,+ ) -> Result<email::domain::send_attempt::SendAttempt, EmailErr> {+ Err(test_email_err())+ }+ async fn cancel_email_send(+ &self,+ _: MacroUserIdStr<'static>,+ _: Uuid,+ _: email::domain::send_attempt::SendAttemptId,+ ) -> Result<email::domain::send_attempt::SendAttempt, EmailErr> {+ Err(test_email_err())+ }+ async fn email_send_status(+ &self,+ _: MacroUserIdStr<'static>,+ _: Uuid,+ _: email::domain::send_attempt::SendAttemptId,+ ) -> Result<Option<email::domain::send_attempt::SendAttempt>, EmailErr> {+ Err(test_email_err())+ }+}+impl EmailUserService for CountingEmailService {async fn get_user_email_senders(&self,@@ -458,6 +496,24 @@ impl EmailUserService for CountingEmailService {}impl EmailService for CountingEmailService {+ async fn resolve_thread_read_id(+ &self,+ macro_id: MacroUserIdStr<'_>,+ thread_id: Uuid,+ ) -> Result<Uuid, EmailErr> {+ assert_eq!(macro_id.as_ref(), VALID_USER_ID);+ if *self.thread_read_fails.lock().unwrap() {+ return Err(anyhow::anyhow!("private repository diagnostic").into());+ }+ Ok(self+ .thread_read_redirect+ .lock()+ .unwrap()+ .filter(|(source, _)| *source == thread_id)+ .map(|(_, canonical)| canonical)+ .unwrap_or(thread_id))+ }+async fn resolve_message_operation(&self,_actor: macro_user_id::user_id::MacroUserIdStr<'static>,@@ -569,6 +625,7 @@ impl EmailService for CountingEmailService {&self,_macro_id: MacroUserIdStr<'_>,_draft_id: Uuid,+ _expected_generation: i32,) -> Result<email::domain::models::DeletedUserDraft, EmailErr> {Err(test_email_err())}@@ -674,6 +731,40 @@ impl EmailService for CountingEmailService {}}+#[tokio::test]+async fn email_thread_redirect_reauthorizes_the_canonical_soup_entity() {+ let source = Uuid::from_u128(420);+ let canonical = Uuid::from_u128(421);+ for visible in [None, Some(source), Some(canonical)] {+ let harness = harness();+ *harness.email_service.thread_read_redirect.lock().unwrap() = Some((source, canonical));+ // Visibility of the retained source alone must never satisfy the+ // redirected lookup's canonical entity authorization.+ harness+ .thread_reader+ .set_raw_threads(visible.into_iter().map(soup_email_thread).collect());+ let response = harness+ .execute(&format!(+ r#"{{ user {{ emailThread(input: {{threadId: "{source}"}}) {{ id }} }} }}"#+ ))+ .await;+ if visible == Some(source) {+ // Even a malformed loader response containing the shared source+ // cannot stand in for the requested canonical entity.+ assert_eq!(response.errors.len(), 1);+ assert!(response.errors[0].message.contains("unrequested entity"));+ } else {+ assert!(response.errors.is_empty(), "{:?}", response.errors);+ }+ let data = response.data.into_json().unwrap();+ if visible == Some(canonical) {+ assert_eq!(data["user"]["emailThread"]["id"], canonical.to_string());+ } else {+ assert!(data["user"]["emailThread"].is_null());+ }+ }+}+#[derive(Clone, Default)]struct RecordingEmailContentReader {calls: Arc<Mutex<Vec<Vec<graphql_email::EmailContentKey>>>>,@@ -878,6 +969,7 @@ impl graphql_activity::ActivityFeedReader for RecordingActivityReader {fn parsed_message(thread_id: Uuid) -> ParsedMessage {ParsedMessage {+ draft_generation: 0,db_id: Uuid::from_u128(100),link_id: Uuid::from_u128(200),thread_db_id: thread_id,@@ -909,6 +1001,7 @@ fn full_message(thread_id: Uuid) -> Message {let message_id = Uuid::from_u128(100);let draft_attachment_id = Uuid::from_u128(102);Message {+ draft_generation: 0,operation_status: None,calendar_invitations: Default::default(),db_id: message_id,@@ -930,6 +1023,7 @@ fn full_message(thread_id: Uuid) -> Message {is_draft: true,has_attachments: true,scheduled_send_time: Some(Default::default()),+ scheduled_send_status: Some(email::domain::models::ScheduledSendStatus::Failed),from: None,to: Vec::new(),cc: Vec::new(),@@ -1191,10 +1285,17 @@ impl FromRef<TestState> for Arc<CountingEntityAccessService> {#[derive(Clone, Default)]struct RecordingThreadReader {reads: Arc<AtomicUsize>,+ return_unrequested_threads: Arc<AtomicBool>,threads: Arc<Mutex<Vec<SoupItem<()>>>>,}impl RecordingThreadReader {+ fn set_raw_threads(&self, threads: Vec<SoupItem<()>>) {+ self.set_threads(threads);+ self.return_unrequested_threads+ .store(true, Ordering::SeqCst);+ }+fn set_threads(&self, threads: Vec<SoupItem<()>>) {*self.threads.lock().unwrap() = threads;}@@ -1214,7 +1315,10 @@ impl graphql_soup::SoupEmailThreadReader for RecordingThreadReader {.unwrap().iter().filter_map(|item| match item {- SoupItem::EmailThread(thread) if thread_ids.contains(&thread.thread.id) => {+ SoupItem::EmailThread(thread)+ if self.return_unrequested_threads.load(Ordering::SeqCst)+ || thread_ids.contains(&thread.thread.id) =>+ {Some(thread.clone())}_ => None,@@ -2559,6 +2663,26 @@ async fn activity_overview_uses_the_authenticated_subject_and_requested_zone() {assert_eq!(overview["topEntities"][0]["count"], 2);}+#[tokio::test]+async fn email_message_delivery_status_alone_requests_the_full_edge_payload() {+ let harness = harness();+ let thread_id = Uuid::from_u128(43);+ harness+ .thread_reader+ .set_threads(vec![soup_email_thread(thread_id)]);+ let response = harness+ .execute(&format!(+ r#"{{ user {{ emailThread(input: {{threadId: "{thread_id}"}}) {{ messages(offset: 0, limit: 1) {{ scheduledSendStatus }} }} }} }}"#+ ))+ .await;+ assert!(response.errors.is_empty(), "{:?}", response.errors);+ let data = response.data.into_json().unwrap();+ assert_eq!(+ data["user"]["emailThread"]["messages"][0]["scheduledSendStatus"],+ "FAILED"+ );+}+#[tokio::test]async fn email_message_full_fields_request_the_full_edge_payload() {let harness = harness();@@ -2569,7 +2693,7 @@ async fn email_message_full_fields_request_the_full_edge_payload() {let response = harness.execute(&format!(- r#"{{ user {{ emailThread(input: {{threadId: "{thread_id}"}}) {{ messages(offset: 2, limit: 4) {{ providerId replyingToId scheduledSendTime bodyParsed attachments {{ id providerId sfsId referenceUrl }} attachmentsDraft {{ id draftId fileName }} attachmentsForwarded {{ attachmentId draftId providerAttachmentId }} }} }} }} }}"#+ r#"{{ user {{ emailThread(input: {{threadId: "{thread_id}"}}) {{ messages(offset: 2, limit: 4) {{ providerId replyingToId scheduledSendTime scheduledSendStatus bodyParsed attachments {{ id providerId sfsId referenceUrl }} attachmentsDraft {{ id draftId fileName }} attachmentsForwarded {{ attachmentId draftId providerAttachmentId }} }} }} }} }}"#)).await;@@ -2579,6 +2703,7 @@ async fn email_message_full_fields_request_the_full_edge_payload() {assert_eq!(message["providerId"], "provider-message");assert_eq!(message["replyingToId"], Uuid::from_u128(101).to_string());assert!(message["scheduledSendTime"].as_str().is_some());+ assert_eq!(message["scheduledSendStatus"], "FAILED");assert_eq!(message["bodyParsed"], "Direct thread body");assert_eq!(message["attachments"][0]["sfsId"],diff --git a/crates/complete_graph/src/schema/test/email_archive.rs b/crates/complete_graph/src/schema/test/email_archive.rsindex c74255af1e..2ff2d4589d 100644--- a/crates/complete_graph/src/schema/test/email_archive.rs+++ b/crates/complete_graph/src/schema/test/email_archive.rs@@ -1,5 +1,26 @@use super::*;+#[tokio::test]+async fn thread_read_repository_errors_are_masked_before_soup_lookup() {+ let harness = harness();+ *harness.email_service.thread_read_fails.lock().unwrap() = true;+ let response = harness+ .execute(&format!(+ r#"{{ user {{ emailThread(input: {{threadId: "{}"}}) {{id}} }} }}"#,+ Uuid::from_u128(44),+ ))+ .await;+ assert_eq!(response.errors.len(), 1);+ let error = &response.errors[0];+ assert_eq!(error.message, "email draft mutation failed");+ assert_eq!(+ error.extensions.as_ref().unwrap().get("code"),+ Some(&async_graphql::Value::from("INTERNAL"))+ );+ assert!(!format!("{response:?}").contains("private repository diagnostic"));+ assert_eq!(harness.raw_soup_calls.load(Ordering::SeqCst), 0);+}+#[tokio::test]async fn ordinary_email_queries_use_the_replica_while_mutations_reload_from_primary() {let harness = harness();diff --git a/crates/complete_graph/src/sdl_test.rs b/crates/complete_graph/src/sdl_test.rsindex 18a84247e8..0f13f9e8ac 100644--- a/crates/complete_graph/src/sdl_test.rs+++ b/crates/complete_graph/src/sdl_test.rs@@ -138,9 +138,12 @@ fn soup_response_schema_exposes_frontend_fields() {"saveEmailDraft(input: SaveEmailDraftInput!): SaveEmailDraftPayload!","sendEmailMessage(input: SendEmailMessageInput!): SendEmailMessagePayload!","input SendEmailMessageInput {",+ "sendEmailAttempt(input: SendEmailAttemptInput!): SendEmailAttemptPayload!",+ "input SendEmailAttemptInput {","draft: SaveEmailDraftInput!","includeSignature: Boolean","type SendEmailMessagePayload {",+ "type SendEmailAttemptPayload {","messageId: ID!","senderEmail: String","deleteEmailDraft(input: DeleteEmailDraftInput!): DeleteEmailDraftPayload!",diff --git a/crates/email/AGENTS.md b/crates/email/AGENTS.mdindex 4b3a40c5dc..a2803bc39a 100644--- a/crates/email/AGENTS.md+++ b/crates/email/AGENTS.md@@ -49,6 +49,10 @@ tools — hexagonal, heavily feature-gated.## Gotchas+- Reconcile deferred message deletion before claiming scheduled work; unresolved sends retain their message, attachments, and delivery job.+- Durable send admission supports Gmail and Outlook; Outlook delivery stays with its provider coordinator.+- Carry the captured `draft_generation` through every draft mutation; advance it on send acceptance/cancellation under the message lock and preserve attempt tombstones after message deletion.+- Forwarded attachments register through `domain/draft_attachments.rs` and resolvebytes through `domain/attachment_access.rs`; scheduled delivery also recheckssource inbox access in `domain/forwarded_attachments.rs`, including legacy jobs.diff --git a/crates/email/Cargo.toml b/crates/email/Cargo.tomlindex 932c0d5210..7113494f8e 100644--- a/crates/email/Cargo.toml+++ b/crates/email/Cargo.toml@@ -112,6 +112,8 @@ uuid = { workspace = true }workspace-hack = { version = "0.1", path = "../workspace-hack" }[dev-dependencies]+models_email = { path = "../models_email" }+email_db_client = { path = "../email_db_client" }crm = { path = "../crm", features = ["outbound"] }frecency = { path = "../frecency", features = ["outbound", "postgres"] }macro_db_migrator = { path = "../macro_db_migrator" }diff --git a/crates/email/src/domain.rs b/crates/email/src/domain.rsindex 5baeae5c93..da66e97ada 100644--- a/crates/email/src/domain.rs+++ b/crates/email/src/domain.rs@@ -25,6 +25,8 @@ pub mod scheduled;#[cfg(feature = "ports")]pub mod scheduled_delivery;#[cfg(feature = "ports")]+pub mod send_attempt;+#[cfg(feature = "ports")]pub mod service;#[cfg(feature = "ports")]diff --git a/crates/email/src/domain/assembler.rs b/crates/email/src/domain/assembler.rsindex 8a23286917..934b19eba0 100644--- a/crates/email/src/domain/assembler.rs+++ b/crates/email/src/domain/assembler.rs@@ -30,11 +30,12 @@ pub fn message_from_row(attachments: Vec<MessageAttachment>,attachments_draft: Vec<AttachmentDraft>,attachments_forwarded: Vec<AttachmentForwarded>,- scheduled_send_time: Option<chrono::DateTime<chrono::Utc>>,+ scheduled_send: Option<crate::domain::models::ScheduledSend>,body_replyless: Option<String>,calendar_invitations: Vec<CalendarInvitation>,) -> Message {Message {+ draft_generation: row.draft_generation,operation_status: None,calendar_invitations,db_id: row.db_id,@@ -55,7 +56,8 @@ pub fn message_from_row(is_sent: row.is_sent,is_draft: row.is_draft,has_attachments: row.has_attachments,- scheduled_send_time,+ scheduled_send_time: scheduled_send.as_ref().map(|schedule| schedule.send_time),+ scheduled_send_status: scheduled_send.map(|schedule| schedule.status),from,to,cc,diff --git a/crates/email/src/domain/draft_attachments.rs b/crates/email/src/domain/draft_attachments.rsindex fbd084a198..667a778862 100644--- a/crates/email/src/domain/draft_attachments.rs+++ b/crates/email/src/domain/draft_attachments.rs@@ -64,6 +64,7 @@ pub struct AttachmentEditFacts {pub authorized: bool,pub editable: bool,pub scheduled: bool,+ pub generation_matches: bool,pub provider: UserProvider,pub total_bytes: u64,}@@ -78,7 +79,7 @@ pub fn validate_attachment_edit(if !facts.editable {return Err(AttachmentError::NotFound);}- if facts.scheduled {+ if facts.scheduled || !facts.generation_matches {return Err(AttachmentError::DeliveryConflict);}let maximum = match facts.provider {@@ -132,6 +133,8 @@ pub trait DraftAttachmentRepository: EmailUserRepo {link: Uuid,draft: Uuid,change: AttachmentChange,++ expected_generation: i32,) -> impl Future<Output = Result<(), AttachmentError>> + Send;}@@ -192,6 +195,7 @@ impl<R: DraftAttachmentRepository, S: DraftAttachmentStorage, A: EntityAccessSerlink: Uuid,draft: Uuid,upload: DraftAttachmentUpload,+ expected_generation: i32,) -> Result<(AttachmentDraft, String), AttachmentError> {let DraftAttachmentUpload {file_name,@@ -223,6 +227,7 @@ impl<R: DraftAttachmentRepository, S: DraftAttachmentStorage, A: EntityAccessSerlink,draft,AttachmentChange::Upload(attachment.clone()),+ expected_generation,).await?;let url = self.storage.upload_url(&attachment).await?;@@ -235,6 +240,7 @@ impl<R: DraftAttachmentRepository, S: DraftAttachmentStorage, A: EntityAccessSerlink: Uuid,draft: Uuid,id: Uuid,+ expected_generation: i32,) -> Result<(), AttachmentError> {self.inbox(actor, link).await?;let attachment = self@@ -249,6 +255,7 @@ impl<R: DraftAttachmentRepository, S: DraftAttachmentStorage, A: EntityAccessSerlink,draft,AttachmentChange::CompleteUpload(attachment),+ expected_generation,).await}@@ -259,6 +266,7 @@ impl<R: DraftAttachmentRepository, S: DraftAttachmentStorage, A: EntityAccessSerlink: Uuid,draft: Uuid,id: Uuid,+ expected_generation: i32,) -> Result<AttachmentReference, AttachmentError> {self.inbox(actor, link).await?;let source = self@@ -293,6 +301,7 @@ impl<R: DraftAttachmentRepository, S: DraftAttachmentStorage, A: EntityAccessSerlink,draft,AttachmentChange::Forward(source.clone()),+ expected_generation,).await?;Ok(source)@@ -305,6 +314,7 @@ impl<R: DraftAttachmentRepository, S: DraftAttachmentStorage, A: EntityAccessSerdraft: Uuid,attachment_id: Uuid,kind: RemovalKind,+ expected_generation: i32,) -> Result<(), AttachmentError> {self.inbox(actor, link).await?;self.repository@@ -316,6 +326,7 @@ impl<R: DraftAttachmentRepository, S: DraftAttachmentStorage, A: EntityAccessSerattachment_id,kind,},+ expected_generation,).await}diff --git a/crates/email/src/domain/draft_attachments/test.rs b/crates/email/src/domain/draft_attachments/test.rsindex 7a30e2912a..cd5f99e531 100644--- a/crates/email/src/domain/draft_attachments/test.rs+++ b/crates/email/src/domain/draft_attachments/test.rs@@ -2,6 +2,7 @@ use super::*;fn facts() -> AttachmentEditFacts {AttachmentEditFacts {+ generation_matches: true,authorized: true,editable: true,scheduled: false,diff --git a/crates/email/src/domain/draft_transfer.rs b/crates/email/src/domain/draft_transfer.rsindex 74a745b95b..8c2edc36a6 100644--- a/crates/email/src/domain/draft_transfer.rs+++ b/crates/email/src/domain/draft_transfer.rs@@ -18,6 +18,9 @@ use uuid::Uuid;#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]pub struct DraftTransferRequest {+ /// Source edit generation captured with the transfer request.+ #[serde(default)]+ pub draft_generation: i32,pub id: Uuid,pub source_id: Uuid,pub source_link_id: Uuid,diff --git a/crates/email/src/domain/mailbox/drafts/content.rs b/crates/email/src/domain/mailbox/drafts/content.rsindex 378622bf7f..de434e9934 100644--- a/crates/email/src/domain/mailbox/drafts/content.rs+++ b/crates/email/src/domain/mailbox/drafts/content.rs@@ -190,6 +190,7 @@ wherereferences.push(parent.clone());}let request = SendRequest {+ message_id: None,message: MessageToSend {db_id: Some(lease.message_id),provider_id: lease.provider_id.as_ref().map(|id| id.as_str().to_owned()),diff --git a/crates/email/src/domain/mailbox/drafts/test.rs b/crates/email/src/domain/mailbox/drafts/test.rsindex e494346380..25dff8f576 100644--- a/crates/email/src/domain/mailbox/drafts/test.rs+++ b/crates/email/src/domain/mailbox/drafts/test.rs@@ -28,6 +28,7 @@ fn harness(stage: Option<DraftStage>) -> Harness {let prepared = PreparedDraft {reply_to: None,request: SendRequest {+ message_id: None,message: serde_json::from_value(serde_json::json!({"db_id":message,"link_id":link,"subject":"Saved locally"}),)diff --git a/crates/email/src/domain/models/draft.rs b/crates/email/src/domain/models/draft.rsindex ffb8ad4691..556622ea07 100644--- a/crates/email/src/domain/models/draft.rs+++ b/crates/email/src/domain/models/draft.rs@@ -9,10 +9,18 @@ use super::label::MessageLabel;use super::link::Link;/// Input for creating a draft message. Mirrors the fields from `MessageToSend`.-#[derive(Debug, Clone)]+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]pub struct CreateDraftInput {+ /// Signature captured at Send; an empty value explicitly freezes no signature.+ /// None preserves legacy server-default behavior.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub frozen_signature_html: Option<String>,+ /// Generation captured when editing; admission/cancellation fence earlier writes.+ #[serde(default)]+ pub draft_generation: i32,/// Requested sender. Absent selects the inbox's primary address. The domain/// verifies alternate addresses against the selected inbox's provider grant.+ #[serde(default, skip_serializing_if = "Option::is_none")]pub sender_email: Option<macro_user_id::email::EmailStr<'static>>,/// Existing message DB ID (for updating an existing draft).pub db_id: Option<Uuid>,@@ -66,6 +74,9 @@ pub struct CreateDraftInput {/// Created from `CreateDraftInput` after validation and ID generation.#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]pub struct ResolvedDraftInput {+ /// Generation captured when editing; admission/cancellation fence earlier writes.+ #[serde(default)]+ pub draft_generation: i32,/// The resolved message DB ID.pub db_id: Uuid,/// Provider message ID.@@ -200,6 +211,8 @@ pub struct DeletedUserDraft {/// The result of creating a draft.#[derive(Debug, Clone)]pub struct CreatedDraft {+ /// Draft edit generation; changes at send and cancellation boundaries.+ pub draft_generation: i32,/// The assigned or existing message DB ID.pub db_id: Uuid,/// Provider message ID.diff --git a/crates/email/src/domain/models/error.rs b/crates/email/src/domain/models/error.rsindex c964aeb734..4d29f06b2a 100644--- a/crates/email/src/domain/models/error.rs+++ b/crates/email/src/domain/models/error.rs@@ -5,6 +5,12 @@ use uuid::Uuid;/// Errors that can occur in the email domain.#[derive(Debug, Error)]pub enum EmailErr {+ /// A send attempt was reused with a different approved snapshot.+ #[error("Send attempt payload does not match the original request")]+ SendAttemptConflict,+ /// A send snapshot is invalid or its attachments have changed.+ #[error("Invalid send snapshot: {0}")]+ InvalidSendSnapshot(String),/// A repository/infrastructure error.#[error(transparent)]RepoErr(#[from] anyhow::Error),@@ -46,6 +52,9 @@ pub enum EmailErr {/// The referenced message has already been sent and cannot be modified.#[error("Message with id {0} has already been sent")]MessageAlreadySent(Uuid),+ /// An older browser edit must not replace a newer send/cancel generation.+ #[error("Draft changed on another device; reload before applying this edit: {0}")]+ DraftGenerationConflict(Uuid),/// Delivery has been committed, claimed, or completed and cannot be edited.#[error("Message with id {0} is scheduled, processing, or already sent")]MessageDeliveryConflict(Uuid),diff --git a/crates/email/src/domain/models/message.rs b/crates/email/src/domain/models/message.rsindex f48aa66522..0fd93d0c7c 100644--- a/crates/email/src/domain/models/message.rs+++ b/crates/email/src/domain/models/message.rs@@ -4,9 +4,36 @@ use super::attachment::{AttachmentDraft, AttachmentForwarded, MessageAttachment}use super::contact::ContactInfo;use super::label::MessageLabel;+/// The user-visible delivery state of an unsent scheduled message.+#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]+#[cfg_attr(feature = "axum", derive(utoipa::ToSchema))]+#[cfg_attr(feature = "ai_schema", derive(schemars::JsonSchema))]+#[serde(rename_all = "snake_case")]+pub enum ScheduledSendStatus {+ /// Waiting for its send time or safely retrying preparation.+ Pending,+ /// Provider submission has started, or a legacy claim has an unknown outcome.+ Sending,+ /// Delivery was definitely rejected; cancellation can restore the draft.+ Failed,+ /// Delivery may have succeeded; only reconciliation is safe.+ Unconfirmed,+}++/// Persisted schedule and its delivery state, independent of the client journal.+#[derive(Debug, Clone)]+pub struct ScheduledSend {+ /// The time the user approved for delivery.+ pub send_time: DateTime<Utc>,+ /// Whether delivery is waiting, in progress, failed, or uncertain.+ pub status: ScheduledSendStatus,+}+/// A raw message record without assembled sub-types.#[derive(Debug, Clone)]pub struct MessageRow {+ /// Draft edit generation; changes at send and cancellation boundaries.+ pub draft_generation: i32,/// Database ID of the message.pub db_id: uuid::Uuid,/// Provider message ID.@@ -109,6 +136,8 @@ pub struct SimpleMessage {/// A fully assembled message with all sub-types resolved.#[derive(Debug, Clone)]pub struct Message {+ /// Draft edit generation; changes at send and cancellation boundaries.+ pub draft_generation: i32,/// Durable provider write state, when synchronization or delivery is tracked.pub operation_status: Option<super::mailbox_operation::MessageOperationStatus>,/// Immutable email-owned scheduling details.@@ -151,6 +180,8 @@ pub struct Message {pub has_attachments: bool,/// Scheduled send time for draft messages.pub scheduled_send_time: Option<DateTime<Utc>>,+ /// Delivery recovery state for an unsent scheduled message.+ pub scheduled_send_status: Option<ScheduledSendStatus>,/// Sender contact info.pub from: Option<ContactInfo>,/// To recipients.diff --git a/crates/email/src/domain/models/mod.rs b/crates/email/src/domain/models/mod.rsindex a3336b3610..fc8ca3e159 100644--- a/crates/email/src/domain/models/mod.rs+++ b/crates/email/src/domain/models/mod.rs@@ -43,7 +43,7 @@ pub use mail_projection::{EmailDraftAggregate, EmailDraftEntry, EmailPreview, EmailThreadDraftState,EmailThreadMailCacheFacts, EmailThreadMailPreviews, EmailThreadMailProjection,};-pub use message::{Message, MessageRow, SimpleMessage};+pub use message::{Message, MessageRow, ScheduledSend, ScheduledSendStatus, SimpleMessage};pub use parsed_message::{ParsedLabel, ParsedMessage, ParsedThread};pub use preview::{EmailThreadPreview, EnrichedEmailThreadPreview, GetEmailsRequest, PreviewCursorQuery,diff --git a/crates/email/src/domain/models/parsed_message.rs b/crates/email/src/domain/models/parsed_message.rsindex b6b9fa0bba..a768d126ed 100644--- a/crates/email/src/domain/models/parsed_message.rs+++ b/crates/email/src/domain/models/parsed_message.rs@@ -15,6 +15,8 @@ pub struct ParsedLabel {/// A lightweight message with parsed body text, without attachments or scheduled send times.#[derive(Debug, Clone)]pub struct ParsedMessage {+ /// Draft edit generation; changes at send and cancellation boundaries.+ pub draft_generation: i32,/// Database ID of the message.pub db_id: Uuid,/// Link ID this message belongs to.@@ -73,6 +75,7 @@ impl From<&Message> for ParsedMessage {);Self {+ draft_generation: message.draft_generation,db_id: message.db_id,link_id: message.link_id,thread_db_id: message.thread_db_id,diff --git a/crates/email/src/domain/ports.rs b/crates/email/src/domain/ports.rsindex e2fd60d01a..7f700dd0f1 100644--- a/crates/email/src/domain/ports.rs+++ b/crates/email/src/domain/ports.rs@@ -9,7 +9,6 @@ use crate::domain::models::{Thread, ThreadRow, UpdateThreadLabelsResult, UpsertEmailFilterInput, UpsertedContacts,UserEmailLink, UserProvider,};-use chrono::{DateTime, Utc};use entity_access::domain::models::{EditAccessLevel, EntityAccessReceipt, ViewAccessLevel};use macro_user_id::user_id::MacroUserIdStr;use models_pagination::{PaginatedCursor, SimpleSortMethod};@@ -295,12 +294,13 @@ pub trait EmailRepo: Send + Sync + 'static {message_ids: &[Uuid],) -> impl Future<Output = Result<HashMap<Uuid, Vec<AttachmentForwarded>>, Self::Err>> + Send;- /// Fetch scheduled send times for a set of message IDs, keyed by message ID.+ /// Fetch schedule times and delivery states, keyed by message ID./// Only returns entries for unsent scheduled messages.- fn scheduled_send_times_by_message_ids(+ fn scheduled_sends_by_message_ids(&self,message_ids: &[Uuid],- ) -> impl Future<Output = Result<HashMap<Uuid, DateTime<Utc>>, Self::Err>> + Send;+ ) -> impl Future<Output = Result<HashMap<Uuid, crate::domain::models::ScheduledSend>, Self::Err>>+ + Send;/// Fetch a simplified message by its DB ID, scoped to a set of accessible/// inbox link IDs (for validation across own + delegated inboxes).@@ -327,6 +327,14 @@ pub trait EmailRepo: Send + Sync + 'static {link_ids: &[Uuid],) -> impl Future<Output = Result<Option<Uuid>, Self::Err>> + Send;+ /// Resolve an empty server thread to its same-inbox canonical conversation.+ /// Both identities must belong to an inbox in the caller's accessible set.+ fn redirected_thread_id(+ &self,+ thread_id: Uuid,+ link_ids: &[Uuid],+ ) -> impl Future<Output = Result<Option<Uuid>, Self::Err>> + Send;+/// Find an existing draft that replies to the given message ID.fn get_draft_replying_to(&self,@@ -350,6 +358,8 @@ pub trait EmailRepo: Send + Sync + 'static {thread_db_id: Uuid,link_ids: &[Uuid],actor: Option<&str>,++ expected_generation: i32,) -> impl Future<Output = Result<Option<DraftDeletion>, Self::Err>> + Send;/// Upsert contacts from the parsed addresses. Must be called outside a transaction@@ -467,8 +477,12 @@ pub trait EmailRepo: Send + Sync + 'static {link_id: Uuid,) -> impl Future<Output = Result<Vec<LinkLabel>, Self::Err>> + Send;- /// Delete unsent scheduled messages for a batch of draft message IDs.- /// Returns the message ids that actually had a pending scheduled send.+ /// Cancel scheduled deliveries for currently unsent drafts under the+ /// message -> schedule lock order. Preserve submitted, unconfirmed and+ /// ambiguous legacy claims; managed preparation may be revoked before+ /// submission. Atomically retire the revoked sends' attempts so a delayed+ /// cancellation cannot affect a replacement send. Returns only the message+ /// IDs actually cancelled.fn delete_scheduled_messages_batch(&self,message_ids: &[Uuid],@@ -748,6 +762,14 @@ pub trait EmailService: Send + Sync + 'static {thread_id: Uuid,) -> impl Future<Output = Result<Option<Link>, EmailErr>> + Send;+ /// Follow an empty thread's canonical alias only within the user's inboxes.+ /// The returned thread still requires normal entity authorization at the caller.+ fn resolve_thread_read_id(+ &self,+ macro_id: MacroUserIdStr<'_>,+ thread_id: Uuid,+ ) -> impl Future<Output = Result<Uuid, EmailErr>> + Send;+/// Fetch a thread with paginated messages, verifying access via the provided receipt.fn get_thread_with_messages(&self,@@ -799,6 +821,8 @@ pub trait EmailService: Send + Sync + 'static {&self,macro_id: MacroUserIdStr<'_>,draft_id: Uuid,++ expected_generation: i32,) -> impl Future<Output = Result<DeletedUserDraft, EmailErr>> + Send;/// Send a message: persist it and enqueue for scheduled delivery.@@ -1041,6 +1065,8 @@ pub trait DraftSendService: Send + Sync + 'static {&self,macro_id: MacroUserIdStr<'_>,draft_id: Uuid,++ expected_generation: i32,) -> impl Future<Output = Result<DeletedUserDraft, EmailErr>> + Send;}@@ -1067,8 +1093,10 @@ impl<T: EmailService> DraftSendService for T {&self,macro_id: MacroUserIdStr<'_>,draft_id: Uuid,++ expected_generation: i32,) -> impl Future<Output = Result<DeletedUserDraft, EmailErr>> + Send {- EmailService::delete_draft_for_user(self, macro_id, draft_id)+ EmailService::delete_draft_for_user(self, macro_id, draft_id, expected_generation)}}@@ -1191,6 +1219,14 @@ impl EmailUserService for NoOpEmailService {}impl EmailService for NoOpEmailService {+ async fn resolve_thread_read_id(+ &self,+ _macro_id: MacroUserIdStr<'_>,+ thread_id: Uuid,+ ) -> Result<Uuid, EmailErr> {+ Ok(thread_id)+ }+async fn resolve_message_operation(&self,_actor: MacroUserIdStr<'static>,@@ -1295,6 +1331,8 @@ impl EmailService for NoOpEmailService {&self,_macro_id: MacroUserIdStr<'_>,_draft_id: Uuid,++ _expected_generation: i32,) -> Result<DeletedUserDraft, EmailErr> {Err(no_op_email_err())}diff --git a/crates/email/src/domain/scheduled.rs b/crates/email/src/domain/scheduled.rsindex b38097f116..47a025154f 100644--- a/crates/email/src/domain/scheduled.rs+++ b/crates/email/src/domain/scheduled.rs@@ -20,13 +20,15 @@ use super::{pub enum ScheduleChange {/// Commit or update a future delivery time.Set(DateTime<Utc>),- /// Restore an unclaimed, unsent message to an editable draft.+ /// Restore an unsent message before provider submission to an editable draft.Cancel,}/// Atomic persistence for schedule transitions. Implementations must serialize-/// against claim/finalization and reject sent/processing messages. An absent-/// schedule can only be cancelled idempotently for an unsent editable draft.+/// against claim/finalization. Cancellation may revoke a managed preparation+/// claim before submission, but must reject submitted or ambiguous legacy claims.+/// Time changes must reject processing messages. An absent schedule can only be+/// cancelled idempotently for an unsent editable draft.pub trait EmailSchedulingRepo: Send + Sync {/// Return the changed thread, or `None` for an already-cancelled draft.fn change_schedule(@@ -36,6 +38,8 @@ pub trait EmailSchedulingRepo: Send + Sync {actor: &MacroUserIdStr<'_>,change: ScheduleChange,signature: Option<&SignaturePreparation>,++ expected_generation: i32,) -> impl Future<Output = Result<Option<Uuid>, EmailErr>> + Send;}@@ -49,6 +53,8 @@ pub trait EmailSchedulingService: Send + Sync {message_id: Uuid,change: ScheduleChange,include_signature: Option<bool>,++ expected_generation: i32,) -> impl Future<Output = Result<(), EmailErr>> + Send;}@@ -69,6 +75,8 @@ wheremessage_id: Uuid,change: ScheduleChange,include_signature: Option<bool>,++ expected_generation: i32,) -> Result<(), EmailErr> {let link = self.email_repo@@ -92,7 +100,14 @@ where};let Some(thread_id) = self.email_repo- .change_schedule(link_id, message_id, &actor, change, signature.as_ref())+ .change_schedule(+ link_id,+ message_id,+ &actor,+ change,+ signature.as_ref(),+ expected_generation,+ ).await?else {return Ok(());diff --git a/crates/email/src/domain/scheduled_delivery.rs b/crates/email/src/domain/scheduled_delivery.rsindex f42af356f3..cc053635dd 100644--- a/crates/email/src/domain/scheduled_delivery.rs+++ b/crates/email/src/domain/scheduled_delivery.rs@@ -1,39 +1,131 @@-//! Claim ownership for queue-driven email delivery. No database lock spans the-//! provider call; only the invocation receiving a claim can release/finalize it.+//! Fenced delivery and recovery. An uncertain provider submission is reconciled,+//! never automatically repeated. No database lock spans provider work.+use std::time::Instant;use uuid::Uuid;-/// Atomic claim and completion persistence.+/// Approved attachment identity checks shared by delivery adapters.+pub mod attachments;+/// Recovery scanning and queue notification policy.+pub mod recovery;++/// A worker must renew ownership before crossing the provider boundary.+pub const DELIVERY_LEASE_SECONDS: i32 = 300;+/// Failed lookups and negative searches may be retried without resending mail.+pub const RECONCILIATION_DELAY_SECONDS: i32 = 300;+/// Back off failures that occurred before any provider submission.+pub const PREPARATION_RETRY_SECONDS: i32 = 60;++/// Work permitted by a newly acquired delivery claim.+#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub enum DeliveryMode {+ /// No provider submission has begun; preparation and delivery are safe.+ Send,+ /// Submission may have succeeded; only provider lookup is safe.+ Reconcile,+}++/// Opaque repository ownership plus the domain action it permits.+pub struct ClaimedDelivery<C> {+ /// Fenced persistence receipt and provider context.+ pub claim: C,+ /// Whether this invocation may send or must reconcile an earlier send.+ pub mode: DeliveryMode,+}++/// Recoverable states that stop automatic provider submission.+#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub enum DeliveryPause {+ /// Preparation or explicit provider rejection failed; cancellation is safe.+ Failed,+ /// Provider acceptance could not be established; cancellation cannot be promised.+ Unconfirmed,+}++/// Preparation has no provider send side effects.+#[derive(Debug, thiserror::Error)]+pub enum PreparationError {+ /// A temporary failure before submission may be retried safely.+ #[error(transparent)]+ Retry(anyhow::Error),+ /// The user must review the message, attachments, or account before retrying.+ #[error(transparent)]+ Failed(anyhow::Error),+}++/// A failed send response must retain whether delivery might have occurred.+#[derive(Debug, thiserror::Error)]+pub enum SubmissionError {+ /// The provider explicitly refused the send without accepting it.+ #[error(transparent)]+ Rejected(anyhow::Error),+ /// A timeout, failed response, or ambiguous provider error needs reconciliation.+ #[error(transparent)]+ Uncertain(anyhow::Error),+}++/// Claim acquisition and all writes are fenced against stale workers.pub trait ScheduledDeliveryRepo: Sync {- /// Proof that this invocation won the claim, including provider context.+ /// Proof of ownership, including provider context.type Claim: Send + Sync;/// Provider result consumed by completion persistence.type Sent: Send;- /// Claim a due, unsent, unclaimed message, committing before returning.+ /// Apply or retire a deferred message deletion only after delivery authority+ /// resolves; preserve it while Send/reconciliation still needs the message.+ fn reconcile_deletion(+ &self,+ link_id: Uuid,+ message_id: Uuid,+ ) -> impl Future<Output = anyhow::Result<()>> + Send;++ /// Acquire an available or expired claim, committing before returning.fn try_claim(&self,link_id: Uuid,message_id: Uuid,- ) -> impl Future<Output = anyhow::Result<Option<Self::Claim>>> + Send;- /// Persist successful delivery and its post-commit side effects.+ ) -> impl Future<Output = anyhow::Result<Option<ClaimedDelivery<Self::Claim>>>> + Send;+ /// Persist the submission boundary only while this claim is live.+ fn begin_send(&self, claim: &Self::Claim) -> impl Future<Output = anyhow::Result<bool>> + Send;+ /// Persist successful delivery only while this receipt still owns the claim.fn complete(&self,claim: &Self::Claim,sent: Self::Sent,) -> impl Future<Output = anyhow::Result<()>> + Send;- /// Release only this invocation's failed claim.- fn release(&self, claim: Self::Claim) -> impl Future<Output = anyhow::Result<()>> + Send;+ /// Release preparation that never submitted, with a retry delay.+ fn release(&self, claim: &Self::Claim) -> impl Future<Output = anyhow::Result<()>> + Send;+ /// Persist a failure or uncertain outcome without granting permission to resend.+ fn pause(+ &self,+ claim: &Self::Claim,+ reason: DeliveryPause,+ ) -> impl Future<Output = anyhow::Result<()>> + Send;}-/// Provider delivery, deliberately outside any persistence transaction.+/// Provider work is separated at the point where a send can have side effects.pub trait ScheduledMessageSender<Claim, Sent>: Sync {- /// Load the committed payload/attachments and send it through the provider.- fn send_claimed(&self, claim: &Claim) -> impl Future<Output = anyhow::Result<Sent>> + Send;+ /// Validated MIME, attachments and credentials, prepared without sending.+ type Prepared: Send;+ /// Load and validate all content and credentials before marking submission.+ fn prepare(+ &self,+ claim: &Claim,+ ) -> impl Future<Output = Result<Self::Prepared, PreparationError>> + Send;+ /// Submit exactly once. The caller has already durably recorded submission.+ fn send_prepared(+ &self,+ claim: &Claim,+ prepared: Self::Prepared,+ ) -> impl Future<Output = Result<Sent, SubmissionError>> + Send;+ /// Find a previously submitted message by its persisted Message-ID.+ fn reconcile(&self, claim: &Claim)+ -> impl Future<Output = anyhow::Result<Option<Sent>>> + Send;}-/// Deliver one queue item. Duplicate/stale items never release another worker's-/// claim. Provider ambiguity/reconciliation retains the existing retry policy.+/// Deliver or reconcile one queue item. No failure after the submission boundary+/// can release delivery authority for another automatic send.+#[tracing::instrument(skip(repo, sender), fields(phase = tracing::field::Empty, mode = tracing::field::Empty), err)]pub async fn deliver_scheduled<R, S>(repo: &R,sender: &S,@@ -44,20 +136,116 @@ whereR: ScheduledDeliveryRepo,S: ScheduledMessageSender<R::Claim, R::Sent>,{- let Some(claim) = repo.try_claim(link_id, message_id).await? else {+ tracing::Span::current().record("phase", "deferred_deletion");+ repo.reconcile_deletion(link_id, message_id).await?;+ tracing::Span::current().record("phase", "claim");+ let Some(ClaimedDelivery { claim, mode }) = repo.try_claim(link_id, message_id).await? else {return Ok(());};- let result = async {- let sent = sender.send_claimed(&claim).await?;- repo.complete(&claim, sent).await+ tracing::Span::current().record("mode", tracing::field::debug(mode));+ if mode == DeliveryMode::Reconcile {+ tracing::Span::current().record("phase", "reconcile");+ let started = Instant::now();+ return match sender.reconcile(&claim).await {+ Ok(Some(sent)) => {+ tracing::info!(+ event = "email_send.reconciliation",+ outcome = "found",+ duration_ms = started.elapsed().as_millis() as u64,+ "prior provider submission found"+ );+ tracing::Span::current().record("phase", "complete");+ repo.complete(&claim, sent).await+ }+ Ok(None) => {+ tracing::info!(+ event = "email_send.reconciliation",+ outcome = "not_found",+ retry_delay_secs = RECONCILIATION_DELAY_SECONDS,+ duration_ms = started.elapsed().as_millis() as u64,+ "delivery remains unconfirmed"+ );+ tracing::Span::current().record("phase", "pause");+ repo.pause(&claim, DeliveryPause::Unconfirmed).await+ }+ Err(error) => {+ tracing::warn!(+ event = "email_send.reconciliation",+ outcome = "error",+ retry_delay_secs = RECONCILIATION_DELAY_SECONDS,+ duration_ms = started.elapsed().as_millis() as u64,+ "provider lookup failed; delivery remains unconfirmed"+ );+ repo.pause(&claim, DeliveryPause::Unconfirmed).await?;+ Err(error)+ }+ };+ }+ tracing::Span::current().record("phase", "prepare");+ let started = Instant::now();+ let prepared = match sender.prepare(&claim).await {+ Ok(prepared) => {+ tracing::info!(+ event = "email_send.preparation",+ outcome = "ready",+ duration_ms = started.elapsed().as_millis() as u64,+ "email preparation completed"+ );+ prepared+ }+ Err(PreparationError::Retry(error)) => {+ tracing::warn!(+ event = "email_send.preparation",+ outcome = "retry",+ retry_delay_secs = PREPARATION_RETRY_SECONDS,+ duration_ms = started.elapsed().as_millis() as u64,+ "email preparation will retry before submission"+ );+ repo.release(&claim).await?;+ return Err(error);+ }+ Err(PreparationError::Failed(error)) => {+ tracing::warn!(event = "email_send.preparation", outcome = "failed", error=?error,+ duration_ms = started.elapsed().as_millis() as u64, "email preparation needs attention");+ return repo.pause(&claim, DeliveryPause::Failed).await;+ }+ };+ tracing::Span::current().record("phase", "begin_submission");+ if !repo.begin_send(&claim).await? {+ tracing::info!(+ event = "email_send.claim_lost",+ "email delivery claim lost before submission"+ );+ return Ok(());}- .await;- if result.is_err() {- let _ = repo.release(claim).await.inspect_err(|error| {- tracing::error!(error=?error, %message_id, %link_id, "failed to release owned delivery claim");- });+ tracing::info!(+ event = "email_send.submission_started",+ "email provider submission boundary recorded"+ );+ tracing::Span::current().record("phase", "submit");+ let started = Instant::now();+ match sender.send_prepared(&claim, prepared).await {+ Ok(sent) => {+ tracing::info!(+ event = "email_send.provider_accepted",+ duration_ms = started.elapsed().as_millis() as u64,+ "provider accepted email; database completion pending"+ );+ tracing::Span::current().record("phase", "complete");+ repo.complete(&claim, sent).await+ }+ Err(SubmissionError::Rejected(error)) => {+ tracing::warn!(event = "email_send.submission", outcome = "rejected", error=?error,+ duration_ms = started.elapsed().as_millis() as u64, "email delivery was rejected");+ repo.pause(&claim, DeliveryPause::Failed).await+ }+ Err(SubmissionError::Uncertain(error)) => {+ tracing::warn!(event = "email_send.submission", outcome = "unconfirmed", error=?error,+ retry_delay_secs = RECONCILIATION_DELAY_SECONDS,+ duration_ms = started.elapsed().as_millis() as u64, "email delivery requires reconciliation");+ repo.pause(&claim, DeliveryPause::Unconfirmed).await+ }}- result}#[cfg(test)]diff --git a/crates/email/src/domain/scheduled_delivery/attachments.rs b/crates/email/src/domain/scheduled_delivery/attachments.rsnew file mode 100644index 0000000000..a56627acf1--- /dev/null+++ b/crates/email/src/domain/scheduled_delivery/attachments.rs@@ -0,0 +1,52 @@+//! Attachment identity approved by the sender, independent of storage lifetime.++use uuid::Uuid;++/// Exact attachment sets captured by the send action.+#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]+pub struct ApprovedAttachments {+ /// Completed upload identities.+ pub uploaded: Vec<Uuid>,+ /// Original provider attachment identities selected for forwarding.+ pub forwarded: Vec<Uuid>,+}++/// The delivery payload can no longer contain exactly the approved attachments.+#[derive(Debug, thiserror::Error, PartialEq, Eq)]+#[error("approved email attachments changed; review the draft before sending")]+pub struct AttachmentSnapshotMismatch;++impl ApprovedAttachments {+ /// Refuse missing, added, or duplicated attachments before provider delivery.+ pub fn validate(+ &self,+ uploaded: &[Uuid],+ forwarded: &[Uuid],+ ) -> Result<(), AttachmentSnapshotMismatch> {+ if same_ids(&self.uploaded, uploaded) && same_ids(&self.forwarded, forwarded) {+ Ok(())+ } else {+ Err(AttachmentSnapshotMismatch)+ }+ }+}++impl From<&crate::domain::send_attempt::SendSnapshot> for ApprovedAttachments {+ fn from(snapshot: &crate::domain::send_attempt::SendSnapshot) -> Self {+ Self {+ uploaded: snapshot.attachment_ids.clone(),+ forwarded: snapshot.forwarded_attachment_ids.clone(),+ }+ }+}++fn same_ids(expected: &[Uuid], actual: &[Uuid]) -> bool {+ let mut expected = expected.to_vec();+ let mut actual = actual.to_vec();+ expected.sort_unstable();+ actual.sort_unstable();+ expected == actual+}++#[cfg(test)]+mod test;diff --git a/crates/email/src/domain/scheduled_delivery/attachments/test.rs b/crates/email/src/domain/scheduled_delivery/attachments/test.rsnew file mode 100644index 0000000000..7bd08b8635--- /dev/null+++ b/crates/email/src/domain/scheduled_delivery/attachments/test.rs@@ -0,0 +1,51 @@+use super::*;++#[test]+fn order_does_not_change_approved_attachments() {+ let first = macro_uuid::generate_uuid_v7();+ let second = macro_uuid::generate_uuid_v7();+ let approved = ApprovedAttachments {+ uploaded: vec![first, second],+ forwarded: vec![second, first],+ };+ assert_eq!(+ approved.validate(&[second, first], &[first, second]),+ Ok(())+ );+}++#[test]+fn missing_added_and_duplicated_attachments_are_rejected() {+ let upload = macro_uuid::generate_uuid_v7();+ let forwarded = macro_uuid::generate_uuid_v7();+ let extra = macro_uuid::generate_uuid_v7();+ let approved = ApprovedAttachments {+ uploaded: vec![upload],+ forwarded: vec![forwarded],+ };+ for (uploaded, forwarded) in [+ (vec![], vec![forwarded]),+ (vec![upload], vec![]),+ (vec![upload, extra], vec![forwarded]),+ (vec![upload], vec![forwarded, extra]),+ (vec![upload, upload], vec![forwarded]),+ ] {+ assert_eq!(+ approved.validate(&uploaded, &forwarded),+ Err(AttachmentSnapshotMismatch)+ );+ }+}++#[test]+fn uploads_and_forwarded_attachments_are_not_interchangeable() {+ let id = macro_uuid::generate_uuid_v7();+ let approved = ApprovedAttachments {+ uploaded: vec![id],+ forwarded: vec![],+ };+ assert_eq!(+ approved.validate(&[], &[id]),+ Err(AttachmentSnapshotMismatch)+ );+}diff --git a/crates/email/src/domain/scheduled_delivery/recovery.rs b/crates/email/src/domain/scheduled_delivery/recovery.rsnew file mode 100644index 0000000000..26a7ec052c--- /dev/null+++ b/crates/email/src/domain/scheduled_delivery/recovery.rs@@ -0,0 +1,85 @@+//! Recover due delivery work through durable queue notifications.++use futures::{Stream, TryStreamExt};+use std::time::Instant;+use uuid::Uuid;++/// A due message that may be claimed for delivery or reconciliation.+#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub struct PendingDelivery {+ /// Linked mailbox owning the message.+ pub link_id: Uuid,+ /// Local message requiring delivery work.+ pub message_id: Uuid,+}++/// Finds unsent, due work whose preparation/reconciliation backoff has elapsed.+pub trait ScheduledRecoveryRepo: Sync {+ /// Exclude permanent failures, active leases, future sends and sent messages.+ /// Expired leases are eligible even if a previous worker left processing set.+ fn pending_deliveries(&self) -> impl Stream<Item = anyhow::Result<PendingDelivery>> + Send;+}++/// Publishes a durable wakeup; the delivery claimant decides whether to send or reconcile.+pub trait ScheduledRecoveryQueue: Sync {+ /// Enqueue one eligible delivery without claiming or submitting it.+ fn enqueue(&self, delivery: PendingDelivery)+ -> impl Future<Output = anyhow::Result<()>> + Send;+}++/// Scans independently recoverable work so one queue failure cannot starve the rest.+#[derive(Clone)]+pub struct ScheduledRecovery<R, Q> {+ repo: R,+ queue: Q,+}++impl<R: ScheduledRecoveryRepo, Q: ScheduledRecoveryQueue> ScheduledRecovery<R, Q> {+ /// Compose recovery with persistence and notification ports.+ pub fn new(repo: R, queue: Q) -> Self {+ Self { repo, queue }+ }++ /// Republish due work. Failed queue writes stay due for the next scan.+ #[tracing::instrument(skip(self), err)]+ pub async fn scan(&self) -> anyhow::Result<()> {+ let started = Instant::now();+ let mut found = 0_u64;+ let mut enqueued = 0_u64;+ let mut failed = 0_u64;+ let result: anyhow::Result<()> = async {+ let pending = self.repo.pending_deliveries();+ futures::pin_mut!(pending);+ while let Some(delivery) = pending.try_next().await? {+ found += 1;+ match self.queue.enqueue(delivery).await {+ Ok(()) => enqueued += 1,+ Err(error) => {+ failed += 1;+ tracing::error!(+ error = ?error,+ link_id = %delivery.link_id,+ message_id = %delivery.message_id,+ "failed to enqueue scheduled email recovery",+ );+ }+ }+ }+ Ok(())+ }+ .await;+ tracing::info!(+ event = "email_send.recovery_scan",+ found,+ enqueued,+ failed,+ scan_complete = result.is_ok(),+ duration_ms = started.elapsed().as_millis() as u64,+ "scheduled email recovery scan finished"+ );+ result+ }+}++#[cfg(test)]+mod test;diff --git a/crates/email/src/domain/scheduled_delivery/recovery/test.rs b/crates/email/src/domain/scheduled_delivery/recovery/test.rsnew file mode 100644index 0000000000..97be476b3f--- /dev/null+++ b/crates/email/src/domain/scheduled_delivery/recovery/test.rs@@ -0,0 +1,65 @@+use super::*;+use std::sync::{Arc, Mutex};++struct Repo {+ fail: bool,+ pending: Vec<PendingDelivery>,+}++impl ScheduledRecoveryRepo for Repo {+ fn pending_deliveries(&self) -> impl Stream<Item = anyhow::Result<PendingDelivery>> + Send {+ let results = if self.fail {+ vec![Err(anyhow::anyhow!("scan unavailable"))]+ } else {+ self.pending.iter().copied().map(Ok).collect()+ };+ futures::stream::iter(results)+ }+}++struct Queue(Arc<Mutex<Vec<PendingDelivery>>>);++impl ScheduledRecoveryQueue for Queue {+ async fn enqueue(&self, delivery: PendingDelivery) -> anyhow::Result<()> {+ let mut attempts = self.0.lock().unwrap();+ attempts.push(delivery);+ anyhow::ensure!(attempts.len() != 1, "first notification failed");+ Ok(())+ }+}++fn delivery(id: u128) -> PendingDelivery {+ PendingDelivery {+ link_id: Uuid::from_u128(1),+ message_id: Uuid::from_u128(id),+ }+}++#[tokio::test]+async fn failed_notification_does_not_starve_other_due_messages() {+ let attempts = Arc::new(Mutex::new(vec![]));+ let pending = vec![delivery(2), delivery(3)];+ let service = ScheduledRecovery::new(+ Repo {+ fail: false,+ pending: pending.clone(),+ },+ Queue(attempts.clone()),+ );+ service.scan().await.unwrap();+ assert_eq!(*attempts.lock().unwrap(), pending);+}++#[tokio::test]+async fn failed_scan_reports_failure_without_publishing() {+ let attempts = Arc::new(Mutex::new(vec![]));+ let service = ScheduledRecovery::new(+ Repo {+ fail: true,+ pending: vec![delivery(2)],+ },+ Queue(attempts.clone()),+ );+ assert!(service.scan().await.is_err());+ assert!(attempts.lock().unwrap().is_empty());+}diff --git a/crates/email/src/domain/scheduled_delivery/test.rs b/crates/email/src/domain/scheduled_delivery/test.rsindex ee6debcb94..aa46c10b3d 100644--- a/crates/email/src/domain/scheduled_delivery/test.rs+++ b/crates/email/src/domain/scheduled_delivery/test.rs@@ -1,73 +1,299 @@use super::*;-use std::sync::{- Mutex,- atomic::{AtomicBool, Ordering},-};+use std::sync::Mutex;++#[derive(Debug, Clone, Copy, PartialEq, Eq)]+enum Call {+ Deletion,+ Claim,+ Prepare,+ Begin,+ Submit,+ Reconcile,+ Complete,+ Release,+ Pause(DeliveryPause),+}++#[derive(Default, Clone, Copy)]+enum PrepareResult {+ #[default]+ Ready,+ Retry,+ Failed,+}++#[derive(Default, Clone, Copy)]+enum SubmitResult {+ #[default]+ Sent,+ Rejected,+ Uncertain,+}++#[derive(Default, Clone, Copy)]+enum ReconcileResult {+ #[default]+ Found,+ Missing,+ Error,+}-#[derive(Default)]struct Fake {- claimed: AtomicBool,- calls: Mutex<Vec<&'static str>>,- fail_send: bool,+ calls: Mutex<Vec<Call>>,+ mode: Option<DeliveryMode>,+ prepare_result: PrepareResult,+ submit_result: SubmitResult,+ reconcile_result: ReconcileResult,+ begin_result: bool,+ complete_error: bool,+}++impl Default for Fake {+ fn default() -> Self {+ Self {+ calls: Mutex::new(vec![]),+ mode: Some(DeliveryMode::Send),+ prepare_result: PrepareResult::Ready,+ submit_result: SubmitResult::Sent,+ reconcile_result: ReconcileResult::Found,+ begin_result: true,+ complete_error: false,+ }+ }+}++impl Fake {+ fn record(&self, call: Call) {+ self.calls.lock().unwrap().push(call);+ }}impl ScheduledDeliveryRepo for Fake {type Claim = ();type Sent = ();- async fn try_claim(&self, _: Uuid, _: Uuid) -> anyhow::Result<Option<()>> {- self.calls.lock().unwrap().push("claim");- Ok((!self.claimed.swap(true, Ordering::SeqCst)).then_some(()))+ async fn reconcile_deletion(&self, _: Uuid, _: Uuid) -> anyhow::Result<()> {+ self.record(Call::Deletion);+ Ok(())+ }++ async fn try_claim(&self, _: Uuid, _: Uuid) -> anyhow::Result<Option<ClaimedDelivery<()>>> {+ self.record(Call::Claim);+ Ok(self.mode.map(|mode| ClaimedDelivery { claim: (), mode }))+ }+ async fn begin_send(&self, _: &()) -> anyhow::Result<bool> {+ self.record(Call::Begin);+ Ok(self.begin_result)}async fn complete(&self, _: &(), _: ()) -> anyhow::Result<()> {- self.calls.lock().unwrap().push("complete");+ self.record(Call::Complete);+ anyhow::ensure!(!self.complete_error, "database completion failed");+ Ok(())+ }+ async fn release(&self, _: &()) -> anyhow::Result<()> {+ self.record(Call::Release);Ok(())}- async fn release(&self, _: ()) -> anyhow::Result<()> {- self.calls.lock().unwrap().push("release");- self.claimed.store(false, Ordering::SeqCst);+ async fn pause(&self, _: &(), reason: DeliveryPause) -> anyhow::Result<()> {+ self.record(Call::Pause(reason));Ok(())}}impl ScheduledMessageSender<(), ()> for Fake {- async fn send_claimed(&self, _: &()) -> anyhow::Result<()> {- self.calls.lock().unwrap().push("send");- anyhow::ensure!(!self.fail_send, "provider failed");- Ok(())+ type Prepared = ();++ async fn prepare(&self, _: &()) -> Result<(), PreparationError> {+ self.record(Call::Prepare);+ match self.prepare_result {+ PrepareResult::Ready => Ok(()),+ PrepareResult::Retry => Err(PreparationError::Retry(anyhow::anyhow!("quota refused"))),+ PrepareResult::Failed => Err(PreparationError::Failed(anyhow::anyhow!(+ "attachment missing"+ ))),+ }+ }+ async fn send_prepared(&self, _: &(), _: ()) -> Result<(), SubmissionError> {+ self.record(Call::Submit);+ match self.submit_result {+ SubmitResult::Sent => Ok(()),+ SubmitResult::Rejected => Err(SubmissionError::Rejected(anyhow::anyhow!(+ "recipient rejected"+ ))),+ SubmitResult::Uncertain => {+ Err(SubmissionError::Uncertain(anyhow::anyhow!("response lost")))+ }+ }+ }+ async fn reconcile(&self, _: &()) -> anyhow::Result<Option<()>> {+ self.record(Call::Reconcile);+ match self.reconcile_result {+ ReconcileResult::Found => Ok(Some(())),+ ReconcileResult::Missing => Ok(None),+ ReconcileResult::Error => anyhow::bail!("provider search unavailable"),+ }}}#[tokio::test]-async fn loser_never_sends_completes_or_releases_winner() {- let fake = Fake::default();- fake.claimed.store(true, Ordering::SeqCst);+async fn claim_loser_cannot_prepare_submit_or_release_another_worker() {+ let fake = Fake {+ mode: None,+ ..Default::default()+ };deliver_scheduled(&fake, &fake, Uuid::nil(), Uuid::nil()).await.unwrap();- assert_eq!(*fake.calls.lock().unwrap(), ["claim"]);- assert!(fake.claimed.load(Ordering::SeqCst));+ assert_eq!(*fake.calls.lock().unwrap(), [Call::Deletion, Call::Claim]);}#[tokio::test]-async fn successful_delivery_completes_without_a_late_release() {+async fn successful_send_records_submission_after_preparation_before_provider() {let fake = Fake::default();deliver_scheduled(&fake, &fake, Uuid::nil(), Uuid::nil()).await.unwrap();- assert_eq!(*fake.calls.lock().unwrap(), ["claim", "send", "complete"]);+ assert_eq!(+ *fake.calls.lock().unwrap(),+ [+ Call::Deletion,+ Call::Claim,+ Call::Prepare,+ Call::Begin,+ Call::Submit,+ Call::Complete+ ]+ );+}++#[tokio::test]+async fn transient_preparation_failure_releases_without_crossing_provider_boundary() {+ let fake = Fake {+ prepare_result: PrepareResult::Retry,+ ..Default::default()+ };+ assert!(+ deliver_scheduled(&fake, &fake, Uuid::nil(), Uuid::nil())+ .await+ .is_err()+ );+ assert_eq!(+ *fake.calls.lock().unwrap(),+ [Call::Deletion, Call::Claim, Call::Prepare, Call::Release]+ );+}++#[tokio::test]+async fn invalid_attachments_pause_for_review_without_submitting() {+ let fake = Fake {+ prepare_result: PrepareResult::Failed,+ ..Default::default()+ };+ deliver_scheduled(&fake, &fake, Uuid::nil(), Uuid::nil())+ .await+ .unwrap();+ assert_eq!(+ *fake.calls.lock().unwrap(),+ [+ Call::Deletion,+ Call::Claim,+ Call::Prepare,+ Call::Pause(DeliveryPause::Failed)+ ]+ );+}++#[tokio::test]+async fn worker_that_lost_its_lease_during_preparation_never_submits() {+ let fake = Fake {+ begin_result: false,+ ..Default::default()+ };+ deliver_scheduled(&fake, &fake, Uuid::nil(), Uuid::nil())+ .await+ .unwrap();+ assert_eq!(+ *fake.calls.lock().unwrap(),+ [Call::Deletion, Call::Claim, Call::Prepare, Call::Begin]+ );}#[tokio::test]-async fn only_failed_winner_releases() {+async fn provider_rejection_and_ambiguity_pause_without_granting_another_send() {+ for (submit_result, pause) in [+ (SubmitResult::Rejected, DeliveryPause::Failed),+ (SubmitResult::Uncertain, DeliveryPause::Unconfirmed),+ ] {+ let fake = Fake {+ submit_result,+ ..Default::default()+ };+ deliver_scheduled(&fake, &fake, Uuid::nil(), Uuid::nil())+ .await+ .unwrap();+ assert_eq!(+ *fake.calls.lock().unwrap(),+ [+ Call::Deletion,+ Call::Claim,+ Call::Prepare,+ Call::Begin,+ Call::Submit,+ Call::Pause(pause)+ ]+ );+ }+}++#[tokio::test]+async fn failed_completion_does_not_release_a_successful_provider_submission() {let fake = Fake {- fail_send: true,- ..Fake::default()+ complete_error: true,+ ..Default::default()};assert!(deliver_scheduled(&fake, &fake, Uuid::nil(), Uuid::nil()).await.is_err());- assert_eq!(*fake.calls.lock().unwrap(), ["claim", "send", "release"]);+ assert_eq!(+ *fake.calls.lock().unwrap(),+ [+ Call::Deletion,+ Call::Claim,+ Call::Prepare,+ Call::Begin,+ Call::Submit,+ Call::Complete+ ]+ );+}++#[tokio::test]+async fn reconciliation_only_records_delivery_or_keeps_outcome_unconfirmed() {+ for (reconcile_result, last_call, should_error) in [+ (ReconcileResult::Found, Call::Complete, false),+ (+ ReconcileResult::Missing,+ Call::Pause(DeliveryPause::Unconfirmed),+ false,+ ),+ (+ ReconcileResult::Error,+ Call::Pause(DeliveryPause::Unconfirmed),+ true,+ ),+ ] {+ let fake = Fake {+ mode: Some(DeliveryMode::Reconcile),+ reconcile_result,+ ..Default::default()+ };+ let result = deliver_scheduled(&fake, &fake, Uuid::nil(), Uuid::nil()).await;+ assert_eq!(result.is_err(), should_error);+ assert_eq!(+ *fake.calls.lock().unwrap(),+ [Call::Deletion, Call::Claim, Call::Reconcile, last_call]+ );+ }}diff --git a/crates/email/src/domain/send_attempt.rs b/crates/email/src/domain/send_attempt.rsnew file mode 100644index 0000000000..e9ee483384--- /dev/null+++ b/crates/email/src/domain/send_attempt.rs@@ -0,0 +1,225 @@+//! Replay-safe admission and cancellation of an approved email snapshot.++use chrono::{DateTime, Utc};+use macro_user_id::user_id::MacroUserIdStr;+use serde::{Deserialize, Serialize};+use uuid::Uuid;++mod approval;++use super::models::{+ ContactInfo, CreateDraftInput, EmailErr, ResolvedDraftInput, ThreadRow, UpsertedContacts,+};++/// Frozen delivery content after validation, sanitization and signature injection.+/// The original request and its versioned replay fingerprint remain separate+/// from prepared delivery content.+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct PreparedSendContent {+ /// Message content and identities as settled by admission.+ pub message: ResolvedDraftInput,+ /// Sender identity captured at admission, independent of later contact sync.+ pub sender: ContactInfo,+}++/// Older or invalid admitted content cannot safely be reconstructed from live rows.+#[derive(Debug, thiserror::Error)]+#[error("approved email content is unavailable; cancel and review the draft before sending")]+pub struct PreparedSendContentUnavailable;++/// Unique identity for one explicit Send action, retained across retries.+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]+pub struct SendAttemptId(pub Uuid);++/// Content approved at Send. Attachment references name completed uploads only.+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct SendSnapshot {+ /// Full message state, with client handles where server IDs are unknown.+ pub message: CreateDraftInput,+ /// Uploaded draft attachment IDs.+ pub attachment_ids: Vec<Uuid>,+ /// Original attachment IDs for forwarded attachments.+ pub forwarded_attachment_ids: Vec<Uuid>,+ /// Original editor HTML, encoded like message HTML; omitted values use the approved body.+ pub restore_body_html: Option<String>,+ /// Original editor text; omitted values use the approved body.+ pub restore_body_text: Option<String>,+ /// Original editor document; omitted values use the approved body.+ pub restore_body_macro: Option<String>,+}++/// Authoritative state of an admitted or cancelled send attempt.+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]+pub enum SendAttemptStatus {+ /// Committed and awaiting provider submission; cancellation is still safe.+ Accepted,+ /// Provider submission began, or a legacy worker owns an ambiguous claim.+ Sending,+ /// Preparation or provider rejection needs attention; cancellation is safe.+ Failed,+ /// Provider acceptance is uncertain; automatic resubmission is forbidden.+ DeliveryUnconfirmed,+ /// Provider delivery was recorded successfully.+ Sent,+ /// Delivery authority was revoked, including before admission.+ Cancelled,+}++/// Stable admission result, independent of response hydration and SQS availability.+#[derive(Debug, Clone)]+pub struct SendAttempt {+ /// Whether this invocation changed delivery authority (for event publication).+ pub transitioned: bool,+ /// Fully hydrated current message, loaded only after authorization.+ pub message: Option<super::models::Message>,+ /// The caller's attempt identity.+ pub attempt_id: SendAttemptId,+ /// Current authoritative delivery state.+ pub status: SendAttemptStatus,+ /// Message identity, absent for cancellation before admission.+ pub message_id: Option<Uuid>,+ /// Conversation identity, absent before admission.+ pub thread_id: Option<Uuid>,+ /// Deadline assigned at first admission, never extended by replay.+ pub send_time: Option<DateTime<Utc>>,+}++/// Stable keyset cursor, scoped to the authenticated actor by the service.+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct SendAttemptCursor {+ /// Admission timestamp.+ pub created_at: DateTime<Utc>,+ /// Inbox identity, for deterministic ordering.+ pub link_id: Uuid,+ /// Attempt identity, for deterministic ordering.+ pub attempt_id: Uuid,+}++/// An authorized pending attempt from any of the actor's devices.+pub struct ListedSendAttempt {+ /// Authorized inbox.+ pub link_id: Uuid,+ /// Current send state.+ pub attempt: SendAttempt,+}++/// Bounded result with a cursor for older unresolved sends.+pub struct SendAttemptPage {+ /// Authorized attempts.+ pub attempts: Vec<ListedSendAttempt>,+ /// Continuation when more attempts remain.+ pub next_cursor: Option<SendAttemptCursor>,+}++/// Validated data for atomic admission. Preparation performs no delivery writes.+pub struct PreparedSend {+ /// Authorized source inbox to move atomically with admission, if changed.+ pub source_inbox: Option<SendSourceInbox>,+ /// Undo delay measured at atomic admission, after acquiring message locks.+ pub undo_delay_secs: u32,+ /// Original immutable request, for detecting mismatched retries.+ pub snapshot: SendSnapshot,+ /// Sanitized message and server-generated candidate identities.+ pub message: ResolvedDraftInput,+ /// Resolved recipients.+ pub contacts: UpsertedContacts,+ /// New conversation, if necessary.+ pub new_thread: Option<ThreadRow>,+ /// Sanitized restoration HTML.+ pub restore_html: Option<String>,+ /// Restoration text, defaulted from the approved body.+ pub restore_text: Option<String>,+ /// Restoration editor document, defaulted from the approved body.+ pub restore_macro: Option<String>,+}++/// Existing editable draft ownership validated before sending from another inbox.+#[derive(Debug, Clone, Copy)]+pub struct SendSourceInbox {+ /// Inbox whose draft the actor was authorized to edit.+ pub link_id: Uuid,+ /// Original conversation, revalidated under the message lock.+ pub thread_id: Uuid,+}++/// Persistence operations serialize admission/cancellation and message delivery locks.+pub trait EmailSendRepo: Send + Sync {+ /// Return at most 51 unresolved attempts for authorized inboxes, newest first.+ fn pending_send_attempts(+ &self,+ actor: &MacroUserIdStr<'_>,+ link_ids: &[Uuid],+ after: Option<&SendAttemptCursor>,+ ) -> impl Future<Output = Result<Vec<(SendAttemptCursor, SendAttempt)>, EmailErr>> + Send;+ /// Fetch a bounded set of authorized message/inbox pairs for list hydration.+ fn send_message_rows(+ &self,+ message_ids: &[Uuid],+ link_ids: &[Uuid],+ ) -> impl Future<Output = Result<Vec<super::models::MessageRow>, EmailErr>> + Send;+ /// Fetch the authorized attempt's current message for response hydration.+ fn send_message_row(+ &self,+ link_id: Uuid,+ message_id: Uuid,+ ) -> impl Future<Output = Result<Option<super::models::MessageRow>, EmailErr>> + Send;+ /// Read an attempt, optionally verifying that its approved content matches.+ fn read_send_attempt(+ &self,+ actor: &MacroUserIdStr<'_>,+ link_id: Uuid,+ attempt_id: SendAttemptId,+ snapshot: Option<&SendSnapshot>,+ ) -> impl Future<Output = Result<Option<SendAttempt>, EmailErr>> + Send;+ /// Commit the attempt, message and schedule together, or return the prior attempt.+ /// Once an editable message is admitted, atomically retire older revoked+ /// attempts so their delayed cancellations cannot affect this send.+ fn admit_send(+ &self,+ actor: &MacroUserIdStr<'_>,+ link_id: Uuid,+ attempt_id: SendAttemptId,+ prepared: PreparedSend,+ ) -> impl Future<Output = Result<SendAttempt, EmailErr>> + Send;+ /// Persist cancellation, even before admission; never cancel another attempt.+ /// Managed preparation remains cancellable until its fenced submission+ /// boundary. Submitted or ambiguous legacy claims must remain locked.+ fn cancel_send(+ &self,+ actor: &MacroUserIdStr<'_>,+ link_id: Uuid,+ attempt_id: SendAttemptId,+ ) -> impl Future<Output = Result<SendAttempt, EmailErr>> + Send;+}++/// Authenticated user-facing delivery capability.+pub trait EmailSendService: Send + Sync {+ /// List the actor's unresolved sends across currently accessible inboxes.+ fn pending_email_sends(+ &self,+ actor: MacroUserIdStr<'static>,+ after: Option<SendAttemptCursor>,+ ) -> impl Future<Output = Result<SendAttemptPage, EmailErr>> + Send;+ /// Authorize the selected inbox and durably admit the approved snapshot.+ fn send_email(+ &self,+ actor: MacroUserIdStr<'static>,+ link_id: Uuid,+ attempt_id: SendAttemptId,+ snapshot: SendSnapshot,+ ) -> impl Future<Output = Result<SendAttempt, EmailErr>> + Send;+ /// Cancel this attempt or report that delivery already started.+ fn cancel_email_send(+ &self,+ actor: MacroUserIdStr<'static>,+ link_id: Uuid,+ attempt_id: SendAttemptId,+ ) -> impl Future<Output = Result<SendAttempt, EmailErr>> + Send;+ /// Read status after navigation/restart without reissuing a send.+ fn email_send_status(+ &self,+ actor: MacroUserIdStr<'static>,+ link_id: Uuid,+ attempt_id: SendAttemptId,+ ) -> impl Future<Output = Result<Option<SendAttempt>, EmailErr>> + Send;+}diff --git a/crates/email/src/domain/send_attempt/approval.rs b/crates/email/src/domain/send_attempt/approval.rsnew file mode 100644index 0000000000..8f198a3029--- /dev/null+++ b/crates/email/src/domain/send_attempt/approval.rs@@ -0,0 +1,169 @@+//! Versioned approval identity, independent of application-model serialization.+//! Add a new version when approved fields change; retain existing versions for+//! attempts admitted by earlier deployments.++use super::SendSnapshot;+use crate::domain::models::ContactInfo;+use serde::{Deserialize, Serialize};+use serde_json::Value;+use sha2::{Digest, Sha256};+use uuid::Uuid;++const FINGERPRINT_FIELD: &str = "_send_approval";+const APPROVAL_VERSION: u8 = 2;++#[derive(Serialize, Deserialize)]+#[serde(deny_unknown_fields)]+struct Fingerprint {+ version: u8,+ digest: String,+}++#[derive(Serialize, Deserialize)]+struct ApprovalV1 {+ message: MessageV1,+ attachment_ids: Vec<Uuid>,+ forwarded_attachment_ids: Vec<Uuid>,+ restore_body_html: Option<String>,+ restore_body_text: Option<String>,+ restore_body_macro: Option<String>,+}++#[derive(Serialize, Deserialize)]+struct MessageV1 {+ sender_email: Option<String>,+ db_id: Option<Uuid>,+ provider_id: Option<String>,+ replying_to_id: Option<Uuid>,+ provider_thread_id: Option<String>,+ thread_db_id: Option<Uuid>,+ subject: String,+ to: Vec<ContactV1>,+ cc: Vec<ContactV1>,+ bcc: Vec<ContactV1>,+ body_text: Option<String>,+ body_html: Option<String>,+ body_macro: Option<String>,+ headers_json: Option<Value>,+ include_signature: Option<bool>,+}++#[derive(Serialize, Deserialize)]+struct ContactV1 {+ email: String,+ name: Option<String>,+}++impl From<&SendSnapshot> for ApprovalV1 {+ fn from(snapshot: &SendSnapshot) -> Self {+ let message = &snapshot.message;+ let contacts = |values: &[ContactInfo]| {+ values+ .iter()+ .map(|contact| ContactV1 {+ email: contact.email.clone(),+ name: contact.name.clone(),+ })+ .collect()+ };+ Self {+ message: MessageV1 {+ sender_email: message+ .sender_email+ .as_ref()+ .map(|email| email.0.as_ref().to_owned()),+ db_id: message.db_id,+ provider_id: message.provider_id.clone(),+ replying_to_id: message.replying_to_id,+ provider_thread_id: message.provider_thread_id.clone(),+ thread_db_id: message.thread_db_id,+ subject: message.subject.clone(),+ to: contacts(&message.to),+ cc: contacts(&message.cc),+ bcc: contacts(&message.bcc),+ body_text: message.body_text.clone(),+ body_html: message.body_html.clone(),+ body_macro: message.body_macro.clone(),+ headers_json: message.headers_json.clone(),+ include_signature: message.include_signature,+ },+ attachment_ids: snapshot.attachment_ids.clone(),+ forwarded_attachment_ids: snapshot.forwarded_attachment_ids.clone(),+ restore_body_html: snapshot.restore_body_html.clone(),+ restore_body_text: snapshot.restore_body_text.clone(),+ restore_body_macro: snapshot.restore_body_macro.clone(),+ }+ }+}++impl ApprovalV1 {+ fn digest(mut self) -> Result<String, serde_json::Error> {+ self.attachment_ids.sort_unstable();+ self.forwarded_attachment_ids.sort_unstable();+ let mut canonical = serde_json::to_value(self)?;+ // Object insertion order can vary with Cargo features, including headers.+ canonical.sort_all_objects();+ Ok(format!(+ "{:x}",+ Sha256::digest(serde_json::to_vec(&canonical)?)+ ))+ }+}++impl SendSnapshot {+ fn approval_v2_digest(&self) -> Result<String, serde_json::Error> {+ let mut canonical = serde_json::json!({+ "content": ApprovalV1::from(self).digest()?,+ "draft_generation": self.message.draft_generation,+ "send_time": self.message.send_time,+ "signature_html": self.message.frozen_signature_html,+ });+ canonical.sort_all_objects();+ Ok(format!(+ "{:x}",+ Sha256::digest(serde_json::to_vec(&canonical)?)+ ))+ }+ /// Retain the delivery snapshot and a stable identity for replay comparison.+ pub(crate) fn persisted_request(&self) -> Result<Value, serde_json::Error> {+ let mut request = serde_json::to_value(self)?;+ request[FINGERPRINT_FIELD] = serde_json::to_value(Fingerprint {+ version: APPROVAL_VERSION,+ digest: self.approval_v2_digest()?,+ })?;+ Ok(request)+ }++ /// Compare approved fields, supporting pre-versioned snapshots and rejecting+ /// unknown versions without granting another delivery attempt.+ pub(crate) fn matches_approved_request(+ &self,+ request: &Value,+ ) -> Result<bool, serde_json::Error> {+ if let Some(fingerprint) = request.get(FINGERPRINT_FIELD) {+ let fingerprint: Fingerprint = serde_json::from_value(fingerprint.clone())?;+ return match fingerprint.version {+ 2 => Ok(fingerprint.digest == self.approval_v2_digest()?),+ 1 if self.message.draft_generation == 0+ && self.message.send_time.is_none()+ && self.message.frozen_signature_html.is_none() =>+ {+ Ok(fingerprint.digest == ApprovalV1::from(self).digest()?)+ }+ _ => Ok(false),+ };+ }+ if self.message.draft_generation != 0+ || self.message.send_time.is_some()+ || self.message.frozen_signature_html.is_some()+ {+ return Ok(false);+ }+ let expected = ApprovalV1::from(self).digest()?;+ let legacy: ApprovalV1 = serde_json::from_value(request.clone())?;+ Ok(legacy.digest()? == expected)+ }+}++#[cfg(test)]+mod test;diff --git a/crates/email/src/domain/send_attempt/approval/test.rs b/crates/email/src/domain/send_attempt/approval/test.rsnew file mode 100644index 0000000000..0db78e8826--- /dev/null+++ b/crates/email/src/domain/send_attempt/approval/test.rs@@ -0,0 +1,120 @@+use super::*;+use serde_json::json;++fn snapshot() -> SendSnapshot {+ serde_json::from_value(json!({+ "message": {+ "subject": "Approved subject",+ "to": [{"email": "[email protected]", "name": "Recipient"}],+ "cc": [], "bcc": [], "body_text": "Approved body"+ },+ "attachment_ids": [], "forwarded_attachment_ids": []+ }))+ .unwrap()+}++#[test]+fn legacy_optional_defaults_and_operational_fields_do_not_change_approval() {+ let snapshot = snapshot();+ let mut legacy = serde_json::to_value(&snapshot).unwrap();+ let message = legacy["message"].as_object_mut().unwrap();+ message.remove("body_html");+ message.insert("sender_email".into(), Value::Null);+ message.insert("actor".into(), json!("historical attribution"));+ message.insert("draft_client_binding".into(), json!("historical binding"));+ message.insert("future_operational_field".into(), json!(true));+ legacy["message"]["to"][0]["photo_url"] = json!("https://photo.invalid/old");+ assert!(snapshot.matches_approved_request(&legacy).unwrap());+ let mut replay = snapshot.clone();+ replay.message.to[0].photo_url = Some("https://photo.invalid/new".into());+ replay.message.draft_client_binding = Some(Uuid::new_v4());+ assert!(+ replay+ .matches_approved_request(&snapshot.persisted_request().unwrap())+ .unwrap()+ );+}++#[test]+fn approved_content_changes_conflict_for_both_legacy_and_versioned_requests() {+ let snapshot = snapshot();+ let requests = [+ serde_json::to_value(&snapshot).unwrap(),+ snapshot.persisted_request().unwrap(),+ ];+ for change in [+ |s: &mut SendSnapshot| s.message.subject.push('!'),+ |s: &mut SendSnapshot| s.message.draft_generation = 2,+ |s: &mut SendSnapshot| s.message.send_time = Some(chrono::Utc::now()),+ |s: &mut SendSnapshot| s.message.frozen_signature_html = Some("Frozen signature".into()),+ |s: &mut SendSnapshot| s.message.body_text = Some("Changed body".into()),+ |s: &mut SendSnapshot| s.message.to[0].email = "[email protected]".into(),+ |s: &mut SendSnapshot| s.message.to[0].name = Some("Other name".into()),+ |s: &mut SendSnapshot| {+ s.message.sender_email = Some(+ macro_user_id::email::EmailStr::parse_from_str("[email protected]").unwrap(),+ )+ },+ |s: &mut SendSnapshot| s.message.include_signature = Some(false),+ |s: &mut SendSnapshot| s.message.db_id = Some(Uuid::new_v4()),+ |s: &mut SendSnapshot| s.attachment_ids.push(Uuid::new_v4()),+ |s: &mut SendSnapshot| s.forwarded_attachment_ids.push(Uuid::new_v4()),+ |s: &mut SendSnapshot| s.restore_body_text = Some("Other restore body".into()),+ ] {+ let mut changed = snapshot.clone();+ change(&mut changed);+ for request in &requests {+ assert!(!changed.matches_approved_request(request).unwrap());+ }+ }+}++#[test]+fn versioned_approval_survives_snapshot_representation_changes() {+ let snapshot = snapshot();+ let mut request = snapshot.persisted_request().unwrap();+ request["message"]["sender_email"] = Value::Null;+ request["message"]+ .as_object_mut()+ .unwrap()+ .remove("body_html");+ request["message"]["future_model_default"] = json!(false);+ assert!(snapshot.matches_approved_request(&request).unwrap());+ // Delivery readers still receive the full snapshot alongside its fingerprint.+ let _: SendSnapshot = serde_json::from_value(request).unwrap();+}++#[test]+fn unknown_or_malformed_approval_versions_never_authorize_replay() {+ let snapshot = snapshot();+ let mut request = snapshot.persisted_request().unwrap();+ request[FINGERPRINT_FIELD]["version"] = json!(99);+ assert!(!snapshot.matches_approved_request(&request).unwrap());+ request[FINGERPRINT_FIELD] = json!({"version": 1});+ assert!(snapshot.matches_approved_request(&request).is_err());+}++#[test]+fn object_key_and_attachment_order_do_not_change_approval() {+ let mut snapshot = snapshot();+ snapshot.message.headers_json =+ Some(serde_json::from_str(r#"{"z":{"b":1,"a":2},"a":0}"#).unwrap());+ snapshot.attachment_ids = vec![Uuid::from_u128(1), Uuid::from_u128(2)];+ let request = snapshot.persisted_request().unwrap();+ snapshot.message.headers_json =+ Some(serde_json::from_str(r#"{"a":0,"z":{"a":2,"b":1}}"#).unwrap());+ snapshot.attachment_ids.reverse();+ assert!(snapshot.matches_approved_request(&request).unwrap());+}++#[test]+fn approval_v1_fingerprint_is_stable_across_deployments() {+ let snapshot = snapshot();+ let digest = ApprovalV1::from(&snapshot).digest().unwrap();+ assert_eq!(+ digest,+ "5ddf3b96f8989d91e1deb409f896fa594a848854483e093239176fe1107e6caf"+ );+ let legacy = json!({"_send_approval": {"version": 1, "digest": digest}});+ assert!(snapshot.matches_approved_request(&legacy).unwrap());+}diff --git a/crates/email/src/domain/service.rs b/crates/email/src/domain/service.rsindex de5d4d2944..bdd3ac25e9 100644--- a/crates/email/src/domain/service.rs+++ b/crates/email/src/domain/service.rs@@ -3,6 +3,7 @@ mod draft;mod followup;mod previews;mod send;+mod send_attempt;mod senders;mod sending_inbox;pub(crate) mod signature;@@ -220,6 +221,14 @@ whereanyhow::Error: From<T::Err>,anyhow::Error: From<E::Err>,{+ async fn resolve_thread_read_id(+ &self,+ macro_id: macro_user_id::user_id::MacroUserIdStr<'_>,+ thread_id: Uuid,+ ) -> Result<Uuid, EmailErr> {+ self.resolve_thread_read_id_impl(macro_id, thread_id).await+ }+async fn get_email_thread_previews(&self,req: GetEmailsRequest,@@ -326,8 +335,11 @@ where&self,macro_id: macro_user_id::user_id::MacroUserIdStr<'_>,draft_id: uuid::Uuid,++ expected_generation: i32,) -> Result<crate::domain::models::DeletedUserDraft, EmailErr> {- self.delete_draft_for_user_impl(macro_id, draft_id).await+ self.delete_draft_for_user_impl(macro_id, draft_id, expected_generation)+ .await}async fn send_message_for_user(diff --git a/crates/email/src/domain/service/attachments.rs b/crates/email/src/domain/service/attachments.rsindex df3c6a3b2c..2b0cace4f2 100644--- a/crates/email/src/domain/service/attachments.rs+++ b/crates/email/src/domain/service/attachments.rs@@ -131,7 +131,7 @@ where};if let Err(error) = self- .delete_draft_for_user(actor.clone(), draft.db_id)+ .delete_draft_for_user(actor.clone(), draft.db_id, 0).await{tracing::warn!(diff --git a/crates/email/src/domain/service/attachments/test.rs b/crates/email/src/domain/service/attachments/test.rsindex 1efac5b123..af81e638cc 100644--- a/crates/email/src/domain/service/attachments/test.rs+++ b/crates/email/src/domain/service/attachments/test.rs@@ -30,6 +30,7 @@ struct Fake {fn created(fake: &Fake, input: &CreateDraftInput) -> CreatedDraft {CreatedDraft {+ draft_generation: 0,db_id: fake.draft_id,provider_id: None,replying_to_id: input.replying_to_id,@@ -81,6 +82,8 @@ impl DraftSendService for Fake {&self,_: MacroUserIdStr<'_>,draft_id: Uuid,++ _expected_generation: i32,) -> Result<DeletedUserDraft, EmailErr> {self.calls.push(format!("delete:{draft_id}"));Ok(DeletedUserDraft {@@ -163,6 +166,8 @@ fn link() -> Link {fn input() -> CreateDraftInput {CreateDraftInput {+ frozen_signature_html: None,+ draft_generation: 0,sender_email: None,db_id: None,provider_id: None,diff --git a/crates/email/src/domain/service/draft.rs b/crates/email/src/domain/service/draft.rsindex 9da10df523..077b5ff853 100644--- a/crates/email/src/domain/service/draft.rs+++ b/crates/email/src/domain/service/draft.rs@@ -4,6 +4,7 @@ use crate::domain::{ResolvedDraftInput, SavedUserDraft, SimpleMessageInfo, ThreadRow,},ports::EmailRepo,+ send_attempt::SendSourceInbox,};use base64::Engine;use base64::engine::general_purpose::URL_SAFE_NO_PAD;@@ -133,8 +134,7 @@ where.draft_attachments_by_message_ids(&message_ids),self.email_repo.forwarded_attachments_by_message_ids(&message_ids),- self.email_repo- .scheduled_send_times_by_message_ids(&message_ids),+ self.email_repo.scheduled_sends_by_message_ids(&message_ids),self.email_repo.message_timestamps(draft.db_id, draft.link_id),self.email_repo.labels_by_message_ids(&message_ids),@@ -147,7 +147,9 @@ where// Autosaves leave scheduling untouched. Return the stored schedule,// not the usually absent input, so normalized cache writes preserve it.- draft.send_time = send_times.remove(&draft.db_id);+ draft.send_time = send_times+ .remove(&draft.db_id)+ .map(|schedule| schedule.send_time);Ok(SavedUserDraft {operation_status: operations.remove(&draft.db_id).map(Into::into),@@ -242,6 +244,8 @@ where&self,macro_id: macro_user_id::user_id::MacroUserIdStr<'_>,draft_id: Uuid,++ expected_generation: i32,) -> Result<DeletedUserDraft, EmailErr> {let accessible_link_ids: Vec<Uuid> = self.email_repo@@ -291,9 +295,12 @@ where});};- if msg.is_sent || !msg.is_draft {+ if msg.is_sent {return Err(EmailErr::MessageAlreadySent(draft_id));}+ if !msg.is_draft {+ return Err(EmailErr::MessageDeliveryConflict(draft_id));+ }let deletion = self.email_repo@@ -302,6 +309,7 @@ wheremsg.thread_db_id,&accessible_link_ids,Some(macro_id.as_ref()),+ expected_generation,).await.map_err(anyhow::Error::from)?;@@ -318,12 +326,15 @@ where.get_simple_message(msg.db_id, &accessible_link_ids).await.map_err(anyhow::Error::from)?;- if raced.as_ref().is_some_and(|m| m.is_sent || !m.is_draft) {+ if raced.as_ref().is_some_and(|m| m.is_sent) {return Err(EmailErr::MessageAlreadySent(draft_id));}+ if raced.as_ref().is_some_and(|m| !m.is_draft) {+ return Err(EmailErr::MessageDeliveryConflict(draft_id));+ }if self.email_repo- .scheduled_send_times_by_message_ids(&[msg.db_id])+ .scheduled_sends_by_message_ids(&[msg.db_id]).await.map_err(anyhow::Error::from)?.contains_key(&msg.db_id)@@ -358,9 +369,95 @@ where&self,link: &Link,accessible_inboxes: &[Link],- mut input: CreateDraftInput,+ input: CreateDraftInput,is_draft: bool,) -> Result<CreatedDraft, EmailErr> {+ let (resolved, contacts, new_thread, _) = self+ .prepare_message(link, accessible_inboxes, input, is_draft, false)+ .await?;+ let link_id = link.id;+ let accessible_link_ids: Vec<Uuid> = accessible_inboxes.iter().map(|l| l.id).collect();++ // The insert reports the IDs it settled on rather than echoing the+ // candidates above: a save whose client handle raced a concurrent+ // first save adopts that save's row, and the client must hear about+ // the row that actually exists.+ let Some(settled) = self+ .email_repo+ .insert_message(&resolved, &contacts, link_id, new_thread, is_draft)+ .await?+ else {+ // A concurrent first save can settle a client handle on a different+ // row. Classify the authoritative row, not our discarded candidate.+ let rejected_id = match resolved.draft_client_id {+ Some(handle) => self+ .email_repo+ .message_id_for_client_draft_id(handle, &accessible_link_ids)+ .await+ .map_err(anyhow::Error::from)?+ .unwrap_or(resolved.db_id),+ None => resolved.db_id,+ };+ let rejected = self+ .email_repo+ .get_simple_message(rejected_id, &accessible_link_ids)+ .await+ .map_err(anyhow::Error::from)?;+ if rejected.as_ref().is_some_and(|m| m.is_sent) {+ return Err(EmailErr::MessageAlreadySent(rejected_id));+ }+ if rejected.as_ref().is_some_and(|m| !m.is_draft) {+ return Err(EmailErr::MessageDeliveryConflict(rejected_id));+ }+ if rejected.is_some()+ && self+ .email_repo+ .scheduled_sends_by_message_ids(&[rejected_id])+ .await+ .map_err(anyhow::Error::from)?+ .contains_key(&rejected_id)+ {+ return Err(EmailErr::MessageDeliveryConflict(rejected_id));+ }+ return Err(EmailErr::MessageNotFound(rejected_id));+ };++ Ok(CreatedDraft {+ draft_generation: resolved.draft_generation,+ db_id: settled.message_db_id,+ provider_id: resolved.provider_id,+ replying_to_id: resolved.replying_to_id,+ provider_thread_id: resolved.provider_thread_id,+ thread_db_id: settled.thread_db_id,+ link_id,+ subject: resolved.subject,+ to: resolved.to,+ cc: resolved.cc,+ bcc: resolved.bcc,+ body_text: resolved.body_text,+ body_html: resolved.body_html,+ body_macro: resolved.body_macro,+ headers_json: resolved.headers_json,+ send_time: resolved.send_time,+ })+ }++ pub(super) async fn prepare_message(+ &self,+ link: &Link,+ accessible_inboxes: &[Link],+ mut input: CreateDraftInput,+ is_draft: bool,+ defer_inbox_move: bool,+ ) -> Result<+ (+ ResolvedDraftInput,+ crate::domain::models::UpsertedContacts,+ Option<ThreadRow>,+ Option<SendSourceInbox>,+ ),+ EmailErr,+ > {let link_id = link.id;let sender = self.resolve_sender(link, input.sender_email.as_ref(), !is_draft)@@ -372,11 +469,18 @@ whereinput.provider_id = None;input.provider_thread_id = None;}- self.validate_existing_message(link_id, accessible_inboxes, &mut input)+ let source_inbox = self+ .validate_existing_message(link_id, accessible_inboxes, &mut input, defer_inbox_move).await?;+ let source_message_id = input.db_id;self.validate_replying_to(link_id, &accessible_link_ids, &mut input).await?;+ if source_inbox.is_some() && input.db_id != source_message_id {+ return Err(EmailErr::InvalidSendSnapshot(+ "another reply draft exists in the selected inbox; review it before sending".into(),+ ));+ }self.validate_thread_hint(link_id, &mut input).await?;@@ -413,13 +517,14 @@ where// Start the undo window only after provider validation and preparation.// A slow send-as lookup must not consume the user's cancellation window.- if !is_draft {+ if !is_draft && input.send_time.is_none() {input.send_time = Some(chrono::Utc::now()+ chrono::Duration::seconds(i64::from(self.sent_undo_delay_secs)),);}let resolved = ResolvedDraftInput {+ draft_generation: input.draft_generation,db_id: message_db_id,provider_id: input.provider_id,replying_to_id: input.replying_to_id,@@ -439,64 +544,7 @@ wherethread_client_id: input.thread_client_binding,};- // The insert reports the IDs it settled on rather than echoing the- // candidates above: a save whose client handle raced a concurrent- // first save adopts that save's row, and the client must hear about- // the row that actually exists.- let Some(settled) = self- .email_repo- .insert_message(&resolved, &contacts, link_id, new_thread, is_draft)- .await?- else {- // A concurrent first save can settle a client handle on a different- // row. Classify the authoritative row, not our discarded candidate.- let rejected_id = match resolved.draft_client_id {- Some(handle) => self- .email_repo- .message_id_for_client_draft_id(handle, &accessible_link_ids)- .await- .map_err(anyhow::Error::from)?- .unwrap_or(resolved.db_id),- None => resolved.db_id,- };- let rejected = self- .email_repo- .get_simple_message(rejected_id, &accessible_link_ids)- .await- .map_err(anyhow::Error::from)?;- if rejected.as_ref().is_some_and(|m| m.is_sent || !m.is_draft) {- return Err(EmailErr::MessageAlreadySent(rejected_id));- }- if rejected.is_some()- && self- .email_repo- .scheduled_send_times_by_message_ids(&[rejected_id])- .await- .map_err(anyhow::Error::from)?- .contains_key(&rejected_id)- {- return Err(EmailErr::MessageDeliveryConflict(rejected_id));- }- return Err(EmailErr::MessageNotFound(rejected_id));- };-- Ok(CreatedDraft {- db_id: settled.message_db_id,- provider_id: resolved.provider_id,- replying_to_id: resolved.replying_to_id,- provider_thread_id: resolved.provider_thread_id,- thread_db_id: settled.thread_db_id,- link_id,- subject: resolved.subject,- to: resolved.to,- cc: resolved.cc,- bcc: resolved.bcc,- body_text: resolved.body_text,- body_html: resolved.body_html,- body_macro: resolved.body_macro,- headers_json: resolved.headers_json,- send_time: resolved.send_time,- })+ Ok((resolved, contacts, new_thread, source_inbox))}/// Appends the inbox's signature to the outgoing body (send path only).@@ -504,6 +552,21 @@ where/// forwards (a `replying_to_id` is present) require/// `signature_on_replies_forwards`. Best-effort — any failure just skips.async fn maybe_inject_signature(&self, link: &Link, input: &mut CreateDraftInput) {+ if let Some(signature) = &input.frozen_signature_html {+ super::signature::SignaturePreparation {+ settings: Some(crate::domain::ports::LinkEmailSettings {+ signature: Some(email_utils::sanitize_authored_html(signature)),+ signature_on_replies_forwards: true,+ }),+ include_signature: Some(!signature.trim().is_empty()),+ }+ .apply(+ input.replying_to_id.is_some(),+ &mut input.body_html,+ &mut input.body_text,+ );+ return;+ }let settings = if input.include_signature == Some(false)|| input.body_html@@ -532,10 +595,11 @@ wherelink_id: Uuid,accessible_inboxes: &[Link],input: &mut CreateDraftInput,- ) -> Result<(), EmailErr> {+ defer_inbox_move: bool,+ ) -> Result<Option<SendSourceInbox>, EmailErr> {let accessible_link_ids: Vec<_> = accessible_inboxes.iter().map(|link| link.id).collect();let Some(db_id) = input.db_id else {- return Ok(());+ return Ok(None);};let Some(msg) = self@@ -552,21 +616,79 @@ wherereturn Err(EmailErr::MessageNotFound(db_id));};- if msg.is_sent || !msg.is_draft {+ if msg.is_sent {return Err(EmailErr::MessageAlreadySent(db_id));}+ if !msg.is_draft {+ return Err(EmailErr::MessageDeliveryConflict(db_id));+ }if msg.link_id != link_id {- return Err(EmailErr::InvalidDraft(- "Use the inbox transfer operation to change this draft's sender".into(),- ));+ let portable = accessible_inboxes+ .iter()+ .filter(|inbox| inbox.id == link_id || inbox.id == msg.link_id)+ .all(|inbox| inbox.provider == crate::domain::models::UserProvider::Gmail)+ && msg.provider_id.is_none();+ if !portable {+ return Err(EmailErr::InvalidDraft(+ "Use the inbox transfer operation to change this draft's sender".into(),+ ));+ }+ if defer_inbox_move {+ // Send owns the final snapshot. Preserve attachments and the+ // source draft until admission can move it under its row lock.+ input.provider_id = None;+ input.thread_db_id = None;+ input.provider_thread_id = None;+ return Ok(Some(SendSourceInbox {+ link_id: msg.link_id,+ thread_id: msg.thread_db_id,+ }));+ }+ // The sender was switched to a different inbox. A draft belongs to a+ // single inbox, so discard it (and its now-empty thread) and create a+ // fresh draft in the sending inbox; validate_replying_to re-derives+ // the thread from the reply target. The draft keeps its server ID+ // across the move, and the delete's cascade drops any client-handle+ // binding — the save's binding upsert re-points the handle at the+ // recreated row in the same transaction, so queued offline saves+ // keep converging. A guarded miss may instead mean the source is+ // now scheduled: do not continue and adopt another reply draft in+ // the target inbox while that committed source is still present.+ let deleted = self+ .email_repo+ .delete_draft_message(+ msg.db_id,+ msg.thread_db_id,+ &accessible_link_ids,+ input.actor.as_ref().map(|actor| actor.as_ref()),+ input.draft_generation,+ )+ .await+ .map_err(anyhow::Error::from)?;+ if deleted.is_none()+ && let Some(retained) = self+ .email_repo+ .get_simple_message(msg.db_id, &accessible_link_ids)+ .await+ .map_err(anyhow::Error::from)?+ {+ if retained.is_sent {+ return Err(EmailErr::MessageAlreadySent(msg.db_id));+ }+ return Err(EmailErr::MessageDeliveryConflict(msg.db_id));+ }+ input.provider_id = None;+ input.thread_db_id = None;+ input.provider_thread_id = None;+ return Ok(None);}input.thread_db_id = Some(msg.thread_db_id);input.provider_id = msg.provider_id;input.provider_thread_id = msg.provider_thread_id;- Ok(())+ Ok(None)}async fn validate_replying_to(diff --git a/crates/email/src/domain/service/draft/test.rs b/crates/email/src/domain/service/draft/test.rsindex 3da573ccd2..7b200e1a3f 100644--- a/crates/email/src/domain/service/draft/test.rs+++ b/crates/email/src/domain/service/draft/test.rs@@ -3,6 +3,8 @@ use base64::engine::general_purpose::URL_SAFE_NO_PAD;fn input_with_body_html(html: &str) -> CreateDraftInput {CreateDraftInput {+ frozen_signature_html: None,+ draft_generation: 0,sender_email: None,db_id: None,provider_id: None,diff --git a/crates/email/src/domain/service/send_attempt.rs b/crates/email/src/domain/service/send_attempt.rsnew file mode 100644index 0000000000..88f4e08e7c--- /dev/null+++ b/crates/email/src/domain/service/send_attempt.rs@@ -0,0 +1,363 @@+use base64::{Engine, engine::general_purpose::URL_SAFE_NO_PAD};+use chrono::{Duration, Utc};+use frecency::domain::ports::FrecencyQueryService;+use macro_event_broker::MacroEventBroker;+use macro_user_id::user_id::MacroUserIdStr;+use std::time::Instant;+use uuid::Uuid;++use super::{EmailServiceImpl, draft::resolve_target_link};+use crate::domain::{+ events::{+ EmailMacroEvent, MessageSendCancelledMetadata, MessageSendQueuedMetadata, SendCancelReason,+ },+ models::EmailErr,+ ports::{EmailMessageEnqueuer, EmailRepo},+ send_attempt::{+ EmailSendRepo, EmailSendService, PreparedSend, SendAttempt, SendAttemptId,+ SendAttemptStatus, SendSnapshot,+ },+};++impl<T, U, E, CS, Eam, B> EmailSendService for EmailServiceImpl<T, U, E, CS, Eam, B>+where+ T: EmailRepo + EmailSendRepo,+ U: FrecencyQueryService,+ E: EmailMessageEnqueuer,+ CS: crm::domain::service::CrmService,+ Eam: Send + Sync,+ B: MacroEventBroker,+ anyhow::Error: From<T::Err> + From<E::Err>,+{+ #[tracing::instrument(skip_all, err)]+ async fn pending_email_sends(+ &self,+ actor: MacroUserIdStr<'static>,+ after: Option<crate::domain::send_attempt::SendAttemptCursor>,+ ) -> Result<crate::domain::send_attempt::SendAttemptPage, EmailErr> {+ use crate::domain::send_attempt::{ListedSendAttempt, SendAttemptPage};+ let inboxes = self+ .email_repo+ .inboxes_for_macro_id(actor.clone())+ .await+ .map_err(anyhow::Error::from)?;+ let ids: Vec<_> = inboxes.iter().map(|link| link.id).collect();+ let mut rows = self+ .email_repo+ .pending_send_attempts(&actor, &ids, after.as_ref())+ .await?;+ let next_cursor = if rows.len() > 50 {+ rows.truncate(50);+ rows.last().map(|(cursor, _)| cursor.clone())+ } else {+ None+ };+ let pairs: Vec<_> = rows+ .iter()+ .filter_map(|(cursor, attempt)| attempt.message_id.map(|id| (id, cursor.link_id)))+ .collect();+ let message_ids: Vec<_> = pairs.iter().map(|(id, _)| *id).collect();+ let message_links: Vec<_> = pairs.iter().map(|(_, link)| *link).collect();+ let messages = self+ .email_repo+ .send_message_rows(&message_ids, &message_links)+ .await?;+ let (senders, recipients, labels) = tokio::try_join!(+ self.email_repo.senders_by_message_ids(&message_ids),+ self.email_repo.recipients_by_message_ids(&message_ids),+ self.email_repo.labels_by_message_ids(&message_ids),+ )+ .map_err(anyhow::Error::from)?;+ let mut hydrated: std::collections::HashMap<_, _> = self+ .hydrate_full_messages(messages, senders, recipients, labels, true)+ .await?+ .into_iter()+ .map(|message| (message.db_id, message))+ .collect();+ let attempts = rows+ .into_iter()+ .map(|(cursor, mut attempt)| {+ attempt.message = attempt.message_id.and_then(|id| hydrated.remove(&id));+ ListedSendAttempt {+ link_id: cursor.link_id,+ attempt,+ }+ })+ .collect();+ Ok(SendAttemptPage {+ attempts,+ next_cursor,+ })+ }+ #[tracing::instrument(skip_all, fields(%link_id, attempt_id = %attempt_id.0, phase = "authorization"), err)]+ async fn send_email(+ &self,+ actor: MacroUserIdStr<'static>,+ link_id: Uuid,+ attempt_id: SendAttemptId,+ snapshot: SendSnapshot,+ ) -> Result<SendAttempt, EmailErr> {+ let started = Instant::now();+ let inboxes = self+ .email_repo+ .inboxes_for_macro_id(actor.clone())+ .await+ .map_err(anyhow::Error::from)?;+ let link = resolve_target_link(&inboxes, Some(link_id), &actor)?;+ tracing::Span::current().record("phase", "read_attempt");+ if let Some(attempt) = self+ .email_repo+ .read_send_attempt(&actor, link_id, attempt_id, Some(&snapshot))+ .await?+ {+ log_attempt_outcome("send", &attempt, started);+ return self.hydrate_send_attempt(link_id, attempt).await;+ }+ tracing::Span::current().record("phase", "prepare");+ let prepare = async {+ if snapshot.message.db_id.is_none()+ || snapshot.message.to.is_empty()+ && snapshot.message.cc.is_empty()+ && snapshot.message.bcc.is_empty()+ {+ return Err(EmailErr::InvalidSendSnapshot(+ "a draft handle and recipients are required".into(),+ ));+ }+ let mut input = snapshot.message.clone();+ let accessible_ids: Vec<_> = inboxes.iter().map(|link| link.id).collect();+ self.resolve_client_handles(&mut input, &accessible_ids)+ .await?;+ input.actor = Some(actor.clone());+ input.send_time = input+ .send_time+ .or_else(|| Some(Utc::now() + Duration::seconds(self.sent_undo_delay_secs.into())));+ let (message, contacts, new_thread, source_inbox) = self+ .prepare_message(link, &inboxes, input, false, true)+ .await?;+ let restore_html = snapshot+ .restore_body_html+ .as_ref()+ .or(snapshot.message.body_html.as_ref())+ .map(|html| {+ let html = String::from_utf8(URL_SAFE_NO_PAD.decode(html)?)?;+ Ok::<_, EmailErr>(email_utils::sanitize_authored_html(&html))+ })+ .transpose()?;+ Ok(PreparedSend {+ source_inbox,+ undo_delay_secs: self.sent_undo_delay_secs,+ snapshot: snapshot.clone(),+ message,+ contacts,+ new_thread,+ restore_html,+ restore_text: snapshot+ .restore_body_text+ .clone()+ .or_else(|| snapshot.message.body_text.clone()),+ restore_macro: snapshot+ .restore_body_macro+ .clone()+ .or_else(|| snapshot.message.body_macro.clone()),+ })+ }+ .await;+ let prepared = match prepare {+ Ok(prepared) => prepared,+ Err(error) => {+ // Another invocation can admit while this one is validating the draft.+ return match self+ .email_repo+ .read_send_attempt(&actor, link_id, attempt_id, Some(&snapshot))+ .await?+ {+ Some(attempt) => {+ log_attempt_outcome("send", &attempt, started);+ self.hydrate_send_attempt(link_id, attempt).await+ }+ None => Err(error),+ };+ }+ };+ tracing::Span::current().record("phase", "admit");+ let attempt = self+ .email_repo+ .admit_send(&actor, link_id, attempt_id, prepared)+ .await?;+ log_attempt_outcome("send", &attempt, started);+ if let (SendAttemptStatus::Accepted, Some(message_id), Some(thread_id), Some(send_time)) = (+ attempt.status,+ attempt.message_id,+ attempt.thread_id,+ attempt.send_time,+ ) && attempt.transitioned+ {+ tracing::Span::current().record("phase", "notify");+ // The database is the durable handoff. The scheduled scanner repairs a+ // failed notification; returning failure here would misstate admission.+ let delay = (send_time - Utc::now()).num_seconds().max(0) + 2;+ let _ = self.enqueuer.enqueue_scheduled_message(link_id, message_id, Some(delay.min(900) as i32)).await.map_err(anyhow::Error::from).inspect_err(|error| {+ tracing::warn!(error=?error, %message_id, "send admitted; scanner will recover notification");+ });+ self.publish_email_event(&EmailMacroEvent::message_send_queued(+ MessageSendQueuedMetadata {+ link_id,+ owner: link.macro_id.clone(),+ actor: Some(actor),+ message_id,+ thread_id,+ scheduled_send_at: send_time,+ is_scheduled: snapshot.message.send_time.is_some(),+ },+ ));+ }+ self.hydrate_send_attempt(link_id, attempt).await+ }++ #[tracing::instrument(skip_all, fields(%link_id, attempt_id = %attempt_id.0, phase = "authorization"), err)]+ async fn cancel_email_send(+ &self,+ actor: MacroUserIdStr<'static>,+ link_id: Uuid,+ attempt_id: SendAttemptId,+ ) -> Result<SendAttempt, EmailErr> {+ let started = Instant::now();+ let inboxes = self+ .email_repo+ .inboxes_for_macro_id(actor.clone())+ .await+ .map_err(anyhow::Error::from)?;+ let link = resolve_target_link(&inboxes, Some(link_id), &actor)?;+ tracing::Span::current().record("phase", "cancel");+ let attempt = self+ .email_repo+ .cancel_send(&actor, link_id, attempt_id)+ .await?;+ log_attempt_outcome("cancel", &attempt, started);+ if let (SendAttemptStatus::Cancelled, Some(message_id), Some(thread_id)) =+ (attempt.status, attempt.message_id, attempt.thread_id)+ && attempt.transitioned+ {+ self.publish_email_event(&EmailMacroEvent::message_send_cancelled(+ MessageSendCancelledMetadata {+ link_id,+ owner: link.macro_id.clone(),+ actor: Some(actor),+ message_id,+ thread_id,+ reason: SendCancelReason::Undo,+ },+ ));+ }+ self.hydrate_send_attempt(link_id, attempt).await+ }++ #[tracing::instrument(skip_all, fields(%link_id, attempt_id = %attempt_id.0, phase = "authorization"), err)]+ async fn email_send_status(+ &self,+ actor: MacroUserIdStr<'static>,+ link_id: Uuid,+ attempt_id: SendAttemptId,+ ) -> Result<Option<SendAttempt>, EmailErr> {+ let inboxes = self+ .email_repo+ .inboxes_for_macro_id(actor.clone())+ .await+ .map_err(anyhow::Error::from)?;+ resolve_target_link(&inboxes, Some(link_id), &actor)?;+ tracing::Span::current().record("phase", "read_attempt");+ match self+ .email_repo+ .read_send_attempt(&actor, link_id, attempt_id, None)+ .await?+ {+ Some(attempt) => self.hydrate_send_attempt(link_id, attempt).await.map(Some),+ None => Ok(None),+ }+ }+}++fn log_attempt_outcome(operation: &'static str, attempt: &SendAttempt, started: Instant) {+ tracing::info!(+ event = "email_send.attempt_resolved",+ operation,+ status = ?attempt.status,+ transitioned = attempt.transitioned,+ message_id = ?attempt.message_id,+ thread_id = ?attempt.thread_id,+ send_time = ?attempt.send_time,+ duration_ms = started.elapsed().as_millis() as u64,+ "email send authority resolved before response hydration",+ );+}++impl EmailSendService for crate::domain::ports::NoOpEmailService {+ async fn pending_email_sends(+ &self,+ _: MacroUserIdStr<'static>,+ _: Option<crate::domain::send_attempt::SendAttemptCursor>,+ ) -> Result<crate::domain::send_attempt::SendAttemptPage, EmailErr> {+ Err(EmailErr::Unauthorized)+ }+ async fn send_email(+ &self,+ _: MacroUserIdStr<'static>,+ _: Uuid,+ _: SendAttemptId,+ _: SendSnapshot,+ ) -> Result<SendAttempt, EmailErr> {+ Err(EmailErr::Unauthorized)+ }+ async fn cancel_email_send(+ &self,+ _: MacroUserIdStr<'static>,+ _: Uuid,+ _: SendAttemptId,+ ) -> Result<SendAttempt, EmailErr> {+ Err(EmailErr::Unauthorized)+ }+ async fn email_send_status(+ &self,+ _: MacroUserIdStr<'static>,+ _: Uuid,+ _: SendAttemptId,+ ) -> Result<Option<SendAttempt>, EmailErr> {+ Err(EmailErr::Unauthorized)+ }+}++impl<T, U, E, CS, Eam, B> EmailServiceImpl<T, U, E, CS, Eam, B>+where+ T: EmailRepo + EmailSendRepo,+ U: FrecencyQueryService,+ E: EmailMessageEnqueuer,+ CS: crm::domain::service::CrmService,+ anyhow::Error: From<T::Err>,+{+ async fn hydrate_send_attempt(+ &self,+ link: Uuid,+ mut attempt: SendAttempt,+ ) -> Result<SendAttempt, EmailErr> {+ tracing::Span::current().record("phase", "hydrate_response");+ let Some(message_id) = attempt.message_id else {+ return Ok(attempt);+ };+ let Some(row) = self.email_repo.send_message_row(link, message_id).await? else {+ return Ok(attempt);+ };+ let ids = [message_id];+ let (senders, recipients, labels) = tokio::try_join!(+ self.email_repo.senders_by_message_ids(&ids),+ self.email_repo.recipients_by_message_ids(&ids),+ self.email_repo.labels_by_message_ids(&ids),+ )+ .map_err(anyhow::Error::from)?;+ attempt.message = self+ .hydrate_full_messages(vec![row], senders, recipients, labels, true)+ .await?+ .pop();+ Ok(attempt)+ }+}diff --git a/crates/email/src/domain/service/thread.rs b/crates/email/src/domain/service/thread.rsindex 799509e9e0..e1f6bdbdc9 100644--- a/crates/email/src/domain/service/thread.rs+++ b/crates/email/src/domain/service/thread.rs@@ -34,6 +34,27 @@ whereCS: crm::domain::service::CrmService,anyhow::Error: From<T::Err>,{+ /// An entity share grants access to that entity only. Following a retained+ /// thread's alias requires independent access to its entire inbox.+ pub(crate) async fn resolve_thread_read_id_impl(+ &self,+ macro_id: macro_user_id::user_id::MacroUserIdStr<'_>,+ thread_id: Uuid,+ ) -> Result<Uuid, EmailErr> {+ let inboxes = self+ .email_repo+ .inboxes_for_macro_id(macro_id)+ .await+ .map_err(anyhow::Error::from)?;+ let link_ids: Vec<_> = inboxes.iter().map(|link| link.id).collect();+ Ok(self+ .email_repo+ .redirected_thread_id(thread_id, &link_ids)+ .await+ .map_err(anyhow::Error::from)?+ .unwrap_or(thread_id))+ }+/// Fetch thread row, paginated messages, and their core sub-resources/// (senders, recipients, labels). Returns `None` if the thread doesn't exist.async fn fetch_thread_core(@@ -42,8 +63,15 @@ whereoffset: i64,limit: i64,) -> Result<Option<ThreadFetchResult>, EmailErr> {- let thread_id = Uuid::parse_str(&receipt.entity().entity_id)+ let requested_id = Uuid::parse_str(&receipt.entity().entity_id).map_err(|e| EmailErr::RepoErr(anyhow::anyhow!("invalid thread id: {}", e)))?;+ let thread_id = match receipt.get_authenticated_user() {+ Ok(actor) => {+ self.resolve_thread_read_id_impl(actor.clone(), requested_id)+ .await?+ }+ Err(_) => requested_id,+ };let thread_row = self.email_repo@@ -61,12 +89,13 @@ where.await.map_err(anyhow::Error::from)?;- let is_owner = matches!(- receipt.entity_permission(),- EntityPermission::AccessLevel {- access_level: AccessLevel::Owner- }- );+ let is_owner = thread_id != requested_id+ || matches!(+ receipt.entity_permission(),+ EntityPermission::AccessLevel {+ access_level: AccessLevel::Owner+ }+ );let mut message_ids: Vec<Uuid> = message_rows.iter().map(|m| m.db_id).collect();@@ -133,7 +162,7 @@ where}))}- async fn hydrate_full_messages(+ pub(super) async fn hydrate_full_messages(&self,message_rows: Vec<MessageRow>,mut senders: HashMap<Uuid, ContactInfo>,@@ -167,7 +196,7 @@ where) = tokio::try_join!(async {self.email_repo- .scheduled_send_times_by_message_ids(&message_ids)+ .scheduled_sends_by_message_ids(&message_ids).await.map_err(anyhow::Error::from)},@@ -505,6 +534,7 @@ fn parsed_message_from_row();ParsedMessage {+ draft_generation: row.draft_generation,db_id: row.db_id,link_id: row.link_id,thread_db_id: row.thread_db_id,diff --git a/crates/email/src/inbound/axum/api_types/draft.rs b/crates/email/src/inbound/axum/api_types/draft.rsindex 3be562e2a9..dae0647fc0 100644--- a/crates/email/src/inbound/axum/api_types/draft.rs+++ b/crates/email/src/inbound/axum/api_types/draft.rs@@ -6,6 +6,15 @@ use uuid::Uuid;use crate::domain::models::{ContactInfo, CreateDraftInput, CreatedDraft};+/// Preconditions captured with a draft edit, including attachment changes.+#[derive(Debug, Deserialize, utoipa::IntoParams)]+#[into_params(parameter_in = Query)]+pub struct DraftEditPrecondition {+ /// Generation from the last loaded draft. Legacy clients use zero.+ #[serde(default)]+ pub draft_generation: i32,+}+/// Contact info for draft request/response (backward-compatible with MessageToSend shape).#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]pub struct ApiDraftContactInfo {@@ -40,6 +49,9 @@ impl From<ContactInfo> for ApiDraftContactInfo {/// The draft input matching the current `MessageToSend` JSON shape for backward compat.#[derive(Debug, Deserialize, ToSchema)]pub struct ApiDraftInput {+ /// Generation from the last loaded draft; legacy clients begin at zero.+ #[serde(default)]+ pub draft_generation: i32,/// Existing message DB ID (for updating an existing draft).pub db_id: Option<Uuid>,/// Provider message ID.@@ -85,6 +97,8 @@ pub struct CreateDraftRequest {/// The draft output matching the current `MessageToSend` JSON shape for backward compat.#[derive(Debug, Serialize, ToSchema)]pub struct ApiDraftOutput {+ /// Generation required for subsequent edits.+ pub draft_generation: i32,/// Message DB ID.pub db_id: Option<Uuid>,/// Provider message ID.@@ -130,6 +144,8 @@ impl CreateDraftRequest {let draft = self.draft;CreateDraftInput {+ frozen_signature_html: None,+ draft_generation: draft.draft_generation,sender_email: None,db_id: draft.db_id,provider_id: draft.provider_id,@@ -180,6 +196,7 @@ impl From<CreatedDraft> for ApiDraftOutput {d.bcc.into_iter().map(ApiDraftContactInfo::from).collect();ApiDraftOutput {+ draft_generation: d.draft_generation,db_id: Some(d.db_id),provider_id: d.provider_id,replying_to_id: d.replying_to_id,diff --git a/crates/email/src/inbound/axum/api_types/message.rs b/crates/email/src/inbound/axum/api_types/message.rsindex d2db6679a8..d3a4b13c3f 100644--- a/crates/email/src/inbound/axum/api_types/message.rs+++ b/crates/email/src/inbound/axum/api_types/message.rs@@ -176,6 +176,8 @@ impl From<AttachmentForwarded> for ApiAttachmentForwarded {#[derive(Debug, Serialize, ToSchema)]#[cfg_attr(feature = "ai_schema", derive(schemars::JsonSchema))]pub struct ApiMessage {+ /// Draft edit generation; changes at send and cancellation boundaries.+ pub draft_generation: i32,#[serde(skip_serializing_if = "Option::is_none")]pub operation_status: Option<super::ApiMessageOperation>,#[schema(required = false)]@@ -200,6 +202,9 @@ pub struct ApiMessage {pub has_attachments: bool,#[serde(skip_serializing_if = "Option::is_none")]pub scheduled_send_time: Option<DateTime<Utc>>,+ /// Delivery state, including failures and unresolved provider outcomes.+ #[serde(skip_serializing_if = "Option::is_none")]+ pub scheduled_send_status: Option<crate::domain::models::ScheduledSendStatus>,pub from: Option<ApiContactInfo>,pub to: Vec<ApiContactInfo>,pub cc: Vec<ApiContactInfo>,@@ -220,6 +225,7 @@ pub struct ApiMessage {impl From<Message> for ApiMessage {fn from(m: Message) -> Self {ApiMessage {+ draft_generation: m.draft_generation,operation_status: m.operation_status.map(Into::into),calendar_invitations: m.calendar_invitations,db_id: m.db_id,@@ -241,6 +247,7 @@ impl From<Message> for ApiMessage {is_draft: m.is_draft,has_attachments: m.has_attachments,scheduled_send_time: m.scheduled_send_time,+ scheduled_send_status: m.scheduled_send_status,from: m.from.map(ApiContactInfo::from),to: m.to.into_iter().map(ApiContactInfo::from).collect(),cc: m.cc.into_iter().map(ApiContactInfo::from).collect(),diff --git a/crates/email/src/inbound/axum/api_types/mod.rs b/crates/email/src/inbound/axum/api_types/mod.rsindex 3138cb4a3e..80be0423f5 100644--- a/crates/email/src/inbound/axum/api_types/mod.rs+++ b/crates/email/src/inbound/axum/api_types/mod.rs@@ -3,6 +3,7 @@ mod send;pub use draft::{ApiDraftContactInfo, ApiDraftInput, ApiDraftOutput, CreateDraftRequest, CreateDraftResponse,+ DraftEditPrecondition,};pub use send::{SendMessageRequest, SendMessageResponse};mod label;diff --git a/crates/email/src/inbound/axum/api_types/send.rs b/crates/email/src/inbound/axum/api_types/send.rsindex 914b516c36..b99494bb8d 100644--- a/crates/email/src/inbound/axum/api_types/send.rs+++ b/crates/email/src/inbound/axum/api_types/send.rs@@ -27,6 +27,8 @@ impl SendMessageRequest {let msg = self.message;CreateDraftInput {+ frozen_signature_html: None,+ draft_generation: msg.draft_generation,sender_email: None,db_id: msg.db_id,provider_id: msg.provider_id,diff --git a/crates/email/src/inbound/axum/draft_router.rs b/crates/email/src/inbound/axum/draft_router.rsindex 41239615b6..a1c125a41a 100644--- a/crates/email/src/inbound/axum/draft_router.rs+++ b/crates/email/src/inbound/axum/draft_router.rs@@ -84,7 +84,8 @@ impl From<EmailErr> for CreateDraftError {EmailErr::MessageNotFound(_) | EmailErr::ThreadNotFound => {CreateDraftError::NotFound(err.to_string())}- EmailErr::MessageAlreadySent(_)+ EmailErr::DraftGenerationConflict(_)+ | EmailErr::MessageAlreadySent(_)| EmailErr::InvalidDraft(_)| EmailErr::MessageDeliveryConflict(_)| EmailErr::CannotReplyToDraftdiff --git a/crates/email/src/inbound/axum/send_router.rs b/crates/email/src/inbound/axum/send_router.rsindex c13fab36a6..53862f56b1 100644--- a/crates/email/src/inbound/axum/send_router.rs+++ b/crates/email/src/inbound/axum/send_router.rs@@ -67,7 +67,8 @@ impl From<EmailErr> for SendMessageError {fn from(err: EmailErr) -> Self {match &err {EmailErr::MessageNotFound(_) => SendMessageError::NotFound(err.to_string()),- EmailErr::MessageAlreadySent(_)+ EmailErr::DraftGenerationConflict(_)+ | EmailErr::MessageAlreadySent(_)| EmailErr::InvalidDraft(_)| EmailErr::MessageDeliveryConflict(_)| EmailErr::CannotReplyToDraftdiff --git a/crates/email/src/inbound/axum/thread_labels_router.rs b/crates/email/src/inbound/axum/thread_labels_router.rsindex 3713d3c9c9..b290991803 100644--- a/crates/email/src/inbound/axum/thread_labels_router.rs+++ b/crates/email/src/inbound/axum/thread_labels_router.rs@@ -88,6 +88,7 @@ impl From<EmailErr> for UpdateThreadLabelError {EmailErr::Unauthorized => UpdateThreadLabelError::Forbidden,EmailErr::InvalidDraft(_)| EmailErr::MessageDeliveryConflict(_)+ | EmailErr::DraftGenerationConflict(_)| EmailErr::MessageAlreadySent(_)| EmailErr::ThreadHasNoInboundMessages => {UpdateThreadLabelError::Conflict(err.to_string())diff --git a/crates/email/src/inbound/toolset/send_email.rs b/crates/email/src/inbound/toolset/send_email.rsindex a633811dc4..aa3eb22d56 100644--- a/crates/email/src/inbound/toolset/send_email.rs+++ b/crates/email/src/inbound/toolset/send_email.rs@@ -169,6 +169,8 @@ where}let input = CreateDraftInput {+ frozen_signature_html: None,+ draft_generation: 0,sender_email: None,db_id: None,provider_id: None,diff --git a/crates/email/src/outbound/email_pg_repo.rs b/crates/email/src/outbound/email_pg_repo.rsindex d35c90cd6a..ea0b05a257 100644--- a/crates/email/src/outbound/email_pg_repo.rs+++ b/crates/email/src/outbound/email_pg_repo.rs@@ -11,7 +11,6 @@ use crate::domain::{DraftAttachmentRepo, EmailRepo, EmailUserRepo, LinkEmailSettings, RecipientsByMessageId,},};-use chrono::{DateTime, Utc};use macro_user_id::user_id::MacroUserIdStr;use sqlx::PgPool;use std::collections::HashMap;@@ -39,6 +38,7 @@ mod preview;mod preview_views;mod project;mod scheduled;+mod send_attempt;pub(super) mod sender_policy;mod settings;mod thread;@@ -104,6 +104,14 @@ impl EmailUserRepo for EmailPgRepo {}impl EmailRepo for EmailPgRepo {+ async fn redirected_thread_id(+ &self,+ thread_id: Uuid,+ link_ids: &[Uuid],+ ) -> Result<Option<Uuid>, Self::Err> {+ client_id_mapping::redirected_thread_id(&self.pool, thread_id, link_ids).await+ }+async fn commit_sender_policy(&self,actor: &MacroUserIdStr<'_>,@@ -315,11 +323,11 @@ impl EmailRepo for EmailPgRepo {message::forwarded_attachments_by_message_ids(&self.pool, message_ids).await}- async fn scheduled_send_times_by_message_ids(+ async fn scheduled_sends_by_message_ids(&self,message_ids: &[Uuid],- ) -> Result<HashMap<Uuid, DateTime<Utc>>, Self::Err> {- message::scheduled_send_times_by_message_ids(&self.pool, message_ids).await+ ) -> Result<HashMap<Uuid, crate::domain::models::ScheduledSend>, Self::Err> {+ message::scheduled_sends_by_message_ids(&self.pool, message_ids).await}async fn get_simple_message(@@ -360,8 +368,18 @@ impl EmailRepo for EmailPgRepo {thread_db_id: Uuid,link_ids: &[Uuid],actor: Option<&str>,++ expected_generation: i32,) -> Result<Option<DraftDeletion>, Self::Err> {- message::delete_draft_message(&self.pool, message_id, thread_db_id, link_ids, actor).await+ message::delete_draft_message(+ &self.pool,+ message_id,+ thread_db_id,+ link_ids,+ actor,+ expected_generation,+ )+ .await}async fn upsert_contacts(diff --git a/crates/email/src/outbound/email_pg_repo/client_id_mapping.rs b/crates/email/src/outbound/email_pg_repo/client_id_mapping.rsindex a46bb07eb7..9b2e5c2a65 100644--- a/crates/email/src/outbound/email_pg_repo/client_id_mapping.rs+++ b/crates/email/src/outbound/email_pg_repo/client_id_mapping.rs@@ -9,6 +9,26 @@ use crate::domain::models::SettledDraftIds;use sqlx::PgPool;use uuid::Uuid;+/// Retained source threads redirect only while globally empty. Pagination can+/// return an empty page for a live thread and must never trigger a redirect.+pub(super) async fn redirected_thread_id(+ pool: &PgPool,+ thread_id: Uuid,+ link_ids: &[Uuid],+) -> Result<Option<Uuid>, sqlx::Error> {+ sqlx::query_scalar!(+ r#"SELECT target.id FROM email_thread_client_ids alias+ JOIN email_threads source ON source.id = alias.client_id AND source.link_id = alias.link_id+ JOIN email_threads target ON target.id = alias.thread_id AND target.link_id = source.link_id+ WHERE source.id = $1 AND source.link_id = ANY($2) AND target.id <> source.id+ AND NOT EXISTS(SELECT 1 FROM email_messages WHERE thread_id = source.id)"#,+ thread_id,+ link_ids,+ )+ .fetch_optional(pool)+ .await+}+/// Resolve a client draft handle to its message ID within the given inboxes./// Newest binding wins if a handle ever appears under more than one link/// (a moved draft re-binds under its new inbox).diff --git a/crates/email/src/outbound/email_pg_repo/db_types.rs b/crates/email/src/outbound/email_pg_repo/db_types.rsindex 2b791ab50f..49ab46e31b 100644--- a/crates/email/src/outbound/email_pg_repo/db_types.rs+++ b/crates/email/src/outbound/email_pg_repo/db_types.rs@@ -206,6 +206,8 @@ impl From<DbThreadRow> for ThreadRow {/// DB row for a message record.#[derive(sqlx::FromRow)]pub struct DbMessageRow {+ /// Draft edit generation; changes at send and cancellation boundaries.+ pub draft_generation: i32,pub id: uuid::Uuid,pub provider_id: Option<String>,pub thread_id: uuid::Uuid,@@ -235,6 +237,7 @@ pub struct DbMessageRow {impl From<DbMessageRow> for MessageRow {fn from(row: DbMessageRow) -> Self {Self {+ draft_generation: row.draft_generation,db_id: row.id,provider_id: row.provider_id,thread_db_id: row.thread_id,diff --git a/crates/email/src/outbound/email_pg_repo/draft.rs b/crates/email/src/outbound/email_pg_repo/draft.rsindex 46832e7aaf..1692f497e6 100644--- a/crates/email/src/outbound/email_pg_repo/draft.rs+++ b/crates/email/src/outbound/email_pg_repo/draft.rs@@ -77,13 +77,30 @@ pub(crate) async fn insert_message() -> Result<Option<SettledDraftIds>, EmailErr> {let mut tx = pool.begin().await.map_err(anyhow::Error::from)?;+ let settled =+ insert_message_in_transaction(&mut tx, input, contacts, link_id, new_thread, is_draft)+ .await?;+ if settled.is_some() {+ tx.commit().await.map_err(anyhow::Error::from)?;+ }+ Ok(settled)+}++pub(super) async fn insert_message_in_transaction(+ tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,+ input: &ResolvedDraftInput,+ contacts: &UpsertedContacts,+ link_id: Uuid,+ new_thread: Option<ThreadRow>,+ is_draft: bool,+) -> Result<Option<SettledDraftIds>, EmailErr> {// Match the mailbox workers' link -> message lock order, and revalidate the// actor at the transaction that accepts an Outlook write.let mailbox = sqlx::query!(r#"SELECT macro_id,($2::text = macro_id OR EXISTS (SELECT 1 FROM macro_user_links u WHERE u.link_id = email_links.id AND u.primary_macro_id = $2)) AS authorizedFROM email_links WHERE id = $1 AND provider = 'OUTLOOK' FOR UPDATE- "#,link_id,input.actor_id).fetch_optional(&mut *tx).await.map_err(anyhow::Error::from)?;+ "#,link_id,input.actor_id).fetch_optional(&mut **tx).await.map_err(anyhow::Error::from)?;if mailbox.as_ref().is_some_and(|mailbox| mailbox.authorized != Some(true))@@ -104,10 +121,10 @@ pub(crate) async fn insert_message(// handle and re-read the binding under the lock: the loser adopts the row// the winner settled on and updates it instead.if let Some(client_id) = input.draft_client_id {- client_id_mapping::lock_draft_client_id(&mut tx, client_id, link_id)+ client_id_mapping::lock_draft_client_id(&mut *tx, client_id, link_id).await.map_err(anyhow::Error::from)?;- if let Some(bound) = client_id_mapping::bound_draft_row(&mut tx, client_id, link_id)+ if let Some(bound) = client_id_mapping::bound_draft_row(&mut *tx, client_id, link_id).await.map_err(anyhow::Error::from)?&& bound.message_db_id != settled.message_db_id@@ -126,35 +143,64 @@ pub(crate) async fn insert_message(// Serialize with schedule/cancel/claim before checking editability. The// domain's earlier read cannot protect a save waiting on this transaction.let existing = sqlx::query!(- "SELECT link_id, is_sent, is_draft, (EXISTS (SELECT 1 FROM email_mailbox_drafts d WHERE d.message_id = email_messages.id AND d.delete_requested) OR EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.source_id=email_messages.id AND t.state<>'preparing')) AS \"deleted!\" FROM email_messages WHERE id = $1 FOR UPDATE",+ "SELECT link_id, draft_generation, is_sent, is_draft, (EXISTS (SELECT 1 FROM email_mailbox_drafts d WHERE d.message_id = email_messages.id AND d.delete_requested) OR EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.source_id=email_messages.id AND t.state<>'preparing')) AS \"deleted!\" FROM email_messages WHERE id = $1 FOR UPDATE",message_db_id,)- .fetch_optional(&mut *tx)+ .fetch_optional(&mut **tx).await.map_err(anyhow::Error::from)?;let was_missing = existing.is_none();+ if was_missing {+ let retired = sqlx::query_scalar!(+ r#"SELECT EXISTS(SELECT 1 FROM email_send_attempts WHERE (link_id=$1 OR $1=ANY(draft_link_ids))+ AND ($2=ANY(draft_handles) OR $3=ANY(draft_handles))) AS "retired!""#,+ link_id, message_db_id, input.draft_client_id,+ ).fetch_one(&mut **tx).await.map_err(anyhow::Error::from)?;+ if retired {+ return Err(EmailErr::DraftGenerationConflict(message_db_id));+ }+ }if let Some(existing) = existing {- if existing.link_id != link_id || existing.is_sent || !existing.is_draft || existing.deleted- {+ if existing.link_id != link_id || existing.is_sent || existing.deleted {return Ok(None);}+ if existing.draft_generation != input.draft_generation {+ return Err(EmailErr::DraftGenerationConflict(message_db_id));+ }+ if !existing.is_draft {+ return Err(EmailErr::MessageDeliveryConflict(message_db_id));+ }+ if !is_draft {+ // Older Gmail trash paths removed delivery without retiring its+ // attempt. A fresh, generation-matched Send may replace that safely+ // revoked authority. Outlook failure rows can still own provider+ // work without a schedule, so leave those to explicit cancellation.+ sqlx::query!(+ r#"UPDATE email_send_attempts a SET cancelled=true+ WHERE a.message_id=$1 AND a.link_id=$2+ AND NOT a.cancelled AND NOT a.sent AND NOT a.delivery_unconfirmed+ AND EXISTS(SELECT 1 FROM email_links WHERE id=$2 AND provider='GMAIL')+ AND NOT EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id=$1 AND link_id=$2)"#,+ message_db_id, link_id,+ ).execute(&mut **tx).await.map_err(anyhow::Error::from)?;+ }let scheduled = sqlx::query_scalar!(- "SELECT EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2) AS \"exists!\"",+ "SELECT (EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2) OR EXISTS(SELECT 1 FROM email_send_attempts WHERE message_id = $1 AND link_id = $2 AND NOT cancelled AND NOT sent)) AS \"exists!\"",message_db_id, link_id,- ).fetch_one(&mut *tx).await.map_err(anyhow::Error::from)?;+ ).fetch_one(&mut **tx).await.map_err(anyhow::Error::from)?;if scheduled {return Err(EmailErr::MessageDeliveryConflict(message_db_id));}}if let Some(thread) = new_thread {- thread::insert_thread(&mut tx, &thread, link_id)+ thread::insert_thread(&mut *tx, &thread, link_id).await.map_err(anyhow::Error::from)?;}let updated = upsert_draft(- &mut tx,+ &mut *tx,input,message_db_id,thread_db_id,@@ -173,14 +219,14 @@ pub(crate) async fn insert_message(// statement snapshot, so recheck after the upsert owns the message lock.// A concurrent insert+schedule must roll back this entire stale write.if was_missing {- let deleted = sqlx::query_scalar!("SELECT EXISTS(SELECT 1 FROM email_mailbox_drafts WHERE message_id = $1 AND delete_requested) AS \"deleted!\"",message_db_id).fetch_one(&mut *tx).await.map_err(anyhow::Error::from)?;+ let deleted = sqlx::query_scalar!("SELECT EXISTS(SELECT 1 FROM email_mailbox_drafts WHERE message_id = $1 AND delete_requested) AS \"deleted!\"",message_db_id).fetch_one(&mut **tx).await.map_err(anyhow::Error::from)?;if deleted {return Err(EmailErr::MessageNotFound(message_db_id));}let scheduled = sqlx::query_scalar!(- "SELECT EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2) AS \"exists!\"",+ "SELECT (EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2) OR EXISTS(SELECT 1 FROM email_send_attempts WHERE message_id = $1 AND link_id = $2 AND NOT cancelled AND NOT sent)) AS \"exists!\"",message_db_id, link_id,- ).fetch_one(&mut *tx).await.map_err(anyhow::Error::from)?;+ ).fetch_one(&mut **tx).await.map_err(anyhow::Error::from)?;if scheduled {return Err(EmailErr::MessageDeliveryConflict(message_db_id));}@@ -189,9 +235,9 @@ pub(crate) async fn insert_message(// Only immediate Send persists its internal undo-window delivery here.// Ordinary draft writes never touch scheduling, even for legacy clients.if !is_draft && input.send_time.is_some() {- require_completed_uploads(&mut tx, message_db_id).await?;+ require_completed_uploads(&mut *tx, message_db_id).await?;message::process_scheduled_message(- &mut tx,+ &mut *tx,link_id,message_db_id,input.send_time,@@ -201,13 +247,13 @@ pub(crate) async fn insert_message(.map_err(anyhow::Error::from)?;}- message::upsert_recipients(&mut tx, message_db_id, contacts)+ message::upsert_recipients(&mut *tx, message_db_id, contacts).await.map_err(anyhow::Error::from)?;if let Some(mailbox) = mailbox {snapshot_outlook_draft(- &mut tx,+ &mut *tx,message_db_id,link_id,input.actor_id.as_deref().unwrap_or(&mailbox.macro_id),@@ -216,28 +262,27 @@ pub(crate) async fn insert_message(.map_err(anyhow::Error::from)?;}- thread::update_thread_metadata(&mut tx, thread_db_id, link_id)+ thread::update_thread_metadata(&mut *tx, thread_db_id, link_id).await.map_err(anyhow::Error::from)?;- thread::upsert_user_history(&mut tx, link_id, thread_db_id)+ thread::upsert_user_history(&mut *tx, link_id, thread_db_id).await.map_err(anyhow::Error::from)?;// Persist handles with the actual settled identity, including a concurrent// first-save winner and a draft recreated after sender migration.if let Some(client_id) = input.draft_client_id {- client_id_mapping::bind_draft_client_id(&mut tx, client_id, link_id, message_db_id)+ client_id_mapping::bind_draft_client_id(&mut *tx, client_id, link_id, message_db_id).await.map_err(anyhow::Error::from)?;}if let Some(client_id) = input.thread_client_id {- client_id_mapping::bind_thread_client_id(&mut tx, client_id, link_id, thread_db_id)+ client_id_mapping::bind_thread_client_id(&mut *tx, client_id, link_id, thread_db_id).await.map_err(anyhow::Error::from)?;}- tx.commit().await.map_err(anyhow::Error::from)?;Ok(Some(settled))}@@ -266,9 +311,9 @@ pub(crate) async fn upsert_draft(replying_to_id, subject, from_contact_id, sent_at,has_attachments, is_read, is_starred, is_sent, is_draft,body_text, body_html_sanitized, body_macro, headers_jsonb,- created_at, updated_at+ created_at, updated_at, draft_generation)- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21)ON CONFLICT (id) DO UPDATE SETprovider_id = COALESCE(email_messages.provider_id, EXCLUDED.provider_id),thread_id = EXCLUDED.thread_id,@@ -287,9 +332,11 @@ pub(crate) async fn upsert_draft(headers_jsonb = EXCLUDED.headers_jsonb,updated_at = NOW()WHERE email_messages.link_id = EXCLUDED.link_id+ AND email_messages.draft_generation = $21AND email_messages.is_draft AND NOT email_messages.is_sentAND NOT EXISTS (SELECT 1 FROM email_mailbox_drafts d WHERE d.message_id = EXCLUDED.id AND d.delete_requested)AND NOT EXISTS (SELECT 1 FROM email_scheduled_messages WHERE message_id = EXCLUDED.id AND link_id = EXCLUDED.link_id)+ AND NOT EXISTS (SELECT 1 FROM email_send_attempts WHERE message_id = EXCLUDED.id AND link_id = EXCLUDED.link_id AND NOT cancelled AND NOT sent)"#,message_db_id,input.provider_id,@@ -311,6 +358,7 @@ pub(crate) async fn upsert_draft(input.headers_json,now,now,+ input.draft_generation,).execute(&mut *tx).await?;diff --git a/crates/email/src/outbound/email_pg_repo/draft_attachments.rs b/crates/email/src/outbound/email_pg_repo/draft_attachments.rsindex d294e76941..e8720409f8 100644--- a/crates/email/src/outbound/email_pg_repo/draft_attachments.rs+++ b/crates/email/src/outbound/email_pg_repo/draft_attachments.rs@@ -54,15 +54,19 @@ impl DraftAttachmentRepository for EmailPgRepo {link: Uuid,draft: Uuid,change: AttachmentChange,++ expected_generation: i32,) -> Result<(), AttachmentError> {let mut tx = self.pool.begin().await.map_err(db_error)?;+ // Serialize attachment edits without blocking the schedule foreign key's+ // key-share lock while its transaction holds the message lock.let mailbox=sqlx::query!(r#"SELECT provider::text AS "provider!",sync_generation,(macro_id = $2 OR EXISTS (SELECT 1 FROM macro_user_links u WHERE u.link_id = l.id AND u.primary_macro_id = $2)) AS "authorized!"- FROM email_links l WHERE id = $1 FOR UPDATE"#,link,actor).fetch_optional(&mut *tx).await.map_err(db_error)?.ok_or(AttachmentError::NotFound)?;- let message=sqlx::query!(r#"SELECT thread_id,is_draft,is_sent,- EXISTS (SELECT 1 FROM email_scheduled_messages s WHERE s.message_id = m.id) AS "scheduled!",+ FROM email_links l WHERE id = $1 FOR NO KEY UPDATE"#,link,actor).fetch_optional(&mut *tx).await.map_err(db_error)?.ok_or(AttachmentError::NotFound)?;+ let message=sqlx::query!(r#"SELECT thread_id,draft_generation,is_draft,is_sent,(EXISTS (SELECT 1 FROM email_mailbox_drafts d WHERE d.message_id = m.id AND d.delete_requested) OR EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.source_id=m.id AND t.state<>'preparing')) AS "deleted!"FROM email_messages m WHERE id = $1 AND link_id = $2 FOR UPDATE"#,draft,link).fetch_optional(&mut *tx).await.map_err(db_error)?.ok_or(AttachmentError::NotFound)?;+ let scheduled = sqlx::query_scalar!("SELECT (EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id=$1 AND link_id=$2) OR EXISTS(SELECT 1 FROM email_send_attempts WHERE message_id=$1 AND link_id=$2 AND NOT cancelled AND NOT sent)) AS \"exists!\"", draft, link).fetch_one(&mut *tx).await.map_err(db_error)?;let provider = match mailbox.provider.as_str() {"GMAIL" => UserProvider::Gmail,"OUTLOOK" => UserProvider::Outlook,@@ -114,10 +118,9 @@ impl DraftAttachmentRepository for EmailPgRepo {validate_attachment_edit(&AttachmentEditFacts {authorized: mailbox.authorized,- editable: (message.is_draft || message.scheduled)- && !message.is_sent- && !message.deleted,- scheduled: message.scheduled,+ editable: (message.is_draft || scheduled) && !message.is_sent && !message.deleted,+ scheduled,+ generation_matches: message.draft_generation == expected_generation,provider,total_bytes: total.max(0) as u64,},diff --git a/crates/email/src/outbound/email_pg_repo/draft_attachments/test.rs b/crates/email/src/outbound/email_pg_repo/draft_attachments/test.rsindex 6a0dcd4d70..be593188bf 100644--- a/crates/email/src/outbound/email_pg_repo/draft_attachments/test.rs+++ b/crates/email/src/outbound/email_pg_repo/draft_attachments/test.rs@@ -50,9 +50,15 @@ async fn upload_reservations_are_idempotent_and_never_send_unverified_bytes(db:let mut file = upload(draft, 120_000_000);file.upload_pending = true;for _ in 0..2 {- repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::Upload(file.clone()))- .await- .unwrap();+ repo.commit_attachment_change(+ ACTOR,+ link,+ draft,+ AttachmentChange::Upload(file.clone()),+ 0,+ )+ .await+ .unwrap();}let content = sqlx::query_scalar!("SELECT desired_content FROM email_mailbox_drafts WHERE message_id=$1",@@ -72,7 +78,7 @@ async fn upload_reservations_are_idempotent_and_never_send_unverified_bytes(db:let mut wrong = file.clone();wrong.sha = "b".repeat(64);assert!(- repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::Upload(wrong))+ repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::Upload(wrong), 0).await.is_err());@@ -81,7 +87,8 @@ async fn upload_reservations_are_idempotent_and_never_send_unverified_bytes(db:"macro|[email protected]",link,draft,- AttachmentChange::CompleteUpload(file.clone())+ AttachmentChange::CompleteUpload(file.clone()),+ 0).await,Err(AttachmentError::Forbidden)@@ -91,6 +98,7 @@ async fn upload_reservations_are_idempotent_and_never_send_unverified_bytes(db:link,draft,AttachmentChange::CompleteUpload(file.clone()),+ 0,).await.unwrap();@@ -99,6 +107,7 @@ async fn upload_reservations_are_idempotent_and_never_send_unverified_bytes(db:link,draft,AttachmentChange::CompleteUpload(file.clone()),+ 0,).await.unwrap();@@ -123,6 +132,7 @@ async fn upload_reservations_are_idempotent_and_never_send_unverified_bytes(db:attachment_id: file.id,kind: RemovalKind::UploadedOrNative,},+ 0,).await.unwrap();@@ -131,13 +141,14 @@ async fn upload_reservations_are_idempotent_and_never_send_unverified_bytes(db:ACTOR,link,draft,- AttachmentChange::CompleteUpload(file.clone())+ AttachmentChange::CompleteUpload(file.clone()),+ 0).await.is_err());assert!(- repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::Upload(file))+ repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::Upload(file), 0).await.is_err());@@ -148,35 +159,60 @@ async fn an_expired_upload_requires_an_explicit_reservation_retry(db: PgPool) {let (repo, link, draft) = fixture(&db).await;let mut file = upload(draft, 123);file.upload_pending = true;- repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::Upload(file.clone()))- .await- .unwrap();+ repo.commit_attachment_change(+ ACTOR,+ link,+ draft,+ AttachmentChange::Upload(file.clone()),+ 0,+ )+ .await+ .unwrap();sqlx::query!("UPDATE email_attachments_drafts SET upload_expires_at=now()-interval '1 second' WHERE id=$1",file.id).execute(&db).await.unwrap();assert!(repo.commit_attachment_change(ACTOR,link,draft,- AttachmentChange::CompleteUpload(file.clone())+ AttachmentChange::CompleteUpload(file.clone()),+ 0).await.is_err());- repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::Upload(file.clone()))- .await- .unwrap();- repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::CompleteUpload(file))- .await- .unwrap();+ repo.commit_attachment_change(+ ACTOR,+ link,+ draft,+ AttachmentChange::Upload(file.clone()),+ 0,+ )+ .await+ .unwrap();+ repo.commit_attachment_change(+ ACTOR,+ link,+ draft,+ AttachmentChange::CompleteUpload(file),+ 0,+ )+ .await+ .unwrap();}#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]async fn file_changes_commit_with_frozen_revision_and_defer_byte_cleanup(db: PgPool) {let (repo, link, draft) = fixture(&db).await;let file = upload(draft, 123);- repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::Upload(file.clone()))- .await- .unwrap();+ repo.commit_attachment_change(+ ACTOR,+ link,+ draft,+ AttachmentChange::Upload(file.clone()),+ 0,+ )+ .await+ .unwrap();let before = sqlx::query!("SELECT revision,desired_content FROM email_mailbox_drafts WHERE message_id = $1",draft@@ -197,6 +233,7 @@ async fn file_changes_commit_with_frozen_revision_and_defer_byte_cleanup(db: PgPattachment_id: file.id,kind: RemovalKind::UploadedOrNative,},+ 0,).await.unwrap();@@ -248,7 +285,8 @@ async fn send_and_attachment_edits_share_the_same_transaction_boundary(db: PgPooACTOR,link,draft,- AttachmentChange::Upload(upload(draft, 123))+ AttachmentChange::Upload(upload(draft, 123)),+ 0).await,Err(AttachmentError::DeliveryConflict)@@ -268,7 +306,8 @@ async fn send_and_attachment_edits_share_the_same_transaction_boundary(db: PgPoo"macro|[email protected]",link,draft,- AttachmentChange::Upload(upload(draft, 123))+ AttachmentChange::Upload(upload(draft, 123)),+ 0).await,Err(AttachmentError::Forbidden)@@ -283,13 +322,15 @@ async fn concurrent_additions_cannot_overrun_the_aggregate_limit(db: PgPool) {ACTOR,link,draft,- AttachmentChange::Upload(upload(draft, 100_000_000))+ AttachmentChange::Upload(upload(draft, 100_000_000)),+ 0),repo.commit_attachment_change(ACTOR,link,draft,- AttachmentChange::Upload(upload(draft, 100_000_000))+ AttachmentChange::Upload(upload(draft, 100_000_000)),+ 0));assert_ne!(one.is_ok(), two.is_ok());@@ -313,9 +354,15 @@ async fn cleanup_retains_active_claims_and_recovery_checkpoints(db: PgPool) {};let (repo, link, draft) = fixture(&db).await;let file = upload(draft, 123);- repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::Upload(file.clone()))- .await- .unwrap();+ repo.commit_attachment_change(+ ACTOR,+ link,+ draft,+ AttachmentChange::Upload(file.clone()),+ 0,+ )+ .await+ .unwrap();let sync = crate::outbound::mailbox_pg::PgMailboxSync::new(db.clone());let _lease = sync.claim_draft(@@ -333,6 +380,7 @@ async fn cleanup_retains_active_claims_and_recovery_checkpoints(db: PgPool) {attachment_id: file.id,kind: RemovalKind::UploadedOrNative,},+ 0,).await.unwrap();@@ -389,6 +437,7 @@ async fn transferred_upload_provider_echo_does_not_consume_quota_twice(db: PgPoolink,draft,AttachmentChange::Upload(original.clone()),+ 0,).await.unwrap();@@ -398,7 +447,7 @@ async fn transferred_upload_provider_echo_does_not_consume_quota_twice(db: PgPoolet source_id = Uuid::new_v4();sqlx::query!("INSERT INTO email_attachments(id,message_id,provider_attachment_id,filename,mime_type,size_bytes,content_id) VALUES($1,$2,'original-forward','notes.pdf','application/pdf',50000000,'forwarded@cid')",source_id,source_message).execute(&db).await.unwrap();let forwarded = repo.attachment_reference(source_id).await.unwrap().unwrap();- repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::Forward(forwarded))+ repo.commit_attachment_change(ACTOR, link, draft, AttachmentChange::Forward(forwarded), 0).await.unwrap();sqlx::query!("INSERT INTO email_attachments(id,message_id,provider_attachment_id,filename,mime_type,size_bytes,content_id) VALUES($1,$2,'forward-echo','notes.pdf','application/pdf',50000000,'<forwarded@cid>')",Uuid::new_v4(),draft).execute(&db).await.unwrap();@@ -407,6 +456,7 @@ async fn transferred_upload_provider_echo_does_not_consume_quota_twice(db: PgPoolink,draft,AttachmentChange::Upload(upload(draft, 100)),+ 0,).await.unwrap();@@ -426,6 +476,7 @@ async fn transferred_upload_provider_echo_does_not_consume_quota_twice(db: PgPooattachment_id,kind,},+ 0,).await.unwrap();@@ -442,6 +493,7 @@ async fn transferred_upload_provider_echo_does_not_consume_quota_twice(db: PgPoolink,draft,AttachmentChange::Upload(upload(draft, 149_000_000)),+ 0,).await.unwrap();diff --git a/crates/email/src/outbound/email_pg_repo/draft_transfer.rs b/crates/email/src/outbound/email_pg_repo/draft_transfer.rsindex ac091409fb..6d1c905ee3 100644--- a/crates/email/src/outbound/email_pg_repo/draft_transfer.rs+++ b/crates/email/src/outbound/email_pg_repo/draft_transfer.rs@@ -84,7 +84,8 @@ async fn source_facts(CASE WHEN l.provider='OUTLOOK' THEN COALESCE(d.checkpoint->'draft'->>'version',m.provider_version,d.base_version) ELSE m.provider_history_id END AS version,m.is_draft,m.is_sent,(COALESCE(d.delete_requested,false) OR EXISTS(SELECT 1 FROM email_draft_transfers t WHERE t.source_id=m.id AND t.state<>'preparing')) AS "retired!",- (EXISTS(SELECT 1 FROM email_scheduled_messages s WHERE s.message_id=m.id)+ (m.draft_generation <> $3 OR EXISTS(SELECT 1 FROM email_send_attempts a WHERE a.message_id=m.id AND NOT a.cancelled AND NOT a.sent)+ OR EXISTS(SELECT 1 FROM email_scheduled_messages s WHERE s.message_id=m.id)OR EXISTS(SELECT 1 FROM email_attachments_drafts a WHERE a.draft_id=m.id AND a.upload_pending)OR COALESCE(d.lease_until>now(),false) OR COALESCE(d.state IN ('conflict','unknown'),false)OR COALESCE(d.checkpoint->>'stage' NOT IN ('inspect','ready'),false)) AS "busy!",@@ -97,7 +98,7 @@ async fn source_facts(jsonb_agg(jsonb_build_object('email',c.email_address,'name',COALESCE(r.name,c.name))) FILTER(WHERE r.recipient_type='CC') AS cc_addresses,jsonb_agg(jsonb_build_object('email',c.email_address,'name',COALESCE(r.name,c.name))) FILTER(WHERE r.recipient_type='BCC') AS bcc_addressesFROM email_message_recipients r JOIN email_contacts c ON c.id=r.contact_id WHERE r.message_id=m.id) recipients- WHERE m.id=$1 AND m.link_id=$2 FOR UPDATE OF m"#,request.source_id,request.source_link_id).fetch_optional(tx).await.map_err(db)?.ok_or(EmailErr::MessageNotFound(request.source_id))?;+ WHERE m.id=$1 AND m.link_id=$2 FOR UPDATE OF m"#,request.source_id,request.source_link_id,request.draft_generation).fetch_optional(tx).await.map_err(db)?.ok_or(EmailErr::MessageNotFound(request.source_id))?;validate_transfer(TransferEligibility {authorized: true,draft: row.is_draft && !row.is_sent,diff --git a/crates/email/src/outbound/email_pg_repo/draft_transfer/test.rs b/crates/email/src/outbound/email_pg_repo/draft_transfer/test.rsindex b5b9da4722..821deced97 100644--- a/crates/email/src/outbound/email_pg_repo/draft_transfer/test.rs+++ b/crates/email/src/outbound/email_pg_repo/draft_transfer/test.rs@@ -30,6 +30,7 @@ async fn fixture(db: &PgPool) -> (EmailPgRepo, DraftTransferRequest) {(EmailPgRepo::new(db.clone()),DraftTransferRequest {+ draft_generation: 0,id: Uuid::now_v7(),source_id: draft,source_link_id: source,@@ -97,7 +98,8 @@ async fn transfer_preserves_uploads_and_fences_old_saves_deletes_and_delivery(dbrequest.source_id,plan.source_thread_id,&[request.source_link_id],- Some(ACTOR)+ Some(ACTOR),+ 0).await.unwrap()@@ -279,6 +281,7 @@ async fn paused_outlook_writes_still_finish_gmail_moves_and_keep_outlook_originalet gmail_move = prepare(&repo,&DraftTransferRequest {+ draft_generation: 0,id: Uuid::now_v7(),source_id: gmail_draft,source_link_id: gmail_source,@@ -292,6 +295,7 @@ async fn paused_outlook_writes_still_finish_gmail_moves_and_keep_outlook_originalet outlook_move = prepare(&repo,&DraftTransferRequest {+ draft_generation: 0,id: Uuid::now_v7(),source_id: outlook_draft,source_link_id: outlook,@@ -414,6 +418,7 @@ async fn recovery_before_a_delayed_request_prevents_it_from_committing(db: PgPoo.is_err());let retry = DraftTransferRequest {+ draft_generation: 0,id: Uuid::now_v7(),..request};@@ -556,6 +561,7 @@ async fn returning_a_reply_to_its_original_inbox_never_rebinds_the_old_draft(db:.await.unwrap();let back = DraftTransferRequest {+ draft_generation: 0,id: Uuid::now_v7(),source_id: moved.message_id,source_link_id: request.destination_link_id,diff --git a/crates/email/src/outbound/email_pg_repo/label.rs b/crates/email/src/outbound/email_pg_repo/label.rsindex 34560e852e..ec3ae6b934 100644--- a/crates/email/src/outbound/email_pg_repo/label.rs+++ b/crates/email/src/outbound/email_pg_repo/label.rs@@ -397,17 +397,34 @@ pub(crate) async fn delete_scheduled_messages_batch(return Ok(Vec::new());}+ let mut tx = pool.begin().await?;+ // The caller's draft list may predate a concurrent send admission.+ let drafts = sqlx::query_scalar!(+ r#"+ SELECT id FROM email_messages+ WHERE id = ANY($1) AND link_id = $2 AND is_draft AND NOT is_sent+ ORDER BY id FOR UPDATE+ "#,+ message_ids,+ link_id+ )+ .fetch_all(&mut *tx)+ .await?;let deleted = sqlx::query_scalar!(r#"DELETE FROM email_scheduled_messagesWHERE message_id = ANY($1) AND link_id = $2 AND sent = false+ AND (delivery_status = 'failed' OR+ (delivery_started_at IS NULL AND delivery_status <> 'unconfirmed'+ AND (NOT processing OR delivery_claim_id IS NOT NULL)))RETURNING message_id"#,- message_ids,+ &drafts,link_id)- .fetch_all(pool)+ .fetch_all(&mut *tx).await?;-+ super::send_attempt::cancel_revoked_attempts(&mut tx, &deleted, link_id).await?;+ tx.commit().await?;Ok(deleted)}diff --git a/crates/email/src/outbound/email_pg_repo/message.rs b/crates/email/src/outbound/email_pg_repo/message.rsindex 28ea400ccc..1245be10dc 100644--- a/crates/email/src/outbound/email_pg_repo/message.rs+++ b/crates/email/src/outbound/email_pg_repo/message.rs@@ -262,10 +262,10 @@ pub(super) async fn forwarded_attachments_by_message_ids(}#[tracing::instrument(err, skip(pool, message_ids))]-pub(super) async fn scheduled_send_times_by_message_ids(+pub(super) async fn scheduled_sends_by_message_ids(pool: &PgPool,message_ids: &[Uuid],-) -> Result<HashMap<Uuid, DateTime<Utc>>, sqlx::Error> {+) -> Result<HashMap<Uuid, crate::domain::models::ScheduledSend>, sqlx::Error> {if message_ids.is_empty() {return Ok(HashMap::new());}@@ -273,12 +273,17 @@ pub(super) async fn scheduled_send_times_by_message_ids(struct DbScheduledRow {message_id: Uuid,send_time: DateTime<Utc>,+ delivery_status: String,+ processing: bool,+ delivery_claim_id: Option<Uuid>,+ delivery_started_at: Option<DateTime<Utc>>,}let rows = sqlx::query_as!(DbScheduledRow,r#"- SELECT message_id, send_time+ SELECT message_id, send_time, delivery_status, processing,+ delivery_claim_id, delivery_started_atFROM email_scheduled_messagesWHERE message_id = ANY($1) AND sent = false"#,@@ -289,7 +294,26 @@ pub(super) async fn scheduled_send_times_by_message_ids(Ok(rows.into_iter()- .map(|r| (r.message_id, r.send_time))+ .map(|row| {+ use crate::domain::models::{ScheduledSend, ScheduledSendStatus};+ let status = match row.delivery_status.as_str() {+ "failed" => ScheduledSendStatus::Failed,+ "unconfirmed" => ScheduledSendStatus::Unconfirmed,+ _ if row.delivery_started_at.is_some()+ || (row.processing && row.delivery_claim_id.is_none()) =>+ {+ ScheduledSendStatus::Sending+ }+ _ => ScheduledSendStatus::Pending,+ };+ (+ row.message_id,+ ScheduledSend {+ send_time: row.send_time,+ status,+ },+ )+ }).collect())}@@ -383,6 +407,8 @@ pub(crate) async fn delete_draft_message(thread_db_id: Uuid,link_ids: &[Uuid],actor: Option<&str>,++ expected_generation: i32,) -> Result<Option<DraftDeletion>, sqlx::Error> {let mut tx = pool.begin().await?;@@ -395,13 +421,19 @@ pub(crate) async fn delete_draft_message(// Sender migration must not delete a draft whose delivery was committed// after the service's initial validation. Match the shared lock order.- sqlx::query!(- "SELECT id FROM email_messages WHERE id = $1 FOR UPDATE",+ let locked = sqlx::query!(+ r#"SELECT id, draft_generation, EXISTS(SELECT 1 FROM email_send_attempts WHERE message_id=$1 AND NOT cancelled AND NOT sent) AS "send_active!" FROM email_messages WHERE id = $1 FOR UPDATE"#,message_id).fetch_optional(&mut *tx).await?;+ if locked.is_none_or(|message| {+ message.draft_generation != expected_generation || message.send_active+ }) {+ return Ok(None);+ }+let retired=sqlx::query_scalar!(r#"SELECT EXISTS(SELECT 1 FROM email_draft_transfers WHERE source_id=$1 AND state<>'preparing') AS "retired!""#,message_id).fetch_one(&mut *tx).await?;if retired {return Ok(None);@@ -619,6 +651,26 @@ pub(super) async fn insert_draft_attachment(link_id: Uuid,attachment: &AttachmentDraft,) -> Result<(), sqlx::Error> {+ // Match send admission's lock order, then read scheduling in a fresh statement.+ let mut tx = pool.begin().await?;+ let state = sqlx::query!(+ "SELECT is_draft, is_sent FROM email_messages WHERE id = $1 AND link_id = $2 FOR UPDATE",+ attachment.draft_id,+ link_id+ )+ .fetch_optional(&mut *tx)+ .await?;+ if state.is_none_or(|state| !state.is_draft || state.is_sent) {+ return Err(sqlx::Error::RowNotFound);+ }+ let scheduled = sqlx::query_scalar!(+ r#"SELECT EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2) AS "scheduled!""#,+ attachment.draft_id,+ link_id+ ).fetch_one(&mut *tx).await?;+ if scheduled {+ return Err(sqlx::Error::RowNotFound);+ }let result = sqlx::query!(r#"INSERT INTO email_attachments_drafts (@@ -637,10 +689,11 @@ pub(super) async fn insert_draft_attachment(attachment.s3_key,link_id,)- .execute(pool)+ .execute(&mut *tx).await?;if result.rows_affected() == 0 {return Err(sqlx::Error::RowNotFound);}+ tx.commit().await?;Ok(())}diff --git a/crates/email/src/outbound/email_pg_repo/scheduled.rs b/crates/email/src/outbound/email_pg_repo/scheduled.rsindex f62ed2c660..bc48db243e 100644--- a/crates/email/src/outbound/email_pg_repo/scheduled.rs+++ b/crates/email/src/outbound/email_pg_repo/scheduled.rs@@ -14,8 +14,19 @@ impl EmailSchedulingRepo for EmailPgRepo {actor: &MacroUserIdStr<'_>,change: ScheduleChange,signature: Option<&SignaturePreparation>,++ expected_generation: i32,) -> Result<Option<Uuid>, EmailErr> {- change_schedule(&self.pool, link_id, message_id, actor, change, signature).await+ change_schedule(+ &self.pool,+ link_id,+ message_id,+ actor,+ change,+ signature,+ expected_generation,+ )+ .await}}@@ -26,6 +37,8 @@ async fn change_schedule(actor: &MacroUserIdStr<'_>,change: ScheduleChange,signature: Option<&SignaturePreparation>,++ expected_generation: i32,) -> Result<Option<Uuid>, EmailErr> {let mut tx = pool.begin().await.map_err(anyhow::Error::from)?;let outlook = sqlx::query!(r#"@@ -37,18 +50,27 @@ async fn change_schedule(}// Every mutator locks message before schedule; no locks cross provider work.let message = sqlx::query!(- "SELECT thread_id, is_draft, is_sent, replying_to_id, body_html_sanitized, body_text FROM email_messages WHERE id = $1 AND link_id = $2 FOR UPDATE",+ "SELECT thread_id, draft_generation, is_draft, is_sent, replying_to_id, body_html_sanitized, body_text FROM email_messages WHERE id = $1 AND link_id = $2 FOR UPDATE",message_id, link_id,).fetch_optional(&mut *tx).await.map_err(anyhow::Error::from)?.ok_or(EmailErr::MessageNotFound(message_id))?;let schedule = sqlx::query!(- "SELECT sent, processing FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2 FOR UPDATE",+ "SELECT sent, processing, delivery_status, delivery_started_at, delivery_claim_id FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2 FOR UPDATE",message_id, link_id,).fetch_optional(&mut *tx).await.map_err(anyhow::Error::from)?;+ let protected = sqlx::query_scalar!(r#"SELECT EXISTS(SELECT 1 FROM email_send_attempts WHERE message_id=$1 AND link_id=$2 AND NOT cancelled AND NOT sent) AS "protected!""#, message_id, link_id).fetch_one(&mut *tx).await.map_err(anyhow::Error::from)?;if message.is_sent- || schedule- .as_ref()- .is_some_and(|row| row.sent || row.processing)+ || protected+ || message.draft_generation != expected_generation+ || schedule.as_ref().is_some_and(|row| {+ row.sent+ || (row.delivery_status != "failed"+ && ((row.processing+ && (row.delivery_claim_id.is_none()+ || matches!(change, ScheduleChange::Set(_))))+ || row.delivery_started_at.is_some()+ || row.delivery_status == "unconfirmed"))+ }){return Err(EmailErr::MessageDeliveryConflict(message_id));}@@ -94,13 +116,23 @@ async fn change_schedule(Err(EmailErr::MessageDeliveryConflict(message_id))};}+ // The schedule lock serializes this revocation with begin_submission.+ // A preparing worker's token no longer authorizes provider I/O once+ // the row is deleted, including during retry backoff or lease expiry.let deleted = sqlx::query!(- "DELETE FROM email_scheduled_messages WHERE link_id = $1 AND message_id = $2 AND NOT sent AND NOT processing",- link_id, message_id,- ).execute(&mut *tx).await.map_err(anyhow::Error::from)?;+ "DELETE FROM email_scheduled_messages WHERE link_id = $1 AND message_id = $2",+ link_id,+ message_id,+ )+ .execute(&mut *tx)+ .await+ .map_err(anyhow::Error::from)?;if deleted.rows_affected() != 1 {return Err(EmailErr::MessageDeliveryConflict(message_id));}+ super::send_attempt::cancel_revoked_attempts(&mut tx, &[message_id], link_id)+ .await+ .map_err(anyhow::Error::from)?;sqlx::query!("UPDATE email_messages SET is_draft = true, updated_at = NOW() WHERE id = $1 AND link_id = $2 AND NOT is_sent",message_id, link_id,diff --git a/crates/email/src/outbound/email_pg_repo/send_attempt.rs b/crates/email/src/outbound/email_pg_repo/send_attempt.rsnew file mode 100644index 0000000000..8c82ea5cfb--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/send_attempt.rs@@ -0,0 +1,441 @@+//! Atomic send admission and cancellation. Lock order is attempt, draft handle,+//! message, schedule; provider work never holds these locks.+use super::{EmailPgRepo, draft, thread};+use crate::domain::{models::EmailErr, send_attempt::*};+use macro_user_id::user_id::MacroUserIdStr;+use sqlx::PgConnection;+use uuid::Uuid;++mod inbox_move;++async fn lock_attempt(+ tx: &mut PgConnection,+ actor: &MacroUserIdStr<'_>,+ link: Uuid,+ attempt: SendAttemptId,+) -> Result<(), EmailErr> {+ sqlx::query!(+ "SELECT pg_advisory_xact_lock(hashtextextended($1, 0))",+ format!("email_send:{actor}:{link}:{}", attempt.0)+ )+ .execute(tx)+ .await+ .map_err(anyhow::Error::from)?;+ Ok(())+}++/// Caller holds message/schedule locks and has revoked the previous delivery.+pub(super) async fn cancel_revoked_attempts(+ tx: &mut PgConnection,+ message_ids: &[Uuid],+ link: Uuid,+) -> Result<(), sqlx::Error> {+ sqlx::query!(+ r#"UPDATE email_send_attempts SET cancelled = true+ WHERE message_id = ANY($1) AND link_id = $2+ AND NOT cancelled AND NOT sent AND NOT delivery_unconfirmed"#,+ message_ids,+ link,+ )+ .execute(tx)+ .await?;+ Ok(())+}++struct AttemptRow {+ request: Option<serde_json::Value>,+ created_at: chrono::DateTime<chrono::Utc>,+ link_id: Uuid,+ attempt_id: Uuid,+ message_id: Option<Uuid>,+ thread_id: Option<Uuid>,+ send_time: Option<chrono::DateTime<chrono::Utc>>,+ cancelled: bool,+ sent: bool,+ processing: bool,+ delivery_status: Option<String>,+ delivery_started_at: Option<chrono::DateTime<chrono::Utc>>,+ delivery_claim_id: Option<Uuid>,+ delivery_unconfirmed: bool,+ mailbox_state: Option<String>,+ error_code: Option<String>,+ mailbox_stage: Option<String>,+}++fn attempt_from_row(row: AttemptRow) -> SendAttempt {+ SendAttempt {+ transitioned: false,+ message: None,+ attempt_id: SendAttemptId(row.attempt_id),+ status: if row.cancelled {+ SendAttemptStatus::Cancelled+ } else if row.sent {+ SendAttemptStatus::Sent+ } else if row.delivery_unconfirmed+ || row.error_code.as_deref() == Some("send_unknown")+ || row.mailbox_stage.as_deref() == Some("confirming")+ || row.delivery_status.as_deref() == Some("unconfirmed")+ || (row.delivery_started_at.is_some() && !row.processing)+ {+ SendAttemptStatus::DeliveryUnconfirmed+ } else if row.delivery_status.as_deref() == Some("failed")+ || matches!(+ row.mailbox_state.as_deref(),+ Some("failed" | "conflict" | "cancelled")+ )+ {+ SendAttemptStatus::Failed+ } else if row.processing+ && (row.delivery_claim_id.is_none() || row.delivery_started_at.is_some())+ {+ SendAttemptStatus::Sending+ } else {+ SendAttemptStatus::Accepted+ },+ message_id: row.message_id,+ thread_id: row.thread_id,+ send_time: row.send_time,+ }+}++async fn read_attempt(+ tx: &mut PgConnection,+ actor: &MacroUserIdStr<'_>,+ link: Uuid,+ attempt: SendAttemptId,+ snapshot: Option<&SendSnapshot>,+) -> Result<Option<SendAttempt>, EmailErr> {+ let row = sqlx::query_as!(AttemptRow, r#"SELECT a.request, a.created_at, a.link_id, a.attempt_id, a.message_id, a.thread_id, a.send_time, a.cancelled,+ (a.sent OR COALESCE(m.is_sent, false)) AS "sent!",+ COALESCE(s.processing, false) AS "processing!",+ s.delivery_status AS "delivery_status?", s.delivery_started_at,+ s.delivery_claim_id,+ a.delivery_unconfirmed, d.state AS "mailbox_state?",+ d.error_code, d.checkpoint->>'stage' AS mailbox_stage+ FROM email_send_attempts a+ LEFT JOIN email_messages m ON m.id = a.message_id AND m.link_id = a.link_id+ LEFT JOIN email_scheduled_messages s ON s.message_id = a.message_id AND s.link_id = a.link_id+ LEFT JOIN email_mailbox_drafts d ON d.message_id = a.message_id AND d.link_id = a.link_id+ WHERE a.user_id = $1 AND a.link_id = $2 AND a.attempt_id = $3"#,+ actor.as_ref(), link, attempt.0,+ ).fetch_optional(tx).await.map_err(anyhow::Error::from)?;+ let Some(row) = row else {+ return Ok(None);+ };+ if let (Some(request), Some(snapshot)) = (row.request.as_ref(), snapshot)+ && !snapshot+ .matches_approved_request(request)+ .map_err(anyhow::Error::from)?+ {+ return Err(EmailErr::SendAttemptConflict);+ }+ Ok(Some(attempt_from_row(row)))+}++impl EmailSendRepo for EmailPgRepo {+ async fn pending_send_attempts(+ &self,+ actor: &MacroUserIdStr<'_>,+ link_ids: &[Uuid],+ after: Option<&SendAttemptCursor>,+ ) -> Result<Vec<(SendAttemptCursor, SendAttempt)>, EmailErr> {+ let rows = sqlx::query_as!(AttemptRow, r#"SELECT a.request, a.created_at, a.link_id, a.attempt_id, a.message_id, a.thread_id, a.send_time, a.cancelled,+ (a.sent OR COALESCE(m.is_sent, false)) AS "sent!",+ COALESCE(s.processing, false) AS "processing!",+ s.delivery_status AS "delivery_status?", s.delivery_started_at,+ s.delivery_claim_id,+ a.delivery_unconfirmed, d.state AS "mailbox_state?",+ d.error_code, d.checkpoint->>'stage' AS mailbox_stage+ FROM email_send_attempts a+ LEFT JOIN email_messages m ON m.id = a.message_id AND m.link_id = a.link_id+ LEFT JOIN email_scheduled_messages s ON s.message_id = a.message_id AND s.link_id = a.link_id+ LEFT JOIN email_mailbox_drafts d ON d.message_id = a.message_id AND d.link_id = a.link_id+ WHERE a.user_id = $1 AND a.link_id = ANY($2) AND NOT a.cancelled AND NOT a.sent+ AND ($3::timestamptz IS NULL OR (a.created_at, a.link_id, a.attempt_id) < ($3, $4, $5))+ ORDER BY a.created_at DESC, a.link_id DESC, a.attempt_id DESC LIMIT 51"#,+ actor.as_ref(), link_ids, after.map(|cursor| cursor.created_at),+ after.map(|cursor| cursor.link_id), after.map(|cursor| cursor.attempt_id),+ ).fetch_all(&self.pool).await.map_err(anyhow::Error::from)?;+ Ok(rows+ .into_iter()+ .map(|row| {+ (+ SendAttemptCursor {+ created_at: row.created_at,+ link_id: row.link_id,+ attempt_id: row.attempt_id,+ },+ attempt_from_row(row),+ )+ })+ .collect())+ }++ async fn send_message_rows(+ &self,+ message_ids: &[Uuid],+ link_ids: &[Uuid],+ ) -> Result<Vec<crate::domain::models::MessageRow>, EmailErr> {+ let rows = sqlx::query_as!(super::db_types::DbMessageRow,+ r#"SELECT draft_generation, id, provider_id, thread_id, provider_thread_id, replying_to_id,+ global_id, link_id, provider_history_id, internal_date_ts, snippet,+ size_estimate, subject, sent_at, has_attachments, is_read, is_starred,+ is_sent, is_draft, body_text, body_html_sanitized, body_macro,+ headers_jsonb, created_at, updated_at+ FROM email_messages WHERE (id, link_id) IN (SELECT * FROM unnest($1::uuid[], $2::uuid[]))"#,+ message_ids, link_ids,+ ).fetch_all(&self.pool).await.map_err(anyhow::Error::from)?;+ Ok(rows.into_iter().map(Into::into).collect())+ }+ async fn send_message_row(+ &self,+ link_id: Uuid,+ message_id: Uuid,+ ) -> Result<Option<crate::domain::models::MessageRow>, EmailErr> {+ let row = sqlx::query_as!(+ super::db_types::DbMessageRow,+ r#"SELECT draft_generation, id, provider_id, thread_id, provider_thread_id, replying_to_id,+ global_id, link_id, provider_history_id, internal_date_ts, snippet,+ size_estimate, subject, sent_at, has_attachments, is_read, is_starred,+ is_sent, is_draft, body_text, body_html_sanitized, body_macro,+ headers_jsonb, created_at, updated_at+ FROM email_messages WHERE id = $1 AND link_id = $2"#,+ message_id,+ link_id,+ )+ .fetch_optional(&self.pool)+ .await+ .map_err(anyhow::Error::from)?;+ Ok(row.map(Into::into))+ }+ async fn read_send_attempt(+ &self,+ actor: &MacroUserIdStr<'_>,+ link: Uuid,+ attempt: SendAttemptId,+ snapshot: Option<&SendSnapshot>,+ ) -> Result<Option<SendAttempt>, EmailErr> {+ let mut connection = self.pool.acquire().await.map_err(anyhow::Error::from)?;+ read_attempt(&mut connection, actor, link, attempt, snapshot).await+ }++ async fn admit_send(+ &self,+ actor: &MacroUserIdStr<'_>,+ link: Uuid,+ attempt: SendAttemptId,+ mut prepared: PreparedSend,+ ) -> Result<SendAttempt, EmailErr> {+ let mut tx = self.pool.begin().await.map_err(anyhow::Error::from)?;+ lock_attempt(&mut tx, actor, link, attempt).await?;+ if let Some(existing) =+ read_attempt(&mut tx, actor, link, attempt, Some(&prepared.snapshot)).await?+ {+ return Ok(existing);+ }+ if let Some(source) = prepared.source_inbox {+ inbox_move::move_for_admission(+ &mut tx,+ &prepared.message,+ link,+ source,+ &mut prepared.new_thread,+ )+ .await?;+ }+ let ids = draft::insert_message_in_transaction(+ &mut tx,+ &prepared.message,+ &prepared.contacts,+ link,+ prepared.new_thread,+ false,+ )+ .await?+ .ok_or(EmailErr::MessageDeliveryConflict(prepared.message.db_id))?;+ sqlx::query!(+ "UPDATE email_messages SET draft_generation = draft_generation + 1 WHERE id = $1 AND link_id = $2",+ ids.message_db_id, link,+ ).execute(&mut *tx).await.map_err(anyhow::Error::from)?;+ // Successful insertion proves the prior delivery was revoked. Retire+ // orphaned attempts atomically so their delayed cancellations stay inert.+ cancel_revoked_attempts(&mut tx, &[ids.message_db_id], link)+ .await+ .map_err(anyhow::Error::from)?;+ // The message lock serializes edits. Verify the approved attachment set+ // inside admission, never silently send missing or newly added files.+ let uploaded = sqlx::query_scalar!(+ "SELECT id FROM email_attachments_drafts WHERE draft_id = $1 ORDER BY id",+ ids.message_db_id+ )+ .fetch_all(&mut *tx)+ .await+ .map_err(anyhow::Error::from)?;+ let forwarded = sqlx::query_scalar!("SELECT attachment_id AS \"attachment_id!\" FROM email_draft_provider_attachment_ids($1, $2) ORDER BY attachment_id", ids.message_db_id, link)+ .fetch_all(&mut *tx).await.map_err(anyhow::Error::from)?;+ let mut expected_uploaded = prepared.snapshot.attachment_ids.clone();+ let mut expected_forwarded = prepared.snapshot.forwarded_attachment_ids.clone();+ expected_uploaded.sort_unstable();+ expected_forwarded.sort_unstable();+ if uploaded != expected_uploaded || forwarded != expected_forwarded {+ return Err(EmailErr::InvalidSendSnapshot(+ "attachments changed; review the draft".into(),+ ));+ }+ let send_time = prepared.snapshot.message.send_time.unwrap_or_else(|| {+ chrono::Utc::now() + chrono::Duration::seconds(prepared.undo_delay_secs.into())+ });+ sqlx::query!("UPDATE email_scheduled_messages SET send_time = $1 WHERE message_id = $2 AND link_id = $3", send_time, ids.message_db_id, link)+ .execute(&mut *tx).await.map_err(anyhow::Error::from)?;+ let sender = sqlx::query!(+ r#"SELECT COALESCE(c.email_address, l.email_address) AS "email_address!", COALESCE(m.from_name, c.name) AS name, c.sfs_photo_url+ FROM email_messages m JOIN email_links l ON l.id = m.link_id+ LEFT JOIN email_contacts c ON c.id = m.from_contact_id+ WHERE m.id = $1 AND m.link_id = $2"#,+ ids.message_db_id,+ link,+ )+ .fetch_one(&mut *tx)+ .await+ .map_err(anyhow::Error::from)?;+ let mut content_message = prepared.message;+ content_message.db_id = ids.message_db_id;+ content_message.thread_db_id = ids.thread_db_id;+ content_message.send_time = Some(send_time);+ let prepared_content = serde_json::to_value(PreparedSendContent {+ message: content_message,+ sender: crate::domain::models::ContactInfo {+ email: sender.email_address,+ name: sender.name,+ photo_url: sender.sfs_photo_url,+ },+ })+ .map_err(anyhow::Error::from)?;+ let request = prepared+ .snapshot+ .persisted_request()+ .map_err(anyhow::Error::from)?;+ sqlx::query!(+ r#"INSERT INTO email_send_attempts (user_id, link_id, attempt_id, request, message_id, thread_id, send_time, restore_body_html, restore_body_text, restore_body_macro, prepared_content, draft_handles, draft_link_ids)+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11,+ ARRAY(SELECT client_id FROM email_draft_client_ids WHERE message_id=$5+ UNION SELECT $5 UNION SELECT $12::uuid WHERE $12 IS NOT NULL),+ ARRAY(SELECT link_id FROM email_draft_client_ids WHERE message_id=$5+ UNION SELECT $2 UNION SELECT $13::uuid WHERE $13 IS NOT NULL))"#,+ actor.as_ref(), link, attempt.0, request, ids.message_db_id, ids.thread_db_id, send_time,+ prepared.restore_html, prepared.restore_text, prepared.restore_macro,+ prepared_content,+ prepared.snapshot.message.db_id, prepared.source_inbox.map(|source| source.link_id),+ ).execute(&mut *tx).await.map_err(anyhow::Error::from)?;+ tx.commit().await.map_err(anyhow::Error::from)?;+ Ok(SendAttempt {+ transitioned: true,+ message: None,+ attempt_id: attempt,+ status: SendAttemptStatus::Accepted,+ message_id: Some(ids.message_db_id),+ thread_id: Some(ids.thread_db_id),+ send_time: Some(send_time),+ })+ }++ async fn cancel_send(+ &self,+ actor: &MacroUserIdStr<'_>,+ link: Uuid,+ attempt: SendAttemptId,+ ) -> Result<SendAttempt, EmailErr> {+ let mut tx = self.pool.begin().await.map_err(anyhow::Error::from)?;+ lock_attempt(&mut tx, actor, link, attempt).await?;+ let existing = read_attempt(&mut tx, actor, link, attempt, None).await?;+ if let Some(existing) = &existing {+ if matches!(+ existing.status,+ SendAttemptStatus::Cancelled+ | SendAttemptStatus::Sent+ | SendAttemptStatus::DeliveryUnconfirmed+ ) {+ return Ok(existing.clone());+ }+ if let Some(message_id) = existing.message_id {+ // Outlook workers lock mailbox, message, then schedule. Match+ // that order while revoking their pending draft revision.+ sqlx::query!(+ "SELECT id FROM email_links WHERE id = $1 AND provider = 'OUTLOOK' FOR UPDATE",+ link,+ )+ .fetch_optional(&mut *tx)+ .await+ .map_err(anyhow::Error::from)?;+ let message = sqlx::query!(+ "SELECT is_sent FROM email_messages WHERE id = $1 AND link_id = $2 FOR UPDATE",+ message_id,+ link+ )+ .fetch_optional(&mut *tx)+ .await+ .map_err(anyhow::Error::from)?;+ let schedule = sqlx::query!("SELECT sent, processing, delivery_status, delivery_started_at, delivery_claim_id FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2 FOR UPDATE", message_id, link)+ .fetch_optional(&mut *tx).await.map_err(anyhow::Error::from)?;+ // Delivery and deletion can commit while we wait for the message+ // lock. Its absence does not mean the send was never delivered.+ let current = read_attempt(&mut tx, actor, link, attempt, None)+ .await?+ .ok_or(EmailErr::MessageNotFound(message_id))?;+ if matches!(+ current.status,+ SendAttemptStatus::Cancelled+ | SendAttemptStatus::Sent+ | SendAttemptStatus::DeliveryUnconfirmed+ ) || message.is_some_and(|m| m.is_sent)+ || schedule.as_ref().is_some_and(|s| {+ s.sent+ || (s.delivery_status != "failed"+ && ((s.processing && s.delivery_claim_id.is_none())+ || s.delivery_started_at.is_some()+ || s.delivery_status == "unconfirmed"))+ })+ {+ return Ok(current);+ }+ // Holding the schedule lock serializes cancellation with the+ // managed worker's submission boundary. Deletion revokes its+ // claim before any provider submission can begin.+ sqlx::query!(+ "DELETE FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2",+ message_id,+ link+ )+ .execute(&mut *tx)+ .await+ .map_err(anyhow::Error::from)?;+ sqlx::query!(+ r#"UPDATE email_messages m SET is_draft = true, draft_generation = m.draft_generation + 1, body_html_sanitized = a.restore_body_html,+ body_text = a.restore_body_text, body_macro = a.restore_body_macro, updated_at = NOW()+ FROM email_send_attempts a WHERE a.user_id = $1 AND a.link_id = $2 AND a.attempt_id = $3+ AND m.id = a.message_id AND m.link_id = a.link_id AND NOT m.is_sent"#,+ actor.as_ref(), link, attempt.0,+ ).execute(&mut *tx).await.map_err(anyhow::Error::from)?;+ draft::snapshot_outlook_draft(&mut tx, message_id, link, actor.as_ref())+ .await+ .map_err(anyhow::Error::from)?;+ if let Some(thread_id) = existing.thread_id {+ thread::update_thread_metadata(&mut tx, thread_id, link)+ .await+ .map_err(anyhow::Error::from)?;+ }+ }+ }+ sqlx::query!(+ r#"INSERT INTO email_send_attempts (user_id, link_id, attempt_id, cancelled) VALUES ($1, $2, $3, true)+ ON CONFLICT (user_id, link_id, attempt_id) DO UPDATE SET cancelled = true"#,+ actor.as_ref(), link, attempt.0,+ ).execute(&mut *tx).await.map_err(anyhow::Error::from)?;+ let mut result = read_attempt(&mut tx, actor, link, attempt, None)+ .await?+ .expect("attempt was inserted in this transaction");+ result.transitioned = true;+ tx.commit().await.map_err(anyhow::Error::from)?;+ Ok(result)+ }+}diff --git a/crates/email/src/outbound/email_pg_repo/send_attempt/inbox_move.rs b/crates/email/src/outbound/email_pg_repo/send_attempt/inbox_move.rsnew file mode 100644index 0000000000..9cb7c9be6d--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/send_attempt/inbox_move.rs@@ -0,0 +1,99 @@+//! Move an authorized editable draft without deleting its attachment rows.++use super::super::{client_id_mapping, thread};+use crate::domain::{+ models::{EmailErr, ResolvedDraftInput, ThreadRow},+ send_attempt::SendSourceInbox,+};+use uuid::Uuid;++/// Match admission's handle/message lock order and revalidate the source facts.+/// Every change rolls back if subsequent attachment validation rejects the send.+pub(super) async fn move_for_admission(+ tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,+ message: &ResolvedDraftInput,+ destination: Uuid,+ source: SendSourceInbox,+ new_thread: &mut Option<ThreadRow>,+) -> Result<(), EmailErr> {+ if let Some(handle) = message.draft_client_id {+ client_id_mapping::lock_draft_client_id(&mut *tx, handle, destination)+ .await+ .map_err(anyhow::Error::from)?;+ if let Some(bound) = client_id_mapping::bound_draft_row(&mut *tx, handle, destination)+ .await+ .map_err(anyhow::Error::from)?+ && bound.message_db_id != message.db_id+ {+ return Err(EmailErr::MessageDeliveryConflict(message.db_id));+ }+ }+ let current = sqlx::query!(+ "SELECT link_id, thread_id, is_draft, is_sent FROM email_messages WHERE id = $1 FOR UPDATE",+ message.db_id,+ )+ .fetch_optional(&mut **tx)+ .await+ .map_err(anyhow::Error::from)?+ .ok_or(EmailErr::MessageNotFound(message.db_id))?;+ if current.link_id != source.link_id+ || current.thread_id != source.thread_id+ || !current.is_draft+ || current.is_sent+ {+ return Err(EmailErr::MessageDeliveryConflict(message.db_id));+ }+ let scheduled = sqlx::query_scalar!(+ r#"SELECT EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id = $1) AS "exists!""#,+ message.db_id,+ )+ .fetch_one(&mut **tx)+ .await+ .map_err(anyhow::Error::from)?;+ if scheduled {+ return Err(EmailErr::MessageDeliveryConflict(message.db_id));+ }+ if let Some(created) = new_thread.take() {+ thread::insert_thread(&mut *tx, &created, destination)+ .await+ .map_err(anyhow::Error::from)?;+ }+ sqlx::query!(+ r#"UPDATE email_messages SET link_id = $1, thread_id = $2,+ provider_id = NULL, provider_thread_id = NULL, provider_history_id = NULL,+ global_id = NULL, updated_at = NOW() WHERE id = $3"#,+ destination,+ message.thread_db_id,+ message.db_id,+ )+ .execute(&mut **tx)+ .await+ .map_err(anyhow::Error::from)?;+ // Provider labels belong to the source account. Attachments belong to the+ // message and remain intact; admission checks their approved identities.+ sqlx::query!(+ "DELETE FROM email_message_labels WHERE message_id = $1",+ message.db_id,+ )+ .execute(&mut **tx)+ .await+ .map_err(anyhow::Error::from)?;+ let remaining = sqlx::query_scalar!(+ r#"SELECT EXISTS(SELECT 1 FROM email_messages WHERE thread_id = $1) AS "exists!""#,+ source.thread_id,+ )+ .fetch_one(&mut **tx)+ .await+ .map_err(anyhow::Error::from)?;+ if remaining {+ thread::update_thread_metadata(&mut *tx, source.thread_id, source.link_id)+ .await+ .map_err(anyhow::Error::from)?;+ } else {+ sqlx::query!("DELETE FROM email_threads WHERE id = $1", source.thread_id)+ .execute(&mut **tx)+ .await+ .map_err(anyhow::Error::from)?;+ }+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test.rs b/crates/email/src/outbound/email_pg_repo/test.rsindex 9e97c52e26..3085f51beb 100644--- a/crates/email/src/outbound/email_pg_repo/test.rs+++ b/crates/email/src/outbound/email_pg_repo/test.rs@@ -11,6 +11,8 @@ mod project;mod project_scope_dynamic_query;mod reminder_collection;mod scheduled;+mod scheduled_trash;+mod send_attempt;mod sender_names;mod senders;mod sending_inbox;@@ -19,6 +21,7 @@ mod signal_flag;mod thread;mod thread_archive;mod thread_labels;+mod thread_redirect;mod thread_unread;use std::sync::Arc;diff --git a/crates/email/src/outbound/email_pg_repo/test/draft.rs b/crates/email/src/outbound/email_pg_repo/test/draft.rsindex 6d014e7dae..bb0cd7ba8e 100644--- a/crates/email/src/outbound/email_pg_repo/test/draft.rs+++ b/crates/email/src/outbound/email_pg_repo/test/draft.rs@@ -182,7 +182,7 @@ async fn test_delete_draft_message_keeps_nonempty_thread(let link_id = Uuid::parse_str("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa")?;let deletion = repo- .delete_draft_message(draft_id, thread_id, &[link_id], None)+ .delete_draft_message(draft_id, thread_id, &[link_id], None, 0).await?.expect("the draft should be deleted");assert!(@@ -218,7 +218,7 @@ async fn test_delete_draft_message_removes_empty_thread(let link_id = Uuid::parse_str("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa")?;let deletion = repo- .delete_draft_message(draft_id, thread_id, &[link_id], None)+ .delete_draft_message(draft_id, thread_id, &[link_id], None, 0).await?.expect("the draft should be deleted");assert!(@@ -249,7 +249,7 @@ async fn test_delete_draft_message_rejects_sent_message(let link_id = Uuid::parse_str("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa")?;assert!(- repo.delete_draft_message(sent_id, thread_id, &[link_id], None)+ repo.delete_draft_message(sent_id, thread_id, &[link_id], None, 0).await?.is_none(),"deleting a non-draft should match nothing and leave it intact"@@ -286,7 +286,7 @@ async fn test_delete_draft_message_rejects_foreign_link_scope(let foreign_link = Uuid::parse_str("bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb")?;assert!(- repo.delete_draft_message(draft_id, thread_id, &[foreign_link], None)+ repo.delete_draft_message(draft_id, thread_id, &[foreign_link], None, 0).await?.is_none(),"a delete outside the caller's inboxes must match nothing"@@ -542,6 +542,7 @@ async fn test_insert_draft_message_into_existing_thread(let to_contact_id = Uuid::parse_str("c0000002-0000-0000-0000-000000000002")?;let input = ResolvedDraftInput {+ draft_generation: 0,db_id: message_db_id,provider_id: None,replying_to_id: None,@@ -633,6 +634,7 @@ async fn test_insert_draft_message_with_new_thread(pool: Pool<Postgres>) -> anyhlet from_contact_id = Uuid::parse_str("c0000001-0000-0000-0000-000000000001")?;let input = ResolvedDraftInput {+ draft_generation: 0,db_id: message_db_id,provider_id: None,replying_to_id: None,@@ -709,6 +711,7 @@ async fn test_autosave_ignores_send_time_but_immediate_send_preserves_undo_schedchrono::DateTime::parse_from_rfc3339("2025-06-01T12:00:00Z")?.with_timezone(&Utc);let input = ResolvedDraftInput {+ draft_generation: 0,db_id: message_db_id,provider_id: None,replying_to_id: None,@@ -797,6 +800,7 @@ async fn test_insert_draft_message_upsert_existing(pool: Pool<Postgres>) -> anyhtokio::time::sleep(Duration::from_millis(10)).await;let input = ResolvedDraftInput {+ draft_generation: 0,db_id: message_db_id,provider_id: None,replying_to_id: Some(Uuid::parse_str("ee000001-0000-0000-0000-000000000001")?),@@ -875,6 +879,7 @@ async fn test_insert_draft_message_updates_thread_metadata(// Insert a macro draft (no provider_id, is_draft=true) into the threadlet input = ResolvedDraftInput {+ draft_generation: 0,db_id: message_db_id,provider_id: None,replying_to_id: None,@@ -930,6 +935,7 @@ async fn test_insert_message_with_is_draft_false(pool: Pool<Postgres>) -> anyhowlet from_contact_id = Uuid::parse_str("c0000001-0000-0000-0000-000000000001")?;let input = ResolvedDraftInput {+ draft_generation: 0,db_id: message_db_id,provider_id: None,replying_to_id: None,@@ -1029,7 +1035,7 @@ async fn test_client_handle_bindings_resolve_scoped_and_cascade();// Deleting the draft cascades its binding away.- repo.delete_draft_message(draft_id, thread_id, &[link], None)+ repo.delete_draft_message(draft_id, thread_id, &[link], None, 0).await?.expect("the draft should be deleted");assert_eq!(@@ -1228,6 +1234,7 @@ async fn test_client_handle_replay_cannot_replace_a_scheduled_or_sent_winner(&actor,ScheduleChange::Set(Utc::now() + chrono::Duration::hours(1)),None,+ 0,).await?;@@ -1338,6 +1345,7 @@ async fn test_rebinding_a_handle_wins_the_cross_inbox_recency_tie(fn resolved_input(db_id: Uuid, thread_db_id: Uuid) -> ResolvedDraftInput {ResolvedDraftInput {+ draft_generation: 0,db_id,provider_id: None,replying_to_id: None,diff --git a/crates/email/src/outbound/email_pg_repo/test/message.rs b/crates/email/src/outbound/email_pg_repo/test/message.rsindex 29a76d9147..fcf4363954 100644--- a/crates/email/src/outbound/email_pg_repo/test/message.rs+++ b/crates/email/src/outbound/email_pg_repo/test/message.rs@@ -395,22 +395,24 @@ async fn test_forwarded_attachments_by_message_ids_empty_input(Ok(())}-// ── scheduled_send_times_by_message_ids ─────────────────────────────+// ── scheduled_sends_by_message_ids ─────────────────────────────#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS",fixtures(path = "../../../../fixtures", scripts("email_message")))]-async fn test_scheduled_send_times_by_message_ids(pool: Pool<Postgres>) -> anyhow::Result<()> {+async fn test_scheduled_sends_by_message_ids(pool: Pool<Postgres>) -> anyhow::Result<()> {let repo = EmailPgRepo::new(pool);let msg3 = Uuid::parse_str("ee000003-0000-0000-0000-000000000003")?;- let times = repo.scheduled_send_times_by_message_ids(&[msg3]).await?;+ let times = repo.scheduled_sends_by_message_ids(&[msg3]).await?;assert_eq!(times.len(), 1, "msg3 has a pending scheduled send");let send_time = times.get(&msg3).expect("msg3 should have a send time");assert_eq!(- send_time.to_rfc3339_opts(chrono::SecondsFormat::Secs, true),+ send_time+ .send_time+ .to_rfc3339_opts(chrono::SecondsFormat::Secs, true),"2025-03-01T09:00:00Z");@@ -428,7 +430,7 @@ async fn test_scheduled_send_times_excludes_already_sent(// msg2 has a scheduled send but sent=truelet msg2 = Uuid::parse_str("ee000002-0000-0000-0000-000000000002")?;- let times = repo.scheduled_send_times_by_message_ids(&[msg2]).await?;+ let times = repo.scheduled_sends_by_message_ids(&[msg2]).await?;assert!(times.is_empty(),@@ -442,12 +444,12 @@ async fn test_scheduled_send_times_excludes_already_sent(migrator = "MACRO_DB_MIGRATIONS",fixtures(path = "../../../../fixtures", scripts("email_message")))]-async fn test_scheduled_send_times_by_message_ids_empty_input(+async fn test_scheduled_sends_by_message_ids_empty_input(pool: Pool<Postgres>,) -> anyhow::Result<()> {let repo = EmailPgRepo::new(pool);- let times = repo.scheduled_send_times_by_message_ids(&[]).await?;+ let times = repo.scheduled_sends_by_message_ids(&[]).await?;assert!(times.is_empty());Ok(())@@ -455,6 +457,70 @@ async fn test_scheduled_send_times_by_message_ids_empty_input(// ── process_scheduled_message ──────────────────────────────────────+#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_message"))+)]+async fn scheduled_send_status_distinguishes_preparation_from_submission(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ use crate::domain::models::ScheduledSendStatus;++ let repo = EmailPgRepo::new(pool.clone());+ let message_id = Uuid::parse_str("ee000003-0000-0000-0000-000000000003")?;+ let claim_id = Uuid::new_v4();+ let cases = [+ ("ready", false, None, false, ScheduledSendStatus::Pending),+ (+ "ready",+ true,+ Some(claim_id),+ false,+ ScheduledSendStatus::Pending,+ ),+ (+ "ready",+ true,+ Some(claim_id),+ true,+ ScheduledSendStatus::Sending,+ ),+ ("ready", true, None, false, ScheduledSendStatus::Sending),+ (+ "failed",+ true,+ Some(claim_id),+ false,+ ScheduledSendStatus::Failed,+ ),+ (+ "unconfirmed",+ true,+ Some(claim_id),+ true,+ ScheduledSendStatus::Unconfirmed,+ ),+ ];+ for (status, processing, claim, started, expected) in cases {+ sqlx::query!(+ r#"UPDATE email_scheduled_messages+ SET delivery_status = $2, processing = $3, delivery_claim_id = $4,+ delivery_started_at = CASE WHEN $5 THEN now() ELSE NULL END+ WHERE message_id = $1"#,+ message_id,+ status,+ processing,+ claim,+ started,+ )+ .execute(&pool)+ .await?;+ let schedules = repo.scheduled_sends_by_message_ids(&[message_id]).await?;+ assert_eq!(schedules[&message_id].status, expected);+ }+ Ok(())+}+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS",fixtures(path = "../../../../fixtures", scripts("email_draft"))@@ -862,6 +928,8 @@ async fn insert_draft_attachment_records_the_attachment_on_the_inboxs_draft(let draft = Uuid::parse_str("ee000003-0000-0000-0000-000000000003")?;let id = Uuid::parse_str("dd000009-0000-0000-0000-000000000009")?;+ // This fixture starts with a scheduled draft; cancel before staging a file.+ repo.delete_scheduled_messages_batch(&[draft], link).await?;repo.insert_draft_attachment(link, &staged_attachment(draft, id)).await?;@@ -905,3 +973,35 @@ async fn insert_draft_attachment_refuses_another_inboxs_draft();Ok(())}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_message"))+)]+async fn insert_draft_attachment_refuses_non_drafts_sent_and_scheduled_messages(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ use crate::domain::ports::DraftAttachmentRepo;+ let repo = EmailPgRepo::new(pool);+ let link = Uuid::parse_str("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa")?;+ for message in [+ "ee000001-0000-0000-0000-000000000001", // Non-draft.+ "ee000002-0000-0000-0000-000000000002", // Sent.+ "ee000003-0000-0000-0000-000000000003", // Scheduled draft.+ ] {+ let message = Uuid::parse_str(message)?;+ let attachment = staged_attachment(message, Uuid::new_v4());+ let result = repo.insert_draft_attachment(link, &attachment).await;+ assert!(+ matches!(result, Err(sqlx::Error::RowNotFound)),+ "locked message accepted an attachment: {result:?}"+ );+ let drafts = repo.draft_attachments_by_message_ids(&[message]).await?;+ assert!(+ drafts+ .get(&message)+ .is_none_or(|rows| rows.iter().all(|row| row.id != attachment.id))+ );+ }+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/scheduled.rs b/crates/email/src/outbound/email_pg_repo/test/scheduled.rsindex 5a130dac90..28306ced8f 100644--- a/crates/email/src/outbound/email_pg_repo/test/scheduled.rs+++ b/crates/email/src/outbound/email_pg_repo/test/scheduled.rs@@ -45,12 +45,12 @@ async fn schedule_update_cancel_is_atomic_and_idempotent(let repo = EmailPgRepo::new(pool.clone());let (link, message) = identity();assert!(- repo.change_schedule(link, message, &actor(), future(), None)+ repo.change_schedule(link, message, &actor(), future(), None, 0).await?.is_some());let later = Utc::now() + chrono::Duration::hours(2);- repo.change_schedule(link, message, &actor(), ScheduleChange::Set(later), None)+ repo.change_schedule(link, message, &actor(), ScheduleChange::Set(later), None, 0).await?;let schedule = sqlx::query!("SELECT send_time, sent, processing FROM email_scheduled_messages WHERE message_id = $1",@@ -64,19 +64,26 @@ async fn schedule_update_cancel_is_atomic_and_idempotent();assert!(!schedule.sent && !schedule.processing);assert!(- repo.change_schedule(link, message, &actor(), ScheduleChange::Cancel, None)+ repo.change_schedule(link, message, &actor(), ScheduleChange::Cancel, None, 0).await?.is_some());assert!(- repo.change_schedule(link, message, &actor(), ScheduleChange::Cancel, None)+ repo.change_schedule(link, message, &actor(), ScheduleChange::Cancel, None, 0).await?.is_none());let wrong_link = Uuid::parse_str("cccccccc-cccc-cccc-cccc-cccccccccccc")?;assert!(matches!(- repo.change_schedule(wrong_link, message, &actor(), ScheduleChange::Cancel, None)- .await,+ repo.change_schedule(+ wrong_link,+ message,+ &actor(),+ ScheduleChange::Cancel,+ None,+ 0+ )+ .await,Err(EmailErr::MessageNotFound(_))));Ok(())@@ -91,7 +98,7 @@ async fn sent_or_claimed_delivery_rejects_update_cancel_and_migration() -> anyhow::Result<()> {let repo = EmailPgRepo::new(pool.clone());let (link, message) = identity();- repo.change_schedule(link, message, &actor(), future(), None)+ repo.change_schedule(link, message, &actor(), future(), None, 0).await?;sqlx::query!("UPDATE email_scheduled_messages SET processing = true WHERE message_id = $1",@@ -101,7 +108,7 @@ async fn sent_or_claimed_delivery_rejects_update_cancel_and_migration(.await?;for change in [future(), ScheduleChange::Cancel] {assert!(matches!(- repo.change_schedule(link, message, &actor(), change, None)+ repo.change_schedule(link, message, &actor(), change, None, 0).await,Err(EmailErr::MessageDeliveryConflict(_))));@@ -111,7 +118,8 @@ async fn sent_or_claimed_delivery_rejects_update_cancel_and_migration(message,Uuid::parse_str("11111111-1111-1111-1111-111111111111")?,&[link],- None+ None,+ 0).await?.is_none()@@ -123,13 +131,13 @@ async fn sent_or_claimed_delivery_rejects_update_cancel_and_migration(.execute(&pool).await?;assert!(matches!(- repo.change_schedule(link, message, &actor(), future(), None)+ repo.change_schedule(link, message, &actor(), future(), None, 0).await,Err(EmailErr::MessageDeliveryConflict(_))));let sent_message = Uuid::parse_str("ee000001-0000-0000-0000-000000000001")?;assert!(matches!(- repo.change_schedule(link, sent_message, &actor(), future(), None)+ repo.change_schedule(link, sent_message, &actor(), future(), None, 0).await,Err(EmailErr::MessageDeliveryConflict(_))));@@ -159,7 +167,7 @@ async fn service_authorizes_actor_and_validates_future_time(let stranger = MacroUserIdStr::parse_from_str("macro|[email protected]")?;assert!(matches!(service- .change_schedule(stranger, link, message, future(), None)+ .change_schedule(stranger, link, message, future(), None, 0).await,Err(EmailErr::Unauthorized)));@@ -170,16 +178,17 @@ async fn service_authorizes_actor_and_validates_future_time(link,message,ScheduleChange::Set(Utc::now()),- None+ None,+ 0).await,Err(EmailErr::InvalidScheduleTime)));service- .change_schedule(actor(), link, message, future(), None)+ .change_schedule(actor(), link, message, future(), None, 0).await?;service- .change_schedule(actor(), link, message, ScheduleChange::Cancel, None)+ .change_schedule(actor(), link, message, ScheduleChange::Cancel, None, 0).await?;Ok(())}@@ -212,15 +221,17 @@ async fn scheduled_source_rejects_delete_and_migration_into_existing_reply(};let (link, message) = identity();service- .change_schedule(actor(), link, message, future(), None)+ .change_schedule(actor(), link, message, future(), None, 0).await?;assert!(matches!(- service.delete_draft_for_user_impl(actor(), message).await,+ service.delete_draft_for_user_impl(actor(), message, 0).await,Err(EmailErr::MessageDeliveryConflict(id)) if id == message));let target_link = Uuid::parse_str("cccccccc-cccc-cccc-cccc-cccccccccccc")?;let target_draft = Uuid::parse_str("ee000005-0000-0000-0000-000000000005")?;let input = CreateDraftInput {+ frozen_signature_html: None,+ draft_generation: 0,sender_email: None,db_id: Some(message),provider_id: None,@@ -245,7 +256,7 @@ async fn scheduled_source_rejects_delete_and_migration_into_existing_reply(service.save_draft_for_user_impl(actor(), Some(target_link), input).await,- Err(EmailErr::InvalidDraft(_))+ Err(EmailErr::MessageDeliveryConflict(id)) if id == message));let subject = sqlx::query_scalar!("SELECT subject FROM email_messages WHERE id = $1",@@ -271,7 +282,7 @@ async fn scheduled_source_rejects_delete_and_migration_into_existing_reply(async fn waiting_transition_observes_committed_claim(pool: Pool<Postgres>) -> anyhow::Result<()> {let repo = EmailPgRepo::new(pool.clone());let (link, message) = identity();- repo.change_schedule(link, message, &actor(), future(), None)+ repo.change_schedule(link, message, &actor(), future(), None, 0).await?;let mut tx = pool.begin().await?;let blocker = sqlx::query_scalar!("SELECT pg_backend_pid() AS \"pid!\"")@@ -290,7 +301,7 @@ async fn waiting_transition_observes_committed_claim(pool: Pool<Postgres>) -> an.execute(&mut *tx).await?;let cancel = tokio::spawn(async move {- repo.change_schedule(link, message, &actor(), ScheduleChange::Cancel, None)+ repo.change_schedule(link, message, &actor(), ScheduleChange::Cancel, None, 0).await});wait_for_transaction_waiter(&pool, blocker).await?;@@ -304,6 +315,7 @@ async fn waiting_transition_observes_committed_claim(pool: Pool<Postgres>) -> anfn stale_input(message: Uuid) -> ResolvedDraftInput {ResolvedDraftInput {+ draft_generation: 0,db_id: message,provider_id: None,replying_to_id: None,@@ -338,7 +350,7 @@ async fn stale_autosave_cannot_mutate_confirmed_claimed_or_sent_message(from_contact_id: None,recipients: vec![],};- repo.change_schedule(link, message, &actor(), future(), None)+ repo.change_schedule(link, message, &actor(), future(), None, 0).await?;assert!(matches!(repo.insert_message(&input, &contacts, link, None, true)@@ -452,24 +464,24 @@ async fn update_or_cancel_before_claim_prevents_stale_queue_delivery() -> anyhow::Result<()> {let repo = EmailPgRepo::new(pool.clone());let (link, message) = identity();- repo.change_schedule(link, message, &actor(), future(), None)+ repo.change_schedule(link, message, &actor(), future(), None, 0).await?;sqlx::query!("UPDATE email_scheduled_messages SET send_time = NOW() - INTERVAL '1 minute' WHERE message_id = $1", message).execute(&pool).await?;- repo.change_schedule(link, message, &actor(), future(), None)+ repo.change_schedule(link, message, &actor(), future(), None, 0).await?;assert!(get_and_start_processing_scheduled_message(&pool, link, message).await?.is_none());- repo.change_schedule(link, message, &actor(), ScheduleChange::Cancel, None)+ repo.change_schedule(link, message, &actor(), ScheduleChange::Cancel, None, 0).await?;assert!(get_and_start_processing_scheduled_message(&pool, link, message).await?.is_none());- repo.change_schedule(link, message, &actor(), future(), None)+ repo.change_schedule(link, message, &actor(), future(), None, 0).await?;sqlx::query!("UPDATE email_scheduled_messages SET send_time = NOW() - INTERVAL '1 minute' WHERE message_id = $1", message).execute(&pool).await?;assert!(@@ -479,7 +491,7 @@ async fn update_or_cancel_before_claim_prevents_stale_queue_delivery();for change in [future(), ScheduleChange::Cancel] {assert!(matches!(- repo.change_schedule(link, message, &actor(), change, None)+ repo.change_schedule(link, message, &actor(), change, None, 0).await,Err(EmailErr::MessageDeliveryConflict(_))));@@ -512,7 +524,7 @@ async fn initial_schedule_prepares_signature_but_time_updates_preserve_content(sent_undo_delay_secs: 5,};service- .change_schedule(actor(), link, message, future(), None)+ .change_schedule(actor(), link, message, future(), None, 0).await?;let original = sqlx::query!("SELECT body_html_sanitized, body_text FROM email_messages WHERE id = $1",@@ -531,7 +543,7 @@ async fn initial_schedule_prepares_signature_but_time_updates_preserve_content(.execute(&pool).await?;service- .change_schedule(actor(), link, message, future(), None)+ .change_schedule(actor(), link, message, future(), None, 0).await?;let updated = sqlx::query!("SELECT body_html_sanitized FROM email_messages WHERE id = $1",@@ -541,10 +553,10 @@ async fn initial_schedule_prepares_signature_but_time_updates_preserve_content(.await?;assert_eq!(updated.body_html_sanitized, original.body_html_sanitized);service- .change_schedule(actor(), link, message, ScheduleChange::Cancel, None)+ .change_schedule(actor(), link, message, ScheduleChange::Cancel, None, 0).await?;service- .change_schedule(actor(), link, message, future(), Some(false))+ .change_schedule(actor(), link, message, future(), Some(false), 0).await?;let excluded = sqlx::query!("SELECT body_html_sanitized FROM email_messages WHERE id = $1",@@ -564,20 +576,41 @@ async fn initial_schedule_prepares_signature_but_time_updates_preserve_content(struct ClaimRepo(Pool<Postgres>);impl crate::domain::scheduled_delivery::ScheduledDeliveryRepo for ClaimRepo {+ async fn reconcile_deletion(&self, _: Uuid, _: Uuid) -> anyhow::Result<()> {+ Ok(())+ }type Claim = (Uuid, Uuid);type Sent = ();- async fn try_claim(&self, link: Uuid, message: Uuid) -> anyhow::Result<Option<Self::Claim>> {+ async fn try_claim(+ &self,+ link: Uuid,+ message: Uuid,+ ) -> anyhow::Result<Option<crate::domain::scheduled_delivery::ClaimedDelivery<Self::Claim>>>+ {Ok(get_and_start_processing_scheduled_message(&self.0, link, message).await?- .map(|_| (link, message)),+ .map(|_| crate::domain::scheduled_delivery::ClaimedDelivery {+ claim: (link, message),+ mode: crate::domain::scheduled_delivery::DeliveryMode::Send,+ }),)}async fn complete(&self, _: &Self::Claim, _: ()) -> anyhow::Result<()> {Ok(())}- async fn release(&self, claim: Self::Claim) -> anyhow::Result<()> {+ async fn begin_send(&self, _: &Self::Claim) -> anyhow::Result<bool> {+ Ok(true)+ }+ async fn pause(+ &self,+ _: &Self::Claim,+ _: crate::domain::scheduled_delivery::DeliveryPause,+ ) -> anyhow::Result<()> {+ panic!("unexpected pause")+ }+ async fn release(&self, claim: &Self::Claim) -> anyhow::Result<()> {email_db_client::messages::scheduled::upsert::clear_scheduled_message_processing(&self.0, claim.0, claim.1,)@@ -595,7 +628,21 @@ struct PendingProvider {impl crate::domain::scheduled_delivery::ScheduledMessageSender<(Uuid, Uuid), ()>for PendingProvider{- async fn send_claimed(&self, _: &(Uuid, Uuid)) -> anyhow::Result<()> {+ type Prepared = ();+ async fn prepare(+ &self,+ _: &(Uuid, Uuid),+ ) -> Result<(), crate::domain::scheduled_delivery::PreparationError> {+ Ok(())+ }+ async fn reconcile(&self, _: &(Uuid, Uuid)) -> anyhow::Result<Option<()>> {+ panic!("unexpected reconciliation")+ }+ async fn send_prepared(+ &self,+ _: &(Uuid, Uuid),+ _: (),+ ) -> Result<(), crate::domain::scheduled_delivery::SubmissionError> {self.entered.notify_one();self.finish.notified().await;Ok(())@@ -612,7 +659,7 @@ async fn pending_provider_holds_no_locks_and_duplicate_cannot_release_claim(use crate::domain::scheduled_delivery::deliver_scheduled;let repo = EmailPgRepo::new(pool.clone());let (link, message) = identity();- repo.change_schedule(link, message, &actor(), future(), None)+ repo.change_schedule(link, message, &actor(), future(), None, 0).await?;sqlx::query!("UPDATE email_scheduled_messages SET send_time = NOW() - INTERVAL '1 minute' WHERE message_id = $1", message).execute(&pool).await?;let claims = ClaimRepo(pool.clone());@@ -627,7 +674,7 @@ async fn pending_provider_holds_no_locks_and_duplicate_cannot_release_claim(let caller = actor();let result = tokio::time::timeout(std::time::Duration::from_secs(5),- repo.change_schedule(link, message, &caller, change, None),+ repo.change_schedule(link, message, &caller, change, None, 0),).await?;assert!(matches!(result, Err(EmailErr::MessageDeliveryConflict(_))));@@ -647,3 +694,94 @@ async fn pending_provider_holds_no_locks_and_duplicate_cannot_release_claim(delivery.await?;Ok(())}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn legacy_cancel_cannot_change_durable_or_historical_delivery_facts(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let (link, message) = identity();+ let actor = actor();+ repo.change_schedule(link, message, &actor, future(), None, 0)+ .await?;+ for (sent, unconfirmed) in [(true, false), (false, true), (false, false)] {+ sqlx::query!("INSERT INTO email_send_attempts (user_id, link_id, attempt_id, message_id, sent, delivery_unconfirmed) VALUES ($1, $2, $3, $4, $5, $6)", actor.as_ref(), link, Uuid::now_v7(), message, sent, unconfirmed).execute(&pool).await?;+ }+ assert!(matches!(+ repo.change_schedule(link, message, &actor, ScheduleChange::Cancel, None, 0)+ .await,+ Err(EmailErr::MessageDeliveryConflict(_))+ ));+ let rows = sqlx::query!("SELECT sent, delivery_unconfirmed, cancelled FROM email_send_attempts WHERE message_id = $1", message).fetch_all(&pool).await?;+ assert_eq!(rows.len(), 3);+ for row in rows {+ assert!(!row.cancelled);+ }+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn late_provider_upload_cannot_change_a_committed_schedule(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ use crate::domain::draft_attachments::{+ AttachmentChange, AttachmentError, DraftAttachmentRepository,+ };+ let (link, draft) = identity();+ let file = Uuid::now_v7();+ let mut admission = pool.begin().await?;+ sqlx::query!(+ "SELECT id FROM email_messages WHERE id=$1 FOR UPDATE",+ draft+ )+ .fetch_one(&mut *admission)+ .await?;+ let blocker = sqlx::query_scalar!("SELECT pg_backend_pid()")+ .fetch_one(&mut *admission)+ .await?+ .unwrap();+ let repo = EmailPgRepo::new(pool.clone());+ let upload = tokio::spawn(async move {+ repo.commit_attachment_change(+ actor().as_ref(),+ link,+ draft,+ AttachmentChange::Upload(crate::domain::models::AttachmentDraft {+ id: file,+ draft_id: draft,+ file_name: "late.txt".into(),+ content_type: "text/plain".into(),+ sha: "a".repeat(64),+ size: 4,+ s3_key: format!("audit/{file}"),+ upload_pending: false,+ content_id: None,+ is_inline: false,+ }),+ 0,+ )+ .await+ });+ wait_for_transaction_waiter(&pool, blocker).await?;+ sqlx::query!("INSERT INTO email_scheduled_messages(link_id,message_id,send_time,sent) VALUES($1,$2,NOW()+INTERVAL '1 hour',false)",link,draft).execute(&mut *admission).await?;+ admission.commit().await?;+ assert!(matches!(+ upload.await?,+ Err(AttachmentError::DeliveryConflict)+ ));+ assert!(+ !sqlx::query_scalar!(+ "SELECT EXISTS(SELECT 1 FROM email_attachments_drafts WHERE id=$1) AS \"exists!\"",+ file+ )+ .fetch_one(&pool)+ .await?+ );+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/scheduled_trash.rs b/crates/email/src/outbound/email_pg_repo/test/scheduled_trash.rsnew file mode 100644index 0000000000..1dfd7d4353--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/scheduled_trash.rs@@ -0,0 +1,154 @@+use super::*;+use email_db_client::messages::scheduled::{+ delivery::{+ DeliveryClaim, begin_submission, claim_delivery, complete_delivery, pause_delivery,+ release_preparation,+ },+ get::{get_and_start_processing_scheduled_message, get_scheduled_message},+};++fn identity() -> (Uuid, Uuid) {+ (+ Uuid::parse_str("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa").unwrap(),+ Uuid::parse_str("ee000003-0000-0000-0000-000000000003").unwrap(),+ )+}++async fn claim(pool: &Pool<Postgres>) -> anyhow::Result<DeliveryClaim> {+ let (link, message) = identity();+ Ok(claim_delivery(pool, link, message, 300)+ .await?+ .expect("fixture has a due scheduled draft"))+}++async fn preserve_submission(pool: Pool<Postgres>, unconfirmed: bool) -> anyhow::Result<()> {+ let (link, message) = identity();+ let claim = claim(&pool).await?;+ assert!(begin_submission(&pool, &claim, 300).await?);+ if unconfirmed {+ pause_delivery(&pool, &claim, true, 300).await?;+ }+ let repo = EmailPgRepo::new(pool.clone());+ assert!(+ repo.delete_scheduled_messages_batch(&[message], link)+ .await?+ .is_empty()+ );+ assert!(get_scheduled_message(&pool, link, message).await?.is_some());+ let mut tx = pool.begin().await?;+ assert!(complete_delivery(&mut tx, &claim).await?);+ tx.commit().await?;+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_message"))+)]+async fn trash_preserves_submitted_delivery(pool: Pool<Postgres>) -> anyhow::Result<()> {+ preserve_submission(pool, false).await+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_message"))+)]+async fn trash_preserves_unconfirmed_delivery(pool: Pool<Postgres>) -> anyhow::Result<()> {+ preserve_submission(pool, true).await+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_message"))+)]+async fn trash_revokes_preparation_before_submission(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let (link, message) = identity();+ let claim = claim(&pool).await?;+ let repo = EmailPgRepo::new(pool.clone());+ assert_eq!(+ repo.delete_scheduled_messages_batch(&[message], link)+ .await?,+ vec![message]+ );+ assert!(!begin_submission(&pool, &claim, 300).await?);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_message"))+)]+async fn trash_revokes_backed_off_preparation(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let (link, message) = identity();+ let claim = claim(&pool).await?;+ release_preparation(&pool, &claim, 300).await?;+ let repo = EmailPgRepo::new(pool.clone());+ assert_eq!(+ repo.delete_scheduled_messages_batch(&[message], link)+ .await?,+ vec![message]+ );+ assert!(!begin_submission(&pool, &claim, 300).await?);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_message"))+)]+async fn trash_preserves_ambiguous_legacy_claim(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let (link, message) = identity();+ assert!(+ get_and_start_processing_scheduled_message(&pool, link, message)+ .await?+ .is_some()+ );+ let repo = EmailPgRepo::new(pool.clone());+ assert!(+ repo.delete_scheduled_messages_batch(&[message], link)+ .await?+ .is_empty()+ );+ assert!(get_scheduled_message(&pool, link, message).await?.is_some());+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_message"))+)]+async fn trash_cancels_definitively_failed_delivery(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let (link, message) = identity();+ let claim = claim(&pool).await?;+ assert!(begin_submission(&pool, &claim, 300).await?);+ pause_delivery(&pool, &claim, false, 300).await?;+ let repo = EmailPgRepo::new(pool.clone());+ assert_eq!(+ repo.delete_scheduled_messages_batch(&[message], link)+ .await?,+ vec![message]+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_message"))+)]+async fn trash_racing_submission_has_one_winner(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let (link, message) = identity();+ let claim = claim(&pool).await?;+ let repo = EmailPgRepo::new(pool.clone());+ let messages = [message];+ let (deleted, submitted) = tokio::join!(+ repo.delete_scheduled_messages_batch(&messages, link),+ begin_submission(&pool, &claim, 300)+ );+ let deleted = deleted?;+ assert_eq!(deleted.is_empty(), submitted?);+ assert_eq!(+ get_scheduled_message(&pool, link, message).await?.is_none(),+ !deleted.is_empty()+ );+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/send_attempt.rs b/crates/email/src/outbound/email_pg_repo/test/send_attempt.rsnew file mode 100644index 0000000000..ca85803688--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/send_attempt.rs@@ -0,0 +1,990 @@+use super::*;+use crate::domain::{+ models::{CreateDraftInput, ResolvedDraftInput, UpsertedContacts},+ send_attempt::*,+};++mod deferred_deletion;+mod independent_outbox;+mod preparation_cancel;+mod provider_deletion;+mod provider_draft_trash;+mod retention;+mod trash;++fn actor() -> MacroUserIdStr<'static> {+ MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap()+}+fn link() -> Uuid {+ Uuid::parse_str("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa").unwrap()+}+fn message() -> Uuid {+ Uuid::parse_str("ee000002-0000-0000-0000-000000000002").unwrap()+}+fn snapshot() -> SendSnapshot {+ SendSnapshot {+ message: CreateDraftInput {+ frozen_signature_html: None,+ draft_generation: 0,+ sender_email: None,+ db_id: Some(message()),+ thread_db_id: Some(Uuid::parse_str("11111111-1111-1111-1111-111111111111").unwrap()),+ provider_id: None,+ provider_thread_id: None,+ replying_to_id: None,+ subject: "Approved snapshot".into(),+ to: vec![],+ cc: vec![],+ bcc: vec![],+ body_text: Some("Approved body".into()),+ body_html: None,+ body_macro: None,+ headers_json: None,+ send_time: None,+ include_signature: None,+ actor: None,+ draft_client_binding: None,+ thread_client_binding: None,+ },+ attachment_ids: vec![],+ forwarded_attachment_ids: vec![],+ restore_body_html: None,+ restore_body_text: Some("Editable body".into()),+ restore_body_macro: None,+ }+}+fn prepared() -> PreparedSend {+ let snapshot = snapshot();+ let input = &snapshot.message;+ PreparedSend {+ source_inbox: None,+ undo_delay_secs: 5,+ message: ResolvedDraftInput {+ draft_generation: 0,+ db_id: message(),+ thread_db_id: input.thread_db_id.unwrap(),+ provider_id: None,+ provider_thread_id: None,+ replying_to_id: None,+ subject: input.subject.clone(),+ to: vec![],+ cc: vec![],+ bcc: vec![],+ body_text: input.body_text.clone(),+ body_html: None,+ body_macro: None,+ headers_json: None,+ send_time: Some(Utc::now() + chrono::Duration::seconds(5)),+ actor_id: Some(actor().to_string()),+ draft_client_id: None,+ thread_client_id: None,+ },+ contacts: UpsertedContacts {+ from_contact_id: None,+ recipients: vec![],+ },+ new_thread: None,+ restore_html: None,+ restore_text: snapshot.restore_body_text.clone(),+ restore_macro: snapshot.restore_body_macro.clone(),+ snapshot,+ }+}++fn prepared_generation(generation: i32) -> PreparedSend {+ let mut input = prepared();+ input.message.draft_generation = generation;+ input.snapshot.message.draft_generation = generation;+ input+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn concurrent_replay_preserves_one_message_and_undo_deadline(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let actor = actor();+ let (first, second) = tokio::join!(+ repo.admit_send(&actor, link(), attempt, prepared()),+ repo.admit_send(&actor, link(), attempt, prepared())+ );+ let first = first?;+ let second = second?;+ assert_eq!(first.message_id, second.message_id);+ assert_eq!(+ first.send_time.unwrap().timestamp_micros(),+ second.send_time.unwrap().timestamp_micros()+ );+ let mut changed = snapshot();+ changed.message.subject = "different".into();+ assert!(matches!(+ repo.read_send_attempt(&actor, link(), attempt, Some(&changed))+ .await,+ Err(EmailErr::SendAttemptConflict)+ ));+ assert!(matches!(+ repo.admit_send(+ &actor,+ link(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ prepared()+ )+ .await,+ Err(EmailErr::DraftGenerationConflict(_))+ ));+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn cancellation_before_admission_is_a_durable_tombstone(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::Cancelled+ );+ assert_eq!(+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?+ .status,+ SendAttemptStatus::Cancelled+ );+ let scheduled = sqlx::query_scalar!(+ "SELECT COUNT(*) FROM email_scheduled_messages WHERE message_id = $1",+ message()+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(scheduled, Some(0));+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn cancellation_restores_body_and_cannot_cancel_a_later_resend(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let first = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), first, prepared()).await?;+ assert_eq!(+ repo.cancel_send(&actor(), link(), first).await?.status,+ SendAttemptStatus::Cancelled+ );+ let restored = sqlx::query!(+ "SELECT is_draft, body_text FROM email_messages WHERE id = $1",+ message()+ )+ .fetch_one(&pool)+ .await?;+ assert!(restored.is_draft);+ assert_eq!(restored.body_text.as_deref(), Some("Editable body"));+ let second = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), second, {+ let mut next = prepared();+ next.message.draft_generation = 2;+ next.snapshot.message.draft_generation = 2;+ next+ })+ .await?;+ repo.cancel_send(&actor(), link(), first).await?;+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), second, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Accepted+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn claimed_delivery_cannot_be_cancelled(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let mut input = prepared();+ input.undo_delay_secs = 0;+ repo.admit_send(&actor(), link(), attempt, input).await?;+ assert!(+ email_db_client::messages::scheduled::get::get_and_start_processing_scheduled_message(+ &pool,+ link(),+ message()+ )+ .await?+ .is_some()+ );+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::Sending+ );+ assert!(+ !sqlx::query_scalar!(+ "SELECT is_draft FROM email_messages WHERE id = $1",+ message()+ )+ .fetch_one(&pool)+ .await?+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn attachment_mismatch_rolls_back_admission(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let mut input = prepared();+ input+ .snapshot+ .attachment_ids+ .push(macro_uuid::generate_uuid_v7());+ assert!(matches!(+ repo.admit_send(&actor(), link(), attempt, input).await,+ Err(EmailErr::InvalidSendSnapshot(_))+ ));+ assert!(+ repo.read_send_attempt(&actor(), link(), attempt, None)+ .await?+ .is_none()+ );+ assert!(+ sqlx::query_scalar!(+ "SELECT is_draft FROM email_messages WHERE id = $1",+ message()+ )+ .fetch_one(&pool)+ .await?+ );+ Ok(())+}++struct UnusedFrecency;+impl frecency::domain::ports::FrecencyQueryService for UnusedFrecency {+ async fn get_frecency_page<'a>(+ &self,+ _: frecency::domain::models::FrecencyPageRequest<'a>,+ ) -> Result<+ frecency::domain::models::FrecencyPageResponse,+ frecency::domain::models::FrecencyQueryErr,+ > {+ panic!("send does not query frecency")+ }+ async fn get_frecencies_by_ids<'a>(+ &self,+ _: frecency::domain::models::FrecencyByIdsRequest<'a>,+ ) -> Result<+ frecency::domain::models::FrecencyPageResponse,+ frecency::domain::models::FrecencyQueryErr,+ > {+ panic!("send does not query frecency")+ }+}++fn service(+ pool: Pool<Postgres>,+) -> crate::domain::service::EmailServiceImpl<+ EmailPgRepo,+ UnusedFrecency,+ crate::domain::ports::NoOpEnqueuer,+ crm::domain::service::NoOpCrmService,+ (),+> {+ crate::domain::service::EmailServiceImpl {+ email_repo: EmailPgRepo::new(pool),+ frecency_service: UnusedFrecency,+ enqueuer: crate::domain::ports::NoOpEnqueuer,+ crm_service: crm::domain::service::NoOpCrmService,+ entity_access_management_service: (),+ macro_event_broker: macro_event_broker::NoopMacroEventBroker,+ sent_undo_delay_secs: 5,+ sender_provider: std::sync::Arc::new(+ crate::domain::senders::UnavailableEmailSenderProvider,+ ),+ }+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn service_authorizes_send_cancel_and_status_before_touching_attempts(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let service = service(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let outsider = MacroUserIdStr::parse_from_str("macro|[email protected]")?;+ assert!(+ service+ .send_email(outsider.clone(), link(), attempt, snapshot())+ .await+ .is_err()+ );+ assert!(+ service+ .cancel_email_send(outsider.clone(), link(), attempt)+ .await+ .is_err()+ );+ assert!(+ service+ .email_send_status(outsider, link(), attempt)+ .await+ .is_err()+ );+ assert!(+ service+ .email_send_status(actor(), link(), attempt)+ .await?+ .is_none()+ );+ let mut input = snapshot();+ input.message.to.push(crate::domain::models::ContactInfo {+ email: "[email protected]".into(),+ name: None,+ photo_url: None,+ });+ let unchanged = sqlx::query!(+ "SELECT link_id, subject, is_draft FROM email_messages WHERE id = $1",+ message()+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(unchanged.link_id, link());+ assert_eq!(unchanged.subject.as_deref(), Some("Re: Hello World"));+ assert!(unchanged.is_draft);+ let admitted = service+ .send_email(actor(), link(), attempt, input.clone())+ .await?;+ assert_eq!(admitted.status, SendAttemptStatus::Accepted);+ assert!(admitted.message.is_some());+ let replay = service.send_email(actor(), link(), attempt, input).await?;+ assert_eq!(admitted.message_id, replay.message_id);+ assert_eq!(+ admitted.send_time.map(|t| t.timestamp_micros()),+ replay.send_time.map(|t| t.timestamp_micros())+ );+ assert_eq!(+ service+ .cancel_email_send(actor(), link(), attempt)+ .await?+ .status,+ SendAttemptStatus::Cancelled+ );+ Ok(())+}++mod inbox_move;++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn attachment_edits_cannot_change_accepted_snapshot(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ let attachment = models_email::service::attachment::AttachmentDraft {+ upload_pending: false,+ content_id: None,+ is_inline: false,+ id: macro_uuid::generate_uuid_v7(),+ draft_id: message(),+ file_name: "file.txt".into(),+ content_type: "text/plain".into(),+ sha: "hash".into(),+ size: 1,+ s3_key: "file".into(),+ };+ assert!(+ email_db_client::attachments::draft::insert_draft_attachment(&pool, link(), attachment)+ .await+ .is_err()+ );+ assert_eq!(+ email_db_client::attachments::draft::get_total_attachments_size_by_draft_id(+ &pool,+ link(),+ message()+ )+ .await?,+ 0+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn omitted_restoration_fields_preserve_the_approved_body_on_cancel(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ use base64::{Engine, engine::general_purpose::URL_SAFE_NO_PAD};++ let service = service(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let mut input = snapshot();+ input.message.to.push(crate::domain::models::ContactInfo {+ email: "[email protected]".into(),+ name: None,+ photo_url: None,+ });+ let html = "<p>Approved body</p><script>alert('unsafe')</script>";+ input.message.body_html = Some(URL_SAFE_NO_PAD.encode(html));+ input.message.body_macro = Some(r#"{"editor":"approved"}"#.into());+ input.restore_body_text = None;+ service+ .send_email(actor(), link(), attempt, input.clone())+ .await?;+ // Defaulting recovery content must not change the immutable replay snapshot.+ let replay = service.send_email(actor(), link(), attempt, input).await?;+ assert_eq!(replay.status, SendAttemptStatus::Accepted);+ service.cancel_email_send(actor(), link(), attempt).await?;+ let restored = sqlx::query!(+ "SELECT is_draft, body_html_sanitized, body_text, body_macro FROM email_messages WHERE id = $1",+ message()+ )+ .fetch_one(&pool)+ .await?;+ assert!(restored.is_draft);+ assert_eq!(+ restored.body_html_sanitized,+ Some(email_utils::sanitize_authored_html(html))+ );+ assert_eq!(restored.body_text.as_deref(), Some("Approved body"));+ assert_eq!(+ restored.body_macro.as_deref(),+ Some(r#"{"editor":"approved"}"#)+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn cancellation_repairs_draft_only_thread_metadata(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let thread_id = Uuid::parse_str("33333333-3333-3333-3333-333333333333")?;+ let message_id = Uuid::parse_str("ee000004-0000-0000-0000-000000000004")?;+ let mut input = prepared();+ input.message.db_id = message_id;+ input.message.thread_db_id = thread_id;+ input.snapshot.message.db_id = Some(message_id);+ input.snapshot.message.thread_db_id = Some(thread_id);+ repo.admit_send(&actor(), link(), attempt, input).await?;+ let before = crate::outbound::email_pg_repo::thread::thread_by_id(&pool, thread_id)+ .await?+ .unwrap();+ assert!(!before.inbox_visible);+ assert!(before.latest_inbound_message_ts.is_none());++ repo.cancel_send(&actor(), link(), attempt).await?;+ let restored = crate::outbound::email_pg_repo::thread::thread_by_id(&pool, thread_id)+ .await?+ .unwrap();+ assert!(restored.inbox_visible);+ assert!(restored.latest_inbound_message_ts.is_some());+ assert!(restored.latest_non_spam_message_ts.is_some());+ assert!(restored.latest_outbound_message_ts.is_none());+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn delivery_remains_terminal_after_provider_deletes_the_message(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let cancelled = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), cancelled, prepared())+ .await?;+ repo.cancel_send(&actor(), link(), cancelled).await?;+ let sent = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), sent, prepared_generation(2))+ .await?;+ email_db_client::messages::update::mark_message_as_sent(+ &mut *pool.acquire().await?,+ "provider-message",+ "provider-thread-1",+ link(),+ message(),+ )+ .await?;+ assert!(+ sqlx::query_scalar!(+ "SELECT sent FROM email_send_attempts WHERE attempt_id = $1 AND link_id = $2",+ sent.0,+ link()+ )+ .fetch_one(&pool)+ .await?+ );+ email_db_client::messages::delete::delete_db_message(&pool, message()).await?;+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), sent, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Sent+ );+ assert_eq!(+ repo.cancel_send(&actor(), link(), sent).await?.status,+ SendAttemptStatus::Sent+ );+ assert_eq!(+ repo.admit_send(&actor(), link(), sent, prepared_generation(2))+ .await?+ .status,+ SendAttemptStatus::Sent+ );+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), cancelled, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Cancelled+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn deletion_preserves_legacy_delivery_confirmation(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ // Simulate a delivery whose proof has not yet been projected onto the attempt.+ sqlx::query!(+ "UPDATE email_messages SET is_sent = true WHERE id = $1",+ message()+ )+ .execute(&pool)+ .await?;+ sqlx::query!(+ "UPDATE email_send_attempts SET sent = false WHERE attempt_id = $1",+ attempt.0+ )+ .execute(&pool)+ .await?;+ email_db_client::messages::delete::delete_db_message(&pool, message()).await?;+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), attempt, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Sent+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn cancellation_waiting_on_delivery_cannot_cancel_a_deleted_sent_message(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ let mut delivery = pool.begin().await?;+ let delivery_pid = sqlx::query_scalar!("SELECT pg_backend_pid() AS \"pid!\"")+ .fetch_one(&mut *delivery)+ .await?;+ email_db_client::messages::update::mark_message_as_sent(+ &mut delivery,+ "provider-message",+ "provider-thread-1",+ link(),+ message(),+ )+ .await?;+ let cancel_pool = pool.clone();+ let cancellation = tokio::spawn(async move {+ EmailPgRepo::new(cancel_pool)+ .cancel_send(&actor(), link(), attempt)+ .await+ });+ // Ensure cancellation read the old attempt and is waiting on delivery's+ // message lock before deleting the message and committing delivery.+ wait_for_blocked_transaction(&pool, delivery_pid).await?;+ email_db_client::messages::delete::delete_db_message(&mut *delivery, message()).await?;+ delivery.commit().await?;+ assert_eq!(cancellation.await??.status, SendAttemptStatus::Sent);+ Ok(())+}++async fn wait_for_blocked_transaction(pool: &Pool<Postgres>, blocker: i32) -> anyhow::Result<()> {+ tokio::time::timeout(std::time::Duration::from_secs(10), async {+ loop {+ let waiting = sqlx::query_scalar!(+ r#"SELECT EXISTS (+ SELECT 1 FROM pg_stat_activity+ WHERE datname = current_database()+ AND $1 = ANY(pg_blocking_pids(pid))+ ) AS "waiting!""#,+ blocker+ )+ .fetch_one(pool)+ .await?;+ if waiting {+ return Ok::<_, anyhow::Error>(());+ }+ tokio::time::sleep(std::time::Duration::from_millis(10)).await;+ }+ })+ .await??;+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn cancellation_waiting_on_legacy_changes_cannot_revoke_a_later_schedule(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ let mut changes = pool.begin().await?;+ let blocker = sqlx::query_scalar!("SELECT pg_backend_pid() AS \"pid!\"")+ .fetch_one(&mut *changes)+ .await?;+ sqlx::query!(+ "SELECT id FROM email_messages WHERE id = $1 FOR UPDATE",+ message()+ )+ .fetch_one(&mut *changes)+ .await?;+ let cancel_pool = pool.clone();+ let cancellation = tokio::spawn(async move {+ EmailPgRepo::new(cancel_pool)+ .cancel_send(&actor(), link(), attempt)+ .await+ });+ wait_for_blocked_transaction(&pool, blocker).await?;+ // Model legacy cancellation followed by a new schedule while attempt-based+ // cancellation is waiting. Legacy writes do not take the attempt lock.+ sqlx::query!(+ "UPDATE email_send_attempts SET cancelled = true WHERE attempt_id = $1",+ attempt.0+ )+ .execute(&mut *changes)+ .await?;+ sqlx::query!(+ "UPDATE email_messages SET body_text = $2 WHERE id = $1",+ message(),+ "Later message"+ )+ .execute(&mut *changes)+ .await?;+ let later_send_time = Utc::now() + chrono::Duration::hours(1);+ sqlx::query!(+ "UPDATE email_scheduled_messages SET send_time = $2 WHERE message_id = $1",+ message(),+ later_send_time+ )+ .execute(&mut *changes)+ .await?;+ changes.commit().await?;+ assert_eq!(cancellation.await??.status, SendAttemptStatus::Cancelled);+ let preserved = sqlx::query!(+ "SELECT m.body_text, m.is_draft, s.send_time FROM email_messages m JOIN email_scheduled_messages s ON s.message_id = m.id WHERE m.id = $1",+ message()+ ).fetch_one(&pool).await?;+ assert_eq!(preserved.body_text.as_deref(), Some("Later message"));+ assert!(!preserved.is_draft);+ assert_eq!(+ preserved.send_time.timestamp_micros(),+ later_send_time.timestamp_micros()+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn failed_preparation_can_be_cancelled_and_restored(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!("UPDATE email_scheduled_messages SET processing = true, delivery_status = 'failed' WHERE message_id = $1", message())+ .execute(&pool).await?;+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), attempt, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Failed+ );+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::Cancelled+ );+ let restored = sqlx::query!(+ "SELECT is_draft, body_text FROM email_messages WHERE id = $1",+ message()+ )+ .fetch_one(&pool)+ .await?;+ assert!(restored.is_draft);+ assert_eq!(restored.body_text.as_deref(), Some("Editable body"));+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn uncertain_delivery_stays_locked_on_cancel_and_schedule_changes(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ use crate::domain::scheduled::{EmailSchedulingRepo, ScheduleChange};+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!("UPDATE email_scheduled_messages SET processing = true, delivery_status = 'unconfirmed', delivery_started_at = NOW() WHERE message_id = $1", message())+ .execute(&pool).await?;+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), attempt, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::DeliveryUnconfirmed+ );+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::DeliveryUnconfirmed+ );+ assert!(matches!(+ repo.change_schedule(link(), message(), &actor(), ScheduleChange::Cancel, None, 0)+ .await,+ Err(EmailErr::MessageDeliveryConflict(_))+ ));+ let record = sqlx::query!(+ "SELECT cancelled, sent FROM email_send_attempts WHERE attempt_id = $1",+ attempt.0+ )+ .fetch_one(&pool)+ .await?;+ assert!(!record.cancelled && !record.sent);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn deleted_message_preserves_uncertain_delivery_authority(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!(+ "UPDATE email_scheduled_messages SET processing = true, delivery_started_at = NOW(), delivery_claim_id = $2 WHERE message_id = $1",+ message(), macro_uuid::generate_uuid_v7(),+ ).execute(&pool).await?;+ sqlx::query!("DELETE FROM email_messages WHERE id = $1", message())+ .execute(&pool)+ .await?;+ let read = repo+ .read_send_attempt(&actor(), link(), attempt, None)+ .await?+ .unwrap();+ assert_eq!(read.status, SendAttemptStatus::Sending);+ assert_eq!(read.message_id, Some(message()));+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::Sending+ );+ assert_eq!(+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?+ .status,+ SendAttemptStatus::Sending+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn deleted_legacy_processing_message_remains_uncertain(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!(+ "UPDATE email_scheduled_messages SET processing = true WHERE message_id = $1",+ message()+ )+ .execute(&pool)+ .await?;+ sqlx::query!("DELETE FROM email_messages WHERE id = $1", message())+ .execute(&pool)+ .await?;+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::Sending+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn deleted_preparation_without_submission_can_be_cancelled(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!(+ "UPDATE email_scheduled_messages SET processing = true, delivery_claim_id = $2 WHERE message_id = $1",+ message(), macro_uuid::generate_uuid_v7(),+ ).execute(&pool).await?;+ sqlx::query!("DELETE FROM email_messages WHERE id = $1", message())+ .execute(&pool)+ .await?;+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::Cancelled+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn legacy_snapshot_without_sender_replays_the_original_attempt(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let admitted = repo+ .admit_send(&actor(), link(), attempt, prepared())+ .await?;+ // Model an attempt written before sender_email existed in the snapshot.+ sqlx::query!(+ "UPDATE email_send_attempts SET request = (request - '_send_approval') #- '{message,sender_email}' WHERE attempt_id = $1",+ attempt.0,+ ).execute(&pool).await?;+ let raw = serde_json::to_value(snapshot())?;+ assert!(raw["message"].get("sender_email").is_none());+ let legacy: SendSnapshot = serde_json::from_value(raw)?;+ let mut replay = prepared();+ replay.snapshot = legacy;+ let replayed = repo.admit_send(&actor(), link(), attempt, replay).await?;+ assert!(!replayed.transitioned);+ assert_eq!(replayed.message_id, admitted.message_id);+ assert_eq!(+ replayed.send_time.unwrap().timestamp_micros(),+ admitted.send_time.unwrap().timestamp_micros(),+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn native_provider_attachments_are_part_of_the_approved_send(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let native = Uuid::parse_str("00000000-0000-0000-0000-00000000aa99")?;+ sqlx::query!("INSERT INTO email_attachments(id,message_id,provider_attachment_id,filename,mime_type,size_bytes) VALUES($1,$2,'native-file','native.txt','text/plain',4)", native, message()).execute(&pool).await?;+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ assert!(matches!(+ repo.admit_send(&actor(), link(), attempt, prepared()).await,+ Err(EmailErr::InvalidSendSnapshot(_))+ ));+ let mut approved = prepared();+ approved.snapshot.forwarded_attachment_ids = vec![native];+ let admitted = repo.admit_send(&actor(), link(), attempt, approved).await?;+ assert_eq!(admitted.status, SendAttemptStatus::Accepted);+ let manifest = sqlx::query_scalar!(+ "SELECT approved_attachments FROM email_scheduled_messages WHERE message_id=$1",+ message()+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(manifest["forwarded"], serde_json::json!([native]));+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn outlook_delivery_stays_with_the_provider_coordinator(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ sqlx::query!(+ "UPDATE email_links SET provider='OUTLOOK' WHERE id=$1",+ link()+ )+ .execute(&pool)+ .await?;+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let result = service(pool.clone())+ .send_email(actor(), link(), attempt, snapshot())+ .await;+ assert!(matches!(result, Err(EmailErr::InvalidSendSnapshot(_))));+ assert!(+ !sqlx::query_scalar!(+ "SELECT EXISTS(SELECT 1 FROM email_send_attempts WHERE attempt_id=$1) AS \"exists!\"",+ attempt.0+ )+ .fetch_one(&pool)+ .await?+ );+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/send_attempt/deferred_deletion.rs b/crates/email/src/outbound/email_pg_repo/test/send_attempt/deferred_deletion.rsnew file mode 100644index 0000000000..4d81b9fe17--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/send_attempt/deferred_deletion.rs@@ -0,0 +1,313 @@+use super::*;+use email_db_client::messages::{+ delete::{delete_db_message, reconcile_deferred_deletion},+ scheduled::delivery,+};++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn deletion_retains_delivery_and_reconciliation_after_submission(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let file = macro_uuid::generate_uuid_v7();+ sqlx::query!("INSERT INTO email_attachments(id,message_id,provider_attachment_id,filename,mime_type,size_bytes) VALUES($1,$2,'approved-file','file.txt','text/plain',4)", file, message()).execute(&pool).await?;+ let mut approved = prepared();+ approved.snapshot.forwarded_attachment_ids = vec![file];+ repo.admit_send(&actor(), link(), attempt, approved).await?;+ sqlx::query!("UPDATE email_scheduled_messages SET send_time=NOW()-INTERVAL '1 minute' WHERE message_id=$1", message()).execute(&pool).await?;+ assert!(!delete_db_message(&pool, message()).await?);+ let claim = delivery::claim_delivery(&pool, link(), message(), 300)+ .await?+ .unwrap();+ assert!(!claim.requires_reconciliation);+ assert!(claim.prepared_content.is_some());+ assert!(delivery::begin_submission(&pool, &claim, 300).await?);+ assert!(!delete_db_message(&pool, message()).await?);+ delivery::pause_delivery(&pool, &claim, true, 0).await?;+ assert!(+ reconcile_deferred_deletion(&pool, link(), message())+ .await?+ .is_none()+ );+ let recovery = delivery::claim_delivery(&pool, link(), message(), 300)+ .await?+ .unwrap();+ assert!(recovery.requires_reconciliation);+ assert_eq!(recovery.message_id_header, claim.message_id_header);+ assert!(recovery.prepared_content.is_some());+ assert_eq!(+ sqlx::query_scalar!("SELECT COUNT(*) FROM email_attachments WHERE id=$1", file)+ .fetch_one(&pool)+ .await?,+ Some(1)+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn failed_send_keeps_recoverable_content_until_cancel(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!(+ "UPDATE email_scheduled_messages SET delivery_status='failed', processing=true WHERE message_id=$1",+ message()+ )+ .execute(&pool)+ .await?;+ assert!(!delete_db_message(&pool, message()).await?);+ assert!(+ reconcile_deferred_deletion(&pool, link(), message())+ .await?+ .is_none()+ );+ assert!(+ sqlx::query_scalar!(+ "SELECT prepared_content IS NOT NULL FROM email_send_attempts WHERE attempt_id=$1",+ attempt.0+ )+ .fetch_one(&pool)+ .await?+ .unwrap()+ );+ repo.cancel_send(&actor(), link(), attempt).await?;+ assert!(+ reconcile_deferred_deletion(&pool, link(), message())+ .await?+ .is_none()+ );+ let restored = repo.send_message_row(link(), message()).await?.unwrap();+ assert!(restored.is_draft);+ assert_eq!(restored.body_text.as_deref(), Some("Editable body"));+ assert_eq!(+ sqlx::query_scalar!("SELECT COUNT(*) FROM email_deferred_message_deletions")+ .fetch_one(&pool)+ .await?,+ Some(0)+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn deferred_deletion_cannot_delete_a_resend_with_the_same_provider_identity(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let first = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), first, prepared()).await?;+ sqlx::query!(+ "UPDATE email_messages SET provider_id='unchanged-provider-id' WHERE id=$1",+ message()+ )+ .execute(&pool)+ .await?;+ assert!(!delete_db_message(&pool, message()).await?);+ repo.cancel_send(&actor(), link(), first).await?;+ let second = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), second, prepared_generation(2))+ .await?;+ assert!(+ reconcile_deferred_deletion(&pool, link(), message())+ .await?+ .is_none()+ );+ assert!(repo.send_message_row(link(), message()).await?.is_some());+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), second, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Accepted+ );+ assert_eq!(+ sqlx::query_scalar!("SELECT COUNT(*) FROM email_deferred_message_deletions")+ .fetch_one(&pool)+ .await?,+ Some(0)+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn terminal_deletion_applies_only_to_the_captured_provider_identity(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!(+ "UPDATE email_messages SET provider_id='provider-draft' WHERE id=$1",+ message()+ )+ .execute(&pool)+ .await?;+ assert!(!delete_db_message(&pool, message()).await?);+ email_db_client::messages::update::mark_message_as_sent(+ &mut *pool.acquire().await?,+ "provider-sent",+ "provider-thread-1",+ link(),+ message(),+ )+ .await?;+ assert!(+ reconcile_deferred_deletion(&pool, link(), message())+ .await?+ .is_none()+ );+ assert!(repo.send_message_row(link(), message()).await?.is_some());+ // A deletion for the confirmed sent identity is still applied normally.+ assert!(delete_db_message(&pool, message()).await?);+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), attempt, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Sent+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn confirmed_delivery_with_unchanged_provider_identity_finishes_deferred_deletion(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!(+ "UPDATE email_messages SET provider_id='provider-message' WHERE id=$1",+ message()+ )+ .execute(&pool)+ .await?;+ assert!(!delete_db_message(&pool, message()).await?);+ email_db_client::messages::update::mark_message_as_sent(+ &mut *pool.acquire().await?,+ "provider-message",+ "provider-thread-1",+ link(),+ message(),+ )+ .await?;+ assert!(+ reconcile_deferred_deletion(&pool, link(), message())+ .await?+ .is_some()+ );+ assert!(repo.send_message_row(link(), message()).await?.is_none());+ assert!(+ reconcile_deferred_deletion(&pool, link(), message())+ .await?+ .is_none()+ );+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), attempt, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Sent+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn explicit_inbox_removal_revokes_authority_without_blocking_the_parent_cascade(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ repo.admit_send(+ &actor(),+ link(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ prepared(),+ )+ .await?;+ assert!(!delete_db_message(&pool, message()).await?);+ sqlx::query!("DELETE FROM email_links WHERE id=$1", link())+ .execute(&pool)+ .await?;+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT COUNT(*) FROM email_send_attempts WHERE link_id=$1",+ link()+ )+ .fetch_one(&pool)+ .await?,+ Some(0)+ );+ assert_eq!(+ sqlx::query_scalar!("SELECT COUNT(*) FROM email_deferred_message_deletions")+ .fetch_one(&pool)+ .await?,+ Some(0)+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn explicit_inbox_purge_removes_an_accepted_send_and_its_retained_deletion(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ repo.admit_send(+ &actor(),+ link(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ prepared(),+ )+ .await?;+ assert!(!delete_db_message(&pool, message()).await?);+ let summary = email_db_client::links::delete::purge_link(+ &pool,+ link(),+ email_db_client::links::delete::PurgeBatchSizes::default(),+ )+ .await?;+ // The fixture has four messages in this inbox and one in a second inbox.+ assert_eq!(summary.messages, 4);+ assert!(summary.link_deleted);+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT COUNT(*) FROM email_send_attempts WHERE link_id=$1",+ link()+ )+ .fetch_one(&pool)+ .await?,+ Some(0)+ );+ assert_eq!(+ sqlx::query_scalar!("SELECT COUNT(*) FROM email_deferred_message_deletions")+ .fetch_one(&pool)+ .await?,+ Some(0)+ );+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/send_attempt/inbox_move.rs b/crates/email/src/outbound/email_pg_repo/test/send_attempt/inbox_move.rsnew file mode 100644index 0000000000..208378671a--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/send_attempt/inbox_move.rs@@ -0,0 +1,310 @@+use super::*;++fn destination() -> Uuid {+ Uuid::parse_str("cccccccc-cccc-cccc-cccc-cccccccccccc").unwrap()+}++fn send_snapshot() -> SendSnapshot {+ let mut input = snapshot();+ input.message.to.push(ContactInfo {+ email: "[email protected]".into(),+ name: None,+ photo_url: None,+ });+ input+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn offline_inbox_change_moves_uploaded_attachments_with_admission(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let service = service(pool.clone());+ let attachment = macro_uuid::generate_uuid_v7();+ sqlx::query!(+ r#"INSERT INTO email_attachments_drafts (id, draft_id, file_name, content_type, sha, size, s3_key)+ VALUES ($1, $2, 'approved.txt', 'text/plain', 'sha', 3, 'approved-bytes')"#,+ attachment,+ message(),+ )+ .execute(&pool)+ .await?;+ let mut input = send_snapshot();+ input.attachment_ids.push(attachment);+ // Offline autosave is suppressed by the send. Admission must apply the+ // selected inbox directly to the existing source draft, including uploads.+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let admitted = service+ .send_email(actor(), destination(), attempt, input.clone())+ .await?;+ assert_eq!(admitted.status, SendAttemptStatus::Accepted);+ assert_eq!(admitted.message_id, Some(message()));+ let replay = service+ .send_email(actor(), destination(), attempt, input.clone())+ .await?;+ assert_eq!(replay.message_id, admitted.message_id);+ assert_eq!(+ replay.send_time.unwrap().timestamp_micros(),+ admitted.send_time.unwrap().timestamp_micros()+ );+ let row = sqlx::query!(+ r#"SELECT m.link_id, m.thread_id, m.provider_thread_id, l.email_address,+ a.id AS attachment_id, a.s3_key FROM email_messages m+ JOIN email_links l ON l.id = m.link_id+ JOIN email_attachments_drafts a ON a.draft_id = m.id WHERE m.id = $1"#,+ message(),+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(row.link_id, destination());+ assert_eq!(row.email_address, "[email protected]");+ assert_ne!(row.thread_id, input.message.thread_db_id.unwrap());+ assert!(row.provider_thread_id.is_none());+ assert_eq!(row.attachment_id, attachment);+ assert_eq!(row.s3_key, "approved-bytes");+ assert_eq!(+ EmailPgRepo::new(pool.clone())+ .message_id_for_client_draft_id(message(), &[destination()])+ .await?,+ Some(message())+ );+ // Cancellation restores an editable draft in the selected inbox. A later+ // send can switch back without stale aliases or attachment loss.+ assert_eq!(+ service+ .cancel_email_send(actor(), destination(), attempt)+ .await?+ .status,+ SendAttemptStatus::Cancelled+ );+ input.message.draft_generation = 2;+ let second = service+ .send_email(+ actor(),+ link(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ input,+ )+ .await?;+ assert_eq!(second.status, SendAttemptStatus::Accepted);+ assert_eq!(second.message_id, Some(message()));+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT link_id FROM email_messages WHERE id = $1",+ message()+ )+ .fetch_one(&pool)+ .await?,+ link()+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn rejected_attachment_set_rolls_back_the_inbox_move(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let mut input = send_snapshot();+ input.attachment_ids.push(macro_uuid::generate_uuid_v7());+ assert!(matches!(+ service(pool.clone())+ .send_email(+ actor(),+ destination(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ input+ )+ .await,+ Err(EmailErr::InvalidSendSnapshot(_))+ ));+ let row = sqlx::query!(+ "SELECT link_id, thread_id, is_draft, subject FROM email_messages WHERE id = $1",+ message(),+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(row.link_id, link());+ assert_eq!(row.thread_id, snapshot().message.thread_db_id.unwrap());+ assert!(row.is_draft);+ assert_eq!(row.subject.as_deref(), Some("Re: Hello World"));+ assert_eq!(+ sqlx::query_scalar!("SELECT COUNT(*) FROM email_send_attempts")+ .fetch_one(&pool)+ .await?,+ Some(0)+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn inbox_move_preserves_approved_forwarded_files(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let attachment = macro_uuid::generate_uuid_v7();+ let source = Uuid::parse_str("ee000001-0000-0000-0000-000000000001")?;+ sqlx::query!(+ r#"INSERT INTO email_attachments (id, message_id, provider_attachment_id, filename, mime_type, size_bytes)+ VALUES ($1, $2, 'provider-attachment', 'forward.txt', 'text/plain', 3)"#,+ attachment,+ source,+ )+ .execute(&pool)+ .await?;+ sqlx::query!(+ "INSERT INTO email_attachments_fwd (message_id, attachment_id) VALUES ($1, $2)",+ message(),+ attachment,+ )+ .execute(&pool)+ .await?;+ let mut input = send_snapshot();+ input.forwarded_attachment_ids.push(attachment);+ let admitted = service(pool.clone())+ .send_email(+ actor(),+ destination(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ input,+ )+ .await?;+ assert_eq!(admitted.status, SendAttemptStatus::Accepted);+ assert_eq!(admitted.message_id, Some(message()));+ let retained = sqlx::query!(+ r#"SELECT m.link_id, f.attachment_id FROM email_messages m+ JOIN email_attachments_fwd f ON f.message_id = m.id WHERE m.id = $1"#,+ message(),+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(retained.link_id, destination());+ assert_eq!(retained.attachment_id, attachment);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn concurrent_inbox_sends_admit_one_delivery(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let service = service(pool.clone());+ let (original, moved) = tokio::join!(+ service.send_email(+ actor(),+ link(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ send_snapshot()+ ),+ service.send_email(+ actor(),+ destination(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ send_snapshot()+ ),+ );+ assert_eq!(+ usize::from(original.is_ok()) + usize::from(moved.is_ok()),+ 1+ );+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT COUNT(*) FROM email_scheduled_messages WHERE message_id = $1",+ message()+ )+ .fetch_one(&pool)+ .await?,+ Some(1)+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn inbox_move_does_not_replace_an_existing_destination_reply(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ sqlx::query!(+ r#"UPDATE email_messages SET headers_jsonb = $1 WHERE id = $2"#,+ serde_json::json!([{"Macro-In-Reply-To": "ee000001-0000-0000-0000-000000000001"}]),+ Uuid::parse_str("ee000005-0000-0000-0000-000000000005")?,+ )+ .execute(&pool)+ .await?;+ let mut input = send_snapshot();+ input.message.replying_to_id = Some(Uuid::parse_str("ee000001-0000-0000-0000-000000000001")?);+ let admitted = service(pool.clone())+ .send_email(+ actor(),+ destination(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ input,+ )+ .await?;+ assert_eq!(admitted.status, SendAttemptStatus::Accepted);+ assert_eq!(admitted.message_id, Some(message()));+ let drafts = sqlx::query!(+ "SELECT id, link_id, subject, is_draft FROM email_messages WHERE id = ANY($1) ORDER BY id",+ &[+ message(),+ Uuid::parse_str("ee000005-0000-0000-0000-000000000005")?+ ],+ )+ .fetch_all(&pool)+ .await?;+ assert_eq!(drafts.len(), 2);+ assert_eq!(drafts[0].id, message());+ assert_eq!(drafts[0].link_id, destination());+ assert_eq!(drafts[0].subject.as_deref(), Some("Approved snapshot"));+ assert_eq!(drafts[1].link_id, destination());+ assert_eq!(drafts[1].subject.as_deref(), Some("Re: Hello World"));+ assert!(drafts[1].is_draft);+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT COUNT(*) FROM email_scheduled_messages WHERE message_id = $1",+ drafts[1].id+ )+ .fetch_one(&pool)+ .await?,+ Some(0)+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn deferred_moved_send_keeps_the_source_inbox_autosave_fence(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ service(pool.clone())+ .send_email(+ actor(),+ destination(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ send_snapshot(),+ )+ .await?;+ email_db_client::messages::delete::delete_db_message(&pool, message()).await?;+ let stale = prepared();+ let repo = EmailPgRepo::new(pool);+ assert!(+ repo.insert_message(&stale.message, &stale.contacts, link(), None, true)+ .await?+ .is_none()+ );+ assert!(repo.send_message_row(link(), message()).await?.is_none());+ assert!(+ repo.send_message_row(destination(), message())+ .await?+ .is_some()+ );+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/send_attempt/independent_outbox.rs b/crates/email/src/outbound/email_pg_repo/test/send_attempt/independent_outbox.rsnew file mode 100644index 0000000000..78926623e9--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/send_attempt/independent_outbox.rs@@ -0,0 +1,257 @@+use super::*;+use crate::domain::draft_attachments::{+ AttachmentChange, AttachmentError, DraftAttachmentRepository, RemovalKind,+};+use crate::domain::scheduled::{EmailSchedulingRepo, ScheduleChange};++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn cancelled_send_fences_old_saves_deletes_attachments_and_schedules(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ assert!(matches!(+ service(pool.clone())+ .save_draft_for_user_impl(actor(), Some(link()), snapshot().message)+ .await,+ Err(EmailErr::MessageDeliveryConflict(_))+ ));+ let pending_autosave = prepared();+ assert!(matches!(+ repo.insert_message(+ &pending_autosave.message,+ &pending_autosave.contacts,+ link(),+ None,+ true+ )+ .await,+ Err(EmailErr::DraftGenerationConflict(_))+ ));+ repo.cancel_send(&actor(), link(), attempt).await?;+ let generation = sqlx::query_scalar!(+ "SELECT draft_generation FROM email_messages WHERE id=$1",+ message()+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(generation, 2);+ assert!(matches!(+ service(pool.clone())+ .save_draft_for_user_impl(actor(), Some(link()), snapshot().message)+ .await,+ Err(EmailErr::DraftGenerationConflict(_))+ ));+ let mut stale = prepared();+ stale.message.body_text = Some("Old autosave".into());+ assert!(matches!(+ repo.insert_message(&stale.message, &stale.contacts, link(), None, true)+ .await,+ Err(EmailErr::DraftGenerationConflict(_))+ ));+ assert!(+ repo.delete_draft_message(+ message(),+ stale.message.thread_db_id,+ &[link()],+ Some(actor().as_ref()),+ 0+ )+ .await?+ .is_none()+ );+ assert!(+ repo.change_schedule(+ link(),+ message(),+ &actor(),+ ScheduleChange::Set(Utc::now() + chrono::Duration::hours(1)),+ None,+ 0+ )+ .await+ .is_err()+ );+ let remove = || AttachmentChange::Remove {+ attachment_id: Uuid::new_v4(),+ kind: RemovalKind::UploadedOrNative,+ };+ assert!(matches!(+ repo.commit_attachment_change(actor().as_ref(), link(), message(), remove(), 0)+ .await,+ Err(AttachmentError::DeliveryConflict)+ ));+ stale.message.draft_generation = generation;+ stale.message.body_text = Some("New edit after Undo".into());+ assert!(+ repo.insert_message(&stale.message, &stale.contacts, link(), None, true)+ .await?+ .is_some()+ );+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT body_text FROM email_messages WHERE id=$1",+ message()+ )+ .fetch_one(&pool)+ .await?+ .as_deref(),+ Some("New edit after Undo")+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn send_later_deadline_is_part_of_immutable_approval(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool);+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let deadline = Utc::now() + chrono::Duration::days(2);+ let mut input = prepared();+ input.snapshot.message.send_time = Some(deadline);+ let snapshot = input.snapshot.clone();+ let first = repo.admit_send(&actor(), link(), attempt, input).await?;+ assert_eq!(first.send_time, Some(deadline));+ let recovered = repo+ .read_send_attempt(&actor(), link(), attempt, Some(&snapshot))+ .await?+ .unwrap();+ assert_eq!(+ recovered.send_time.unwrap().timestamp_micros(),+ deadline.timestamp_micros()+ );+ let mut changed = snapshot;+ changed.message.send_time = Some(deadline + chrono::Duration::seconds(1));+ assert!(matches!(+ repo.read_send_attempt(&actor(), link(), attempt, Some(&changed))+ .await,+ Err(EmailErr::SendAttemptConflict)+ ));+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn pending_sends_are_scoped_to_actor_inbox_and_cursor(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool);+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ let rows = repo+ .pending_send_attempts(&actor(), &[link()], None)+ .await?;+ assert_eq!(rows.len(), 1);+ assert_eq!(rows[0].0.attempt_id, attempt.0);+ assert!(+ repo.pending_send_attempts(&actor(), &[], None)+ .await?+ .is_empty()+ );+ let other = MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap();+ assert!(+ repo.pending_send_attempts(&other, &[link()], None)+ .await?+ .is_empty()+ );+ assert!(+ repo.pending_send_attempts(&actor(), &[link()], Some(&rows[0].0))+ .await?+ .is_empty()+ );+ repo.cancel_send(&actor(), link(), attempt).await?;+ assert!(+ repo.pending_send_attempts(&actor(), &[link()], None)+ .await?+ .is_empty()+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn outlook_ambiguous_submission_cannot_be_cancelled_or_reapproved(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ sqlx::query!(+ "UPDATE email_links SET provider='OUTLOOK' WHERE id=$1",+ link()+ )+ .execute(&pool)+ .await?;+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!("UPDATE email_mailbox_drafts SET state='failed', error_code='send_unknown', checkpoint=jsonb_build_object('stage','confirming') WHERE message_id=$1", message()).execute(&pool).await?;+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), attempt, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::DeliveryUnconfirmed+ );+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::DeliveryUnconfirmed+ );+ assert!(+ repo.admit_send(+ &actor(),+ link(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ prepared()+ )+ .await+ .is_err()+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn outlook_cancel_revokes_the_prepared_provider_revision(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ sqlx::query!(+ "UPDATE email_links SET provider='OUTLOOK' WHERE id=$1",+ link()+ )+ .execute(&pool)+ .await?;+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ let before = sqlx::query_scalar!(+ "SELECT revision FROM email_mailbox_drafts WHERE message_id=$1",+ message()+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::Cancelled+ );+ let restored = sqlx::query!("SELECT revision, desired_content->>'body_text' AS body, desired_content->>'send_time' AS send_time FROM email_mailbox_drafts WHERE message_id=$1", message()).fetch_one(&pool).await?;+ assert!(restored.revision > before);+ assert_eq!(restored.body.as_deref(), Some("Editable body"));+ assert!(restored.send_time.is_none());+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/send_attempt/preparation_cancel.rs b/crates/email/src/outbound/email_pg_repo/test/send_attempt/preparation_cancel.rsnew file mode 100644index 0000000000..3091c25b29--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/send_attempt/preparation_cancel.rs@@ -0,0 +1,228 @@+use super::*;+use crate::domain::scheduled::{EmailSchedulingRepo, ScheduleChange};+use email_db_client::messages::scheduled::delivery::{+ DeliveryClaim, begin_submission, claim_delivery, pause_delivery, release_preparation,+};++async fn admit_and_claim(pool: &Pool<Postgres>) -> anyhow::Result<(SendAttemptId, DeliveryClaim)> {+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let generation = sqlx::query_scalar!(+ "SELECT draft_generation FROM email_messages WHERE id=$1",+ message()+ )+ .fetch_one(pool)+ .await?;+ let mut input = prepared_generation(generation);+ input.undo_delay_secs = 0;+ EmailPgRepo::new(pool.clone())+ .admit_send(&actor(), link(), attempt, input)+ .await?;+ let claim = claim_delivery(pool, link(), message(), 300)+ .await?+ .expect("due send must be claimable");+ Ok((attempt, claim))+}++async fn expire(pool: &Pool<Postgres>) -> anyhow::Result<()> {+ sqlx::query!(+ "UPDATE email_scheduled_messages SET delivery_lease_expires_at = NOW() - INTERVAL '1 second', updated_at = NOW() - INTERVAL '1 day' WHERE message_id = $1",+ message(),+ ).execute(pool).await?;+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn active_backed_off_and_expired_preparation_can_be_cancelled(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ for backoff in [None, Some(false), Some(true)] {+ let (attempt, claim) = admit_and_claim(&pool).await?;+ if let Some(expired) = backoff {+ release_preparation(&pool, &claim, 300).await?;+ if expired {+ expire(&pool).await?;+ }+ }+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), attempt, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Accepted,+ "managed preparation must expose cancellation during {backoff:?}"+ );+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::Cancelled+ );+ assert!(!begin_submission(&pool, &claim, 300).await?);+ release_preparation(&pool, &claim, 300).await?;+ pause_delivery(&pool, &claim, true, 300).await?;+ let restored = sqlx::query!(+ "SELECT is_draft, body_text FROM email_messages WHERE id = $1",+ message(),+ )+ .fetch_one(&pool)+ .await?;+ assert!(restored.is_draft);+ assert_eq!(restored.body_text.as_deref(), Some("Editable body"));+ assert!(+ claim_delivery(&pool, link(), message(), 300)+ .await?+ .is_none()+ );++ // Reusing the draft creates a different delivery authority. The cancelled+ // worker must not revive itself against the replacement schedule.+ let (replacement, next_claim) = admit_and_claim(&pool).await?;+ assert!(!begin_submission(&pool, &claim, 300).await?);+ assert_ne!(claim.token, next_claim.token);+ repo.cancel_send(&actor(), link(), replacement).await?;+ }+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn schedule_cancellation_fences_managed_preparation_during_backoff(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ for expired in [false, true] {+ let (attempt, claim) = admit_and_claim(&pool).await?;+ release_preparation(&pool, &claim, 300).await?;+ if expired {+ expire(&pool).await?;+ }+ assert!(matches!(+ repo.change_schedule(+ link(),+ message(),+ &actor(),+ ScheduleChange::Set(Utc::now() + chrono::Duration::hours(1)),+ None,+ 0+ )+ .await,+ Err(EmailErr::MessageDeliveryConflict(_))+ ));+ assert!(+ repo.change_schedule(link(), message(), &actor(), ScheduleChange::Cancel, None, 0)+ .await+ .is_err()+ );+ repo.cancel_send(&actor(), link(), attempt).await?;+ assert!(!begin_submission(&pool, &claim, 300).await?);+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), attempt, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Cancelled+ );+ }+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn submitted_delivery_remains_locked_after_lease_expiry(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let (attempt, claim) = admit_and_claim(&pool).await?;+ assert!(begin_submission(&pool, &claim, 300).await?);+ expire(&pool).await?;+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::Sending+ );+ assert!(matches!(+ repo.change_schedule(link(), message(), &actor(), ScheduleChange::Cancel, None, 0)+ .await,+ Err(EmailErr::MessageDeliveryConflict(_))+ ));+ let recovered = claim_delivery(&pool, link(), message(), 300)+ .await?+ .unwrap();+ assert!(recovered.requires_reconciliation);+ pause_delivery(&pool, &recovered, true, 300).await?;+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::DeliveryUnconfirmed+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn expired_legacy_claim_cannot_be_mistaken_for_safe_preparation(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!(+ "UPDATE email_scheduled_messages SET processing = true WHERE message_id = $1",+ message(),+ )+ .execute(&pool)+ .await?;+ expire(&pool).await?;+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ SendAttemptStatus::Sending+ );+ assert!(matches!(+ repo.change_schedule(link(), message(), &actor(), ScheduleChange::Cancel, None, 0)+ .await,+ Err(EmailErr::MessageDeliveryConflict(_))+ ));+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn cancellation_and_submission_race_has_exactly_one_winner(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ for _ in 0..12 {+ let (attempt, claim) = admit_and_claim(&pool).await?;+ let caller = actor();+ let (cancelled, submitted) = tokio::join!(+ repo.cancel_send(&caller, link(), attempt),+ begin_submission(&pool, &claim, 300),+ );+ let cancelled = cancelled?;+ if submitted? {+ assert_eq!(cancelled.status, SendAttemptStatus::Sending);+ // A definite provider rejection makes another attempt safe.+ pause_delivery(&pool, &claim, false, 300).await?;+ repo.cancel_send(&caller, link(), attempt).await?;+ } else {+ assert_eq!(cancelled.status, SendAttemptStatus::Cancelled);+ }+ assert_eq!(+ repo.read_send_attempt(&caller, link(), attempt, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Cancelled+ );+ }+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/send_attempt/provider_deletion.rs b/crates/email/src/outbound/email_pg_repo/test/send_attempt/provider_deletion.rsnew file mode 100644index 0000000000..169fb21144--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/send_attempt/provider_deletion.rs@@ -0,0 +1,112 @@+use super::*;+use email_db_client::messages::{+ delete::{MessageDeletion, delete_message_with_tx, reconcile_deferred_deletion},+ get_simple_messages::get_simple_message_by_provider_and_link_for_update,+};++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn provider_delete_lookup_locks_the_snapshot_until_deletion_is_deferred(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!(+ "UPDATE email_messages SET provider_id='provider-draft' WHERE id=$1",+ message(),+ )+ .execute(&pool)+ .await?;++ let mut deletion = pool.begin().await?;+ let snapshot = get_simple_message_by_provider_and_link_for_update(+ &mut deletion,+ "provider-draft",+ &link(),+ )+ .await?+ .expect("provider draft exists");+ // Completion and cancellation acquire this same row lock. NOWAIT proves+ // they cannot change the captured identity/lifetime before DELETE, without+ // timing-dependent sleeps or polling for a blocked worker.+ let blocked = sqlx::query!(+ "SELECT id FROM email_messages WHERE id=$1 FOR UPDATE NOWAIT",+ message(),+ )+ .fetch_one(&pool)+ .await+ .expect_err("the provider lookup must retain the row lock");+ assert_eq!(+ blocked+ .as_database_error()+ .and_then(|error| error.code())+ .as_deref(),+ Some("55P03")+ );+ assert_eq!(+ delete_message_with_tx(&mut deletion, &snapshot).await?,+ MessageDeletion::Deferred+ );+ deletion.commit().await?;++ // Undo can now advance the lifetime while retaining the provider identity.+ // Cleanup of the earlier deletion must preserve the restored draft.+ repo.cancel_send(&actor(), link(), attempt).await?;+ assert!(+ reconcile_deferred_deletion(&pool, link(), message())+ .await?+ .is_none()+ );+ let restored = repo.send_message_row(link(), message()).await?.unwrap();+ assert!(restored.is_draft);+ assert_eq!(restored.provider_id.as_deref(), Some("provider-draft"));+ assert_eq!(restored.draft_generation, 2);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn provider_delete_lookup_does_not_adopt_a_replacement_sent_identity(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ sqlx::query!(+ "UPDATE email_messages SET provider_id='provider-draft' WHERE id=$1",+ message(),+ )+ .execute(&pool)+ .await?;+ email_db_client::messages::update::mark_message_as_sent(+ &mut *pool.acquire().await?,+ "provider-sent",+ "provider-thread-1",+ link(),+ message(),+ )+ .await?;++ let mut deletion = pool.begin().await?;+ assert!(+ get_simple_message_by_provider_and_link_for_update(+ &mut deletion,+ "provider-draft",+ &link(),+ )+ .await?+ .is_none()+ );+ deletion.commit().await?;+ let sent = repo.send_message_row(link(), message()).await?.unwrap();+ assert!(sent.is_sent);+ assert_eq!(sent.provider_id.as_deref(), Some("provider-sent"));+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/send_attempt/provider_draft_trash.rs b/crates/email/src/outbound/email_pg_repo/test/send_attempt/provider_draft_trash.rsnew file mode 100644index 0000000000..58755ff83b--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/send_attempt/provider_draft_trash.rs@@ -0,0 +1,154 @@+use super::*;+use email_db_client::messages::{+ get::fetch_messages_metadata, insert::insert_message, scheduled::get::get_scheduled_message,+};++async fn echo_then_trash(+ pool: &Pool<Postgres>,+ legacy: bool,+) -> anyhow::Result<(EmailPgRepo, SendAttemptId)> {+ let repo = EmailPgRepo::new(pool.clone());+ let thread = prepared().message.thread_db_id;+ let mut echo = fetch_messages_metadata(&mut *pool.acquire().await?, thread)+ .await?+ .into_iter()+ .find(|row| row.db_id == message())+ .unwrap();+ echo.provider_id = Some("gmail-draft-provider-id".into());+ echo.is_draft = true;+ echo.is_sent = false;+ echo.subject = Some("Provider draft echo".into());+ echo.body_text = Some("Provider draft body".into());+ echo.body_html_sanitized = Some("<p>Provider draft body</p>".into());+ let first = SendAttemptId(macro_uuid::generate_uuid_v7());+ let mut input = prepared();+ input.undo_delay_secs = 120;+ input.message.provider_id = echo.provider_id.clone();+ input.snapshot.message.provider_id = echo.provider_id.clone();+ input.message.provider_thread_id = echo.provider_thread_id.clone();+ input.snapshot.message.provider_thread_id = echo.provider_thread_id.clone();+ repo.admit_send(&actor(), link(), first, input).await?;+ assert!(+ !repo+ .get_simple_message(message(), &[link()])+ .await?+ .unwrap()+ .is_draft+ );+ // The same production path used by inbox synchronization, not a direct flag UPDATE.+ insert_message(pool, thread, &mut echo, link(), true).await?;+ assert!(+ repo.get_simple_message(message(), &[link()])+ .await?+ .unwrap()+ .is_draft+ );+ if legacy {+ // Older trash implementations removed the schedule without retiring its attempt.+ email_db_client::messages::scheduled::delete::delete_scheduled_message(+ pool,+ link(),+ message(),+ )+ .await?;+ } else {+ assert_eq!(+ repo.delete_scheduled_messages_batch(&[message()], link())+ .await?,+ vec![message()]+ );+ }+ Ok((repo, first))+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn trashing_a_provider_echoed_send_retires_its_attempt(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let (repo, first) = echo_then_trash(&pool, false).await?;+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), first, None)+ .await?+ .unwrap()+ .status,+ SendAttemptStatus::Cancelled,+ "Trash revoked delivery but left the original send attempt active"+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn cancel_of_trashed_provider_draft_cannot_cancel_its_replacement(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ preserve_replacement(pool, false, false).await+}++async fn preserve_replacement(+ pool: Pool<Postgres>,+ legacy: bool,+ cancel_newer: bool,+) -> anyhow::Result<()> {+ let (repo, first) = echo_then_trash(&pool, legacy).await?;+ // A second device sees an editable, unscheduled draft and explicitly sends new content.+ let second = SendAttemptId(macro_uuid::generate_uuid_v7());+ let mut newer = prepared_generation(1);+ // Delivery deadlines do not define ownership: newer sends may have shorter delays.+ newer.undo_delay_secs = 5;+ newer.message.subject = "Second explicit send".into();+ newer.snapshot.message.subject = newer.message.subject.clone();+ newer.message.body_text = Some("Approved second body".into());+ newer.snapshot.message.body_text = newer.message.body_text.clone();+ newer.message.provider_id = Some("gmail-draft-provider-id".into());+ newer.snapshot.message.provider_id = newer.message.provider_id.clone();+ repo.admit_send(&actor(), link(), second, newer).await?;+ assert!(+ get_scheduled_message(&pool, link(), message())+ .await?+ .is_some()+ );+ if cancel_newer {+ repo.cancel_send(&actor(), link(), second).await?;+ }+ let before = repo.send_message_row(link(), message()).await?.unwrap();+ // A delayed Undo from the first device must not revoke that second Send.+ repo.cancel_send(&actor(), link(), first).await?;+ let schedule = get_scheduled_message(&pool, link(), message()).await?;+ let row = repo.send_message_row(link(), message()).await?.unwrap();+ assert!(+ schedule.is_some() == !cancel_newer+ && row.body_text == before.body_text+ && row.is_draft == before.is_draft,+ "Old cancellation changed a newer send: schedule_present={}, body={:?}, is_draft={}",+ schedule.is_some(),+ row.body_text,+ row.is_draft+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn legacy_orphan_cancellation_preserves_newer_send(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ preserve_replacement(pool, true, false).await+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn legacy_orphan_cancellation_preserves_newer_cancelled_draft(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ preserve_replacement(pool, true, true).await+}diff --git a/crates/email/src/outbound/email_pg_repo/test/send_attempt/retention.rs b/crates/email/src/outbound/email_pg_repo/test/send_attempt/retention.rsnew file mode 100644index 0000000000..9b6f717485--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/send_attempt/retention.rs@@ -0,0 +1,106 @@+use super::*;++async fn assert_compacted(pool: &Pool<Postgres>, attempt: SendAttemptId) -> anyhow::Result<()> {+ let row = sqlx::query!(+ "SELECT request, prepared_content, restore_body_html, restore_body_text, restore_body_macro FROM email_send_attempts WHERE attempt_id = $1",+ attempt.0,+ ).fetch_one(pool).await?;+ let request = row+ .request+ .expect("admitted attempt retains its approval digest");+ assert_eq!(request.as_object().unwrap().len(), 1);+ assert_eq!(request["_send_approval"]["version"], 2);+ assert!(row.prepared_content.is_none());+ assert!(row.restore_body_html.is_none());+ assert!(row.restore_body_text.is_none());+ assert!(row.restore_body_macro.is_none());+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn cancellation_and_delivery_clear_content_without_losing_replay_identity(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let cancelled = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), cancelled, prepared())+ .await?;+ repo.cancel_send(&actor(), link(), cancelled).await?;+ assert_compacted(&pool, cancelled).await?;+ let body = sqlx::query_scalar!(+ "SELECT body_text FROM email_messages WHERE id = $1",+ message()+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(body.as_deref(), Some("Editable body"));+ assert_eq!(+ repo.admit_send(&actor(), link(), cancelled, prepared())+ .await?+ .status,+ SendAttemptStatus::Cancelled+ );++ let sent = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), sent, prepared_generation(2))+ .await?;+ email_db_client::messages::update::mark_message_as_sent(+ &mut *pool.acquire().await?,+ "provider-message",+ "provider-thread-1",+ link(),+ message(),+ )+ .await?;+ assert_compacted(&pool, sent).await?;+ assert_eq!(+ repo.admit_send(&actor(), link(), sent, prepared_generation(2))+ .await?+ .status,+ SendAttemptStatus::Sent+ );+ for attempt in [cancelled, sent] {+ let mut changed = prepared();+ changed.snapshot.message.body_text = Some("Changed content".into());+ assert!(matches!(+ repo.admit_send(&actor(), link(), attempt, changed).await,+ Err(EmailErr::SendAttemptConflict)+ ));+ }+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn deleting_an_active_message_retains_delivery_content_and_job(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ repo.admit_send(&actor(), link(), attempt, prepared())+ .await?;+ assert!(!email_db_client::messages::delete::delete_db_message(&pool, message()).await?);+ let retained = sqlx::query!(+ "SELECT a.prepared_content, s.message_id FROM email_send_attempts a JOIN email_scheduled_messages s ON s.message_id=a.message_id WHERE a.attempt_id=$1",+ attempt.0,+ ).fetch_one(&pool).await?;+ assert!(retained.prepared_content.is_some());+ assert_eq!(retained.message_id, message());+ let replay = repo+ .admit_send(&actor(), link(), attempt, prepared())+ .await?;+ assert!(!replay.transitioned);+ assert!(repo.send_message_row(link(), message()).await?.is_some());+ let mut changed = prepared();+ changed.snapshot.message.subject.push('!');+ assert!(matches!(+ repo.admit_send(&actor(), link(), attempt, changed).await,+ Err(EmailErr::SendAttemptConflict)+ ));+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/send_attempt/trash.rs b/crates/email/src/outbound/email_pg_repo/test/send_attempt/trash.rsnew file mode 100644index 0000000000..4e51243e1d--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/send_attempt/trash.rs@@ -0,0 +1,107 @@+use super::*;+use email_db_client::messages::scheduled::delivery::{+ begin_submission, claim_delivery, pause_delivery,+};++async fn preserve_attempt(pool: Pool<Postgres>, unconfirmed: bool) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let cached = repo+ .get_simple_message(message(), &[link()])+ .await?+ .unwrap();+ assert!(cached.is_draft);+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let mut input = prepared();+ input.undo_delay_secs = 0;+ repo.admit_send(&actor(), link(), attempt, input).await?;+ let claim = claim_delivery(&pool, link(), message(), 300)+ .await?+ .unwrap();+ assert!(begin_submission(&pool, &claim, 300).await?);+ if unconfirmed {+ pause_delivery(&pool, &claim, true, 300).await?;+ }+ // The trash caller retained a draft snapshot from before admission.+ assert!(+ repo.delete_scheduled_messages_batch(&[cached.db_id], link())+ .await?+ .is_empty()+ );+ let expected = if unconfirmed {+ SendAttemptStatus::DeliveryUnconfirmed+ } else {+ SendAttemptStatus::Sending+ };+ assert_eq!(+ repo.read_send_attempt(&actor(), link(), attempt, None)+ .await?+ .unwrap()+ .status,+ expected+ );+ assert_eq!(+ repo.cancel_send(&actor(), link(), attempt).await?.status,+ expected+ );+ assert!(+ !repo+ .get_simple_message(message(), &[link()])+ .await?+ .unwrap()+ .is_draft+ );+ assert!(+ repo.admit_send(+ &actor(),+ link(),+ SendAttemptId(macro_uuid::generate_uuid_v7()),+ prepared()+ )+ .await+ .is_err()+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn trash_preserves_submitted_attempt(pool: Pool<Postgres>) -> anyhow::Result<()> {+ preserve_attempt(pool, false).await+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn trash_preserves_unconfirmed_attempt(pool: Pool<Postgres>) -> anyhow::Result<()> {+ preserve_attempt(pool, true).await+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn trash_rechecks_draft_state_after_admission(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let repo = EmailPgRepo::new(pool.clone());+ let cached = repo+ .get_simple_message(message(), &[link()])+ .await?+ .unwrap();+ assert!(cached.is_draft);+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let mut input = prepared();+ input.undo_delay_secs = 0;+ repo.admit_send(&actor(), link(), attempt, input).await?;+ let claim = claim_delivery(&pool, link(), message(), 300)+ .await?+ .unwrap();+ assert!(+ repo.delete_scheduled_messages_batch(&[cached.db_id], link())+ .await?+ .is_empty()+ );+ assert!(begin_submission(&pool, &claim, 300).await?);+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/senders.rs b/crates/email/src/outbound/email_pg_repo/test/senders.rsindex ce3945da1c..82ebc15f86 100644--- a/crates/email/src/outbound/email_pg_repo/test/senders.rs+++ b/crates/email/src/outbound/email_pg_repo/test/senders.rs@@ -1,5 +1,6 @@use super::*;+mod durable;mod send_window;use crate::domain::{models::{ContactInfo, CreateDraftInput, EmailErr, Link},@@ -31,6 +32,8 @@ fn actor() -> MacroUserIdStr<'static> {fn draft() -> CreateDraftInput {CreateDraftInput {+ frozen_signature_html: None,+ draft_generation: 0,sender_email: Some(EmailStr::try_from("[email protected]".to_owned()).unwrap()),db_id: Some(macro_uuid::generate_uuid_v7()),provider_id: None,diff --git a/crates/email/src/outbound/email_pg_repo/test/senders/durable.rs b/crates/email/src/outbound/email_pg_repo/test/senders/durable.rsnew file mode 100644index 0000000000..c2e98bc60f--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/senders/durable.rs@@ -0,0 +1,60 @@+use super::*;+use crate::domain::send_attempt::{+ EmailSendRepo, EmailSendService, PreparedSendContent, SendAttemptId, SendSnapshot,+};+use email_db_client::messages::scheduled::delivery::claim_delivery;++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../../fixtures", scripts("email_draft"))+)]+async fn durable_send_freezes_the_authorized_alias_through_contact_sync(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let service = super::super::thread_unread::service(pool.clone()).with_sender_provider(Provider);+ let snapshot = SendSnapshot {+ message: draft(),+ attachment_ids: vec![],+ forwarded_attachment_ids: vec![],+ restore_body_html: None,+ restore_body_text: None,+ restore_body_macro: None,+ };+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ let admitted = service+ .send_email(actor(), inbox_id(), attempt, snapshot.clone())+ .await?;+ assert_eq!(+ admitted+ .message+ .as_ref()+ .unwrap()+ .from+ .as_ref()+ .unwrap()+ .email,+ );+ // Provider synchronization may rewrite contacts while the send is queued.+ sqlx::query!("UPDATE email_contacts SET email_address = id::text || '@changed.example', name = 'Changed contact' WHERE link_id = $1", inbox_id()).execute(&pool).await?;+ let claim = claim_delivery(&pool, inbox_id(), admitted.message_id.unwrap(), 300)+ .await?+ .unwrap();+ let content: PreparedSendContent = serde_json::from_value(claim.prepared_content.unwrap())?;+ assert_eq!(content.sender.email, "[email protected]");+ assert_eq!(content.sender.name.as_deref(), Some("Property manager"));+ assert_eq!(+ claim.approved_snapshot.unwrap()["message"]["sender_email"],+ );+ let mut changed = snapshot;+ changed.message.sender_email = Some(EmailStr::try_from("[email protected]".to_owned())?);+ assert!(matches!(+ service+ .email_repo+ .read_send_attempt(&actor(), inbox_id(), attempt, Some(&changed))+ .await,+ Err(EmailErr::SendAttemptConflict)+ ));+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/test/sending_inbox.rs b/crates/email/src/outbound/email_pg_repo/test/sending_inbox.rsindex f8fda3683d..bfa9fc5502 100644--- a/crates/email/src/outbound/email_pg_repo/test/sending_inbox.rs+++ b/crates/email/src/outbound/email_pg_repo/test/sending_inbox.rs@@ -56,6 +56,8 @@ fn reply_to(replying_to_id: Uuid) -> SendingInboxRequest<'static> {fn reply_input(replying_to_id: Uuid) -> CreateDraftInput {CreateDraftInput {+ frozen_signature_html: None,+ draft_generation: 0,db_id: None,provider_id: None,replying_to_id: Some(replying_to_id),diff --git a/crates/email/src/outbound/email_pg_repo/test/signal_flag.rs b/crates/email/src/outbound/email_pg_repo/test/signal_flag.rsindex 8947392376..cd70e671a0 100644--- a/crates/email/src/outbound/email_pg_repo/test/signal_flag.rs+++ b/crates/email/src/outbound/email_pg_repo/test/signal_flag.rs@@ -186,6 +186,7 @@ async fn delete_draft_message_recomputes_thread_metadata(Uuid::parse_str(THREAD_DRAFT_SIGNAL)?,&[Uuid::parse_str(LINK_ID)?],None,+ 0,).await?;@@ -220,6 +221,7 @@ async fn delete_draft_message_returns_sent_thread_out_of_inbox(Uuid::parse_str(THREAD_SENT_DONE)?,&[Uuid::parse_str(LINK_ID)?],None,+ 0,).await?;diff --git a/crates/email/src/outbound/email_pg_repo/test/thread_redirect.rs b/crates/email/src/outbound/email_pg_repo/test/thread_redirect.rsnew file mode 100644index 0000000000..21ed84c1bd--- /dev/null+++ b/crates/email/src/outbound/email_pg_repo/test/thread_redirect.rs@@ -0,0 +1,141 @@+use super::*;+use entity_access::domain::models::{+ AccessLevel, Entity, EntityAccessAuth, EntityAccessReceipt, EntityPermission, EntityType,+ ViewAccessLevel,+};++fn source() -> Uuid {+ uuid::uuid!("33333333-3333-3333-3333-333333333333")+}+fn canonical() -> Uuid {+ uuid::uuid!("11111111-1111-1111-1111-111111111111")+}+fn inbox() -> Uuid {+ uuid::uuid!("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa")+}+async fn alias(pool: &Pool<Postgres>, target: Uuid) -> anyhow::Result<()> {+ sqlx::query!("DELETE FROM email_messages WHERE thread_id = $1", source())+ .execute(pool)+ .await?;+ sqlx::query!(+ "INSERT INTO email_thread_client_ids (client_id, link_id, thread_id) VALUES ($1, $2, $3)",+ source(),+ inbox(),+ target,+ )+ .execute(pool)+ .await?;+ Ok(())+}+fn receipt(auth: EntityAccessAuth, id: Uuid) -> EntityAccessReceipt<ViewAccessLevel> {+ EntityAccessReceipt::try_new(+ auth,+ Entity {+ entity_type: EntityType::EmailThread,+ entity_id: id.to_string(),+ },+ EntityPermission::AccessLevel {+ access_level: AccessLevel::View,+ },+ )+ .unwrap()+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn thread_redirect_requires_independent_inbox_access(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ alias(&pool, canonical()).await?;+ let service = super::thread_unread::service(pool.clone());+ let owner = MacroUserIdStr::try_from_email("[email protected]")?;+ assert_eq!(+ service+ .resolve_thread_read_id_impl(owner.clone(), source())+ .await?,+ canonical()+ );+ let fetched = service+ .get_thread_with_messages_impl(+ receipt(EntityAccessAuth::Authenticated(owner), source()),+ 0,+ 20,+ )+ .await?+ .unwrap();+ assert_eq!(fetched.row.db_id, canonical());+ assert!(!fetched.messages.is_empty());+ // A share to the retained source does not grant the target's other mail.+ for auth in [+ EntityAccessAuth::Authenticated(MacroUserIdStr::try_from_email("[email protected]")?),+ EntityAccessAuth::Unauthenticated,+ ] {+ let fetched = service+ .get_thread_with_messages_impl(receipt(auth, source()), 0, 20)+ .await?+ .unwrap();+ assert_eq!(fetched.row.db_id, source());+ assert!(fetched.messages.is_empty());+ }+ assert_eq!(+ EmailPgRepo::new(pool)+ .redirected_thread_id(source(), &[])+ .await?,+ None+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn thread_redirect_never_crosses_inboxes(pool: Pool<Postgres>) -> anyhow::Result<()> {+ alias(&pool, uuid::uuid!("cccccccc-0000-0000-0000-0000000000c4")).await?;+ let actor = MacroUserIdStr::try_from_email("[email protected]")?;+ assert_eq!(+ super::thread_unread::service(pool)+ .resolve_thread_read_id_impl(actor, source())+ .await?,+ source()+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../../fixtures", scripts("email_draft"))+)]+async fn thread_redirect_checks_global_emptiness_not_the_requested_page(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ sqlx::query!(+ "INSERT INTO email_thread_client_ids (client_id, link_id, thread_id) VALUES ($1, $2, $3)",+ canonical(),+ inbox(),+ source(),+ )+ .execute(&pool)+ .await?;+ let service = super::thread_unread::service(pool);+ let actor = MacroUserIdStr::try_from_email("[email protected]")?;+ assert_eq!(+ service+ .resolve_thread_read_id_impl(actor.clone(), canonical())+ .await?,+ canonical()+ );+ let fetched = service+ .get_thread_with_messages_impl(+ receipt(EntityAccessAuth::Authenticated(actor), canonical()),+ 100,+ 20,+ )+ .await?+ .unwrap();+ assert_eq!(fetched.row.db_id, canonical());+ assert!(fetched.messages.is_empty());+ Ok(())+}diff --git a/crates/email/src/outbound/email_pg_repo/thread.rs b/crates/email/src/outbound/email_pg_repo/thread.rsindex 533e4447a3..a66832150c 100644--- a/crates/email/src/outbound/email_pg_repo/thread.rs+++ b/crates/email/src/outbound/email_pg_repo/thread.rs@@ -227,7 +227,7 @@ pub(super) async fn messages_by_thread_id_paginated(DbMessageRow,r#"SELECT- id, provider_id, thread_id, provider_thread_id, replying_to_id,+ draft_generation, id, provider_id, thread_id, provider_thread_id, replying_to_id,global_id, link_id, provider_history_id, internal_date_ts, snippet,size_estimate, subject, sent_at, has_attachments, is_read, is_starred,is_sent, is_draft, body_text, body_html_sanitized, body_macro,@@ -260,7 +260,7 @@ pub(super) async fn latest_content_message_rows(let rows = sqlx::query_as::<_, DbMessageRow>(r#"SELECT- message.id, message.provider_id, message.thread_id,+ message.draft_generation, message.id, message.provider_id, message.thread_id,message.provider_thread_id, message.replying_to_id,message.global_id, message.link_id, message.provider_history_id,message.internal_date_ts, message.snippet, message.size_estimate,@@ -272,7 +272,7 @@ pub(super) async fn latest_content_message_rows(FROM UNNEST($1::uuid[]) AS requested(thread_id)CROSS JOIN LATERAL (SELECT- id, provider_id, thread_id, provider_thread_id, replying_to_id,+ draft_generation, id, provider_id, thread_id, provider_thread_id, replying_to_id,global_id, link_id, provider_history_id, internal_date_ts,snippet, size_estimate, subject, sent_at, has_attachments,is_read, is_starred, is_sent, is_draft, body_text,@@ -308,7 +308,7 @@ pub(super) async fn cross_inbox_reply_drafts(DbMessageRow,r#"SELECT- id, provider_id, thread_id, provider_thread_id, replying_to_id,+ draft_generation, id, provider_id, thread_id, provider_thread_id, replying_to_id,global_id, link_id, provider_history_id, internal_date_ts, snippet,size_estimate, subject, sent_at, has_attachments, is_read, is_starred,is_sent, is_draft, body_text, body_html_sanitized, body_macro,diff --git a/crates/email/src/outbound/mailbox_pg/drafts/test.rs b/crates/email/src/outbound/mailbox_pg/drafts/test.rsindex 146885308d..e86fd41147 100644--- a/crates/email/src/outbound/mailbox_pg/drafts/test.rs+++ b/crates/email/src/outbound/mailbox_pg/drafts/test.rs@@ -361,6 +361,7 @@ fn checkpoint(lease: &DraftLease, stage: DraftStage) -> DraftCheckpoint {DraftCheckpoint {revision:lease.revision,actor_id:lease.actor_id.clone(),stage,stage_started_at:chrono::Utc::now(),prepared:PreparedDraft {reply_to:None,request:SendRequest {+ message_id: None,message:serde_json::from_value(serde_json::json!({"db_id":lease.message_id,"link_id":lease.mailbox.link_id,"subject":"Local subject"})).unwrap(),from:models_email::service::address::ContactInfo {email:"[email protected]".into(),name:None,photo_url:None},parent_message_id:None,references:None,},files:Vec::new(),removals:Vec::new()},@@ -517,7 +518,7 @@ async fn cancellation_that_wins_before_submission_prevents_delivery(db: PgPool)async fn deletion_retains_a_fenced_remote_cleanup_intent(db: PgPool) {let (sync, repo, input, link) = setup(&db, true).await;assert!(- repo.delete_draft_message(input.db_id, input.thread_db_id, &[link], Some(ACTOR))+ repo.delete_draft_message(input.db_id, input.thread_db_id, &[link], Some(ACTOR), 0).await.unwrap().is_some()diff --git a/crates/email_api_client/src/domain/models/error.rs b/crates/email_api_client/src/domain/models/error.rsindex e47fd7f897..83b1695c6a 100644--- a/crates/email_api_client/src/domain/models/error.rs+++ b/crates/email_api_client/src/domain/models/error.rs@@ -54,6 +54,13 @@ pub enum EmailApiError {/// A sanitized diagnostic suitable for logs.message: String,},+ /// The provider explicitly rejected message submission without accepting it.+ /// Unlike a malformed success response, this permits cancelling and editing.+ #[error("email provider rejected the message: {message}")]+ SendRejected {+ /// A sanitized diagnostic suitable for logs.+ message: String,+ },}impl EmailApiError {diff --git a/crates/email_api_client/src/domain/models/error/test.rs b/crates/email_api_client/src/domain/models/error/test.rsindex 8b176ad8a6..79430ac379 100644--- a/crates/email_api_client/src/domain/models/error/test.rs+++ b/crates/email_api_client/src/domain/models/error/test.rs@@ -22,4 +22,10 @@ fn email_api_error_identifies_transient_failures() {.is_transient());assert!(!EmailApiError::OutdatedCursor.is_transient());+ assert!(+ !EmailApiError::SendRejected {+ message: "invalid message".to_string(),+ }+ .is_transient()+ );}diff --git a/crates/email_api_client/src/domain/models/mod.rs b/crates/email_api_client/src/domain/models/mod.rsindex 8e8e801f4a..3d6b2c7416 100644--- a/crates/email_api_client/src/domain/models/mod.rs+++ b/crates/email_api_client/src/domain/models/mod.rs@@ -20,4 +20,8 @@ pub use mailbox::{CalendarPart, MessageWithCalendarParts, ProviderSubscription,pub use mailbox_settings::*;pub use operation::ApiOperationKind;pub use provider::*;+#[cfg(feature = "ports")]+pub use send::PreparedSendMessage;+#[cfg(feature = "ports")]+pub(crate) use send::validate_message_id;pub use send::{SendRequest, SentIds};diff --git a/crates/email_api_client/src/domain/models/send.rs b/crates/email_api_client/src/domain/models/send.rsindex ad5df5fe75..e0ed6c91b2 100644--- a/crates/email_api_client/src/domain/models/send.rs+++ b/crates/email_api_client/src/domain/models/send.rs@@ -3,6 +3,8 @@ use mail_builder::headers::address::Address;use models_email::email::service::address::ContactInfo;use models_email::email::service::message::MessageToSend;+#[cfg(feature = "ports")]+use super::AccessToken;use super::EmailApiError;#[cfg(test)]@@ -11,6 +13,8 @@ mod test;/// Provider-neutral content and threading metadata for a message send.#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]pub struct SendRequest {+ /// Stable RFC 5322 Message-ID without angle brackets, for delivery recovery.+ pub message_id: Option<String>,/// Message content prepared by the email service.pub message: MessageToSend,/// Sender shown in the message's `From` header.@@ -31,6 +35,11 @@ impl SendRequest {.bcc(contacts_to_address_list(self.message.bcc.as_deref())).subject(&self.message.subject);+ if let Some(message_id) = &self.message_id {+ validate_message_id(message_id)?;+ builder = builder.message_id(message_id.as_str());+ }+if let Some(parent_message_id) = &self.parent_message_id {builder = builder.in_reply_to(parent_message_id.as_str());}@@ -75,6 +84,29 @@ impl SendRequest {}}+/// Locally prepared delivery. Tokens and message contents cannot be logged via+/// `Debug`, and callers cannot construct it without completing preparation.+#[cfg(feature = "ports")]+pub struct PreparedSendMessage {+ pub(crate) access_token: AccessToken,+ pub(crate) mime: Vec<u8>,+ pub(crate) provider_thread_id: Option<String>,+}++pub(crate) fn validate_message_id(message_id: &str) -> Result<(), EmailApiError> {+ let valid = message_id.split_once('@').is_some_and(|(local, domain)| {+ !local.is_empty() && !domain.is_empty() && !domain.contains('@')+ }) && message_id.bytes().all(|byte| {+ byte.is_ascii_alphanumeric() || matches!(byte, b'@' | b'.' | b'-' | b'_' | b'+')+ });+ if !valid {+ return Err(EmailApiError::Permanent {+ message: "invalid stable email Message-ID".to_string(),+ });+ }+ Ok(())+}+fn contact_to_address(contact: &ContactInfo) -> Address<'_> {Address::new_address(contact.name.as_deref(), contact.email.as_str())}diff --git a/crates/email_api_client/src/domain/models/send/test.rs b/crates/email_api_client/src/domain/models/send/test.rsindex 91b10066d1..44a4a81748 100644--- a/crates/email_api_client/src/domain/models/send/test.rs+++ b/crates/email_api_client/src/domain/models/send/test.rs@@ -16,6 +16,7 @@ fn contact(email: &str, name: &str) -> ContactInfo {#[test]fn mime_contains_recipients_threading_bodies_and_attachments() {let request = SendRequest {+ message_id: Some("[email protected]".to_string()),message: MessageToSend {db_id: None,provider_id: None,@@ -52,6 +53,8 @@ fn mime_contains_recipients_threading_bodies_and_attachments() {.expect("generated MIME should be UTF-8 for this fixture");assert!(mime.contains("From:"));+ assert!(mime.contains("Message-ID: <[email protected]>\r\n"));+ assert_eq!(mime.matches("Message-ID:").count(), 1);assert!(mime.contains("[email protected]"));assert!(mime.contains("To:"));assert!(mime.contains("[email protected]"));@@ -66,3 +69,17 @@ fn mime_contains_recipients_threading_bodies_and_attachments() {assert!(mime.contains("filename=\"notes.txt\""));assert!(mime.contains("attachment contents") || mime.contains("YXR0YWNobWVudCBjb250ZW50cw=="));}++#[test]+fn stable_message_id_rejects_header_or_query_injection() {+ for id in [+ "",+ "<[email protected]>",+ "bad\r\nBcc: [email protected]",+ "[email protected] OR in:sent",+ "id@@example.com",+ ] {+ assert!(super::validate_message_id(id).is_err());+ }+ assert!(super::validate_message_id("[email protected]").is_ok());+}diff --git a/crates/email_api_client/src/domain/ports.rs b/crates/email_api_client/src/domain/ports.rsindex 6601cae938..87c3e8739d 100644--- a/crates/email_api_client/src/domain/ports.rs+++ b/crates/email_api_client/src/domain/ports.rs@@ -122,6 +122,27 @@ pub trait MailboxSendClient: Send + Sync + 'static {) -> impl Future<Output = Result<SentIds, EmailApiError>> + Send;}+/// Explicitly separated provider dispatch and delivery reconciliation.+///+/// This optional capability leaves existing message-send implementations intact.+pub trait MailboxSendRecoveryClient: Send + Sync + 'static {+ /// Dispatches already-built MIME once, without token refresh or send retries.+ fn send_prepared(+ &self,+ access_token: &AccessToken,+ mime: &[u8],+ provider_thread_id: Option<&str>,+ ) -> impl Future<Output = Result<SentIds, EmailApiError>> + Send;++ /// Finds one sent message by the stable RFC 5322 Message-ID. An empty result+ /// does not prove that an earlier ambiguous request was never delivered.+ fn find_sent_message(+ &self,+ access_token: &AccessToken,+ message_id: &str,+ ) -> impl Future<Output = Result<Option<SentIds>, EmailApiError>> + Send;+}+/// Mailbox label management capabilities.pub trait MailboxLabelClient: Send + Sync + 'static {/// Lists and normalizes all mailbox labels.@@ -412,6 +433,25 @@ impl MailboxSendClient for NoOpMailboxClient {}}+impl MailboxSendRecoveryClient for NoOpMailboxClient {+ async fn send_prepared(+ &self,+ _: &AccessToken,+ _: &[u8],+ _: Option<&str>,+ ) -> Result<SentIds, EmailApiError> {+ Err(unavailable())+ }++ async fn find_sent_message(+ &self,+ _: &AccessToken,+ _: &str,+ ) -> Result<Option<SentIds>, EmailApiError> {+ Err(unavailable())+ }+}+impl MailboxLabelClient for NoOpMailboxClient {async fn list_labels(&self, _: &AccessToken, _: Uuid) -> Result<Vec<Label>, EmailApiError> {Err(unavailable())diff --git a/crates/email_api_client/src/domain/service/send.rs b/crates/email_api_client/src/domain/service/send.rsindex 4791ebca17..ca4a3f32e9 100644--- a/crates/email_api_client/src/domain/service/send.rs+++ b/crates/email_api_client/src/domain/service/send.rs@@ -1,7 +1,11 @@use uuid::Uuid;-use super::super::models::{EmailApiError, SendRequest, SentIds};-use super::super::ports::{MailboxSendClient, ProviderRateLimiter, ProviderTokenSource};+use super::super::models::{+ EmailApiError, PreparedSendMessage, SendRequest, SentIds, validate_message_id,+};+use super::super::ports::{+ MailboxSendClient, MailboxSendRecoveryClient, ProviderRateLimiter, ProviderTokenSource,+};use super::{ApiOperationKind, EmailApiClientServiceImpl, log_operation_error};impl<R, T, L> EmailApiClientServiceImpl<R, T, L>@@ -27,5 +31,64 @@ where}}+impl<R, T, L> EmailApiClientServiceImpl<R, T, L>+where+ R: MailboxSendRecoveryClient,+ T: ProviderTokenSource,+ L: ProviderRateLimiter,+{+ /// Completes quota, token and MIME preparation without dispatching a send.+ /// Persist delivery-started state only after this method succeeds.+ #[tracing::instrument(skip(self, request))]+ pub async fn prepare_send(+ &self,+ link_id: Uuid,+ request: &SendRequest,+ provider_thread_id: Option<&str>,+ ) -> Result<PreparedSendMessage, EmailApiError> {+ let mime = request.build_mime().inspect_err(log_operation_error)?;+ let access_token = self.prepare(link_id, ApiOperationKind::SendMessage).await?;+ Ok(PreparedSendMessage {+ access_token,+ mime,+ provider_thread_id: provider_thread_id.map(str::to_owned),+ })+ }++ /// Dispatches the prepared request once. Any ambiguous result must be+ /// reconciled before a caller considers a later delivery attempt.+ #[tracing::instrument(skip_all)]+ pub async fn send_prepared(+ &self,+ prepared: &PreparedSendMessage,+ ) -> Result<SentIds, EmailApiError> {+ self.repository+ .send_prepared(+ &prepared.access_token,+ &prepared.mime,+ prepared.provider_thread_id.as_deref(),+ )+ .await+ .inspect_err(log_operation_error)+ }++ /// Checks sent mail for a stable delivery identifier without sending again.+ #[tracing::instrument(skip(self, message_id))]+ pub async fn find_sent_message(+ &self,+ link_id: Uuid,+ message_id: &str,+ ) -> Result<Option<SentIds>, EmailApiError> {+ validate_message_id(message_id).inspect_err(log_operation_error)?;+ let access_token = self+ .prepare(link_id, ApiOperationKind::ListMessages)+ .await?;+ self.repository+ .find_sent_message(&access_token, message_id)+ .await+ .inspect_err(log_operation_error)+ }+}+#[cfg(test)]mod test;diff --git a/crates/email_api_client/src/domain/service/send/test.rs b/crates/email_api_client/src/domain/service/send/test.rsindex 1741c62a36..fc31102260 100644--- a/crates/email_api_client/src/domain/service/send/test.rs+++ b/crates/email_api_client/src/domain/service/send/test.rs@@ -2,8 +2,10 @@ use models_email::email::service::address::ContactInfo;use models_email::email::service::message::MessageToSend;use uuid::Uuid;-use super::super::super::models::{AccessToken, SendRequest, SentIds, TokenFreshness};-use super::super::super::ports::MailboxSendClient;+use super::super::super::models::{+ AccessToken, EmailApiError, RateLimitRefusal, SendRequest, SentIds, TokenFreshness,+};+use super::super::super::ports::{MailboxSendClient, MailboxSendRecoveryClient};use super::super::test_support::{Call, FakeRateLimiter, FakeTokenSource, call_log};use super::EmailApiClientServiceImpl;@@ -33,6 +35,123 @@ impl MailboxSendClient for SendClient {}}+impl MailboxSendRecoveryClient for SendClient {+ async fn send_prepared(+ &self,+ token: &AccessToken,+ mime: &[u8],+ thread: Option<&str>,+ ) -> Result<SentIds, EmailApiError> {+ assert_eq!(token.expose_secret(), "access-token");+ assert_eq!(thread, Some("thread-1"));+ assert!(String::from_utf8_lossy(mime).contains("Message-ID: <[email protected]>"));+ self.calls+ .lock()+ .unwrap()+ .push(Call::Repository("send_prepared"));+ Ok(SentIds {+ provider_message_id: "message-1".into(),+ provider_thread_id: "thread-1".into(),+ })+ }++ async fn find_sent_message(+ &self,+ token: &AccessToken,+ id: &str,+ ) -> Result<Option<SentIds>, EmailApiError> {+ assert_eq!(token.expose_secret(), "access-token");+ assert_eq!(id, "[email protected]");+ self.calls+ .lock()+ .unwrap()+ .push(Call::Repository("find_sent_message"));+ Ok(Some(SentIds {+ provider_message_id: "message-1".into(),+ provider_thread_id: "thread-1".into(),+ }))+ }+}++#[tokio::test]+async fn preparation_never_dispatches_and_dispatch_does_not_repeat_preparation() {+ let calls = call_log();+ let service = EmailApiClientServiceImpl::new(+ SendClient {+ calls: calls.clone(),+ },+ FakeTokenSource::new(calls.clone(), Ok(AccessToken::new("access-token"))),+ FakeRateLimiter::new(calls.clone(), Ok(())),+ );+ let mut request = send_request();+ request.message_id = Some("[email protected]".into());+ let prepared = service+ .prepare_send(Uuid::nil(), &request, Some("thread-1"))+ .await+ .unwrap();+ assert_eq!(+ *calls.lock().unwrap(),+ [+ Call::RateLimit(Uuid::nil(), super::ApiOperationKind::SendMessage),+ Call::Token(Uuid::nil(), TokenFreshness::Cached),+ ]+ );+ service.send_prepared(&prepared).await.unwrap();+ assert_eq!(calls.lock().unwrap().len(), 3);+ assert_eq!(calls.lock().unwrap()[2], Call::Repository("send_prepared"));+}++#[tokio::test]+async fn quota_refusal_is_a_preparation_error_before_token_or_dispatch() {+ let calls = call_log();+ let service = EmailApiClientServiceImpl::new(+ SendClient {+ calls: calls.clone(),+ },+ FakeTokenSource::new(calls.clone(), Ok(AccessToken::new("access-token"))),+ FakeRateLimiter::new(calls.clone(), Err(RateLimitRefusal { retry_after: None })),+ );+ let error = service+ .prepare_send(Uuid::nil(), &send_request(), None)+ .await+ .err()+ .unwrap();+ assert!(matches!(error, EmailApiError::RateLimited { .. }));+ assert_eq!(+ *calls.lock().unwrap(),+ [Call::RateLimit(+ Uuid::nil(),+ super::ApiOperationKind::SendMessage+ )]+ );+}++#[tokio::test]+async fn recovery_uses_read_quota_and_does_not_send() {+ let calls = call_log();+ let service = EmailApiClientServiceImpl::new(+ SendClient {+ calls: calls.clone(),+ },+ FakeTokenSource::new(calls.clone(), Ok(AccessToken::new("access-token"))),+ FakeRateLimiter::new(calls.clone(), Ok(())),+ );+ let sent = service+ .find_sent_message(Uuid::nil(), "[email protected]")+ .await+ .unwrap()+ .unwrap();+ assert_eq!(sent.provider_message_id, "message-1");+ assert_eq!(+ *calls.lock().unwrap(),+ [+ Call::RateLimit(Uuid::nil(), super::ApiOperationKind::ListMessages),+ Call::Token(Uuid::nil(), TokenFreshness::Cached),+ Call::Repository("find_sent_message"),+ ]+ );+}+#[tokio::test]async fn send_uses_send_cost_and_returns_ids_without_mutating_message() {let calls = call_log();@@ -67,6 +186,7 @@ async fn send_uses_send_cost_and_returns_ids_without_mutating_message() {fn send_request() -> SendRequest {SendRequest {+ message_id: None,message: MessageToSend {db_id: None,provider_id: None,diff --git a/crates/email_api_client/src/outbound/gmail/send.rs b/crates/email_api_client/src/outbound/gmail/send.rsindex 9908bea3bc..ac8e04f0d3 100644--- a/crates/email_api_client/src/outbound/gmail/send.rs+++ b/crates/email_api_client/src/outbound/gmail/send.rs@@ -1,7 +1,7 @@//! Gmail send capability implementation.use crate::domain::models::{AccessToken, EmailApiError, SendRequest, SentIds};-use crate::domain::ports::MailboxSendClient;+use crate::domain::ports::{MailboxSendClient, MailboxSendRecoveryClient};use super::{GmailApiClientRepository, map_gmail_error};@@ -17,7 +17,7 @@ impl MailboxSendClient for GmailApiClientRepository {.client.send_message(access_token.expose_secret(), &mime, provider_thread_id).await- .map_err(map_gmail_error)?;+ .map_err(map_send_error)?;Ok(SentIds {provider_message_id: sent.id,@@ -25,3 +25,51 @@ impl MailboxSendClient for GmailApiClientRepository {})}}++impl MailboxSendRecoveryClient for GmailApiClientRepository {+ async fn send_prepared(+ &self,+ access_token: &AccessToken,+ mime: &[u8],+ provider_thread_id: Option<&str>,+ ) -> Result<SentIds, EmailApiError> {+ let sent = self+ .client+ .send_message(access_token.expose_secret(), mime, provider_thread_id)+ .await+ .map_err(map_send_error)?;+ Ok(SentIds {+ provider_message_id: sent.id,+ provider_thread_id: sent.thread_id,+ })+ }++ async fn find_sent_message(+ &self,+ access_token: &AccessToken,+ message_id: &str,+ ) -> Result<Option<SentIds>, EmailApiError> {+ self.client+ .find_sent_message(access_token.expose_secret(), message_id)+ .await+ .map(|found| {+ found.map(|sent| SentIds {+ provider_message_id: sent.id,+ provider_thread_id: sent.thread_id,+ })+ })+ .map_err(map_gmail_error)+ }+}++/// Preserve an explicit validation refusal separately from a malformed success.+/// A request-timeout response still cannot establish whether delivery occurred.+fn map_send_error(error: gmail_client::GmailApiHttpError) -> EmailApiError {+ let rejected = error+ .status()+ .is_some_and(|status| status.is_client_error() && status.as_u16() != 408);+ match map_gmail_error(error) {+ EmailApiError::Permanent { message } if rejected => EmailApiError::SendRejected { message },+ error => error,+ }+}diff --git a/crates/email_api_client/src/outbound/gmail/test/send.rs b/crates/email_api_client/src/outbound/gmail/test/send.rsindex 6e8368e96c..77e0b0791e 100644--- a/crates/email_api_client/src/outbound/gmail/test/send.rs+++ b/crates/email_api_client/src/outbound/gmail/test/send.rs@@ -36,6 +36,7 @@ async fn builds_posts_and_returns_provider_ids() {.await;let request = SendRequest {+ message_id: None,message: MessageToSend {db_id: None,provider_id: None,@@ -91,3 +92,109 @@ async fn builds_posts_and_returns_provider_ids() {assert!(mime.contains("In-Reply-To:"));assert!(mime.contains("[email protected]"));}++#[tokio::test]+async fn prepared_dispatch_does_not_retry_provider_failure() {+ use crate::domain::ports::MailboxSendRecoveryClient;+ let server = MockServer::start().await;+ Mock::given(method("POST"))+ .and(path("/users/me/messages/send"))+ .respond_with(ResponseTemplate::new(503))+ .expect(1)+ .mount(&server)+ .await;+ let error = repository(&server)+ .send_prepared(+ &AccessToken::new("access-token"),+ b"Message-ID: <[email protected]>\r\n\r\nbody",+ None,+ )+ .await+ .unwrap_err();+ assert!(matches!(+ error,+ crate::domain::models::EmailApiError::Transient { .. }+ ));+ assert_eq!(server.received_requests().await.unwrap().len(), 1);+}++#[tokio::test]+async fn prepared_dispatch_preserves_explicit_validation_rejection() {+ use crate::domain::models::EmailApiError;+ use crate::domain::ports::MailboxSendRecoveryClient;+ for status in [400, 413, 422] {+ let server = MockServer::start().await;+ Mock::given(method("POST"))+ .and(path("/users/me/messages/send"))+ .respond_with(ResponseTemplate::new(status).set_body_string("invalid message"))+ .expect(1)+ .mount(&server)+ .await;+ let error = repository(&server)+ .send_prepared(&AccessToken::new("token"), b"message", None)+ .await+ .unwrap_err();+ assert!(matches!(error, EmailApiError::SendRejected { .. }));+ assert_eq!(server.received_requests().await.unwrap().len(), 1);+ }+}++#[tokio::test]+async fn timeout_and_malformed_success_do_not_establish_rejection() {+ use crate::domain::models::EmailApiError;+ use crate::domain::ports::MailboxSendRecoveryClient;+ for (status, body) in [+ (408, "request timeout"),+ (200, "not JSON"),+ (200, "{}"),+ (302, "redirect"),+ ] {+ let server = MockServer::start().await;+ Mock::given(method("POST"))+ .and(path("/users/me/messages/send"))+ .respond_with(ResponseTemplate::new(status).set_body_raw(body, "application/json"))+ .expect(1)+ .mount(&server)+ .await;+ let error = repository(&server)+ .send_prepared(&AccessToken::new("token"), b"message", None)+ .await+ .unwrap_err();+ assert!(matches!(error, EmailApiError::Permanent { .. }));+ assert_eq!(server.received_requests().await.unwrap().len(), 1);+ }+}++#[tokio::test]+async fn recovery_maps_ids_and_search_errors_without_sending() {+ use crate::domain::ports::MailboxSendRecoveryClient;+ let server = MockServer::start().await;+ Mock::given(method("GET"))+ .and(path("/users/me/messages"))+ .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({+ "messages": [{"id":"sent-message","threadId":"sent-thread"}]+ })))+ .expect(1)+ .mount(&server)+ .await;+ let found = repository(&server)+ .find_sent_message(&AccessToken::new("token"), "[email protected]")+ .await+ .unwrap()+ .unwrap();+ assert_eq!(found.provider_message_id, "sent-message");+ assert_eq!(found.provider_thread_id, "sent-thread");+ let server = MockServer::start().await;+ Mock::given(method("GET"))+ .and(path("/users/me/messages"))+ .respond_with(ResponseTemplate::new(429))+ .expect(1)+ .mount(&server)+ .await;+ assert!(matches!(+ repository(&server)+ .find_sent_message(&AccessToken::new("token"), "[email protected]")+ .await,+ Err(crate::domain::models::EmailApiError::RateLimited { .. })+ ));+}diff --git a/crates/email_api_client/src/outbound/outlook/drafts/test.rs b/crates/email_api_client/src/outbound/outlook/drafts/test.rsindex 871aa2657a..dbd4a5c609 100644--- a/crates/email_api_client/src/outbound/outlook/drafts/test.rs+++ b/crates/email_api_client/src/outbound/outlook/drafts/test.rs@@ -16,6 +16,7 @@ fn request() -> DraftRequest {correlation: Uuid::now_v7(),revision: 1,content: SendRequest {+ message_id: None,message: serde_json::from_value(json!({"link_id":Uuid::now_v7(),"subject":"Reply","body_html":"<b>Hello</b>","to":[{"email":"[email protected]"}]})).unwrap(),from: ContactInfo {email:"[email protected]".into(),name:None,photo_url:None},parent_message_id:Some("<[email protected]>".into()), references:Some(vec!["<[email protected]>".into()]),diff --git a/crates/email_db_client/AGENTS.md b/crates/email_db_client/AGENTS.mdindex 3d5d50d451..e651b3883b 100644--- a/crates/email_db_client/AGENTS.md+++ b/crates/email_db_client/AGENTS.md@@ -41,8 +41,16 @@ cleanup, and backfill.- `cargo test -p email_db_client` (`SQLX_OFFLINE` unset; requires localMacroDB — `just setup_macrodb`).+Parsed message responses expose the draft generation captured in the same SQL snapshot as their content.+## Gotchas+- Message deletion may return `Deferred` while an accepted send owns the row; reconcile retained deletions under the message lock and compare both provider identity and draft generation.+- Resolve provider deletions with `get_simple_message_by_provider_and_link_for_update` inside the deletion transaction; retain the message lock through cleanup and deletion so Send completion or Undo cannot invalidate the snapshot.++- Scheduled delivery and durable Send share `email_draft_provider_attachment_ids`+ for native/forwarded identities, honoring removals and copied-upload deduplication.+- Forwarded-attachment delivery reads preserve `source_link_id` from the originalmessage; the destination draft inbox is only the query access scope.- Quote and alias camelCase columns to Rust field names; checkdiff --git a/crates/email_db_client/src/attachments/draft.rs b/crates/email_db_client/src/attachments/draft.rsindex 182a5bc1e3..aebb288597 100644--- a/crates/email_db_client/src/attachments/draft.rs+++ b/crates/email_db_client/src/attachments/draft.rs@@ -1,32 +1,44 @@use models_email::{db, service};+use sqlx::PgPool;use sqlx::types::Uuid;-use sqlx::{Executor, PgPool, Postgres};#[cfg(test)]mod test;/// Inserts a new draft attachment metadata record.-#[tracing::instrument(skip(executor, attachment), err)]-pub async fn insert_draft_attachment<'e, E>(- executor: E,+#[tracing::instrument(skip(pool, attachment), err)]+pub async fn insert_draft_attachment(+ pool: &PgPool,link_id: Uuid,attachment: service::attachment::AttachmentDraft,-) -> anyhow::Result<()>-where- E: Executor<'e, Database = Postgres>,-{+) -> anyhow::Result<()> {+ let mut tx = pool.begin().await?;+ anyhow::ensure!(+ super::mutation::lock_editable_attachment_message(+ &mut tx,+ link_id,+ attachment.draft_id,+ false+ )+ .await?,+ "draft is no longer editable"+ );let db_att: db::attachment::AttachmentDraft = attachment.into();- sqlx::query!(+ let inserted = sqlx::query!(r#"+ WITH editable AS (+ SELECT id FROM email_messages+ WHERE id = $2 AND link_id = $8 AND is_draft AND NOT is_sent+ FOR UPDATE+ )INSERT INTO email_attachments_drafts (id, draft_id, file_name, content_type, sha, size, s3_key)-- if the message belongs to a different link_id, nothing will be returned from this-- and thus nothing will be insertedSELECT $1, $2, $3, $4, $5, $6, $7- FROM email_messages m- WHERE m.id = $2 AND m.link_id = $8+ FROM editable"#,db_att.id,db_att.draft_id,@@ -37,9 +49,11 @@ wheredb_att.s3_key,link_id)- .execute(executor)+ .execute(&mut *tx).await?;+ anyhow::ensure!(inserted.rows_affected() == 1, "draft is no longer editable");+ tx.commit().await?;Ok(())}@@ -67,30 +81,37 @@ pub async fn get_total_attachments_size_by_draft_id(}/// Deletes a draft attachment record given the draft_id and attachment_id.-#[tracing::instrument(skip(executor), err)]-pub async fn delete_draft_attachment<'e, E>(- executor: E,+#[tracing::instrument(skip(pool), err)]+pub async fn delete_draft_attachment(+ pool: &PgPool,link_id: Uuid,draft_id: Uuid,attachment_id: Uuid,-) -> anyhow::Result<u64>-where- E: Executor<'e, Database = Postgres>,-{+) -> anyhow::Result<u64> {+ let mut tx = pool.begin().await?;+ if !super::mutation::lock_editable_attachment_message(&mut tx, link_id, draft_id, true).await? {+ return Ok(0);+ }let result = sqlx::query!(r#"+ WITH editable AS (+ -- Sent rows are used by the worker's post-delivery cleanup.+ SELECT id FROM email_messages+ WHERE id = $2 AND link_id = $3 AND (is_draft OR is_sent)+ FOR UPDATE+ )DELETE FROM email_attachments_drafts ead- USING email_messages m- WHERE ead.draft_id = m.id- AND ead.id = $1 AND ead.draft_id = $2 AND m.link_id = $3+ USING editable m+ WHERE ead.draft_id = m.id AND ead.id = $1"#,attachment_id,draft_id,link_id)- .execute(executor)+ .execute(&mut *tx).await?;+ tx.commit().await?;Ok(result.rows_affected())}diff --git a/crates/email_db_client/src/attachments/draft/test.rs b/crates/email_db_client/src/attachments/draft/test.rsindex 0dab9eda5a..ce61fe7cd6 100644--- a/crates/email_db_client/src/attachments/draft/test.rs+++ b/crates/email_db_client/src/attachments/draft/test.rs@@ -211,9 +211,7 @@ async fn insert_draft_attachment_creates_new_attachment(pool: Pool<Postgres>) ->migrator = "MACRO_DB_MIGRATIONS",fixtures(path = "../../../fixtures", scripts("draft_attachments")))]-async fn insert_draft_attachment_does_nothing_for_wrong_link_id(- pool: Pool<Postgres>,-) -> Result<()> {+async fn insert_draft_attachment_rejects_wrong_link_id(pool: Pool<Postgres>) -> Result<()> {let wrong_link_id = Uuid::parse_str("00000000-0000-0000-0000-000000000d02")?;let draft_id = Uuid::parse_str("00000000-0000-0000-0000-00000000d502")?;let attachment_id = Uuid::parse_str("00000000-0000-0000-0000-0000000da098")?;@@ -231,8 +229,12 @@ async fn insert_draft_attachment_does_nothing_for_wrong_link_id(s3_key: "s3://bucket/should_not_insert.pdf".to_string(),};- // Insert with wrong link_id (should not insert anything)- insert_draft_attachment(&pool, wrong_link_id, attachment).await?;+ // A rejected insert must not report that an attachment was persisted.+ assert!(+ insert_draft_attachment(&pool, wrong_link_id, attachment)+ .await+ .is_err()+ );// Verify nothing was inserted (check with correct link_id)let correct_link_id = Uuid::parse_str("00000000-0000-0000-0000-000000000d01")?;diff --git a/crates/email_db_client/src/attachments/forwarded.rs b/crates/email_db_client/src/attachments/forwarded.rsindex 7cb2c5038e..ba0722b2d3 100644--- a/crates/email_db_client/src/attachments/forwarded.rs+++ b/crates/email_db_client/src/attachments/forwarded.rs@@ -1,6 +1,6 @@use models_email::db;+use sqlx::PgPool;use sqlx::types::Uuid;-use sqlx::{Executor, PgPool, Postgres};#[cfg(test)]mod test;@@ -8,59 +8,73 @@ mod test;/// Inserts a forwarded attachment link between a draft and an original message's attachment./// Uses a subquery to verify the draft belongs to the given link_id./// ON CONFLICT DO NOTHING makes this idempotent.-#[tracing::instrument(skip(executor), err)]-pub async fn insert_forwarded_attachment<'e, E>(- executor: E,+#[tracing::instrument(skip(pool), err)]+pub async fn insert_forwarded_attachment(+ pool: &PgPool,link_id: Uuid,draft_id: Uuid,attachment_id: Uuid,-) -> anyhow::Result<()>-where- E: Executor<'e, Database = Postgres>,-{+) -> anyhow::Result<()> {+ let mut tx = pool.begin().await?;+ if !super::mutation::lock_editable_attachment_message(&mut tx, link_id, draft_id, false).await?+ {+ return Ok(());+ }sqlx::query!(r#"+ WITH editable AS (+ SELECT id FROM email_messages+ WHERE id = $1 AND link_id = $3 AND is_draft AND NOT is_sent+ FOR UPDATE+ )INSERT INTO email_attachments_fwd (message_id, attachment_id)SELECT $1, $2- FROM email_messages m- WHERE m.id = $1 AND m.link_id = $3+ FROM editableON CONFLICT DO NOTHING"#,draft_id,attachment_id,link_id,)- .execute(executor)+ .execute(&mut *tx).await?;+ tx.commit().await?;Ok(())}/// Deletes a forwarded attachment link. Verifies draft ownership via link_id.-#[tracing::instrument(skip(executor), err)]-pub async fn delete_forwarded_attachment<'e, E>(- executor: E,+#[tracing::instrument(skip(pool), err)]+pub async fn delete_forwarded_attachment(+ pool: &PgPool,link_id: Uuid,draft_id: Uuid,attachment_id: Uuid,-) -> anyhow::Result<u64>-where- E: Executor<'e, Database = Postgres>,-{+) -> anyhow::Result<u64> {+ let mut tx = pool.begin().await?;+ if !super::mutation::lock_editable_attachment_message(&mut tx, link_id, draft_id, false).await?+ {+ return Ok(0);+ }let result = sqlx::query!(r#"+ WITH editable AS (+ SELECT id FROM email_messages+ WHERE id = $1 AND link_id = $3 AND is_draft AND NOT is_sent+ FOR UPDATE+ )DELETE FROM email_attachments_fwd eaf- USING email_messages m- WHERE eaf.message_id = m.id- AND eaf.message_id = $1 AND eaf.attachment_id = $2 AND m.link_id = $3+ USING editable m+ WHERE eaf.message_id = m.id AND eaf.attachment_id = $2"#,draft_id,attachment_id,link_id,)- .execute(executor)+ .execute(&mut *tx).await?;+ tx.commit().await?;Ok(result.rows_affected())}diff --git a/crates/email_db_client/src/attachments/forwarded/test.rs b/crates/email_db_client/src/attachments/forwarded/test.rsindex 0bddf7f4e7..7f1c618c86 100644--- a/crates/email_db_client/src/attachments/forwarded/test.rs+++ b/crates/email_db_client/src/attachments/forwarded/test.rs@@ -246,6 +246,139 @@ async fn fetch_forwarded_attachments_in_bulk_excludes_drafts_without_attachmentsOk(())}+#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../fixtures", scripts("forwarded_attachments"))+)]+async fn scheduled_draft_blocks_all_attachment_mutations_and_preserves_manifest(+ pool: Pool<Postgres>,+) -> Result<()> {+ use crate::attachments::draft::{delete_draft_attachment, insert_draft_attachment};+ let link = Uuid::parse_str("00000000-0000-0000-0000-000000000f01")?;+ let draft = Uuid::parse_str("00000000-0000-0000-0000-00000000f501")?;+ let original = Uuid::parse_str("00000000-0000-0000-0000-0000000fa001")?;+ let extra = Uuid::parse_str("00000000-0000-0000-0000-0000000fa003")?;+ let upload = Uuid::new_v4();+ let attachment = |id| models_email::service::attachment::AttachmentDraft {+ id,+ draft_id: draft,+ file_name: "approved.txt".into(),+ content_type: "text/plain".into(),+ sha: "sha".into(),+ size: 4,+ s3_key: "approved".into(),+ upload_pending: false,+ content_id: None,+ is_inline: false,+ };+ insert_draft_attachment(&pool, link, attachment(upload)).await?;+ sqlx::query("INSERT INTO email_scheduled_messages(link_id, message_id, send_time, sent) VALUES ($1, $2, NOW() + INTERVAL '1 hour', false)")+ .bind(link).bind(draft).execute(&pool).await?;+ assert!(+ insert_draft_attachment(&pool, link, attachment(Uuid::new_v4()))+ .await+ .is_err()+ );+ assert!(+ delete_draft_attachment(&pool, link, draft, upload)+ .await+ .is_err()+ );+ assert!(+ insert_forwarded_attachment(&pool, link, draft, extra)+ .await+ .is_err()+ );+ assert!(+ delete_forwarded_attachment(&pool, link, draft, original)+ .await+ .is_err()+ );+ let manifest: serde_json::Value = sqlx::query_scalar(+ "SELECT approved_attachments FROM email_scheduled_messages WHERE message_id = $1",+ )+ .bind(draft)+ .fetch_one(&pool)+ .await?;+ assert_eq!(manifest["uploaded"], serde_json::json!([upload]));+ assert_eq!(manifest["forwarded"].as_array().unwrap().len(), 2);+ // Cascading source deletion cannot erase the record of what the sender approved.+ sqlx::query("DELETE FROM email_attachments WHERE id = $1")+ .bind(original)+ .execute(&pool)+ .await?;+ let retained: serde_json::Value = sqlx::query_scalar(+ "SELECT approved_attachments FROM email_scheduled_messages WHERE message_id = $1",+ )+ .bind(draft)+ .fetch_one(&pool)+ .await?;+ assert_eq!(retained, manifest);+ assert_eq!(+ fetch_forwarded_attachments_by_draft_id(&pool, link, draft)+ .await?+ .len(),+ 1+ );+ sqlx::query("DELETE FROM email_scheduled_messages WHERE message_id = $1")+ .bind(draft)+ .execute(&pool)+ .await?;+ assert_eq!(+ delete_draft_attachment(&pool, link, draft, upload).await?,+ 1+ );+ insert_forwarded_attachment(&pool, link, draft, extra).await?;+ assert_eq!(+ delete_forwarded_attachment(&pool, link, draft, extra).await?,+ 1+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../fixtures", scripts("forwarded_attachments"))+)]+async fn attachment_request_waiting_for_admission_observes_the_committed_schedule(+ pool: Pool<Postgres>,+) -> Result<()> {+ let link = Uuid::parse_str("00000000-0000-0000-0000-000000000f01")?;+ let draft = Uuid::parse_str("00000000-0000-0000-0000-00000000f501")?;+ let original = Uuid::parse_str("00000000-0000-0000-0000-0000000fa001")?;+ let mut admission = pool.begin().await?;+ sqlx::query("SELECT id FROM email_messages WHERE id = $1 FOR UPDATE")+ .bind(draft)+ .execute(&mut *admission)+ .await?;+ let blocker: i32 = sqlx::query_scalar("SELECT pg_backend_pid()")+ .fetch_one(&mut *admission)+ .await?;+ let worker_pool = pool.clone();+ let remove = tokio::spawn(async move {+ delete_forwarded_attachment(&worker_pool, link, draft, original).await+ });+ tokio::time::timeout(std::time::Duration::from_secs(10), async {+ loop {+ let waiting: bool = sqlx::query_scalar("SELECT EXISTS(SELECT 1 FROM pg_stat_activity WHERE datname = current_database() AND $1 = ANY(pg_blocking_pids(pid)))")+ .bind(blocker).fetch_one(&pool).await?;+ if waiting { return Ok::<_, sqlx::Error>(()); }+ tokio::task::yield_now().await;+ }+ }).await??;+ sqlx::query("INSERT INTO email_scheduled_messages(link_id, message_id, send_time, sent) VALUES ($1, $2, NOW() + INTERVAL '1 hour', false)")+ .bind(link).bind(draft).execute(&mut *admission).await?;+ admission.commit().await?;+ assert!(remove.await?.is_err());+ assert_eq!(+ fetch_forwarded_attachments_by_draft_id(&pool, link, draft)+ .await?+ .len(),+ 2+ );+ Ok(())+}+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS",fixtures(path = "../../../fixtures", scripts("forwarded_attachments"))diff --git a/crates/email_db_client/src/attachments/mod.rs b/crates/email_db_client/src/attachments/mod.rsindex 93dcb049f9..c583417ffe 100644--- a/crates/email_db_client/src/attachments/mod.rs+++ b/crates/email_db_client/src/attachments/mod.rs@@ -2,3 +2,5 @@ pub mod draft;pub mod forwarded;pub mod provider;pub mod sfs;++mod mutation;diff --git a/crates/email_db_client/src/attachments/mutation.rs b/crates/email_db_client/src/attachments/mutation.rsnew file mode 100644index 0000000000..e893f15804--- /dev/null+++ b/crates/email_db_client/src/attachments/mutation.rs@@ -0,0 +1,35 @@+/// Serialize attachment changes with send admission using message -> schedule locks.+/// The schedule read is a separate statement so a waiter sees newly committed schedules.+pub(super) async fn lock_editable_attachment_message(+ tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,+ link_id: sqlx::types::Uuid,+ message_id: sqlx::types::Uuid,+ allow_sent_cleanup: bool,+) -> anyhow::Result<bool> {+ let state = sqlx::query!(+ "SELECT is_draft, is_sent FROM email_messages WHERE id = $1 AND link_id = $2 FOR UPDATE",+ message_id,+ link_id+ )+ .fetch_optional(&mut **tx)+ .await?;+ let Some(state) = state else {+ return Ok(false);+ };+ if allow_sent_cleanup && state.is_sent {+ return Ok(true);+ }+ if !state.is_draft || state.is_sent {+ return Ok(false);+ }+ let scheduled = sqlx::query_scalar!(+ r#"SELECT EXISTS(SELECT 1 FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2) AS "scheduled!""#,+ message_id,+ link_id+ ).fetch_one(&mut **tx).await?;+ anyhow::ensure!(+ !scheduled,+ "cancel the scheduled send before changing attachments"+ );+ Ok(true)+}diff --git a/crates/email_db_client/src/contacts/get.rs b/crates/email_db_client/src/contacts/get.rsindex b9e54cc542..4e49efd31a 100644--- a/crates/email_db_client/src/contacts/get.rs+++ b/crates/email_db_client/src/contacts/get.rs@@ -18,11 +18,14 @@ pub type ThreadContactsMap = HashMap<Uuid, Vec<(String, Option<String>)>>;pub type CrmContactRange = (String, Option<String>, DateTime<Utc>, DateTime<Utc>);/// fetch message sender from db-#[tracing::instrument(skip(pool), err)]-pub async fn get_sender_by_message_id(- pool: &PgPool,+#[tracing::instrument(skip(executor), err)]+pub async fn get_sender_by_message_id<'e, E>(+ executor: E,message_id: Uuid,-) -> anyhow::Result<Option<db::contact::Contact>> {+) -> anyhow::Result<Option<db::contact::Contact>>+where+ E: sqlx::Executor<'e, Database = sqlx::Postgres>,+{let result = sqlx::query_as!(db::contact::Contact,r#"@@ -42,7 +45,7 @@ pub async fn get_sender_by_message_id("#,message_id)- .fetch_optional(pool)+ .fetch_optional(executor).await?;Ok(result)@@ -210,11 +213,14 @@ pub async fn link_has_any_message_with(}/// fetch recipients (to, cc, bcc) from db-#[tracing::instrument(skip(pool), err)]-pub async fn fetch_db_recipients(- pool: &PgPool,+#[tracing::instrument(skip(executor), err)]+pub async fn fetch_db_recipients<'e, E>(+ executor: E,message_db_id: Uuid,-) -> anyhow::Result<Vec<(db::contact::Contact, db::address::EmailRecipientType)>> {+) -> anyhow::Result<Vec<(db::contact::Contact, db::address::EmailRecipientType)>>+where+ E: sqlx::Executor<'e, Database = sqlx::Postgres>,+{// Fetch address and recipient type togethersqlx::query_as!(RecipientQueryResult,@@ -252,7 +258,7 @@ pub async fn fetch_db_recipients(row.recipient_type,)})- .fetch_all(pool)+ .fetch_all(executor).await.map_err(Into::into)}diff --git a/crates/email_db_client/src/crm_cleanup/candidates.rs b/crates/email_db_client/src/crm_cleanup/candidates.rsindex 12d1363486..4b06e3637a 100644--- a/crates/email_db_client/src/crm_cleanup/candidates.rs+++ b/crates/email_db_client/src/crm_cleanup/candidates.rs@@ -12,12 +12,15 @@ use sqlx::types::Uuid;/// clock expire while that populate is pending.////// Returns the number of rows recorded (inserted or refreshed).-#[tracing::instrument(skip(pool, contact_emails), err)]-pub async fn insert_candidates(- pool: &PgPool,+#[tracing::instrument(skip(executor, contact_emails), err)]+pub async fn insert_candidates<'e, E>(+ executor: E,link_id: Uuid,contact_emails: &[String],-) -> anyhow::Result<u64> {+) -> anyhow::Result<u64>+where+ E: sqlx::Executor<'e, Database = sqlx::Postgres>,+{if contact_emails.is_empty() {return Ok(0);}@@ -31,7 +34,7 @@ pub async fn insert_candidates(link_id,contact_emails)- .execute(pool)+ .execute(executor).await?;Ok(result.rows_affected())diff --git a/crates/email_db_client/src/messages/delete.rs b/crates/email_db_client/src/messages/delete.rsindex 8281363ccb..10c4c1dd44 100644--- a/crates/email_db_client/src/messages/delete.rs+++ b/crates/email_db_client/src/messages/delete.rs@@ -8,47 +8,158 @@ use sqlx::{Executor, Postgres};pub enum MessageDeletion {/// The message row was already gone, e.g. removed by a concurrent sync.AlreadyDeleted,+ /// An accepted send still needs the message; deletion is recorded for recovery.+ Deferred,/// The message was deleted. `deleted_thread` holds the thread id when the/// message was the thread's last one and the thread was deleted with it.Deleted { deleted_thread: Option<Uuid> },}-/// Deletes message from the database with transaction handling.+/// Deletes a message snapshot locked in this transaction. Provider sync must use+/// `get_simple_message_by_provider_and_link_for_update` before collecting its+/// cleanup data, so completion/Undo cannot replace the snapshot before DELETE.#[tracing::instrument(skip(tx, message), fields(link_id = %message.link_id), err)]pub async fn delete_message_with_tx(tx: &mut sqlx::PgConnection,message: &message::SimpleMessage,) -> anyhow::Result<MessageDeletion> {- if !delete_db_message(&mut *tx, message.db_id).await? {- return Ok(MessageDeletion::AlreadyDeleted);+ delete_message_in_thread(+ tx,+ message.db_id,+ message.thread_db_id,+ message.link_id,+ message.is_draft,+ )+ .await+}++async fn delete_message_in_thread(+ tx: &mut sqlx::PgConnection,+ message_id: Uuid,+ thread_id: Uuid,+ link_id: Uuid,+ is_draft: bool,+) -> anyhow::Result<MessageDeletion> {+ if !delete_db_message(&mut *tx, message_id).await? {+ let deferred = sqlx::query_scalar!(+ "SELECT EXISTS(SELECT 1 FROM email_deferred_message_deletions WHERE message_id=$1) AS \"deferred!\"",+ message_id,+ ).fetch_one(&mut *tx).await?;+ return Ok(if deferred {+ MessageDeletion::Deferred+ } else {+ MessageDeletion::AlreadyDeleted+ });}// if it was the only message in the thread, delete the thread too- let deleted_thread =- threads::delete::delete_thread_if_empty(&mut *tx, message.thread_db_id).await?;+ let deleted_thread = threads::delete::delete_thread_if_empty(&mut *tx, thread_id).await?;// Drafts count toward inbox_visible, latest_inbound_message_ts, and// is_signal, so every surviving thread needs the full recompute (which// piggybacks the is_signal sync) — a discarded draft would otherwise// leave the thread stranded in inbox views.if !deleted_thread {- threads::update::update_thread_metadata(&mut *tx, message.thread_db_id, message.link_id)- .await?;+ threads::update::update_thread_metadata(&mut *tx, thread_id, link_id).await?;}// The message's attachments cascade with the delete, which may have// removed the thread's last calendar attachment. Drafts never have// email_attachments rows, so they can't move the flag.- if !deleted_thread && !message.is_draft {- threads::update::sync_thread_calendar_flag(&mut *tx, message.thread_db_id).await?;+ if !deleted_thread && !is_draft {+ threads::update::sync_thread_calendar_flag(&mut *tx, thread_id).await?;}Ok(MessageDeletion::Deleted {- deleted_thread: deleted_thread.then_some(message.thread_db_id),+ deleted_thread: deleted_thread.then_some(thread_id),+ })+}++/// Identity needed to publish the deletion after the database commit.+pub struct DeferredMessageDeleted {+ /// Thread containing the deleted message.+ pub thread_id: Uuid,+ /// Provider identity the deferred deletion targeted.+ pub provider_id: String,+}++/// Reconcile one retained deletion under the same message lock as Send and Undo.+/// Changed identities/generations retire stale deletions; unresolved sends retain+/// both the deletion and all delivery/recovery data.+#[tracing::instrument(skip(pool), err)]+pub async fn reconcile_deferred_deletion(+ pool: &sqlx::PgPool,+ link_id: Uuid,+ message_id: Uuid,+) -> anyhow::Result<Option<DeferredMessageDeleted>> {+ let mut tx = pool.begin().await?;+ let message = sqlx::query!(+ "SELECT thread_id, provider_id, draft_generation, is_draft FROM email_messages WHERE id=$1 AND link_id=$2 FOR UPDATE",+ message_id, link_id,+ ).fetch_optional(&mut *tx).await?;+ let Some(message) = message else {+ return Ok(None);+ };+ let deferred = sqlx::query!(+ "SELECT provider_id, draft_generation FROM email_deferred_message_deletions WHERE message_id=$1",+ message_id,+ ).fetch_optional(&mut *tx).await?;+ let Some(deferred) = deferred else {+ return Ok(None);+ };+ if message.draft_generation != deferred.draft_generation+ || message.provider_id != deferred.provider_id+ {+ sqlx::query!(+ "DELETE FROM email_deferred_message_deletions WHERE message_id=$1",+ message_id+ )+ .execute(&mut *tx)+ .await?;+ tx.commit().await?;+ return Ok(None);+ }+ let active = sqlx::query_scalar!(+ "SELECT EXISTS(SELECT 1 FROM email_send_attempts WHERE message_id=$1 AND link_id=$2 AND NOT cancelled AND NOT sent) AS \"active!\"",+ message_id, link_id,+ ).fetch_one(&mut *tx).await?;+ if active {+ return Ok(None);+ }++ // Capture recipients before the cascade. Extra candidates are harmless:+ // the CRM cleanup worker checks remaining email sources before removal.+ sqlx::query!(+ r#"INSERT INTO crm_cleanup_candidates (link_id, contact_email)+ SELECT DISTINCT $2::uuid, lower(trim(c.email_address))+ FROM email_message_recipients r JOIN email_contacts c ON c.id = r.contact_id+ WHERE r.message_id=$1 AND c.email_address IS NOT NULL AND trim(c.email_address) <> ''+ ON CONFLICT (link_id, contact_email) DO UPDATE SET created_at=NOW()"#,+ message_id,+ link_id,+ )+ .execute(&mut *tx)+ .await?;+ let result = delete_message_in_thread(+ &mut tx,+ message_id,+ message.thread_id,+ link_id,+ message.is_draft,+ )+ .await?;+ tx.commit().await?;+ tracing::info!(event = "email_send.deferred_deletion_resolved", %message_id, %link_id);+ Ok(match result {+ MessageDeletion::Deleted { .. } => Some(DeferredMessageDeleted {+ thread_id: message.thread_id,+ provider_id: deferred.provider_id.unwrap_or_default(),+ }),+ MessageDeletion::AlreadyDeleted | MessageDeletion::Deferred => None,})}-/// Deletes a message row, returning `false` when no message has this id.+/// Deletes a message row, returning `false` when missing or retained for an active send.#[tracing::instrument(skip(executor), err)]pub async fn delete_db_message<'e, E>(executor: E, message_id: Uuid) -> anyhow::Result<bool>wherediff --git a/crates/email_db_client/src/messages/get_parsed.rs b/crates/email_db_client/src/messages/get_parsed.rsindex 66c687969b..32ec0ebc4d 100644--- a/crates/email_db_client/src/messages/get_parsed.rs+++ b/crates/email_db_client/src/messages/get_parsed.rs@@ -1,13 +1,79 @@use crate::parse::db_to_service::{self};use crate::{contacts, labels};+use chrono::{DateTime, Utc};use futures::future::join_all;use models_email::email::service::message;use models_email::email::{db, service};use models_email::service::message::{MessageWithBodyReplyless, ParsedMessage};+use serde_json::Value as JsonValue;use sqlx::PgPool;use sqlx::types::Uuid;+// Keep the edit generation in the same SQL snapshot as the parsed message.+struct ParsedMessageRow {+ draft_generation: i32,+ id: Uuid,+ provider_id: Option<String>,+ thread_id: Uuid,+ provider_thread_id: Option<String>,+ replying_to_id: Option<Uuid>,+ global_id: Option<String>,+ link_id: Uuid,+ provider_history_id: Option<String>,+ internal_date_ts: Option<DateTime<Utc>>,+ snippet: Option<String>,+ size_estimate: Option<i64>,+ subject: Option<String>,+ from_name: Option<String>,+ from_contact_id: Option<Uuid>,+ sent_at: Option<DateTime<Utc>>,+ has_attachments: bool,+ is_read: bool,+ is_starred: bool,+ is_sent: bool,+ is_draft: bool,+ body_text: Option<String>,+ body_html_sanitized: Option<String>,+ body_macro: Option<String>,+ headers_jsonb: Option<JsonValue>,+ created_at: DateTime<Utc>,+ updated_at: DateTime<Utc>,+}++impl From<ParsedMessageRow> for db::message::Message {+ fn from(row: ParsedMessageRow) -> Self {+ Self {+ id: row.id,+ provider_id: row.provider_id,+ thread_id: row.thread_id,+ provider_thread_id: row.provider_thread_id,+ replying_to_id: row.replying_to_id,+ global_id: row.global_id,+ link_id: row.link_id,+ provider_history_id: row.provider_history_id,+ internal_date_ts: row.internal_date_ts,+ snippet: row.snippet,+ size_estimate: row.size_estimate,+ subject: row.subject,+ from_name: row.from_name,+ from_contact_id: row.from_contact_id,+ sent_at: row.sent_at,+ has_attachments: row.has_attachments,+ is_read: row.is_read,+ is_starred: row.is_starred,+ is_sent: row.is_sent,+ is_draft: row.is_draft,+ body_text: row.body_text,+ body_html_sanitized: row.body_html_sanitized,+ body_macro: row.body_macro,+ headers_jsonb: row.headers_jsonb,+ created_at: row.created_at,+ updated_at: row.updated_at,+ }+ }+}+/// retreive a parsed message by its id./// returns None if no message was found.#[tracing::instrument(skip(pool), err)]@@ -19,10 +85,10 @@ pub async fn get_parsed_message_by_id(// Only fetch parsed bodylet db_message = sqlx::query_as!(- db::message::Message,+ ParsedMessageRow,r#"SELECT- m.id, m.provider_id, m.global_id, m.link_id, m.thread_id, m.provider_thread_id, m.provider_history_id,+ m.draft_generation, m.id, m.provider_id, m.global_id, m.link_id, m.thread_id, m.provider_thread_id, m.provider_history_id,m.replying_to_id, m.internal_date_ts, m.snippet, m.size_estimate, m.subject, m.from_name,m.from_contact_id, m.sent_at, m.has_attachments, m.is_read, m.is_starred, m.is_sent, m.is_draft,NULL::TEXT as body_text,@@ -38,7 +104,7 @@ pub async fn get_parsed_message_by_id(.fetch_optional(&mut *conn).await?;- let db_message: db::message::Message = if let Some(db_message) = db_message {+ let db_message = if let Some(db_message) = db_message {db_message} else {return Ok(None);@@ -62,13 +128,19 @@ pub async fn get_parsed_message_by_id(.unwrap_or_default();let labels = labels_map.get(&db_message.id).cloned().unwrap_or_default();+ let draft_generation = db_message.draft_generation;let service_message = db_to_service::map_attachmentless_db_message_to_service(- db_message, sender, recipients, None, labels,+ db_message.into(),+ sender,+ recipients,+ None,+ labels,);- Ok(Some(ParsedMessage::from(MessageWithBodyReplyless::from(- service_message,- ))))+ Ok(Some(ParsedMessage::with_generation(+ MessageWithBodyReplyless::from(service_message),+ draft_generation,+ )))}/// retreive a list of parsed message by their ids@@ -79,11 +151,11 @@ pub async fn get_parsed_messages_by_id_batch() -> anyhow::Result<Vec<service::message::ParsedMessage>> {let mut conn = pool.acquire().await?;- let db_messages: Vec<db::message::Message> = sqlx::query_as!(- db::message::Message,+ let db_messages: Vec<ParsedMessageRow> = sqlx::query_as!(+ ParsedMessageRow,r#"SELECT- m.id, m.provider_id, m.global_id, m.link_id, m.thread_id, m.provider_thread_id, m.provider_history_id,+ m.draft_generation, m.id, m.provider_id, m.global_id, m.link_id, m.thread_id, m.provider_thread_id, m.provider_history_id,m.replying_to_id, m.internal_date_ts, m.snippet, m.size_estimate, m.subject, m.from_name,m.from_contact_id, m.sent_at, m.has_attachments, m.is_read, m.is_starred, m.is_sent, m.is_draft,m.body_text as body_text,@@ -127,11 +199,19 @@ pub async fn get_parsed_messages_by_id_batch(let recipients = recipients_map.get(&message.id).cloned().unwrap_or_default();let labels = labels_map.get(&message.id).cloned().unwrap_or_default();+ let draft_generation = message.draft_generation;let service_message = db_to_service::map_attachmentless_db_message_to_service(- message, sender, recipients, None, labels,+ message.into(),+ sender,+ recipients,+ None,+ labels,);- ParsedMessage::from(MessageWithBodyReplyless::from(service_message))+ ParsedMessage::with_generation(+ MessageWithBodyReplyless::from(service_message),+ draft_generation,+ )}}).collect();@@ -152,10 +232,11 @@ pub async fn get_paginated_parsed_messages_by_thread_id(let mut conn = pool.acquire().await?;// Get messages for thread- let db_messages: Vec<db::message::Message> = sqlx::query_as!(- db::message::Message,+ let db_messages: Vec<ParsedMessageRow> = sqlx::query_as!(+ ParsedMessageRow,r#"SELECT+ draft_generation,id,provider_id,global_id,@@ -223,11 +304,19 @@ pub async fn get_paginated_parsed_messages_by_thread_id(let recipients = recipients_map.get(&message.id).cloned().unwrap_or_default();let labels = labels_map.get(&message.id).cloned().unwrap_or_default();+ let draft_generation = message.draft_generation;let service_message = db_to_service::map_attachmentless_db_message_to_service(- message, sender, recipients, None, labels,+ message.into(),+ sender,+ recipients,+ None,+ labels,);- ParsedMessage::from(MessageWithBodyReplyless::from(service_message))+ ParsedMessage::with_generation(+ MessageWithBodyReplyless::from(service_message),+ draft_generation,+ )}}).collect();diff --git a/crates/email_db_client/src/messages/get_simple_messages.rs b/crates/email_db_client/src/messages/get_simple_messages.rsindex b204319646..7733f2b2a8 100644--- a/crates/email_db_client/src/messages/get_simple_messages.rs+++ b/crates/email_db_client/src/messages/get_simple_messages.rs@@ -25,11 +25,14 @@ pub async fn get_simple_messages(/// retrieve a simplified version of message that has no nested fields (contacts, labels, attachments). Direct/// map from the db::message::Message object, with no body attributes. returns None if no message was found.-pub async fn get_simple_message_by_provider_and_link(- pool: &PgPool,+pub async fn get_simple_message_by_provider_and_link<'e, E>(+ executor: E,provider_id: &str,link_id: &Uuid,-) -> anyhow::Result<Option<message::SimpleMessage>> {+) -> anyhow::Result<Option<message::SimpleMessage>>+where+ E: Executor<'e, Database = Postgres>,+{// Fetch message without body-related attributeslet db_message = sqlx::query_as!(db::message::Message,@@ -48,7 +51,7 @@ pub async fn get_simple_message_by_provider_and_link(provider_id,link_id)- .fetch_optional(pool)+ .fetch_optional(executor).await?;if let Some(db_message) = db_message {@@ -59,6 +62,28 @@ pub async fn get_simple_message_by_provider_and_link(}}+/// Resolve a provider deletion while holding the message lock until the caller+/// commits. Send completion and Undo cannot replace its identity or draft state+/// between this lookup and deletion. Use only within an explicit transaction.+#[tracing::instrument(skip(tx), err)]+pub async fn get_simple_message_by_provider_and_link_for_update(+ tx: &mut sqlx::PgConnection,+ provider_id: &str,+ link_id: &Uuid,+) -> anyhow::Result<Option<message::SimpleMessage>> {+ let locked = sqlx::query!(+ "SELECT id FROM email_messages WHERE provider_id=$1 AND link_id=$2 FOR UPDATE",+ provider_id,+ link_id,+ )+ .fetch_optional(&mut *tx)+ .await?;+ if locked.is_none() {+ return Ok(None);+ }+ get_simple_message_by_provider_and_link(&mut *tx, provider_id, link_id).await+}+/// retrieve a simplified version of message that has no nested fields (contacts, labels, attachments). Direct/// map from the db::message::Message object, with no body attributes. returns None if no message was found.pub async fn get_simple_message(diff --git a/crates/email_db_client/src/messages/insert.rs b/crates/email_db_client/src/messages/insert.rsindex 1278c6d601..3d35573b22 100644--- a/crates/email_db_client/src/messages/insert.rs+++ b/crates/email_db_client/src/messages/insert.rs@@ -25,6 +25,9 @@ pub async fn insert_message_with_tx(// 2. backfilling messages (metadata gets updated once after all messages complete)update_thread_metadata: bool,) -> anyhow::Result<()> {+ if let Some(provider_thread_id) = message.provider_thread_id.as_deref() {+ threads::provider_identity::lock_provider_thread(tx, link_id, provider_thread_id).await?;+ }let message_db_id = insert_db_message(tx,message,diff --git a/crates/email_db_client/src/messages/mod.rs b/crates/email_db_client/src/messages/mod.rsindex dae9ac5b36..e428ae3e92 100644--- a/crates/email_db_client/src/messages/mod.rs+++ b/crates/email_db_client/src/messages/mod.rs@@ -6,6 +6,7 @@ pub mod get_simple_messages;pub mod insert;pub mod replying_to_id;pub mod scheduled;+pub mod sent_identity;#[cfg(test)]mod test;pub mod update;diff --git a/crates/email_db_client/src/messages/scheduled/delivery.rs b/crates/email_db_client/src/messages/scheduled/delivery.rsnew file mode 100644index 0000000000..624bd067a2--- /dev/null+++ b/crates/email_db_client/src/messages/scheduled/delivery.rs@@ -0,0 +1,202 @@+//! Fenced persistence for recoverable scheduled delivery.++use models_email::service::message::ScheduledMessage;+use sqlx::types::Uuid;+use sqlx::{PgConnection, PgPool};++/// A unique ownership receipt; replacing it fences every older invocation.+#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub struct DeliveryClaimToken(pub Uuid);++/// Facts acquired atomically before any provider I/O.+pub struct DeliveryClaim {+ /// Scheduled message identity and attribution.+ pub schedule: ScheduledMessage,+ /// Ownership required by every subsequent transition.+ pub token: DeliveryClaimToken,+ /// Stable RFC 5322 Message-ID; absent for uncertain pre-upgrade submissions.+ pub message_id_header: Option<String>,+ /// Whether a provider submission may already have happened.+ pub requires_reconciliation: bool,+ /// Immutable approved content, when admitted through GraphQL.+ /// Attachment identities retained for every scheduled send.+ pub approved_attachments: serde_json::Value,+ pub approved_snapshot: Option<serde_json::Value>,+ /// Prepared envelope/body frozen by GraphQL admission; absent for older writes.+ pub prepared_content: Option<serde_json::Value>,+}++/// Acquire a fresh or expired claim under the common message -> schedule lock order.+#[tracing::instrument(skip(pool), err)]+pub async fn claim_delivery(+ pool: &PgPool,+ link_id: Uuid,+ message_id: Uuid,+ lease_seconds: i32,+) -> anyhow::Result<Option<DeliveryClaim>> {+ let mut tx = pool.begin().await?;+ let message = sqlx::query!(+ "SELECT is_sent FROM email_messages WHERE id = $1 AND link_id = $2 FOR UPDATE",+ message_id,+ link_id,+ )+ .fetch_optional(&mut *tx)+ .await?;+ if message.is_none_or(|message| message.is_sent) {+ return Ok(None);+ }+ let schedule = sqlx::query!(+ r#"SELECT send_time, sent, processing, actor_id, delivery_claim_id,+ delivery_started_at, delivery_message_id, delivery_status, approved_attachments,+ (send_time <= NOW() AND NOT sent AND delivery_status <> 'failed'+ AND (CASE WHEN processing THEN+ COALESCE(delivery_lease_expires_at, updated_at + make_interval(secs => $3)) <= NOW()+ ELSE delivery_lease_expires_at IS NULL OR delivery_lease_expires_at <= NOW() END)) AS "available!"+ FROM email_scheduled_messages WHERE message_id = $1 AND link_id = $2 FOR UPDATE"#,+ message_id, link_id, f64::from(lease_seconds),+ ).fetch_optional(&mut *tx).await?;+ let Some(schedule) = schedule.filter(|row| row.available) else {+ return Ok(None);+ };+ // Old claims have no submission boundary. Never infer they are safe to resend.+ let legacy_claim = schedule.processing && schedule.delivery_claim_id.is_none();+ let reconcile = legacy_claim+ || schedule.delivery_started_at.is_some()+ || schedule.delivery_status == "unconfirmed";+ let header = schedule.delivery_message_id.or_else(|| {+ (!reconcile).then(|| {+ format!(+ "{}.{}@send.macro.com",+ message_id,+ macro_uuid::generate_uuid_v7()+ )+ })+ });+ let token = DeliveryClaimToken(macro_uuid::generate_uuid_v7());+ sqlx::query!(+ r#"UPDATE email_scheduled_messages SET processing = true, delivery_claim_id = $3,+ delivery_lease_expires_at = NOW() + make_interval(secs => $4),+ delivery_message_id = $5,+ delivery_started_at = CASE WHEN $6 THEN COALESCE(delivery_started_at, updated_at) ELSE delivery_started_at END,+ updated_at = NOW() WHERE message_id = $1 AND link_id = $2"#,+ message_id, link_id, token.0, f64::from(lease_seconds), header, legacy_claim,+ ).execute(&mut *tx).await?;+ let attempt = sqlx::query!(+ "SELECT request, prepared_content FROM email_send_attempts WHERE message_id = $1 AND link_id = $2 AND NOT cancelled AND NOT sent ORDER BY send_time DESC NULLS LAST LIMIT 1",+ message_id, link_id,+ ).fetch_optional(&mut *tx).await?;+ tx.commit().await?;+ Ok(Some(DeliveryClaim {+ schedule: ScheduledMessage {+ link_id,+ message_id,+ send_time: schedule.send_time,+ sent: false,+ processing: true,+ actor_id: schedule.actor_id,+ },+ token,+ message_id_header: header,+ requires_reconciliation: reconcile,+ approved_attachments: schedule.approved_attachments,+ approved_snapshot: attempt.as_ref().and_then(|attempt| attempt.request.clone()),+ prepared_content: attempt.and_then(|attempt| attempt.prepared_content),+ }))+}++/// Persist the point after which loss of this invocation requires reconciliation.+#[tracing::instrument(skip(pool, claim), err)]+pub async fn begin_submission(+ pool: &PgPool,+ claim: &DeliveryClaim,+ lease_seconds: i32,+) -> anyhow::Result<bool> {+ let changed = sqlx::query!(+ r#"UPDATE email_scheduled_messages SET delivery_started_at = NOW(),+ delivery_lease_expires_at = NOW() + make_interval(secs => $4), updated_at = NOW()+ WHERE message_id = $1 AND link_id = $2 AND delivery_claim_id = $3+ AND processing AND NOT sent AND delivery_status = 'ready'+ AND delivery_started_at IS NULL AND delivery_lease_expires_at > NOW()"#,+ claim.schedule.message_id,+ claim.schedule.link_id,+ claim.token.0,+ f64::from(lease_seconds),+ )+ .execute(pool)+ .await?;+ Ok(changed.rows_affected() == 1)+}++/// Back off preparation without exposing managed claims to pre-upgrade workers.+#[tracing::instrument(skip(pool, claim), err)]+pub async fn release_preparation(+ pool: &PgPool,+ claim: &DeliveryClaim,+ retry_seconds: i32,+) -> anyhow::Result<()> {+ sqlx::query!(+ r#"UPDATE email_scheduled_messages SET processing = true,+ delivery_lease_expires_at = NOW() + make_interval(secs => $4), updated_at = NOW()+ WHERE message_id = $1 AND link_id = $2 AND delivery_claim_id = $3+ AND processing AND NOT sent AND delivery_started_at IS NULL AND delivery_status = 'ready'"#,+ claim.schedule.message_id, claim.schedule.link_id, claim.token.0, f64::from(retry_seconds),+ ).execute(pool).await?;+ Ok(())+}++/// Persist a paused delivery; unconfirmed outcomes remain eligible only for lookup.+#[tracing::instrument(skip(pool, claim), err)]+pub async fn pause_delivery(+ pool: &PgPool,+ claim: &DeliveryClaim,+ unconfirmed: bool,+ retry_seconds: i32,+) -> anyhow::Result<()> {+ sqlx::query!(+ r#"UPDATE email_scheduled_messages SET processing = true,+ delivery_status = CASE WHEN $4 THEN 'unconfirmed' ELSE 'failed' END,+ delivery_lease_expires_at = NOW() + make_interval(secs => $5), updated_at = NOW()+ WHERE message_id = $1 AND link_id = $2 AND delivery_claim_id = $3 AND NOT sent"#,+ claim.schedule.message_id,+ claim.schedule.link_id,+ claim.token.0,+ unconfirmed,+ f64::from(retry_seconds),+ )+ .execute(pool)+ .await?;+ Ok(())+}++/// Fence completion after taking the message lock, before changing message state.+#[tracing::instrument(skip(tx, claim), err)]+pub async fn complete_delivery(+ tx: &mut PgConnection,+ claim: &DeliveryClaim,+) -> anyhow::Result<bool> {+ let row = sqlx::query!(+ "SELECT is_sent FROM email_messages WHERE id = $1 AND link_id = $2 FOR UPDATE",+ claim.schedule.message_id,+ claim.schedule.link_id,+ )+ .fetch_optional(&mut *tx)+ .await?;+ if row.is_none_or(|row| row.is_sent) {+ return Ok(false);+ }+ let changed = sqlx::query!(+ r#"UPDATE email_scheduled_messages SET sent = true, processing = false,+ delivery_status = 'ready', delivery_lease_expires_at = NULL, updated_at = NOW()+ WHERE message_id = $1 AND link_id = $2 AND delivery_claim_id = $3+ AND processing AND NOT sent AND delivery_started_at IS NOT NULL"#,+ claim.schedule.message_id,+ claim.schedule.link_id,+ claim.token.0,+ )+ .execute(&mut *tx)+ .await?;+ Ok(changed.rows_affected() == 1)+}++#[cfg(test)]+mod test;diff --git a/crates/email_db_client/src/messages/scheduled/delivery/test.rs b/crates/email_db_client/src/messages/scheduled/delivery/test.rsnew file mode 100644index 0000000000..83940611b6--- /dev/null+++ b/crates/email_db_client/src/messages/scheduled/delivery/test.rs@@ -0,0 +1,331 @@+use super::*;+use macro_db_migrator::MACRO_DB_MIGRATIONS;++fn identity() -> (Uuid, Uuid) {+ (+ Uuid::parse_str("00000000-0000-0000-0000-000000000e01").unwrap(),+ Uuid::parse_str("00000000-0000-0000-0000-00000000e501").unwrap(),+ )+}++async fn claim(pool: &PgPool) -> anyhow::Result<DeliveryClaim> {+ let (link, message) = identity();+ claim_delivery(pool, link, message, 300)+ .await?+ .ok_or_else(|| anyhow::anyhow!("expected a delivery claim"))+}++async fn expire(pool: &PgPool) -> anyhow::Result<()> {+ sqlx::query!(+ "UPDATE email_scheduled_messages SET delivery_lease_expires_at = NOW() - INTERVAL '1 second' WHERE message_id = $1",+ identity().1,+ ).execute(pool).await?;+ Ok(())+}++#[derive(Debug, PartialEq, Eq)]+struct State {+ token: Option<Uuid>,+ processing: bool,+ sent: bool,+ started: bool,+ status: String,+ expires: Option<chrono::DateTime<chrono::Utc>>,+}++async fn state(pool: &PgPool) -> anyhow::Result<State> {+ let row = sqlx::query!(+ r#"SELECT delivery_claim_id, processing, sent, delivery_started_at IS NOT NULL AS "started!",+ delivery_status, delivery_lease_expires_at+ FROM email_scheduled_messages WHERE message_id = $1"#,+ identity().1,+ ).fetch_one(pool).await?;+ Ok(State {+ token: row.delivery_claim_id,+ processing: row.processing,+ sent: row.sent,+ started: row.started,+ status: row.delivery_status,+ expires: row.delivery_lease_expires_at,+ })+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn concurrent_claims_have_one_owner(pool: PgPool) -> anyhow::Result<()> {+ let (link, message) = identity();+ let (first, second) = tokio::join!(+ claim_delivery(&pool, link, message, 300),+ claim_delivery(&pool, link, message, 300),+ );+ let owners: Vec<_> = [first?, second?].into_iter().flatten().collect();+ assert_eq!(owners.len(), 1);+ assert!(!owners[0].requires_reconciliation);+ assert!(owners[0].message_id_header.is_some());+ assert_eq!(state(&pool).await?.token, Some(owners[0].token.0));+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn expiry_before_submission_allows_preparation_with_same_message_id(+ pool: PgPool,+) -> anyhow::Result<()> {+ let first = claim(&pool).await?;+ expire(&pool).await?;+ assert!(!begin_submission(&pool, &first, 300).await?);+ let second = claim(&pool).await?;+ assert_ne!(first.token, second.token);+ assert_eq!(first.message_id_header, second.message_id_header);+ assert!(!second.requires_reconciliation);+ assert!(begin_submission(&pool, &second, 300).await?);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn expiry_after_submission_permits_only_reconciliation(pool: PgPool) -> anyhow::Result<()> {+ let first = claim(&pool).await?;+ assert!(begin_submission(&pool, &first, 300).await?);+ expire(&pool).await?;+ let second = claim(&pool).await?;+ assert!(second.requires_reconciliation);+ assert_eq!(first.message_id_header, second.message_id_header);+ assert!(!begin_submission(&pool, &second, 300).await?);+ let before = state(&pool).await?;+ release_preparation(&pool, &second, 0).await?;+ assert_eq!(state(&pool).await?, before);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn old_worker_claim_without_message_id_remains_ambiguous(pool: PgPool) -> anyhow::Result<()> {+ sqlx::query!(+ "UPDATE email_scheduled_messages SET processing = true, updated_at = NOW() - INTERVAL '1 day' WHERE message_id = $1",+ identity().1,+ ).execute(&pool).await?;+ let recovered = claim(&pool).await?;+ assert!(recovered.requires_reconciliation);+ assert!(recovered.message_id_header.is_none());+ assert!(state(&pool).await?.started);+ assert!(!begin_submission(&pool, &recovered, 300).await?);+ expire(&pool).await?;+ let again = claim(&pool).await?;+ assert!(again.requires_reconciliation);+ assert!(again.message_id_header.is_none());+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn reclaimed_worker_fences_every_stale_transition(pool: PgPool) -> anyhow::Result<()> {+ let old = claim(&pool).await?;+ expire(&pool).await?;+ let current = claim(&pool).await?;+ assert!(begin_submission(&pool, ¤t, 300).await?);+ let before = state(&pool).await?;+ assert!(!begin_submission(&pool, &old, 300).await?);+ assert_eq!(state(&pool).await?, before);+ release_preparation(&pool, &old, 0).await?;+ assert_eq!(state(&pool).await?, before);+ for unconfirmed in [false, true] {+ pause_delivery(&pool, &old, unconfirmed, 0).await?;+ assert_eq!(state(&pool).await?, before);+ }+ let mut tx = pool.begin().await?;+ assert!(!complete_delivery(&mut tx, &old).await?);+ tx.commit().await?;+ assert_eq!(state(&pool).await?, before);+ let mut tx = pool.begin().await?;+ assert!(complete_delivery(&mut tx, ¤t).await?);+ tx.commit().await?;+ assert!(state(&pool).await?.sent);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn failed_delivery_never_becomes_claimable_just_because_time_passes(+ pool: PgPool,+) -> anyhow::Result<()> {+ let first = claim(&pool).await?;+ pause_delivery(&pool, &first, false, 0).await?;+ expire(&pool).await?;+ let (link, message) = identity();+ assert!(claim_delivery(&pool, link, message, 300).await?.is_none());+ let current = state(&pool).await?;+ assert_eq!(current.status, "failed");+ assert!(+ current.processing,+ "old workers must not retry this paused row"+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn unconfirmed_delivery_can_only_be_claimed_for_lookup(pool: PgPool) -> anyhow::Result<()> {+ let first = claim(&pool).await?;+ assert!(begin_submission(&pool, &first, 300).await?);+ pause_delivery(&pool, &first, true, 300).await?;+ let (link, message) = identity();+ assert!(claim_delivery(&pool, link, message, 300).await?.is_none());+ expire(&pool).await?;+ let recovered = claim(&pool).await?;+ assert!(recovered.requires_reconciliation);+ assert!(!begin_submission(&pool, &recovered, 300).await?);+ let mut tx = pool.begin().await?;+ assert!(complete_delivery(&mut tx, &recovered).await?);+ tx.commit().await?;+ assert!(state(&pool).await?.sent);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn preparation_release_backs_off_and_preserves_stable_identity(+ pool: PgPool,+) -> anyhow::Result<()> {+ let first = claim(&pool).await?;+ release_preparation(&pool, &first, 300).await?;+ assert!(state(&pool).await?.processing);+ // An old deployed worker only understands this processing predicate.+ let claimed = sqlx::query!(+ "UPDATE email_scheduled_messages SET processing = true, updated_at = NOW() WHERE message_id = $1 AND processing = false AND sent = false RETURNING message_id",+ identity().1,+ ).fetch_optional(&pool).await?;+ assert!(claimed.is_none());+ let (link, message) = identity();+ assert!(claim_delivery(&pool, link, message, 300).await?.is_none());+ expire(&pool).await?;+ let retried = claim(&pool).await?;+ assert!(!retried.requires_reconciliation);+ assert_eq!(first.message_id_header, retried.message_id_header);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn pre_upgrade_unfenced_clear_cannot_reopen_uncertain_delivery(+ pool: PgPool,+) -> anyhow::Result<()> {+ let first = claim(&pool).await?;+ assert!(begin_submission(&pool, &first, 300).await?);+ expire(&pool).await?;+ let current = claim(&pool).await?;+ pause_delivery(&pool, ¤t, true, 300).await?;+ let before = state(&pool).await?;+ // This is deliberately the old unfenced UPDATE, not the guarded current helper.+ let error = sqlx::query!(+ "UPDATE email_scheduled_messages SET processing=false, updated_at=NOW() WHERE message_id=$1",+ identity().1,+ ).execute(&pool).await.unwrap_err();+ assert_eq!(+ error+ .as_database_error()+ .and_then(|error| error.code())+ .as_deref(),+ Some("23514")+ );+ assert_eq!(state(&pool).await?, before);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn pre_upgrade_successful_completion_remains_compatible(pool: PgPool) -> anyhow::Result<()> {+ let first = claim(&pool).await?;+ assert!(begin_submission(&pool, &first, 300).await?);+ sqlx::query!(+ "UPDATE email_scheduled_messages SET sent=true, processing=false, updated_at=NOW() WHERE message_id=$1",+ identity().1,+ ).execute(&pool).await?;+ let completed = state(&pool).await?;+ assert!(completed.sent);+ assert!(!completed.processing);+ assert!(+ claim_delivery(&pool, identity().0, identity().1, 300)+ .await?+ .is_none()+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn pre_upgrade_unfenced_clear_cannot_reopen_failed_delivery(+ pool: PgPool,+) -> anyhow::Result<()> {+ let current = claim(&pool).await?;+ pause_delivery(&pool, ¤t, false, 300).await?;+ let before = state(&pool).await?;+ let error = sqlx::query!(+ "UPDATE email_scheduled_messages SET processing=false, updated_at=NOW() WHERE message_id=$1",+ identity().1,+ ).execute(&pool).await.unwrap_err();+ assert_eq!(+ error+ .as_database_error()+ .and_then(|error| error.code())+ .as_deref(),+ Some("23514")+ );+ assert_eq!(state(&pool).await?, before);+ Ok(())+}diff --git a/crates/email_db_client/src/messages/scheduled/get.rs b/crates/email_db_client/src/messages/scheduled/get.rsindex 5e41f43ff6..36d703c138 100644--- a/crates/email_db_client/src/messages/scheduled/get.rs+++ b/crates/email_db_client/src/messages/scheduled/get.rs@@ -57,6 +57,7 @@ pub async fn get_and_start_processing_scheduled_message(SET processing = true, updated_at = NOW()WHERE link_id = $1 AND message_id = $2AND NOT sent AND NOT processing AND send_time <= NOW()+ AND delivery_claim_id IS NULL AND delivery_started_at IS NULL AND delivery_status = 'ready'AND NOT EXISTS(SELECT 1 FROM email_attachments_drafts WHERE draft_id=$2 AND upload_pending)AND NOT EXISTS(SELECT 1 FROM email_draft_transfers WHERE (destination_id=$2 AND state NOT IN ('ready','retained','preparing')) OR (source_id=$2 AND state<>'preparing'))RETURNING link_id, message_id, send_time, sent, processing, actor_iddiff --git a/crates/email_db_client/src/messages/scheduled/mod.rs b/crates/email_db_client/src/messages/scheduled/mod.rsindex a5bddfa697..ea1872ff2a 100644--- a/crates/email_db_client/src/messages/scheduled/mod.rs+++ b/crates/email_db_client/src/messages/scheduled/mod.rs@@ -1,4 +1,5 @@pub mod delete;+pub mod delivery;pub mod get;#[cfg(test)]mod test;diff --git a/crates/email_db_client/src/messages/scheduled/upsert.rs b/crates/email_db_client/src/messages/scheduled/upsert.rsindex 5ad047f4b8..3f5f95355c 100644--- a/crates/email_db_client/src/messages/scheduled/upsert.rs+++ b/crates/email_db_client/src/messages/scheduled/upsert.rs@@ -52,7 +52,7 @@ wheresent = true,processing = false,updated_at = NOW()- WHERE link_id = $1 AND message_id = $2 AND processing AND NOT sent+ WHERE link_id = $1 AND message_id = $2 AND processing AND NOT sent AND delivery_claim_id IS NULL"#,link_id,message_id,@@ -80,7 +80,7 @@ whereSETprocessing = false,updated_at = NOW()- WHERE link_id = $1 AND message_id = $2 AND processing AND NOT sent+ WHERE link_id = $1 AND message_id = $2 AND processing AND NOT sent AND delivery_claim_id IS NULL"#,link_id,message_id,diff --git a/crates/email_db_client/src/messages/sent_identity.rs b/crates/email_db_client/src/messages/sent_identity.rsnew file mode 100644index 0000000000..be5df07374--- /dev/null+++ b/crates/email_db_client/src/messages/sent_identity.rs@@ -0,0 +1,180 @@+//! Preserve the local message identity when inbox sync wins the delivery race.++use sqlx::PgConnection;+use sqlx::types::Uuid;++/// Adopt an already imported provider message into the original local message.+///+/// The caller holds the provider-thread advisory lock and the local message row+/// lock. Related rows move before the imported message is removed, so attachment+/// IDs (including forwarded and document references) and replies survive.+#[tracing::instrument(skip(tx), err)]+pub async fn reconcile_message(+ tx: &mut PgConnection,+ link_id: Uuid,+ message_id: Uuid,+ provider_id: &str,+) -> anyhow::Result<()> {+ let imported = sqlx::query!(+ r#"SELECT provider.id FROM email_messages provider+ JOIN email_messages local ON local.id = $3 AND local.link_id = $1+ WHERE provider.link_id = $1 AND provider.provider_id = $2 AND provider.id <> $3+ FOR UPDATE OF provider"#,+ link_id,+ provider_id,+ message_id,+ )+ .fetch_optional(&mut *tx)+ .await?;+ let Some(imported) = imported else {+ return Ok(());+ };++ sqlx::query!(+ r#"UPDATE email_messages local SET+ global_id = provider.global_id,+ provider_history_id = provider.provider_history_id,+ internal_date_ts = COALESCE(provider.internal_date_ts, local.internal_date_ts),+ snippet = provider.snippet, size_estimate = provider.size_estimate,+ sent_at = COALESCE(provider.sent_at, local.sent_at),+ has_attachments = local.has_attachments OR provider.has_attachments,+ is_read = provider.is_read, is_starred = local.is_starred OR provider.is_starred,+ headers_jsonb = provider.headers_jsonb+ FROM email_messages provider+ WHERE local.id = $1 AND local.link_id = $3 AND provider.id = $2"#,+ message_id,+ imported.id,+ link_id,+ )+ .execute(&mut *tx)+ .await?;++ sqlx::query!(+ r#"INSERT INTO email_message_labels (message_id, label_id)+ SELECT $1, label_id FROM email_message_labels WHERE message_id = $2+ ON CONFLICT DO NOTHING"#,+ message_id,+ imported.id,+ )+ .execute(&mut *tx)+ .await?;+ sqlx::query!(+ r#"INSERT INTO email_message_recipients (message_id, contact_id, recipient_type, name)+ SELECT $1, contact_id, recipient_type, name+ FROM email_message_recipients WHERE message_id = $2+ ON CONFLICT (message_id, contact_id, recipient_type) DO UPDATE+ SET name = COALESCE(EXCLUDED.name, email_message_recipients.name)"#,+ message_id,+ imported.id,+ )+ .execute(&mut *tx)+ .await?;+ sqlx::query!(+ r#"INSERT INTO email_message_calendar_invites (message_id, component_id, snapshot)+ SELECT $1, component_id, snapshot FROM email_message_calendar_invites WHERE message_id = $2+ ON CONFLICT (message_id, component_id) DO UPDATE SET snapshot = EXCLUDED.snapshot"#,+ message_id,+ imported.id,+ )+ .execute(&mut *tx)+ .await?;+ sqlx::query!(+ "UPDATE email_messages SET replying_to_id = $1 WHERE replying_to_id = $2",+ message_id,+ imported.id,+ )+ .execute(&mut *tx)+ .await?;+ sqlx::query!(+ "UPDATE email_draft_client_ids SET message_id = $1 WHERE message_id = $2",+ message_id,+ imported.id,+ )+ .execute(&mut *tx)+ .await?;+ sqlx::query!(+ "UPDATE email_attachments_drafts SET draft_id = $1 WHERE draft_id = $2",+ message_id,+ imported.id,+ )+ .execute(&mut *tx)+ .await?;+ sqlx::query!(+ r#"INSERT INTO email_attachments_fwd (message_id, attachment_id, created_at)+ SELECT $1, attachment_id, created_at FROM email_attachments_fwd WHERE message_id = $2+ ON CONFLICT DO NOTHING"#,+ message_id,+ imported.id,+ )+ .execute(&mut *tx)+ .await?;++ reconcile_attachments(tx, message_id, imported.id).await?;+ sqlx::query!("DELETE FROM email_messages WHERE id = $1", imported.id)+ .execute(tx)+ .await?;+ Ok(())+}++async fn reconcile_attachments(+ tx: &mut PgConnection,+ message_id: Uuid,+ imported_id: Uuid,+) -> anyhow::Result<()> {+ // Normally only the imported message has provider attachments. If both do,+ // retain the imported attachment ID and move the local one's references.+ let duplicates = sqlx::query!(+ r#"SELECT local.id AS local_id, provider.id AS provider_id+ FROM email_attachments local JOIN email_attachments provider+ ON provider.provider_attachment_id = local.provider_attachment_id+ WHERE local.message_id = $1 AND provider.message_id = $2"#,+ message_id,+ imported_id,+ )+ .fetch_all(&mut *tx)+ .await?;+ for duplicate in duplicates {+ sqlx::query!(+ "UPDATE email_attachments_sfs SET attachment_id = $1 WHERE attachment_id = $2",+ duplicate.provider_id,+ duplicate.local_id,+ )+ .execute(&mut *tx)+ .await?;+ sqlx::query!(+ r#"INSERT INTO email_attachments_fwd (message_id, attachment_id, created_at)+ SELECT message_id, $1, created_at FROM email_attachments_fwd WHERE attachment_id = $2+ ON CONFLICT DO NOTHING"#,+ duplicate.provider_id,+ duplicate.local_id,+ )+ .execute(&mut *tx)+ .await?;+ sqlx::query!(+ r#"INSERT INTO document_email (document_id, email_attachment_id)+ SELECT document_id, $1 FROM document_email WHERE email_attachment_id = $2+ ON CONFLICT DO NOTHING"#,+ duplicate.provider_id,+ duplicate.local_id,+ )+ .execute(&mut *tx)+ .await?;+ sqlx::query!(+ "DELETE FROM email_attachments WHERE id = $1",+ duplicate.local_id+ )+ .execute(&mut *tx)+ .await?;+ }+ sqlx::query!(+ "UPDATE email_attachments SET message_id = $1 WHERE message_id = $2",+ message_id,+ imported_id,+ )+ .execute(tx)+ .await?;+ Ok(())+}++#[cfg(test)]+mod test;diff --git a/crates/email_db_client/src/messages/sent_identity/test.rs b/crates/email_db_client/src/messages/sent_identity/test.rsnew file mode 100644index 0000000000..52a1d006fb--- /dev/null+++ b/crates/email_db_client/src/messages/sent_identity/test.rs@@ -0,0 +1,376 @@+use super::reconcile_message;+use crate::messages::scheduled::delivery;+use crate::messages::update::mark_message_as_sent;+use crate::threads::provider_identity::{lock_provider_thread, reconcile_sent_thread};+use macro_db_migrator::MACRO_DB_MIGRATIONS;+use sqlx::{PgPool, types::Uuid};++const LINK: Uuid = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000001);+const THREAD: Uuid = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000101);+const PROVIDER_THREAD: Uuid = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000102);+const MESSAGE: Uuid = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000201);+const IMPORTED: Uuid = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000202);+const ATTACHMENT: Uuid = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000401);+const CONTACT: Uuid = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000301);++async fn imported_delivery(pool: &PgPool) -> anyhow::Result<delivery::DeliveryClaim> {+ sqlx::query!(+ "INSERT INTO email_scheduled_messages (link_id, message_id, send_time) VALUES ($1, $2, NOW() - INTERVAL '1 second')",+ LINK, MESSAGE,+ ).execute(pool).await?;+ let claim = delivery::claim_delivery(pool, LINK, MESSAGE, 300)+ .await?+ .unwrap();+ assert!(delivery::begin_submission(pool, &claim, 300).await?);+ sqlx::query!(+ r#"INSERT INTO email_send_attempts (user_id, link_id, attempt_id, message_id, thread_id)+ VALUES ('macro|[email protected]', $1, $2, $2, $3)"#,+ LINK,+ MESSAGE,+ THREAD,+ )+ .execute(pool)+ .await?;+ sqlx::query!(+ "UPDATE email_threads SET provider_id = 'sent-provider-thread' WHERE id = $1",+ PROVIDER_THREAD,+ )+ .execute(pool)+ .await?;+ sqlx::query!(+ r#"UPDATE email_messages SET provider_id = 'sent-provider-message',+ provider_thread_id = 'sent-provider-thread', is_sent = TRUE,+ global_id = $2, headers_jsonb = '{"received":"headers"}', is_starred = TRUE,+ has_attachments = TRUE WHERE id = $1"#,+ IMPORTED,+ claim.message_id_header,+ )+ .execute(pool)+ .await?;+ sqlx::query!(+ "INSERT INTO email_attachments (id, message_id, provider_attachment_id, filename) VALUES ($1, $2, 'attachment', 'event.ics')",+ ATTACHMENT, IMPORTED,+ ).execute(pool).await?;+ sqlx::query!(+ "INSERT INTO email_attachments_fwd (message_id, attachment_id) VALUES ($1, $2)",+ MESSAGE,+ ATTACHMENT,+ )+ .execute(pool)+ .await?;+ sqlx::query!(+ "INSERT INTO email_message_recipients (message_id, contact_id, recipient_type, name) VALUES ($1, $2, 'TO', 'Provider recipient')",+ IMPORTED, CONTACT,+ ).execute(pool).await?;+ sqlx::query!(+ "INSERT INTO email_message_calendar_invites (message_id, component_id, snapshot) VALUES ($1, 'invitation', '{}')",+ IMPORTED,+ ).execute(pool).await?;+ Ok(claim)+}++async fn complete(pool: &PgPool, claim: &delivery::DeliveryClaim) -> anyhow::Result<bool> {+ let mut tx = pool.begin().await?;+ lock_provider_thread(&mut tx, LINK, "sent-provider-thread").await?;+ if !delivery::complete_delivery(&mut tx, claim).await? {+ return Ok(false);+ }+ reconcile_message(&mut tx, LINK, MESSAGE, "sent-provider-message").await?;+ let thread = reconcile_sent_thread(&mut tx, LINK, MESSAGE, "sent-provider-thread").await?;+ mark_message_as_sent(+ &mut tx,+ "sent-provider-message",+ "sent-provider-thread",+ LINK,+ MESSAGE,+ )+ .await?;+ crate::threads::update::update_thread_metadata(&mut tx, thread, LINK).await?;+ crate::threads::update::sync_thread_calendar_flag(&mut tx, thread).await?;+ tx.commit().await?;+ Ok(true)+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../fixtures", scripts("mark_message_as_sent"))+)]+async fn sync_before_completion_preserves_original_message_and_imported_dependents(+ pool: PgPool,+) -> anyhow::Result<()> {+ let claim = imported_delivery(&pool).await?;+ let reply = macro_uuid::generate_uuid_v7();+ sqlx::query!(+ "INSERT INTO email_messages (id, link_id, thread_id, replying_to_id) VALUES ($1, $2, $3, $4)",+ reply, LINK, THREAD, IMPORTED,+ ).execute(&pool).await?;+ assert!(complete(&pool, &claim).await?);+ let message = sqlx::query!(+ r#"SELECT id, thread_id, is_sent, internal_date_ts, is_starred, has_attachments+ FROM email_messages WHERE link_id = $1 AND provider_id = 'sent-provider-message'"#,+ LINK,+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(message.id, MESSAGE);+ assert_eq!(message.thread_id, PROVIDER_THREAD);+ assert!(message.is_sent && message.is_starred && message.has_attachments);+ assert_eq!(+ message.internal_date_ts.unwrap().to_rfc3339(),+ "2025-01-01T12:00:00+00:00"+ );+ let attachment = sqlx::query!(+ r#"SELECT a.message_id, f.message_id AS forwarded_by+ FROM email_attachments a JOIN email_attachments_fwd f ON f.attachment_id = a.id+ WHERE a.id = $1"#,+ ATTACHMENT,+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(attachment.message_id, MESSAGE);+ assert_eq!(attachment.forwarded_by, MESSAGE);+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT replying_to_id FROM email_messages WHERE id = $1",+ reply+ )+ .fetch_one(&pool)+ .await?,+ Some(MESSAGE)+ );+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT name FROM email_message_recipients WHERE message_id = $1 AND contact_id = $2",+ MESSAGE,+ CONTACT,+ )+ .fetch_one(&pool)+ .await?+ .as_deref(),+ Some("Provider recipient"),+ );+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT component_id FROM email_message_calendar_invites WHERE message_id = $1",+ MESSAGE,+ )+ .fetch_one(&pool)+ .await?,+ "invitation",+ );+ assert!(!complete(&pool, &claim).await?);+ assert!(+ sqlx::query_scalar!(+ "SELECT thread_id FROM email_thread_client_ids WHERE link_id = $1 AND client_id = $2",+ LINK,+ THREAD,+ )+ .fetch_optional(&pool)+ .await?+ .is_none(),+ "A thread retaining other messages must not redirect",+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../fixtures", scripts("mark_message_as_sent"))+)]+async fn empty_original_thread_retains_row_and_redirects_all_its_aliases(+ pool: PgPool,+) -> anyhow::Result<()> {+ let claim = imported_delivery(&pool).await?;+ let client_id = macro_uuid::generate_uuid_v7();+ sqlx::query!(+ "INSERT INTO email_thread_client_ids (client_id, link_id, thread_id) VALUES ($1, $2, $3)",+ client_id,+ LINK,+ THREAD,+ )+ .execute(&pool)+ .await?;+ assert!(complete(&pool, &claim).await?);+ let aliases = sqlx::query_scalar!(+ "SELECT thread_id FROM email_thread_client_ids WHERE link_id = $1 AND client_id = ANY($2)",+ LINK,+ &[client_id, THREAD],+ )+ .fetch_all(&pool)+ .await?;+ assert_eq!(aliases, vec![PROVIDER_THREAD, PROVIDER_THREAD]);+ let original = sqlx::query!(+ "SELECT inbox_visible, latest_outbound_message_ts FROM email_threads WHERE id = $1",+ THREAD,+ )+ .fetch_one(&pool)+ .await?;+ assert!(!original.inbox_visible);+ assert!(original.latest_outbound_message_ts.is_none());+ assert!(+ sqlx::query_scalar!(+ "SELECT has_calendar_attachment FROM email_threads WHERE id = $1",+ PROVIDER_THREAD,+ )+ .fetch_one(&pool)+ .await?+ );+ let attempt = sqlx::query!(+ "SELECT message_id, thread_id, sent FROM email_send_attempts WHERE link_id = $1 AND attempt_id = $2",+ LINK, MESSAGE,+ ).fetch_one(&pool).await?;+ assert_eq!(attempt.message_id, Some(MESSAGE));+ assert_eq!(attempt.thread_id, Some(PROVIDER_THREAD));+ assert!(attempt.sent);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../fixtures", scripts("mark_message_as_sent"))+)]+async fn duplicate_attachment_references_survive_reconciliation(+ pool: PgPool,+) -> anyhow::Result<()> {+ let claim = imported_delivery(&pool).await?;+ let duplicate = macro_uuid::generate_uuid_v7();+ let sfs = macro_uuid::generate_uuid_v7();+ sqlx::query!(+ "INSERT INTO email_attachments (id, message_id, provider_attachment_id) VALUES ($1, $2, 'attachment')",+ duplicate, MESSAGE,+ ).execute(&pool).await?;+ sqlx::query!(+ "INSERT INTO email_attachments_sfs (id, attachment_id, sfs_id) VALUES ($1, $2, $1)",+ sfs,+ duplicate,+ )+ .execute(&pool)+ .await?;+ sqlx::query!(+ "INSERT INTO macro_user (id, username, email, stripe_customer_id) VALUES ($1, 'delivery-user', '[email protected]', 'cus_delivery_test')",+ sfs,+ ).execute(&pool).await?;+ sqlx::query!(+ r#"INSERT INTO "User" (id, email, macro_user_id)+ VALUES ('macro|[email protected]', '[email protected]', $1)"#,+ sfs,+ )+ .execute(&pool)+ .await?;+ let document = duplicate.to_string();+ sqlx::query!(+ r#"INSERT INTO "Document" (id, name, owner, "fileType", uploaded)+ VALUES ($1, 'attached.pdf', 'macro|[email protected]', 'pdf', TRUE)"#,+ document,+ )+ .execute(&pool)+ .await?;+ sqlx::query!(+ "INSERT INTO document_email (document_id, email_attachment_id) VALUES ($1, $2)",+ document,+ duplicate,+ )+ .execute(&pool)+ .await?;+ sqlx::query!(+ "INSERT INTO email_attachments_fwd (message_id, attachment_id) VALUES ($1, $2)",+ MESSAGE,+ duplicate,+ )+ .execute(&pool)+ .await?;+ assert!(complete(&pool, &claim).await?);+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT attachment_id FROM email_attachments_sfs WHERE id = $1",+ sfs+ )+ .fetch_one(&pool)+ .await?,+ Some(ATTACHMENT),+ );+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT attachment_id FROM email_attachments_fwd WHERE message_id = $1",+ MESSAGE+ )+ .fetch_all(&pool)+ .await?,+ vec![ATTACHMENT],+ );+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT email_attachment_id FROM document_email WHERE document_id = $1",+ document,+ )+ .fetch_one(&pool)+ .await?,+ ATTACHMENT,+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../fixtures", scripts("mark_message_as_sent"))+)]+async fn concurrent_reconciliation_completes_once(pool: PgPool) -> anyhow::Result<()> {+ let claim = imported_delivery(&pool).await?;+ let (first, second) = tokio::join!(complete(&pool, &claim), complete(&pool, &claim));+ assert_ne!(first?, second?);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../fixtures", scripts("mark_message_as_sent"))+)]+async fn inbox_thread_sync_and_completion_converge_on_original_message(+ pool: PgPool,+) -> anyhow::Result<()> {+ let claim = imported_delivery(&pool).await?;+ let mut provider_thread =+ crate::threads::get::get_thread_by_id_and_link_id(&pool, PROVIDER_THREAD, LINK)+ .await?+ .unwrap();+ provider_thread.messages =+ crate::messages::get::fetch_messages_metadata(&mut *pool.acquire().await?, PROVIDER_THREAD)+ .await?;+ let (completed, synced_thread) = tokio::join!(+ complete(&pool, &claim),+ crate::threads::insert::insert_thread_and_messages(&pool, provider_thread, LINK),+ );+ assert!(completed?);+ assert_eq!(synced_thread?, PROVIDER_THREAD);+ let surviving = sqlx::query!(+ "SELECT id, thread_id FROM email_messages WHERE link_id = $1 AND provider_id = 'sent-provider-message'",+ LINK,+ ).fetch_one(&pool).await?;+ assert_eq!(surviving.id, MESSAGE);+ assert_eq!(surviving.thread_id, PROVIDER_THREAD);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../../fixtures", scripts("mark_message_as_sent"))+)]+async fn failed_completion_rolls_back_adoption(pool: PgPool) -> anyhow::Result<()> {+ let claim = imported_delivery(&pool).await?;+ let mut tx = pool.begin().await?;+ lock_provider_thread(&mut tx, LINK, "sent-provider-thread").await?;+ assert!(delivery::complete_delivery(&mut tx, &claim).await?);+ reconcile_message(&mut tx, LINK, MESSAGE, "sent-provider-message").await?;+ tx.rollback().await?;+ assert_eq!(+ sqlx::query_scalar!(+ "SELECT message_id FROM email_attachments WHERE id = $1",+ ATTACHMENT+ )+ .fetch_one(&pool)+ .await?,+ IMPORTED,+ );+ assert!(complete(&pool, &claim).await?);+ Ok(())+}diff --git a/crates/email_db_client/src/messages/test.rs b/crates/email_db_client/src/messages/test.rsindex 548c0095e7..9f4f14c059 100644--- a/crates/email_db_client/src/messages/test.rs+++ b/crates/email_db_client/src/messages/test.rs@@ -550,3 +550,38 @@ async fn filter_existing_provider_message_ids_partitions_known_and_missing(Ok(())}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "../../fixtures", scripts("draft_exists_with_id"))+)]+async fn parsed_reads_preserve_restored_draft_generation(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ use crate::messages::get_parsed::{+ get_paginated_parsed_messages_by_thread_id, get_parsed_message_by_id,+ get_parsed_messages_by_id_batch,+ };+ let draft_id = Uuid::parse_str("00000000-0000-0000-0000-00000000e501")?;+ sqlx::query!(+ "UPDATE email_messages SET draft_generation = 2 WHERE id = $1",+ draft_id+ )+ .execute(&pool)+ .await?;+ let single = get_parsed_message_by_id(&pool, &draft_id).await?.unwrap();+ assert_eq!(single.draft_generation, 2);+ assert_eq!(serde_json::to_value(&single)?["draft_generation"], 2);+ let batch = get_parsed_messages_by_id_batch(&pool, &[draft_id]).await?;+ assert_eq!(batch[0].draft_generation, 2);+ let page =+ get_paginated_parsed_messages_by_thread_id(&pool, single.thread_db_id, 0, 100).await?;+ assert_eq!(+ page.iter()+ .find(|message| message.db_id == draft_id)+ .unwrap()+ .draft_generation,+ 2+ );+ Ok(())+}diff --git a/crates/email_db_client/src/threads/insert.rs b/crates/email_db_client/src/threads/insert.rsindex 54c6d0187c..8a15d13cdb 100644--- a/crates/email_db_client/src/threads/insert.rs+++ b/crates/email_db_client/src/threads/insert.rs@@ -106,6 +106,9 @@ pub async fn insert_thread(service_thread: &thread::Thread,link_id: Uuid,) -> anyhow::Result<Uuid> {+ if let Some(provider_id) = service_thread.provider_id.as_deref() {+ super::provider_identity::lock_provider_thread(conn, link_id, provider_id).await?;+ }let db_thread = parse::service_to_db::map_service_thread_to_db(service_thread, link_id);let result = sqlx::query_scalar!(@@ -174,6 +177,8 @@ pub async fn insert_blank_thread(messages: vec![],};- let mut conn = pool.acquire().await?;- insert_thread(&mut conn, &thread, link_id).await+ let mut tx = pool.begin().await?;+ let id = insert_thread(&mut tx, &thread, link_id).await?;+ tx.commit().await?;+ Ok(id)}diff --git a/crates/email_db_client/src/threads/mod.rs b/crates/email_db_client/src/threads/mod.rsindex 04505fb2b2..1df0e1b13a 100644--- a/crates/email_db_client/src/threads/mod.rs+++ b/crates/email_db_client/src/threads/mod.rs@@ -1,4 +1,5 @@pub mod delete;pub mod get;pub mod insert;+pub mod provider_identity;pub mod update;diff --git a/crates/email_db_client/src/threads/provider_identity.rs b/crates/email_db_client/src/threads/provider_identity.rsnew file mode 100644index 0000000000..3f399fac03--- /dev/null+++ b/crates/email_db_client/src/threads/provider_identity.rs@@ -0,0 +1,103 @@+//! Serialize provider identity reconciliation with inbox synchronization.++use sqlx::PgConnection;+use sqlx::types::Uuid;++/// Lock a provider conversation before taking its thread or message row locks.+///+/// The caller must keep its transaction open for the entire write. Both sync+/// and delivery completion use this order so reconciliation cannot deadlock+/// against a thread upsert followed by a message upsert.+#[tracing::instrument(skip(tx), err)]+pub async fn lock_provider_thread(+ tx: &mut PgConnection,+ link_id: Uuid,+ provider_thread_id: &str,+) -> anyhow::Result<()> {+ sqlx::query!(+ "SELECT pg_advisory_xact_lock(hashtextextended($1, 0))",+ format!("email_provider_thread:{link_id}:{provider_thread_id}"),+ )+ .execute(tx)+ .await?;+ Ok(())+}++/// Resolve a confirmed send to Gmail's existing conversation, if sync won.+///+/// Only the sent message moves. The original thread is retained with all of its+/// associations. Once empty, its lookup aliases point at the canonical thread;+/// readers must authorize the canonical inbox before following those aliases.+/// The caller holds [`lock_provider_thread`] and the sent message row lock.+#[tracing::instrument(skip(tx), err)]+pub async fn reconcile_sent_thread(+ tx: &mut PgConnection,+ link_id: Uuid,+ message_id: Uuid,+ provider_thread_id: &str,+) -> anyhow::Result<Uuid> {+ let original = sqlx::query_scalar!(+ "SELECT thread_id FROM email_messages WHERE id = $1 AND link_id = $2",+ message_id,+ link_id,+ )+ .fetch_one(&mut *tx)+ .await?;+ let canonical = sqlx::query_scalar!(+ "SELECT id FROM email_threads WHERE link_id = $1 AND provider_id = $2 FOR UPDATE",+ link_id,+ provider_thread_id,+ )+ .fetch_optional(&mut *tx)+ .await?;+ let Some(canonical) = canonical.filter(|id| *id != original) else {+ return Ok(original);+ };++ sqlx::query!(+ "UPDATE email_messages SET thread_id = $3, updated_at = NOW() WHERE id = $1 AND link_id = $2",+ message_id,+ link_id,+ canonical,+ )+ .execute(&mut *tx)+ .await?;+ sqlx::query!(+ "UPDATE email_send_attempts SET thread_id = $3 WHERE message_id = $1 AND link_id = $2",+ message_id,+ link_id,+ canonical,+ )+ .execute(&mut *tx)+ .await?;+ let empty = sqlx::query_scalar!(+ r#"SELECT NOT EXISTS(SELECT 1 FROM email_messages WHERE thread_id = $1) AS "empty!""#,+ original,+ )+ .fetch_one(&mut *tx)+ .await?;+ if empty {+ sqlx::query!(+ r#"UPDATE email_thread_client_ids SET thread_id = $3, created_at = NOW()+ WHERE link_id = $1 AND thread_id = $2"#,+ link_id,+ original,+ canonical,+ )+ .execute(&mut *tx)+ .await?;+ sqlx::query!(+ r#"INSERT INTO email_thread_client_ids (client_id, link_id, thread_id)+ VALUES ($1, $2, $3) ON CONFLICT (link_id, client_id)+ DO UPDATE SET thread_id = EXCLUDED.thread_id, created_at = NOW()"#,+ original,+ link_id,+ canonical,+ )+ .execute(&mut *tx)+ .await?;+ }+ super::update::update_thread_metadata(tx, original, link_id).await?;+ super::update::sync_thread_calendar_flag(tx, original).await?;+ Ok(canonical)+}diff --git a/crates/gmail_client/src/lib.rs b/crates/gmail_client/src/lib.rsindex 83de9244d3..25efce93fd 100644--- a/crates/gmail_client/src/lib.rs+++ b/crates/gmail_client/src/lib.rs@@ -58,6 +58,9 @@ use models_email::gmail::{pub struct GmailClient {/// The inner client used to make requestsinner: reqwest::Client,+ /// Sending crosses a durable submission boundary and must never be retried+ /// or redirected automatically by the transport.+ send_client: reqwest::Client,/// The base url for Gmail APIbase_url: String,/// The url for fetching google certs@@ -106,6 +109,11 @@ impl GmailClient {) -> Self {Self {inner: reqwest::Client::new(),+ send_client: reqwest::Client::builder()+ .retry(reqwest::retry::never())+ .redirect(reqwest::redirect::Policy::none())+ .build()+ .expect("Gmail send HTTP client should initialize"),base_url: gmail_url.trim_end_matches('/').to_string(),certs_url: jwks_url,contacts_url: people_url.trim_end_matches('/').to_string(),@@ -269,6 +277,16 @@ impl GmailClient {messages::send_message(self, access_token, mime, thread_id).await}+ /// Looks for a unique sent message by its RFC 5322 Message-ID, including trash.+ #[tracing::instrument(skip(self, access_token, message_id), err)]+ pub async fn find_sent_message(+ &self,+ access_token: &str,+ message_id: &str,+ ) -> Result<Option<models_email::gmail::SentMessageResource>, GmailApiHttpError> {+ messages::find_sent_message(self, access_token, message_id).await+ }+/// Fetches an attachment from Gmail by its provider ID#[tracing::instrument(skip(self, access_token), err)]pub async fn get_attachment_data(diff --git a/crates/gmail_client/src/messages.rs b/crates/gmail_client/src/messages.rsindex 481b45b2e1..9cc2ecdc22 100644--- a/crates/gmail_client/src/messages.rs+++ b/crates/gmail_client/src/messages.rs@@ -60,6 +60,55 @@ pub(crate) async fn list_messages(.collect())}+/// Finds a unique sent message, including messages moved into spam or trash.+/// Ambiguous or incomplete search responses must never count as proof of absence.+#[tracing::instrument(skip(client, access_token, message_id), err)]+pub(crate) async fn find_sent_message(+ client: &GmailClient,+ access_token: &str,+ message_id: &str,+) -> Result<Option<SentMessageResource>, GmailApiHttpError> {+ let response = client+ .inner+ .get(format!("{}/users/me/messages", client.base_url))+ .bearer_auth(access_token)+ .query(&[+ ("q", format!("rfc822msgid:<{message_id}>")),+ ("labelIds", "SENT".to_string()),+ ("includeSpamTrash", "true".to_string()),+ ("maxResults", "2".to_string()),+ ])+ .send()+ .await+ .map_err(GmailApiHttpError::transport)?;+ if !response.status().is_success() {+ return Err(unsuccessful_response(response).await);+ }+ let matches: SentMessageMatches = decode_json_response(response).await?;+ let mut messages = matches.messages.unwrap_or_default();+ if messages.len() > 1 || matches.next_page_token.is_some() {+ return Err(GmailApiHttpError::InvalidResponse(+ "multiple sent messages match the delivery identifier".to_string(),+ ));+ }+ if messages+ .iter()+ .any(|message| message.id.is_empty() || message.thread_id.is_empty())+ {+ return Err(GmailApiHttpError::InvalidResponse(+ "sent message match omitted provider identifiers".to_string(),+ ));+ }+ Ok(messages.pop())+}++#[derive(serde::Deserialize)]+#[serde(rename_all = "camelCase")]+struct SentMessageMatches {+ messages: Option<Vec<SentMessageResource>>,+ next_page_token: Option<String>,+}+#[tracing::instrument(skip(client, access_token), err)]pub(crate) async fn get_message(client: &GmailClient,@@ -134,7 +183,7 @@ pub(crate) async fn send_message(};let response = client- .inner+ .send_client.post(url).bearer_auth(access_token).json(&payload)diff --git a/crates/gmail_client/src/messages/test.rs b/crates/gmail_client/src/messages/test.rsindex af16d00b59..7ac6b4a0f2 100644--- a/crates/gmail_client/src/messages/test.rs+++ b/crates/gmail_client/src/messages/test.rs@@ -208,3 +208,100 @@ async fn malformed_message_json_is_a_decode_error() {.expect_err("malformed JSON should fail");assert!(matches!(error, GmailApiHttpError::Decode(_)));}++#[tokio::test]+async fn sent_lookup_encodes_message_id_and_includes_sent_trash() {+ let server = MockServer::start().await;+ Mock::given(method("GET"))+ .and(path("/users/me/messages"))+ .and(query_param("q", "rfc822msgid:<[email protected]>"))+ .and(query_param("labelIds", "SENT"))+ .and(query_param("includeSpamTrash", "true"))+ .and(query_param("maxResults", "2"))+ .and(header("authorization", "Bearer token"))+ .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({+ "messages": [{ "id": "sent-1", "threadId": "thread-1" }]+ })))+ .expect(1)+ .mount(&server)+ .await;+ let found = find_sent_message(&client(&server), "token", "[email protected]")+ .await+ .unwrap()+ .unwrap();+ assert_eq!(found.id, "sent-1");+ assert_eq!(found.thread_id, "thread-1");+}++#[tokio::test]+async fn sent_lookup_rejects_multiple_matches_and_incomplete_pages() {+ for body in [+ serde_json::json!({"messages":[{"id":"one","threadId":"thread"},{"id":"two","threadId":"thread"}]}),+ serde_json::json!({"messages":[{"id":"one","threadId":"thread"}],"nextPageToken":"more"}),+ serde_json::json!({"messages":[{"id":"one","threadId":""}]}),+ ] {+ let server = MockServer::start().await;+ Mock::given(method("GET"))+ .and(path("/users/me/messages"))+ .respond_with(ResponseTemplate::new(200).set_body_json(body))+ .mount(&server)+ .await;+ assert!(+ find_sent_message(&client(&server), "token", "[email protected]")+ .await+ .is_err()+ );+ }+}++#[tokio::test]+async fn sent_lookup_distinguishes_no_match_from_search_failure() {+ let empty = MockServer::start().await;+ Mock::given(method("GET"))+ .and(path("/users/me/messages"))+ .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({})))+ .mount(&empty)+ .await;+ assert!(+ find_sent_message(&client(&empty), "token", "[email protected]")+ .await+ .unwrap()+ .is_none()+ );+ for status in [401, 404, 429, 500] {+ let server = MockServer::start().await;+ Mock::given(method("GET"))+ .and(path("/users/me/messages"))+ .respond_with(ResponseTemplate::new(status))+ .expect(1)+ .mount(&server)+ .await;+ let error = find_sent_message(&client(&server), "token", "[email protected]")+ .await+ .unwrap_err();+ assert_eq!(error.status().unwrap().as_u16(), status);+ }+}++#[tokio::test]+async fn send_does_not_follow_a_redirect_and_repeat_submission() {+ let server = MockServer::start().await;+ Mock::given(method("POST"))+ .and(path("/users/me/messages/send"))+ .respond_with(ResponseTemplate::new(307).insert_header("location", "/second-send"))+ .expect(1)+ .mount(&server)+ .await;+ Mock::given(method("POST"))+ .and(path("/second-send"))+ .respond_with(ResponseTemplate::new(200).set_body_json(serde_json::json!({+ "id": "unexpected", "threadId": "unexpected"+ })))+ .expect(0)+ .mount(&server)+ .await;+ let error = send_message(&client(&server), "token", b"mime", None)+ .await+ .unwrap_err();+ assert_eq!(error.status().unwrap().as_u16(), 307);+}diff --git a/crates/graphql_email/AGENTS.md b/crates/graphql_email/AGENTS.mdindex fd108b787b..1683400b54 100644--- a/crates/graphql_email/AGENTS.md+++ b/crates/graphql_email/AGENTS.md@@ -9,6 +9,7 @@ types, the `EmailThread` edge resolvers, and draft mutations.- `src/objects.rs`: `GraphqlSoupEmailMessage`, `GraphqlMailPreviewMessage`, andthe loaders that fetch message bodies vs. previews.+- `src/send.rs`: idempotent send/cancel/status plus actor/inbox-scoped pending-send pagination.- `src/mutation.rs`: `GraphqlEmailMutation` (save/delete draft, mark seen/unread,update label).- `src/loaders.rs`: DataLoader batching for thread metadata, mail projection,diff --git a/crates/graphql_email/Cargo.toml b/crates/graphql_email/Cargo.tomlindex 2e8c9a76ee..9e6235b912 100644--- a/crates/graphql_email/Cargo.toml+++ b/crates/graphql_email/Cargo.toml@@ -13,10 +13,8 @@ entity_access = { path = "../entity_access", default-features = false }futures = { workspace = true }graphql_common = { path = "../graphql_common" }macro_user_id = { path = "../macro_user_id" }+serde_json = { workspace = true }tokio = { workspace = true }tracing = { workspace = true }uuid = { workspace = true }workspace-hack = { version = "0.1", path = "../workspace-hack" }--[dev-dependencies]-serde_json = { workspace = true }diff --git a/crates/graphql_email/src/lib.rs b/crates/graphql_email/src/lib.rsindex 79a3a82c19..12ca53597f 100644--- a/crates/graphql_email/src/lib.rs+++ b/crates/graphql_email/src/lib.rs@@ -4,6 +4,11 @@mod loaders;mod mutation;+mod send;+pub use send::{+ EmailSendAttemptInput, EmailSendAttemptPayload, GraphqlEmailSendMutation, PendingEmailSends,+ load_pending_sends, load_send_attempt,+};mod objects;mod operation;mod user_objects;@@ -21,7 +26,7 @@ pub use mutation::{DeleteEmailDraftInput, DeleteEmailDraftPayload, EmailMutationService,EmailThreadMutationLoadFuture, EmailThreadMutationOutput, GraphqlEmailMutation,MarkEmailThreadSeenInput, MarkEmailThreadUnreadInput, SaveEmailDraftContactInput,- SaveEmailDraftInput, SaveEmailDraftPayload, UpdateEmailThreadLabelInput,+ SaveEmailDraftInput, SaveEmailDraftPayload, UpdateEmailThreadLabelInput, draft_mutation_error,};pub use objects::{GraphqlMailDraftState, GraphqlMailPreviewMessage, GraphqlSoupEmailMessage,diff --git a/crates/graphql_email/src/mutation.rs b/crates/graphql_email/src/mutation.rsindex 928b2e7aab..3c03255699 100644--- a/crates/graphql_email/src/mutation.rs+++ b/crates/graphql_email/src/mutation.rs@@ -120,6 +120,8 @@ pub trait EmailMutationService: Send + Sync + 'static {&self,user_id: MacroUserIdStr<'static>,draft_id: Uuid,++ expected_generation: i32,) -> impl Future<Output = Result<DeletedUserDraft, EmailErr>> + Send;}@@ -201,8 +203,11 @@ where&self,user_id: MacroUserIdStr<'static>,draft_id: Uuid,++ expected_generation: i32,) -> Result<DeletedUserDraft, EmailErr> {- self.delete_draft_for_user(user_id, draft_id).await+ self.delete_draft_for_user(user_id, draft_id, expected_generation)+ .await}}@@ -332,6 +337,8 @@ impl From<SaveEmailDraftContactInput> for ContactInfo {/// existing draft.#[derive(InputObject)]pub struct SaveEmailDraftInput {+ /// Generation from the last loaded draft. Omitted by legacy clients.+ pub draft_generation: Option<i32>,/// Verified sender address for the selected inbox. Absent selects its primary address.pub sender_email: Option<String>,/// Draft handle: a client-generated ID, or a server ID from a fetched@@ -374,6 +381,8 @@ pub struct SaveEmailDraftInput {/// Input for deleting an email draft.#[derive(InputObject)]pub struct DeleteEmailDraftInput {+ /// Generation from the last loaded draft.+ pub draft_generation: Option<i32>,/// Draft handle to delete: a client-generated ID or a server ID, resolved/// like a save's. A handle that is already gone (or was never bound — a/// discard can replay before its draft's first save ever committed)@@ -475,6 +484,7 @@ fn saved_draft_message(saved: SavedUserDraft) -> Message {draft.body_text.as_deref(),);Message {+ draft_generation: draft.draft_generation,operation_status,db_id: draft.db_id,provider_id: draft.provider_id,@@ -497,6 +507,7 @@ fn saved_draft_message(saved: SavedUserDraft) -> Message {|| !attachments_draft.is_empty()|| !attachments_forwarded.is_empty(),scheduled_send_time: draft.send_time,+ scheduled_send_status: None,from: Some(sender),to: draft.to,cc: draft.cc,@@ -519,8 +530,20 @@ fn saved_draft_message(saved: SavedUserDraft) -> Message {/// Error taxonomy for the draft mutations (save and delete), mirroring the/// REST `CreateDraftError` mapping with machine-readable `extensions.code`/// values the client can use to offer recovery without blocking its mutation queue.-fn draft_mutation_error(error: &EmailErr) -> async_graphql::Error {+pub fn draft_mutation_error(error: &EmailErr) -> async_graphql::Error {let (message, code) = match error {+ EmailErr::SendAttemptConflict => (+ "send attempt was reused with different content",+ "SEND_ATTEMPT_CONFLICT",+ ),+ EmailErr::InvalidSendSnapshot(_) => (+ "review the message and attachments before sending",+ "INVALID",+ ),+ EmailErr::DraftGenerationConflict(_) => (+ "draft changed on another device; preserve your edits and reload before retrying",+ "DRAFT_VERSION_CONFLICT",+ ),EmailErr::MessageAlreadySent(_) => {("email draft has already been sent", "DRAFT_ALREADY_SENT")}@@ -838,7 +861,11 @@ wherelet service = ctx.data::<Arc<S>>()?;let deleted = service- .delete_email_draft(user_id.clone(), draft_id)+ .delete_email_draft(+ user_id.clone(),+ draft_id,+ input.draft_generation.unwrap_or(0),+ ).await.map_err(|error| {tracing::error!(@@ -868,7 +895,9 @@ where/// Convert transport input into the domain draft input. Drafts carry no/// actor: attribution happens when the draft is actually sent.-fn draft_input_from_graphql(input: SaveEmailDraftInput) -> async_graphql::Result<CreateDraftInput> {+pub(crate) fn draft_input_from_graphql(+ input: SaveEmailDraftInput,+) -> async_graphql::Result<CreateDraftInput> {let send_time = input.send_time.as_deref()@@ -883,6 +912,8 @@ fn draft_input_from_graphql(input: SaveEmailDraftInput) -> async_graphql::Result.transpose()?;Ok(CreateDraftInput {+ frozen_signature_html: None,+ draft_generation: input.draft_generation.unwrap_or(0),sender_email: input.sender_email.map(|address| {diff --git a/crates/graphql_email/src/mutation/test.rs b/crates/graphql_email/src/mutation/test.rsindex 2cf59f10ca..4542850a39 100644--- a/crates/graphql_email/src/mutation/test.rs+++ b/crates/graphql_email/src/mutation/test.rs@@ -217,6 +217,7 @@ impl EmailMutationService for CapturingEmailMutationService {photo_url: None,},draft: email::domain::models::CreatedDraft {+ draft_generation: input.draft_generation,db_id: input.db_id.unwrap_or_default(),provider_id: input.provider_id,replying_to_id: input.replying_to_id,@@ -256,6 +257,8 @@ impl EmailMutationService for CapturingEmailMutationService {&self,user_id: MacroUserIdStr<'static>,draft_id: Uuid,++ _expected_generation: i32,) -> Result<DeletedUserDraft, EmailErr> {if self.draft_fails_as_already_sent@@ -895,3 +898,11 @@ async fn semantic_mailbox_action_needs_no_provider_label_id() {assert!(!response.errors.is_empty());assert_eq!(service.calls.lock().unwrap().len(), 1);}++#[test]+fn stale_draft_generation_is_recoverable_not_already_sent() {+ let error = super::draft_mutation_error(&EmailErr::DraftGenerationConflict(Uuid::nil()));+ let extensions = format!("{:?}", error.extensions);+ assert!(extensions.contains("DRAFT_VERSION_CONFLICT"));+ assert!(!extensions.contains("DRAFT_ALREADY_SENT"));+}diff --git a/crates/graphql_email/src/mutation/test/senders.rs b/crates/graphql_email/src/mutation/test/senders.rsindex e3f4c3ffc0..827573ba1a 100644--- a/crates/graphql_email/src/mutation/test/senders.rs+++ b/crates/graphql_email/src/mutation/test/senders.rs@@ -44,16 +44,21 @@ async fn send_returns_confirmed_identity_without_fallible_post_commit_hydration(});let draft_id = Uuid::now_v7();let inbox_id = Uuid::now_v7();- let response = schema(service.clone()).execute(format!(- r#"mutation {{ sendEmailMessage(input: {{ draft: {{- draftId: "{draft_id}", linkId: "{inbox_id}", subject: "Alias", senderEmail: "[email protected]"- }}, includeSignature: false }}) {{ messageId threadId linkId }} }}"#- )).await;+ let response = schema(service.clone()).execute(+ async_graphql::Request::new(+ "mutation LegacySend($input: SendEmailMessageInput!) { sendEmailMessage(input: $input) { messageId threadId linkId sendTime } }",+ ).variables(async_graphql::Variables::from_json(serde_json::json!({+ "input": {"draft": {+ "draftId": draft_id.to_string(), "linkId": inbox_id.to_string(),+ "subject": "Alias", "senderEmail": "[email protected]"+ }, "includeSignature": false}+ }))),+ ).await;assert!(response.errors.is_empty(), "{:?}", response.errors);assert_eq!(response.data.into_json().unwrap()["sendEmailMessage"],serde_json::json!({- "messageId": draft_id.to_string(), "threadId": TEST_THREAD_ID.to_string(), "linkId": inbox_id.to_string(),+ "messageId": draft_id.to_string(), "threadId": TEST_THREAD_ID.to_string(), "linkId": inbox_id.to_string(), "sendTime": null,}));assert_eq!(diff --git a/crates/graphql_email/src/objects.rs b/crates/graphql_email/src/objects.rsindex 102eeb3b75..305ff7c489 100644--- a/crates/graphql_email/src/objects.rs+++ b/crates/graphql_email/src/objects.rs@@ -4,6 +4,7 @@ use async_graphql::{Context, ID, Object, SimpleObject, dataloader::DataLoader};use email::domain::models::{AttachmentDraft, AttachmentForwarded, ContactInfo, EmailThreadMailProjection,EmailThreadMetadata, Message, MessageAttachment, ParsedLabel, ParsedMessage,+ ScheduledSendStatus,};use crate::loaders::{@@ -18,6 +19,7 @@ const FULL_MESSAGE_FIELDS: &[&str] = &["providerId","replyingToId","scheduledSendTime",+ "scheduledSendStatus","attachments","attachmentsDraft","attachmentsForwarded",@@ -69,6 +71,30 @@ impl From<email::domain::models::EmailPreview> for GraphqlMailPreviewMessage {/// An adaptively hydrated email content projection for Soup queries.pub struct GraphqlSoupEmailMessage(EmailContentMessage);+/// The persisted state of a scheduled delivery.+#[derive(async_graphql::Enum, Copy, Clone, Eq, PartialEq)]+pub enum GraphqlScheduledSendStatus {+ /// Waiting for its send time or safely retrying preparation.+ Pending,+ /// Provider submission has started.+ Sending,+ /// Delivery was definitely rejected; the draft can be restored.+ Failed,+ /// Delivery may have succeeded; reconciliation is required.+ Unconfirmed,+}++impl From<ScheduledSendStatus> for GraphqlScheduledSendStatus {+ fn from(status: ScheduledSendStatus) -> Self {+ match status {+ ScheduledSendStatus::Pending => Self::Pending,+ ScheduledSendStatus::Sending => Self::Sending,+ ScheduledSendStatus::Failed => Self::Failed,+ ScheduledSendStatus::Unconfirmed => Self::Unconfirmed,+ }+ }+}+impl GraphqlSoupEmailMessage {/// Wraps a message produced outside the DataLoader path (e.g. a/// mutation payload's draft record).@@ -90,6 +116,10 @@ impl GraphqlSoupEmailMessage {/// An adaptively hydrated email content projection for Soup queries.#[Object]impl GraphqlSoupEmailMessage {+ /// Generation required when editing a draft after send/cancellation.+ async fn draft_generation(&self) -> i32 {+ self.parsed().draft_generation+ }/// Immutable scheduling snapshots; JSON keeps both transports identical.async fn calendar_invitations(&self,@@ -190,6 +220,13 @@ impl GraphqlSoupEmailMessage {.map(|value| value.to_rfc3339()))}+ /// Whether the scheduled delivery is pending, sending, failed, or unconfirmed.+ async fn scheduled_send_status(+ &self,+ ) -> async_graphql::Result<Option<GraphqlScheduledSendStatus>> {+ Ok(self.full()?.scheduled_send_status.map(Into::into))+ }+/// The sender of the message.async fn from(&self) -> Option<GraphqlSoupEmailContact> {self.parsed().from.clone().map(GraphqlSoupEmailContact)@@ -620,6 +657,7 @@ mod tests {fn message(thread_id: Uuid) -> ParsedMessage {let now = Utc::now();ParsedMessage {+ draft_generation: 0,db_id: Uuid::from_u128(1),link_id: Uuid::from_u128(3),thread_db_id: thread_id,diff --git a/crates/graphql_email/src/send.rs b/crates/graphql_email/src/send.rsnew file mode 100644index 0000000000..d8e0035117--- /dev/null+++ b/crates/graphql_email/src/send.rs@@ -0,0 +1,282 @@+//! GraphQL adapters for the email domain's replay-safe delivery capability.+use crate::mutation::{draft_input_from_graphql, draft_mutation_error};+use crate::{+ EmailThreadMutationOutput, GraphqlSoupEmailMessage, SaveEmailDraftInput,+ loaders::EmailContentMessage,+};+use async_graphql::{Context, Enum, ID, InputObject, Object};+use email::domain::send_attempt::{+ EmailSendService, SendAttempt, SendAttemptId, SendAttemptStatus, SendSnapshot,+};+use graphql_common::{parse_id, require_authenticated_user};+use macro_user_id::user_id::MacroUserIdStr;+use std::{marker::PhantomData, sync::Arc};++/// Identifies one send action independently of its server message identity.+#[derive(InputObject)]+pub struct EmailSendAttemptInput {+ /// Stable UUID generated for the explicit Send action.+ pub attempt_id: ID,+ /// Sending inbox captured at Send, never inferred during replay.+ pub link_id: ID,+}++/// Immutable content approved by the user.+#[derive(InputObject)]+pub struct SendEmailAttemptInput {+ /// Saved signature HTML captured at Send; empty means no signature.+ pub signature_html: Option<String>,+ /// Stable attempt and sending inbox.+ pub attempt: EmailSendAttemptInput,+ /// Full message snapshot; optional send time preserves Send Later across retries.+ pub message: SaveEmailDraftInput,+ /// Per-message signature preference.+ pub include_signature: Option<bool>,+ /// Completed draft attachment IDs.+ pub attachment_ids: Vec<ID>,+ /// Original attachment IDs for forwarded attachments.+ pub forwarded_attachment_ids: Vec<ID>,+ /// Editor HTML before the watermark, encoded like message HTML.+ pub restore_body_html: Option<String>,+ /// Editor plain text before the watermark.+ pub restore_body_text: Option<String>,+ /// Editor document before the watermark.+ pub restore_body_macro: Option<String>,+}++/// Authoritative delivery state; acceptance is not proof of provider delivery.+#[derive(Enum, Copy, Clone, Eq, PartialEq)]+pub enum EmailSendStatus {+ /// Durably accepted; preparation may be retried and cancellation remains safe.+ Accepted,+ /// Submission began, or a legacy claim has an unknown outcome; cancellation is unsafe.+ Sending,+ /// Delivery failed before acceptance; cancellation can restore the draft.+ Failed,+ /// Delivery may have occurred and is being reconciled without resending.+ DeliveryUnconfirmed,+ /// Provider delivery was recorded.+ Sent,+ /// This attempt cannot deliver.+ Cancelled,+}++/// Embedded attempt result; message identity belongs on its normalized message.+pub struct EmailSendAttemptPayload(pub(crate) SendAttempt);++/// Current result of one replay-safe send action.+#[Object]+impl EmailSendAttemptPayload {+ /// Stable send-action identity.+ async fn attempt_id(&self) -> ID {+ ID(self.0.attempt_id.0.to_string())+ }+ /// Current delivery state.+ async fn status(&self) -> EmailSendStatus {+ match self.0.status {+ SendAttemptStatus::Accepted => EmailSendStatus::Accepted,+ SendAttemptStatus::Sending => EmailSendStatus::Sending,+ SendAttemptStatus::Failed => EmailSendStatus::Failed,+ SendAttemptStatus::DeliveryUnconfirmed => EmailSendStatus::DeliveryUnconfirmed,+ SendAttemptStatus::Sent => EmailSendStatus::Sent,+ SendAttemptStatus::Cancelled => EmailSendStatus::Cancelled,+ }+ }+ /// First acceptance's delivery deadline, preserved across retries.+ async fn send_time(&self) -> Option<String> {+ self.0.send_time.map(|time| time.to_rfc3339())+ }+ /// Current message, absent if cancelled before admission or subsequently deleted.+ async fn message(&self) -> Option<GraphqlSoupEmailMessage> {+ self.0.message.clone().map(|message| {+ GraphqlSoupEmailMessage::from_content(EmailContentMessage::from(message))+ })+ }+ /// Server conversation identity, when admitted.+ async fn thread_id(&self) -> Option<ID> {+ self.0.thread_id.map(|id| ID(id.to_string()))+ }+}++/// Send admission and its canonical thread.+pub struct SendEmailAttemptPayload<O: EmailThreadMutationOutput> {+ attempt: EmailSendAttemptPayload,+ thread: Option<O::Thread>,+}++/// Send admission or cancellation and the updated conversation.+#[Object(name = "SendEmailAttemptPayload")]+impl<O: EmailThreadMutationOutput> SendEmailAttemptPayload<O> {+ /// Admission/cancellation result and hydrated message.+ async fn attempt(&self) -> &EmailSendAttemptPayload {+ &self.attempt+ }+ /// Updated thread, absent for cancellation before admission.+ async fn thread(&self) -> Option<&O::Thread> {+ self.thread.as_ref()+ }+}++/// Independent mutation root for send/cancel operations.+pub struct GraphqlEmailSendMutation<S, O>(PhantomData<fn() -> (S, O)>);+impl<S, O> Default for GraphqlEmailSendMutation<S, O> {+ fn default() -> Self {+ Self(PhantomData)+ }+}++#[Object]+impl<S: EmailSendService + 'static, O: EmailThreadMutationOutput> GraphqlEmailSendMutation<S, O> {+ /// Durably accept an immutable send snapshot; safe to replay after response loss.+ #[tracing::instrument(skip_all, err(Debug))]+ async fn send_email_attempt(+ &self,+ ctx: &Context<'_>,+ input: SendEmailAttemptInput,+ ) -> async_graphql::Result<SendEmailAttemptPayload<O>> {+ let actor = require_authenticated_user(ctx)?;+ let link = parse_id(input.attempt.link_id, "linkId")?;+ let attempt = SendAttemptId(parse_id(input.attempt.attempt_id, "attemptId")?);+ let mut message = draft_input_from_graphql(input.message)?;+ message.include_signature = input.include_signature;+ message.frozen_signature_html = input.signature_html;+ let snapshot = SendSnapshot {+ message,+ attachment_ids: input+ .attachment_ids+ .into_iter()+ .map(|id| parse_id(id, "attachmentId"))+ .collect::<Result<_, _>>()?,+ forwarded_attachment_ids: input+ .forwarded_attachment_ids+ .into_iter()+ .map(|id| parse_id(id, "attachmentId"))+ .collect::<Result<_, _>>()?,+ restore_body_html: input.restore_body_html,+ restore_body_text: input.restore_body_text,+ restore_body_macro: input.restore_body_macro,+ };+ let result = ctx+ .data::<Arc<S>>()?+ .send_email(actor.clone(), link, attempt, snapshot)+ .await+ .map_err(|error| draft_mutation_error(&error))?;+ payload::<O>(ctx, actor, result).await+ }++ /// Revoke delivery authority even if the original send request has not arrived.+ #[tracing::instrument(skip_all, err(Debug))]+ async fn cancel_email_send(+ &self,+ ctx: &Context<'_>,+ input: EmailSendAttemptInput,+ ) -> async_graphql::Result<SendEmailAttemptPayload<O>> {+ let actor = require_authenticated_user(ctx)?;+ let result = ctx+ .data::<Arc<S>>()?+ .cancel_email_send(+ actor.clone(),+ parse_id(input.link_id, "linkId")?,+ SendAttemptId(parse_id(input.attempt_id, "attemptId")?),+ )+ .await+ .map_err(|error| draft_mutation_error(&error))?;+ payload::<O>(ctx, actor, result).await+ }+}++async fn payload<O: EmailThreadMutationOutput>(+ ctx: &Context<'_>,+ actor: MacroUserIdStr<'static>,+ attempt: SendAttempt,+) -> async_graphql::Result<SendEmailAttemptPayload<O>> {+ use async_graphql::ErrorExtensions;+ let thread = match attempt.thread_id {+ Some(id) => O::load_email_thread(ctx, actor, id)+ .await+ .map_err(|error| {+ error.extend_with(|_, ext| {+ ext.set("retryable", true);+ ext.set("code", "INTERNAL");+ })+ })?,+ None => None,+ };+ Ok(SendEmailAttemptPayload {+ attempt: EmailSendAttemptPayload(attempt),+ thread,+ })+}++/// Resolve status on the authenticated viewer without resubmitting delivery.+pub async fn load_send_attempt<S: EmailSendService>(+ service: &S,+ actor: MacroUserIdStr<'static>,+ input: EmailSendAttemptInput,+) -> async_graphql::Result<Option<EmailSendAttemptPayload>> {+ service+ .email_send_status(+ actor,+ parse_id(input.link_id, "linkId")?,+ SendAttemptId(parse_id(input.attempt_id, "attemptId")?),+ )+ .await+ .map(|result| result.map(EmailSendAttemptPayload))+ .map_err(|error| draft_mutation_error(&error))+}++/// An unresolved send owned by the authenticated actor, possibly from another device.+#[derive(async_graphql::SimpleObject)]+pub struct PendingEmailSend {+ /// Inbox needed to address the attempt, including after message deletion.+ pub link_id: ID,+ /// Current authoritative status.+ pub attempt: EmailSendAttemptPayload,+}++/// A bounded page of unresolved sends, newest first.+#[derive(async_graphql::SimpleObject)]+pub struct PendingEmailSends {+ /// Authorized sends.+ pub attempts: Vec<PendingEmailSend>,+ /// Opaque cursor for the next page.+ pub next_cursor: Option<String>,+}++/// Parse the cursor and delegate ownership/access policy to the email domain.+pub async fn load_pending_sends<S: EmailSendService>(+ service: &S,+ actor: MacroUserIdStr<'static>,+ after: Option<String>,+) -> async_graphql::Result<PendingEmailSends> {+ let cursor = after+ .map(|value| {+ if value.len() > 512 {+ return Err(async_graphql::Error::new("Invalid email send cursor"));+ }+ serde_json::from_str(&value)+ .map_err(|_| async_graphql::Error::new("Invalid email send cursor"))+ })+ .transpose()?;+ let page = service+ .pending_email_sends(actor, cursor)+ .await+ .map_err(|error| draft_mutation_error(&error))?;+ Ok(PendingEmailSends {+ attempts: page+ .attempts+ .into_iter()+ .map(|entry| PendingEmailSend {+ link_id: ID(entry.link_id.to_string()),+ attempt: EmailSendAttemptPayload(entry.attempt),+ })+ .collect(),+ next_cursor: page+ .next_cursor+ .map(|cursor| serde_json::to_string(&cursor))+ .transpose()?,+ })+}++#[cfg(test)]+mod test;diff --git a/crates/graphql_email/src/send/test.rs b/crates/graphql_email/src/send/test.rsnew file mode 100644index 0000000000..a13e25dfe2--- /dev/null+++ b/crates/graphql_email/src/send/test.rs@@ -0,0 +1,264 @@+use super::*;+use async_graphql::{EmptySubscription, Schema, SimpleObject};+use email::domain::models::EmailErr;+use std::{pin::Pin, sync::Mutex};+use uuid::Uuid;++#[derive(Default)]+struct Service {+ calls: Mutex<Vec<(String, Uuid, SendAttemptId, Option<SendSnapshot>)>>,+ fail_hydration: bool,+}+fn attempt(id: SendAttemptId, status: SendAttemptStatus) -> SendAttempt {+ SendAttempt {+ transitioned: false,+ message: None,+ attempt_id: id,+ status,+ message_id: None,+ thread_id: Some(Uuid::nil()),+ send_time: Some(chrono::Utc::now()),+ }+}+impl EmailSendService for Service {+ async fn pending_email_sends(+ &self,+ actor: MacroUserIdStr<'static>,+ _after: Option<email::domain::send_attempt::SendAttemptCursor>,+ ) -> Result<email::domain::send_attempt::SendAttemptPage, EmailErr> {+ self.calls.lock().unwrap().push((+ actor.to_string(),+ Uuid::nil(),+ SendAttemptId(Uuid::nil()),+ None,+ ));+ Ok(email::domain::send_attempt::SendAttemptPage {+ attempts: vec![],+ next_cursor: None,+ })+ }+ async fn send_email(+ &self,+ actor: MacroUserIdStr<'static>,+ link: Uuid,+ id: SendAttemptId,+ snapshot: SendSnapshot,+ ) -> Result<SendAttempt, EmailErr> {+ self.calls+ .lock()+ .unwrap()+ .push((actor.to_string(), link, id, Some(snapshot)));+ Ok(attempt(id, SendAttemptStatus::Accepted))+ }+ async fn cancel_email_send(+ &self,+ actor: MacroUserIdStr<'static>,+ link: Uuid,+ id: SendAttemptId,+ ) -> Result<SendAttempt, EmailErr> {+ self.calls+ .lock()+ .unwrap()+ .push((actor.to_string(), link, id, None));+ Ok(attempt(id, SendAttemptStatus::Cancelled))+ }+ async fn email_send_status(+ &self,+ actor: MacroUserIdStr<'static>,+ link: Uuid,+ id: SendAttemptId,+ ) -> Result<Option<SendAttempt>, EmailErr> {+ self.calls+ .lock()+ .unwrap()+ .push((actor.to_string(), link, id, None));+ Ok(Some(attempt(id, SendAttemptStatus::Sending)))+ }+}+struct Query;+#[Object]+impl Query {+ async fn pending(+ &self,+ ctx: &Context<'_>,+ after: Option<String>,+ ) -> async_graphql::Result<PendingEmailSends> {+ load_pending_sends(+ ctx.data::<Arc<Service>>()?.as_ref(),+ require_authenticated_user(ctx)?,+ after,+ )+ .await+ }+ async fn status(+ &self,+ ctx: &Context<'_>,+ input: EmailSendAttemptInput,+ ) -> async_graphql::Result<Option<EmailSendAttemptPayload>> {+ load_send_attempt(+ ctx.data::<Arc<Service>>()?.as_ref(),+ require_authenticated_user(ctx)?,+ input,+ )+ .await+ }+}+struct ThreadOutput;+#[derive(SimpleObject)]+struct Thread {+ id: ID,+}+impl EmailThreadMutationOutput for ThreadOutput {+ type Thread = Thread;+ fn load_email_thread<'ctx>(+ ctx: &'ctx Context<'_>,+ _: MacroUserIdStr<'static>,+ id: Uuid,+ ) -> Pin<Box<dyn Future<Output = async_graphql::Result<Option<Thread>>> + Send + 'ctx>> {+ Box::pin(async move {+ if ctx.data::<Arc<Service>>()?.fail_hydration {+ return Err(async_graphql::Error::new("response hydration unavailable"));+ }+ Ok(Some(Thread {+ id: ID(id.to_string()),+ }))+ })+ }+}+fn schema(+ service: Arc<Service>,+ authenticated: bool,+) -> Schema<Query, GraphqlEmailSendMutation<Service, ThreadOutput>, EmptySubscription> {+ let builder = Schema::build(+ Query,+ GraphqlEmailSendMutation::default(),+ EmptySubscription,+ )+ .data(service);+ if authenticated {+ builder+ .data(MacroUserIdStr::try_from_email("[email protected]").unwrap())+ .finish()+ } else {+ builder.finish()+ }+}+const SEND: &str = r#"mutation { sendEmailAttempt(input: {+ attempt: {attemptId:"00000000-0000-4000-8000-000000000001",linkId:"00000000-0000-4000-8000-000000000002"},+ message: {draftId:"00000000-0000-4000-8000-000000000003",subject:"Approved",to:[{email:"[email protected]"}],bodyHtml:"aHRtbA"},+ includeSignature:false,attachmentIds:["00000000-0000-4000-8000-000000000004"],forwardedAttachmentIds:[],restoreBodyText:"Editable"+}) { attempt {attemptId status sendTime threadId message {id}} thread {id} } }"#;++#[tokio::test]+async fn authenticated_send_maps_the_immutable_snapshot_and_selected_inbox() {+ let service = Arc::new(Service::default());+ let response = schema(service.clone(), true).execute(SEND).await;+ assert!(response.errors.is_empty(), "{:?}", response.errors);+ assert_eq!(+ response.data.into_json().unwrap()["sendEmailAttempt"]["attempt"]["status"],+ "ACCEPTED"+ );+ let calls = service.calls.lock().unwrap();+ assert_eq!(calls[0].0, "macro|[email protected]");+ assert_eq!(+ calls[0].1.to_string(),+ "00000000-0000-4000-8000-000000000002"+ );+ let snapshot = calls[0].3.as_ref().unwrap();+ assert_eq!(snapshot.message.subject, "Approved");+ assert_eq!(snapshot.message.include_signature, Some(false));+ assert_eq!(snapshot.message.body_html.as_deref(), Some("aHRtbA"));+ assert_eq!(snapshot.restore_body_text.as_deref(), Some("Editable"));+ assert_eq!(snapshot.attachment_ids.len(), 1);+}++#[tokio::test]+async fn unauthenticated_send_never_calls_the_domain() {+ let service = Arc::new(Service::default());+ assert!(+ !schema(service.clone(), false)+ .execute(SEND)+ .await+ .errors+ .is_empty()+ );+ assert!(service.calls.lock().unwrap().is_empty());+}++#[tokio::test]+async fn hydration_failure_after_admission_remains_retryable() {+ let service = Arc::new(Service {+ fail_hydration: true,+ ..Default::default()+ });+ let response = schema(service.clone(), true).execute(SEND).await;+ assert_eq!(service.calls.lock().unwrap().len(), 1);+ assert_eq!(+ response.errors[0]+ .extensions+ .as_ref()+ .unwrap()+ .get("retryable"),+ Some(&async_graphql::Value::Boolean(true))+ );+}++#[tokio::test]+async fn cancel_and_status_use_the_same_scoped_attempt() {+ let service = Arc::new(Service::default());+ let schema = schema(service.clone(), true);+ let input = r#"{attemptId:"00000000-0000-4000-8000-000000000001",linkId:"00000000-0000-4000-8000-000000000002"}"#;+ let status = schema+ .execute(format!("{{status(input:{input}){{status}}}}"))+ .await;+ assert!(status.errors.is_empty());+ assert_eq!(+ status.data.into_json().unwrap()["status"]["status"],+ "SENDING"+ );+ let cancel = schema+ .execute(format!(+ "mutation{{cancelEmailSend(input:{input}){{attempt{{status}}}}}}"+ ))+ .await;+ assert!(cancel.errors.is_empty());+ assert_eq!(+ cancel.data.into_json().unwrap()["cancelEmailSend"]["attempt"]["status"],+ "CANCELLED"+ );+ let calls = service.calls.lock().unwrap();+ assert_eq!(calls[0].0, calls[1].0);+ assert_eq!(calls[0].1, calls[1].1);+ assert_eq!(calls[0].2, calls[1].2);+}++#[tokio::test]+async fn pending_sends_require_authentication_and_reject_malformed_cursors() {+ let service = Arc::new(Service::default());+ assert!(+ !schema(service.clone(), false)+ .execute("{pending{attempts{linkId}}}")+ .await+ .errors+ .is_empty()+ );+ assert!(+ !schema(service.clone(), true)+ .execute(r#"{pending(after:"invalid"){attempts{linkId}}}"#)+ .await+ .errors+ .is_empty()+ );+ assert!(service.calls.lock().unwrap().is_empty());+ assert!(+ schema(service.clone(), true)+ .execute("{pending{attempts{linkId} nextCursor}}")+ .await+ .errors+ .is_empty()+ );+ assert_eq!(+ service.calls.lock().unwrap()[0].0,+ "macro|[email protected]"+ );+}diff --git a/crates/macro_db_client/AGENTS.md b/crates/macro_db_client/AGENTS.mdindex 6ec49254ee..63e33a5762 100644--- a/crates/macro_db_client/AGENTS.md+++ b/crates/macro_db_client/AGENTS.md@@ -84,3 +84,12 @@ unreferenced replicas. These additive tables do not change agent-session claims.- Rules: `.agents/rules/rust/db.md`, `.agents/rules/rust/architecture.md` ·Docs: `docs/development/database.md` · Skill: `dump-schema`++Email send migrations add `email_messages.draft_generation` and attempt handle/inbox+fences. Deploy the additive migrations and all generation-aware writers before+enabling the independent email outbox; old writers do not enforce these fences.++`preserve_deleted_email_send_delivery` defers active-send deletion before compacting+content. Bypass retention for inboxes marked `deleting_at` and direct inbox+cascades; other parent cascades must not destroy unresolved delivery state. Deferred markers retain provider identity and+draft generation so Undo/resend cannot inherit an old deletion.diff --git a/crates/macro_db_client/migrations/20261015141405_email_delivery_claims.sql b/crates/macro_db_client/migrations/20261015141405_email_delivery_claims.sqlnew file mode 100644index 0000000000..98895236c9--- /dev/null+++ b/crates/macro_db_client/migrations/20261015141405_email_delivery_claims.sql@@ -0,0 +1,20 @@+-- Additive fields keep existing workers compatible during deployment. Paused rows+-- retain processing=true so older workers cannot accidentally submit them again.+ALTER TABLE email_scheduled_messages+ ADD COLUMN delivery_claim_id UUID,+ ADD COLUMN delivery_lease_expires_at TIMESTAMPTZ,+ ADD COLUMN delivery_started_at TIMESTAMPTZ,+ ADD COLUMN delivery_message_id TEXT,+ ADD COLUMN delivery_status TEXT NOT NULL DEFAULT 'ready'+ CHECK (delivery_status IN ('ready', 'failed', 'unconfirmed'));++CREATE INDEX email_scheduled_delivery_recovery_idx+ ON email_scheduled_messages (delivery_lease_expires_at, send_time)+ WHERE NOT sent AND delivery_status <> 'failed';++-- A stale worker must not expose a failed or uncertain delivery as unclaimed.+-- Cancellation removes the schedule; successful completion may clear processing.+ALTER TABLE email_scheduled_messages+ ADD CONSTRAINT email_delivery_uncertainty_keeps_processing+ CHECK (sent OR processing+ OR (delivery_status = 'ready' AND delivery_started_at IS NULL));diff --git a/crates/macro_db_client/migrations/20261015141410_email_send_attempt_ledger.sql b/crates/macro_db_client/migrations/20261015141410_email_send_attempt_ledger.sqlnew file mode 100644index 0000000000..ae21cb8b29--- /dev/null+++ b/crates/macro_db_client/migrations/20261015141410_email_send_attempt_ledger.sql@@ -0,0 +1,99 @@+-- Attempt tombstones outlive message deletion so delayed requests cannot send again.+-- Removing an inbox removes its delivery authority and all its attempts.+CREATE TABLE email_send_attempts (+ user_id TEXT NOT NULL,+ link_id UUID NOT NULL REFERENCES email_links(id) ON DELETE CASCADE,+ attempt_id UUID NOT NULL,+ request JSONB,+ message_id UUID,+ thread_id UUID,+ send_time TIMESTAMPTZ,+ cancelled BOOLEAN NOT NULL DEFAULT FALSE,+ restore_body_html TEXT,+ restore_body_text TEXT,+ restore_body_macro TEXT,+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),+ sent BOOLEAN NOT NULL DEFAULT FALSE,+ delivery_unconfirmed BOOLEAN NOT NULL DEFAULT FALSE,+ -- Compare the versioned approval digest in request; retain the full snapshot only while active.+ prepared_content JSONB,+ PRIMARY KEY (user_id, link_id, attempt_id)+);+CREATE INDEX email_send_attempts_message_idx ON email_send_attempts(message_id)+ WHERE message_id IS NOT NULL;++-- Terminal tombstones keep approval identity, never duplicate message content.+CREATE FUNCTION email_send_attempt_identity(request JSONB) RETURNS JSONB AS $$+ SELECT CASE WHEN request IS NULL THEN NULL ELSE jsonb_build_object(+ '_send_approval', COALESCE(request->'_send_approval', '{"version":0,"digest":""}'::jsonb)+ ) END;+$$ LANGUAGE SQL IMMUTABLE;++CREATE FUNCTION clear_terminal_email_send_content() RETURNS TRIGGER AS $$+BEGIN+ IF NEW.sent OR NEW.cancelled THEN+ -- A legacy request without a digest becomes an unsupported-version+ -- identity: late admission fails closed rather than retaining its body.+ NEW.request := email_send_attempt_identity(NEW.request);+ NEW.prepared_content := NULL;+ NEW.restore_body_html := NULL;+ NEW.restore_body_text := NULL;+ NEW.restore_body_macro := NULL;+ END IF;+ RETURN NEW;+END;+$$ LANGUAGE plpgsql;++CREATE TRIGGER clear_terminal_email_send_content+BEFORE INSERT OR UPDATE ON email_send_attempts+FOR EACH ROW EXECUTE FUNCTION clear_terminal_email_send_content();++-- Delivery facts outlive the message, including provider synchronization and deletion.+CREATE FUNCTION record_email_send_attempt_delivery() RETURNS TRIGGER AS $$+BEGIN+ UPDATE email_send_attempts+ SET sent = TRUE+ WHERE message_id = NEW.id AND link_id = NEW.link_id+ AND NOT cancelled AND NOT sent;+ RETURN NEW;+END;+$$ LANGUAGE plpgsql;++CREATE TRIGGER email_send_attempt_delivery+AFTER UPDATE OF is_sent ON email_messages+FOR EACH ROW WHEN (NEW.is_sent AND NOT OLD.is_sent)+EXECUTE FUNCTION record_email_send_attempt_delivery();++CREATE FUNCTION preserve_deleted_email_send_delivery() RETURNS TRIGGER AS $$+DECLARE+ scheduled email_scheduled_messages%ROWTYPE;+BEGIN+ -- Match the worker's message -> schedule lock order. If submission is racing+ -- deletion, either we observe its boundary or its subsequent UPDATE finds no row.+ SELECT * INTO scheduled FROM email_scheduled_messages+ WHERE message_id = OLD.id AND link_id = OLD.link_id FOR UPDATE;++ IF OLD.is_sent OR COALESCE(scheduled.sent, FALSE) THEN+ UPDATE email_send_attempts SET sent = TRUE+ WHERE message_id = OLD.id AND link_id = OLD.link_id+ AND NOT cancelled AND NOT sent;+ ELSIF scheduled.delivery_status <> 'failed' AND (+ scheduled.delivery_started_at IS NOT NULL+ OR scheduled.delivery_status = 'unconfirmed'+ OR (scheduled.processing AND scheduled.delivery_claim_id IS NULL)+ ) THEN+ UPDATE email_send_attempts SET delivery_unconfirmed = TRUE+ WHERE message_id = OLD.id AND link_id = OLD.link_id+ AND NOT cancelled AND NOT sent;+ END IF;+ UPDATE email_send_attempts+ SET request = email_send_attempt_identity(request), prepared_content = NULL,+ restore_body_html = NULL, restore_body_text = NULL, restore_body_macro = NULL+ WHERE message_id = OLD.id AND link_id = OLD.link_id;+ RETURN OLD;+END;+$$ LANGUAGE plpgsql;++CREATE TRIGGER email_send_attempt_delivery_before_delete+BEFORE DELETE ON email_messages+FOR EACH ROW EXECUTE FUNCTION preserve_deleted_email_send_delivery();diff --git a/crates/macro_db_client/migrations/20261015141418_email_scheduled_attachment_manifest.sql b/crates/macro_db_client/migrations/20261015141418_email_scheduled_attachment_manifest.sqlnew file mode 100644index 0000000000..e8bfacc5bd--- /dev/null+++ b/crates/macro_db_client/migrations/20261015141418_email_scheduled_attachment_manifest.sql@@ -0,0 +1,39 @@+-- One provider-file set for native imported files and explicit forwards.+CREATE FUNCTION email_draft_provider_attachment_ids(UUID, UUID)+RETURNS TABLE(attachment_id UUID) AS $$+SELECT a.id FROM email_attachments a+ JOIN email_messages m ON m.id=a.message_id WHERE m.id=$1 AND m.link_id=$2+ AND NOT EXISTS(SELECT 1 FROM email_draft_attachment_removals r WHERE r.message_id=m.id AND (r.provider_id=a.provider_attachment_id OR trim(both '<>' from r.content_id)=trim(both '<>' from a.content_id)))+ AND NOT EXISTS(SELECT 1 FROM email_attachments_drafts u WHERE u.draft_id=m.id AND trim(both '<>' from a.content_id)=COALESCE(trim(both '<>' from u.content_id),u.id::text||'@attachments.macro.com'))+ AND NOT EXISTS(SELECT 1 FROM email_attachments_fwd f JOIN email_attachments original ON original.id=f.attachment_id WHERE f.message_id=m.id AND (trim(both '<>' from a.content_id)=trim(both '<>' from original.content_id) OR trim(both '<>' from a.content_id)=f.attachment_id::text||'@attachments.macro.com'))+ UNION SELECT f.attachment_id FROM email_attachments_fwd f JOIN email_messages m ON m.id=f.message_id WHERE m.id=$1 AND m.link_id=$2+$$ LANGUAGE sql STABLE;++-- Retain approved identities even if a forwarded source is later deleted.+ALTER TABLE email_scheduled_messages ADD COLUMN approved_attachments JSONB NOT NULL+ DEFAULT '{"uploaded": [], "forwarded": []}'::jsonb;++CREATE FUNCTION capture_email_scheduled_attachments() RETURNS trigger AS $$+BEGIN+ -- Match admission and mutation lock order, including older schedule writers.+ PERFORM id FROM email_messages WHERE id = NEW.message_id FOR UPDATE;+ NEW.approved_attachments := jsonb_build_object(+ 'uploaded', COALESCE((SELECT jsonb_agg(id ORDER BY id)+ FROM email_attachments_drafts WHERE draft_id = NEW.message_id), '[]'::jsonb),+ 'forwarded', COALESCE((SELECT jsonb_agg(attachment_id ORDER BY attachment_id)+ FROM email_draft_provider_attachment_ids(NEW.message_id, NEW.link_id)), '[]'::jsonb)+ );+ RETURN NEW;+END;+$$ LANGUAGE plpgsql;++CREATE TRIGGER capture_email_scheduled_attachments+ BEFORE INSERT ON email_scheduled_messages+ FOR EACH ROW EXECUTE FUNCTION capture_email_scheduled_attachments();++UPDATE email_scheduled_messages s SET approved_attachments = jsonb_build_object(+ 'uploaded', COALESCE((SELECT jsonb_agg(id ORDER BY id)+ FROM email_attachments_drafts WHERE draft_id = s.message_id), '[]'::jsonb),+ 'forwarded', COALESCE((SELECT jsonb_agg(attachment_id ORDER BY attachment_id)+ FROM email_draft_provider_attachment_ids(s.message_id, s.link_id)), '[]'::jsonb)+);diff --git a/crates/macro_db_client/migrations/20261020192404_email_send_draft_fencing.sql b/crates/macro_db_client/migrations/20261020192404_email_send_draft_fencing.sqlnew file mode 100644index 0000000000..b7e6debb39--- /dev/null+++ b/crates/macro_db_client/migrations/20261020192404_email_send_draft_fencing.sql@@ -0,0 +1,5 @@+SET lock_timeout = '5s';++-- Zero preserves existing clients. Admission and cancellation advance the+-- generation so requests captured before either boundary cannot edit the draft.+ALTER TABLE email_messages ADD COLUMN draft_generation integer NOT NULL DEFAULT 0;diff --git a/crates/macro_db_client/migrations/20261020193229_email_send_attempt_handles_and_listing.sql b/crates/macro_db_client/migrations/20261020193229_email_send_attempt_handles_and_listing.sqlnew file mode 100644index 0000000000..53faa22c7b--- /dev/null+++ b/crates/macro_db_client/migrations/20261020193229_email_send_attempt_handles_and_listing.sql@@ -0,0 +1,19 @@+SET lock_timeout = '5s';++-- Retain handles after message deletion. Otherwise a delayed offline save can+-- mistake the cascaded client-ID mapping for a draft that has never been saved.+ALTER TABLE email_send_attempts ADD COLUMN draft_handles uuid[] NOT NULL DEFAULT '{}';+UPDATE email_send_attempts a+SET draft_handles = ARRAY(+ SELECT DISTINCT handle FROM (+ SELECT a.message_id AS handle+ UNION ALL+ SELECT c.client_id FROM email_draft_client_ids c+ WHERE c.message_id = a.message_id AND c.link_id = a.link_id+ ) handles WHERE handle IS NOT NULL+);++CREATE INDEX email_send_attempts_pending_actor+ ON email_send_attempts (user_id, created_at DESC, link_id DESC, attempt_id DESC)+ WHERE NOT cancelled AND NOT sent;+CREATE INDEX email_send_attempts_inbox ON email_send_attempts (link_id);diff --git a/crates/macro_db_client/migrations/20261020195320_email_send_source_inbox_fences.sql b/crates/macro_db_client/migrations/20261020195320_email_send_source_inbox_fences.sqlnew file mode 100644index 0000000000..4db3d43b3d--- /dev/null+++ b/crates/macro_db_client/migrations/20261020195320_email_send_source_inbox_fences.sql@@ -0,0 +1,16 @@+SET lock_timeout = '5s';++-- A Gmail draft may move inboxes at admission while keeping its old client+-- aliases. Retain those namespaces after provider sync deletes the message.+ALTER TABLE email_send_attempts+ ADD COLUMN draft_link_ids uuid[] NOT NULL DEFAULT '{}';++UPDATE email_send_attempts a+SET draft_link_ids = ARRAY(+ SELECT a.link_id+ UNION SELECT b.link_id FROM email_draft_client_ids b WHERE b.message_id = a.message_id+),+draft_handles = ARRAY(+ SELECT unnest(a.draft_handles)+ UNION SELECT b.client_id FROM email_draft_client_ids b WHERE b.message_id = a.message_id+);diff --git a/crates/macro_db_client/migrations/20261020210731_defer_active_email_send_deletion.sql b/crates/macro_db_client/migrations/20261020210731_defer_active_email_send_deletion.sqlnew file mode 100644index 0000000000..5767fcae29--- /dev/null+++ b/crates/macro_db_client/migrations/20261020210731_defer_active_email_send_deletion.sql@@ -0,0 +1,54 @@+SET LOCAL lock_timeout = '5s';++-- Retain sync deletions while accepted delivery still owns the message.+-- The generation prevents an old deletion from affecting a draft restored by Undo.+CREATE TABLE email_deferred_message_deletions (+ message_id UUID PRIMARY KEY REFERENCES email_messages(id) ON DELETE CASCADE,+ provider_id TEXT,+ draft_generation INTEGER NOT NULL+);++CREATE OR REPLACE FUNCTION preserve_deleted_email_send_delivery() RETURNS TRIGGER AS $$+DECLARE+ scheduled email_scheduled_messages%ROWTYPE;+BEGIN+ -- DELETE already owns the message lock shared with admission/cancellation.+ -- Explicit inbox removal revokes delivery authority; permit batched purge+ -- while the link is marked deleting, and direct parent FK cascades.+ IF NOT OLD.is_sent AND EXISTS (SELECT 1 FROM email_links+ WHERE id = OLD.link_id AND deleting_at IS NULL)+ AND EXISTS (SELECT 1 FROM email_send_attempts+ WHERE message_id = OLD.id AND link_id = OLD.link_id+ AND NOT cancelled AND NOT sent) THEN+ INSERT INTO email_deferred_message_deletions (message_id, provider_id, draft_generation)+ VALUES (OLD.id, OLD.provider_id, OLD.draft_generation)+ ON CONFLICT (message_id) DO UPDATE+ SET provider_id = EXCLUDED.provider_id, draft_generation = EXCLUDED.draft_generation;+ -- Stop before compacting content or cascading to jobs and attachments.+ RETURN NULL;+ END IF;+ -- Match the worker's message -> schedule lock order. If submission is racing+ -- deletion, either we observe its boundary or its subsequent UPDATE finds no row.+ SELECT * INTO scheduled FROM email_scheduled_messages+ WHERE message_id = OLD.id AND link_id = OLD.link_id FOR UPDATE;++ IF OLD.is_sent OR COALESCE(scheduled.sent, FALSE) THEN+ UPDATE email_send_attempts SET sent = TRUE+ WHERE message_id = OLD.id AND link_id = OLD.link_id+ AND NOT cancelled AND NOT sent;+ ELSIF scheduled.delivery_status <> 'failed' AND (+ scheduled.delivery_started_at IS NOT NULL+ OR scheduled.delivery_status = 'unconfirmed'+ OR (scheduled.processing AND scheduled.delivery_claim_id IS NULL)+ ) THEN+ UPDATE email_send_attempts SET delivery_unconfirmed = TRUE+ WHERE message_id = OLD.id AND link_id = OLD.link_id+ AND NOT cancelled AND NOT sent;+ END IF;+ UPDATE email_send_attempts+ SET request = email_send_attempt_identity(request), prepared_content = NULL,+ restore_body_html = NULL, restore_body_text = NULL, restore_body_macro = NULL+ WHERE message_id = OLD.id AND link_id = OLD.link_id;+ RETURN OLD;+END;+$$ LANGUAGE plpgsql;diff --git a/crates/macro_db_migrator/src/test.rs b/crates/macro_db_migrator/src/test.rsindex 74cf340355..dc06f3efb0 100644--- a/crates/macro_db_migrator/src/test.rs+++ b/crates/macro_db_migrator/src/test.rs@@ -8,6 +8,42 @@ use std::borrow::Cow;const EMPTY_PUBLIC_SCHEMA: &str = "DROP SCHEMA public CASCADE; CREATE SCHEMA public;";const SCHEMA_DROP_VERSION: i64 = 20261002150422;+const EMAIL_DELIVERY_VERSION: i64 = 20261015141405;++#[sqlx::test(migrations = false)]+async fn email_delivery_upgrade_preserves_existing_schedules_and_attachments(pool: PgPool) {+ sqlx::raw_sql(EMPTY_PUBLIC_SCHEMA)+ .execute(&pool)+ .await+ .unwrap();+ let before_delivery = Migrator {+ migrations: Cow::Owned(+ MACRO_DB_MIGRATIONS+ .iter()+ .filter(|migration| migration.version < EMAIL_DELIVERY_VERSION)+ .cloned()+ .collect(),+ ),+ ..Migrator::DEFAULT+ };+ before_delivery.run(&pool).await.unwrap();+ sqlx::raw_sql(include_str!(+ "../../email_db_client/fixtures/get_process_scheduled_messages.sql"+ ))+ .execute(&pool)+ .await+ .unwrap();+ sqlx::raw_sql(include_str!("test/before_email_delivery.sql"))+ .execute(&pool)+ .await+ .unwrap();+ MACRO_DB_MIGRATIONS.run(&pool).await.unwrap();+ sqlx::raw_sql(include_str!("test/after_email_delivery.sql"))+ .execute(&pool)+ .await+ .unwrap();+ MACRO_DB_MIGRATIONS.run(&pool).await.unwrap();+}const OUTLOOK_RUNTIME_VERSION: i64 = 20261004022345;async fn before_drop(pool: &PgPool) {diff --git a/crates/macro_db_migrator/src/test/after_email_delivery.sql b/crates/macro_db_migrator/src/test/after_email_delivery.sqlnew file mode 100644index 0000000000..d2dfccacf6--- /dev/null+++ b/crates/macro_db_migrator/src/test/after_email_delivery.sql@@ -0,0 +1,29 @@+DO $$+BEGIN+ IF (SELECT approved_attachments FROM email_scheduled_messages+ WHERE message_id = '00000000-0000-0000-0000-00000000e501')+ IS DISTINCT FROM '{"uploaded": ["f0000000-0000-0000-0000-000000000002"],+ "forwarded": ["f0000000-0000-0000-0000-000000000001"]}'::jsonb+ THEN+ RAISE EXCEPTION 'Upgrade did not capture existing attachment identities';+ END IF;++ IF EXISTS (SELECT 1 FROM email_scheduled_messages+ WHERE delivery_status <> 'ready' OR delivery_claim_id IS NOT NULL+ OR delivery_lease_expires_at IS NOT NULL OR delivery_started_at IS NOT NULL+ OR delivery_message_id IS NOT NULL)+ THEN+ RAISE EXCEPTION 'Upgrade changed legacy delivery defaults';+ END IF;++ IF NOT EXISTS (SELECT 1 FROM email_scheduled_messages+ WHERE message_id = '00000000-0000-0000-0000-00000000e502'+ AND processing AND NOT sent)+ OR NOT EXISTS (SELECT 1 FROM email_scheduled_messages+ WHERE message_id = '00000000-0000-0000-0000-00000000e503'+ AND sent AND NOT processing)+ THEN+ RAISE EXCEPTION 'Upgrade changed existing processing or delivery state';+ END IF;+END;+$$;diff --git a/crates/macro_db_migrator/src/test/before_email_delivery.sql b/crates/macro_db_migrator/src/test/before_email_delivery.sqlnew file mode 100644index 0000000000..842121b859--- /dev/null+++ b/crates/macro_db_migrator/src/test/before_email_delivery.sql@@ -0,0 +1,16 @@+-- Seed attachments before the manifest column and its insert trigger exist.+INSERT INTO email_attachments_drafts+ (id, draft_id, file_name, content_type, sha, size, s3_key)+VALUES ('f0000000-0000-0000-0000-000000000002',+ '00000000-0000-0000-0000-00000000e501',+ 'uploaded.txt', 'text/plain', 'upgrade-upload', 3, 'upgrade-upload');++INSERT INTO email_attachments+ (id, message_id, provider_attachment_id, filename, mime_type, size_bytes)+VALUES ('f0000000-0000-0000-0000-000000000001',+ '00000000-0000-0000-0000-00000000e502',+ 'upgrade-forward', 'forwarded.txt', 'text/plain', 3);++INSERT INTO email_attachments_fwd (message_id, attachment_id)+VALUES ('00000000-0000-0000-0000-00000000e501',+ 'f0000000-0000-0000-0000-000000000001');diff --git a/crates/models_email/AGENTS.md b/crates/models_email/AGENTS.mdindex d8cb33d0de..d24db92ed9 100644--- a/crates/models_email/AGENTS.md+++ b/crates/models_email/AGENTS.md@@ -31,6 +31,8 @@ thread/message API types, DB row types, and Gmail API response shapes.- `cargo test -p models_email` (`SQLX_OFFLINE` unset).+Parsed message responses expose the draft generation captured in the same SQL snapshot as their content.+## Related- Rules: `.agents/rules/rust/architecture.md`diff --git a/crates/models_email/src/email/service/message.rs b/crates/models_email/src/email/service/message.rsindex 07fca22c29..73e65bb7e9 100644--- a/crates/models_email/src/email/service/message.rs+++ b/crates/models_email/src/email/service/message.rs@@ -16,6 +16,9 @@ use uuid::Uuid;#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]pub struct ParsedMessage {+ /// Draft edit generation captured with this message snapshot.+ #[serde(default)]+ pub draft_generation: i32,pub db_id: Uuid,pub link_id: Uuid,pub thread_db_id: Uuid,@@ -116,9 +119,11 @@ impl From<Message> for MessageWithBodyReplyless {}}-impl From<MessageWithBodyReplyless> for ParsedMessage {- fn from(msg: MessageWithBodyReplyless) -> Self {+impl ParsedMessage {+ /// Preserve the generation read atomically with the message content.+ pub fn with_generation(msg: MessageWithBodyReplyless, draft_generation: i32) -> Self {Self {+ draft_generation,body_parsed: get_body_parsed_for_message(&msg),db_id: msg.inner.db_id,link_id: msg.inner.link_id,diff --git a/crates/scheduled_action/src/outbound/event_content/routine_event/test.rs b/crates/scheduled_action/src/outbound/event_content/routine_event/test.rsindex 4997f27231..dbc6ad6a2b 100644--- a/crates/scheduled_action/src/outbound/event_content/routine_event/test.rs+++ b/crates/scheduled_action/src/outbound/event_content/routine_event/test.rs@@ -346,6 +346,7 @@ fn a_received_email_carries_its_headers_and_reply_free_body() {.unwrap();let received_at = Utc.with_ymd_and_hms(2026, 10, 5, 9, 30, 0).unwrap();let content = EventContent::Email(Some(ParsedMessage {+ draft_generation: 0,db_id: Uuid::parse_str("01928f3e-6a2b-7c3d-8e4f-00000000e3e5").unwrap(),link_id: Uuid::nil(),thread_db_id: Uuid::parse_str("01928f3e-6a2b-7c3d-8e4f-00000000e7a1").unwrap(),diff --git a/crates/scheduled_action/src/outbound/event_content/test.rs b/crates/scheduled_action/src/outbound/event_content/test.rsindex 0d59787e61..3f7edae62a 100644--- a/crates/scheduled_action/src/outbound/event_content/test.rs+++ b/crates/scheduled_action/src/outbound/event_content/test.rs@@ -25,6 +25,7 @@ fn event(name: &str, message_id: Option<Uuid>) -> EventReference {fn email() -> ParsedMessage {let at = Utc.with_ymd_and_hms(2026, 10, 5, 9, 30, 0).unwrap();ParsedMessage {+ draft_generation: 0,db_id: Uuid::nil(),link_id: Uuid::nil(),thread_db_id: Uuid::nil(),diff --git a/crates/soup/src/inbound/axum_router/tests.rs b/crates/soup/src/inbound/axum_router/tests.rsindex 67d7a484f0..abc4ff4d40 100644--- a/crates/soup/src/inbound/axum_router/tests.rs+++ b/crates/soup/src/inbound/axum_router/tests.rs@@ -225,6 +225,14 @@ impl SoupService for MockSoup {struct MockEmail;impl EmailService for MockEmail {+ async fn resolve_thread_read_id(+ &self,+ _macro_id: MacroUserIdStr<'_>,+ thread_id: Uuid,+ ) -> Result<Uuid, EmailErr> {+ Ok(thread_id)+ }+async fn resolve_message_operation(&self,_actor: macro_user_id::user_id::MacroUserIdStr<'static>,@@ -355,6 +363,7 @@ impl EmailService for MockEmail {&self,_macro_id: macro_user_id::user_id::MacroUserIdStr<'_>,_draft_id: uuid::Uuid,+ _expected_generation: i32,) -> Result<email::domain::models::DeletedUserDraft, EmailErr> {Err(EmailErr::RepoErr(anyhow::anyhow!("Not implemented")))}@@ -720,6 +729,14 @@ struct MockEmailLinkResult {}impl EmailService for MockEmailLinkResult {+ async fn resolve_thread_read_id(+ &self,+ _macro_id: MacroUserIdStr<'_>,+ thread_id: Uuid,+ ) -> Result<Uuid, EmailErr> {+ Ok(thread_id)+ }+async fn resolve_message_operation(&self,_actor: macro_user_id::user_id::MacroUserIdStr<'static>,@@ -840,6 +857,7 @@ impl EmailService for MockEmailLinkResult {&self,_macro_id: macro_user_id::user_id::MacroUserIdStr<'_>,_draft_id: uuid::Uuid,+ _expected_generation: i32,) -> Result<email::domain::models::DeletedUserDraft, EmailErr> {Err(EmailErr::RepoErr(anyhow::anyhow!("Not implemented")))}diff --git a/deny.toml b/deny.tomlindex eb418d5683..4c691e2a21 100644--- a/deny.toml+++ b/deny.toml@@ -96,8 +96,9 @@ ignore = [{ id = "RUSTSEC-2026-0367", reason = "zip 3.0.0 is a utoipa-swagger-ui build-dependency that reads its vendored Swagger UI archive entry by entry and never calls extract(); no release uses patched zip >= 9" },{ id = "RUSTSEC-2026-0368", reason = "zip 3.0.0 is a utoipa-swagger-ui build-dependency that reads its vendored Swagger UI archive entry by entry and never calls extract(); no release uses patched zip >= 9" },{ id = "RUSTSEC-2026-0369", reason = "zip 3.0.0 is a utoipa-swagger-ui build-dependency that reads its vendored Swagger UI archive entry by entry and never calls extract(); no release uses patched zip >= 9" },- # Revisit: drop when sqlx depends on webpki-roots 1.x directly.- { id = "RUSTSEC-2026-0381", reason = "webpki-roots 0.26.11 pinned by sqlx-core 0.8.6 is a semver-trick facade over webpki-roots 1.x; this lockfile resolves it to patched 1.0.10, which removed the distrusted emSign root" },+ # 0.26.11 only re-exports webpki-roots 1.x; the bans below require patched roots.+ # Remove this exception when SQLx and the remaining callers stop using the wrapper.+ { id = "RUSTSEC-2026-0381", reason = "webpki-roots 0.26.11 contains no certificates and re-exports patched 1.0.10; bans reject every other version below 1.0.10" },#{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" },#"[email protected]", # you can also ignore yanked crate versions if you wish#{ crate = "[email protected]", reason = "you can specify why you are ignoring the yanked crate" },@@ -206,6 +207,10 @@ allow = []# List of crates to denydeny = [+ # Preserve RUSTSEC-2026-0381 protection while allowing the certificate-free+ # 0.26.11 compatibility wrapper. Its 1.x parent must also satisfy these bans.+ { crate = "webpki-roots:<0.26.11", reason = "Contains distrusted emSign roots (RUSTSEC-2026-0381)" },+ { crate = "webpki-roots:>0.26.11, <1.0.10", reason = "Contains distrusted emSign roots (RUSTSEC-2026-0381)" },{ crate = "aws-config", wrappers = ["aws-msk-iam-sasl-signer", # External crate, requires aws-config directly"macro_aws_config",diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.mdindex 49636db739..4a0d7d7b8d 100644--- a/docs/agent-guide/email.md+++ b/docs/agent-guide/email.md@@ -580,18 +580,116 @@ final sent update, then switching offline and opening Sent. Existing providertimestamps and timestamps from repeated finalization remain unchanged; an unsentor cancelled draft must not acquire Sent membership.-Send and schedule are refused with a notice while the device is offline, while a-draft is still syncing (its save was accepted locally but not yet confirmed by the-server; retry after a moment), or while an attachment has no completed upload. The-composer keeps its content in each case. Attachments cannot be added while-offline: a blocking notice explains and nothing is attached.-For a new standalone email, a failed REST draft save is best-effort: Send can-still proceed without a draft ID when no save was queued and no attachment is-waiting to upload. A server rejection blocks sending even an existing draft.+**Send** and **Send Later** always persist new messages, replies, and forwards+for Gmail and Outlook in device email storage; no outbox feature flag is required.+This works with either thread read transport, including when normalized-cache+initialization has failed. Recipients, inbox, sender alias, body, displayed+signature, attachment references, and any scheduled time are frozen under one+attempt ID. Completed uploads are required; adding files offline is unavailable.++An authenticated app-level dispatcher submits online immediately and retries the+same attempt independently of unrelated draft, archive, and property mutations.+**Queued on this device** means the app must run again to submit. **Accepted by+server** means delivery continues after the browser closes. Never equate local+queueing or server acceptance with provider delivery. Only one active send can+own a draft across tabs; queued composers remain read-only.++Queued sends remain visible in **Drafts** and their conversation with a persistent+status and **Cancel** action. A never-attempted send can be cancelled offline.+If admission may have reached the server, **Cancellation pending** keeps it locked+until the server confirms cancellation. A definitive inbox-access rejection of+the first submission permits restoring the saved draft locally. Verify this still+works after reload without a cancellation request to the inaccessible inbox.+A lost response followed by an inbox-access error must remain locked. Once delivery starts, cancellation may+be too late. Confirmed cancellation automatically restores the working copy,+including after navigation or reload. Restoration and removal of local send+authority commit together. It preserves newer edits and fences callbacks from+before cancellation; older autosaves cannot overwrite or delete the restored copy. A failed queue attempt retains recovery content;+cancel it before restoring and sending again. The server starts the undo delay+at first admission, so reconnecting does not consume that delay while offline.+The send toast's **Undo** works after navigation closes the composer. It restores+the draft only after cancellation is confirmed. Pending cancellation, an expired+undo window, and failed cancellation each display a notice. Delivered attempts+remain complete even if the sent message is later deleted from the provider.+After Undo, delay the accepted cache record's refresh: the newer restored draft+must still reopen with its body and attachments. A later confirmed send must still+prevent reopening that older draft.++In local backend tests, delete a message after acceptance and during uncertain+submission. Its body, attachments, delivery job, and reconciliation identifier+must remain intact. After cancellation, the deferred deletion must not delete the+restored draft or a subsequent send, even when the provider ID stays the same.++If an approved attachment is no longer available before delivery, the send stops+with a failure so the draft can be restored and reviewed. It must never silently+send a smaller attachment set. An interrupted worker can retry preparation, but+after submission may have begun it only checks Gmail for the original Message-ID.+An unresolved outcome shows **Delivery unconfirmed** with **Check status**; it+remains locked and is never automatically resent. A confirmed Gmail match marks+the original attempt delivered. A definite preparation failure or provider+rejection allows cancellation and draft restoration.++When Gmail sync imports a delivered message before recovery completes, recovery+keeps the Gmail-synced conversation and the original local message ID. Links to+the now-empty draft conversation redirect for users with access to that inbox.+Sharing only the old conversation must not grant access to the destination.+Existing properties and reminders on the old conversation stay attached to it.++Switching an existing draft's sending inbox while offline must send from the+selected inbox after reconnect, even when the intermediate draft save is still+queued. Uploaded files remain attached. Forwarded and imported provider attachments retain their source-inbox access checks.+Provider-bound drafts use the explicit inbox-transfer flow. Accepted Outlook+sends remain owned by its provider coordinator; ambiguity is reconciled there.++Verify: queue a new message and a reply offline, close and reopen the app, and+check their persistent status and read-only content. Cancel one before reconnect+and confirm its send mutation is never issued. Reconnect the other and check+that one stable attempt is replayed even after a lost response. Also test a+cancel racing admission, unavailable local storage, and a pending upload. Queue+admission means **Email queued to send** or **Email sending**, not provider delivery.+Send a standalone message, let it open its thread, then use the toast's Undo and+confirm the original draft reopens. Repeat after delivery starts and check the+visible failure notice. Cancel a draft-only thread and check it returns to Drafts+without requiring another save.+Restore both a standalone draft and a reply, then edit and save without reloading;+confirm the original content is visible and no send watermark returns. While a+standalone send is queued, verify sender, recipients, subject, body, attachments,+signature, formatting, schedule picker, delete, and Send remain disabled. Only+Cancel may change the queued send. The disabled reply Send action explains+**Queued to send. Cancel the send before editing.**+Open the formatting ribbon before queueing+and verify it disappears while locked. Repeat after reload and restore in the+same mounted composer; no schedule proposal should survive the queued state.+Drop an inline image while queued and confirm no upload or insertion occurs.+Queue the same draft from another composer while its link editor is open;+the link editor must close. Repeat while image conversion or file upload is+pending and verify completion does not insert content into the locked body.+While a+reply is queued, click Forward on another message and confirm the queued content+and recipients stay unchanged. Race Send from two tabs and confirm only one+active intent exists; cancellation must not leave a second send queued.+Queue Send before the latest edit reaches the server. The send journal takes+ownership of that exact local revision. After cancelling, edit the restored draft before reconnecting and verify those later+edits still sync. Repeat across tabs: a newer local edit racing Send must block+the stale submission, and old send cleanup must preserve a restored draft and+its attachments. Logout should warn about queued sends even after their original+local working copies have been retired; it must not claim to cancel server sends.+Approved local sends survive sign-out, are hidden from other accounts, and resume+only when the same account signs back in. The status panel also lists pending and+failed server attempts from other devices, with pagination. Cancelling one must+preserve this device's unsynced edits. A malformed or newer-version journal record+shows a recovery warning, retains its recognizable draft locks, and does not stop+unrelated valid sends. Reconnecting an expired email account requires **Check+status** to resume a paused local attempt.++New messages and replies persist a local draft identity before Send; an ordinary+autosave does not need server acknowledgement when the frozen message and+completed attachment references are available locally.GraphQL draft saves automatically retry only network failures. GraphQL errors,including internal, invalid, and unauthorized errors, fail the mutation and-release the queue. The local working copy offers explicit Retry; Send stays-blocked until a save is confirmed.+release the queue. The local working copy offers explicit Retry. Send and Send+Later capture the latest local revision and completed attachments for offline+delivery.A successful save response with an invalid cache identity binding still commitsits normalizable server data and reports a cache diagnostic without replayingthe mutation or asking the user to save again. If that response also cannot be@@ -665,6 +763,50 @@ and reconnect. Opening through an older local thread link must reach the sameserver thread after synchronization. Repeat with an existing reply and confirmthat other messages, attachments, and the Sent preview remain intact.+Attachments require connectivity: adding files offline is refused in both composers.+Existing attachments stay visible and preserved while offline, but Send and Schedule+send require reconnection for any draft with attachments. Online, clicking Send before+a save debounce finishes must start or continue uploads; a queued save's confirmation+must also resume pending uploads after reload. Pending or failed inline image/video+uploads block Send and Schedule send until they have durable URLs or are removed.++Queued sends survive query-cache recovery in independent account-scoped storage,+retaining their original attempt IDs, frozen bodies, attachments and cancellation+requests. After cache loss, status reconciliation must reuse that attempt identity;+it must not create a second delivery.+Cancel a reconstructed send while its original HTTP request is delayed: the draft+must stay locked until the server confirms cancellation, even if recovery's status+lookup found no attempt. A fresh queue entry cannot prove the original was never tried.+Repeat while the general GraphQL queue is blocked on an unrelated mutation;+Outbox submission and cancellation must proceed independently.+After durable reply Undo, delay the restored working-copy read until UI callbacks+finish, then edit and send again. New edits must save using the restored generation.+Repeat provider draft sync followed by trash and a new explicit Send: a delayed+Undo for the trashed send must preserve the newer send's schedule and body.+Restart after persisting Cancel but before submitting it: app-shell recovery must+finish cancellation and restore the draft atomically. Repeat with no email view+mounted. Reset the actual WASM cache and verify the independent send journal,+approved body, attempt ID and draft reservation remain intact.+Cancel and Restore must win over a delayed Send completion in both composers. Start+another send after restoration, delay its preparation, then release the old response:+the newer send must remain locked until its own preparation and delivery finish.+Restore while an editor is still connecting and verify that its text, HTML, or+empty body survives initialization. Leave a reply attachment picker open, start+restoration, then finish picking a file: the delayed callback must not change+attachments until restoration completes. Existing attachments must stay intact.+Trashing a thread may cancel unsubmitted scheduled drafts, but must preserve+submitted and delivery-unconfirmed claims. It must not make either send appear+cancelled or allow a second delivery while the original outcome is unresolved.+Resizing media must stop immediately when an editor+locks, including an active drag and a pending debounced resize. Open the GIF+picker before the lock arrives: it must close, and a pending selection or+deferred opening must not insert content into the locked draft.+Keep an oversized-file link confirmation or upload pending while another tab+queues the send, changes the inbox, or restores the draft. Its late completion+must leave the uploaded files private and the draft body unchanged. Restore a+queued reply while Send and mark done is waiting for the next page: the delayed+completion must not archive the restored thread.+With GraphQL Mail enabled, discarding the last draft in a thread must remove thethread from every local Mail view, including after queued replay. Discarding astandalone draft from its composer returns to the previous list after deletion@@ -709,6 +851,19 @@ label truncates while Cancel stays at its far edge; the bar never covers discardattachment, formatting, the clock, or the primary action. Reply recipientscannot be edited or dragged during a confirmed schedule or active delivery mutation.+Scheduled delivery failures replace the time summary with **Send failed before+delivery** and **Restore draft**. Restoration cancels delivery before unlocking the+message. **Delivery unconfirmed** explains that the email may already have been+sent and offers **Check status**; it never offers restoration or automatic resend.+The time picker stays disabled for failed, sending, and unconfirmed deliveries.+Preparation that has not reached provider submission remains cancellable, including+after its due time or a retry delay. Verify both standalone and reply composers,+including a status refresh whose scheduled time is unchanged and a failure arriving+while a replacement time is selected.+Block the REST lifecycle read while GraphQL loads a failed scheduled draft. It+must still show failure recovery and keep the time picker disabled; GraphQL+provides both the scheduled time and delivery status.+When verifying, use an intercepted or isolated delivery fixture: choose a time,confirm that the editable **Scheduled send** preview makes zero delivery calls, then usethe primary button and `Ctrl`/`Cmd`+`Enter separately to confirm exactly one schedule@@ -781,7 +936,12 @@ and address pickers remain available. To check without sending real mail, openboth pickers, select an alias, switch to the primary address, reopen a saved aliasdraft, and confirm the address remains unchanged. Alias discovery uses`MailAccounts`, draft saves use `saveEmailDraft`, and delivery uses-`sendEmailMessage` in GraphQL; the existing undo-send window still applies.+`sendEmailAttempt` for durable delivery or `sendEmailMessage` for foreground+GraphQL delivery; the existing undo-send window still applies. Verify an alias+through offline queueing, reconnect, and Undo: it must stay attached to the+captured inbox and must never fall back to that inbox's primary address. Existing+queued sends created before alias support must still replay with the same attempt+identity.If an explicitly selected sending inbox is unavailable, Send reports`Unable to find linked email account. Select a sending inbox.` without delivering@@ -830,3 +990,14 @@ A confirmed save archives the thread and advances within the invoking list.Cancel and failed saves keep the current email. H on a pending snooze edits it;**Remove reminder** returns it to the inbox. Bare H in a reply or search fieldremains ordinary typing.++### Cache initialization recovery++With the GraphQL draft queue enabled, block the cache WASM download until its+bootstrap retries fail. Compose text and verify it remains saved on this device+with a synchronization status and Retry. Restore network access and reconnect or+press Retry: the same composer and working copy must remain, and synchronization+must resume only after the preserved queue is readable. Repeat while another tab+holds the cache owner lock; recovery must never steal the lock or erase its queue.+Storage/schema failures that cannot prove preservation show recovery/update+instructions instead of repeatedly reopening potentially damaged storage.diff --git a/docs/architecture/email.md b/docs/architecture/email.mdindex 7a0526e642..00e21ce45a 100644--- a/docs/architecture/email.md+++ b/docs/architecture/email.md@@ -154,9 +154,9 @@ The compose controllers now assemble these smaller responsibilities:| Module | Responsibility and boundary || --- | --- || `attachment-persistence.ts` | Upload/remove operations and completion tracking. Receives attachment state and three transport capabilities. A saved attachment ID does not mean its content upload has finished; every save waits for outstanding uploads. |-| `email-send-schedule.ts` | Confirmed send time, pending changes, unscheduling and archive feedback. Scheduling saves the current draft and waits for its attachments even when a draft ID already exists; each operation retains its selected inbox. |-| `draft-session.ts` / `draft-persistence.ts` | Shared draft identity, queued-write status, rejection policy, and save/delete ordering. Server identity and a committed latest save are separate facts; REST send, schedule, and uploads wait for a committed save. |-| `send-readiness.ts` | Why an immediate send must be refused: offline, a draft the server cannot address yet (queued or unconfirmed handle), or an attachment whose upload never finished. Pure checks plus the one failure notice both controllers show. |+| `email-send-schedule.ts` | Confirmed send time, pending changes, unscheduling and archive feedback. Send Later freezes its deadline in the send intent; updating an existing legacy schedule saves first. Cancellation only unlocks editing after confirmation. |+| `draft-session.ts` / `draft-persistence.ts` | Shared draft identity, queued-write status, rejection policy, and save/delete ordering. Server identity and a committed latest save are separate facts; uploads and updates to existing legacy schedules wait for a committed save. |+| `send-readiness.ts` | Outbox admission allows offline delivery with complete attachment references and rejects unfinished uploads. || `draft-autosave.ts` | One debounce and serialized write queue used by reply and standalone compose. Captures editor values before queueing, flushes pending edits on disposal, and exposes cancellation and completion for send/discard. || `reply-recipient-fields.ts` | Recipient field expansion, drag/drop and outside interaction. Receives values, a setter and a change callback; it knows nothing about saving or sending. || `reply-composer-focus.ts` | Deferred editor/recipient focus and the forward focus guard. Receives DOM accessors and an editor `focus()` capability. Its timers, animation frames and event listeners end with its owner. |@@ -499,3 +499,100 @@ occurrence and invitation caches, including email-only views. Failed older requecannot roll back a newer selection or replace its feedback. Settlement revalidates bothprojections. The on-demand local-day agenda shares occurrence queries and handles DSTboundaries and exclusive all-day ends without mounting a calendar grid.++## Independent send outbox++All composer sends use a device email journal for Gmail and Outlook,+independent of GraphQL normalized-cache availability and read transport.+`send-queue.ts` freezes approval and reserves the draft in IndexedDB before+returning local acceptance. `outbox-session.ts` runs dispatch and recovery from+the authenticated app shell; mounted composers only observe them.+The general GraphQL queue owns draft autosaves and other ordinary mutations only;+it has no send catalog or Send/Cancel replacement protocol. The former cache-queue+send format was used only in local development and tests, so there is no deployed+format to migrate. Unsupported journal records retain their contents and+recognizable draft reservations for recovery.++`email-send-dispatcher.ts` submits immediately online through the fetch-only+GraphQL client in `service-storage/email-send.ts`. Per-attempt database leases+coordinate tabs, with bounded concurrency across unrelated messages. A lost+response triggers a status read before resubmitting the identical attempt.+Cancellation requested before any submission claim stays local; after a claim it+requires authoritative server cancellation. The exception is a definitive inbox-access+rejection of the first exclusive submission: the journal records local cancellation+and permits restoration. Timeouts, mixed/nested errors, and later status rejections+never provide that proof. Retry backoff and authentication+pauses do not discard approval. `email-send-restoration.ts` restores content,+fences the prior local lifetime, and retires send authority atomically. Newer+local edits and file bytes survive restoration. Sign-out retains approved sends+under their original account and stops dispatch; ordinary drafts retain their+existing sign-out policy.++The server accepts the frozen message, attachment set, send attempt, and delivery+job in one Postgres transaction. The existing recovery scanner and Gmail/Outlook+provider reconciliation continue delivery after browser closure. Attempt IDs+provide idempotent admission, not a promise of exactly-once provider delivery:+unknown provider outcomes remain locked and reconcile before any resend.+Unrecognized GraphQL scheduled-delivery states map to `unconfirmed`, preserving+the thread and its delivery lock when the server is newer than the client.+Gmail submission checkpoints and Outlook coordinator revisions retain their+provider-specific submission boundaries.++Hard deletion of a message owned by a nonterminal send is deferred in+`email_deferred_message_deletions` before any content compaction or attachment/job+cascade. The retained provider ID and draft generation scope the deletion to that+message lifetime. The recovery scanner also wakes terminal deferred deletions,+even without a schedule. Workers discard markers superseded by Undo or a changed+provider identity; matching terminal deletions use normal thread/CRM cleanup.+Failed and unconfirmed attempts remain protected until cancellation or confirmed+delivery. Explicit inbox removal revokes authority: links marked `deleting_at`+permit batched purge, and direct inbox deletion permits its normal cascade.++`email_messages.draft_generation` advances at acceptance and confirmed+cancellation. Save, delete, schedule, transfer, and attachment edits compare the+captured generation under the message lock. Stale autosaves return `DRAFT_VERSION_CONFLICT` and preserve local edits for recovery; they are not classified as an already-sent message. The attempt retains draft handles+and source inbox namespaces after provider deletion, preventing old queued saves+from recreating the submitted draft. Versioned approval fingerprints include the+generation, frozen signature and Send Later deadline. An explicit new Send after+Undo uses the returned generation and a fresh attempt ID. Draft reads prefer that+newer working-copy generation over stale accepted cache records; an equal or newer+server delivery generation still wins. REST parsed-message reads expose the same+generation alongside message content; SDK draft actions carry that version, and+attachment handles retain the generation captured at reservation.++The status panel combines device intents with actor/inbox-authorized, cursor-paged+`pendingEmailSends`, with batched message hydration. Server listing grants observation and cancellation authority,+never automatic resubmission. Delivery state distinguishes local queueing,+server acceptance, provider processing, sent, failed, and unconfirmed outcomes.++Deploy schema/migrations and all generation-aware backend writers before+releasing this frontend, including before applying `ios-update`: that workflow+embeds the PR's frontend with production endpoints and releases automatically+after Apple approval. See the [iOS release flow](../../apps/web/docs/ios-releases.md).+The outbox is unconditional; there is no feature flag or+legacy send fallback. Old deployed writers do not enforce the new generation+precondition. Verify cache failure, offline/reload, lost HTTP response, concurrent+tabs, sign-out, Undo, stale writes, Send Later,+completed attachments, both providers, and server sends from other devices before+release. The separate cache-bootstrap recovery hotfix remains useful+for draft synchronization and does not determine send availability.++The approved iOS 2.0.11 build 190 is held for manual release with the production+deployment. Its source is `04063d2bb35d7369eae93900c2692f3ecccf882b`.+The subsequent main merge through `93900478fb` preserves its native/web and+email interfaces. Build 190 keeps its compiled format-3 native cache; the new+format-4 compression in cache version 0.6.52 belongs to the cache engine, and+only JSON crosses the native/web boundary. Browser OPFS storage is separate.+New native diagnostics are optional, and the agent runtime/Chromium additions+are desktop-only. The `skip-ios-update` exception records this compatibility+review, not identical build provenance.+Keep the iOS floor at 185. Deploy the migrations and generation-aware backend+writers before the frontend, then release the approved App Store version as+part of that production rollout. Do not release it early: its embedded frontend+also requires those backend changes. Recheck compatibility if further native+requirements are introduced before deployment.++The format-4 browser cache starts a separate physical database. Old nonempty+general mutation queues are retained but are not imported into it; verify their+recovery separately during the cache rollout. The email journal is independent+of these cache files and retains its draft working copies and send attempts.diff --git a/infra/stacks/fusionauth-instance/README.md b/infra/stacks/fusionauth-instance/README.mdindex 3295ed9089..b4d23e3df0 100644--- a/infra/stacks/fusionauth-instance/README.md+++ b/infra/stacks/fusionauth-instance/README.md@@ -4,6 +4,10 @@ This pulumi stack contains everything you need to be able to setup a "macro compSupports easy setup for local development.+The local FusionAuth container runs with `init: true` to reap orphaned health-check+processes. Recreate existing FusionAuth containers to apply this setting; restarting+them does not update their configuration. Keep their database and config volumes.+# PrerequisitesThe following are required tools you need to have setup ahead of time:diff --git a/infra/stacks/fusionauth-instance/docker-compose.yml b/infra/stacks/fusionauth-instance/docker-compose.ymlindex 6aa70f1589..614c9741bb 100644--- a/infra/stacks/fusionauth-instance/docker-compose.yml+++ b/infra/stacks/fusionauth-instance/docker-compose.yml@@ -25,6 +25,7 @@ services:fusionauth:image: fusionauth/fusionauth-app:1.62.1+ init: trueenv_file:- path: .envrequired: falsediff --git a/packages/code-mode-sdk/AGENTS.md b/packages/code-mode-sdk/AGENTS.mdindex 3e1976e33d..eca6e3f265 100644--- a/packages/code-mode-sdk/AGENTS.md+++ b/packages/code-mode-sdk/AGENTS.md@@ -26,3 +26,5 @@ HTML worker belong to `packages/sdk-docs`.Run from this directory after installing the root workspace and the standalone`packages/sdk` dependencies. Generated Rust documentation JSON and Deno bundlesmust match the public SDK; edit source and regenerate them together.+Use the repository's pinned Bun version (via `nix develop`); different Bun+bundlers produce different checked-in output even from identical SDK source.diff --git a/packages/sdk-docs/reference/generated/email/types.gen/README.md b/packages/sdk-docs/reference/generated/email/types.gen/README.mdindex 785901f1a7..18d4dacd59 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/README.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/README.md@@ -324,6 +324,7 @@- [ResyncLinkResponse](type-aliases/ResyncLinkResponse.md)- [ResyncLinkResponses](type-aliases/ResyncLinkResponses.md)- [ResyncResponse](type-aliases/ResyncResponse.md)+- [ScheduledSendStatus](type-aliases/ScheduledSendStatus.md)- [SendMessageData](type-aliases/SendMessageData.md)- [SendMessageError](type-aliases/SendMessageError.md)- [SendMessageErrors](type-aliases/SendMessageErrors.md)diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/AddDraftAttachmentData.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/AddDraftAttachmentData.mdindex bdbca7d120..e8cb65a319 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/AddDraftAttachmentData.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/AddDraftAttachmentData.md@@ -1,6 +1,6 @@# Type Alias: AddDraftAttachmentData-> **AddDraftAttachmentData** = \{ `body`: [`AddDraftAttachmentRequest`](AddDraftAttachmentRequest.md); `path`: \{ `id`: `string`; \}; `query?`: `never`; `url`: `"/email/drafts/{id}/attachments"`; \}+> **AddDraftAttachmentData** = \{ `body`: [`AddDraftAttachmentRequest`](AddDraftAttachmentRequest.md); `path`: \{ `id`: `string`; \}; `query?`: \{ `draft_generation?`: `number`; \}; `url`: `"/email/drafts/{id}/attachments"`; \}## Properties@@ -9,5 +9,6 @@| <a id="property-body"></a> `body` | [`AddDraftAttachmentRequest`](AddDraftAttachmentRequest.md) | - || <a id="property-path"></a> `path` | \{ `id`: `string`; \} | - || `path.id` | `string` | The ID of the draft to add the attachment to. |-| <a id="property-query"></a> `query?` | `never` | - |+| <a id="property-query"></a> `query?` | \{ `draft_generation?`: `number`; \} | - |+| `query.draft_generation?` | `number` | Generation from the last loaded draft. Legacy clients use zero. || <a id="property-url"></a> `url` | `"/email/drafts/{id}/attachments"` | - |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/AddForwardedAttachmentData.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/AddForwardedAttachmentData.mdindex eed9897379..9a2e75939f 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/AddForwardedAttachmentData.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/AddForwardedAttachmentData.md@@ -1,6 +1,6 @@# Type Alias: AddForwardedAttachmentData-> **AddForwardedAttachmentData** = \{ `body`: [`AddForwardedAttachmentRequest`](AddForwardedAttachmentRequest.md); `path`: \{ `id`: `string`; \}; `query?`: `never`; `url`: `"/email/drafts/{id}/forwarded-attachments"`; \}+> **AddForwardedAttachmentData** = \{ `body`: [`AddForwardedAttachmentRequest`](AddForwardedAttachmentRequest.md); `path`: \{ `id`: `string`; \}; `query?`: \{ `draft_generation?`: `number`; \}; `url`: `"/email/drafts/{id}/forwarded-attachments"`; \}## Properties@@ -9,5 +9,6 @@| <a id="property-body"></a> `body` | [`AddForwardedAttachmentRequest`](AddForwardedAttachmentRequest.md) | - || <a id="property-path"></a> `path` | \{ `id`: `string`; \} | - || `path.id` | `string` | The ID of the draft to add the forwarded attachment to. |-| <a id="property-query"></a> `query?` | `never` | - |+| <a id="property-query"></a> `query?` | \{ `draft_generation?`: `number`; \} | - |+| `query.draft_generation?` | `number` | Generation from the last loaded draft. Legacy clients use zero. || <a id="property-url"></a> `url` | `"/email/drafts/{id}/forwarded-attachments"` | - |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiDraftInput.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiDraftInput.mdindex 2b4f6b7c44..93afe88c74 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiDraftInput.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiDraftInput.md@@ -1,6 +1,6 @@# Type Alias: ApiDraftInput-> **ApiDraftInput** = \{ `bcc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; `body_html?`: `string` \| `null`; `body_macro?`: `string` \| `null`; `body_text?`: `string` \| `null`; `cc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; `db_id?`: `string` \| `null`; `headers_json?`: `null` \| [`Value`](Value.md); `include_signature?`: `boolean` \| `null`; `provider_id?`: `string` \| `null`; `provider_thread_id?`: `string` \| `null`; `replying_to_id?`: `string` \| `null`; `subject`: `string`; `thread_db_id?`: `string` \| `null`; `to?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; \}+> **ApiDraftInput** = \{ `bcc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; `body_html?`: `string` \| `null`; `body_macro?`: `string` \| `null`; `body_text?`: `string` \| `null`; `cc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; `db_id?`: `string` \| `null`; `draft_generation?`: `number`; `headers_json?`: `null` \| [`Value`](Value.md); `include_signature?`: `boolean` \| `null`; `provider_id?`: `string` \| `null`; `provider_thread_id?`: `string` \| `null`; `replying_to_id?`: `string` \| `null`; `subject`: `string`; `thread_db_id?`: `string` \| `null`; `to?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; \}The draft input matching the current `MessageToSend` JSON shape for backward compat.@@ -14,6 +14,7 @@ The draft input matching the current `MessageToSend` JSON shape for backward com| <a id="property-body_text"></a> `body_text?` | `string` \| `null` | Plain text body. || <a id="property-cc"></a> `cc?` | [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null` | Cc recipients. || <a id="property-db_id"></a> `db_id?` | `string` \| `null` | Existing message DB ID (for updating an existing draft). |+| <a id="property-draft_generation"></a> `draft_generation?` | `number` | Generation from the last loaded draft; legacy clients begin at zero. || <a id="property-headers_json"></a> `headers_json?` | `null` \| [`Value`](Value.md) | - || <a id="property-include_signature"></a> `include_signature?` | `boolean` \| `null` | Per-message override for whether to include the signature on send: `Some(false)` to exclude (user dismissed it). Omit to use the inbox's default policy. Ignored for drafts. || <a id="property-provider_id"></a> `provider_id?` | `string` \| `null` | Provider message ID. |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiDraftOutput.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiDraftOutput.mdindex 494f6cc5e4..676208c28a 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiDraftOutput.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiDraftOutput.md@@ -1,6 +1,6 @@# Type Alias: ApiDraftOutput-> **ApiDraftOutput** = \{ `bcc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; `body_html?`: `string` \| `null`; `body_macro?`: `string` \| `null`; `body_text?`: `string` \| `null`; `cc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; `db_id?`: `string` \| `null`; `headers_json?`: `null` \| [`Value`](Value.md); `link_id`: `string`; `provider_id?`: `string` \| `null`; `provider_thread_id?`: `string` \| `null`; `replying_to_id?`: `string` \| `null`; `send_time?`: `string` \| `null`; `subject`: `string`; `thread_db_id?`: `string` \| `null`; `to?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; \}+> **ApiDraftOutput** = \{ `bcc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; `body_html?`: `string` \| `null`; `body_macro?`: `string` \| `null`; `body_text?`: `string` \| `null`; `cc?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; `db_id?`: `string` \| `null`; `draft_generation`: `number`; `headers_json?`: `null` \| [`Value`](Value.md); `link_id`: `string`; `provider_id?`: `string` \| `null`; `provider_thread_id?`: `string` \| `null`; `replying_to_id?`: `string` \| `null`; `send_time?`: `string` \| `null`; `subject`: `string`; `thread_db_id?`: `string` \| `null`; `to?`: [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null`; \}The draft output matching the current `MessageToSend` JSON shape for backward compat.@@ -14,6 +14,7 @@ The draft output matching the current `MessageToSend` JSON shape for backward co| <a id="property-body_text"></a> `body_text?` | `string` \| `null` | Plain text body. || <a id="property-cc"></a> `cc?` | [`ApiDraftContactInfo`](ApiDraftContactInfo.md)[] \| `null` | Cc recipients. || <a id="property-db_id"></a> `db_id?` | `string` \| `null` | Message DB ID. |+| <a id="property-draft_generation"></a> `draft_generation` | `number` | Generation required for subsequent edits. || <a id="property-headers_json"></a> `headers_json?` | `null` \| [`Value`](Value.md) | - || <a id="property-link_id"></a> `link_id` | `string` | Link ID. || <a id="property-provider_id"></a> `provider_id?` | `string` \| `null` | Provider message ID. |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiMessage.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiMessage.mdindex c3f6c7866e..1bdacd6690 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiMessage.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ApiMessage.md@@ -1,46 +1,48 @@# Type Alias: ApiMessage-> **ApiMessage** = \{ `attachments`: [`ApiMessageAttachment`](ApiMessageAttachment.md)[]; `attachments_draft`: [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[]; `attachments_forwarded`: [`ApiAttachmentForwarded`](ApiAttachmentForwarded.md)[]; `bcc`: [`ApiContactInfo`](ApiContactInfo.md)[]; `body_html_sanitized?`: `string` \| `null`; `body_macro?`: `string` \| `null`; `body_replyless?`: `string` \| `null`; `body_text?`: `string` \| `null`; `calendar_invitations?`: [`CalendarInvitation`](CalendarInvitation.md)[]; `cc`: [`ApiContactInfo`](ApiContactInfo.md)[]; `created_at`: `string`; `db_id`: `string`; `from?`: `null` \| [`ApiContactInfo`](ApiContactInfo.md); `global_id?`: `string` \| `null`; `has_attachments`: `boolean`; `headers_json?`: `unknown`; `internal_date_ts?`: `string` \| `null`; `is_draft`: `boolean`; `is_read`: `boolean`; `is_sent`: `boolean`; `is_starred`: `boolean`; `labels`: [`ApiMessageLabel`](ApiMessageLabel.md)[]; `link_id`: `string`; `operation_status?`: `null` \| [`ApiMessageOperation`](ApiMessageOperation.md); `provider_history_id?`: `string` \| `null`; `provider_id?`: `string` \| `null`; `provider_thread_id?`: `string` \| `null`; `replying_to_id?`: `string` \| `null`; `scheduled_send_time?`: `string` \| `null`; `sent_at?`: `string` \| `null`; `size_estimate?`: `number` \| `null`; `snippet?`: `string` \| `null`; `subject?`: `string` \| `null`; `thread_db_id`: `string`; `to`: [`ApiContactInfo`](ApiContactInfo.md)[]; `updated_at`: `string`; \}+> **ApiMessage** = \{ `attachments`: [`ApiMessageAttachment`](ApiMessageAttachment.md)[]; `attachments_draft`: [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[]; `attachments_forwarded`: [`ApiAttachmentForwarded`](ApiAttachmentForwarded.md)[]; `bcc`: [`ApiContactInfo`](ApiContactInfo.md)[]; `body_html_sanitized?`: `string` \| `null`; `body_macro?`: `string` \| `null`; `body_replyless?`: `string` \| `null`; `body_text?`: `string` \| `null`; `calendar_invitations?`: [`CalendarInvitation`](CalendarInvitation.md)[]; `cc`: [`ApiContactInfo`](ApiContactInfo.md)[]; `created_at`: `string`; `db_id`: `string`; `draft_generation`: `number`; `from?`: `null` \| [`ApiContactInfo`](ApiContactInfo.md); `global_id?`: `string` \| `null`; `has_attachments`: `boolean`; `headers_json?`: `unknown`; `internal_date_ts?`: `string` \| `null`; `is_draft`: `boolean`; `is_read`: `boolean`; `is_sent`: `boolean`; `is_starred`: `boolean`; `labels`: [`ApiMessageLabel`](ApiMessageLabel.md)[]; `link_id`: `string`; `operation_status?`: `null` \| [`ApiMessageOperation`](ApiMessageOperation.md); `provider_history_id?`: `string` \| `null`; `provider_id?`: `string` \| `null`; `provider_thread_id?`: `string` \| `null`; `replying_to_id?`: `string` \| `null`; `scheduled_send_status?`: `null` \| [`ScheduledSendStatus`](ScheduledSendStatus.md); `scheduled_send_time?`: `string` \| `null`; `sent_at?`: `string` \| `null`; `size_estimate?`: `number` \| `null`; `snippet?`: `string` \| `null`; `subject?`: `string` \| `null`; `thread_db_id`: `string`; `to`: [`ApiContactInfo`](ApiContactInfo.md)[]; `updated_at`: `string`; \}API representation of a fully assembled email message.## Properties-| Property | Type |-| ------ | ------ |-| <a id="property-attachments"></a> `attachments` | [`ApiMessageAttachment`](ApiMessageAttachment.md)[] |-| <a id="property-attachments_draft"></a> `attachments_draft` | [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[] |-| <a id="property-attachments_forwarded"></a> `attachments_forwarded` | [`ApiAttachmentForwarded`](ApiAttachmentForwarded.md)[] |-| <a id="property-bcc"></a> `bcc` | [`ApiContactInfo`](ApiContactInfo.md)[] |-| <a id="property-body_html_sanitized"></a> `body_html_sanitized?` | `string` \| `null` |-| <a id="property-body_macro"></a> `body_macro?` | `string` \| `null` |-| <a id="property-body_replyless"></a> `body_replyless?` | `string` \| `null` |-| <a id="property-body_text"></a> `body_text?` | `string` \| `null` |-| <a id="property-calendar_invitations"></a> `calendar_invitations?` | [`CalendarInvitation`](CalendarInvitation.md)[] |-| <a id="property-cc"></a> `cc` | [`ApiContactInfo`](ApiContactInfo.md)[] |-| <a id="property-created_at"></a> `created_at` | `string` |-| <a id="property-db_id"></a> `db_id` | `string` |-| <a id="property-from"></a> `from?` | `null` \| [`ApiContactInfo`](ApiContactInfo.md) |-| <a id="property-global_id"></a> `global_id?` | `string` \| `null` |-| <a id="property-has_attachments"></a> `has_attachments` | `boolean` |-| <a id="property-headers_json"></a> `headers_json?` | `unknown` |-| <a id="property-internal_date_ts"></a> `internal_date_ts?` | `string` \| `null` |-| <a id="property-is_draft"></a> `is_draft` | `boolean` |-| <a id="property-is_read"></a> `is_read` | `boolean` |-| <a id="property-is_sent"></a> `is_sent` | `boolean` |-| <a id="property-is_starred"></a> `is_starred` | `boolean` |-| <a id="property-labels"></a> `labels` | [`ApiMessageLabel`](ApiMessageLabel.md)[] |-| <a id="property-link_id"></a> `link_id` | `string` |-| <a id="property-operation_status"></a> `operation_status?` | `null` \| [`ApiMessageOperation`](ApiMessageOperation.md) |-| <a id="property-provider_history_id"></a> `provider_history_id?` | `string` \| `null` |-| <a id="property-provider_id"></a> `provider_id?` | `string` \| `null` |-| <a id="property-provider_thread_id"></a> `provider_thread_id?` | `string` \| `null` |-| <a id="property-replying_to_id"></a> `replying_to_id?` | `string` \| `null` |-| <a id="property-scheduled_send_time"></a> `scheduled_send_time?` | `string` \| `null` |-| <a id="property-sent_at"></a> `sent_at?` | `string` \| `null` |-| <a id="property-size_estimate"></a> `size_estimate?` | `number` \| `null` |-| <a id="property-snippet"></a> `snippet?` | `string` \| `null` |-| <a id="property-subject"></a> `subject?` | `string` \| `null` |-| <a id="property-thread_db_id"></a> `thread_db_id` | `string` |-| <a id="property-to"></a> `to` | [`ApiContactInfo`](ApiContactInfo.md)[] |-| <a id="property-updated_at"></a> `updated_at` | `string` |+| Property | Type | Description |+| ------ | ------ | ------ |+| <a id="property-attachments"></a> `attachments` | [`ApiMessageAttachment`](ApiMessageAttachment.md)[] | - |+| <a id="property-attachments_draft"></a> `attachments_draft` | [`ApiAttachmentDraft`](ApiAttachmentDraft.md)[] | - |+| <a id="property-attachments_forwarded"></a> `attachments_forwarded` | [`ApiAttachmentForwarded`](ApiAttachmentForwarded.md)[] | - |+| <a id="property-bcc"></a> `bcc` | [`ApiContactInfo`](ApiContactInfo.md)[] | - |+| <a id="property-body_html_sanitized"></a> `body_html_sanitized?` | `string` \| `null` | - |+| <a id="property-body_macro"></a> `body_macro?` | `string` \| `null` | - |+| <a id="property-body_replyless"></a> `body_replyless?` | `string` \| `null` | - |+| <a id="property-body_text"></a> `body_text?` | `string` \| `null` | - |+| <a id="property-calendar_invitations"></a> `calendar_invitations?` | [`CalendarInvitation`](CalendarInvitation.md)[] | - |+| <a id="property-cc"></a> `cc` | [`ApiContactInfo`](ApiContactInfo.md)[] | - |+| <a id="property-created_at"></a> `created_at` | `string` | - |+| <a id="property-db_id"></a> `db_id` | `string` | - |+| <a id="property-draft_generation"></a> `draft_generation` | `number` | Draft edit generation; changes at send and cancellation boundaries. |+| <a id="property-from"></a> `from?` | `null` \| [`ApiContactInfo`](ApiContactInfo.md) | - |+| <a id="property-global_id"></a> `global_id?` | `string` \| `null` | - |+| <a id="property-has_attachments"></a> `has_attachments` | `boolean` | - |+| <a id="property-headers_json"></a> `headers_json?` | `unknown` | - |+| <a id="property-internal_date_ts"></a> `internal_date_ts?` | `string` \| `null` | - |+| <a id="property-is_draft"></a> `is_draft` | `boolean` | - |+| <a id="property-is_read"></a> `is_read` | `boolean` | - |+| <a id="property-is_sent"></a> `is_sent` | `boolean` | - |+| <a id="property-is_starred"></a> `is_starred` | `boolean` | - |+| <a id="property-labels"></a> `labels` | [`ApiMessageLabel`](ApiMessageLabel.md)[] | - |+| <a id="property-link_id"></a> `link_id` | `string` | - |+| <a id="property-operation_status"></a> `operation_status?` | `null` \| [`ApiMessageOperation`](ApiMessageOperation.md) | - |+| <a id="property-provider_history_id"></a> `provider_history_id?` | `string` \| `null` | - |+| <a id="property-provider_id"></a> `provider_id?` | `string` \| `null` | - |+| <a id="property-provider_thread_id"></a> `provider_thread_id?` | `string` \| `null` | - |+| <a id="property-replying_to_id"></a> `replying_to_id?` | `string` \| `null` | - |+| <a id="property-scheduled_send_status"></a> `scheduled_send_status?` | `null` \| [`ScheduledSendStatus`](ScheduledSendStatus.md) | - |+| <a id="property-scheduled_send_time"></a> `scheduled_send_time?` | `string` \| `null` | - |+| <a id="property-sent_at"></a> `sent_at?` | `string` \| `null` | - |+| <a id="property-size_estimate"></a> `size_estimate?` | `number` \| `null` | - |+| <a id="property-snippet"></a> `snippet?` | `string` \| `null` | - |+| <a id="property-subject"></a> `subject?` | `string` \| `null` | - |+| <a id="property-thread_db_id"></a> `thread_db_id` | `string` | - |+| <a id="property-to"></a> `to` | [`ApiContactInfo`](ApiContactInfo.md)[] | - |+| <a id="property-updated_at"></a> `updated_at` | `string` | - |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/CompleteDraftAttachmentData.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/CompleteDraftAttachmentData.mdindex 3fd09909e8..f27f5c0908 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/CompleteDraftAttachmentData.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/CompleteDraftAttachmentData.md@@ -1,14 +1,15 @@# Type Alias: CompleteDraftAttachmentData-> **CompleteDraftAttachmentData** = \{ `body?`: `never`; `path`: \{ `attachment_id`: `string`; `id`: `string`; \}; `query?`: `never`; `url`: `"/email/drafts/{id}/attachments/{attachment_id}/complete"`; \}+> **CompleteDraftAttachmentData** = \{ `body?`: `never`; `path`: \{ `attachment_id`: `string`; `id`: `string`; \}; `query?`: \{ `draft_generation?`: `number`; \}; `url`: `"/email/drafts/{id}/attachments/{attachment_id}/complete"`; \}## Properties-| Property | Type |-| ------ | ------ |-| <a id="property-body"></a> `body?` | `never` |-| <a id="property-path"></a> `path` | \{ `attachment_id`: `string`; `id`: `string`; \} |-| `path.attachment_id` | `string` |-| `path.id` | `string` |-| <a id="property-query"></a> `query?` | `never` |-| <a id="property-url"></a> `url` | `"/email/drafts/{id}/attachments/{attachment_id}/complete"` |+| Property | Type | Description |+| ------ | ------ | ------ |+| <a id="property-body"></a> `body?` | `never` | - |+| <a id="property-path"></a> `path` | \{ `attachment_id`: `string`; `id`: `string`; \} | - |+| `path.attachment_id` | `string` | - |+| `path.id` | `string` | - |+| <a id="property-query"></a> `query?` | \{ `draft_generation?`: `number`; \} | - |+| `query.draft_generation?` | `number` | Generation from the last loaded draft. Legacy clients use zero. |+| <a id="property-url"></a> `url` | `"/email/drafts/{id}/attachments/{attachment_id}/complete"` | - |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/DeleteDraftData.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/DeleteDraftData.mdindex 15c75555ac..59ae08201d 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/DeleteDraftData.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/DeleteDraftData.md@@ -1,6 +1,6 @@# Type Alias: DeleteDraftData-> **DeleteDraftData** = \{ `body?`: `never`; `path`: \{ `id`: `string`; \}; `query?`: `never`; `url`: `"/email/drafts/{id}"`; \}+> **DeleteDraftData** = \{ `body?`: `never`; `path`: \{ `id`: `string`; \}; `query?`: \{ `draft_generation?`: `number`; \}; `url`: `"/email/drafts/{id}"`; \}## Properties@@ -9,5 +9,6 @@| <a id="property-body"></a> `body?` | `never` | - || <a id="property-path"></a> `path` | \{ `id`: `string`; \} | - || `path.id` | `string` | Draft ID. |-| <a id="property-query"></a> `query?` | `never` | - |+| <a id="property-query"></a> `query?` | \{ `draft_generation?`: `number`; \} | - |+| `query.draft_generation?` | `number` | Generation from the last loaded draft. Legacy clients use zero. || <a id="property-url"></a> `url` | `"/email/drafts/{id}"` | - |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/DeleteScheduledDraftData.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/DeleteScheduledDraftData.mdindex 4a63be4aaa..ac6c45fe52 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/DeleteScheduledDraftData.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/DeleteScheduledDraftData.md@@ -1,6 +1,6 @@# Type Alias: DeleteScheduledDraftData-> **DeleteScheduledDraftData** = \{ `body?`: `never`; `path`: \{ `message_id`: `string`; \}; `query?`: `never`; `url`: `"/email/drafts/scheduled/{message_id}"`; \}+> **DeleteScheduledDraftData** = \{ `body?`: `never`; `path`: \{ `message_id`: `string`; \}; `query?`: \{ `draft_generation?`: `number`; \}; `url`: `"/email/drafts/scheduled/{message_id}"`; \}## Properties@@ -9,5 +9,6 @@| <a id="property-body"></a> `body?` | `never` | - || <a id="property-path"></a> `path` | \{ `message_id`: `string`; \} | - || `path.message_id` | `string` | The ID of the draft |-| <a id="property-query"></a> `query?` | `never` | - |+| <a id="property-query"></a> `query?` | \{ `draft_generation?`: `number`; \} | - |+| `query.draft_generation?` | `number` | Generation from the last loaded draft. Legacy clients use zero. || <a id="property-url"></a> `url` | `"/email/drafts/scheduled/{message_id}"` | - |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ParsedMessage.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ParsedMessage.mdindex 7a24b39a32..9fa64dbe71 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ParsedMessage.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ParsedMessage.md@@ -1,19 +1,20 @@# Type Alias: ParsedMessage-> **ParsedMessage** = \{ `bcc`: [`ContactInfo`](ContactInfo.md)[]; `body_parsed?`: `string` \| `null`; `cc`: [`ContactInfo`](ContactInfo.md)[]; `db_id`: `string`; `from?`: `null` \| [`ContactInfo`](ContactInfo.md); `internal_date_ts?`: `string` \| `null`; `labels`: [`LabelInfo`](LabelInfo.md)[]; `link_id`: `string`; `subject?`: `string` \| `null`; `thread_db_id`: `string`; `to`: [`ContactInfo`](ContactInfo.md)[]; \}+> **ParsedMessage** = \{ `bcc`: [`ContactInfo`](ContactInfo.md)[]; `body_parsed?`: `string` \| `null`; `cc`: [`ContactInfo`](ContactInfo.md)[]; `db_id`: `string`; `draft_generation?`: `number`; `from?`: `null` \| [`ContactInfo`](ContactInfo.md); `internal_date_ts?`: `string` \| `null`; `labels`: [`LabelInfo`](LabelInfo.md)[]; `link_id`: `string`; `subject?`: `string` \| `null`; `thread_db_id`: `string`; `to`: [`ContactInfo`](ContactInfo.md)[]; \}## Properties-| Property | Type |-| ------ | ------ |-| <a id="property-bcc"></a> `bcc` | [`ContactInfo`](ContactInfo.md)[] |-| <a id="property-body_parsed"></a> `body_parsed?` | `string` \| `null` |-| <a id="property-cc"></a> `cc` | [`ContactInfo`](ContactInfo.md)[] |-| <a id="property-db_id"></a> `db_id` | `string` |-| <a id="property-from"></a> `from?` | `null` \| [`ContactInfo`](ContactInfo.md) |-| <a id="property-internal_date_ts"></a> `internal_date_ts?` | `string` \| `null` |-| <a id="property-labels"></a> `labels` | [`LabelInfo`](LabelInfo.md)[] |-| <a id="property-link_id"></a> `link_id` | `string` |-| <a id="property-subject"></a> `subject?` | `string` \| `null` |-| <a id="property-thread_db_id"></a> `thread_db_id` | `string` |-| <a id="property-to"></a> `to` | [`ContactInfo`](ContactInfo.md)[] |+| Property | Type | Description |+| ------ | ------ | ------ |+| <a id="property-bcc"></a> `bcc` | [`ContactInfo`](ContactInfo.md)[] | - |+| <a id="property-body_parsed"></a> `body_parsed?` | `string` \| `null` | - |+| <a id="property-cc"></a> `cc` | [`ContactInfo`](ContactInfo.md)[] | - |+| <a id="property-db_id"></a> `db_id` | `string` | - |+| <a id="property-draft_generation"></a> `draft_generation?` | `number` | Draft edit generation captured with this message snapshot. |+| <a id="property-from"></a> `from?` | `null` \| [`ContactInfo`](ContactInfo.md) | - |+| <a id="property-internal_date_ts"></a> `internal_date_ts?` | `string` \| `null` | - |+| <a id="property-labels"></a> `labels` | [`LabelInfo`](LabelInfo.md)[] | - |+| <a id="property-link_id"></a> `link_id` | `string` | - |+| <a id="property-subject"></a> `subject?` | `string` \| `null` | - |+| <a id="property-thread_db_id"></a> `thread_db_id` | `string` | - |+| <a id="property-to"></a> `to` | [`ContactInfo`](ContactInfo.md)[] | - |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/RemoveDraftAttachmentData.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/RemoveDraftAttachmentData.mdindex 45235ead81..5f64fb9279 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/RemoveDraftAttachmentData.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/RemoveDraftAttachmentData.md@@ -1,6 +1,6 @@# Type Alias: RemoveDraftAttachmentData-> **RemoveDraftAttachmentData** = \{ `body?`: `never`; `path`: \{ `attachment_id`: `string`; `id`: `string`; \}; `query?`: `never`; `url`: `"/email/drafts/{id}/attachments/{attachment_id}"`; \}+> **RemoveDraftAttachmentData** = \{ `body?`: `never`; `path`: \{ `attachment_id`: `string`; `id`: `string`; \}; `query?`: \{ `draft_generation?`: `number`; \}; `url`: `"/email/drafts/{id}/attachments/{attachment_id}"`; \}## Properties@@ -10,5 +10,6 @@| <a id="property-path"></a> `path` | \{ `attachment_id`: `string`; `id`: `string`; \} | - || `path.attachment_id` | `string` | The ID of the attachment to remove. || `path.id` | `string` | The ID of the draft to remove the attachment from. |-| <a id="property-query"></a> `query?` | `never` | - |+| <a id="property-query"></a> `query?` | \{ `draft_generation?`: `number`; \} | - |+| `query.draft_generation?` | `number` | Generation from the last loaded draft. Legacy clients use zero. || <a id="property-url"></a> `url` | `"/email/drafts/{id}/attachments/{attachment_id}"` | - |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/RemoveForwardedAttachmentData.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/RemoveForwardedAttachmentData.mdindex c686c88309..a8834aa59d 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/RemoveForwardedAttachmentData.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/RemoveForwardedAttachmentData.md@@ -1,6 +1,6 @@# Type Alias: RemoveForwardedAttachmentData-> **RemoveForwardedAttachmentData** = \{ `body?`: `never`; `path`: \{ `attachment_id`: `string`; `id`: `string`; \}; `query?`: `never`; `url`: `"/email/drafts/{id}/forwarded-attachments/{attachment_id}"`; \}+> **RemoveForwardedAttachmentData** = \{ `body?`: `never`; `path`: \{ `attachment_id`: `string`; `id`: `string`; \}; `query?`: \{ `draft_generation?`: `number`; \}; `url`: `"/email/drafts/{id}/forwarded-attachments/{attachment_id}"`; \}## Properties@@ -10,5 +10,6 @@| <a id="property-path"></a> `path` | \{ `attachment_id`: `string`; `id`: `string`; \} | - || `path.attachment_id` | `string` | The ID of the forwarded attachment to remove. || `path.id` | `string` | The ID of the draft to remove the forwarded attachment from. |-| <a id="property-query"></a> `query?` | `never` | - |+| <a id="property-query"></a> `query?` | \{ `draft_generation?`: `number`; \} | - |+| `query.draft_generation?` | `number` | Generation from the last loaded draft. Legacy clients use zero. || <a id="property-url"></a> `url` | `"/email/drafts/{id}/forwarded-attachments/{attachment_id}"` | - |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ScheduledSendStatus.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ScheduledSendStatus.mdnew file mode 100644index 0000000000..ff6386d59d--- /dev/null+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/ScheduledSendStatus.md@@ -0,0 +1,5 @@+# Type Alias: ScheduledSendStatus++> **ScheduledSendStatus** = `"pending"` \| `"sending"` \| `"failed"` \| `"unconfirmed"`++The user-visible delivery state of an unsent scheduled message.diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/TransferDraftRequest.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/TransferDraftRequest.mdindex 00a828a704..07d626c44f 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/TransferDraftRequest.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/TransferDraftRequest.md@@ -1,12 +1,13 @@# Type Alias: TransferDraftRequest-> **TransferDraftRequest** = \{ `destination_link_id`: `string`; `operation_id`: `string`; \}+> **TransferDraftRequest** = \{ `destination_link_id`: `string`; `draft_generation?`: `number`; `operation_id`: `string`; \}Reuse the same operation ID when retrying after a lost response.## Properties-| Property | Type |-| ------ | ------ |-| <a id="property-destination_link_id"></a> `destination_link_id` | `string` |-| <a id="property-operation_id"></a> `operation_id` | `string` |+| Property | Type | Description |+| ------ | ------ | ------ |+| <a id="property-destination_link_id"></a> `destination_link_id` | `string` | - |+| <a id="property-draft_generation"></a> `draft_generation?` | `number` | Generation captured with the source draft. |+| <a id="property-operation_id"></a> `operation_id` | `string` | - |diff --git a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/UpsertScheduledMessageData.md b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/UpsertScheduledMessageData.mdindex aef9e6d722..d978014eb1 100644--- a/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/UpsertScheduledMessageData.md+++ b/packages/sdk-docs/reference/generated/email/types.gen/type-aliases/UpsertScheduledMessageData.md@@ -1,6 +1,6 @@# Type Alias: UpsertScheduledMessageData-> **UpsertScheduledMessageData** = \{ `body`: [`UpsertScheduledRequest`](UpsertScheduledRequest.md); `path`: \{ `id`: `string`; \}; `query?`: `never`; `url`: `"/email/drafts/scheduled/{id}"`; \}+> **UpsertScheduledMessageData** = \{ `body`: [`UpsertScheduledRequest`](UpsertScheduledRequest.md); `path`: \{ `id`: `string`; \}; `query?`: \{ `draft_generation?`: `number`; \}; `url`: `"/email/drafts/scheduled/{id}"`; \}## Properties@@ -9,5 +9,6 @@| <a id="property-body"></a> `body` | [`UpsertScheduledRequest`](UpsertScheduledRequest.md) | - || <a id="property-path"></a> `path` | \{ `id`: `string`; \} | - || `path.id` | `string` | The ID of the draft message to schedule |-| <a id="property-query"></a> `query?` | `never` | - |+| <a id="property-query"></a> `query?` | \{ `draft_generation?`: `number`; \} | - |+| `query.draft_generation?` | `number` | Generation from the last loaded draft. Legacy clients use zero. || <a id="property-url"></a> `url` | `"/email/drafts/scheduled/{id}"` | - |diff --git a/packages/sdk-docs/reference/src/entities/email/draft/classes/DraftAttachment.md b/packages/sdk-docs/reference/src/entities/email/draft/classes/DraftAttachment.mdindex 523fe42568..24753a47f6 100644--- a/packages/sdk-docs/reference/src/entities/email/draft/classes/DraftAttachment.md+++ b/packages/sdk-docs/reference/src/entities/email/draft/classes/DraftAttachment.md@@ -7,6 +7,7 @@ An uploaded or forwarded attachment belonging to a draft.| Property | Modifier | Type | Description || ------ | ------ | ------ | ------ || <a id="property-draft"></a> `draft` | `readonly` | [`EmailDraft`](EmailDraft.md) | Parent draft. |+| <a id="property-draftgeneration"></a> `draftGeneration` | `readonly` | `number` | Draft generation captured when the attachment was reserved. || <a id="property-forwarded"></a> `forwarded` | `readonly` | `boolean` | Whether this attachment was forwarded. || <a id="property-id"></a> `id` | `readonly` | `string` | Attachment identity. |@@ -38,16 +39,17 @@ Remove this attachment from its draft.### toJSON()-> **toJSON**(): \{ `draftId`: `string`; `forwarded`: `boolean`; `id`: `string`; \}+> **toJSON**(): \{ `draftGeneration`: `number`; `draftId`: `string`; `forwarded`: `boolean`; `id`: `string`; \}Serialize identity without credentials.#### Returns-\{ `draftId`: `string`; `forwarded`: `boolean`; `id`: `string`; \}+\{ `draftGeneration`: `number`; `draftId`: `string`; `forwarded`: `boolean`; `id`: `string`; \}| Name | Type || ------ | ------ |+| `draftGeneration` | `number` || `draftId` | `string` || `forwarded` | `boolean` || `id` | `string` |@@ -56,7 +58,7 @@ Serialize identity without credentials.### byId()-> `static` **byId**(`_client`, `draft`, `id`, `forwarded?`): `DraftAttachment`+> `static` **byId**(`_client`, `draft`, `id`, `forwarded?`, `draftGeneration?`): `DraftAttachment`Construct a draft scoped attachment handle.@@ -68,6 +70,7 @@ Construct a draft scoped attachment handle.| `draft` | [`EmailDraft`](EmailDraft.md) | `undefined` || `id` | `string` | `undefined` || `forwarded?` | `boolean` | `false` |+| `draftGeneration?` | `number` | `0` |#### Returnsdiff --git a/packages/sdk-docs/reference/src/entities/email/draft/classes/EmailDraft.md b/packages/sdk-docs/reference/src/entities/email/draft/classes/EmailDraft.mdindex 2b1d6136b3..ced88311dd 100644--- a/packages/sdk-docs/reference/src/entities/email/draft/classes/EmailDraft.md+++ b/packages/sdk-docs/reference/src/entities/email/draft/classes/EmailDraft.md@@ -13,6 +13,7 @@ A draft email. Sending remains an explicit separate operation.| <a id="property-bcc"></a> `bcc` | `readonly` | () => `Promise`\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\> | The Bcc recipients. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`bcc`](../../message/classes/EmailMessage.md#property-bcc) || <a id="property-body"></a> `body` | `readonly` | () => `Promise`\<`string` \| `undefined`\> | The parsed message body, as the API returns it. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`body`](../../message/classes/EmailMessage.md#property-body) || <a id="property-cc"></a> `cc` | `readonly` | () => `Promise`\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md)[]\> | The Cc recipients. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`cc`](../../message/classes/EmailMessage.md#property-cc) |+| <a id="property-draftgeneration"></a> `draftGeneration` | `readonly` | () => `Promise`\<`number` \| `undefined`\> | Edit generation to capture with content before saving or transferring it. | - || <a id="property-from"></a> `from` | `readonly` | () => `Promise`\<[`ContactInfo`](../../../../../generated/email/types.gen/type-aliases/ContactInfo.md) \| `undefined`\> | The sender. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`from`](../../message/classes/EmailMessage.md#property-from) || <a id="property-id"></a> `id` | `public readonly` | `string` | - | [`EmailMessage`](../../message/classes/EmailMessage.md).[`id`](../../message/classes/EmailMessage.md#property-id) || <a id="property-labels"></a> `labels` | `readonly` | () => `Promise`\<[`LabelInfo`](../../../../../generated/email/types.gen/type-aliases/LabelInfo.md)[]\> | Labels on this message. | [`EmailMessage`](../../message/classes/EmailMessage.md).[`labels`](../../message/classes/EmailMessage.md#property-labels) |@@ -69,15 +70,16 @@ Add a label to this message.### completeDraftAttachment()-> **completeDraftAttachment**(`attachmentId`): `Promise`\<`void`\>+> **completeDraftAttachment**(`attachmentId`, `draftGeneration?`): `Promise`\<`void`\>-Verify an uploaded draft attachment before it can be sent.+Verify an uploaded attachment using the draft generation captured when its upload began.#### Parameters-| Parameter | Type |-| ------ | ------ |-| `attachmentId` | `string` |+| Parameter | Type | Default value |+| ------ | ------ | ------ |+| `attachmentId` | `string` | `undefined` |+| `draftGeneration?` | `number` | `0` |#### Returnsdiff --git a/packages/sdk-docs/reference/src/entities/email/draft/type-aliases/DraftOptions.md b/packages/sdk-docs/reference/src/entities/email/draft/type-aliases/DraftOptions.mdindex b6d0c1bfd0..5e6280f1bc 100644--- a/packages/sdk-docs/reference/src/entities/email/draft/type-aliases/DraftOptions.md+++ b/packages/sdk-docs/reference/src/entities/email/draft/type-aliases/DraftOptions.md@@ -1,6 +1,6 @@# Type Alias: DraftOptions-> **DraftOptions** = `Omit`\<[`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md), `"db_id"` \| `"provider_id"` \| `"provider_thread_id"` \| `"replying_to_id"` \| `"thread_db_id"` \| `"body_text"` \| `"body_html"` \| `"body_macro"` \| `"headers_json"` \| `"include_signature"`\> & \{ `bodyHtml?`: `string`; `bodyMacro?`: `string`; `bodyText?`: `string`; `headers?`: [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\[`"headers_json"`\]; `includeSignature?`: `boolean`; `replyingTo?`: [`EmailMessage`](../../message/classes/EmailMessage.md); `thread?`: [`EmailThread`](../../thread/classes/EmailThread.md); \}+> **DraftOptions** = `Omit`\<[`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md), `"db_id"` \| `"provider_id"` \| `"provider_thread_id"` \| `"replying_to_id"` \| `"thread_db_id"` \| `"body_text"` \| `"body_html"` \| `"body_macro"` \| `"headers_json"` \| `"include_signature"` \| `"draft_generation"`\> & \{ `bodyHtml?`: `string`; `bodyMacro?`: `string`; `bodyText?`: `string`; `draftGeneration?`: `number`; `headers?`: [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\[`"headers_json"`\]; `includeSignature?`: `boolean`; `replyingTo?`: [`EmailMessage`](../../message/classes/EmailMessage.md); `thread?`: [`EmailThread`](../../thread/classes/EmailThread.md); \}Draft content; relationships use message and thread handles.@@ -11,6 +11,7 @@ Draft content; relationships use message and thread handles.| `bodyHtml?` | `string` | HTML body. || `bodyMacro?` | `string` | Macro body. || `bodyText?` | `string` | Plain text body. |+| `draftGeneration?` | `number` | Generation captured when editing began; defaults to the loaded draft. || `headers?` | [`ApiDraftInput`](../../../../../generated/email/types.gen/type-aliases/ApiDraftInput.md)\[`"headers_json"`\] | Extra headers. || `includeSignature?` | `boolean` | Include the inbox signature. || `replyingTo?` | [`EmailMessage`](../../message/classes/EmailMessage.md) | Message being replied to. |diff --git a/packages/sdk-docs/reference/src/entities/email/message/classes/EmailMessage.md b/packages/sdk-docs/reference/src/entities/email/message/classes/EmailMessage.mdindex 2ae2cb5fb5..892913bcbe 100644--- a/packages/sdk-docs/reference/src/entities/email/message/classes/EmailMessage.md+++ b/packages/sdk-docs/reference/src/entities/email/message/classes/EmailMessage.md@@ -48,15 +48,16 @@ Add a label to this message.### completeDraftAttachment()-> **completeDraftAttachment**(`attachmentId`): `Promise`\<`void`\>+> **completeDraftAttachment**(`attachmentId`, `draftGeneration?`): `Promise`\<`void`\>-Verify an uploaded draft attachment before it can be sent.+Verify an uploaded attachment using the draft generation captured when its upload began.#### Parameters-| Parameter | Type |-| ------ | ------ |-| `attachmentId` | `string` |+| Parameter | Type | Default value |+| ------ | ------ | ------ |+| `attachmentId` | `string` | `undefined` |+| `draftGeneration?` | `number` | `0` |#### Returnsdiff --git a/packages/sdk/AGENTS.md b/packages/sdk/AGENTS.mdindex ae80f332b2..f0f73cd602 100644--- a/packages/sdk/AGENTS.md+++ b/packages/sdk/AGENTS.md@@ -64,4 +64,9 @@ the existing gateway prefixes.- Email sends and other writes against hosted data are real actions; use mocksfor automated SDK mutation tests.+- Carry the generation read with the draft through each mutation, including+ transfer and save. Attachment handles retain their reservation generation+ through completion and removal. A stale-generation rejection requires a fresh+ draft read and explicit reapproval; never refresh the generation to replay an+ old edit.- SQL result schemas are dynamic typed-cell unions; inspect `truncatedTables` before interpreting aggregates. Queries can write and are never retried automatically.diff --git a/packages/sdk/generated/email/index.ts b/packages/sdk/generated/email/index.tsindex 41e62ed83b..8b965ac1c3 100644--- a/packages/sdk/generated/email/index.ts+++ b/packages/sdk/generated/email/index.ts@@ -1,4 +1,4 @@// This file is auto-generated by @hey-api/openapi-tsexport { type Options, Sdk } from './sdk.gen';-export type { AccessLevel, AddDraftAttachmentData, AddDraftAttachmentError, AddDraftAttachmentErrors, AddDraftAttachmentRequest, AddDraftAttachmentResponse, AddDraftAttachmentResponse2, AddDraftAttachmentResponses, AddForwardedAttachmentData, AddForwardedAttachmentError, AddForwardedAttachmentErrors, AddForwardedAttachmentRequest, AddForwardedAttachmentResponse, AddForwardedAttachmentResponse2, AddForwardedAttachmentResponses, AddRemoveLabelData, AddRemoveLabelError, AddRemoveLabelErrors, AddRemoveLabelResponse, AddRemoveLabelResponses, AddRemoveThreadLabelData, AddRemoveThreadLabelError, AddRemoveThreadLabelErrors, AddRemoveThreadLabelResponse, AddRemoveThreadLabelResponses, ApiAttachment, ApiAttachmentDraft, ApiAttachmentForwarded, ApiContact, ApiContactInfo, ApiDraftContactInfo, ApiDraftInput, ApiDraftOutput, ApiEmailFilter, ApiLabel, ApiLabelListVisibility, ApiLabelType, ApiMessage, ApiMessageAttachment, ApiMessageLabel, ApiMessageListVisibility, ApiMessageOperation, ApiMessageOperationIssue, ApiMessageOperationState, ApiMessageResolutionAction, ApiPaginatedThreadCursor, ApiSortMethod, ApiThread, ApiThreadPreviewCursor, ApiThreadPreviewCursorInner, ArchiveThreadData, ArchiveThreadError, ArchiveThreadErrors, ArchiveThreadRequest, ArchiveThreadResponse, ArchiveThreadResponses, Attachment, AttachmentDraft, AttachmentForwarded, AttendeeResponseStatus, BackfillJob, BackfillJobStatus, BackfillStatus, BlockSenderData, BlockSenderError, BlockSenderErrors, BlockSenderRequest, BlockSenderResponses, CalendarAttendee, CalendarEvent, CalendarEventSourceContent, CalendarInvitation, CalendarOccurrence, CancelBackfillGmailData, CancelBackfillGmailError, CancelBackfillGmailErrors, CancelBackfillGmailResponse, CancelBackfillGmailResponses, CancelBackfillParams, ClientOptions, CompleteDraftAttachmentData, CompleteDraftAttachmentErrors, CompleteDraftAttachmentResponse, CompleteDraftAttachmentResponses, ConferenceProvider, Contact, ContactInfo, ContactInfoLegacy, ContactInfoWithInteraction, CreateDraftData, CreateDraftError, CreateDraftErrors, CreateDraftRequest, CreateDraftResponse, CreateDraftResponse2, CreateDraftResponses, CreateLabelData, CreateLabelError, CreateLabelErrors, CreateLabelRequest, CreateLabelResponse, CreateLabelResponse2, CreateLabelResponses, DeleteDraftData, DeleteDraftError, DeleteDraftErrors, DeleteDraftResponse, DeleteDraftResponses, DeleteEmailFilterData, DeleteEmailFilterError, DeleteEmailFilterErrors, DeleteEmailFilterResponse, DeleteEmailFilterResponses, DeleteLabelData, DeleteLabelError, DeleteLabelErrors, DeleteLabelResponse, DeleteLabelResponses, DeleteLinkData, DeleteLinkError, DeleteLinkErrors, DeleteLinkResponse, DeleteLinkResponses, DeleteScheduledDraftData, DeleteScheduledDraftError, DeleteScheduledDraftErrors, DeleteScheduledDraftResponse, DeleteScheduledDraftResponses, DisableLinkCalendarData, DisableLinkCalendarError, DisableLinkCalendarErrors, DisableLinkCalendarResponse, DisableLinkCalendarResponses, DisableSyncData, DisableSyncError, DisableSyncErrors, DisableSyncResponse, DisableSyncResponses, EmptyResponse, ErrorResponse, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, GetActiveBackfillJobResponse, GetAttachmentData, GetAttachmentDocumentIdData, GetAttachmentDocumentIdError, GetAttachmentDocumentIdErrors, GetAttachmentDocumentIdResponse, GetAttachmentDocumentIdResponse2, GetAttachmentDocumentIdResponses, GetAttachmentError, GetAttachmentErrors, GetAttachmentResponse, GetAttachmentResponse2, GetAttachmentResponses, GetBackfillGmailActiveData, GetBackfillGmailActiveError, GetBackfillGmailActiveErrors, GetBackfillGmailActiveResponse, GetBackfillGmailActiveResponses, GetBackfillGmailData, GetBackfillGmailError, GetBackfillGmailErrors, GetBackfillGmailResponse, GetBackfillGmailResponses, GetBackfillJobResponse, GetMessageData, GetMessageError, GetMessageErrors, GetMessageResponse, GetMessageResponses, GetMessagesBatchData, GetMessagesBatchError, GetMessagesBatchErrors, GetMessagesBatchResponse, GetMessagesBatchResponses, GetPreviewsCursorParams, GetScheduledMessagesData, GetScheduledMessagesError, GetScheduledMessagesErrors, GetScheduledMessagesResponse, GetScheduledMessagesResponses, GetScheduledResponse, GetThreadCalendarInvitationsData, GetThreadCalendarInvitationsErrors, GetThreadCalendarInvitationsResponse, GetThreadCalendarInvitationsResponses, GetThreadData, GetThreadError, GetThreadErrors, GetThreadMessagesHandlerData, GetThreadMessagesHandlerError, GetThreadMessagesHandlerErrors, GetThreadMessagesHandlerResponse, GetThreadMessagesHandlerResponses, GetThreadResponse, GetThreadResponse2, GetThreadResponses, GuestPolicy, HealthCheckLinksData, HealthCheckLinksError, HealthCheckLinksErrors, HealthCheckLinksResponse, HealthCheckLinksResponses, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InitErrorCodeResponse, InitResponse, InitUserData, InitUserError, InitUserErrors, InitUserResponse, InitUserResponses, InvitationDateTime, InvitationMethod, InvitationParticipant, InvitationResolution, Label, LabelInfo, LabelListVisibility, LabelType, Link, ListBackfillGmailData, ListBackfillGmailError, ListBackfillGmailErrors, ListBackfillGmailResponse, ListBackfillGmailResponses, ListBackfillJobsResponse, ListBlockedResponse, ListBlockedSendersData, ListBlockedSendersError, ListBlockedSendersErrors, ListBlockedSendersResponse, ListBlockedSendersResponses, ListContactsData, ListContactsError, ListContactsErrors, ListContactsResponse, ListContactsResponse2, ListContactsResponses, ListEmailFiltersData, ListEmailFiltersError, ListEmailFiltersErrors, ListEmailFiltersResponse, ListEmailFiltersResponse2, ListEmailFiltersResponses, ListLabelsData, ListLabelsError, ListLabelsErrors, ListLabelsResponse, ListLabelsResponse2, ListLabelsResponses, ListLinksData, ListLinksError, ListLinksErrors, ListLinksResponse, ListLinksResponse2, ListLinksResponses, MailboxAction, MailboxOperation, MailboxOperationState, MailboxSettingsChange, MailboxSettingsOperation, MailboxSettingsOperationsData, MailboxSettingsOperationsResponse, MailboxSettingsOperationsResponses, Message, MessageListVisibility, MessageOperationResponse, MessageOperationStatusData, MessageOperationStatusError, MessageOperationStatusErrors, MessageOperationStatusResponse, MessageOperationStatusResponses, ParsedMessage, PatchSettingsData, PatchSettingsError, PatchSettingsErrors, PatchSettingsRequest, PatchSettingsResponse, PatchSettingsResponse2, PatchSettingsResponses, PreviewsInboxCursorData, PreviewsInboxCursorError, PreviewsInboxCursorErrors, PreviewsInboxCursorResponse, PreviewsInboxCursorResponses, PreviewView, PreviewViewStandardLabel, RecoverDraftTransferData, RecoverDraftTransferErrors, RecoverDraftTransferResponse, RecoverDraftTransferResponses, RefreshEmailEvent, RemoveDraftAttachmentData, RemoveDraftAttachmentError, RemoveDraftAttachmentErrors, RemoveDraftAttachmentResponse, RemoveDraftAttachmentResponses, RemoveForwardedAttachmentData, RemoveForwardedAttachmentError, RemoveForwardedAttachmentErrors, RemoveForwardedAttachmentResponse, RemoveForwardedAttachmentResponses, ResolveMessageOperationData, ResolveMessageOperationError, ResolveMessageOperationErrors, ResolveMessageOperationRequest, ResolveMessageOperationResponse, ResolveMessageOperationResponses, ResyncLinkData, ResyncLinkError, ResyncLinkErrors, ResyncLinkResponse, ResyncLinkResponses, ResyncResponse, SendMessageData, SendMessageError, SendMessageErrors, SendMessageRequest, SendMessageResponse, SendMessageResponse2, SendMessageResponses, Settings, SharedInboxConflictResponse, SyncStatus, Thread, ThreadList, ThreadOperationsData, ThreadOperationsError, ThreadOperationsErrors, ThreadOperationsResponse, ThreadOperationsResponses, ThreadPreviewCursor, ThreadSeenData, ThreadSeenError, ThreadSeenErrors, ThreadSeenResponse, ThreadSeenResponses, ThreadStateField, ThreadSummary, TransferDraftData, TransferDraftErrors, TransferDraftRequest, TransferDraftResponse, TransferDraftResponse2, TransferDraftResponses, TransferRecoveryResponse, UnblockSenderData, UnblockSenderError, UnblockSenderErrors, UnblockSenderRequest, UnblockSenderResponse, UnblockSenderResponses, UnresolvedSignatureImagesError, UpdateLabelBatchRequest, UpdateLabelBatchResponse, UpdateThreadLabelRequest, UpdateThreadLabelsResponse, UpdateThreadProjectData, UpdateThreadProjectError, UpdateThreadProjectErrors, UpdateThreadProjectRequest, UpdateThreadProjectResponse, UpdateThreadProjectResponse2, UpdateThreadProjectResponses, UpdateThreadStateData, UpdateThreadStateError, UpdateThreadStateErrors, UpdateThreadStateRequest, UpdateThreadStateResponse, UpdateThreadStateResponses, UpsertEmailFilterData, UpsertEmailFilterError, UpsertEmailFilterErrors, UpsertEmailFilterRequest, UpsertEmailFilterResponse, UpsertEmailFilterResponse2, UpsertEmailFilterResponses, UpsertScheduledMessageData, UpsertScheduledMessageError, UpsertScheduledMessageErrors, UpsertScheduledMessageResponse, UpsertScheduledMessageResponses, UpsertScheduledRequest, UpsertScheduledResponse, UserProvider, Value, ViewerCapabilities } from './types.gen';+export type { AccessLevel, AddDraftAttachmentData, AddDraftAttachmentError, AddDraftAttachmentErrors, AddDraftAttachmentRequest, AddDraftAttachmentResponse, AddDraftAttachmentResponse2, AddDraftAttachmentResponses, AddForwardedAttachmentData, AddForwardedAttachmentError, AddForwardedAttachmentErrors, AddForwardedAttachmentRequest, AddForwardedAttachmentResponse, AddForwardedAttachmentResponse2, AddForwardedAttachmentResponses, AddRemoveLabelData, AddRemoveLabelError, AddRemoveLabelErrors, AddRemoveLabelResponse, AddRemoveLabelResponses, AddRemoveThreadLabelData, AddRemoveThreadLabelError, AddRemoveThreadLabelErrors, AddRemoveThreadLabelResponse, AddRemoveThreadLabelResponses, ApiAttachment, ApiAttachmentDraft, ApiAttachmentForwarded, ApiContact, ApiContactInfo, ApiDraftContactInfo, ApiDraftInput, ApiDraftOutput, ApiEmailFilter, ApiLabel, ApiLabelListVisibility, ApiLabelType, ApiMessage, ApiMessageAttachment, ApiMessageLabel, ApiMessageListVisibility, ApiMessageOperation, ApiMessageOperationIssue, ApiMessageOperationState, ApiMessageResolutionAction, ApiPaginatedThreadCursor, ApiSortMethod, ApiThread, ApiThreadPreviewCursor, ApiThreadPreviewCursorInner, ArchiveThreadData, ArchiveThreadError, ArchiveThreadErrors, ArchiveThreadRequest, ArchiveThreadResponse, ArchiveThreadResponses, Attachment, AttachmentDraft, AttachmentForwarded, AttendeeResponseStatus, BackfillJob, BackfillJobStatus, BackfillStatus, BlockSenderData, BlockSenderError, BlockSenderErrors, BlockSenderRequest, BlockSenderResponses, CalendarAttendee, CalendarEvent, CalendarEventSourceContent, CalendarInvitation, CalendarOccurrence, CancelBackfillGmailData, CancelBackfillGmailError, CancelBackfillGmailErrors, CancelBackfillGmailResponse, CancelBackfillGmailResponses, CancelBackfillParams, ClientOptions, CompleteDraftAttachmentData, CompleteDraftAttachmentErrors, CompleteDraftAttachmentResponse, CompleteDraftAttachmentResponses, ConferenceProvider, Contact, ContactInfo, ContactInfoLegacy, ContactInfoWithInteraction, CreateDraftData, CreateDraftError, CreateDraftErrors, CreateDraftRequest, CreateDraftResponse, CreateDraftResponse2, CreateDraftResponses, CreateLabelData, CreateLabelError, CreateLabelErrors, CreateLabelRequest, CreateLabelResponse, CreateLabelResponse2, CreateLabelResponses, DeleteDraftData, DeleteDraftError, DeleteDraftErrors, DeleteDraftResponse, DeleteDraftResponses, DeleteEmailFilterData, DeleteEmailFilterError, DeleteEmailFilterErrors, DeleteEmailFilterResponse, DeleteEmailFilterResponses, DeleteLabelData, DeleteLabelError, DeleteLabelErrors, DeleteLabelResponse, DeleteLabelResponses, DeleteLinkData, DeleteLinkError, DeleteLinkErrors, DeleteLinkResponse, DeleteLinkResponses, DeleteScheduledDraftData, DeleteScheduledDraftError, DeleteScheduledDraftErrors, DeleteScheduledDraftResponse, DeleteScheduledDraftResponses, DisableLinkCalendarData, DisableLinkCalendarError, DisableLinkCalendarErrors, DisableLinkCalendarResponse, DisableLinkCalendarResponses, DisableSyncData, DisableSyncError, DisableSyncErrors, DisableSyncResponse, DisableSyncResponses, EmptyResponse, ErrorResponse, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, GetActiveBackfillJobResponse, GetAttachmentData, GetAttachmentDocumentIdData, GetAttachmentDocumentIdError, GetAttachmentDocumentIdErrors, GetAttachmentDocumentIdResponse, GetAttachmentDocumentIdResponse2, GetAttachmentDocumentIdResponses, GetAttachmentError, GetAttachmentErrors, GetAttachmentResponse, GetAttachmentResponse2, GetAttachmentResponses, GetBackfillGmailActiveData, GetBackfillGmailActiveError, GetBackfillGmailActiveErrors, GetBackfillGmailActiveResponse, GetBackfillGmailActiveResponses, GetBackfillGmailData, GetBackfillGmailError, GetBackfillGmailErrors, GetBackfillGmailResponse, GetBackfillGmailResponses, GetBackfillJobResponse, GetMessageData, GetMessageError, GetMessageErrors, GetMessageResponse, GetMessageResponses, GetMessagesBatchData, GetMessagesBatchError, GetMessagesBatchErrors, GetMessagesBatchResponse, GetMessagesBatchResponses, GetPreviewsCursorParams, GetScheduledMessagesData, GetScheduledMessagesError, GetScheduledMessagesErrors, GetScheduledMessagesResponse, GetScheduledMessagesResponses, GetScheduledResponse, GetThreadCalendarInvitationsData, GetThreadCalendarInvitationsErrors, GetThreadCalendarInvitationsResponse, GetThreadCalendarInvitationsResponses, GetThreadData, GetThreadError, GetThreadErrors, GetThreadMessagesHandlerData, GetThreadMessagesHandlerError, GetThreadMessagesHandlerErrors, GetThreadMessagesHandlerResponse, GetThreadMessagesHandlerResponses, GetThreadResponse, GetThreadResponse2, GetThreadResponses, GuestPolicy, HealthCheckLinksData, HealthCheckLinksError, HealthCheckLinksErrors, HealthCheckLinksResponse, HealthCheckLinksResponses, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, InitErrorCodeResponse, InitResponse, InitUserData, InitUserError, InitUserErrors, InitUserResponse, InitUserResponses, InvitationDateTime, InvitationMethod, InvitationParticipant, InvitationResolution, Label, LabelInfo, LabelListVisibility, LabelType, Link, ListBackfillGmailData, ListBackfillGmailError, ListBackfillGmailErrors, ListBackfillGmailResponse, ListBackfillGmailResponses, ListBackfillJobsResponse, ListBlockedResponse, ListBlockedSendersData, ListBlockedSendersError, ListBlockedSendersErrors, ListBlockedSendersResponse, ListBlockedSendersResponses, ListContactsData, ListContactsError, ListContactsErrors, ListContactsResponse, ListContactsResponse2, ListContactsResponses, ListEmailFiltersData, ListEmailFiltersError, ListEmailFiltersErrors, ListEmailFiltersResponse, ListEmailFiltersResponse2, ListEmailFiltersResponses, ListLabelsData, ListLabelsError, ListLabelsErrors, ListLabelsResponse, ListLabelsResponse2, ListLabelsResponses, ListLinksData, ListLinksError, ListLinksErrors, ListLinksResponse, ListLinksResponse2, ListLinksResponses, MailboxAction, MailboxOperation, MailboxOperationState, MailboxSettingsChange, MailboxSettingsOperation, MailboxSettingsOperationsData, MailboxSettingsOperationsResponse, MailboxSettingsOperationsResponses, Message, MessageListVisibility, MessageOperationResponse, MessageOperationStatusData, MessageOperationStatusError, MessageOperationStatusErrors, MessageOperationStatusResponse, MessageOperationStatusResponses, ParsedMessage, PatchSettingsData, PatchSettingsError, PatchSettingsErrors, PatchSettingsRequest, PatchSettingsResponse, PatchSettingsResponse2, PatchSettingsResponses, PreviewsInboxCursorData, PreviewsInboxCursorError, PreviewsInboxCursorErrors, PreviewsInboxCursorResponse, PreviewsInboxCursorResponses, PreviewView, PreviewViewStandardLabel, RecoverDraftTransferData, RecoverDraftTransferErrors, RecoverDraftTransferResponse, RecoverDraftTransferResponses, RefreshEmailEvent, RemoveDraftAttachmentData, RemoveDraftAttachmentError, RemoveDraftAttachmentErrors, RemoveDraftAttachmentResponse, RemoveDraftAttachmentResponses, RemoveForwardedAttachmentData, RemoveForwardedAttachmentError, RemoveForwardedAttachmentErrors, RemoveForwardedAttachmentResponse, RemoveForwardedAttachmentResponses, ResolveMessageOperationData, ResolveMessageOperationError, ResolveMessageOperationErrors, ResolveMessageOperationRequest, ResolveMessageOperationResponse, ResolveMessageOperationResponses, ResyncLinkData, ResyncLinkError, ResyncLinkErrors, ResyncLinkResponse, ResyncLinkResponses, ResyncResponse, ScheduledSendStatus, SendMessageData, SendMessageError, SendMessageErrors, SendMessageRequest, SendMessageResponse, SendMessageResponse2, SendMessageResponses, Settings, SharedInboxConflictResponse, SyncStatus, Thread, ThreadList, ThreadOperationsData, ThreadOperationsError, ThreadOperationsErrors, ThreadOperationsResponse, ThreadOperationsResponses, ThreadPreviewCursor, ThreadSeenData, ThreadSeenError, ThreadSeenErrors, ThreadSeenResponse, ThreadSeenResponses, ThreadStateField, ThreadSummary, TransferDraftData, TransferDraftErrors, TransferDraftRequest, TransferDraftResponse, TransferDraftResponse2, TransferDraftResponses, TransferRecoveryResponse, UnblockSenderData, UnblockSenderError, UnblockSenderErrors, UnblockSenderRequest, UnblockSenderResponse, UnblockSenderResponses, UnresolvedSignatureImagesError, UpdateLabelBatchRequest, UpdateLabelBatchResponse, UpdateThreadLabelRequest, UpdateThreadLabelsResponse, UpdateThreadProjectData, UpdateThreadProjectError, UpdateThreadProjectErrors, UpdateThreadProjectRequest, UpdateThreadProjectResponse, UpdateThreadProjectResponse2, UpdateThreadProjectResponses, UpdateThreadStateData, UpdateThreadStateError, UpdateThreadStateErrors, UpdateThreadStateRequest, UpdateThreadStateResponse, UpdateThreadStateResponses, UpsertEmailFilterData, UpsertEmailFilterError, UpsertEmailFilterErrors, UpsertEmailFilterRequest, UpsertEmailFilterResponse, UpsertEmailFilterResponse2, UpsertEmailFilterResponses, UpsertScheduledMessageData, UpsertScheduledMessageError, UpsertScheduledMessageErrors, UpsertScheduledMessageResponse, UpsertScheduledMessageResponses, UpsertScheduledRequest, UpsertScheduledResponse, UserProvider, Value, ViewerCapabilities } from './types.gen';diff --git a/packages/sdk/generated/email/types.gen.ts b/packages/sdk/generated/email/types.gen.tsindex 302db070d6..357e99536d 100644--- a/packages/sdk/generated/email/types.gen.ts+++ b/packages/sdk/generated/email/types.gen.ts@@ -175,6 +175,10 @@ export type ApiDraftInput = {* Existing message DB ID (for updating an existing draft).*/db_id?: string | null;+ /**+ * Generation from the last loaded draft; legacy clients begin at zero.+ */+ draft_generation?: number;headers_json?: null | Value;/*** Per-message override for whether to include the signature on send:@@ -236,6 +240,10 @@ export type ApiDraftOutput = {* Message DB ID.*/db_id?: string | null;+ /**+ * Generation required for subsequent edits.+ */+ draft_generation: number;headers_json?: null | Value;/*** Link ID.@@ -313,6 +321,10 @@ export type ApiMessage = {cc: Array<ApiContactInfo>;created_at: string;db_id: string;+ /**+ * Draft edit generation; changes at send and cancellation boundaries.+ */+ draft_generation: number;from?: null | ApiContactInfo;global_id?: string | null;has_attachments: boolean;@@ -329,6 +341,7 @@ export type ApiMessage = {provider_id?: string | null;provider_thread_id?: string | null;replying_to_id?: string | null;+ scheduled_send_status?: null | ScheduledSendStatus;scheduled_send_time?: string | null;sent_at?: string | null;size_estimate?: number | null;@@ -1523,6 +1536,10 @@ export type ParsedMessage = {body_parsed?: string | null;cc: Array<ContactInfo>;db_id: string;+ /**+ * Draft edit generation captured with this message snapshot.+ */+ draft_generation?: number;from?: null | ContactInfo;internal_date_ts?: string | null;labels: Array<LabelInfo>;@@ -1603,6 +1620,11 @@ export type ResyncResponse = {backfill_job_id: string;};+/**+ * The user-visible delivery state of an unsent scheduled message.+ */+export type ScheduledSendStatus = 'pending' | 'sending' | 'failed' | 'unconfirmed';+/*** Request body for sending a message (backward-compatible with `{ message: MessageToSend }`).*/@@ -1717,6 +1739,10 @@ export type ThreadSummary = {*/export type TransferDraftRequest = {destination_link_id: string;+ /**+ * Generation captured with the source draft.+ */+ draft_generation?: number;operation_id: string;};@@ -2190,7 +2216,12 @@ export type UpsertScheduledMessageData = {*/id: string;};- query?: never;+ query?: {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+ };url: '/email/drafts/scheduled/{id}';};@@ -2218,7 +2249,12 @@ export type DeleteScheduledDraftData = {*/message_id: string;};- query?: never;+ query?: {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+ };url: '/email/drafts/scheduled/{message_id}';};@@ -2249,7 +2285,12 @@ export type DeleteDraftData = {*/id: string;};- query?: never;+ query?: {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+ };url: '/email/drafts/{id}';};@@ -2276,7 +2317,12 @@ export type AddDraftAttachmentData = {*/id: string;};- query?: never;+ query?: {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+ };url: '/email/drafts/{id}/attachments';};@@ -2307,7 +2353,12 @@ export type RemoveDraftAttachmentData = {*/attachment_id: string;};- query?: never;+ query?: {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+ };url: '/email/drafts/{id}/attachments/{attachment_id}';};@@ -2332,7 +2383,12 @@ export type CompleteDraftAttachmentData = {id: string;attachment_id: string;};- query?: never;+ query?: {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+ };url: '/email/drafts/{id}/attachments/{attachment_id}/complete';};@@ -2358,7 +2414,12 @@ export type AddForwardedAttachmentData = {*/id: string;};- query?: never;+ query?: {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+ };url: '/email/drafts/{id}/forwarded-attachments';};@@ -2387,7 +2448,12 @@ export type RemoveForwardedAttachmentData = {*/attachment_id: string;};- query?: never;+ query?: {+ /**+ * Generation from the last loaded draft. Legacy clients use zero.+ */+ draft_generation?: number;+ };url: '/email/drafts/{id}/forwarded-attachments/{attachment_id}';};diff --git a/packages/sdk/specs/email.json b/packages/sdk/specs/email.jsonindex 003002bf0d..a9be7c28e4 100644--- a/packages/sdk/specs/email.json+++ b/packages/sdk/specs/email.json@@ -783,6 +783,16 @@"summary": "Schedule or update a scheduled draft.","operationId": "upsert_scheduled_message","parameters": [+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }+ },{"name": "id","in": "path",@@ -874,6 +884,16 @@"summary": "Remove the scheduled send from a draft, including immediate-send undo.","operationId": "delete_scheduled_draft","parameters": [+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }+ },{"name": "message_id","in": "path",@@ -948,6 +968,16 @@"summary": "Delete a draft.","operationId": "delete_draft","parameters": [+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }+ },{"name": "id","in": "path",@@ -1028,6 +1058,16 @@"type": "string","format": "uuid"}+ },+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }}],"requestBody": {@@ -1119,6 +1159,16 @@"type": "string","format": "uuid"}+ },+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }}],"responses": {@@ -1181,6 +1231,16 @@"summary": "Confirm an uploaded attachment before it becomes part of a sendable draft.","operationId": "complete_draft_attachment","parameters": [+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }+ },{"name": "id","in": "path",@@ -1237,6 +1297,16 @@"type": "string","format": "uuid"}+ },+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }}],"requestBody": {@@ -1308,6 +1378,16 @@"type": "string","format": "uuid"}+ },+ {+ "name": "draft_generation",+ "in": "query",+ "description": "Generation from the last loaded draft. Legacy clients use zero.",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32"+ }}],"responses": {@@ -3716,6 +3796,11 @@"format": "uuid","description": "Existing message DB ID (for updating an existing draft)."},+ "draft_generation": {+ "type": "integer",+ "format": "int32",+ "description": "Generation from the last loaded draft; legacy clients begin at zero."+ },"headers_json": {"oneOf": [{@@ -3765,7 +3850,7 @@"ApiDraftOutput": {"type": "object","description": "The draft output matching the current `MessageToSend` JSON shape for backward compat.",- "required": ["link_id", "subject"],+ "required": ["draft_generation", "link_id", "subject"],"properties": {"bcc": {"type": ["array", "null"],@@ -3798,6 +3883,11 @@"format": "uuid","description": "Message DB ID."},+ "draft_generation": {+ "type": "integer",+ "format": "int32",+ "description": "Generation required for subsequent edits."+ },"headers_json": {"oneOf": [{@@ -3928,6 +4018,7 @@"type": "object","description": "API representation of a fully assembled email message.","required": [+ "draft_generation","db_id","thread_db_id","link_id",@@ -4003,6 +4094,11 @@"type": "string","format": "uuid"},+ "draft_generation": {+ "type": "integer",+ "format": "int32",+ "description": "Draft edit generation; changes at send and cancellation boundaries."+ },"from": {"oneOf": [{@@ -4069,6 +4165,17 @@"type": ["string", "null"],"format": "uuid"},+ "scheduled_send_status": {+ "oneOf": [+ {+ "type": "null"+ },+ {+ "$ref": "#/components/schemas/ScheduledSendStatus",+ "description": "Delivery state, including failures and unresolved provider outcomes."+ }+ ]+ },"scheduled_send_time": {"type": ["string", "null"],"format": "date-time"@@ -6297,6 +6404,11 @@"type": "string","format": "uuid"},+ "draft_generation": {+ "type": "integer",+ "format": "int32",+ "description": "Draft edit generation captured with this message snapshot."+ },"from": {"oneOf": [{@@ -6552,6 +6664,11 @@}}},+ "ScheduledSendStatus": {+ "type": "string",+ "description": "The user-visible delivery state of an unsent scheduled message.",+ "enum": ["pending", "sending", "failed", "unconfirmed"]+ },"SendMessageRequest": {"type": "object","description": "Request body for sending a message (backward-compatible with `{ message: MessageToSend }`).",@@ -6794,6 +6911,11 @@"type": "string","format": "uuid"},+ "draft_generation": {+ "type": "integer",+ "format": "int32",+ "description": "Generation captured with the source draft."+ },"operation_id": {"type": "string","format": "uuid"diff --git a/packages/sdk/src/entities/email/draft.ts b/packages/sdk/src/entities/email/draft.tsindex 6ee562787a..15f69da70b 100644--- a/packages/sdk/src/entities/email/draft.ts+++ b/packages/sdk/src/entities/email/draft.ts@@ -20,7 +20,10 @@ export type DraftOptions = Omit<| 'body_macro'| 'headers_json'| 'include_signature'+ | 'draft_generation'> & {+ /** Generation captured when editing began; defaults to the loaded draft. */+ draftGeneration?: number;/** Plain text body. */bodyText?: string;/** HTML body. */@@ -39,8 +42,12 @@ export type DraftOptions = Omit</** A draft email. Sending remains an explicit separate operation. */export class EmailDraft extends EmailMessage {- private async inboxHeaders() {- return { 'X-Email-Link-Id': (await this.link()).id };+ private async draftContext() {+ const draft = await this.detail.get();+ return {+ headers: { 'X-Email-Link-Id': draft.link_id },+ query: { draft_generation: draft.draft_generation ?? 0 },+ };}/** Construct a lazy draft handle. */@@ -48,22 +55,31 @@ export class EmailDraft extends EmailMessage {return new EmailDraft(client, id);}+ /** Edit generation to capture with content before saving or transferring it. */+ readonly draftGeneration = this.field('draft_generation');+/** Replace draft content without changing its identity or sending it. */async update(options: DraftOptions): Promise<void> {- const headers = await this.inboxHeaders();+ const { headers, query } = await this.draftContext();await this.mutate((c) =>c.email.createDraft({headers,- body: { draft: { ...draftBody(options), db_id: this.id } },+ body: {+ draft: {+ ...draftBody(options),+ db_id: this.id,+ draft_generation: options.draftGeneration ?? query.draft_generation,+ },+ },}),);}/** Delete the draft. */async delete(): Promise<void> {- const headers = await this.inboxHeaders();+ const { headers, query } = await this.draftContext();await this.mutate((c) =>- c.email.deleteDraft({ path: { id: this.id }, headers }),+ c.email.deleteDraft({ path: { id: this.id }, headers, query }),);}@@ -72,11 +88,12 @@ export class EmailDraft extends EmailMessage {sendTime: string,options?: { includeSignature?: boolean },): Promise<void> {- const headers = await this.inboxHeaders();+ const { headers, query } = await this.draftContext();await this.mutate((c) =>c.email.upsertScheduledMessage({path: { id: this.id },headers,+ query,body: {send_time: sendTime,include_signature: options?.includeSignature,@@ -87,9 +104,13 @@ export class EmailDraft extends EmailMessage {/** Remove a scheduled send. */async unschedule(): Promise<void> {- const headers = await this.inboxHeaders();+ const { headers, query } = await this.draftContext();await this.mutate((c) =>- c.email.deleteScheduledDraft({ path: { message_id: this.id }, headers }),+ c.email.deleteScheduledDraft({+ path: { message_id: this.id },+ headers,+ query,+ }),);}@@ -106,12 +127,23 @@ export class EmailDraft extends EmailMessage {size: options.size,upload_id: options.uploadId,};- const headers = await this.inboxHeaders();+ const { headers, query } = await this.draftContext();const result = await this.mutate((c) =>- c.email.addDraftAttachment({ path: { id: this.id }, headers, body }),+ c.email.addDraftAttachment({+ path: { id: this.id },+ headers,+ query,+ body,+ }),);return {- attachment: DraftAttachment.byId(this.client, this, result.attachment_id),+ attachment: DraftAttachment.byId(+ this.client,+ this,+ result.attachment_id,+ false,+ query.draft_generation,+ ),uploadUrl: result.upload_url,contentType: result.content_type,};@@ -121,27 +153,36 @@ export class EmailDraft extends EmailMessage {async forwardAttachment(attachment: EmailAttachment,): Promise<DraftAttachment> {- const headers = await this.inboxHeaders();+ const { headers, query } = await this.draftContext();const result = await this.mutate((c) =>c.email.addForwardedAttachment({path: { id: this.id },headers,+ query,body: { attachment_id: attachment.id },}),);- return DraftAttachment.byId(this.client, this, result.attachment_id, true);+ return DraftAttachment.byId(+ this.client,+ this,+ result.attachment_id,+ true,+ query.draft_generation,+ );}/** Remove a draft attachment. */async removeAttachment(attachment: DraftAttachment): Promise<void> {if (attachment.draft.id !== this.id)throw new Error('Attachment belongs to another draft');- const headers = await this.inboxHeaders();+ const { headers } = await this.draftContext();+ const query = { draft_generation: attachment.draftGeneration };if (attachment.forwarded)await this.mutate((c) =>c.email.removeForwardedAttachment({path: { id: this.id, attachment_id: attachment.id },headers,+ query,}),);else@@ -149,6 +190,7 @@ export class EmailDraft extends EmailMessage {c.email.removeDraftAttachment({path: { id: this.id, attachment_id: attachment.id },headers,+ query,}),);}@@ -157,7 +199,10 @@ export class EmailDraft extends EmailMessage {async verifyAttachment(attachment: DraftAttachment): Promise<void> {if (attachment.draft.id !== this.id || attachment.forwarded)throw new Error('Expected an uploaded attachment on this draft');- await this.completeDraftAttachment(attachment.id);+ await this.completeDraftAttachment(+ attachment.id,+ attachment.draftGeneration,+ );}}@@ -170,6 +215,8 @@ export class DraftAttachment {readonly id: string,/** Whether this attachment was forwarded. */readonly forwarded: boolean,+ /** Draft generation captured when the attachment was reserved. */+ readonly draftGeneration: number,) {}/** Construct a draft scoped attachment handle. */@@ -178,8 +225,9 @@ export class DraftAttachment {draft: EmailDraft,id: string,forwarded = false,+ draftGeneration = 0,): DraftAttachment {- return new DraftAttachment(draft, id, forwarded);+ return new DraftAttachment(draft, id, forwarded, draftGeneration);}/** Complete verification after uploading the file. */@@ -194,7 +242,12 @@ export class DraftAttachment {/** Serialize identity without credentials. */toJSON() {- return { id: this.id, draftId: this.draft.id, forwarded: this.forwarded };+ return {+ id: this.id,+ draftId: this.draft.id,+ forwarded: this.forwarded,+ draftGeneration: this.draftGeneration,+ };}}@@ -206,6 +259,7 @@ export function draftBody(options: DraftOptions): ApiDraftInput {bodyMacro,headers,includeSignature,+ draftGeneration,thread,replyingTo,...rest@@ -227,6 +281,7 @@ export function draftBody(options: DraftOptions): ApiDraftInput {body_macro: bodyMacro,headers_json: headers,include_signature: includeSignature,+ draft_generation: draftGeneration,thread_db_id: thread?.id,replying_to_id: replyingTo?.id,};diff --git a/packages/sdk/src/entities/email/message.ts b/packages/sdk/src/entities/email/message.tsindex 449dfaee19..a9f5cb3969 100644--- a/packages/sdk/src/entities/email/message.ts+++ b/packages/sdk/src/entities/email/message.ts@@ -118,12 +118,16 @@ export class EmailMessage extends MacroEntity<EmailMessageData> {);}- /** Verify an uploaded draft attachment before it can be sent. */- async completeDraftAttachment(attachmentId: string): Promise<void> {+ /** Verify an uploaded attachment using the draft generation captured when its upload began. */+ async completeDraftAttachment(+ attachmentId: string,+ draftGeneration = 0,+ ): Promise<void> {const link = await this.link();await this.mutate((c) =>c.email.completeDraftAttachment({path: { id: this.id, attachment_id: attachmentId },+ query: { draft_generation: draftGeneration },headers: { 'X-Email-Link-Id': link.id },}),);@@ -135,12 +139,16 @@ export class EmailMessage extends MacroEntity<EmailMessageData> {async transferDraft(request: TransferDraftRequest,): Promise<TransferDraftResponse> {- const link = await this.link();+ const draft = await this.detail.get();return this.mutate((c) =>c.email.transferDraft({path: { id: this.id },- body: request,- headers: { 'X-Email-Link-Id': link.id },+ body: {+ ...request,+ draft_generation:+ request.draft_generation ?? draft.draft_generation ?? 0,+ },+ headers: { 'X-Email-Link-Id': draft.link_id },}),);}diff --git a/packages/sdk/tests/backlog-entities.test.ts b/packages/sdk/tests/backlog-entities.test.tsindex dfab0fd2b4..af51a235a6 100644--- a/packages/sdk/tests/backlog-entities.test.ts+++ b/packages/sdk/tests/backlog-entities.test.ts@@ -22,6 +22,7 @@ const draftMessage: ParsedMessage = {cc: [],to: [],labels: [],+ draft_generation: 2,};test('draft editing encodes Unicode HTML and every write stays in the draft inbox', async () => {@@ -33,13 +34,13 @@ test('draft editing encodes Unicode HTML and every write stays in the draft inbowrites.push(request);if (request.headers.get('X-Email-Link-Id') !== 'secondary-inbox')return Response.json({ error: 'wrong inbox' }, { status: 403 });- if (request.url.endsWith('/attachments'))+ if (new URL(request.url).pathname.endsWith('/attachments'))return Response.json({attachment_id: 'attachment-1',upload_url: 'https://uploads.test/file',content_type: 'text/plain',});- if (request.url.endsWith('/forwarded-attachments'))+ if (new URL(request.url).pathname.endsWith('/forwarded-attachments'))return Response.json({ attachment_id: 'attachment-2' });if (request.url.endsWith('/drafts'))return Response.json({@@ -58,6 +59,7 @@ test('draft editing encodes Unicode HTML and every write stays in the draft inbohosts: { email: 'https://email.test' },});const draft = macro.email.draftById('draft-1');+ expect(await draft.draftGeneration()).toBe(2);await draft.update({subject: 'Updated',bodyHtml: '<p>café ☕</p>',@@ -67,6 +69,7 @@ test('draft editing encodes Unicode HTML and every write stays in the draft inboexpect(await writes[0].json()).toEqual({draft: {db_id: 'draft-1',+ draft_generation: 2,subject: 'Updated',body_html: Buffer.from('<p>café ☕</p>').toString('base64url'),thread_db_id: 'thread-1',@@ -89,11 +92,19 @@ test('draft editing encodes Unicode HTML and every write stays in the draft inboawait draft.unschedule();await draft.delete();expect(writes).toHaveLength(9);+ expect(+ writes+ .slice(1)+ .every(+ (request) =>+ new URL(request.url).searchParams.get('draft_generation') === '2',+ ),+ ).toBe(true);expect(writes.every((r) => r.headers.get('X-Email-Link-Id') === 'secondary-inbox'),).toBe(true);expect(JSON.stringify(upload.attachment)).toBe(- '{"id":"attachment-1","draftId":"draft-1","forwarded":false}',+ '{"id":"attachment-1","draftId":"draft-1","forwarded":false,"draftGeneration":2}',);});diff --git a/packages/sdk/tests/email-draft-inbox.test.ts b/packages/sdk/tests/email-draft-inbox.test.tsindex aa3d4cd89c..16ccecd680 100644--- a/packages/sdk/tests/email-draft-inbox.test.ts+++ b/packages/sdk/tests/email-draft-inbox.test.ts@@ -11,6 +11,7 @@ const message: ParsedMessage = {db_id: '0198a4cc-e138-7670-a308-a6b766602700',link_id: '0198a4cc-e138-7670-a308-a6b766602701',thread_db_id: '0198a4cc-e138-7670-a308-a6b766602702',+ draft_generation: 2,bcc: [],cc: [],to: [],@@ -24,7 +25,11 @@ const transferred: TransferDraftResponse = {attachments: [],};-for (const action of ['attachment completion', 'draft transfer'] as const) {+for (const action of [+ 'attachment completion',+ 'draft transfer',+ 'stale draft transfer',+] as const) {test(`${action} uses the draft's secondary inbox instead of the primary inbox`, async () => {const requests: Request[] = [];const fetchMock = Object.assign(@@ -37,7 +42,7 @@ for (const action of ['attachment completion', 'draft transfer'] as const) {status: 403,});}- return action === 'draft transfer'+ return action !== 'attachment completion'? Response.json(transferred): new Response(null, { status: 204 });},@@ -49,13 +54,17 @@ for (const action of ['attachment completion', 'draft transfer'] as const) {hosts: { email: 'https://email.example.test' },});const draft = macro.email.message(message.db_id);- if (action === 'draft transfer') {+ if (action !== 'attachment completion') {const request = {operation_id: '0198a4cc-e138-7670-a308-a6b766602705',destination_link_id: '0198a4cc-e138-7670-a308-a6b766602706',+ ...(action === 'stale draft transfer' ? { draft_generation: 0 } : {}),};expect(await draft.transferDraft(request)).toEqual(transferred);- expect(await requests[1].json()).toEqual(request);+ expect(await requests[1].json()).toEqual({+ ...request,+ draft_generation: action === 'stale draft transfer' ? 0 : 2,+ });} else {await draft.completeDraftAttachment('0198a4cc-e138-7670-a308-a6b766602707',@@ -72,3 +81,50 @@ for (const action of ['attachment completion', 'draft transfer'] as const) {);});}++test('an upload keeps its captured generation after Send and Undo restore a newer draft', async () => {+ let generation = 2;+ const writes: Request[] = [];+ spyOn(globalThis, 'fetch').mockImplementation(+ Object.assign(+ async (input: RequestInfo | URL) => {+ const request = input instanceof Request ? input : new Request(input);+ if (request.method === 'GET')+ return Response.json({ ...message, draft_generation: generation });+ writes.push(request);+ if (new URL(request.url).pathname.endsWith('/attachments'))+ return Response.json({+ attachment_id: 'attachment',+ upload_url: 'https://upload.example.test',+ content_type: 'text/plain',+ });+ return Response.json(+ { error: 'Draft generation conflict' },+ { status: 409 },+ );+ },+ { preconnect: globalThis.fetch.preconnect },+ ),+ );+ const macro = new Macro({+ auth: { type: 'user', apiKey: 'mak_test' },+ hosts: { email: 'https://email.example.test' },+ });+ const draft = macro.email.draftById(message.db_id);+ const upload = await draft.addAttachment({+ fileName: 'note.txt',+ sha: 'sha',+ size: 5,+ });+ generation = 4;+ await expect(upload.attachment.complete()).rejects.toThrow();+ await expect(upload.attachment.remove()).rejects.toThrow();+ expect(writes).toHaveLength(3);+ expect(+ writes.every(+ (request) =>+ new URL(request.url).searchParams.get('draft_generation') === '2',+ ),+ ).toBe(true);+ expect(upload.attachment.toJSON().draftGeneration).toBe(2);+});diff --git a/services/document_storage_service/src/server.rs b/services/document_storage_service/src/server.rsindex 1661d4806e..1f87eab776 100644--- a/services/document_storage_service/src/server.rs+++ b/services/document_storage_service/src/server.rs@@ -280,13 +280,14 @@ pub async fn run() -> anyhow::Result<()> {let contacts_queue = macro_queues::ContactsQueue::new();let notification_queue = macro_queues::NotificationIngressQueue::new();let gmail_ops_queue = macro_queues::GmailOpsQueue::new();+ let email_scheduled_queue = macro_queues::EmailScheduledQueue::new();let reminder_dispatch_queue = macro_queues::ReminderDispatchQueue::new();let calendar_reminder_dispatch_queue = macro_queues::CalendarReminderDispatchQueue::new();let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(&aws_config)).search_event_queue(&search_event_queue).document_delete_queue(&document_delete_queue).gmail_ops_queue(&gmail_ops_queue)- .email_scheduled_queue(¯o_queues::EmailScheduledQueue::new());+ .email_scheduled_queue(&email_scheduled_queue);let webhook_event_queue = webhook::outbound::SqsWebhookQueue::new(Arc::new(sqs_client.clone()),macro_queues::WebhookEventQueue::new().to_string(),diff --git a/services/email_scheduled_handler/AGENTS.md b/services/email_scheduled_handler/AGENTS.mdindex 9f3312e452..209b6d0517 100644--- a/services/email_scheduled_handler/AGENTS.md+++ b/services/email_scheduled_handler/AGENTS.md@@ -3,18 +3,20 @@## What it isEmail feature: Lambda, triggered every minute by EventBridge, that finds-scheduled email drafts whose `send_time` has passed and publishes a-`ScheduledPubsubMessage` per draft for `email_service` to actually send.+due delivery/reconciliation work and terminal deferred message deletions, then+publishes a `ScheduledPubsubMessage` for the email worker to process.## Start here-- `src/handler.rs`: `fetch_pending_scheduled_messages` query + publish loop;+- `src/outbound.rs`: recovery selection and queue adapters;+ `src/handler.rs` invokes the email domain recovery scanner;`README.md` explains the trigger cadence and the `scheduled_messages` table.## Scope-- Owns: finding due scheduled sends and enqueuing them exactly once.-- Not here: sending the email itself, or the enqueue-failure recovery path →+- Owns: repeatedly finding eligible durable work and publishing wakeups; worker+ claims provide fencing and idempotency.+- Not here: provider submission, reconciliation, or deferred-deletion application →`email_service`'s scheduled message worker (`src/pubsub/scheduled`).## Checksdiff --git a/services/email_scheduled_handler/Cargo.toml b/services/email_scheduled_handler/Cargo.tomlindex 4cb0512a74..20df340f09 100644--- a/services/email_scheduled_handler/Cargo.toml+++ b/services/email_scheduled_handler/Cargo.toml@@ -10,6 +10,8 @@ aws-sdk-sqs = { workspace = true }macro_aws_config = { path = "../../crates/macro_aws_config" }aws_lambda_events = { workspace = true, features = ["eventbridge"] }chrono = { workspace = true }+email = { path = "../../crates/email", default-features = false, features = ["ports"] }+futures = { workspace = true }lambda_runtime = { workspace = true }macro_entrypoint = { path = "../../crates/macro_entrypoint" }macro_env = { path = "../../crates/macro_env" }diff --git a/services/email_scheduled_handler/README.md b/services/email_scheduled_handler/README.mdindex a6cb7a2b06..6d2cb9143d 100644--- a/services/email_scheduled_handler/README.md+++ b/services/email_scheduled_handler/README.md@@ -1,5 +1,8 @@# Email Scheduled Handler-This Lambda function executes every minute to process scheduled emails. It checks for rows in the `scheduled_messages`-table where the `send_time` has passed and publishes a message to the email service's scheduled message worker queue via-PubSub. This triggers the scheduled message worker to process and send the queued email.\ No newline at end of file+This Lambda runs every minute and republishes eligible delivery/reconciliation+work from `email_scheduled_messages`. It also selects resolved or superseded+`email_deferred_message_deletions`, including rows with no remaining schedule.+Both use the existing scheduled message queue. The email domain worker reconciles+deferred deletion before claiming delivery; database claims prevent duplicate+submission. Failed queue writes remain eligible for the next scan.diff --git a/services/email_scheduled_handler/src/context.rs b/services/email_scheduled_handler/src/context.rsindex 7b9c0db64e..a3a5001e5e 100644--- a/services/email_scheduled_handler/src/context.rs+++ b/services/email_scheduled_handler/src/context.rs@@ -1,7 +1,7 @@-use std::sync::Arc;+use crate::outbound::{RecoveryQueue, RecoveryRepository};+use email::domain::scheduled_delivery::recovery::ScheduledRecovery;#[derive(Clone)]pub struct Context {- pub db: sqlx::Pool<sqlx::Postgres>,- pub sqs_client: Arc<sqs_client::SQS>,+ pub recovery: ScheduledRecovery<RecoveryRepository, RecoveryQueue>,}diff --git a/services/email_scheduled_handler/src/handler.rs b/services/email_scheduled_handler/src/handler.rsindex 6124137641..94b1f029ba 100644--- a/services/email_scheduled_handler/src/handler.rs+++ b/services/email_scheduled_handler/src/handler.rs@@ -1,73 +1,12 @@-use crate::context::{self};+use crate::context;use aws_lambda_events::eventbridge::EventBridgeEvent;-use lambda_runtime::{- Error, LambdaEvent,- tracing::{self},-};-use models_email::service::pubsub::ScheduledPubsubMessage;-use sqlx::PgPool;+use lambda_runtime::{Error, LambdaEvent, tracing};-#[tracing::instrument(skip(ctx, _event))]+#[tracing::instrument(skip(ctx, _event), err)]pub async fn handler(ctx: context::Context,_event: LambdaEvent<EventBridgeEvent>,) -> Result<(), Error> {- // grab all drafts with passed send_time that have not been sent already- let notifications = fetch_pending_scheduled_messages(&ctx.db)- .await- .unwrap_or_else(|e| {- tracing::error!(error=?e, "Error fetching scheduled messages");- Vec::new()- });-- if !notifications.is_empty() {- tracing::info!(notifications = ?notifications, "Sending scheduled email pubsub messages");- }-- for notif in notifications.into_iter() {- let message_id = notif.message_id;- let link_id = notif.link_id;- if let Err(e) = ctx- .sqs_client- .enqueue_email_scheduled_message(notif, None)- .await- {- tracing::error!(- error = ?e,- link_id = link_id.to_string(),- message_id = message_id.to_string(),- "Error enqueueing scheduled notification",- );- };- }-+ ctx.recovery.scan().await?;Ok(())}--/// Fetches all scheduled messages that are ready to be sent.-/// Only returns messages where:-/// - send_time has passed (< now())-/// - sent = false-/// - the associated email message is still a draft (is_draft = true)-#[tracing::instrument(skip(pool), err)]-pub async fn fetch_pending_scheduled_messages(- pool: &PgPool,-) -> anyhow::Result<Vec<ScheduledPubsubMessage>> {- let messages = sqlx::query_as!(- ScheduledPubsubMessage,- r#"- SELECT- esm.link_id, esm.message_id- FROM email_scheduled_messages esm- JOIN email_messages em ON em.id = esm.message_id- WHERE- esm.send_time < now()- AND esm.sent = FALSE- AND em.is_draft = TRUE- "#,- )- .fetch_all(pool)- .await?;-- Ok(messages)-}diff --git a/services/email_scheduled_handler/src/main.rs b/services/email_scheduled_handler/src/main.rsindex f715304389..a0e0068ac4 100644--- a/services/email_scheduled_handler/src/main.rs+++ b/services/email_scheduled_handler/src/main.rs@@ -1,6 +1,9 @@+#![recursion_limit = "256"]+mod config;mod context;mod handler;+mod outbound;#[cfg(test)]mod test;@@ -34,8 +37,10 @@ async fn main() -> Result<(), Error> {.email_scheduled_queue(&email_scheduled_queue);let ctx = context::Context {- db,- sqs_client: Arc::new(sqs_client),+ recovery: email::domain::scheduled_delivery::recovery::ScheduledRecovery::new(+ outbound::RecoveryRepository(db),+ outbound::RecoveryQueue(Arc::new(sqs_client)),+ ),};let func = service_fn(move |event: LambdaEvent<EventBridgeEvent>| {diff --git a/services/email_scheduled_handler/src/outbound.rs b/services/email_scheduled_handler/src/outbound.rsnew file mode 100644index 0000000000..f9e268d4ff--- /dev/null+++ b/services/email_scheduled_handler/src/outbound.rs@@ -0,0 +1,85 @@+//! Persistence and queue adapters for scheduled delivery recovery.++use email::domain::scheduled_delivery::recovery::{+ PendingDelivery, ScheduledRecoveryQueue, ScheduledRecoveryRepo,+};+use futures::{Stream, TryStreamExt};+use models_email::service::pubsub::ScheduledPubsubMessage;+use sqlx::PgPool;+use std::sync::Arc;++#[derive(Clone)]+pub struct RecoveryRepository(pub PgPool);++impl ScheduledRecoveryRepo for RecoveryRepository {+ fn pending_deliveries(&self) -> impl Stream<Item = anyhow::Result<PendingDelivery>> + Send {+ stream_pending_scheduled_messages(&self.0)+ }+}++#[derive(Clone)]+pub struct RecoveryQueue(pub Arc<sqs_client::SQS>);++impl ScheduledRecoveryQueue for RecoveryQueue {+ async fn enqueue(&self, delivery: PendingDelivery) -> anyhow::Result<()> {+ self.0+ .enqueue_email_scheduled_message(+ ScheduledPubsubMessage {+ link_id: delivery.link_id,+ message_id: delivery.message_id,+ },+ None,+ )+ .await?;+ Ok(())+ }+}++/// Streams eligible unsent work without accumulating the mailbox backlog in memory.+/// SQLx bounds row buffering while the domain publishes each durable notification.+fn stream_pending_scheduled_messages(+ pool: &PgPool,+) -> impl Stream<Item = anyhow::Result<PendingDelivery>> + Send + '_ {+ sqlx::query_as!(+ PendingDelivery,+ r#"+ SELECT+ esm.link_id AS "link_id!", esm.message_id AS "message_id!"+ FROM email_scheduled_messages esm+ JOIN email_messages em ON em.id = esm.message_id+ WHERE+ esm.send_time < now()+ AND esm.sent = FALSE+ AND em.is_sent = FALSE+ AND esm.delivery_status <> 'failed'+ AND (CASE WHEN esm.processing THEN+ COALESCE(esm.delivery_lease_expires_at, esm.updated_at + make_interval(secs => $1)) <= NOW()+ ELSE esm.delivery_lease_expires_at IS NULL OR esm.delivery_lease_expires_at <= NOW() END)+ AND (em.is_draft OR esm.delivery_claim_id IS NOT NULL OR EXISTS (+ SELECT 1 FROM email_send_attempts a+ WHERE a.link_id = esm.link_id AND a.message_id = esm.message_id AND NOT a.cancelled+ ))+ UNION+ SELECT em.link_id, em.id AS message_id+ FROM email_deferred_message_deletions d+ JOIN email_messages em ON em.id = d.message_id+ WHERE em.draft_generation <> d.draft_generation+ OR em.provider_id IS DISTINCT FROM d.provider_id+ OR NOT EXISTS (+ SELECT 1 FROM email_send_attempts a+ WHERE a.message_id = em.id AND a.link_id = em.link_id+ AND NOT a.cancelled AND NOT a.sent+ )+ "#,+ f64::from(email::domain::scheduled_delivery::DELIVERY_LEASE_SECONDS),+ )+ .fetch(pool)+ .map_err(anyhow::Error::from)+}++#[cfg(test)]+pub async fn fetch_pending_scheduled_messages(+ pool: &PgPool,+) -> anyhow::Result<Vec<PendingDelivery>> {+ stream_pending_scheduled_messages(pool).try_collect().await+}diff --git a/services/email_scheduled_handler/src/test.rs b/services/email_scheduled_handler/src/test.rsindex e6aba1e190..e5097c0549 100644--- a/services/email_scheduled_handler/src/test.rs+++ b/services/email_scheduled_handler/src/test.rs@@ -1,4 +1,4 @@-use crate::handler::fetch_pending_scheduled_messages;+use crate::outbound::fetch_pending_scheduled_messages;use anyhow::Result;use macro_db_migrator::MACRO_DB_MIGRATIONS;use sqlx::types::Uuid;@@ -13,7 +13,7 @@ async fn fetch_pending_returns_only_eligible_messages(pool: Pool<Postgres>) -> Rlet results = fetch_pending_scheduled_messages(&pool).await?;- // Should return exactly 2 messages:+ // Legacy non-draft immediate sends must never be resurrected.// - Message 1: Draft with past send_time, not sent// - Message 5: Draft with past send_time, not sent (different link)assert_eq!(results.len(), 2);@@ -60,14 +60,96 @@ async fn fetch_pending_excludes_already_sent(pool: Pool<Postgres>) -> Result<()>migrator = "MACRO_DB_MIGRATIONS",fixtures(path = "test/fixtures", scripts("fetch_pending_scheduled_messages")))]-async fn fetch_pending_excludes_non_drafts(pool: Pool<Postgres>) -> Result<()> {- let results = fetch_pending_scheduled_messages(&pool).await?;-- let message_ids: Vec<Uuid> = results.iter().map(|r| r.message_id).collect();+async fn fetch_pending_recovers_only_admitted_graphql_immediate_sends(+ pool: Pool<Postgres>,+) -> Result<()> {+ let message_id = Uuid::parse_str("00000000-0000-0000-0000-00000000f504")?;+ sqlx::query!(+ "UPDATE email_messages SET is_sent = false WHERE id = $1",+ message_id+ )+ .execute(&pool)+ .await?;+ assert!(+ !fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message_id)+ );+ sqlx::query!("INSERT INTO email_send_attempts (user_id,link_id,attempt_id,message_id) SELECT 'test',link_id,$1,id FROM email_messages WHERE id=$2", Uuid::new_v4(),message_id).execute(&pool).await?;+ assert!(+ fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message_id)+ );+ sqlx::query!(+ "UPDATE email_scheduled_messages SET processing = true WHERE message_id=$1",+ message_id+ )+ .execute(&pool)+ .await?;+ assert!(+ !fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message_id)+ );+ Ok(())+}- // Message 4 has is_draft = false, should not be included- assert!(!message_ids.contains(&Uuid::parse_str("00000000-0000-0000-0000-00000000f504")?));+#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "test/fixtures", scripts("fetch_pending_scheduled_messages"))+)]+async fn scanner_recovers_managed_rest_sends_without_resurrecting_legacy_sends(+ pool: Pool<Postgres>,+) -> Result<()> {+ let message_id = Uuid::parse_str("00000000-0000-0000-0000-00000000f504")?;+ sqlx::query!(+ "UPDATE email_messages SET is_sent = false WHERE id = $1",+ message_id+ )+ .execute(&pool)+ .await?;+ assert!(+ !fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message_id)+ );+ // REST admission creates no GraphQL attempt. The managed claim is its fence.+ for (status, submitted) in [("ready", false), ("ready", true), ("unconfirmed", true)] {+ sqlx::query!(+ "UPDATE email_scheduled_messages SET delivery_claim_id=$2,+ delivery_status=$3, processing=$4,+ delivery_started_at=CASE WHEN $4 THEN NOW() ELSE NULL END,+ delivery_lease_expires_at=NOW()+INTERVAL '5 minutes' WHERE message_id=$1",+ message_id,+ Uuid::new_v4(),+ status,+ submitted,+ )+ .execute(&pool)+ .await?;+ assert!(+ !fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message_id)+ );+ sqlx::query!(+ "UPDATE email_scheduled_messages SET delivery_lease_expires_at=NOW()-INTERVAL '1 second' WHERE message_id=$1",+ message_id,+ ).execute(&pool).await?;+ assert!(+ fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message_id)+ );+ }Ok(())}@@ -109,3 +191,209 @@ async fn fetch_pending_returns_empty_when_no_scheduled_messages(Ok(())}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "test/fixtures", scripts("fetch_pending_scheduled_messages"))+)]+async fn scanner_recovers_expired_preparation_submission_and_legacy_claims(+ pool: Pool<Postgres>,+) -> Result<()> {+ let message = Uuid::parse_str("00000000-0000-0000-0000-00000000f501")?;+ // Both modern phases have a lease. Neither may disappear from recovery forever.+ for submitted in [false, true] {+ sqlx::query!(+ "UPDATE email_scheduled_messages SET processing=true, delivery_claim_id=$2,+ delivery_lease_expires_at=NOW()-INTERVAL '1 second',+ delivery_started_at=CASE WHEN $3 THEN NOW()-INTERVAL '10 minutes' ELSE NULL END+ WHERE message_id=$1",+ message,+ Uuid::new_v4(),+ submitted,+ )+ .execute(&pool)+ .await?;+ assert!(+ fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message)+ );+ }+ sqlx::query!(+ "UPDATE email_scheduled_messages SET delivery_claim_id=NULL, delivery_lease_expires_at=NULL,+ delivery_started_at=NULL, updated_at=NOW()-INTERVAL '10 minutes' WHERE message_id=$1",+ message,+ )+ .execute(&pool)+ .await?;+ assert!(+ fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message)+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "test/fixtures", scripts("fetch_pending_scheduled_messages"))+)]+async fn scanner_obeys_active_lease_and_preparation_backoff(pool: Pool<Postgres>) -> Result<()> {+ let message = Uuid::parse_str("00000000-0000-0000-0000-00000000f501")?;+ for processing in [true, false] {+ sqlx::query!(+ "UPDATE email_scheduled_messages SET processing=$2,+ delivery_lease_expires_at=NOW()+INTERVAL '5 minutes' WHERE message_id=$1",+ message,+ processing,+ )+ .execute(&pool)+ .await?;+ assert!(+ !fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message)+ );+ }+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "test/fixtures", scripts("fetch_pending_scheduled_messages"))+)]+async fn scanner_does_not_restart_failed_delivery_after_expiry(pool: Pool<Postgres>) -> Result<()> {+ let message = Uuid::parse_str("00000000-0000-0000-0000-00000000f501")?;+ sqlx::query!(+ "UPDATE email_scheduled_messages SET processing=true, delivery_status='failed',+ delivery_lease_expires_at=NOW()-INTERVAL '1 day' WHERE message_id=$1",+ message,+ )+ .execute(&pool)+ .await?;+ assert!(+ !fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message)+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "test/fixtures", scripts("fetch_pending_scheduled_messages"))+)]+async fn scanner_retries_unconfirmed_lookups_only_after_backoff(+ pool: Pool<Postgres>,+) -> Result<()> {+ let message = Uuid::parse_str("00000000-0000-0000-0000-00000000f501")?;+ sqlx::query!(+ "UPDATE email_scheduled_messages SET processing=true, delivery_status='unconfirmed',+ delivery_started_at=NOW(), delivery_lease_expires_at=NOW()+INTERVAL '5 minutes' WHERE message_id=$1",+ message,+ ).execute(&pool).await?;+ assert!(+ !fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message)+ );+ sqlx::query!(+ "UPDATE email_scheduled_messages SET delivery_lease_expires_at=NOW()-INTERVAL '1 second' WHERE message_id=$1",+ message,+ ).execute(&pool).await?;+ assert!(+ fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message)+ );+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(path = "test/fixtures", scripts("fetch_pending_scheduled_messages"))+)]+async fn scanner_recovers_deferred_deletions_after_delivery_or_cancellation(+ pool: Pool<Postgres>,+) -> Result<()> {+ let message = Uuid::parse_str("00000000-0000-0000-0000-00000000f502")?;+ sqlx::query!("INSERT INTO email_send_attempts (user_id,link_id,attempt_id,message_id) SELECT 'test',link_id,$1,id FROM email_messages WHERE id=$2", Uuid::now_v7(), message).execute(&pool).await?;+ sqlx::query!("DELETE FROM email_messages WHERE id=$1", message)+ .execute(&pool)+ .await?;+ assert!(+ !fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message)+ );+ sqlx::query!(+ "UPDATE email_scheduled_messages SET delivery_status='failed', processing=true WHERE message_id=$1",+ message+ )+ .execute(&pool)+ .await?;+ assert!(+ !fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message)+ );+ // Cancellation removes the schedule; cleanup must still run.+ sqlx::query!(+ "UPDATE email_send_attempts SET cancelled=true WHERE message_id=$1",+ message+ )+ .execute(&pool)+ .await?;+ sqlx::query!(+ "UPDATE email_messages SET draft_generation=draft_generation+1 WHERE id=$1",+ message+ )+ .execute(&pool)+ .await?;+ sqlx::query!(+ "DELETE FROM email_scheduled_messages WHERE message_id=$1",+ message+ )+ .execute(&pool)+ .await?;+ assert!(+ fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message)+ );+ // Delivery also leaves a terminal deletion eligible, with no new submission.+ sqlx::query!(+ "UPDATE email_deferred_message_deletions d SET draft_generation=m.draft_generation FROM email_messages m WHERE d.message_id=m.id AND m.id=$1",+ message+ )+ .execute(&pool)+ .await?;+ sqlx::query!(+ "UPDATE email_send_attempts SET cancelled=false, sent=true WHERE message_id=$1",+ message+ )+ .execute(&pool)+ .await?;+ sqlx::query!(+ "UPDATE email_messages SET is_sent=true WHERE id=$1",+ message+ )+ .execute(&pool)+ .await?;+ assert!(+ fetch_pending_scheduled_messages(&pool)+ .await?+ .iter()+ .any(|row| row.message_id == message)+ );+ Ok(())+}diff --git a/services/email_service/AGENTS.md b/services/email_service/AGENTS.mdindex 7d63d3c21b..1dd25a9eb8 100644--- a/services/email_service/AGENTS.md+++ b/services/email_service/AGENTS.md@@ -48,6 +48,13 @@ the gateway `/email` prefix.## Gotchas+- Provider-sync deletions deferred by active sends publish no deletion event; scheduled recovery reconciles the retained marker before trying to claim delivery.++- Draft edit routes carry `draft_generation` from the editing lifetime, including attachments, deletion, transfer, and schedules; regenerate OpenAPI clients when this contract changes.++- The Gmail delivery adapter freezes approved upload/provider-file IDs before+ loading bytes through the authorized reader; Outlook uses its own coordinator.+- Forwarded attachments use the source inbox's provider credentials; the emaildomain rechecks the scheduled actor's access before cross-inbox downloads.- Macro's own digest emails are filtered out of Signal/email notificationsdiff --git a/services/email_service/src/api/email/drafts/add_attachment.rs b/services/email_service/src/api/email/drafts/add_attachment.rsindex e03a94c805..997aae980b 100644--- a/services/email_service/src/api/email/drafts/add_attachment.rs+++ b/services/email_service/src/api/email/drafts/add_attachment.rs@@ -2,9 +2,10 @@ use super::attachment_error::AttachmentApiError;use crate::api::context::{ApiContext, AuthorizationService, EmailSvc};use axum::{Json,- extract::{Path, State},+ extract::{Path, Query, State},};use axum_extra::extract::Cached;+use email::inbound::axum::api_types::DraftEditPrecondition;use email::{domain::draft_attachments::DraftAttachmentUpload, inbound::axum::axum_impls::EmailLinkExtractor,};@@ -49,7 +50,7 @@ pub struct AddDraftAttachmentResponse {tag = "Drafts",path = "/email/drafts/{id}/attachments",operation_id = "add_draft_attachment",- params(PathParams),+ params(PathParams, DraftEditPrecondition),request_body = AddDraftAttachmentRequest,responses((status = 201, body = AddDraftAttachmentResponse),@@ -61,6 +62,7 @@ pub struct AddDraftAttachmentResponse {)]#[tracing::instrument(skip_all, err)]pub async fn handler(+ Query(precondition): Query<DraftEditPrecondition>,State(ctx): State<ApiContext>,authorization: MacroAuthorizationExtractor<AuthorizationService, UserOrInternal>,Cached(EmailLinkExtractor(link, _)): Cached<EmailLinkExtractor<EmailSvc, AuthorizationService>>,@@ -80,6 +82,7 @@ pub async fn handler(size: req.size,upload_id: req.upload_id,},+ precondition.draft_generation,).await?;Ok(Json(AddDraftAttachmentResponse {diff --git a/services/email_service/src/api/email/drafts/add_forwarded_attachment.rs b/services/email_service/src/api/email/drafts/add_forwarded_attachment.rsindex ce9e369c5c..99a71e9606 100644--- a/services/email_service/src/api/email/drafts/add_forwarded_attachment.rs+++ b/services/email_service/src/api/email/drafts/add_forwarded_attachment.rs@@ -2,10 +2,11 @@ use super::attachment_error::AttachmentApiError;use crate::api::context::{ApiContext, AuthorizationService, EmailSvc};use axum::{Json,- extract::{Path, State},+ extract::{Path, Query, State},http::StatusCode,};use axum_extra::extract::Cached;+use email::inbound::axum::api_types::DraftEditPrecondition;use email::inbound::axum::axum_impls::EmailLinkExtractor;use macro_authorization::{MacroAuthorizationExtractor, UserOrInternal};use model::response::ErrorResponse;@@ -42,7 +43,7 @@ pub struct AddForwardedAttachmentResponse {tag = "Drafts",path = "/email/drafts/{id}/forwarded-attachments",operation_id = "add_forwarded_attachment",- params(PathParams),+ params(PathParams, DraftEditPrecondition),request_body = AddForwardedAttachmentRequest,responses((status = 201, body = AddForwardedAttachmentResponse),@@ -52,6 +53,7 @@ pub struct AddForwardedAttachmentResponse {)]#[tracing::instrument(skip_all, err)]pub async fn handler(+ Query(precondition): Query<DraftEditPrecondition>,State(ctx): State<ApiContext>,authorization: MacroAuthorizationExtractor<AuthorizationService, UserOrInternal>,Cached(EmailLinkExtractor(link, _)): Cached<EmailLinkExtractor<EmailSvc, AuthorizationService>>,@@ -61,7 +63,13 @@ pub async fn handler(let actor = &authorization.authorization.user.macro_user_id;let attachment = ctx.draft_attachments- .forward(actor, link.id, draft_id, req.attachment_id)+ .forward(+ actor,+ link.id,+ draft_id,+ req.attachment_id,+ precondition.draft_generation,+ ).await?;Ok((StatusCode::CREATED,diff --git a/services/email_service/src/api/email/drafts/complete_attachment.rs b/services/email_service/src/api/email/drafts/complete_attachment.rsindex 98c82e96c7..527ebbcb9f 100644--- a/services/email_service/src/api/email/drafts/complete_attachment.rs+++ b/services/email_service/src/api/email/drafts/complete_attachment.rs@@ -1,19 +1,21 @@use super::attachment_error::AttachmentApiError;use crate::api::context::{ApiContext, AuthorizationService, EmailSvc};use axum::{- extract::{Path, State},+ extract::{Path, Query, State},http::StatusCode,};use axum_extra::extract::Cached;+use email::inbound::axum::api_types::DraftEditPrecondition;use email::inbound::axum::axum_impls::EmailLinkExtractor;use macro_authorization::{MacroAuthorizationExtractor, UserOrInternal};use uuid::Uuid;/// Confirm an uploaded attachment before it becomes part of a sendable draft.#[utoipa::path(post, tag = "Drafts", path = "/email/drafts/{id}/attachments/{attachment_id}/complete",- operation_id = "complete_draft_attachment", params(("id" = Uuid, Path), ("attachment_id" = Uuid, Path)),+ operation_id = "complete_draft_attachment", params(DraftEditPrecondition, ("id" = Uuid, Path), ("attachment_id" = Uuid, Path)),responses((status = 204), (status = 400), (status = 403), (status = 404), (status = 409), (status = 500)))]pub async fn handler(+ Query(precondition): Query<DraftEditPrecondition>,State(ctx): State<ApiContext>,authorization: MacroAuthorizationExtractor<AuthorizationService, UserOrInternal>,Cached(EmailLinkExtractor(link, _)): Cached<EmailLinkExtractor<EmailSvc, AuthorizationService>>,@@ -25,6 +27,7 @@ pub async fn handler(link.id,draft,attachment,+ precondition.draft_generation,).await?;Ok(StatusCode::NO_CONTENT)diff --git a/services/email_service/src/api/email/drafts/delete.rs b/services/email_service/src/api/email/drafts/delete.rsindex 69da21c7e2..f5314b06af 100644--- a/services/email_service/src/api/email/drafts/delete.rs+++ b/services/email_service/src/api/email/drafts/delete.rs@@ -1,11 +1,12 @@use crate::api::context::{ApiContext, AuthorizationService};use axum::{Json,- extract::{Path, State},+ extract::{Path, Query, State},http::StatusCode,response::{IntoResponse, Response},};use email::domain::{models::EmailErr, ports::EmailService};+use email::inbound::axum::api_types::DraftEditPrecondition;use macro_authorization::{MacroAuthorizationExtractor, UserOrInternal};use model::response::{EmptyResponse, ErrorResponse};use uuid::Uuid;@@ -39,6 +40,7 @@ impl IntoResponse for DeleteDraftError {path = "/email/drafts/{id}",operation_id = "delete_draft",params(+ DraftEditPrecondition,("id" = Uuid, Path, description = "Draft ID."),),responses(@@ -51,13 +53,18 @@ impl IntoResponse for DeleteDraftError {)]#[tracing::instrument(skip(ctx, authorization), err)]pub async fn handler(+ Query(precondition): Query<DraftEditPrecondition>,State(ctx): State<ApiContext>,authorization: MacroAuthorizationExtractor<AuthorizationService, UserOrInternal>,Path(draft_id): Path<Uuid>,) -> Result<StatusCode, DeleteDraftError> {ctx.email_service.service()- .delete_draft_for_user(authorization.authorization.user.macro_user_id, draft_id)+ .delete_draft_for_user(+ authorization.authorization.user.macro_user_id,+ draft_id,+ precondition.draft_generation,+ ).await?;Ok(StatusCode::NO_CONTENT)}diff --git a/services/email_service/src/api/email/drafts/remove_attachment.rs b/services/email_service/src/api/email/drafts/remove_attachment.rsindex 36e41a03a4..a25b1af4e0 100644--- a/services/email_service/src/api/email/drafts/remove_attachment.rs+++ b/services/email_service/src/api/email/drafts/remove_attachment.rs@@ -1,11 +1,12 @@use super::attachment_error::AttachmentApiError;use crate::api::context::{ApiContext, AuthorizationService, EmailSvc};use axum::{- extract::{Path, State},+ extract::{Path, Query, State},http::StatusCode,response::IntoResponse,};use axum_extra::extract::Cached;+use email::inbound::axum::api_types::DraftEditPrecondition;use email::inbound::axum::axum_impls::EmailLinkExtractor;use macro_authorization::{MacroAuthorizationExtractor, UserOrInternal};use model::response::EmptyResponse;@@ -26,7 +27,7 @@ pub struct PathParams {tag = "Drafts",path = "/email/drafts/{id}/attachments/{attachment_id}",operation_id = "remove_draft_attachment",- params(PathParams),+ params(PathParams, DraftEditPrecondition),responses((status = 201, body = EmptyResponse),(status = 400, body = ErrorResponse),@@ -37,6 +38,7 @@ pub struct PathParams {)]#[tracing::instrument(skip_all, err)]pub async fn handler(+ Query(precondition): Query<DraftEditPrecondition>,State(ctx): State<ApiContext>,authorization: MacroAuthorizationExtractor<AuthorizationService, UserOrInternal>,Cached(EmailLinkExtractor(link, _)): Cached<EmailLinkExtractor<EmailSvc, AuthorizationService>>,@@ -53,6 +55,7 @@ pub async fn handler(draft_id,attachment_id,email::domain::draft_attachments::RemovalKind::UploadedOrNative,+ precondition.draft_generation,).await?;Ok(StatusCode::NO_CONTENT)diff --git a/services/email_service/src/api/email/drafts/remove_forwarded_attachment.rs b/services/email_service/src/api/email/drafts/remove_forwarded_attachment.rsindex 8bf301b2df..72c9f3e021 100644--- a/services/email_service/src/api/email/drafts/remove_forwarded_attachment.rs+++ b/services/email_service/src/api/email/drafts/remove_forwarded_attachment.rs@@ -1,11 +1,12 @@use super::attachment_error::AttachmentApiError;use crate::api::context::{ApiContext, AuthorizationService, EmailSvc};use axum::{- extract::{Path, State},+ extract::{Path, Query, State},http::StatusCode,response::IntoResponse,};use axum_extra::extract::Cached;+use email::inbound::axum::api_types::DraftEditPrecondition;use email::inbound::axum::axum_impls::EmailLinkExtractor;use macro_authorization::{MacroAuthorizationExtractor, UserOrInternal};use model::response::ErrorResponse;@@ -25,7 +26,7 @@ pub struct PathParams {tag = "Drafts",path = "/email/drafts/{id}/forwarded-attachments/{attachment_id}",operation_id = "remove_forwarded_attachment",- params(PathParams),+ params(PathParams, DraftEditPrecondition),responses((status = 204),(status = 404, body = ErrorResponse),@@ -34,6 +35,7 @@ pub struct PathParams {)]#[tracing::instrument(skip_all, err)]pub async fn handler(+ Query(precondition): Query<DraftEditPrecondition>,State(ctx): State<ApiContext>,authorization: MacroAuthorizationExtractor<AuthorizationService, UserOrInternal>,Cached(EmailLinkExtractor(link, _)): Cached<EmailLinkExtractor<EmailSvc, AuthorizationService>>,@@ -50,6 +52,7 @@ pub async fn handler(draft_id,attachment_id,email::domain::draft_attachments::RemovalKind::Forwarded,+ precondition.draft_generation,).await?;Ok(StatusCode::NO_CONTENT)diff --git a/services/email_service/src/api/email/drafts/scheduled/remove.rs b/services/email_service/src/api/email/drafts/scheduled/remove.rsindex 09ae4e5934..278c532f60 100644--- a/services/email_service/src/api/email/drafts/scheduled/remove.rs+++ b/services/email_service/src/api/email/drafts/scheduled/remove.rs@@ -1,10 +1,11 @@use crate::api::context::{ApiContext, AuthorizationService, EmailSvc};use axum::{- extract::{Path, State},+ extract::{Path, Query, State},http::StatusCode,};use axum_extra::extract::Cached;use email::domain::scheduled::{EmailSchedulingService, ScheduleChange};+use email::inbound::axum::api_types::DraftEditPrecondition;use email::inbound::axum::axum_impls::EmailLinkExtractor;use macro_authorization::{MacroAuthorizationExtractor, UserOrInternal};use model::response::ErrorResponse;@@ -16,7 +17,7 @@ use super::upsert::UpsertScheduledError;#[utoipa::path(delete, tag = "Draft Scheduling", path = "/email/drafts/scheduled/{message_id}",operation_id = "delete_scheduled_draft",- params(("message_id" = Uuid, Path, description = "The ID of the draft")),+ params(DraftEditPrecondition, ("message_id" = Uuid, Path, description = "The ID of the draft")),responses((status = 204, description = "Scheduled send deleted successfully"),(status = 400, body = ErrorResponse),@@ -28,6 +29,7 @@ use super::upsert::UpsertScheduledError;)]#[tracing::instrument(skip(ctx, authorization, link), err)]pub async fn handler(+ Query(precondition): Query<DraftEditPrecondition>,State(ctx): State<ApiContext>,Cached(authorization): Cached<MacroAuthorizationExtractor<AuthorizationService, UserOrInternal>,@@ -43,6 +45,7 @@ pub async fn handler(message_id,ScheduleChange::Cancel,None,+ precondition.draft_generation,).await?;Ok(StatusCode::NO_CONTENT)diff --git a/services/email_service/src/api/email/drafts/scheduled/upsert.rs b/services/email_service/src/api/email/drafts/scheduled/upsert.rsindex 9a2d4a6d02..8a4e137806 100644--- a/services/email_service/src/api/email/drafts/scheduled/upsert.rs+++ b/services/email_service/src/api/email/drafts/scheduled/upsert.rs@@ -1,6 +1,6 @@use crate::api::context::{ApiContext, AuthorizationService, EmailSvc};use axum::Json;-use axum::extract::{Path, State};+use axum::extract::{Path, Query, State};use axum::http::StatusCode;use axum::response::{IntoResponse, Response};use axum_extra::extract::Cached;@@ -8,6 +8,7 @@ use email::domain::{models::EmailErr,scheduled::{EmailSchedulingService, ScheduleChange},};+use email::inbound::axum::api_types::DraftEditPrecondition;use email::inbound::axum::axum_impls::EmailLinkExtractor;use macro_authorization::{MacroAuthorizationExtractor, UserOrInternal};use model::response::ErrorResponse;@@ -66,7 +67,7 @@ pub struct UpsertScheduledResponse {#[utoipa::path(put, tag = "Draft Scheduling", path = "/email/drafts/scheduled/{id}",operation_id = "upsert_scheduled_message",- params(("id" = Uuid, Path, description = "The ID of the draft message to schedule")),+ params(DraftEditPrecondition, ("id" = Uuid, Path, description = "The ID of the draft message to schedule")),request_body = UpsertScheduledRequest,responses((status = 200, body = UpsertScheduledResponse),@@ -79,6 +80,7 @@ pub struct UpsertScheduledResponse {)]#[tracing::instrument(skip(ctx, authorization, link), err)]pub async fn handler(+ Query(precondition): Query<DraftEditPrecondition>,State(ctx): State<ApiContext>,Cached(authorization): Cached<MacroAuthorizationExtractor<AuthorizationService, UserOrInternal>,@@ -95,6 +97,7 @@ pub async fn handler(draft_id,ScheduleChange::Set(request.send_time),request.include_signature,+ precondition.draft_generation,).await?;Ok(Json(UpsertScheduledResponse {diff --git a/services/email_service/src/api/email/drafts/transfer.rs b/services/email_service/src/api/email/drafts/transfer.rsindex 37000c9dde..86d7f9d8eb 100644--- a/services/email_service/src/api/email/drafts/transfer.rs+++ b/services/email_service/src/api/email/drafts/transfer.rs@@ -16,6 +16,9 @@ use uuid::Uuid;/// Reuse the same operation ID when retrying after a lost response.#[derive(Deserialize, ToSchema)]pub struct TransferDraftRequest {+ /// Generation captured with the source draft.+ #[serde(default)]+ pub draft_generation: i32,pub operation_id: Uuid,pub destination_link_id: Uuid,}@@ -43,6 +46,7 @@ pub async fn handler(.transfer(authorization.authorization.user.macro_user_id,email::domain::draft_transfer::DraftTransferRequest {+ draft_generation: request.draft_generation,id: request.operation_id,source_id,source_link_id: link.id,diff --git a/services/email_service/src/api/email/provider_error.rs b/services/email_service/src/api/email/provider_error.rsindex 7f2a6f50cb..4cbdb6b2f5 100644--- a/services/email_service/src/api/email/provider_error.rs+++ b/services/email_service/src/api/email/provider_error.rs@@ -27,6 +27,7 @@ pub(crate) fn provider_error_status(error: &EmailApiError) -> StatusCode {EmailApiError::Forbidden => StatusCode::FORBIDDEN,EmailApiError::NotFound => StatusCode::NOT_FOUND,EmailApiError::Conflict | EmailApiError::OutdatedCursor => StatusCode::CONFLICT,+ EmailApiError::SendRejected { .. } => StatusCode::BAD_REQUEST,EmailApiError::Transient { .. } | EmailApiError::Permanent { .. } => {StatusCode::INTERNAL_SERVER_ERROR}diff --git a/services/email_service/src/api/email/provider_error/test.rs b/services/email_service/src/api/email/provider_error/test.rsindex c35e9683c2..eef819cfd6 100644--- a/services/email_service/src/api/email/provider_error/test.rs+++ b/services/email_service/src/api/email/provider_error/test.rs@@ -18,6 +18,12 @@ fn maps_provider_errors_to_api_statuses() {(EmailApiError::Forbidden, StatusCode::FORBIDDEN),(EmailApiError::NotFound, StatusCode::NOT_FOUND),(EmailApiError::Conflict, StatusCode::CONFLICT),+ (+ EmailApiError::SendRejected {+ message: "message exceeds provider size limit".to_string(),+ },+ StatusCode::BAD_REQUEST,+ ),(EmailApiError::Transient {message: "provider unavailable".to_string(),diff --git a/services/email_service/src/outbound/scheduled_delivery.rs b/services/email_service/src/outbound/scheduled_delivery.rsindex f7f81a0ec5..92b9d00351 100644--- a/services/email_service/src/outbound/scheduled_delivery.rs+++ b/services/email_service/src/outbound/scheduled_delivery.rs@@ -1,26 +1,33 @@//! PostgreSQL and provider adapters for scheduled email delivery.use crate::outbound::email_api::GmailApi;use crate::util::gmail::send::{- cleanup_draft_attachments, fetch_and_attach_draft_attachments,- fetch_and_attach_forwarded_attachments, generate_email_threading_headers,+ attachment_snapshot::prepare_delivery_attachments, cleanup_draft_attachments,+ generate_email_threading_headers,};use anyhow::Context;use chrono::Utc;-use email::domain::events::{EmailEventOrigin, EmailMacroEvent, MessageSentMetadata};-use email::domain::scheduled_delivery::{ScheduledDeliveryRepo, ScheduledMessageSender};-use email_api_client::domain::models::{SendRequest, SentIds};-use email_db_client::messages::scheduled::get::get_and_start_processing_scheduled_message;+use email::domain::events::{+ EmailEventOrigin, EmailMacroEvent, MessageDeletedMetadata, MessageSentMetadata,+};+use email::domain::scheduled_delivery::{+ ClaimedDelivery, DELIVERY_LEASE_SECONDS, DeliveryMode, DeliveryPause,+ PREPARATION_RETRY_SECONDS, PreparationError, RECONCILIATION_DELAY_SECONDS,+ ScheduledDeliveryRepo, ScheduledMessageSender, SubmissionError,+ attachments::{ApprovedAttachments, AttachmentSnapshotMismatch},+};+use email::domain::send_attempt::{PreparedSendContentUnavailable, SendSnapshot};+use email_api_client::domain::models::{EmailApiError, PreparedSendMessage, SendRequest, SentIds};+use email_db_client::messages::scheduled::delivery::{self, DeliveryClaim};use macro_event_broker::{KafkaEventPublisher, MacroEventBroker, MacroEventBrokerService};use macro_user_id::cowlike::CowLike as _;use macro_user_id::user_id::MacroUserIdStr;-use models_email::service::{- attachment::AttachmentDraft,- link::Link,- message::{MessageToSend, ScheduledMessage},-};+use models_email::service::{attachment::AttachmentDraft, link::Link, message::MessageToSend};+use std::time::Instant;use tokio_util::task::TaskTracker;use uuid::Uuid;+mod content;+/// Concrete worker adapters, wired by the scheduled worker's composition root.pub struct ScheduledDeliveryAdapter {pub db: sqlx::PgPool,@@ -38,7 +45,7 @@ pub struct ScheduledDeliveryAdapter {/// Context obtained only by winning an atomic database claim.pub struct ScheduledClaim {link: Link,- schedule: ScheduledMessage,+ delivery: DeliveryClaim,}/// Provider result and attachment cleanup data retained until DB completion.@@ -51,11 +58,33 @@ impl ScheduledDeliveryRepo for ScheduledDeliveryAdapter {type Claim = ScheduledClaim;type Sent = SentDelivery;+ #[tracing::instrument(skip(self), err)]+ async fn reconcile_deletion(&self, link_id: Uuid, message_id: Uuid) -> anyhow::Result<()> {+ let Some(link) = email_db_client::links::get::fetch_link_by_id(&self.db, link_id).await?+ else {+ return Ok(());+ };+ if let Some(deleted) = email_db_client::messages::delete::reconcile_deferred_deletion(+ &self.db, link_id, message_id,+ )+ .await?+ {+ let _ = self.macro_event_broker.send_event(&EmailMacroEvent::message_deleted(MessageDeletedMetadata {+ link_id,+ owner: link.macro_id,+ message_id,+ provider_message_id: deleted.provider_id,+ thread_id: deleted.thread_id,+ })).inspect_err(|error| tracing::error!(error=?error, "failed to publish deferred email deletion"));+ }+ Ok(())+ }+async fn try_claim(&self,link_id: Uuid,message_id: Uuid,- ) -> anyhow::Result<Option<ScheduledClaim>> {+ ) -> anyhow::Result<Option<ClaimedDelivery<ScheduledClaim>>> {let Some(link) = email_db_client::links::get::fetch_link_by_id(&self.db, link_id).await?else {return Ok(None);@@ -69,28 +98,56 @@ impl ScheduledDeliveryRepo for ScheduledDeliveryAdapter {return Ok(None);}Ok(- get_and_start_processing_scheduled_message(&self.db, link_id, message_id)+ delivery::claim_delivery(&self.db, link_id, message_id, DELIVERY_LEASE_SECONDS).await?- .map(|schedule| ScheduledClaim { link, schedule }),+ .map(|delivery| {+ tracing::info!(event = "email_send.claim_acquired", %link_id, %message_id,+ claim_id = %delivery.token.0,+ reconcile = delivery.requires_reconciliation,+ send_lateness_ms = (Utc::now() - delivery.schedule.send_time).num_milliseconds().max(0),+ "email delivery claim acquired");+ ClaimedDelivery {+ mode: if delivery.requires_reconciliation {+ DeliveryMode::Reconcile+ } else {+ DeliveryMode::Send+ },+ claim: ScheduledClaim { link, delivery },+ }+ }),)}- async fn release(&self, claim: ScheduledClaim) -> anyhow::Result<()> {- email_db_client::messages::scheduled::upsert::clear_scheduled_message_processing(+ async fn begin_send(&self, claim: &ScheduledClaim) -> anyhow::Result<bool> {+ delivery::begin_submission(&self.db, &claim.delivery, DELIVERY_LEASE_SECONDS).await+ }++ async fn release(&self, claim: &ScheduledClaim) -> anyhow::Result<()> {+ delivery::release_preparation(&self.db, &claim.delivery, PREPARATION_RETRY_SECONDS).await+ }++ async fn pause(&self, claim: &ScheduledClaim, reason: DeliveryPause) -> anyhow::Result<()> {+ delivery::pause_delivery(&self.db,- claim.schedule.link_id,- claim.schedule.message_id,+ &claim.delivery,+ reason == DeliveryPause::Unconfirmed,+ RECONCILIATION_DELAY_SECONDS,)- .await?;- Ok(())+ .await}+ #[tracing::instrument(skip_all, fields(+ link_id = %claim.link.id,+ message_id = %claim.delivery.schedule.message_id,+ claim_id = %claim.delivery.token.0,+ ), err)]async fn complete(&self, claim: &ScheduledClaim, sent: SentDelivery) -> anyhow::Result<()> {+ let started = Instant::now();let ctx = self;let link = &claim.link;- let data = &claim.schedule;- let scheduled_message = &claim.schedule;- let message_to_send = sent.message;+ let data = &claim.delivery.schedule;+ let scheduled_message = &claim.delivery.schedule;+ let mut message_to_send = sent.message;let db_attachments = sent.attachments;let mut tx = ctx.db@@ -98,11 +155,33 @@ impl ScheduledDeliveryRepo for ScheduledDeliveryAdapter {.await.context("Failed to begin transaction")?;- let result = process_sent_message(tx.as_mut(), &message_to_send).await;+ email_db_client::threads::provider_identity::lock_provider_thread(+ tx.as_mut(),+ link.id,+ message_to_send+ .provider_thread_id+ .as_deref()+ .context("provider accepted send without a thread ID")?,+ )+ .await?;+ if !delivery::complete_delivery(tx.as_mut(), &claim.delivery).await? {+ tracing::info!(+ event = "email_send.completion_fenced",+ "stale claim cannot persist email completion"+ );+ return Ok(());+ }+ let result = process_sent_message(tx.as_mut(), &mut message_to_send).await;match result {Ok(_) => {tx.commit().await.context("Failed to commit transaction")?;+ tracing::info!(+ event = "email_send.database_committed",+ duration_ms = started.elapsed().as_millis() as u64,+ delivery_lateness_ms = (Utc::now() - data.send_time).num_milliseconds().max(0),+ "email delivery completion committed"+ );// Gmail accepted the send and the DB updates are committed:// publish the message_sent event resolving the earlier@@ -181,86 +260,185 @@ impl ScheduledDeliveryRepo for ScheduledDeliveryAdapter {}}+/// Fully prepared MIME and persistence data; contains no provider side effects.+pub struct PreparedDelivery {+ provider: PreparedSendMessage,+ delivery: SentDelivery,+}+impl ScheduledMessageSender<ScheduledClaim, SentDelivery> for ScheduledDeliveryAdapter {- async fn send_claimed(&self, claim: &ScheduledClaim) -> anyhow::Result<SentDelivery> {- let ctx = self;- let link = &claim.link;- let data = &claim.schedule;- // fetch message from db- let (mut message_to_send, sender_contact) =- email_db_client::messages::get::get_message_to_send(- &ctx.db,- data.message_id,- data.link_id,- )+ type Prepared = PreparedDelivery;++ async fn prepare(&self, claim: &ScheduledClaim) -> Result<PreparedDelivery, PreparationError> {+ self.prepare_delivery(claim).await- .context(format!(- "Failed to fetch message to gmail api for message_id {}",- data.message_id- ))?;+ .map_err(classify_preparation_error)+ }- // generate headers- let (parent_message_id, references) =- generate_email_threading_headers(&ctx.db, message_to_send.replying_to_id, data.link_id)- .await;-- // Include draft attachments (user-uploaded files from S3)- let db_attachments = fetch_and_attach_draft_attachments(- &ctx.db,- &ctx.s3_client,- ctx.attachment_bucket.as_str(),- link,- &mut message_to_send,+ async fn send_prepared(+ &self,+ _: &ScheduledClaim,+ mut prepared: PreparedDelivery,+ ) -> Result<SentDelivery, SubmissionError> {+ let ids = self+ .email_api+ .send_prepared(&prepared.provider)+ .await+ .map_err(classify_submission_error)?;+ apply_sent_ids(&mut prepared.delivery.message, ids);+ Ok(prepared.delivery)+ }++ async fn reconcile(&self, claim: &ScheduledClaim) -> anyhow::Result<Option<SentDelivery>> {+ let Some(header) = claim.delivery.message_id_header.as_deref() else {+ return Ok(None);+ };+ let Some(ids) = self+ .email_api+ .find_sent_message(claim.link.id, header)+ .await?+ else {+ return Ok(None);+ };+ let (mut message, _) = email_db_client::messages::get::get_message_to_send(+ &self.db,+ claim.delivery.schedule.message_id,+ claim.link.id,+ )+ .await?;+ apply_sent_ids(&mut message, ids);+ // Reconciliation loads cleanup metadata only, never attachment bytes.+ let attachments = email_db_client::attachments::draft::fetch_draft_attachments_by_draft_id(+ &self.db,+ claim.link.id,+ claim.delivery.schedule.message_id,).await?;+ Ok(Some(SentDelivery {+ message,+ attachments: Some(attachments),+ }))+ }+}- // Preserve delivery-time source inbox checks, including legacy jobs- // that have no actor attribution. Attachment bytes are resolved below- // through the provider-aware reader.+impl ScheduledDeliveryAdapter {+ #[tracing::instrument(skip_all, fields(+ link_id = %claim.link.id, message_id = %claim.delivery.schedule.message_id,+ claim_id = %claim.delivery.token.0, phase = "load_content",+ ), err)]+ async fn prepare_delivery(&self, claim: &ScheduledClaim) -> anyhow::Result<PreparedDelivery> {+ let data = &claim.delivery.schedule;+ let (mut message, sender_contact) =+ content::load_delivery_content(&self.db, &claim.delivery)+ .await+ .context("failed to load scheduled message")?;+ let (parent_message_id, references) =+ generate_email_threading_headers(&self.db, message.replying_to_id, data.link_id).await;+ let approved = claim+ .delivery+ .approved_snapshot+ .as_ref()+ .map(|snapshot| serde_json::from_value::<SendSnapshot>(snapshot.clone()))+ .transpose()?+ .as_ref()+ .map(ApprovedAttachments::from)+ .unwrap_or(serde_json::from_value(+ claim.delivery.approved_attachments.clone(),+ )?);+ tracing::Span::current().record("phase", "attachments");+ let started = Instant::now();let actor = data.actor_id.as_deref().and_then(|actor| MacroUserIdStr::parse_from_str(actor).ok());- ctx.forwarded_attachments- .for_delivery(actor.as_ref(), link.id, data.message_id)+ self.forwarded_attachments+ .for_delivery(actor.as_ref(), claim.link.id, data.message_id).await?;-- // Include forwarded and imported-draft attachments.- fetch_and_attach_forwarded_attachments(- &ctx.db,- ctx.attachment_bytes.as_ref(),+ let attachments = prepare_delivery_attachments(+ &self.db,+ &self.s3_client,+ self.attachment_bytes.as_ref(),data.actor_id.as_deref()- .unwrap_or_else(|| link.macro_id.as_ref()),- link,- &mut message_to_send,+ .unwrap_or_else(|| claim.link.macro_id.as_ref()),+ &self.attachment_bucket,+ &mut message,+ Some(&approved),).await?;-- let send_request = SendRequest {- message: message_to_send.clone(),+ tracing::info!(+ event = "email_send.attachments_prepared",+ duration_ms = started.elapsed().as_millis() as u64,+ "approved email attachments prepared"+ );+ tracing::Span::current().record("phase", "mime_and_credentials");+ let started = Instant::now();+ let request = SendRequest {+ message: message.clone(),from: sender_contact,parent_message_id,references,+ message_id: claim.delivery.message_id_header.clone(),};- let sent_ids = ctx+ let provider = self.email_api- .send_message(- link.id,- &send_request,- message_to_send.provider_thread_id.as_deref(),+ .prepare_send(+ claim.link.id,+ &request,+ message.provider_thread_id.as_deref(),+ )+ .await?;+ tracing::info!(+ event = "email_send.mime_prepared",+ duration_ms = started.elapsed().as_millis() as u64,+ "email MIME and provider credentials prepared"+ );+ // The opaque provider request owns MIME, so raw attachment buffers need+ // not be retained while the provider call is in flight.+ message.attachments = None;+ Ok(PreparedDelivery {+ provider,+ delivery: SentDelivery {+ message,+ attachments,+ },+ })+ }+}++fn classify_preparation_error(error: anyhow::Error) -> PreparationError {+ if error.is::<AttachmentSnapshotMismatch>()+ || error.is::<PreparedSendContentUnavailable>()+ || error.downcast_ref::<email::domain::forwarded_attachments::ForwardedAttachmentError>().is_some_and(|error| matches!(error, email::domain::forwarded_attachments::ForwardedAttachmentError::DraftNotFound | email::domain::forwarded_attachments::ForwardedAttachmentError::AttachmentNotFound))+ || error.downcast_ref::<EmailApiError>().is_some_and(|error| {+ matches!(+ error,+ EmailApiError::AuthRequired+ | EmailApiError::Forbidden+ | EmailApiError::NotFound+ | EmailApiError::Conflict+ | EmailApiError::SendRejected { .. }+ | EmailApiError::Permanent { .. })- .await- .context(format!(- "Failed to send message to gmail api for message_id {}",- data.message_id- ))?;- apply_sent_ids(&mut message_to_send, sent_ids);-- Ok(SentDelivery {- message: message_to_send,- attachments: db_attachments,})+ {+ PreparationError::Failed(error)+ } else {+ PreparationError::Retry(error)+ }+}++fn classify_submission_error(error: EmailApiError) -> SubmissionError {+ // Transport failures, server failures, and malformed success responses+ // cannot establish that Gmail refused delivery.+ match error {+ EmailApiError::AuthRequired+ | EmailApiError::Forbidden+ | EmailApiError::NotFound+ | EmailApiError::Conflict+ | EmailApiError::SendRejected { .. }+ | EmailApiError::RateLimited { .. } => SubmissionError::Rejected(error.into()),+ _ => SubmissionError::Uncertain(error.into()),}}@@ -286,29 +464,39 @@ fn apply_sent_ids(message: &mut MessageToSend, sent_ids: SentIds) {)]async fn process_sent_message(tx: &mut sqlx::PgConnection,- message: &MessageToSend,+ message: &mut MessageToSend,) -> anyhow::Result<()> {- // mark message as non-draft- email_db_client::messages::update::mark_message_as_sent(+ email_db_client::messages::sent_identity::reconcile_message(tx.as_mut(),- &message.provider_id.clone().unwrap_or_default(),- &message.provider_thread_id.clone().unwrap_or_default(),message.link_id,- message.db_id.unwrap(),+ message.db_id.context("sent message has no local ID")?,+ message+ .provider_id+ .as_deref()+ .context("sent message has no provider ID")?,).await?;- // mark scheduled message as sent- let finalized = email_db_client::messages::scheduled::upsert::mark_scheduled_message_as_sent(+ let thread_db_id = email_db_client::threads::provider_identity::reconcile_sent_thread(tx.as_mut(),message.link_id,+ message.db_id.context("sent message has no local ID")?,+ message+ .provider_thread_id+ .as_deref()+ .context("sent message has no provider thread ID")?,+ )+ .await?;+ message.thread_db_id = Some(thread_db_id);+ // mark message as non-draft+ email_db_client::messages::update::mark_message_as_sent(+ tx.as_mut(),+ &message.provider_id.clone().unwrap_or_default(),+ &message.provider_thread_id.clone().unwrap_or_default(),+ message.link_id,message.db_id.unwrap(),).await?;- anyhow::ensure!(finalized, "scheduled delivery claim no longer exists");-- // safe as it was fetched from the database - message is only inserted once thread is created- let thread_db_id = message.thread_db_id.unwrap();// set provider id of thread - needed in case it's a thread with no other messages, as it wouldn't// have a provider id yet@@ -327,6 +515,8 @@ async fn process_sent_message().await?;+ email_db_client::threads::update::sync_thread_calendar_flag(tx.as_mut(), thread_db_id).await?;+Ok(())}diff --git a/services/email_service/src/outbound/scheduled_delivery/content.rs b/services/email_service/src/outbound/scheduled_delivery/content.rsnew file mode 100644index 0000000000..34541670a3--- /dev/null+++ b/services/email_service/src/outbound/scheduled_delivery/content.rs@@ -0,0 +1,62 @@+//! Reconstruct approved GraphQL delivery without consulting mutable message content.++use email::domain::send_attempt::{PreparedSendContent, PreparedSendContentUnavailable};+use email_db_client::messages::scheduled::delivery::DeliveryClaim;+use models_email::service::{address::ContactInfo, message::MessageToSend};+use sqlx::PgPool;++pub(super) async fn load_delivery_content(+ db: &PgPool,+ claim: &DeliveryClaim,+) -> anyhow::Result<(MessageToSend, ContactInfo)> {+ if claim.approved_snapshot.is_none() {+ return email_db_client::messages::get::get_message_to_send(+ db,+ claim.schedule.message_id,+ claim.schedule.link_id,+ )+ .await;+ }+ let content = claim+ .prepared_content+ .as_ref()+ .ok_or(PreparedSendContentUnavailable)?;+ let content: PreparedSendContent =+ serde_json::from_value(content.clone()).map_err(|_| PreparedSendContentUnavailable)?;+ if content.message.db_id != claim.schedule.message_id {+ return Err(PreparedSendContentUnavailable.into());+ }+ let message = content.message;+ Ok((+ MessageToSend {+ db_id: Some(message.db_id),+ provider_id: message.provider_id,+ replying_to_id: message.replying_to_id,+ provider_thread_id: message.provider_thread_id,+ thread_db_id: Some(message.thread_db_id),+ link_id: claim.schedule.link_id,+ subject: message.subject,+ to: Some(message.to.into_iter().map(contact).collect()),+ cc: Some(message.cc.into_iter().map(contact).collect()),+ bcc: Some(message.bcc.into_iter().map(contact).collect()),+ body_text: message.body_text,+ body_html: message.body_html,+ body_macro: message.body_macro,+ attachments: None,+ headers_json: message.headers_json,+ send_time: message.send_time,+ },+ contact(content.sender),+ ))+}++fn contact(value: email::domain::models::ContactInfo) -> ContactInfo {+ ContactInfo {+ email: value.email,+ name: value.name,+ photo_url: value.photo_url,+ }+}++#[cfg(test)]+mod test;diff --git a/services/email_service/src/outbound/scheduled_delivery/content/test.rs b/services/email_service/src/outbound/scheduled_delivery/content/test.rsnew file mode 100644index 0000000000..5f2ffccfbb--- /dev/null+++ b/services/email_service/src/outbound/scheduled_delivery/content/test.rs@@ -0,0 +1,210 @@+use super::*;+use email::domain::{+ models::{+ ContactInfo as DomainContact, CreateDraftInput, RecipientType, ResolvedDraftInput,+ UpsertedContacts, UpsertedRecipient,+ },+ send_attempt::{EmailSendRepo, PreparedSend, SendAttemptId, SendSnapshot},+};+use email::outbound::EmailPgRepo;+use email_db_client::messages::scheduled::delivery::claim_delivery;+use macro_db_migrator::MACRO_DB_MIGRATIONS;+use macro_user_id::user_id::MacroUserIdStr;+use uuid::Uuid;++fn link() -> Uuid {+ Uuid::parse_str("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa").unwrap()+}+fn message() -> Uuid {+ Uuid::parse_str("ee000002-0000-0000-0000-000000000002").unwrap()+}++async fn admit(pool: &PgPool) -> anyhow::Result<SendAttemptId> {+ let to = DomainContact {+ email: "[email protected]".into(),+ name: Some("Approved recipient".into()),+ photo_url: None,+ };+ let message = ResolvedDraftInput {+ draft_generation: 0,+ db_id: message(),+ provider_id: Some("provider-draft".into()),+ replying_to_id: None,+ provider_thread_id: Some("approved-provider-thread".into()),+ thread_db_id: Uuid::parse_str("11111111-1111-1111-1111-111111111111").unwrap(),+ subject: "Approved subject".into(),+ to: vec![to.clone()],+ cc: vec![],+ bcc: vec![],+ body_text: Some("Approved body and signature".into()),+ body_html: Some("<p>Approved body</p><p>Frozen signature</p>".into()),+ body_macro: Some("approved editor state".into()),+ headers_json: None,+ send_time: Some(chrono::Utc::now()),+ actor_id: None,+ draft_client_id: None,+ thread_client_id: None,+ };+ let snapshot = SendSnapshot {+ message: CreateDraftInput {+ frozen_signature_html: None,+ draft_generation: 0,+ sender_email: None,+ db_id: Some(message.db_id),+ provider_id: message.provider_id.clone(),+ replying_to_id: None,+ provider_thread_id: message.provider_thread_id.clone(),+ thread_db_id: Some(message.thread_db_id),+ subject: message.subject.clone(),+ to: vec![to],+ cc: vec![],+ bcc: vec![],+ body_text: Some("Approved body".into()),+ body_html: None,+ body_macro: None,+ headers_json: None,+ send_time: None,+ include_signature: None,+ actor: None,+ draft_client_binding: None,+ thread_client_binding: None,+ },+ attachment_ids: vec![],+ forwarded_attachment_ids: vec![],+ restore_body_html: None,+ restore_body_text: None,+ restore_body_macro: None,+ };+ let attempt = SendAttemptId(macro_uuid::generate_uuid_v7());+ EmailPgRepo::new(pool.clone())+ .admit_send(+ &MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),+ link(),+ attempt,+ PreparedSend {+ source_inbox: None,+ undo_delay_secs: 0,+ snapshot,+ message,+ contacts: UpsertedContacts {+ from_contact_id: Some(+ Uuid::parse_str("c0000001-0000-0000-0000-000000000001").unwrap(),+ ),+ recipients: vec![UpsertedRecipient {+ contact_id: Uuid::parse_str("c0000002-0000-0000-0000-000000000002")+ .unwrap(),+ name: Some("Approved recipient".into()),+ recipient_type: RecipientType::To,+ }],+ },+ new_thread: None,+ restore_html: None,+ restore_text: None,+ restore_macro: None,+ },+ )+ .await?;+ Ok(attempt)+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../../../crates/email/fixtures",+ scripts("email_draft")+ )+)]+async fn provider_sync_cannot_replace_approved_body_envelope_or_sender(+ pool: PgPool,+) -> anyhow::Result<()> {+ let attempt = admit(&pool).await?;+ sqlx::query!(+ "UPDATE email_messages SET subject = 'Changed subject', body_text = 'Changed body', body_html_sanitized = '<p>Changed</p>', provider_thread_id = 'changed-thread' WHERE id = $1",+ message(),+ ).execute(&pool).await?;+ sqlx::query!("UPDATE email_contacts SET email_address = id::text || '@changed.example', name = 'Changed contact' WHERE link_id = $1", link()).execute(&pool).await?;+ sqlx::query!(+ "DELETE FROM email_message_recipients WHERE message_id = $1",+ message()+ )+ .execute(&pool)+ .await?;+ let claim = claim_delivery(&pool, link(), message(), 300)+ .await?+ .unwrap();+ let (prepared, sender) = load_delivery_content(&pool, &claim).await?;+ assert_eq!(prepared.subject, "Approved subject");+ assert_eq!(+ prepared.body_text.as_deref(),+ Some("Approved body and signature")+ );+ assert_eq!(+ prepared.body_html.as_deref(),+ Some("<p>Approved body</p><p>Frozen signature</p>")+ );+ assert_eq!(prepared.to.unwrap()[0].email, "[email protected]");+ assert_eq!(+ prepared.provider_thread_id.as_deref(),+ Some("approved-provider-thread")+ );+ assert_eq!(sender.email, "[email protected]");+ assert_eq!(sender.name.as_deref(), Some("Alice Smith"));+ let raw = sqlx::query_scalar!(+ "SELECT request FROM email_send_attempts WHERE attempt_id = $1",+ attempt.0+ )+ .fetch_one(&pool)+ .await?+ .unwrap();+ assert_eq!(raw["message"]["body_text"], "Approved body");+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../../../crates/email/fixtures",+ scripts("email_draft")+ )+)]+async fn older_graphql_attempt_without_prepared_content_requires_review(+ pool: PgPool,+) -> anyhow::Result<()> {+ let attempt = admit(&pool).await?;+ sqlx::query!(+ "UPDATE email_send_attempts SET prepared_content = NULL WHERE attempt_id = $1",+ attempt.0+ )+ .execute(&pool)+ .await?;+ let claim = claim_delivery(&pool, link(), message(), 300)+ .await?+ .unwrap();+ let error = load_delivery_content(&pool, &claim).await.unwrap_err();+ assert!(matches!(+ super::super::classify_preparation_error(error),+ email::domain::scheduled_delivery::PreparationError::Failed(_)+ ));+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../../../crates/email_db_client/fixtures",+ scripts("get_process_scheduled_messages")+ )+)]+async fn legacy_rest_delivery_still_loads_current_message(pool: PgPool) -> anyhow::Result<()> {+ let link = Uuid::parse_str("00000000-0000-0000-0000-000000000e01").unwrap();+ let message = Uuid::parse_str("00000000-0000-0000-0000-00000000e501").unwrap();+ let claim = claim_delivery(&pool, link, message, 300).await?.unwrap();+ assert!(claim.approved_snapshot.is_none());+ let (prepared, sender) = load_delivery_content(&pool, &claim).await?;+ assert_eq!(+ prepared.provider_id.as_deref(),+ Some("provider-scheduled-501")+ );+ assert_eq!(sender.email, "[email protected]");+ Ok(())+}diff --git a/services/email_service/src/outbound/scheduled_delivery/test.rs b/services/email_service/src/outbound/scheduled_delivery/test.rsindex 3f23e3b200..747f07210d 100644--- a/services/email_service/src/outbound/scheduled_delivery/test.rs+++ b/services/email_service/src/outbound/scheduled_delivery/test.rs@@ -1,8 +1,62 @@-use email_api_client::domain::models::SentIds;+use email::domain::scheduled_delivery::{PreparationError, SubmissionError};+use email_api_client::domain::models::{EmailApiError, RateLimitOrigin, SentIds};+use macro_db_migrator::MACRO_DB_MIGRATIONS;use models_email::service::message::MessageToSend;use uuid::Uuid;-use super::apply_sent_ids;+use super::{apply_sent_ids, classify_preparation_error, classify_submission_error};++#[test]+fn response_decode_failure_is_ambiguous_only_after_submission() {+ let error = EmailApiError::Permanent {+ message: "invalid provider response".into(),+ };+ assert!(matches!(+ classify_preparation_error(error.clone().into()),+ PreparationError::Failed(_)+ ));+ assert!(matches!(+ classify_submission_error(error),+ SubmissionError::Uncertain(_)+ ));+}++#[test]+fn transient_failure_can_retry_only_before_submission() {+ let error = EmailApiError::Transient {+ message: "request timed out".into(),+ };+ assert!(matches!(+ classify_preparation_error(error.clone().into()),+ PreparationError::Retry(_)+ ));+ assert!(matches!(+ classify_submission_error(error),+ SubmissionError::Uncertain(_)+ ));+}++#[test]+fn explicit_provider_refusal_is_safe_to_restore() {+ for error in [+ EmailApiError::AuthRequired,+ EmailApiError::Forbidden,+ EmailApiError::NotFound,+ EmailApiError::Conflict,+ EmailApiError::SendRejected {+ message: "message exceeded the provider size limit".into(),+ },+ EmailApiError::RateLimited {+ retry_after: None,+ origin: RateLimitOrigin::Provider,+ },+ ] {+ assert!(matches!(+ classify_submission_error(error),+ SubmissionError::Rejected(_)+ ));+ }+}#[test]fn sent_ids_are_written_back_for_existing_persistence_flow() {@@ -43,3 +97,93 @@ fn message_to_send() -> MessageToSend {send_time: None,}}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../../crates/email_db_client/fixtures",+ scripts("mark_message_as_sent")+ )+)]+async fn recovered_completion_publishes_canonical_thread_and_keeps_message_identity(+ pool: sqlx::PgPool,+) -> anyhow::Result<()> {+ let link = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000001);+ let original_thread = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000101);+ let canonical_thread = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000102);+ let original_message = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000201);+ let imported_message = Uuid::from_u128(0x019a0000_0000_7000_8000_000000000202);+ sqlx::query!(+ "INSERT INTO email_scheduled_messages (link_id, message_id, send_time) VALUES ($1, $2, NOW() - INTERVAL '1 second')",+ link, original_message,+ ).execute(&pool).await?;+ let claim = super::delivery::claim_delivery(&pool, link, original_message, 300)+ .await?+ .unwrap();+ assert!(super::delivery::begin_submission(&pool, &claim, 300).await?);+ sqlx::query!(+ "UPDATE email_threads SET provider_id = 'confirmed-thread' WHERE id = $1",+ canonical_thread,+ )+ .execute(&pool)+ .await?;+ sqlx::query!(+ "UPDATE email_messages SET provider_id = 'confirmed-message', provider_thread_id = 'confirmed-thread', is_sent = TRUE WHERE id = $1",+ imported_message,+ ).execute(&pool).await?;+ let mut sent = message_to_send();+ sent.db_id = Some(original_message);+ sent.thread_db_id = Some(original_thread);+ sent.link_id = link;+ apply_sent_ids(+ &mut sent,+ SentIds {+ provider_message_id: "confirmed-message".into(),+ provider_thread_id: "confirmed-thread".into(),+ },+ );+ let mut tx = pool.begin().await?;+ email_db_client::threads::provider_identity::lock_provider_thread(+ &mut tx,+ link,+ "confirmed-thread",+ )+ .await?;+ assert!(super::delivery::complete_delivery(&mut tx, &claim).await?);+ super::process_sent_message(&mut tx, &mut sent).await?;+ tx.commit().await?;++ // The worker publishes its message_sent event from this updated value.+ assert_eq!(sent.db_id, Some(original_message));+ assert_eq!(sent.thread_db_id, Some(canonical_thread));+ let persisted = sqlx::query!(+ "SELECT id, thread_id, is_sent FROM email_messages WHERE link_id = $1 AND provider_id = 'confirmed-message'",+ link,+ ).fetch_one(&pool).await?;+ assert_eq!(persisted.id, original_message);+ assert_eq!(persisted.thread_id, canonical_thread);+ assert!(persisted.is_sent);+ assert!(+ sqlx::query_scalar!(+ "SELECT sent FROM email_scheduled_messages WHERE message_id = $1",+ original_message,+ )+ .fetch_one(&pool)+ .await?+ );+ Ok(())+}++#[test]+fn missing_forwarded_sources_fail_before_provider_submission() {+ use email::domain::forwarded_attachments::ForwardedAttachmentError;+ for error in [+ ForwardedAttachmentError::DraftNotFound,+ ForwardedAttachmentError::AttachmentNotFound,+ ] {+ assert!(matches!(+ classify_preparation_error(error.into()),+ PreparationError::Failed(_)+ ));+ }+}diff --git a/services/email_service/src/pubsub/backfill/email_api_error.rs b/services/email_service/src/pubsub/backfill/email_api_error.rsindex 080499cf06..4f9cddc12e 100644--- a/services/email_service/src/pubsub/backfill/email_api_error.rs+++ b/services/email_service/src/pubsub/backfill/email_api_error.rs@@ -15,6 +15,7 @@ pub(crate) fn map_email_api_error(error: EmailApiError, context: &'static str) -| EmailApiError::NotFound| EmailApiError::Conflict| EmailApiError::Transient { .. }+ | EmailApiError::SendRejected { .. }| EmailApiError::Permanent { .. } => FailureReason::GmailApiFailed,};let is_retryable = error.is_transient();diff --git a/services/email_service/src/pubsub/gmail_ops/email_api_error.rs b/services/email_service/src/pubsub/gmail_ops/email_api_error.rsindex e187dfb2d3..2140963c84 100644--- a/services/email_service/src/pubsub/gmail_ops/email_api_error.rs+++ b/services/email_service/src/pubsub/gmail_ops/email_api_error.rs@@ -31,6 +31,7 @@ fn error_policy(error: &EmailApiError) -> ErrorPolicy {| EmailApiError::NotFound| EmailApiError::Conflict| EmailApiError::OutdatedCursor+ | EmailApiError::SendRejected { .. }| EmailApiError::Permanent { .. } => ErrorPolicy::Permanent,}}@@ -95,6 +96,7 @@ fn processing_error(error: EmailApiError, retryable: bool) -> ProcessingError {| EmailApiError::NotFound| EmailApiError::Conflict| EmailApiError::Transient { .. }+ | EmailApiError::SendRejected { .. }| EmailApiError::Permanent { .. } => FailureReason::GmailApiFailed,};let detail = DetailedError {diff --git a/services/email_service/src/pubsub/inbox_sync/email_api_error.rs b/services/email_service/src/pubsub/inbox_sync/email_api_error.rsindex e1cd79702d..682629d318 100644--- a/services/email_service/src/pubsub/inbox_sync/email_api_error.rs+++ b/services/email_service/src/pubsub/inbox_sync/email_api_error.rs@@ -92,6 +92,7 @@ fn detail(error: EmailApiError) -> DetailedError {| EmailApiError::NotFound| EmailApiError::Conflict| EmailApiError::Transient { .. }+ | EmailApiError::SendRejected { .. }| EmailApiError::Permanent { .. } => FailureReason::GmailApiFailed,};DetailedError {diff --git a/services/email_service/src/pubsub/inbox_sync/operations/delete_message.rs b/services/email_service/src/pubsub/inbox_sync/operations/delete_message.rsindex 1f97e06bea..f164884fc3 100644--- a/services/email_service/src/pubsub/inbox_sync/operations/delete_message.rs+++ b/services/email_service/src/pubsub/inbox_sync/operations/delete_message.rs@@ -18,14 +18,23 @@ pub async fn delete_message(link: &link::Link,payload: &DeleteMessagePayload,) -> result::Result<(), ProcessingError> {- let message = match email_db_client::messages::get_simple_messages::get_simple_message_by_provider_and_link(- &ctx.db,+ let mut tx = ctx.db.begin().await.map_err(|e| {+ ProcessingError::Retryable(DetailedError {+ reason: FailureReason::DatabaseQueryFailed,+ source: anyhow::Error::from(e).context("Failed to begin transaction"),+ })+ })?;+ // Keep the provider identity and draft lifetime stable through deletion.+ // A completion or Undo that wins the message lock is observed by this lookup;+ // one that loses waits until deletion has been applied or safely deferred.+ let message = match email_db_client::messages::get_simple_messages::get_simple_message_by_provider_and_link_for_update(+ &mut tx,&payload.provider_message_id,&link.id,).await.map_err(|e| {- ProcessingError::NonRetryable(DetailedError {+ ProcessingError::Retryable(DetailedError {reason: FailureReason::DatabaseQueryFailed,source: e.context("Failed to get simple message".to_string()),})@@ -47,7 +56,7 @@ pub async fn delete_message(Vec::new()} else if message.is_sent {let recipients =- email_db_client::contacts::get::fetch_db_recipients(&ctx.db, message.db_id)+ email_db_client::contacts::get::fetch_db_recipients(&mut *tx, message.db_id).await.map_err(|e| {ProcessingError::Retryable(DetailedError {@@ -67,7 +76,7 @@ pub async fn delete_message(// Received: the sender is the external party that may have a// CRM source row tied to this link.let sender =- email_db_client::contacts::get::get_sender_by_message_id(&ctx.db, message.db_id)+ email_db_client::contacts::get::get_sender_by_message_id(&mut *tx, message.db_id).await.map_err(|e| {ProcessingError::Retryable(DetailedError {@@ -78,25 +87,14 @@ pub async fn delete_message(sender.into_iter().filter_map(|c| c.email_address).collect()};- // Record CRM cleanup candidates BEFORE the delete commits, so a- // transient insert failure here doesn't strand the teardown after the- // message row is already gone (SQS retry would then short-circuit at- // the `None` arm above and never re-record). If the insert succeeds- // but the delete below fails, the nightly cleanup job's- // `link_has_any_message_with` pre-check sees the message still in- // place and skips — so the ordering is safe in both directions.+ // Commit CRM cleanup candidates with the deletion so neither can survive+ // a rollback alone. Deferred deletions retain the message; cleanup's+ // `link_has_any_message_with` pre-check keeps its contacts until removal.if !crm_emails.is_empty() {let self_email = link.email_address.0.as_ref().to_ascii_lowercase();- insert_crm_cleanup_candidates(ctx, link.id, &self_email, crm_emails).await?;+ insert_crm_cleanup_candidates(&mut *tx, link.id, &self_email, crm_emails).await?;}- let mut tx = ctx.db.begin().await.map_err(|e| {- ProcessingError::Retryable(DetailedError {- reason: FailureReason::DatabaseQueryFailed,- source: anyhow::Error::from(e).context("Failed to begin transaction"),- })- })?;-let result = async {let result = email_db_client::messages::delete::delete_message_with_tx(&mut tx, &message).await@@ -111,6 +109,11 @@ pub async fn delete_message(.await;let deletion = complete_transaction_with_processing_error(tx, result).await?;+ if deletion == MessageDeletion::Deferred {+ tracing::info!(event = "email_send.deletion_deferred", message_id = %message.db_id,+ link_id = %link.id, "retained message for accepted delivery");+ return Ok(());+ }if deletion == MessageDeletion::AlreadyDeleted {tracing::debug!(message_id = %message.db_id,diff --git a/services/email_service/src/pubsub/util.rs b/services/email_service/src/pubsub/util.rsindex 77b0ee649c..565c2c699d 100644--- a/services/email_service/src/pubsub/util.rs+++ b/services/email_service/src/pubsub/util.rs@@ -285,15 +285,18 @@ pub async fn enqueue_populate_crm_contacts(/// The unique `(link_id, contact_email)` index collapses bulk deletes into a/// single pending row; the nightly cleanup job sweeps the table and/// depopulates contacts whose links no longer have messages with them.-pub async fn insert_crm_cleanup_candidates(- ctx: &PubSubContext,+pub async fn insert_crm_cleanup_candidates<'e, E>(+ executor: E,link_id: Uuid,self_email: &str,contact_emails: impl IntoIterator<Item = String>,-) -> Result<(), ProcessingError> {+) -> Result<(), ProcessingError>+where+ E: sqlx::Executor<'e, Database = sqlx::Postgres>,+{let emails = normalized_non_self_contact_emails(self_email, contact_emails);- email_db_client::crm_cleanup::candidates::insert_candidates(&ctx.db, link_id, &emails)+ email_db_client::crm_cleanup::candidates::insert_candidates(executor, link_id, &emails).await.map_err(|e| {ProcessingError::Retryable(DetailedError {diff --git a/services/email_service/src/util/gmail/send.rs b/services/email_service/src/util/gmail/send.rsindex ac0932b6ad..4980284b72 100644--- a/services/email_service/src/util/gmail/send.rs+++ b/services/email_service/src/util/gmail/send.rs@@ -1,9 +1,7 @@-use anyhow::Context;-use email::domain::attachment_access::AuthorizedAttachmentBytes;-use futures::{StreamExt, TryStreamExt};-use models_email::service::attachment::{AttachmentDraft, AttachmentToSend};-use models_email::service::link::Link;-use models_email::service::message;+/// Frozen attachment metadata and payload preparation for delivery.+pub mod attachment_snapshot;++use models_email::service::attachment::AttachmentDraft;use sqlx::PgPool;use uuid::Uuid;@@ -56,139 +54,6 @@ pub async fn generate_email_threading_headers(}}-/// Fetch any attachments the user previously added to the draft from s3 and attach them to the message-/// being sent. Return the attachment metadata so we can use it to delete the attachments from s3-/// after the message is sent.-#[tracing::instrument(- skip(db, s3_client, message_to_send),- fields(message_db_id = ?message_to_send.db_id)-)]-pub async fn fetch_and_attach_draft_attachments(- db: &sqlx::PgPool,- s3_client: &s3_client::S3,- bucket: &str,- link: &Link,- message_to_send: &mut message::MessageToSend,-) -> anyhow::Result<Option<Vec<AttachmentDraft>>> {- if let Some(db_id) = message_to_send.db_id {- let db_attachments =- email_db_client::attachments::draft::fetch_draft_attachments_by_draft_id(- db, link.id, db_id,- )- .await- .context("unable to fetch draft attachments from database")?;-- if !db_attachments.is_empty() {- let fetch_futures = db_attachments.iter().map(|db_attachment| async move {- anyhow::ensure!(- !db_attachment.upload_pending,- "Attachment upload is unfinished"- );- let attachment_data = s3_client- .get(bucket, &db_attachment.s3_key)- .await- .with_context(|| {- format!(- "Failed to fetch attachment from S3 (key: {})",- db_attachment.s3_key- )- })?;-- Ok::<AttachmentToSend, anyhow::Error>(AttachmentToSend {- content_id: db_attachment.content_id.clone(),- is_inline: db_attachment.is_inline,- file_name: db_attachment.file_name.clone(),- content_type: db_attachment.content_type.clone(),- data: attachment_data,- })- });-- let attachments_to_send = futures::future::try_join_all(fetch_futures).await?;-- message_to_send.attachments = Some(attachments_to_send);- return Ok(Some(db_attachments));- }- }- Ok(None)-}--/// Resolve forwarded and imported-draft files with their source inbox credentials and current actor access.-#[tracing::instrument(- skip(db, reader, actor, message_to_send),- fields(message_db_id = ?message_to_send.db_id), err-)]-pub async fn fetch_and_attach_forwarded_attachments(- db: &PgPool,- reader: &dyn AuthorizedAttachmentBytes,- actor: &str,- link: &Link,- message_to_send: &mut message::MessageToSend,-) -> anyhow::Result<()> {- let Some(db_id) = message_to_send.db_id else {- return Ok(());- };-- // Include native attachments on imported drafts, while deduplicating the- // provider copies of Macro uploads/forwarded files and honoring removals.- let attachment_ids=sqlx::query_scalar!(r#"SELECT a.id AS "id!" FROM email_attachments a- JOIN email_messages m ON m.id=a.message_id WHERE m.id=$1 AND m.link_id=$2- AND NOT EXISTS(SELECT 1 FROM email_draft_attachment_removals r WHERE r.message_id=m.id AND (r.provider_id=a.provider_attachment_id OR trim(both '<>' from r.content_id)=trim(both '<>' from a.content_id)))- AND NOT EXISTS(SELECT 1 FROM email_attachments_drafts u WHERE u.draft_id=m.id AND trim(both '<>' from a.content_id)=COALESCE(trim(both '<>' from u.content_id),u.id::text||'@attachments.macro.com'))- AND NOT EXISTS(SELECT 1 FROM email_attachments_fwd f JOIN email_attachments original ON original.id=f.attachment_id WHERE f.message_id=m.id AND (trim(both '<>' from a.content_id)=trim(both '<>' from original.content_id) OR trim(both '<>' from a.content_id)=f.attachment_id::text||'@attachments.macro.com'))- UNION SELECT f.attachment_id FROM email_attachments_fwd f JOIN email_messages m ON m.id=f.message_id WHERE m.id=$1 AND m.link_id=$2"#,db_id,link.id).fetch_all(db).await?;- if attachment_ids.is_empty() {- return Ok(());- }-- let html = message_to_send.body_html.as_deref();- let forwarded_to_send =- futures::stream::iter(attachment_ids.into_iter().map(|attachment_id| async move {- let (record, data) = reader.read(actor, attachment_id).await?;- let content_id = record- .attachment- .content_id- .map(|cid| cid.trim_matches(['<', '>']).to_owned());- let is_inline = content_id- .as_deref()- .is_some_and(|cid| html.is_some_and(|body| body.contains(&format!("cid:{cid}"))));- Ok::<AttachmentToSend, anyhow::Error>(AttachmentToSend {- content_id,- is_inline,- file_name: record- .attachment- .filename- .unwrap_or_else(|| "attachment".into()),- content_type: record- .attachment- .mime_type- .unwrap_or_else(|| "application/octet-stream".into()),- data,- })- }))- .buffered(4)- .try_collect::<Vec<_>>()- .await?;-- let total = message_to_send- .attachments- .as_ref()- .into_iter()- .flatten()- .chain(forwarded_to_send.iter())- .map(|file| file.data.len())- .sum::<usize>();- anyhow::ensure!(- total <= 18_000_000,- "Combined attachment size exceeds Gmail's upload limit"- );- match &mut message_to_send.attachments {- Some(existing) => existing.extend(forwarded_to_send),- None => message_to_send.attachments = Some(forwarded_to_send),- }-- Ok(())-}-/// Release upload references; the shared cleanup worker preserves every remaining draft or blob reference.#[tracing::instrument(skip_all)]pub async fn cleanup_draft_attachments(@@ -201,7 +66,7 @@ pub async fn cleanup_draft_attachments(let mut tx=db.begin().await?;for attachment in attachments {sqlx::query!("INSERT INTO email_draft_object_cleanup(object_key,available_at) VALUES($1,now()+interval '1 day') ON CONFLICT DO NOTHING",attachment.s3_key).execute(&mut *tx).await?;- email_db_client::attachments::draft::delete_draft_attachment(&mut *tx,link_id,draft_id,attachment.id).await?;+ sqlx::query!("DELETE FROM email_attachments_drafts WHERE id=$1 AND draft_id=$2 AND EXISTS(SELECT 1 FROM email_messages WHERE id=$2 AND link_id=$3)",attachment.id,draft_id,link_id).execute(&mut *tx).await?;}tx.commit().await?;Ok(())@@ -210,6 +75,3 @@ pub async fn cleanup_draft_attachments(tracing::error!(?error, "Failed to release sent draft attachment references");}}--#[cfg(test)]-mod test;diff --git a/services/email_service/src/util/gmail/send/attachment_snapshot.rs b/services/email_service/src/util/gmail/send/attachment_snapshot.rsnew file mode 100644index 0000000000..287e0f9fda--- /dev/null+++ b/services/email_service/src/util/gmail/send/attachment_snapshot.rs@@ -0,0 +1,168 @@+//! Load attachment metadata once and assemble exactly that payload before sending.++use anyhow::Context;+use email::domain::attachment_access::AuthorizedAttachmentBytes;+use email::domain::scheduled_delivery::attachments::{+ ApprovedAttachments, AttachmentSnapshotMismatch,+};+use futures::{StreamExt, TryStreamExt};+use models_email::service::{+ attachment::{AttachmentDraft, AttachmentToSend},+ message::MessageToSend,+};+use sqlx::PgPool;+use uuid::Uuid;++/// Assemble attachments from one validated metadata snapshot. No provider send+/// occurs here, so every error leaves delivery safe to cancel or retry.+#[tracing::instrument(skip_all, fields(message_id = ?message.db_id), err)]+pub async fn prepare_delivery_attachments(+ db: &PgPool,+ s3_client: &s3_client::S3,+ reader: &dyn AuthorizedAttachmentBytes,+ actor: &str,+ bucket: &str,+ message: &mut MessageToSend,+ approved: Option<&ApprovedAttachments>,+) -> anyhow::Result<Option<Vec<AttachmentDraft>>> {+ let message_id = message+ .db_id+ .context("delivery message has no database identity")?;+ let snapshot = AttachmentMetadata::load(db, message.link_id, message_id, approved).await?;++ anyhow::ensure!(+ snapshot.uploaded.iter().all(|file| !file.upload_pending),+ AttachmentSnapshotMismatch+ );+ let uploaded = snapshot.uploaded.iter().map(|attachment| async move {+ let data = s3_client+ .get(bucket, &attachment.s3_key)+ .await+ .map_err(classify_uploaded_attachment_error)+ .context("failed to load an approved uploaded attachment")?;+ Ok::<_, anyhow::Error>(AttachmentToSend {+ content_id: attachment.content_id.clone(),+ is_inline: attachment.is_inline,+ file_name: attachment.file_name.clone(),+ content_type: attachment.content_type.clone(),+ data,+ })+ });+ let forwarded = prepare_provider_attachments(+ reader,+ actor,+ &snapshot.forwarded,+ message.body_html.as_deref(),+ );+ let (mut uploaded_bytes, forwarded_bytes) =+ tokio::try_join!(futures::future::try_join_all(uploaded), forwarded,)?;+ uploaded_bytes.extend(forwarded_bytes);+ anyhow::ensure!(+ uploaded_bytes+ .iter()+ .map(|file| file.data.len())+ .sum::<usize>()+ <= 18_000_000,+ AttachmentSnapshotMismatch+ );+ message.attachments = (!uploaded_bytes.is_empty()).then_some(uploaded_bytes);+ Ok((!snapshot.uploaded.is_empty()).then_some(snapshot.uploaded))+}++async fn prepare_provider_attachments(+ reader: &dyn AuthorizedAttachmentBytes,+ actor: &str,+ attachment_ids: &[Uuid],+ html: Option<&str>,+) -> anyhow::Result<Vec<AttachmentToSend>> {+ let forwarded = attachment_ids.iter().copied().map(|id| async move {+ let (record, data) = reader+ .read(actor, id)+ .await+ .map_err(|error| match error {+ email::domain::mailbox::MailboxError::Provider(+ email_api_client::domain::models::EmailApiError::NotFound+ | email_api_client::domain::models::EmailApiError::Forbidden+ | email_api_client::domain::models::EmailApiError::AuthRequired,+ ) => anyhow::Error::new(AttachmentSnapshotMismatch),+ other => anyhow::Error::new(other),+ })+ .context("failed to load an approved provider attachment")?;+ let attachment = record.attachment;+ let content_id = attachment+ .content_id+ .map(|id| id.trim_matches(['<', '>']).to_owned());+ let is_inline = content_id+ .as_deref()+ .is_some_and(|id| html.is_some_and(|body| body.contains(&format!("cid:{id}"))));+ Ok::<_, anyhow::Error>(AttachmentToSend {+ content_id,+ is_inline,+ file_name: attachment.filename.unwrap_or_else(|| "attachment".into()),+ content_type: attachment+ .mime_type+ .unwrap_or_else(|| "application/octet-stream".into()),+ data,+ })+ });+ futures::stream::iter(forwarded)+ .buffered(4)+ .try_collect()+ .await+}++fn classify_uploaded_attachment_error(error: anyhow::Error) -> anyhow::Error {+ let missing = error.chain().any(|cause| {+ cause+ .downcast_ref::<aws_sdk_s3::operation::get_object::GetObjectError>()+ .is_some_and(|error| error.is_no_such_key())+ });+ if missing {+ error.context(AttachmentSnapshotMismatch)+ } else {+ error+ }+}++/// Approved identities remain available if sources disappear while bytes are loaded.+struct AttachmentMetadata {+ uploaded: Vec<AttachmentDraft>,+ forwarded: Vec<Uuid>,+}++impl AttachmentMetadata {+ async fn load(+ db: &PgPool,+ link_id: Uuid,+ message_id: Uuid,+ approved: Option<&ApprovedAttachments>,+ ) -> anyhow::Result<Self> {+ let (uploaded, forwarded) = tokio::try_join!(+ email_db_client::attachments::draft::fetch_draft_attachments_by_draft_id(+ db, link_id, message_id,+ ),+ async {+ sqlx::query_scalar!("SELECT attachment_id AS \"attachment_id!\" FROM email_draft_provider_attachment_ids($1, $2) ORDER BY attachment_id", message_id, link_id).fetch_all(db).await.map_err(anyhow::Error::from)+ },+ )?;+ if let Some(approved) = approved {+ approved.validate(+ &uploaded+ .iter()+ .map(|attachment| attachment.id)+ .collect::<Vec<_>>(),+ &forwarded,+ )?;+ }+ Ok(Self {+ uploaded,+ forwarded,+ })+ }+}++#[cfg(test)]+mod test;++#[cfg(test)]+mod provider_test;diff --git a/services/email_service/src/util/gmail/send/test.rs b/services/email_service/src/util/gmail/send/attachment_snapshot/provider_test.rssimilarity index 85%rename from services/email_service/src/util/gmail/send/test.rsrename to services/email_service/src/util/gmail/send/attachment_snapshot/provider_test.rsindex c63117c9f1..916d0ea931 100644--- a/services/email_service/src/util/gmail/send/test.rs+++ b/services/email_service/src/util/gmail/send/attachment_snapshot/provider_test.rs@@ -3,6 +3,7 @@ use email::domain::attachment_access::{AttachmentReadRecord, AttachmentReadReposuse email::domain::mailbox::MailboxError;use futures::future::BoxFuture;use macro_db_migrator::MACRO_DB_MIGRATIONS;+use models_email::service::message;use std::sync::{Arc, Mutex};struct Reader {@@ -78,18 +79,21 @@ async fn imported_gmail_draft_preserves_native_inline_files_and_honors_removal_adb: db.clone(),read: reads.clone(),};- let mut message:message::MessageToSend=serde_json::from_value(serde_json::json!({"db_id":draft,"link_id":link.id,"subject":"Imported native draft","body_html":"<img src=\"cid:logo@draft\">"})).unwrap();- fetch_and_attach_forwarded_attachments(- &db,+ let message:message::MessageToSend=serde_json::from_value(serde_json::json!({"db_id":draft,"link_id":link.id,"subject":"Imported native draft","body_html":"<img src=\"cid:logo@draft\">"})).unwrap();+ let snapshot = AttachmentMetadata::load(&db, link.id, draft, None)+ .await+ .unwrap();+ assert_eq!(snapshot.uploaded.len(), 1);+ assert_eq!(snapshot.forwarded, vec![inline]);+ let files = prepare_provider_attachments(&reader,"macro|[email protected]",- &link,- &mut message,+ &snapshot.forwarded,+ message.body_html.as_deref(),).await.unwrap();assert_eq!(*reads.lock().unwrap(), vec![inline]);- let files = message.attachments.unwrap();assert_eq!(files.len(), 1);assert_eq!(files[0].content_id.as_deref(), Some("logo@draft"));assert!(files[0].is_inline);@@ -131,7 +135,7 @@ impl AuthorizedAttachmentBytes for SourceInboxReader {}#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]-async fn forwarding_preserves_source_inbox_identity_and_existing_attachments(db: PgPool) {+async fn forwarding_reads_bytes_with_the_source_inbox_identity(db: PgPool) {let sending = Uuid::now_v7();let source = Uuid::now_v7();let draft = Uuid::now_v7();@@ -186,28 +190,21 @@ async fn forwarding_preserves_source_inbox_identity_and_existing_attachments(db:db: db.clone(),source_link: source,};- let mut message: message::MessageToSend = serde_json::from_value(serde_json::json!({- "db_id": draft,- "link_id": sending,- "subject": "Forward",- "attachments": [{"file_name": "local.txt", "content_type": "text/plain", "data": [1, 2, 3]}]- }))- .unwrap();- fetch_and_attach_forwarded_attachments(- &db,+ let snapshot = AttachmentMetadata::load(&db, link.id, draft, None)+ .await+ .unwrap();+ assert!(snapshot.uploaded.is_empty());+ assert_eq!(snapshot.forwarded, vec![attachment]);+ let files = prepare_provider_attachments(&reader,"macro|[email protected]",- &link,- &mut message,+ &snapshot.forwarded,+ None,).await.unwrap();- assert_eq!(message.link_id, sending);- let files = message.attachments.unwrap();- assert_eq!(files.len(), 2);- assert_eq!(files[0].file_name, "local.txt");- assert_eq!(files[0].data, vec![1, 2, 3]);- assert_eq!(files[1].file_name, "report.pdf");- assert_eq!(files[1].content_type, "application/pdf");- assert_eq!(files[1].data, b"pdf bytes");+ assert_eq!(files.len(), 1);+ assert_eq!(files[0].file_name, "report.pdf");+ assert_eq!(files[0].content_type, "application/pdf");+ assert_eq!(files[0].data, b"pdf bytes");}diff --git a/services/email_service/src/util/gmail/send/attachment_snapshot/test.rs b/services/email_service/src/util/gmail/send/attachment_snapshot/test.rsnew file mode 100644index 0000000000..ebc7bca567--- /dev/null+++ b/services/email_service/src/util/gmail/send/attachment_snapshot/test.rs@@ -0,0 +1,99 @@+use super::*;+use macro_db_migrator::MACRO_DB_MIGRATIONS;++fn link() -> Uuid {+ Uuid::parse_str("00000000-0000-0000-0000-000000000f01").unwrap()+}++fn draft() -> Uuid {+ Uuid::parse_str("00000000-0000-0000-0000-00000000f501").unwrap()+}++fn original() -> Uuid {+ Uuid::parse_str("00000000-0000-0000-0000-00000000f301").unwrap()+}++fn approved() -> ApprovedAttachments {+ ApprovedAttachments {+ uploaded: vec![],+ forwarded: vec![+ Uuid::parse_str("00000000-0000-0000-0000-0000000fa001").unwrap(),+ Uuid::parse_str("00000000-0000-0000-0000-0000000fa002").unwrap(),+ ],+ }+}++#[test]+fn missing_uploaded_bytes_require_review_but_transient_storage_errors_remain_retryable() {+ use aws_sdk_s3::operation::get_object::GetObjectError;+ let missing = GetObjectError::NoSuchKey(aws_sdk_s3::types::error::NoSuchKey::builder().build());+ let sdk_error = aws_sdk_s3::error::SdkError::service_error(missing, ());+ let error =+ classify_uploaded_attachment_error(anyhow::Error::new(sdk_error).context("S3 read"));+ assert!(error.downcast_ref::<AttachmentSnapshotMismatch>().is_some());+ let transient = classify_uploaded_attachment_error(anyhow::anyhow!("temporary storage outage"));+ assert!(+ transient+ .downcast_ref::<AttachmentSnapshotMismatch>()+ .is_none()+ );+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../../../../crates/email_db_client/fixtures",+ scripts("forwarded_attachments")+ )+)]+async fn source_deletion_before_preparation_rejects_incomplete_payload(+ pool: PgPool,+) -> anyhow::Result<()> {+ email_db_client::messages::delete::delete_db_message(&pool, original()).await?;+ let result = AttachmentMetadata::load(&pool, link(), draft(), Some(&approved())).await;+ let Err(error) = result else {+ panic!("missing approved attachments must reject preparation");+ };+ assert!(error.downcast_ref::<AttachmentSnapshotMismatch>().is_some());+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../../../../crates/email_db_client/fixtures",+ scripts("forwarded_attachments")+ )+)]+async fn source_deletion_after_snapshot_cannot_shrink_the_payload(+ pool: PgPool,+) -> anyhow::Result<()> {+ let snapshot = AttachmentMetadata::load(&pool, link(), draft(), Some(&approved())).await?;+ email_db_client::messages::delete::delete_db_message(&pool, original()).await?;+ let current = email_db_client::attachments::forwarded::fetch_forwarded_attachments_by_draft_id(+ &pool,+ link(),+ draft(),+ )+ .await?;+ assert!(current.is_empty());+ assert_eq!(snapshot.forwarded.len(), 2);+ assert_eq!(snapshot.forwarded, approved().forwarded);+ Ok(())+}++#[sqlx::test(+ migrator = "MACRO_DB_MIGRATIONS",+ fixtures(+ path = "../../../../../../../crates/email_db_client/fixtures",+ scripts("forwarded_attachments")+ )+)]+async fn legacy_delivery_without_an_approved_set_uses_existing_attachments(+ pool: PgPool,+) -> anyhow::Result<()> {+ let snapshot = AttachmentMetadata::load(&pool, link(), draft(), None).await?;+ assert_eq!(snapshot.forwarded.len(), 2);+ assert!(snapshot.uploaded.is_empty());+ Ok(())+}diff --git a/static_assets/schema.graphql b/static_assets/schema.graphqlindex e789a16ffc..2390c8d466 100644--- a/static_assets/schema.graphql+++ b/static_assets/schema.graphql@@ -324,6 +324,14 @@ type CompleteMutationRoot {"""deleteEmailDraft(input: DeleteEmailDraftInput!): DeleteEmailDraftPayload!"""+ Durably accept an immutable send snapshot; safe to replay after response loss.+ """+ sendEmailAttempt(input: SendEmailAttemptInput!): SendEmailAttemptPayload!+ """+ Revoke delivery authority even if the original send request has not arrived.+ """+ cancelEmailSend(input: EmailSendAttemptInput!): SendEmailAttemptPayload!+ """Create an initiative owned by the authenticated user."""createInitiative(input: CreateInitiativeInput!): GraphqlSoupInitiative!@@ -539,6 +547,10 @@ input DeleteCalendarEventInput {Input for deleting an email draft."""input DeleteEmailDraftInput {+ """+ Generation from the last loaded draft.+ """+ draftGeneration: Int"""Draft handle to delete: a client-generated ID or a server ID, resolvedlike a save's. A handle that is already gone (or was never bound — a@@ -737,6 +749,76 @@ enum EmailMessageResolutionAction {RETRY_SEND}+"""+Identifies one send action independently of its server message identity.+"""+input EmailSendAttemptInput {+ """+ Stable UUID generated for the explicit Send action.+ """+ attemptId: ID!+ """+ Sending inbox captured at Send, never inferred during replay.+ """+ linkId: ID!+}++"""+Current result of one replay-safe send action.+"""+type EmailSendAttemptPayload {+ """+ Stable send-action identity.+ """+ attemptId: ID!+ """+ Current delivery state.+ """+ status: EmailSendStatus!+ """+ First acceptance's delivery deadline, preserved across retries.+ """+ sendTime: String+ """+ Current message, absent if cancelled before admission or subsequently deleted.+ """+ message: GraphqlSoupEmailMessage+ """+ Server conversation identity, when admitted.+ """+ threadId: ID+}++"""+Authoritative delivery state; acceptance is not proof of provider delivery.+"""+enum EmailSendStatus {+ """+ Durably accepted; preparation may be retried and cancellation remains safe.+ """+ ACCEPTED+ """+ Submission began, or a legacy claim has an unknown outcome; cancellation is unsafe.+ """+ SENDING+ """+ Delivery failed before acceptance; cancellation can restore the draft.+ """+ FAILED+ """+ Delivery may have occurred and is being reconciled without resending.+ """+ DELIVERY_UNCONFIRMED+ """+ Provider delivery was recorded.+ """+ SENT+ """+ This attempt cannot deliver.+ """+ CANCELLED+}+"""Input for fetching one email thread by its canonical identifier."""@@ -6489,6 +6571,28 @@ The way a routine starts."""union GraphqlScheduledActionTrigger = GraphqlScheduledActionCronTrigger | GraphqlScheduledActionEventsTrigger | GraphqlScheduledActionMultipleTrigger+"""+The persisted state of a scheduled delivery.+"""+enum GraphqlScheduledSendStatus {+ """+ Waiting for its send time or safely retrying preparation.+ """+ PENDING+ """+ Provider submission has started.+ """+ SENDING+ """+ Delivery was definitely rejected; the draft can be restored.+ """+ FAILED+ """+ Delivery may have succeeded; reconciliation is required.+ """+ UNCONFIRMED+}+"""A select-option property value."""@@ -7977,6 +8081,10 @@ type GraphqlSoupEmailLabel {An adaptively hydrated email content projection for Soup queries."""type GraphqlSoupEmailMessage {+ """+ Generation required when editing a draft after send/cancellation.+ """+ draftGeneration: Int!"""Immutable scheduling snapshots; JSON keeps both transports identical."""@@ -8046,6 +8154,10 @@ type GraphqlSoupEmailMessage {"""scheduledSendTime: String"""+ Whether the scheduled delivery is pending, sending, failed, or unconfirmed.+ """+ scheduledSendStatus: GraphqlScheduledSendStatus+ """The sender of the message."""from: GraphqlSoupEmailContact@@ -9089,6 +9201,14 @@ type GraphqlUser {"""emailLinks: [GraphqlEmailLink!]!"""+ Inspect a queued send after reconnect or restart without resending it.+ """+ pendingEmailSends(after: String): PendingEmailSends!+ """+ Inspect a queued send after reconnect or restart without resending it.+ """+ emailSendAttempt(input: EmailSendAttemptInput!): EmailSendAttemptPayload+ """Fetch one accessible email thread by its canonical identifier."""emailThread(input: EmailThreadInput!): GraphqlSoupEmailThread@@ -9479,6 +9599,34 @@ enum NotificationUpdateOperation {MARK_UNDONE}+"""+An unresolved send owned by the authenticated actor, possibly from another device.+"""+type PendingEmailSend {+ """+ Inbox needed to address the attempt, including after message deletion.+ """+ linkId: ID!+ """+ Current authoritative status.+ """+ attempt: EmailSendAttemptPayload!+}++"""+A bounded page of unresolved sends, newest first.+"""+type PendingEmailSends {+ """+ Authorized sends.+ """+ attempts: [PendingEmailSend!]!+ """+ Opaque cursor for the next page.+ """+ nextCursor: String+}+"""Input for recording authenticated channel activity."""@@ -9606,6 +9754,10 @@ derives authoritative thread linkage from the reply target or theexisting draft."""input SaveEmailDraftInput {+ """+ Generation from the last loaded draft. Omitted by legacy clients.+ """+ draftGeneration: Int"""Verified sender address for the selected inbox. Absent selects its primary address."""@@ -9698,6 +9850,62 @@ type SaveEmailDraftPayload {thread: GraphqlSoupEmailThread!}+"""+Immutable content approved by the user.+"""+input SendEmailAttemptInput {+ """+ Saved signature HTML captured at Send; empty means no signature.+ """+ signatureHtml: String+ """+ Stable attempt and sending inbox.+ """+ attempt: EmailSendAttemptInput!+ """+ Full message snapshot; optional send time preserves Send Later across retries.+ """+ message: SaveEmailDraftInput!+ """+ Per-message signature preference.+ """+ includeSignature: Boolean+ """+ Completed draft attachment IDs.+ """+ attachmentIds: [ID!]!+ """+ Original attachment IDs for forwarded attachments.+ """+ forwardedAttachmentIds: [ID!]!+ """+ Editor HTML before the watermark, encoded like message HTML.+ """+ restoreBodyHtml: String+ """+ Editor plain text before the watermark.+ """+ restoreBodyText: String+ """+ Editor document before the watermark.+ """+ restoreBodyMacro: String+}++"""+Send admission or cancellation and the updated conversation.+"""+type SendEmailAttemptPayload {+ """+ Admission/cancellation result and hydrated message.+ """+ attempt: EmailSendAttemptPayload!+ """+ Updated thread, absent for cancellation before admission.+ """+ thread: GraphqlSoupEmailThread+}+"""Online delivery command. The draft handle is required so a response lostafter enqueue cannot turn a retry into a second, unrelated message.