@flowselections/floriday-authenticatie-module 1.0.25 → 1.0.26

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.
@@ -902,9 +902,10 @@ export const syncFlorydayConnections = createServerFn({ method: "POST" })
902
902
  }
903
903
  return input;
904
904
  })
905
- .handler(async ({ data, context }) => {
905
+ .handler(async ({ data, context: _context }) => {
906
906
  try {
907
- const result = await runFloridayConnectionsSync(context.supabase, data.environment);
907
+ const { supabaseAdmin } = await import("../integrations/supabase/client.server");
908
+ const result = await runFloridayConnectionsSync(supabaseAdmin, data.environment);
908
909
  return { ok: true, ...result };
909
910
  }
910
911
  catch (e) {
@@ -923,7 +924,8 @@ export const getFlorydaySyncStatus = createServerFn({ method: "POST" })
923
924
  const row = await getActiveFlorydayCredentials(context.supabase, data.environment);
924
925
  if (!row)
925
926
  return { ok: false, error: `Geen actieve koppeling voor ${data.environment}` };
926
- const { data: states } = await context.supabase
927
+ const { supabaseAdmin } = await import("../integrations/supabase/client.server");
928
+ const { data: states } = await supabaseAdmin
927
929
  .from("floriday_sync_state")
928
930
  .select("entity_type, last_sequence_number, last_synced_at, last_error")
929
931
  .eq("connection_id", row.id);
@@ -960,7 +962,10 @@ export const getFlorydaySyncStatus = createServerFn({ method: "POST" })
960
962
  if (!table)
961
963
  continue;
962
964
  let cached_count = 0;
963
- const { count } = await context.supabase
965
+ const client = table === "floriday_connections_cache"
966
+ ? (await import("../integrations/supabase/client.server")).supabaseAdmin
967
+ : context.supabase;
968
+ const { count } = await client
964
969
  .from(table)
965
970
  .select("connection_id", { count: "exact", head: true })
966
971
  .eq("connection_id", row.id);
@@ -1303,7 +1308,8 @@ export const getFlorydaySyncHealth = createServerFn({ method: "POST" })
1303
1308
  const row = await getActiveFlorydayCredentials(context.supabase, data.environment);
1304
1309
  if (!row)
1305
1310
  return { ok: false, error: `Geen actieve koppeling voor ${data.environment}` };
1306
- const { data: states } = await context.supabase
1311
+ const { supabaseAdmin } = await import("../integrations/supabase/client.server");
1312
+ const { data: states } = await supabaseAdmin
1307
1313
  .from("floriday_sync_state")
1308
1314
  .select("entity_type, last_success_at, last_synced_at, last_error")
1309
1315
  .eq("connection_id", row.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowselections/floriday-authenticatie-module",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "sideEffects": false,
5
5
  "type": "module",
6
6
  "main": "./dist-lib/index.js",