@fayz-ai/plugin-conversations 0.23.2 → 0.23.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +33 -1
- package/dist/index.js.map +1 -1
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5649,6 +5649,37 @@ BEGIN
|
|
|
5649
5649
|
END LOOP;
|
|
5650
5650
|
END $$;
|
|
5651
5651
|
`;
|
|
5652
|
+
var MIGRATION_016_A_DELIVERY_RECEIPT_FINDS_ITS_TENANT = `-- ============================================================================
|
|
5653
|
+
-- 016_a_delivery_receipt_finds_its_tenant \u2014 the Tyxter webhook moves to the
|
|
5654
|
+
-- integration service (ADR 0003 phase 2).
|
|
5655
|
+
--
|
|
5656
|
+
-- A delivery receipt names only the provider's message id. The service writes
|
|
5657
|
+
-- the inbox AS the store's owner (core 212), so it must learn the store first:
|
|
5658
|
+
-- this answers the tenant of the message that id was sent as, and nothing
|
|
5659
|
+
-- else. SECURITY DEFINER, service role only.
|
|
5660
|
+
--
|
|
5661
|
+
-- Replay-safe: CREATE OR REPLACE; guarded grants.
|
|
5662
|
+
-- ============================================================================
|
|
5663
|
+
|
|
5664
|
+
CREATE OR REPLACE FUNCTION public.conversations_message_tenant(p_provider_message_id text) RETURNS uuid
|
|
5665
|
+
LANGUAGE sql STABLE SECURITY DEFINER SET search_path TO ''
|
|
5666
|
+
AS $function$
|
|
5667
|
+
SELECT m.tenant_id
|
|
5668
|
+
FROM public.plg_conversation_messages m
|
|
5669
|
+
WHERE m.provider_message_id = p_provider_message_id
|
|
5670
|
+
ORDER BY m.at DESC NULLS LAST
|
|
5671
|
+
LIMIT 1;
|
|
5672
|
+
$function$;
|
|
5673
|
+
|
|
5674
|
+
DO $$
|
|
5675
|
+
BEGIN
|
|
5676
|
+
REVOKE ALL ON FUNCTION public.conversations_message_tenant(text) FROM PUBLIC;
|
|
5677
|
+
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'anon') THEN REVOKE ALL ON FUNCTION public.conversations_message_tenant(text) FROM anon; END IF;
|
|
5678
|
+
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'authenticated') THEN REVOKE ALL ON FUNCTION public.conversations_message_tenant(text) FROM authenticated; END IF;
|
|
5679
|
+
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'service_role') THEN GRANT EXECUTE ON FUNCTION public.conversations_message_tenant(text) TO service_role; END IF;
|
|
5680
|
+
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'fayz_integration') THEN GRANT EXECUTE ON FUNCTION public.conversations_message_tenant(text) TO fayz_integration; END IF;
|
|
5681
|
+
END $$;
|
|
5682
|
+
`;
|
|
5652
5683
|
var MIGRATIONS = [
|
|
5653
5684
|
{ id: "000_baseline", sql: MIGRATION_000_BASELINE },
|
|
5654
5685
|
{ id: "001_a_caixa_sabe_quem_falou_por_ultimo", sql: MIGRATION_001_A_CAIXA_SABE_QUEM_FALOU_POR_ULTIMO },
|
|
@@ -5665,7 +5696,8 @@ var MIGRATIONS = [
|
|
|
5665
5696
|
{ id: "012_a_rich_message_keeps_its_shape", sql: MIGRATION_012_A_RICH_MESSAGE_KEEPS_ITS_SHAPE },
|
|
5666
5697
|
{ id: "013_a_midia_fica_conosco", sql: MIGRATION_013_A_MIDIA_FICA_CONOSCO },
|
|
5667
5698
|
{ id: "014_claiming_targets_is_server_only", sql: MIGRATION_014_CLAIMING_TARGETS_IS_SERVER_ONLY },
|
|
5668
|
-
{ id: "015_the_service_door_for_messaging", sql: MIGRATION_015_THE_SERVICE_DOOR_FOR_MESSAGING }
|
|
5699
|
+
{ id: "015_the_service_door_for_messaging", sql: MIGRATION_015_THE_SERVICE_DOOR_FOR_MESSAGING },
|
|
5700
|
+
{ id: "016_a_delivery_receipt_finds_its_tenant", sql: MIGRATION_016_A_DELIVERY_RECEIPT_FINDS_ITS_TENANT }
|
|
5669
5701
|
];
|
|
5670
5702
|
var conversationsV1SettingsTabs = [
|
|
5671
5703
|
defineSettingsTab({
|