@flowselections/floriday-authenticatie-module 1.0.46 → 1.0.47
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-lib/components/settings/FlorydaySettingsCard.d.ts.map +1 -1
- package/dist-lib/components/settings/FlorydaySettingsCard.js +12 -2
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +54 -0
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +54 -0
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +54 -0
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +54 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/cron/process-stock-queue.d.ts.map +1 -1
- package/dist-lib/lib/cron/process-stock-queue.js +5 -0
- package/dist-lib/lib/floricode.functions.d.ts +378 -0
- package/dist-lib/lib/floricode.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-api-log.functions.d.ts +486 -0
- package/dist-lib/lib/floriday-api-log.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-auction-letters.functions.d.ts +54 -0
- package/dist-lib/lib/floriday-auction-letters.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-labels.functions.d.ts +54 -0
- package/dist-lib/lib/floriday-labels.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-public.functions.d.ts +324 -0
- package/dist-lib/lib/floriday-public.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-stickers.functions.d.ts +54 -0
- package/dist-lib/lib/floriday-stickers.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-sync.functions.d.ts +1782 -0
- package/dist-lib/lib/floriday-sync.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-writes.functions.d.ts +432 -0
- package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday.functions.d.ts +55821 -75
- package/dist-lib/lib/floriday.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday.functions.js +66 -10
- package/package.json +1 -1
|
@@ -123,7 +123,14 @@ export async function getFlorydayAccessToken(supabase, env, options = {}) {
|
|
|
123
123
|
}
|
|
124
124
|
try {
|
|
125
125
|
const { getFlorydayTokenFromCentral } = await import("./central-auth.server.js");
|
|
126
|
-
|
|
126
|
+
let result = await getFlorydayTokenFromCentral(env, options.scope, "default");
|
|
127
|
+
// Central Auth kan bij gelijktijdige grants incidenteel één 5xx teruggeven,
|
|
128
|
+
// terwijl dezelfde aanvraag direct daarna slaagt. Eén korte herpoging houdt
|
|
129
|
+
// voorraadregels uit de foutstatus zonder echte configuratiefouten te maskeren.
|
|
130
|
+
if (!result.ok && result.raw.status >= 500) {
|
|
131
|
+
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
132
|
+
result = await getFlorydayTokenFromCentral(env, options.scope, "default");
|
|
133
|
+
}
|
|
127
134
|
if (!result.ok) {
|
|
128
135
|
throw await createFlorydayTokenError(result.raw.status, result.raw.body, requestedScope, env);
|
|
129
136
|
}
|
|
@@ -819,7 +826,13 @@ export async function resolveFlorydayCronBaseUrlAsync() {
|
|
|
819
826
|
export async function syncShellHostRuntimeConfig() {
|
|
820
827
|
let base = null;
|
|
821
828
|
try {
|
|
822
|
-
|
|
829
|
+
// Voor deze databasewaarde is géén project/env-fallback toegestaan: een
|
|
830
|
+
// gekopieerde module zou dan ongemerkt terug naar de bouwshell wijzen.
|
|
831
|
+
// Alleen de actieve tenant-host uit Central Auth mag deze waarde bepalen.
|
|
832
|
+
const { getShellHostFromCentral } = await import("./central-auth.server.js");
|
|
833
|
+
base = await getShellHostFromCentral();
|
|
834
|
+
if (!base)
|
|
835
|
+
return { base: null, changed: false };
|
|
823
836
|
}
|
|
824
837
|
catch {
|
|
825
838
|
return { base: null, changed: false };
|
|
@@ -838,14 +851,9 @@ export async function syncShellHostRuntimeConfig() {
|
|
|
838
851
|
value: base,
|
|
839
852
|
updated_at: new Date().toISOString(),
|
|
840
853
|
}, { onConflict: "key" });
|
|
841
|
-
//
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
await supabaseAdmin.rpc("schedule_floriday_stock_queue_process", {
|
|
845
|
-
p_url: `${base}/api/public/cron/process-stock-queue`,
|
|
846
|
-
p_apikey: apikey,
|
|
847
|
-
});
|
|
848
|
-
}
|
|
854
|
+
// De actieve minuuttaak roept `run_floriday_stock_queue_process()` aan;
|
|
855
|
+
// die leest deze waarde bij iedere ronde opnieuw. Herplannen is dus niet
|
|
856
|
+
// nodig en zou hier bovendien falen zonder een ingelogde admin-context.
|
|
849
857
|
console.log(`[floriday] shell-host bijgewerkt naar ${base}`);
|
|
850
858
|
return { base, changed: true };
|
|
851
859
|
}
|
|
@@ -854,6 +862,54 @@ export async function syncShellHostRuntimeConfig() {
|
|
|
854
862
|
return { base, changed: false };
|
|
855
863
|
}
|
|
856
864
|
}
|
|
865
|
+
export const getFlorydayShellHostStatus = createServerFn({ method: "GET" })
|
|
866
|
+
.middleware([requireSupabaseAuth])
|
|
867
|
+
.handler(async ({ context }) => {
|
|
868
|
+
const { data: isAdmin, error: roleError } = await context.supabase.rpc("has_role", {
|
|
869
|
+
_user_id: context.userId,
|
|
870
|
+
_role: "admin",
|
|
871
|
+
});
|
|
872
|
+
if (roleError)
|
|
873
|
+
throw new Error(roleError.message);
|
|
874
|
+
if (!isAdmin)
|
|
875
|
+
throw new Error("Alleen admins mogen de verwerker-host controleren");
|
|
876
|
+
const { getShellHostFromCentral } = await import("./central-auth.server.js");
|
|
877
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
878
|
+
const centralHost = await getShellHostFromCentral();
|
|
879
|
+
const { data, error } = await supabaseAdmin
|
|
880
|
+
.from("module_runtime_config")
|
|
881
|
+
.select("value, updated_at")
|
|
882
|
+
.eq("key", "stock_queue_processor_base_url")
|
|
883
|
+
.maybeSingle();
|
|
884
|
+
if (error) {
|
|
885
|
+
return { ok: false, error: error.message, centralHost };
|
|
886
|
+
}
|
|
887
|
+
const processorHost = typeof data?.value === "string" ? data.value : null;
|
|
888
|
+
return {
|
|
889
|
+
ok: true,
|
|
890
|
+
centralHost,
|
|
891
|
+
processorHost,
|
|
892
|
+
updatedAt: typeof data?.updated_at === "string" ? data.updated_at : null,
|
|
893
|
+
matches: Boolean(centralHost && processorHost === centralHost),
|
|
894
|
+
};
|
|
895
|
+
});
|
|
896
|
+
export const repairFlorydayShellHost = createServerFn({ method: "POST" })
|
|
897
|
+
.middleware([requireSupabaseAuth])
|
|
898
|
+
.handler(async ({ context }) => {
|
|
899
|
+
const { data: isAdmin, error: roleError } = await context.supabase.rpc("has_role", {
|
|
900
|
+
_user_id: context.userId,
|
|
901
|
+
_role: "admin",
|
|
902
|
+
});
|
|
903
|
+
if (roleError)
|
|
904
|
+
throw new Error(roleError.message);
|
|
905
|
+
if (!isAdmin)
|
|
906
|
+
throw new Error("Alleen admins mogen de verwerker-host herstellen");
|
|
907
|
+
const result = await syncShellHostRuntimeConfig();
|
|
908
|
+
if (!result.base) {
|
|
909
|
+
throw new Error("Central Auth gaf geen actieve shell-host terug.");
|
|
910
|
+
}
|
|
911
|
+
return { ok: true, host: result.base, changed: result.changed };
|
|
912
|
+
});
|
|
857
913
|
async function scheduleFlorydayTokenRefreshInternal(supabase) {
|
|
858
914
|
const apikey = process.env.SUPABASE_PUBLISHABLE_KEY ?? process.env.VITE_SUPABASE_PUBLISHABLE_KEY;
|
|
859
915
|
if (!apikey)
|