@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/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-BQ1uMdFh.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-Dzi17fx5.css">
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realtimex/email-automator",
3
- "version": "2.3.8",
3
+ "version": "2.4.5",
4
4
  "type": "module",
5
5
  "main": "dist/api/server.js",
6
6
  "bin": {
@@ -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('date', { ascending: false })
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);