realtimex-crm 0.9.1 → 0.9.2
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/bin/realtimex-crm.js +56 -32
- package/dist/assets/{DealList-DnGVfS15.js → DealList-DbwJCRGl.js} +2 -2
- package/dist/assets/{DealList-DnGVfS15.js.map → DealList-DbwJCRGl.js.map} +1 -1
- package/dist/assets/index-C__S90Gb.css +1 -0
- package/dist/assets/index-mE-upBfc.js +166 -0
- package/dist/assets/{index-DPrpo5Xq.js.map → index-mE-upBfc.js.map} +1 -1
- package/dist/index.html +1 -1
- package/dist/stats.html +1 -1
- package/package.json +2 -1
- package/src/components/atomic-crm/activities/ActivitiesPage.tsx +16 -0
- package/src/components/atomic-crm/activities/ActivityFeed.tsx +212 -0
- package/src/components/atomic-crm/activities/FileUpload.tsx +359 -0
- package/src/components/atomic-crm/contacts/ContactShow.tsx +28 -10
- package/src/components/atomic-crm/integrations/CreateChannelDialog.tsx +139 -0
- package/src/components/atomic-crm/integrations/IngestionChannelsTab.tsx +188 -0
- package/src/components/atomic-crm/integrations/IntegrationsPage.tsx +15 -3
- package/supabase/fix_webhook_hardcoded.sql +34 -0
- package/supabase/functions/_shared/ingestionGuard.ts +128 -0
- package/supabase/functions/_shared/utils.ts +1 -1
- package/supabase/functions/ingest-activity/.well-known/supabase/config.toml +4 -0
- package/supabase/functions/ingest-activity/index.ts +261 -0
- package/supabase/migrations/20251219120100_webhook_triggers.sql +10 -5
- package/supabase/migrations/20251220120000_realtime_ingestion.sql +154 -0
- package/supabase/migrations/20251221000000_contact_matching.sql +94 -0
- package/supabase/migrations/20251221000001_fix_ingestion_providers_rls.sql +23 -0
- package/supabase/migrations/20251221000002_fix_contact_matching_jsonb.sql +67 -0
- package/supabase/migrations/20251221000003_fix_email_matching.sql +70 -0
- package/supabase/migrations/20251221000004_time_based_work_stealing.sql +99 -0
- package/supabase/migrations/20251221000005_realtime_functions.sql +73 -0
- package/supabase/migrations/20251221000006_enable_pg_net.sql +3 -0
- package/supabase/migrations/20251222075019_enable_extensions_and_configure_cron.sql +86 -0
- package/supabase/migrations/20251222094036_large_payload_storage.sql +213 -0
- package/supabase/migrations/20251222094247_large_payload_cron.sql +28 -0
- package/supabase/migrations/20251222220000_fix_large_payload_types.sql +72 -0
- package/supabase/migrations/20251223000000_enable_realtime_all_crm_tables.sql +50 -0
- package/supabase/migrations/20251223185638_remove_large_payload_storage.sql +54 -0
- package/dist/assets/index-DPrpo5Xq.js +0 -159
- package/dist/assets/index-kM1Og1AS.css +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
-- Enable Realtime for all core CRM tables
|
|
2
|
+
-- This migration adds realtime support for tables not covered in the initial setup
|
|
3
|
+
-- Safe to run on existing deployments (idempotent - won't duplicate if already enabled)
|
|
4
|
+
|
|
5
|
+
-- Enable realtime for core CRM entities
|
|
6
|
+
select enable_realtime_for_table('contacts');
|
|
7
|
+
select enable_realtime_for_table('companies');
|
|
8
|
+
select enable_realtime_for_table('deals');
|
|
9
|
+
select enable_realtime_for_table('contactNotes');
|
|
10
|
+
select enable_realtime_for_table('dealNotes');
|
|
11
|
+
select enable_realtime_for_table('sales');
|
|
12
|
+
select enable_realtime_for_table('ingestion_providers');
|
|
13
|
+
|
|
14
|
+
-- Verify all tables are enabled
|
|
15
|
+
do $$
|
|
16
|
+
declare
|
|
17
|
+
expected_tables text[] := ARRAY[
|
|
18
|
+
'activities',
|
|
19
|
+
'tasks',
|
|
20
|
+
'contacts',
|
|
21
|
+
'companies',
|
|
22
|
+
'deals',
|
|
23
|
+
'contactNotes',
|
|
24
|
+
'dealNotes',
|
|
25
|
+
'sales',
|
|
26
|
+
'ingestion_providers'
|
|
27
|
+
];
|
|
28
|
+
enabled_tables text[];
|
|
29
|
+
missing_tables text[];
|
|
30
|
+
begin
|
|
31
|
+
-- Get list of enabled tables
|
|
32
|
+
select array_agg(tablename)
|
|
33
|
+
into enabled_tables
|
|
34
|
+
from pg_publication_tables
|
|
35
|
+
where pubname = 'supabase_realtime'
|
|
36
|
+
and schemaname = 'public';
|
|
37
|
+
|
|
38
|
+
-- Find missing tables
|
|
39
|
+
select array_agg(t)
|
|
40
|
+
into missing_tables
|
|
41
|
+
from unnest(expected_tables) as t
|
|
42
|
+
where t != ALL(coalesce(enabled_tables, ARRAY[]::text[]));
|
|
43
|
+
|
|
44
|
+
-- Report results
|
|
45
|
+
if missing_tables is null or array_length(missing_tables, 1) = 0 then
|
|
46
|
+
raise notice '✅ All CRM tables have realtime enabled';
|
|
47
|
+
else
|
|
48
|
+
raise warning '⚠️ Missing realtime for: %', array_to_string(missing_tables, ', ');
|
|
49
|
+
end if;
|
|
50
|
+
end $$;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
-- Remove Large JSON Payload Storage System
|
|
2
|
+
-- This migration removes the move_payload_to_storage function and related infrastructure
|
|
3
|
+
-- that was designed to move large JSON payloads to storage.
|
|
4
|
+
--
|
|
5
|
+
-- Decision: Files are now uploaded directly to storage in the incoming/ folder
|
|
6
|
+
-- and marked as 'in_storage' immediately. No cron job needed to move them.
|
|
7
|
+
|
|
8
|
+
-- Unschedule the cron job (safe to run even if it doesn't exist)
|
|
9
|
+
SELECT cron.unschedule('process-large-payloads') WHERE EXISTS (
|
|
10
|
+
SELECT 1 FROM cron.job WHERE jobname = 'process-large-payloads'
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
-- Drop the trigger that auto-detects large payloads
|
|
14
|
+
DROP TRIGGER IF EXISTS trigger_check_payload_size ON activities;
|
|
15
|
+
|
|
16
|
+
-- Drop the trigger function
|
|
17
|
+
DROP FUNCTION IF EXISTS check_payload_size();
|
|
18
|
+
|
|
19
|
+
-- Drop the move_payload_to_storage function
|
|
20
|
+
DROP FUNCTION IF EXISTS move_payload_to_storage(UUID, TEXT);
|
|
21
|
+
|
|
22
|
+
-- Drop the get_activity_payload helper function (no longer needed)
|
|
23
|
+
DROP FUNCTION IF EXISTS get_activity_payload(UUID);
|
|
24
|
+
|
|
25
|
+
-- Drop the calculate_payload_size helper function (no longer needed)
|
|
26
|
+
DROP FUNCTION IF EXISTS calculate_payload_size(JSONB);
|
|
27
|
+
|
|
28
|
+
-- Drop the index for pending_move queries (no longer needed)
|
|
29
|
+
DROP INDEX IF EXISTS idx_activities_pending_storage;
|
|
30
|
+
|
|
31
|
+
-- Remove the CHECK constraint on payload_storage_status to allow NULL and 'in_storage' only
|
|
32
|
+
-- First drop the constraint, then add a new one
|
|
33
|
+
ALTER TABLE activities DROP CONSTRAINT IF EXISTS activities_payload_storage_status_check;
|
|
34
|
+
ALTER TABLE activities ADD CONSTRAINT activities_payload_storage_status_check
|
|
35
|
+
CHECK (payload_storage_status IS NULL OR payload_storage_status = 'in_storage');
|
|
36
|
+
|
|
37
|
+
-- Update pg_cron comment to remove reference to process-large-payloads
|
|
38
|
+
COMMENT ON EXTENSION pg_cron IS
|
|
39
|
+
'Cron jobs:
|
|
40
|
+
- webhook-dispatcher: Runs every minute to dispatch webhooks';
|
|
41
|
+
|
|
42
|
+
-- Add comment to explain the simplified storage model
|
|
43
|
+
COMMENT ON COLUMN activities.payload_storage_status IS
|
|
44
|
+
'Storage status for file attachments:
|
|
45
|
+
- NULL: No files attached (raw_data is pure JSON)
|
|
46
|
+
- ''in_storage'': Files uploaded to storage/incoming/ folder, referenced in raw_data.storage_path
|
|
47
|
+
|
|
48
|
+
Files are uploaded directly to storage by the ingest-activity Edge Function.
|
|
49
|
+
No post-processing or file moving is needed.';
|
|
50
|
+
|
|
51
|
+
COMMENT ON COLUMN activities.storage_path IS
|
|
52
|
+
'Storage path for file attachments. Populated when raw_data.source_type = ''storage_ref''.
|
|
53
|
+
Files are stored in the activity-payloads bucket under incoming/ folder.
|
|
54
|
+
Example: incoming/1766514359388_document.pdf';
|