@flowselections/logistiek-engine 1.0.32 → 1.0.33
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/README.md +24 -24
- package/dist-lib/components/FloridayPoortCard.d.ts +2 -0
- package/dist-lib/components/FloridayPoortCard.d.ts.map +1 -0
- package/dist-lib/components/FloridayPoortCard.js +28 -0
- package/dist-lib/components/LogistiekEnginePage.d.ts.map +1 -1
- package/dist-lib/components/LogistiekEnginePage.js +2 -1
- package/dist-lib/hooks/useFloridayGate.d.ts +30 -0
- package/dist-lib/hooks/useFloridayGate.d.ts.map +1 -0
- package/dist-lib/hooks/useFloridayGate.js +46 -0
- package/dist-lib/index.d.ts +2 -0
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +2 -0
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +162 -0
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +158 -1515
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +162 -0
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/moduleClient.d.ts +162 -0
- package/dist-lib/integrations/supabase/moduleClient.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +162 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/floridayDocuments.functions.d.ts +486 -0
- package/dist-lib/lib/floridayDocuments.functions.d.ts.map +1 -1
- package/dist-lib/lib/floridayDocuments.server.d.ts +3 -4
- package/dist-lib/lib/floridayDocuments.server.d.ts.map +1 -1
- package/dist-lib/lib/floridayDocuments.server.js +24 -15
- package/dist-lib/lib/floridayGuard.server.d.ts +32 -0
- package/dist-lib/lib/floridayGuard.server.d.ts.map +1 -0
- package/dist-lib/lib/floridayGuard.server.js +111 -0
- package/dist-lib/lib/floridayPush.functions.d.ts +162 -0
- package/dist-lib/lib/floridayPush.functions.d.ts.map +1 -1
- package/dist-lib/lib/floridayPush.server.d.ts.map +1 -1
- package/dist-lib/lib/floridayPush.server.js +1 -1
- package/dist-lib/lib/loadCarrierPlanning.functions.d.ts +810 -0
- package/dist-lib/lib/loadCarrierPlanning.functions.d.ts.map +1 -1
- package/dist-lib/lib/logisticsRecalcJob.functions.d.ts +324 -0
- package/dist-lib/lib/logisticsRecalcJob.functions.d.ts.map +1 -1
- package/dist-lib/lib/logisticsRecalculate.functions.d.ts +162 -0
- package/dist-lib/lib/logisticsRecalculate.functions.d.ts.map +1 -1
- package/dist-lib/lib/modulePrompts.d.ts.map +1 -1
- package/dist-lib/lib/modulePrompts.js +2617 -2578
- package/package.json +1 -1
|
@@ -46,11 +46,10 @@ export interface FulfillmentSendResult {
|
|
|
46
46
|
/**
|
|
47
47
|
* Fulfillment-order aanmaken in Floriday.
|
|
48
48
|
*
|
|
49
|
-
* Laatste poort
|
|
50
|
-
*
|
|
51
|
-
* gelezen worden, dan versturen we niet.
|
|
49
|
+
* Laatste poort vóór de gateway: de gedeelde wachter bepaalt of er iets weg
|
|
50
|
+
* mag. Fail closed — is de poort niet leesbaar, dan versturen we niet.
|
|
52
51
|
*/
|
|
53
|
-
export declare function sendFlorydayFulfillmentOrder(supabase: SupabaseClient, body: unknown, caller?: string): Promise<FulfillmentSendResult>;
|
|
52
|
+
export declare function sendFlorydayFulfillmentOrder(supabase: SupabaseClient, body: unknown, caller?: string, orderRef?: string | null): Promise<FulfillmentSendResult>;
|
|
54
53
|
export type DocumentKind = "delivery-note" | "logistic-label" | "auction-letter" | "customer-sticker";
|
|
55
54
|
export interface PrintClaim {
|
|
56
55
|
fresh: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floridayDocuments.server.d.ts","sourceRoot":"","sources":["../../src/lib/floridayDocuments.server.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CA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,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,wEAAwE;IACxE,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED
|
|
1
|
+
{"version":3,"file":"floridayDocuments.server.d.ts","sourceRoot":"","sources":["../../src/lib/floridayDocuments.server.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAKL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACzB,MAAM,uDAAuD,CAAC;AAE/D,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,IAAI,CAAC;IACT,WAAW,EAAE,mBAAmB,CAAC;IACjC,UAAU,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;QACjC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,SAAS,EAAE,OAAO,CAAC;KACpB,GAAG,IAAI,CAAC;CACV;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAC/C,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,wBAAwB,GAAG,uBAAuB,CAAC,CAqB7D;AAED,sEAAsE;AACtE,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,GACnC,OAAO,CAAC,SAAS,CAAC,CAOpB;AAED,yDAAyD;AACzD,wBAAsB,yBAAyB,CAC7C,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AAO,CAAC,UAAU,CAAC,CAiCrB;AAED,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,cAAc,EACxB,EAAE,EAAE,MAAM,GAAG,IAAI,EACjB,EAAE,EAAE,OAAO,EACX,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,iBAWtB"}
|
|
@@ -64,30 +64,39 @@ export async function getFlorydayMergedDocument(supabase, input) {
|
|
|
64
64
|
/**
|
|
65
65
|
* Fulfillment-order aanmaken in Floriday.
|
|
66
66
|
*
|
|
67
|
-
* Laatste poort
|
|
68
|
-
*
|
|
69
|
-
* gelezen worden, dan versturen we niet.
|
|
67
|
+
* Laatste poort vóór de gateway: de gedeelde wachter bepaalt of er iets weg
|
|
68
|
+
* mag. Fail closed — is de poort niet leesbaar, dan versturen we niet.
|
|
70
69
|
*/
|
|
71
|
-
export async function sendFlorydayFulfillmentOrder(supabase, body, caller = "logistiek-engine") {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
export async function sendFlorydayFulfillmentOrder(supabase, body, caller = "logistiek-engine", orderRef = null) {
|
|
71
|
+
const { floridayStatusGuard, logFloridaySend } = await import("./floridayGuard.server.js");
|
|
72
|
+
const decision = await floridayStatusGuard(supabase, {
|
|
73
|
+
orderRef,
|
|
74
|
+
action: "fulfillment_order_send",
|
|
75
|
+
// Zonder ordernummer valt er niets te toetsen aan een controlescan; de
|
|
76
|
+
// schakelaar blijft dan de enige, en dus beslissende, poort.
|
|
77
|
+
requireApproval: Boolean(orderRef),
|
|
78
|
+
module: caller,
|
|
79
|
+
});
|
|
80
|
+
if (!decision.allowed) {
|
|
81
81
|
return {
|
|
82
82
|
status: 0,
|
|
83
83
|
payload: {
|
|
84
84
|
ok: false,
|
|
85
85
|
skipped: true,
|
|
86
|
-
error: "Statuswijzigingen naar Floriday
|
|
86
|
+
error: decision.reason ?? "Statuswijzigingen naar Floriday zijn niet toegestaan.",
|
|
87
87
|
},
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
const result = (await runFulfillmentOrderSend(supabase, body, caller));
|
|
91
|
+
await logFloridaySend(supabase, {
|
|
92
|
+
orderRef,
|
|
93
|
+
action: "fulfillment_order_send",
|
|
94
|
+
ok: (result?.payload?.ok ?? result?.ok) === true,
|
|
95
|
+
httpStatus: typeof result?.status === "number" ? result.status : null,
|
|
96
|
+
detail: result?.payload?.error ?? result?.error ?? null,
|
|
97
|
+
module: caller,
|
|
98
|
+
});
|
|
99
|
+
return result;
|
|
91
100
|
}
|
|
92
101
|
/** Claim een printregel. fresh=false betekent: er is al geprint. */
|
|
93
102
|
export async function claimDocumentPrint(supabase, args) {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SupabaseClient } from "@supabase/supabase-js";
|
|
2
|
+
export type FloridayGuardAction = "fulfillment_order_send" | "queue_push" | "status_update" | "load_carrier_update";
|
|
3
|
+
export interface FloridayGuardDecision {
|
|
4
|
+
allowed: boolean;
|
|
5
|
+
/** Leesbare reden waarom er niet verstuurd mag worden. */
|
|
6
|
+
reason: string | null;
|
|
7
|
+
/** Machineleesbaar, om op te kunnen filteren. */
|
|
8
|
+
code: "toegestaan" | "schakelaar_uit" | "schakelaar_onleesbaar" | "poort_ontbreekt" | "niet_goedgekeurd";
|
|
9
|
+
}
|
|
10
|
+
/** Verstuurde poging vastleggen, zodat achteraf aantoonbaar is wat wij deden. */
|
|
11
|
+
export declare function logFloridaySend(sb: SupabaseClient, args: {
|
|
12
|
+
orderRef: string | null;
|
|
13
|
+
action: FloridayGuardAction;
|
|
14
|
+
ok: boolean;
|
|
15
|
+
httpStatus?: number | null;
|
|
16
|
+
detail?: string | null;
|
|
17
|
+
module?: string;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* De enige plek die "ja" mag zeggen tegen een statuswijziging in Floriday.
|
|
21
|
+
*
|
|
22
|
+
* @param orderRef ordernummer; laat leeg voor acties zonder order (dan wordt
|
|
23
|
+
* alleen de schakelaar gecontroleerd).
|
|
24
|
+
*/
|
|
25
|
+
export declare function floridayStatusGuard(sb: SupabaseClient, args: {
|
|
26
|
+
orderRef?: string | null;
|
|
27
|
+
action: FloridayGuardAction;
|
|
28
|
+
/** Zet op false voor acties die geen karrencontrole kennen. */
|
|
29
|
+
requireApproval?: boolean;
|
|
30
|
+
module?: string;
|
|
31
|
+
}): Promise<FloridayGuardDecision>;
|
|
32
|
+
//# sourceMappingURL=floridayGuard.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floridayGuard.server.d.ts","sourceRoot":"","sources":["../../src/lib/floridayGuard.server.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAC3B,wBAAwB,GACxB,YAAY,GACZ,eAAe,GACf,qBAAqB,CAAC;AAE1B,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,iDAAiD;IACjD,IAAI,EACA,YAAY,GACZ,gBAAgB,GAChB,uBAAuB,GACvB,iBAAiB,GACjB,kBAAkB,CAAC;CACxB;AA+BD,iFAAiF;AACjF,wBAAsB,eAAe,CACnC,EAAE,EAAE,cAAc,EAClB,IAAI,EAAE;IACJ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,cAAc,EAClB,IAAI,EAAE;IACJ,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,+DAA+D;IAC/D,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAAC,qBAAqB,CAAC,CAqDhC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// src/lib/floridayGuard.server.ts
|
|
3
|
+
// Eén gedeelde poort voor ELKE statuswijziging richting Floriday.
|
|
4
|
+
//
|
|
5
|
+
// Waarom in de modulecode en niet alleen in de database: dezelfde modules
|
|
6
|
+
// draaien in meerdere shells, elk met een eigen database. Een poort die alleen
|
|
7
|
+
// als databaseregel bestaat, ontbreekt in een shell waar die regel nooit is
|
|
8
|
+
// toegepast. Deze wachter zit in de code die iedere shell meekrijgt.
|
|
9
|
+
//
|
|
10
|
+
// Fail closed, zonder uitzondering:
|
|
11
|
+
// - schakelaar niet leesbaar -> niet versturen
|
|
12
|
+
// - functie bestaat niet -> niet versturen
|
|
13
|
+
// - geen actieve werkwijze -> niet versturen
|
|
14
|
+
// - geen goedgekeurde controle -> niet versturen (bij ordergebonden acties)
|
|
15
|
+
//
|
|
16
|
+
// Geen omgevingswaarden in dit bestand: de shell-aanduiding komt uit de
|
|
17
|
+
// omgeving en blijft leeg als die er niet is.
|
|
18
|
+
// ============================================================================
|
|
19
|
+
/** Naam van de shell waarin deze module draait; leeg als die ontbreekt. */
|
|
20
|
+
function shellName() {
|
|
21
|
+
const env = globalThis.process
|
|
22
|
+
?.env;
|
|
23
|
+
const value = env?.["FLOWSELECTIONS_SHELL"] ?? env?.["SHELL_NAME"] ?? null;
|
|
24
|
+
const trimmed = (value ?? "").trim();
|
|
25
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
26
|
+
}
|
|
27
|
+
async function logRefusal(sb, orderRef, reason, action, module) {
|
|
28
|
+
try {
|
|
29
|
+
await sb.rpc("logistics_floriday_log_refusal", {
|
|
30
|
+
_order_ref: orderRef ?? "onbekend",
|
|
31
|
+
_reason: reason,
|
|
32
|
+
_module: module,
|
|
33
|
+
_shell: shellName(),
|
|
34
|
+
_action: action,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Vastleggen mag de blokkade nooit ongedaan maken.
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Verstuurde poging vastleggen, zodat achteraf aantoonbaar is wat wij deden. */
|
|
42
|
+
export async function logFloridaySend(sb, args) {
|
|
43
|
+
try {
|
|
44
|
+
await sb.rpc("logistics_floriday_log_send", {
|
|
45
|
+
_order_ref: args.orderRef ?? "onbekend",
|
|
46
|
+
_action: args.action,
|
|
47
|
+
_ok: args.ok,
|
|
48
|
+
_http_status: args.httpStatus ?? null,
|
|
49
|
+
_detail: args.detail ?? null,
|
|
50
|
+
_module: args.module ?? "logistiek-engine",
|
|
51
|
+
_shell: shellName(),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// Vastleggen is nooit kritiek voor de verzending zelf.
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* De enige plek die "ja" mag zeggen tegen een statuswijziging in Floriday.
|
|
60
|
+
*
|
|
61
|
+
* @param orderRef ordernummer; laat leeg voor acties zonder order (dan wordt
|
|
62
|
+
* alleen de schakelaar gecontroleerd).
|
|
63
|
+
*/
|
|
64
|
+
export async function floridayStatusGuard(sb, args) {
|
|
65
|
+
const module = args.module ?? "logistiek-engine";
|
|
66
|
+
const orderRef = args.orderRef ?? null;
|
|
67
|
+
// 1. Staat de schakelaar aan? Alles behalve een expliciete true is "nee".
|
|
68
|
+
let enabled = null;
|
|
69
|
+
try {
|
|
70
|
+
const { data, error } = await sb.rpc("logistics_floriday_status_updates_enabled");
|
|
71
|
+
enabled = error ? null : data === true;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
enabled = null;
|
|
75
|
+
}
|
|
76
|
+
if (enabled === null) {
|
|
77
|
+
const reason = "De poort op statuswijzigingen kan niet gelezen worden in deze omgeving; er wordt niets naar Floriday gestuurd.";
|
|
78
|
+
await logRefusal(sb, orderRef, reason, args.action, module);
|
|
79
|
+
return { allowed: false, reason, code: "poort_ontbreekt" };
|
|
80
|
+
}
|
|
81
|
+
if (!enabled) {
|
|
82
|
+
const reason = "Statussen wijzigen in Floriday staat uit in de actieve werkwijze.";
|
|
83
|
+
await logRefusal(sb, orderRef, reason, args.action, module);
|
|
84
|
+
return { allowed: false, reason, code: "schakelaar_uit" };
|
|
85
|
+
}
|
|
86
|
+
// 2. Ordergebonden acties vragen om een goedgekeurde karrencontrole.
|
|
87
|
+
if (args.requireApproval !== false && orderRef) {
|
|
88
|
+
let approved = null;
|
|
89
|
+
try {
|
|
90
|
+
const { data, error } = await sb.rpc("logistics_floriday_order_approved", {
|
|
91
|
+
_order_ref: orderRef,
|
|
92
|
+
});
|
|
93
|
+
approved = error ? null : data === true;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
approved = null;
|
|
97
|
+
}
|
|
98
|
+
if (approved !== true) {
|
|
99
|
+
const reason = approved === null
|
|
100
|
+
? "De goedkeuringscontrole kan niet gelezen worden; er wordt niets naar Floriday gestuurd."
|
|
101
|
+
: "Nog geen goedgekeurde karrencontrole voor deze order.";
|
|
102
|
+
await logRefusal(sb, orderRef, reason, args.action, module);
|
|
103
|
+
return {
|
|
104
|
+
allowed: false,
|
|
105
|
+
reason,
|
|
106
|
+
code: approved === null ? "poort_ontbreekt" : "niet_goedgekeurd",
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return { allowed: true, reason: null, code: "toegestaan" };
|
|
111
|
+
}
|
|
@@ -10076,6 +10076,36 @@ export declare const retryFloridayPush: import("@tanstack/start-client-core").Re
|
|
|
10076
10076
|
};
|
|
10077
10077
|
Relationships: [];
|
|
10078
10078
|
};
|
|
10079
|
+
logistics_floriday_push_refusals: {
|
|
10080
|
+
Row: {
|
|
10081
|
+
action: string | null;
|
|
10082
|
+
created_at: string;
|
|
10083
|
+
id: string;
|
|
10084
|
+
order_ref: string;
|
|
10085
|
+
reason: string;
|
|
10086
|
+
source_module: string | null;
|
|
10087
|
+
source_shell: string | null;
|
|
10088
|
+
};
|
|
10089
|
+
Insert: {
|
|
10090
|
+
action?: string | null;
|
|
10091
|
+
created_at?: string;
|
|
10092
|
+
id?: string;
|
|
10093
|
+
order_ref: string;
|
|
10094
|
+
reason: string;
|
|
10095
|
+
source_module?: string | null;
|
|
10096
|
+
source_shell?: string | null;
|
|
10097
|
+
};
|
|
10098
|
+
Update: {
|
|
10099
|
+
action?: string | null;
|
|
10100
|
+
created_at?: string;
|
|
10101
|
+
id?: string;
|
|
10102
|
+
order_ref?: string;
|
|
10103
|
+
reason?: string;
|
|
10104
|
+
source_module?: string | null;
|
|
10105
|
+
source_shell?: string | null;
|
|
10106
|
+
};
|
|
10107
|
+
Relationships: [];
|
|
10108
|
+
};
|
|
10079
10109
|
logistics_floriday_pushes: {
|
|
10080
10110
|
Row: {
|
|
10081
10111
|
attempts: number;
|
|
@@ -10151,6 +10181,42 @@ export declare const retryFloridayPush: import("@tanstack/start-client-core").Re
|
|
|
10151
10181
|
};
|
|
10152
10182
|
Relationships: [];
|
|
10153
10183
|
};
|
|
10184
|
+
logistics_floriday_status_sends: {
|
|
10185
|
+
Row: {
|
|
10186
|
+
action: string;
|
|
10187
|
+
created_at: string;
|
|
10188
|
+
detail: string | null;
|
|
10189
|
+
http_status: number | null;
|
|
10190
|
+
id: string;
|
|
10191
|
+
ok: boolean;
|
|
10192
|
+
order_ref: string;
|
|
10193
|
+
source_module: string | null;
|
|
10194
|
+
source_shell: string | null;
|
|
10195
|
+
};
|
|
10196
|
+
Insert: {
|
|
10197
|
+
action: string;
|
|
10198
|
+
created_at?: string;
|
|
10199
|
+
detail?: string | null;
|
|
10200
|
+
http_status?: number | null;
|
|
10201
|
+
id?: string;
|
|
10202
|
+
ok?: boolean;
|
|
10203
|
+
order_ref: string;
|
|
10204
|
+
source_module?: string | null;
|
|
10205
|
+
source_shell?: string | null;
|
|
10206
|
+
};
|
|
10207
|
+
Update: {
|
|
10208
|
+
action?: string;
|
|
10209
|
+
created_at?: string;
|
|
10210
|
+
detail?: string | null;
|
|
10211
|
+
http_status?: number | null;
|
|
10212
|
+
id?: string;
|
|
10213
|
+
ok?: boolean;
|
|
10214
|
+
order_ref?: string;
|
|
10215
|
+
source_module?: string | null;
|
|
10216
|
+
source_shell?: string | null;
|
|
10217
|
+
};
|
|
10218
|
+
Relationships: [];
|
|
10219
|
+
};
|
|
10154
10220
|
logistics_formulas: {
|
|
10155
10221
|
Row: {
|
|
10156
10222
|
created_at: string;
|
|
@@ -19322,6 +19388,36 @@ export declare const retryFloridayPush: import("@tanstack/start-client-core").Re
|
|
|
19322
19388
|
referencedColumns: ["id"];
|
|
19323
19389
|
}];
|
|
19324
19390
|
};
|
|
19391
|
+
voorraad_buffer_state: {
|
|
19392
|
+
Row: {
|
|
19393
|
+
buffer_id: string;
|
|
19394
|
+
buffer_key: string | null;
|
|
19395
|
+
closed_at: string | null;
|
|
19396
|
+
created_at: string;
|
|
19397
|
+
detached_orders: import("../integrations/supabase/types").Json;
|
|
19398
|
+
reason: string | null;
|
|
19399
|
+
updated_at: string;
|
|
19400
|
+
};
|
|
19401
|
+
Insert: {
|
|
19402
|
+
buffer_id: string;
|
|
19403
|
+
buffer_key?: string | null;
|
|
19404
|
+
closed_at?: string | null;
|
|
19405
|
+
created_at?: string;
|
|
19406
|
+
detached_orders?: import("../integrations/supabase/types").Json;
|
|
19407
|
+
reason?: string | null;
|
|
19408
|
+
updated_at?: string;
|
|
19409
|
+
};
|
|
19410
|
+
Update: {
|
|
19411
|
+
buffer_id?: string;
|
|
19412
|
+
buffer_key?: string | null;
|
|
19413
|
+
closed_at?: string | null;
|
|
19414
|
+
created_at?: string;
|
|
19415
|
+
detached_orders?: import("../integrations/supabase/types").Json;
|
|
19416
|
+
reason?: string | null;
|
|
19417
|
+
updated_at?: string;
|
|
19418
|
+
};
|
|
19419
|
+
Relationships: [];
|
|
19420
|
+
};
|
|
19325
19421
|
voorraad_custom_fields: {
|
|
19326
19422
|
Row: {
|
|
19327
19423
|
created_at: string;
|
|
@@ -19364,6 +19460,36 @@ export declare const retryFloridayPush: import("@tanstack/start-client-core").Re
|
|
|
19364
19460
|
};
|
|
19365
19461
|
Relationships: [];
|
|
19366
19462
|
};
|
|
19463
|
+
voorraad_logistics_event_log: {
|
|
19464
|
+
Row: {
|
|
19465
|
+
created_at: string;
|
|
19466
|
+
event_id: string;
|
|
19467
|
+
event_type: string;
|
|
19468
|
+
order_ref: string | null;
|
|
19469
|
+
processed_at: string;
|
|
19470
|
+
result: import("../integrations/supabase/types").Json;
|
|
19471
|
+
updated_at: string;
|
|
19472
|
+
};
|
|
19473
|
+
Insert: {
|
|
19474
|
+
created_at?: string;
|
|
19475
|
+
event_id: string;
|
|
19476
|
+
event_type: string;
|
|
19477
|
+
order_ref?: string | null;
|
|
19478
|
+
processed_at?: string;
|
|
19479
|
+
result?: import("../integrations/supabase/types").Json;
|
|
19480
|
+
updated_at?: string;
|
|
19481
|
+
};
|
|
19482
|
+
Update: {
|
|
19483
|
+
created_at?: string;
|
|
19484
|
+
event_id?: string;
|
|
19485
|
+
event_type?: string;
|
|
19486
|
+
order_ref?: string | null;
|
|
19487
|
+
processed_at?: string;
|
|
19488
|
+
result?: import("../integrations/supabase/types").Json;
|
|
19489
|
+
updated_at?: string;
|
|
19490
|
+
};
|
|
19491
|
+
Relationships: [];
|
|
19492
|
+
};
|
|
19367
19493
|
voorraad_media_upload_failures: {
|
|
19368
19494
|
Row: {
|
|
19369
19495
|
action: string;
|
|
@@ -23617,6 +23743,38 @@ export declare const retryFloridayPush: import("@tanstack/start-client-core").Re
|
|
|
23617
23743
|
};
|
|
23618
23744
|
Returns: string;
|
|
23619
23745
|
};
|
|
23746
|
+
logistics_floriday_gate_status: {
|
|
23747
|
+
Args: never;
|
|
23748
|
+
Returns: import("../integrations/supabase/types").Json;
|
|
23749
|
+
};
|
|
23750
|
+
logistics_floriday_log_refusal: {
|
|
23751
|
+
Args: {
|
|
23752
|
+
_action?: string;
|
|
23753
|
+
_module?: string;
|
|
23754
|
+
_order_ref: string;
|
|
23755
|
+
_reason: string;
|
|
23756
|
+
_shell?: string;
|
|
23757
|
+
};
|
|
23758
|
+
Returns: undefined;
|
|
23759
|
+
};
|
|
23760
|
+
logistics_floriday_log_send: {
|
|
23761
|
+
Args: {
|
|
23762
|
+
_action: string;
|
|
23763
|
+
_detail?: string;
|
|
23764
|
+
_http_status?: number;
|
|
23765
|
+
_module?: string;
|
|
23766
|
+
_ok: boolean;
|
|
23767
|
+
_order_ref: string;
|
|
23768
|
+
_shell?: string;
|
|
23769
|
+
};
|
|
23770
|
+
Returns: undefined;
|
|
23771
|
+
};
|
|
23772
|
+
logistics_floriday_order_approved: {
|
|
23773
|
+
Args: {
|
|
23774
|
+
_order_ref: string;
|
|
23775
|
+
};
|
|
23776
|
+
Returns: boolean;
|
|
23777
|
+
};
|
|
23620
23778
|
logistics_floriday_prune_pushes: {
|
|
23621
23779
|
Args: {
|
|
23622
23780
|
_days?: number;
|
|
@@ -23631,6 +23789,10 @@ export declare const retryFloridayPush: import("@tanstack/start-client-core").Re
|
|
|
23631
23789
|
};
|
|
23632
23790
|
Returns: string;
|
|
23633
23791
|
};
|
|
23792
|
+
logistics_floriday_status_updates_enabled: {
|
|
23793
|
+
Args: never;
|
|
23794
|
+
Returns: boolean;
|
|
23795
|
+
};
|
|
23634
23796
|
logistics_fulfill_barcode_requests: {
|
|
23635
23797
|
Args: {
|
|
23636
23798
|
p_limit?: number;
|