@flowselections/floriday-authenticatie-module 1.0.39 → 1.0.40
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/assets/floriday-logo.png.asset.json +11 -0
- package/dist-lib/components/TemplatePage.d.ts +1 -1
- package/dist-lib/components/TemplatePage.d.ts.map +1 -1
- package/dist-lib/components/floriday/FlorydayConnectionPage.d.ts +1 -1
- package/dist-lib/components/floriday/FlorydayConnectionPage.d.ts.map +1 -1
- package/dist-lib/components/floriday/FlorydaySyncHealthBanner.d.ts +1 -1
- package/dist-lib/components/floriday/FlorydaySyncHealthBanner.d.ts.map +1 -1
- package/dist-lib/components/floriday/FlorydaySyncJobsCard.d.ts +1 -1
- package/dist-lib/components/floriday/FlorydaySyncJobsCard.d.ts.map +1 -1
- package/dist-lib/components/floriday/TokenHealthCard.d.ts +1 -1
- package/dist-lib/components/floriday/TokenHealthCard.d.ts.map +1 -1
- package/dist-lib/components/settings/FloricodeSettingsCard.d.ts +1 -1
- package/dist-lib/components/settings/FloricodeSettingsCard.d.ts.map +1 -1
- package/dist-lib/components/settings/FlorydaySettingsCard.d.ts +1 -1
- package/dist-lib/components/settings/FlorydaySettingsCard.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +91 -0
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +91 -0
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +91 -0
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +91 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/cron/process-stock-queue.js +2 -2
- package/dist-lib/lib/error-page.js +30 -30
- package/dist-lib/lib/floricode.functions.d.ts +637 -0
- package/dist-lib/lib/floricode.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-auction-letters.functions.d.ts +91 -0
- package/dist-lib/lib/floriday-auction-letters.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-labels.functions.d.ts +91 -0
- package/dist-lib/lib/floriday-labels.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-public.functions.d.ts +546 -0
- package/dist-lib/lib/floriday-public.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-stickers.functions.d.ts +91 -0
- package/dist-lib/lib/floriday-stickers.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-sync.functions.d.ts +2821 -0
- package/dist-lib/lib/floriday-sync.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-writes.functions.d.ts +552 -6
- package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday.functions.d.ts +1732 -0
- package/dist-lib/lib/floriday.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday.functions.js +46 -3
- package/package.json +1 -1
|
@@ -796,6 +796,11 @@ export async function syncFloridayEntityBySequence(supabase, env, connectionId,
|
|
|
796
796
|
.eq("connection_id", connectionId)
|
|
797
797
|
.eq("entity_type", opts.entityType)
|
|
798
798
|
.maybeSingle();
|
|
799
|
+
// Een ONTBREKENDE state-rij mag NOOIT stil op 0 starten: Floriday-sequences
|
|
800
|
+
// zijn globaal, dus cursor 0 haalt willekeurige historie (2019) binnen en
|
|
801
|
+
// springt daarna door de kleine-batch-regel meteen naar maxSeq. We starten
|
|
802
|
+
// in dat geval expliciet op maxSeq en markeren de rij als "backfill nodig".
|
|
803
|
+
const hasStateRow = stateRow != null;
|
|
799
804
|
const startCursor = stateRow?.last_sequence_number ?? 0;
|
|
800
805
|
try {
|
|
801
806
|
// Debug-logging: helpt 401's onderscheid maken tussen scope-issue,
|
|
@@ -812,6 +817,32 @@ export async function syncFloridayEntityBySequence(supabase, env, connectionId,
|
|
|
812
817
|
/* logging mag nooit de sync breken */
|
|
813
818
|
}
|
|
814
819
|
const maxSeq = await fetchMaxSequence(supabase, env, opts.maxSequenceEndpoint);
|
|
820
|
+
if (!hasStateRow) {
|
|
821
|
+
// Geen cursor bekend: initialiseer op maxSeq (geen impliciete reset naar 0)
|
|
822
|
+
// en markeer expliciet dat historische data ontbreekt. Een backfill moet
|
|
823
|
+
// bewust worden gestart; nooit ongemerkt via deze sync.
|
|
824
|
+
const marker = `BACKFILL NODIG: cursor geïnitialiseerd op maxSeq=${maxSeq} zonder historie (entity=${opts.entityType}, connection=${connectionId}). Start een gerichte backfill/by-id refetch om oudere records te herstellen.`;
|
|
825
|
+
console.warn("[floriday-sync] %s", marker);
|
|
826
|
+
const initIso = new Date().toISOString();
|
|
827
|
+
await supabase
|
|
828
|
+
.from("floriday_sync_state")
|
|
829
|
+
.upsert({
|
|
830
|
+
connection_id: connectionId,
|
|
831
|
+
entity_type: opts.entityType,
|
|
832
|
+
last_sequence_number: maxSeq,
|
|
833
|
+
last_synced_at: initIso,
|
|
834
|
+
last_success_at: initIso,
|
|
835
|
+
last_items_processed: 0,
|
|
836
|
+
last_error: marker.slice(0, 500),
|
|
837
|
+
});
|
|
838
|
+
return {
|
|
839
|
+
synced: 0,
|
|
840
|
+
fromSequence: maxSeq,
|
|
841
|
+
toSequence: maxSeq,
|
|
842
|
+
durationMs: Date.now() - t0,
|
|
843
|
+
backfillNeeded: true,
|
|
844
|
+
};
|
|
845
|
+
}
|
|
815
846
|
let cursor = startCursor;
|
|
816
847
|
let totalSynced = 0;
|
|
817
848
|
let safety = 0;
|
|
@@ -1129,6 +1160,17 @@ async function hashIdempotencyKey(input) {
|
|
|
1129
1160
|
* zonder Floriday opnieuw aan te roepen.
|
|
1130
1161
|
*/
|
|
1131
1162
|
export async function florydayWrite(supabase, env, opts) {
|
|
1163
|
+
// Eén plek waar de API-versieprefix aan schrijfpaden wordt toegevoegd.
|
|
1164
|
+
// Idempotent: een pad dat de prefix al meestuurt krijgt er geen tweede.
|
|
1165
|
+
const rawPath = opts.path.startsWith("/") ? opts.path : `/${opts.path}`;
|
|
1166
|
+
let requestPath;
|
|
1167
|
+
if (rawPath.startsWith(`/${SUPPLIERS_API_VERSION}/`) || rawPath === `/${SUPPLIERS_API_VERSION}`) {
|
|
1168
|
+
requestPath = rawPath;
|
|
1169
|
+
console.warn(`[florydayWrite] caller stuurde de API-versieprefix zelf mee (${opts.module}/${opts.action}): ${rawPath} — prefix hoort in florydayWrite`);
|
|
1170
|
+
}
|
|
1171
|
+
else {
|
|
1172
|
+
requestPath = `/${SUPPLIERS_API_VERSION}${rawPath}`;
|
|
1173
|
+
}
|
|
1132
1174
|
const conn = await getActiveFlorydayCredentials(supabase, env);
|
|
1133
1175
|
if (!conn) {
|
|
1134
1176
|
return {
|
|
@@ -1200,9 +1242,10 @@ export async function florydayWrite(supabase, env, opts) {
|
|
|
1200
1242
|
"Idempotency-Key": idemKey,
|
|
1201
1243
|
};
|
|
1202
1244
|
const requestLog = {
|
|
1203
|
-
endpoint
|
|
1245
|
+
// endpoint == het werkelijk verstuurde pad (geen samengestelde string).
|
|
1246
|
+
endpoint: requestPath,
|
|
1204
1247
|
method: opts.method,
|
|
1205
|
-
path:
|
|
1248
|
+
path: requestPath,
|
|
1206
1249
|
environment: env,
|
|
1207
1250
|
connectionId: conn.id,
|
|
1208
1251
|
tenant: {
|
|
@@ -1225,7 +1268,7 @@ export async function florydayWrite(supabase, env, opts) {
|
|
|
1225
1268
|
let ok = false;
|
|
1226
1269
|
let errMsg;
|
|
1227
1270
|
try {
|
|
1228
|
-
const res = await florydayFetch(supabase, env,
|
|
1271
|
+
const res = await florydayFetch(supabase, env, requestPath, {
|
|
1229
1272
|
method: opts.method,
|
|
1230
1273
|
headers,
|
|
1231
1274
|
body: opts.body == null ? undefined : JSON.stringify(opts.body),
|