@flowselections/logistiek-engine 1.0.167 → 1.0.170
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/FloridayPoortCard.d.ts.map +1 -1
- package/dist-lib/components/FloridayPoortCard.js +8 -2
- package/dist-lib/hooks/useFloridayGate.d.ts +2 -0
- package/dist-lib/hooks/useFloridayGate.d.ts.map +1 -1
- package/dist-lib/hooks/useFloridayGate.js +9 -2
- package/dist-lib/index.d.ts +0 -1
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +1 -5
- package/dist-lib/integrations/supabase/types.d.ts +669 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/autoSend.server.d.ts +1 -0
- package/dist-lib/lib/autoSend.server.d.ts.map +1 -1
- package/dist-lib/lib/autoSend.server.js +17 -2
- package/dist-lib/lib/floridayPush.server.d.ts +3 -0
- package/dist-lib/lib/floridayPush.server.d.ts.map +1 -1
- package/dist-lib/lib/floridayPush.server.js +25 -0
- package/dist-lib/lib/floridayWriteMode.d.ts +15 -0
- package/dist-lib/lib/floridayWriteMode.d.ts.map +1 -0
- package/dist-lib/lib/floridayWriteMode.js +44 -0
- package/dist-lib/lib/floridayWriteMode.server.d.ts +5 -0
- package/dist-lib/lib/floridayWriteMode.server.d.ts.map +1 -0
- package/dist-lib/lib/floridayWriteMode.server.js +11 -0
- package/dist-lib/lib/handlers/logistics-tick.server.js +18 -0
- package/dist-lib/lib/moduleVersion.d.ts +1 -1
- package/dist-lib/lib/moduleVersion.js +1 -1
- package/dist-lib/lib/shippingNoteQueue.server.d.ts.map +1 -1
- package/dist-lib/lib/shippingNoteQueue.server.js +15 -0
- package/dist-lib/lib/stickerQueue.server.d.ts.map +1 -1
- package/dist-lib/lib/stickerQueue.server.js +14 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoSend.server.d.ts","sourceRoot":"","sources":["../../src/lib/autoSend.server.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"autoSend.server.d.ts","sourceRoot":"","sources":["../../src/lib/autoSend.server.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAa5D,uFAAuF;AACvF,wBAAsB,cAAc,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAS/E;AAED,wBAAsB,gBAAgB,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO;;;;;;;GAgGvF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AUTO_SEND_ADRES_REDEN, AUTO_SEND_PATH, autoSendBody, beoordeelAntwoord, normaliseerShellAdres, ondertekenAutoSend, } from "./autoSend.js";
|
|
2
2
|
import { haalAutoSendSleutel, terugvalShellAdres } from "./centralSecrets.server.js";
|
|
3
|
+
import { ALLEEN_LEZEN_REDEN, isReadOnlyBlocked } from "./floridayWriteMode.js";
|
|
4
|
+
import { readFloridayWriteMode } from "./floridayWriteMode.server.js";
|
|
3
5
|
/** shell_base_url; alleen als die ontbreekt: PUBLIC_BASE_URL of de centrale dienst. */
|
|
4
6
|
export async function leesShellAdres(sb) {
|
|
5
7
|
try {
|
|
@@ -14,7 +16,7 @@ export async function leesShellAdres(sb) {
|
|
|
14
16
|
return normaliseerShellAdres(await terugvalShellAdres());
|
|
15
17
|
}
|
|
16
18
|
export async function runAutoSendQueue(sb, opts = {}) {
|
|
17
|
-
const run = { claimed: 0, sent: 0, failed: 0, definitief: 0, configMissing: 0 };
|
|
19
|
+
const run = { claimed: 0, sent: 0, failed: 0, definitief: 0, configMissing: 0, readOnly: 0 };
|
|
18
20
|
const { data, error } = await sb.rpc("logistics_auto_send_claim", { p_limit: opts.limit ?? 10 });
|
|
19
21
|
if (error)
|
|
20
22
|
throw new Error(error.message);
|
|
@@ -27,6 +29,7 @@ export async function runAutoSendQueue(sb, opts = {}) {
|
|
|
27
29
|
const configReden = sleutel.sleutel === null
|
|
28
30
|
? `Automatisch versturen niet mogelijk: ${sleutel.reden}`
|
|
29
31
|
: !adres ? AUTO_SEND_ADRES_REDEN : null;
|
|
32
|
+
const alleenLezen = (await readFloridayWriteMode(sb)).readOnly;
|
|
30
33
|
for (const row of rows) {
|
|
31
34
|
const finish = (ok, reason, http, cfg = false, definitief = false) => sb.rpc("logistics_auto_send_finish", {
|
|
32
35
|
p_id: row.id, p_ok: ok, p_reason: reason, p_http: http, p_config_missing: cfg, p_definitief: definitief,
|
|
@@ -36,6 +39,12 @@ export async function runAutoSendQueue(sb, opts = {}) {
|
|
|
36
39
|
await finish(false, configReden ?? AUTO_SEND_ADRES_REDEN, null, true);
|
|
37
40
|
continue;
|
|
38
41
|
}
|
|
42
|
+
// 1.0.169: koppeling op alleen lezen => niet aanroepen, geen poging; later opnieuw kijken.
|
|
43
|
+
if (alleenLezen) {
|
|
44
|
+
run.readOnly++;
|
|
45
|
+
await finish(false, ALLEEN_LEZEN_REDEN, null, true);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
39
48
|
// 1.0.166: volledig afgehandeld in Floriday => nooit automatisch versturen. Onleesbaar => later opnieuw.
|
|
40
49
|
{
|
|
41
50
|
const { data: extern, error: externError } = await sb.rpc("logistics_order_external_state", { p_order_id: row.order_id });
|
|
@@ -65,7 +74,13 @@ export async function runAutoSendQueue(sb, opts = {}) {
|
|
|
65
74
|
body,
|
|
66
75
|
signal: AbortSignal.timeout(15000),
|
|
67
76
|
});
|
|
68
|
-
const
|
|
77
|
+
const tekst = await res.text().catch(() => "");
|
|
78
|
+
if (isReadOnlyBlocked(res.status, tekst)) {
|
|
79
|
+
run.readOnly++;
|
|
80
|
+
await finish(false, ALLEEN_LEZEN_REDEN, res.status, true);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const uitkomst = beoordeelAntwoord(res.status, tekst);
|
|
69
84
|
if (uitkomst.soort === "verstuurd") {
|
|
70
85
|
run.sent++;
|
|
71
86
|
await finish(true, null, res.status);
|
|
@@ -56,6 +56,9 @@ export interface PushQueueResult {
|
|
|
56
56
|
notApplicable: number;
|
|
57
57
|
/** Statuswaarden die we niet kennen — nooit stilzwijgend laten verdwijnen. */
|
|
58
58
|
unknown: number;
|
|
59
|
+
/** Koppeling op alleen lezen: tegengehouden, telt niet als poging. */
|
|
60
|
+
readOnly: boolean;
|
|
61
|
+
heldReadOnly: number;
|
|
59
62
|
}
|
|
60
63
|
export declare function runFloridayPushQueue(sb: SupabaseClient, opts?: {
|
|
61
64
|
limit?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floridayPush.server.d.ts","sourceRoot":"","sources":["../../src/lib/floridayPush.server.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"floridayPush.server.d.ts","sourceRoot":"","sources":["../../src/lib/floridayPush.server.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAc/C,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAUlD;AAaD,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,YAAY,EAAE,OAAO,2BAA2B,EAAE,WAAW,EAAE,CAAC;CACjE;AAED,MAAM,MAAM,WAAW,GACnB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,mBAAmB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAUnE;;;;GAIG;AACH,wBAAsB,8BAA8B,CAClD,EAAE,EAAE,cAAc,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CACN;IACE,EAAE,EAAE,IAAI,CAAC;IACT,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,cAAc,EAAE,OAAO,2BAA2B,EAAE,oBAAoB,EAAE,CAAC;IAC3E,OAAO,EAAE,MAAM,CAAC;CACjB,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAC7C,CAoEA;AAED,8CAA8C;AAC9C,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,cAAc,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,CAAC,CAkItB;AAQD,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAW3F;AAED,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhG;AA6BD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,OAAO,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAElF,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAYD,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,cAAc,EAClB,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACjD,OAAO,CAAC,eAAe,CAAC,CAqN1B;AAQD,wBAAsB,wBAAwB,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,SAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAS3F"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// - Backoff + dead-letter; alles begrensd op batch en tijd.
|
|
11
11
|
// - Supabase-client komt altijd als eerste parameter binnen (geen module-state).
|
|
12
12
|
// ============================================================================
|
|
13
|
+
import { isReadOnlyBlocked } from "./floridayWriteMode.js";
|
|
13
14
|
export const FLORIDAY_PUSH_BATCH = 20;
|
|
14
15
|
export const FLORIDAY_PUSH_LEASE_SECONDS = 120;
|
|
15
16
|
// ---------------------------------------------------------------------------
|
|
@@ -288,6 +289,8 @@ export async function runFloridayPushQueue(sb, opts = {}) {
|
|
|
288
289
|
alreadyFulfilled: 0,
|
|
289
290
|
notApplicable: 0,
|
|
290
291
|
unknown: 0,
|
|
292
|
+
readOnly: false,
|
|
293
|
+
heldReadOnly: 0,
|
|
291
294
|
};
|
|
292
295
|
// De Engine verstuurt nooit zelf een afleveropdracht (sinds 1.0.130),
|
|
293
296
|
// ongeacht belading_verstuurder. De wachtrij wordt niet meer verwerkt.
|
|
@@ -313,6 +316,16 @@ export async function runFloridayPushQueue(sb, opts = {}) {
|
|
|
313
316
|
catch {
|
|
314
317
|
return out;
|
|
315
318
|
}
|
|
319
|
+
// Poort 1b (1.0.169): koppeling op alleen lezen? Dan niets oppakken; dat is
|
|
320
|
+
// geen fout en geen poging. Geparkeerde rijen komen vrij zodra het mag.
|
|
321
|
+
{
|
|
322
|
+
const { readFloridayWriteMode } = await import("./floridayWriteMode.server.js");
|
|
323
|
+
const mode = await readFloridayWriteMode(sb);
|
|
324
|
+
if (mode.readOnly) {
|
|
325
|
+
out.readOnly = true;
|
|
326
|
+
return out;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
316
329
|
let claimed = [];
|
|
317
330
|
try {
|
|
318
331
|
const { data } = await sb.rpc("logistics_floriday_claim_pushes", {
|
|
@@ -373,6 +386,18 @@ export async function runFloridayPushQueue(sb, opts = {}) {
|
|
|
373
386
|
else {
|
|
374
387
|
const res = await sendFlorydayFulfillmentOrder(sb, built.payload, "logistiek-engine", orderRef);
|
|
375
388
|
gatewayStatus = typeof res?.status === "number" ? res.status : null;
|
|
389
|
+
// 1.0.169: 423 write_blocked/read_only is geen Floriday-fout en geen poging.
|
|
390
|
+
if (isReadOnlyBlocked(gatewayStatus, res)) {
|
|
391
|
+
try {
|
|
392
|
+
await sb.rpc("logistics_floriday_push_hold_read_only", { _id: id, _revision: revision });
|
|
393
|
+
}
|
|
394
|
+
catch {
|
|
395
|
+
// Lease verloopt vanzelf; de voorcontrole houdt de volgende ronde tegen.
|
|
396
|
+
}
|
|
397
|
+
out.readOnly = true;
|
|
398
|
+
out.heldReadOnly++;
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
376
401
|
// Nieuw contract: { status, payload: { ok, error, fulfillmentOrderId } }.
|
|
377
402
|
// Defensief: een oudere gatewayversie gaf ok/error op het hoogste niveau.
|
|
378
403
|
const payload = (res?.payload ?? null);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const ALLEEN_LEZEN_REDEN = "Tegengehouden: alleen lezen";
|
|
2
|
+
export declare const ALLEEN_LEZEN_CODE = "alleen_lezen";
|
|
3
|
+
export interface FloridayWriteMode {
|
|
4
|
+
/** true = alleen lezen. Onleesbaar of onbekend telt ook als alleen lezen. */
|
|
5
|
+
readOnly: boolean;
|
|
6
|
+
/** false als de stand niet gelezen kon worden. */
|
|
7
|
+
known: boolean;
|
|
8
|
+
environment: string | null;
|
|
9
|
+
changedAt: string | null;
|
|
10
|
+
}
|
|
11
|
+
/** Fail closed: alleen een expliciete read_only=false betekent schrijven toegestaan. */
|
|
12
|
+
export declare function parseWriteMode(data: unknown): FloridayWriteMode;
|
|
13
|
+
/** Herkent de weigering van Floriday-authenticatie bij een koppeling op alleen lezen. */
|
|
14
|
+
export declare function isReadOnlyBlocked(status: number | null | undefined, body: unknown): boolean;
|
|
15
|
+
//# sourceMappingURL=floridayWriteMode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floridayWriteMode.d.ts","sourceRoot":"","sources":["../../src/lib/floridayWriteMode.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,kBAAkB,gCAAgC,CAAC;AAChE,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,MAAM,WAAW,iBAAiB;IAChC,6EAA6E;IAC7E,QAAQ,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB,CAW/D;AAED,yFAAyF;AACzF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAgB3F"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// src/lib/floridayWriteMode.ts — stand "alleen lezen" van de Floriday-koppeling
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Floriday-authenticatie (1.0.92) weigert elke schrijfactie zolang de koppeling
|
|
5
|
+
// op alleen lezen staat: HTTP 423 { ok:false, code:"write_blocked",
|
|
6
|
+
// reason:"read_only" }. Dat is geen Floriday-fout en geen mislukte poging.
|
|
7
|
+
// Pure hulpfuncties, los te testen.
|
|
8
|
+
// ============================================================================
|
|
9
|
+
export const ALLEEN_LEZEN_REDEN = "Tegengehouden: alleen lezen";
|
|
10
|
+
export const ALLEEN_LEZEN_CODE = "alleen_lezen";
|
|
11
|
+
/** Fail closed: alleen een expliciete read_only=false betekent schrijven toegestaan. */
|
|
12
|
+
export function parseWriteMode(data) {
|
|
13
|
+
const d = data && typeof data === "object" && !Array.isArray(data) ? data : null;
|
|
14
|
+
if (!d || typeof d["read_only"] !== "boolean") {
|
|
15
|
+
return { readOnly: true, known: false, environment: null, changedAt: null };
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
readOnly: d["read_only"] !== false,
|
|
19
|
+
known: true,
|
|
20
|
+
environment: typeof d["environment"] === "string" ? d["environment"] : null,
|
|
21
|
+
changedAt: typeof d["changed_at"] === "string" ? d["changed_at"] : null,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Herkent de weigering van Floriday-authenticatie bij een koppeling op alleen lezen. */
|
|
25
|
+
export function isReadOnlyBlocked(status, body) {
|
|
26
|
+
let b = body;
|
|
27
|
+
if (typeof b === "string") {
|
|
28
|
+
try {
|
|
29
|
+
b = JSON.parse(b);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
b = null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const o = b && typeof b === "object" ? b : null;
|
|
36
|
+
const inner = o && o["payload"] && typeof o["payload"] === "object" ? o["payload"] : null;
|
|
37
|
+
const code = String(o?.["code"] ?? inner?.["code"] ?? "");
|
|
38
|
+
const reason = String(o?.["reason"] ?? inner?.["reason"] ?? "");
|
|
39
|
+
if (code !== "write_blocked")
|
|
40
|
+
return false;
|
|
41
|
+
if (reason === "read_only")
|
|
42
|
+
return true;
|
|
43
|
+
return status === 423 && reason === "";
|
|
44
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SupabaseClient } from "@supabase/supabase-js";
|
|
2
|
+
import { type FloridayWriteMode } from "./floridayWriteMode.js";
|
|
3
|
+
/** Leest floriday_write_mode(); ontbreekt de functie of faalt hij: alleen lezen (fail closed). */
|
|
4
|
+
export declare function readFloridayWriteMode(sb: SupabaseClient): Promise<FloridayWriteMode>;
|
|
5
|
+
//# sourceMappingURL=floridayWriteMode.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floridayWriteMode.server.d.ts","sourceRoot":"","sources":["../../src/lib/floridayWriteMode.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhF,kGAAkG;AAClG,wBAAsB,qBAAqB,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAO1F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { parseWriteMode } from "./floridayWriteMode.js";
|
|
2
|
+
/** Leest floriday_write_mode(); ontbreekt de functie of faalt hij: alleen lezen (fail closed). */
|
|
3
|
+
export async function readFloridayWriteMode(sb) {
|
|
4
|
+
try {
|
|
5
|
+
const { data, error } = await sb.rpc("floriday_write_mode");
|
|
6
|
+
return parseWriteMode(error ? null : data);
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return parseWriteMode(null);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -191,6 +191,16 @@ async function runTickRound(supabase, tickJob, ident) {
|
|
|
191
191
|
catch (e) {
|
|
192
192
|
queueRefresh = { error: String(e?.message ?? e) };
|
|
193
193
|
}
|
|
194
|
+
// 1.0.169: rijen die op "alleen lezen" geparkeerd stonden vrijgeven zodra
|
|
195
|
+
// de Floriday-koppeling weer mag schrijven (doet niets zolang alleen lezen).
|
|
196
|
+
let floridayReadOnly = null;
|
|
197
|
+
try {
|
|
198
|
+
const { data, error } = await supabase.rpc("logistics_floriday_release_read_only");
|
|
199
|
+
floridayReadOnly = error ? { error: error.message } : data;
|
|
200
|
+
}
|
|
201
|
+
catch (e) {
|
|
202
|
+
floridayReadOnly = { error: String(e?.message ?? e) };
|
|
203
|
+
}
|
|
194
204
|
// Floriday-pushwachtrij verwerken binnen dezelfde aanroep, met eigen marge.
|
|
195
205
|
let push = null;
|
|
196
206
|
try {
|
|
@@ -223,6 +233,13 @@ async function runTickRound(supabase, tickJob, ident) {
|
|
|
223
233
|
p_limit: 200,
|
|
224
234
|
});
|
|
225
235
|
shippingNotesBackfill = backfill ?? null;
|
|
236
|
+
// 1.0.168: verzendstatus van voorraadmails overnemen uit de outbox.
|
|
237
|
+
try {
|
|
238
|
+
await supabase.rpc("logistics_sync_stock_alert_email_status", { p_limit: 500 });
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
/* mag de ronde niet blokkeren */
|
|
242
|
+
}
|
|
226
243
|
// Zelfherstel: een eigen verzendbrief die bij een Floriday-order hoort wordt
|
|
227
244
|
// geannuleerd en vervangen door de officiele Floriday-aanvraag.
|
|
228
245
|
try {
|
|
@@ -371,6 +388,7 @@ async function runTickRound(supabase, tickJob, ident) {
|
|
|
371
388
|
queueRefresh,
|
|
372
389
|
pickupMoments,
|
|
373
390
|
push,
|
|
391
|
+
floridayReadOnly,
|
|
374
392
|
control,
|
|
375
393
|
shippingNotes,
|
|
376
394
|
barcodes,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const MODULE_VERSION = "1.0.
|
|
1
|
+
export declare const MODULE_VERSION = "1.0.170";
|
|
2
2
|
//# sourceMappingURL=moduleVersion.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatisch gegenereerd door prebuild:lib; niet handmatig aanpassen.
|
|
2
|
-
export const MODULE_VERSION = "1.0.
|
|
2
|
+
export const MODULE_VERSION = "1.0.170";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shippingNoteQueue.server.d.ts","sourceRoot":"","sources":["../../src/lib/shippingNoteQueue.server.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"shippingNoteQueue.server.d.ts","sourceRoot":"","sources":["../../src/lib/shippingNoteQueue.server.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAS5D,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAoCD,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,cAAc,EAClB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/B,OAAO,CAAC,eAAe,CAAC,CA8f1B;AAMD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,aAAa,GAAG,IAAI,CAAC;AAElE,qGAAqG;AACrG,wBAAsB,uBAAuB,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAQ9F;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAG5E;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,mBAAmB,GAAG,MAAM,CAI3E"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// Er wordt niets bevestigd of afgehandeld, en er komen geen omgevings- of
|
|
12
12
|
// klantwaarden in deze code.
|
|
13
13
|
// ============================================================================
|
|
14
|
+
import { ALLEEN_LEZEN_CODE, ALLEEN_LEZEN_REDEN, isReadOnlyBlocked } from "./floridayWriteMode.js";
|
|
14
15
|
import { trace, newTraceId, classifyError } from "./trace.server.js";
|
|
15
16
|
import { FLOW_NODE } from "./flowNodes.js";
|
|
16
17
|
import { printViaLayoutGecontroleerd, floridayLayout, floridayPdfOpslag } from "./layoutPrint.server.js";
|
|
@@ -325,6 +326,20 @@ export async function runShippingNoteQueue(sb, options = {}) {
|
|
|
325
326
|
},
|
|
326
327
|
durationMs: Date.now() - startOphalen,
|
|
327
328
|
});
|
|
329
|
+
// 1.0.169: koppeling op alleen lezen is geen Floriday-fout en geen poging.
|
|
330
|
+
if (isReadOnlyBlocked(typeof doc["status"] === "number" ? doc["status"] : null, doc)) {
|
|
331
|
+
await sb.rpc("logistics_slip_note_hold_read_only", { _id: row.id });
|
|
332
|
+
run.waiting++;
|
|
333
|
+
await trace(sb, {
|
|
334
|
+
...basis,
|
|
335
|
+
step: ALLEEN_LEZEN_REDEN,
|
|
336
|
+
status: "wachtend",
|
|
337
|
+
decision: ALLEEN_LEZEN_CODE,
|
|
338
|
+
reason: "De Floriday-koppeling staat op alleen lezen.",
|
|
339
|
+
nextStep: "Gaat vanzelf verder zodra de koppeling weer mag schrijven",
|
|
340
|
+
});
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
328
343
|
if (!doc["ok"]) {
|
|
329
344
|
const message = String(doc["error"] ?? "") ||
|
|
330
345
|
"Wachten op officiële Floriday-afleverbrief: Floriday heeft het document nog niet aangemaakt.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stickerQueue.server.d.ts","sourceRoot":"","sources":["../../src/lib/stickerQueue.server.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"stickerQueue.server.d.ts","sourceRoot":"","sources":["../../src/lib/stickerQueue.server.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAiB5D,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAoCD,wBAAsB,eAAe,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CA2T5G"}
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
//
|
|
13
13
|
// Geen omgevingswaarden; Floriday wordt nooit rechtstreeks aangeroepen.
|
|
14
14
|
// ============================================================================
|
|
15
|
+
import { ALLEEN_LEZEN_REDEN, isReadOnlyBlocked } from "./floridayWriteMode.js";
|
|
16
|
+
import { readFloridayWriteMode } from "./floridayWriteMode.server.js";
|
|
15
17
|
import { trace, newTraceId } from "./trace.server.js";
|
|
16
18
|
import { printViaLayoutGecontroleerd, floridayLayout, bucketUitLink } from "./layoutPrint.server.js";
|
|
17
19
|
import { getFlorydayDocument, getFlorydayFulfillmentStatus } from "./floridayDocuments.server.js";
|
|
@@ -387,6 +389,16 @@ async function afmelden(sb, run) {
|
|
|
387
389
|
if (klaarVoorAfmelden.length === 0)
|
|
388
390
|
return 0;
|
|
389
391
|
const ids = klaarVoorAfmelden.flatMap((s) => perSticker.get(s) ?? []);
|
|
392
|
+
// 1.0.169: koppeling op alleen lezen => niet afmelden, geen fout; later opnieuw kijken.
|
|
393
|
+
const tegenhouden = async () => {
|
|
394
|
+
await sb
|
|
395
|
+
.from("logistics_sticker_prints")
|
|
396
|
+
.update({ handled_error: ALLEEN_LEZEN_REDEN, handled_next_at: new Date(Date.now() + 5 * 60000).toISOString() })
|
|
397
|
+
.in("id", ids);
|
|
398
|
+
return 0;
|
|
399
|
+
};
|
|
400
|
+
if ((await readFloridayWriteMode(sb)).readOnly)
|
|
401
|
+
return tegenhouden();
|
|
390
402
|
const gw = (await import("@flowselections/floriday-authenticatie-module/gateway"));
|
|
391
403
|
const fn = gw["runCustomerStickersHandled"];
|
|
392
404
|
const volgende = new Date(Date.now() + 60 * 60000).toISOString();
|
|
@@ -404,6 +416,8 @@ async function afmelden(sb, run) {
|
|
|
404
416
|
const res = (await fn(sb, {
|
|
405
417
|
stickerIds: klaarVoorAfmelden,
|
|
406
418
|
})) ?? {};
|
|
419
|
+
if (isReadOnlyBlocked(typeof res["status"] === "number" ? res["status"] : null, res))
|
|
420
|
+
return tegenhouden();
|
|
407
421
|
const ok = res["ok"] === true || res["payload"]?.["ok"] === true;
|
|
408
422
|
if (!ok)
|
|
409
423
|
throw new Error(String(res["error"] ?? res["payload"]?.["error"] ?? "onbekende fout"));
|