@realtimex/email-automator 2.3.8 → 2.4.5
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/api/src/middleware/validation.ts +11 -4
- package/api/src/routes/actions.ts +84 -49
- package/api/src/routes/emails.ts +8 -1
- package/api/src/routes/rules.ts +8 -3
- package/api/src/services/eventLogger.ts +10 -2
- package/api/src/services/gmail.ts +128 -0
- package/api/src/services/intelligence.ts +1 -1
- package/api/src/services/microsoft.ts +3 -1
- package/api/src/services/processor.ts +89 -58
- package/api/src/services/supabase.ts +2 -1
- package/dist/api/src/middleware/validation.js +11 -4
- package/dist/api/src/routes/actions.js +87 -51
- package/dist/api/src/routes/emails.js +6 -2
- package/dist/api/src/routes/rules.js +7 -3
- package/dist/api/src/services/eventLogger.js +12 -2
- package/dist/api/src/services/gmail.js +99 -0
- package/dist/api/src/services/intelligence.js +1 -1
- package/dist/api/src/services/microsoft.js +3 -1
- package/dist/api/src/services/processor.js +77 -49
- package/dist/assets/index-C3PlbplS.css +1 -0
- package/dist/assets/index-DfGa9R7j.js +97 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/supabase/functions/api-v1-emails/index.ts +9 -1
- package/supabase/migrations/20260118000000_multi_actions_rules.sql +17 -0
- package/dist/assets/index-BQ1uMdFh.js +0 -97
- package/dist/assets/index-Dzi17fx5.css +0 -1
package/dist/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Email Automator</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DfGa9R7j.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C3PlbplS.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -57,6 +57,14 @@ Deno.serve(async (req) => {
|
|
|
57
57
|
const account_id = url.searchParams.get('account_id');
|
|
58
58
|
const action_taken = url.searchParams.get('action_taken');
|
|
59
59
|
const search = url.searchParams.get('search');
|
|
60
|
+
|
|
61
|
+
const sort_by = url.searchParams.get('sort_by') || 'date';
|
|
62
|
+
const sort_order = url.searchParams.get('sort_order') || 'desc';
|
|
63
|
+
|
|
64
|
+
// Validate sort params
|
|
65
|
+
const validSortFields = ['date', 'created_at'];
|
|
66
|
+
const sortField = validSortFields.includes(sort_by) ? sort_by : 'date';
|
|
67
|
+
const isAscending = sort_order === 'asc';
|
|
60
68
|
|
|
61
69
|
let query = supabaseAdmin
|
|
62
70
|
.from('emails')
|
|
@@ -65,7 +73,7 @@ Deno.serve(async (req) => {
|
|
|
65
73
|
email_accounts!inner(id, user_id, email_address, provider)
|
|
66
74
|
`, { count: 'exact' })
|
|
67
75
|
.eq('email_accounts.user_id', user.id)
|
|
68
|
-
.order(
|
|
76
|
+
.order(sortField, { ascending: isAscending })
|
|
69
77
|
.range(offset, offset + limit - 1);
|
|
70
78
|
|
|
71
79
|
// Apply filters
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- Enable multiple actions per rule
|
|
2
|
+
-- Add actions array column (replaces single action column)
|
|
3
|
+
ALTER TABLE rules ADD COLUMN IF NOT EXISTS actions TEXT[] DEFAULT '{}';
|
|
4
|
+
|
|
5
|
+
-- Migrate existing data: copy action to actions array
|
|
6
|
+
UPDATE rules
|
|
7
|
+
SET actions = ARRAY[action]
|
|
8
|
+
WHERE action IS NOT NULL AND (actions IS NULL OR actions = '{}');
|
|
9
|
+
|
|
10
|
+
-- We keep the legacy 'action' column for backward compatibility
|
|
11
|
+
-- but the application will now use the 'actions' array
|
|
12
|
+
|
|
13
|
+
-- Update check constraint to include new action types
|
|
14
|
+
ALTER TABLE rules DROP CONSTRAINT IF EXISTS rules_action_check;
|
|
15
|
+
|
|
16
|
+
-- Add index for faster lookups on actions array
|
|
17
|
+
CREATE INDEX IF NOT EXISTS idx_rules_actions ON rules USING GIN (actions);
|