@flowselections/floriday-verkoop-module 1.0.86 → 1.0.90
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/verkoop/CreateOrderPage.js +1 -1
- package/dist-lib/components/verkoop/DiagnoseConnectionDialog.js +1 -1
- package/dist-lib/components/verkoop/EditLocalOrderDialog.js +3 -3
- package/dist-lib/components/verkoop/OrderControlStatusCard.js +1 -1
- package/dist-lib/components/verkoop/OrderKarindelingCard.js +2 -2
- package/dist-lib/components/verkoop/OrderLinePackingCard.js +1 -1
- package/dist-lib/components/verkoop/OrderShipmentsCard.js +1 -1
- package/dist-lib/components/verkoop/ProductDimensionsSettings.js +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailView.d.ts +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailView.js +12 -12
- package/dist-lib/components/verkoop/SalesOrdersFilterPanel.d.ts +1 -1
- package/dist-lib/components/verkoop/SalesOrdersFilters.js +1 -1
- package/dist-lib/components/verkoop/SalesOrdersTable.d.ts +1 -1
- package/dist-lib/components/verkoop/SalesOrdersTable.js +2 -2
- package/dist-lib/components/verkoop/StockConsumptionAlertsBanner.js +1 -1
- package/dist-lib/components/verkoop/VerkoopOrdersPage.js +15 -15
- package/dist-lib/index.d.ts +4 -5
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +5 -6
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +346 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/belading.server.js +1 -1
- package/dist-lib/lib/buffer-events.functions.d.ts +1 -1
- package/dist-lib/lib/buffer-events.functions.js +1 -1
- package/dist-lib/lib/cart-layers.functions.d.ts +4 -4
- package/dist-lib/lib/cart-layers.functions.js +2 -2
- package/dist-lib/lib/cart-lock.functions.d.ts +1 -1
- package/dist-lib/lib/cart-lock.functions.js +2 -2
- package/dist-lib/lib/cart-planning-settings.functions.d.ts +11 -11
- package/dist-lib/lib/cart-planning-settings.functions.js +1 -1
- package/dist-lib/lib/cart-replan.functions.d.ts +4 -4
- package/dist-lib/lib/cart-replan.functions.js +9 -9
- package/dist-lib/lib/create-order.functions.d.ts +18 -18
- package/dist-lib/lib/create-order.functions.js +15 -15
- package/dist-lib/lib/cron/index.d.ts +3 -3
- package/dist-lib/lib/cron/index.js +3 -3
- package/dist-lib/lib/cron/invoice-due.js +1 -1
- package/dist-lib/lib/cron/sync-salesorders.js +2 -2
- package/dist-lib/lib/cron/sync-tradeitems.js +1 -1
- package/dist-lib/lib/engine-block-alerts.server.js +4 -4
- package/dist-lib/lib/expand-group-order-items.d.ts +1 -1
- package/dist-lib/lib/floriday-change-diff.check.js +2 -2
- package/dist-lib/lib/floriday-gateway.server.d.ts +1 -1
- package/dist-lib/lib/floriday-gateway.server.js +2 -2
- package/dist-lib/lib/floriday-logistic-labels.functions.d.ts +2 -2
- package/dist-lib/lib/floriday-logistic-labels.functions.js +5 -5
- package/dist-lib/lib/floriday-mirror.functions.d.ts +1 -1
- package/dist-lib/lib/floriday-mirror.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-mirror.functions.js +19 -12
- package/dist-lib/lib/floriday-public.functions.d.ts +7 -7
- package/dist-lib/lib/floriday-public.functions.js +2 -2
- package/dist-lib/lib/floriday-status.d.ts +1 -1
- package/dist-lib/lib/floriday-status.server.d.ts +1 -1
- package/dist-lib/lib/floriday-status.server.js +2 -2
- package/dist-lib/lib/floriday-sync.js +1 -1
- package/dist-lib/lib/floriday-unlinked-products.js +1 -1
- package/dist-lib/lib/floriday-writes.functions.d.ts +3 -3
- package/dist-lib/lib/floriday-writes.functions.js +3 -3
- package/dist-lib/lib/invoice-timing.functions.d.ts +5 -5
- package/dist-lib/lib/invoice-timing.functions.js +8 -8
- package/dist-lib/lib/invoice-timing.server.d.ts +8 -3
- package/dist-lib/lib/invoice-timing.server.d.ts.map +1 -1
- package/dist-lib/lib/invoice-timing.server.js +70 -34
- package/dist-lib/lib/load-carriers.functions.d.ts +2 -2
- package/dist-lib/lib/load-carriers.functions.js +2 -2
- package/dist-lib/lib/load-carriers.server.d.ts +1 -1
- package/dist-lib/lib/load-carriers.server.js +1 -1
- package/dist-lib/lib/logistics-buffer.server.js +1 -1
- package/dist-lib/lib/logistics-engine.functions.d.ts +8 -8
- package/dist-lib/lib/logistics-engine.functions.js +6 -6
- package/dist-lib/lib/logistics-engine.server.d.ts +1 -1
- package/dist-lib/lib/logistics-engine.server.js +4 -4
- package/dist-lib/lib/logistics-stock.functions.d.ts +3 -3
- package/dist-lib/lib/logistics-stock.functions.js +3 -3
- package/dist-lib/lib/order-addresses.functions.d.ts +1 -1
- package/dist-lib/lib/order-addresses.functions.js +2 -2
- package/dist-lib/lib/order-block-mail.server.js +3 -3
- package/dist-lib/lib/order-buffers.functions.d.ts +3 -3
- package/dist-lib/lib/order-buffers.functions.js +3 -3
- package/dist-lib/lib/order-cancel.server.js +6 -6
- package/dist-lib/lib/order-carrier.functions.d.ts +2 -2
- package/dist-lib/lib/order-carrier.functions.js +2 -2
- package/dist-lib/lib/order-fulfill.functions.d.ts +1 -1
- package/dist-lib/lib/order-fulfill.functions.js +3 -3
- package/dist-lib/lib/order-item-packing.functions.d.ts +3 -3
- package/dist-lib/lib/order-item-packing.functions.js +3 -3
- package/dist-lib/lib/order-patch.check.d.ts +2 -0
- package/dist-lib/lib/order-patch.check.d.ts.map +1 -0
- package/dist-lib/lib/order-patch.check.js +40 -0
- package/dist-lib/lib/order-patch.d.ts +18 -0
- package/dist-lib/lib/order-patch.d.ts.map +1 -0
- package/dist-lib/lib/order-patch.js +105 -0
- package/dist-lib/lib/order-pickup.functions.d.ts +2 -2
- package/dist-lib/lib/order-pickup.functions.js +3 -3
- package/dist-lib/lib/order-shipments.functions.d.ts +4 -4
- package/dist-lib/lib/order-shipments.functions.js +6 -6
- package/dist-lib/lib/plan-coverage.check.js +1 -1
- package/dist-lib/lib/plan-coverage.server.d.ts +1 -1
- package/dist-lib/lib/plan-coverage.server.js +1 -1
- package/dist-lib/lib/product-dimensions.functions.d.ts +2 -2
- package/dist-lib/lib/product-dimensions.functions.js +1 -1
- package/dist-lib/lib/salesorders-list.functions.d.ts +5 -5
- package/dist-lib/lib/salesorders-list.functions.js +4 -4
- package/dist-lib/lib/salesorders-list.server.d.ts +2 -2
- package/dist-lib/lib/salesorders-list.server.js +17 -17
- package/dist-lib/lib/salesorders-mapping.d.ts +3 -3
- package/dist-lib/lib/salesorders-mapping.js +2 -2
- package/dist-lib/lib/salesorders.functions.d.ts +7 -7
- package/dist-lib/lib/salesorders.functions.js +20 -20
- package/dist-lib/lib/stock-consumption-alerts.functions.d.ts +2 -2
- package/dist-lib/lib/stock-consumption-alerts.functions.js +1 -1
- package/dist-lib/lib/tradeitems.functions.d.ts +1068 -1068
- package/dist-lib/lib/tradeitems.functions.js +3 -3
- package/dist-lib/lib/useAllowedLoadCarriers.d.ts +1 -1
- package/dist-lib/lib/useAllowedLoadCarriers.js +1 -1
- package/dist-lib/lib/useBufferEvents.d.ts +1 -1
- package/dist-lib/lib/useBufferEvents.js +2 -2
- package/dist-lib/lib/useLocalSalesOrderDetailQuery.d.ts +2 -2
- package/dist-lib/lib/useLocalSalesOrderDetailQuery.js +2 -2
- package/dist-lib/lib/useSalesOrderDetailQuery.d.ts +1 -1
- package/dist-lib/lib/useSalesOrderDetailQuery.js +2 -2
- package/dist-lib/lib/useSalesOrdersQuery.d.ts +2 -2
- package/dist-lib/lib/useSalesOrdersQuery.js +3 -3
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Server-side toepassing van het instelbare factuurmoment.
|
|
2
|
-
import { DEFAULT_INVOICE_TIMING, computeInvoiceDueAt, normalizeTimeOfDay, } from "./invoice-timing";
|
|
2
|
+
import { DEFAULT_INVOICE_TIMING, computeInvoiceDueAt, normalizeTimeOfDay, } from "./invoice-timing.js";
|
|
3
3
|
/** Status die de facturatiemodule oppakt zodra het factuurmoment is bereikt. */
|
|
4
4
|
export const INVOICE_READY_STATUS = "Gereed voor facturatie";
|
|
5
5
|
export async function loadInvoiceTimingSettings(supabase) {
|
|
@@ -83,39 +83,72 @@ async function buildAnchorInputs(supabase, rows) {
|
|
|
83
83
|
}
|
|
84
84
|
return out;
|
|
85
85
|
}
|
|
86
|
-
/**
|
|
86
|
+
/** Statussen waarbij de order al bij facturatie ligt: factuurmoment niet meer herberekenen. */
|
|
87
|
+
const INVOICED_STATUSES = [INVOICE_READY_STATUS, "Gefactureerd", "gefactureerd"];
|
|
88
|
+
const CHUNK = 200;
|
|
89
|
+
/**
|
|
90
|
+
* Herberekent `invoice_due_at` voor de meegegeven orders, of voor álle orders
|
|
91
|
+
* die nog niet gefactureerd, niet geannuleerd en niet verwijderd zijn (in delen
|
|
92
|
+
* van 200). Slaat alleen op als het moment echt verandert, met dezelfde
|
|
93
|
+
* voorwaarde ook in de database.
|
|
94
|
+
*/
|
|
87
95
|
export async function recomputeInvoiceDueDates(supabase, options = {}) {
|
|
96
|
+
const { updateOrderIfChanged } = await import("./order-patch.js");
|
|
88
97
|
const settings = await loadInvoiceTimingSettings(supabase);
|
|
89
|
-
|
|
90
|
-
.from("orders")
|
|
91
|
-
.select("id, created_at, delivery_date, status, custom_fields")
|
|
92
|
-
.is("deleted_at", null)
|
|
93
|
-
.limit(options.limit ?? 500);
|
|
94
|
-
if (options.orderIds?.length)
|
|
95
|
-
query = query.in("id", options.orderIds.slice(0, 500));
|
|
96
|
-
else
|
|
97
|
-
query = query.order("created_at", { ascending: false });
|
|
98
|
-
const { data, error } = await query;
|
|
99
|
-
if (error)
|
|
100
|
-
throw new Error(error.message);
|
|
101
|
-
const rows = (data ?? []);
|
|
102
|
-
if (rows.length === 0)
|
|
103
|
-
return { updated: 0 };
|
|
104
|
-
const inputs = await buildAnchorInputs(supabase, rows);
|
|
98
|
+
const ids = options.orderIds?.length ? Array.from(new Set(options.orderIds)) : null;
|
|
105
99
|
let updated = 0;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const { error: upErr } = await supabase
|
|
100
|
+
let checked = 0;
|
|
101
|
+
let lastId = null;
|
|
102
|
+
let idOffset = 0;
|
|
103
|
+
for (;;) {
|
|
104
|
+
let query = supabase
|
|
112
105
|
.from("orders")
|
|
113
|
-
.
|
|
114
|
-
.
|
|
115
|
-
if (
|
|
116
|
-
|
|
106
|
+
.select("id, created_at, delivery_date, status, custom_fields, invoice_due_at")
|
|
107
|
+
.is("deleted_at", null);
|
|
108
|
+
if (ids) {
|
|
109
|
+
const part = ids.slice(idOffset, idOffset + CHUNK);
|
|
110
|
+
if (part.length === 0)
|
|
111
|
+
break;
|
|
112
|
+
idOffset += CHUNK;
|
|
113
|
+
query = query.in("id", part);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
query = query
|
|
117
|
+
.is("cancelled_at", null)
|
|
118
|
+
.not("status", "in", `(${INVOICED_STATUSES.map((s) => `"${s}"`).join(",")})`)
|
|
119
|
+
.order("id", { ascending: true })
|
|
120
|
+
.limit(CHUNK);
|
|
121
|
+
if (lastId)
|
|
122
|
+
query = query.gt("id", lastId);
|
|
123
|
+
}
|
|
124
|
+
const { data, error } = await query;
|
|
125
|
+
if (error)
|
|
126
|
+
throw new Error(error.message);
|
|
127
|
+
const rows = (data ?? []);
|
|
128
|
+
if (rows.length === 0) {
|
|
129
|
+
if (ids)
|
|
130
|
+
continue;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
checked += rows.length;
|
|
134
|
+
const inputs = await buildAnchorInputs(supabase, rows);
|
|
135
|
+
for (const row of rows) {
|
|
136
|
+
const input = inputs.get(String(row.id));
|
|
137
|
+
if (!input)
|
|
138
|
+
continue;
|
|
139
|
+
const due = computeInvoiceDueAt(input, settings);
|
|
140
|
+
const r = await updateOrderIfChanged(supabase, String(row.id), row, {
|
|
141
|
+
invoice_due_at: due,
|
|
142
|
+
});
|
|
143
|
+
updated += r.written;
|
|
144
|
+
}
|
|
145
|
+
if (!ids) {
|
|
146
|
+
lastId = String(rows[rows.length - 1].id);
|
|
147
|
+
if (rows.length < CHUNK)
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
117
150
|
}
|
|
118
|
-
return { updated };
|
|
151
|
+
return { updated, checked };
|
|
119
152
|
}
|
|
120
153
|
/** Zet orders waarvan het factuurmoment is bereikt op de facturatiestatus. */
|
|
121
154
|
export async function releaseDueInvoices(supabase, limit = 200) {
|
|
@@ -137,19 +170,22 @@ export async function releaseDueInvoices(supabase, limit = 200) {
|
|
|
137
170
|
String(r.order_source ?? "").toLowerCase() !== "floriday");
|
|
138
171
|
const orderIds = [];
|
|
139
172
|
for (const r of rows) {
|
|
140
|
-
|
|
173
|
+
// Ook in de database: alleen als de status nog anders is.
|
|
174
|
+
const { data: done, error: upErr } = await supabase
|
|
141
175
|
.from("orders")
|
|
142
176
|
.update({ status: INVOICE_READY_STATUS })
|
|
143
|
-
.eq("id", r.id)
|
|
144
|
-
|
|
177
|
+
.eq("id", r.id)
|
|
178
|
+
.or(`status.is.null,status.neq."${INVOICE_READY_STATUS}"`)
|
|
179
|
+
.select("id");
|
|
180
|
+
if (!upErr && (done ?? []).length > 0)
|
|
145
181
|
orderIds.push(String(r.id));
|
|
146
182
|
}
|
|
147
183
|
return { released: orderIds.length, orderIds };
|
|
148
184
|
}
|
|
149
185
|
/** Volledige cyclus: eerst herberekenen, daarna vrijgeven. */
|
|
150
186
|
export async function runInvoiceTimingCycle() {
|
|
151
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
152
|
-
const recomputed = (await recomputeInvoiceDueDates(supabaseAdmin
|
|
187
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
188
|
+
const recomputed = (await recomputeInvoiceDueDates(supabaseAdmin)).updated;
|
|
153
189
|
const released = (await releaseDueInvoices(supabaseAdmin, 200)).released;
|
|
154
190
|
return { recomputed, released };
|
|
155
191
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** Lijst met ladingdragers die de Engine toestaat (alleen enabled). */
|
|
2
2
|
export declare const listAllowedLoadCarriers: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
3
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
3
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
4
4
|
userId: string;
|
|
5
5
|
claims: import("@supabase/auth-js").User;
|
|
6
6
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
7
7
|
strategyId?: string | null | undefined;
|
|
8
|
-
}, Promise<import("./load-carriers").AllowedLoadCarriers>>;
|
|
8
|
+
}, Promise<import("./load-carriers.js").AllowedLoadCarriers>>;
|
|
9
9
|
//# sourceMappingURL=load-carriers.functions.d.ts.map
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// Rule Engine (stap Beladingindeling) kan elk moment wijzigen.
|
|
4
4
|
import { createServerFn } from "@tanstack/react-start";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
7
|
-
import { normalizeAllowedLoadCarriers } from "./load-carriers";
|
|
6
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
7
|
+
import { normalizeAllowedLoadCarriers } from "./load-carriers.js";
|
|
8
8
|
/** Lijst met ladingdragers die de Engine toestaat (alleen enabled). */
|
|
9
9
|
export const listAllowedLoadCarriers = createServerFn({ method: "POST" })
|
|
10
10
|
.middleware([requireSupabaseAuth])
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function fetchAllowedLoadCarriers(supabase: any, strategyId?: string | null): Promise<import("./load-carriers").AllowedLoadCarriers>;
|
|
1
|
+
export declare function fetchAllowedLoadCarriers(supabase: any, strategyId?: string | null): Promise<import("./load-carriers.js").AllowedLoadCarriers>;
|
|
2
2
|
/**
|
|
3
3
|
* Valideert de gekozen ladingdrager. Zonder keuze wordt de default van de
|
|
4
4
|
* Engine teruggegeven. Geen eigen controle: alleen de Engine beslist.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Leest de ladingdragerlijst van de Engine. Geen eigen blokkade (koppelprompt 22).
|
|
2
|
-
import { normalizeAllowedLoadCarriers, normalizeLoadCarrierCode, } from "./load-carriers";
|
|
2
|
+
import { normalizeAllowedLoadCarriers, normalizeLoadCarrierCode, } from "./load-carriers.js";
|
|
3
3
|
export async function fetchAllowedLoadCarriers(supabase, strategyId = null) {
|
|
4
4
|
const { data, error } = await supabase.rpc("logistics_allowed_load_carriers", {
|
|
5
5
|
p_strategy_id: strategyId,
|
|
@@ -31,7 +31,7 @@ function normalizeDecision(raw) {
|
|
|
31
31
|
* payload is het besluit niet beschikbaar en wordt er niets geschreven.
|
|
32
32
|
*/
|
|
33
33
|
export async function getEngineBufferDecision(orderId) {
|
|
34
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
34
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
35
35
|
const { data: payload, error: pErr } = await supabaseAdmin.rpc("logistics_buffer_payload", { p_order_id: orderId });
|
|
36
36
|
if (pErr || payload == null) {
|
|
37
37
|
return { available: false, error: pErr?.message ?? BUFFER_DECISION_UNAVAILABLE };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Meld een order aan de Engine (order.received / order.changed). */
|
|
2
2
|
export declare const sendOrderEventToEngine: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
3
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
3
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
4
4
|
userId: string;
|
|
5
5
|
claims: import("@supabase/auth-js").User;
|
|
6
6
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -17,7 +17,7 @@ export declare const sendOrderEventToEngine: import("@tanstack/start-client-core
|
|
|
17
17
|
}>>;
|
|
18
18
|
/** Taken van de Engine ophalen (default: geplande/gereed taken). */
|
|
19
19
|
export declare const listEngineTasks: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
20
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
20
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
21
21
|
userId: string;
|
|
22
22
|
claims: import("@supabase/auth-js").User;
|
|
23
23
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -31,7 +31,7 @@ export declare const listEngineTasks: import("@tanstack/start-client-core").Opti
|
|
|
31
31
|
} | {
|
|
32
32
|
ok: true;
|
|
33
33
|
tasks: {
|
|
34
|
-
attempt_log: import("../integrations/supabase/types").Json;
|
|
34
|
+
attempt_log: import("../integrations/supabase/types.js").Json;
|
|
35
35
|
attempts: number;
|
|
36
36
|
buffer_ref: string | null;
|
|
37
37
|
claimed_at: string | null;
|
|
@@ -46,12 +46,12 @@ export declare const listEngineTasks: import("@tanstack/start-client-core").Opti
|
|
|
46
46
|
next_attempt_at: string | null;
|
|
47
47
|
order_ref: string;
|
|
48
48
|
owner_module: string;
|
|
49
|
-
payload: import("../integrations/supabase/types").Json;
|
|
49
|
+
payload: import("../integrations/supabase/types.js").Json;
|
|
50
50
|
plan_run_id: string | null;
|
|
51
51
|
planned_end: string | null;
|
|
52
52
|
planned_start: string | null;
|
|
53
53
|
priority: number;
|
|
54
|
-
result: import("../integrations/supabase/types").Json | null;
|
|
54
|
+
result: import("../integrations/supabase/types.js").Json | null;
|
|
55
55
|
rule_config_id: string | null;
|
|
56
56
|
rule_version: number | null;
|
|
57
57
|
sequence: number;
|
|
@@ -68,7 +68,7 @@ export declare const listEngineTasks: import("@tanstack/start-client-core").Opti
|
|
|
68
68
|
}>>;
|
|
69
69
|
/** Taak afmelden (status + result op dezelfde rij). */
|
|
70
70
|
export declare const completeEngineTask: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
71
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
71
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
72
72
|
userId: string;
|
|
73
73
|
claims: import("@supabase/auth-js").User;
|
|
74
74
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -83,7 +83,7 @@ export declare const completeEngineTask: import("@tanstack/start-client-core").O
|
|
|
83
83
|
* (`logistics_buffer_decision`) — nooit uit een eigen regel of cache.
|
|
84
84
|
*/
|
|
85
85
|
export declare const getEngineBufferForOrder: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
86
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
86
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
87
87
|
userId: string;
|
|
88
88
|
claims: import("@supabase/auth-js").User;
|
|
89
89
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -112,7 +112,7 @@ export declare const getEngineBufferForOrder: import("@tanstack/start-client-cor
|
|
|
112
112
|
}>>;
|
|
113
113
|
/** Buffer handmatig vrijgeven (release === "manual"): taak afmelden als done. */
|
|
114
114
|
export declare const releaseEngineBuffer: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
115
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
115
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
116
116
|
userId: string;
|
|
117
117
|
claims: import("@supabase/auth-js").User;
|
|
118
118
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// gedeelde Supabase-tabellen logistics_events en logistics_tasks.
|
|
3
3
|
import { createServerFn } from "@tanstack/react-start";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
6
|
-
import { resolveOrderRow } from "./order-row.server";
|
|
5
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
6
|
+
import { resolveOrderRow } from "./order-row.server.js";
|
|
7
7
|
const TaskStatus = z.enum([
|
|
8
8
|
"planned",
|
|
9
9
|
"ready",
|
|
@@ -25,7 +25,7 @@ export const sendOrderEventToEngine = createServerFn({ method: "POST" })
|
|
|
25
25
|
.handler(async ({ data, context }) => {
|
|
26
26
|
// DTO-id kan een Floriday salesOrderId zijn.
|
|
27
27
|
const order = await resolveOrderRow(context.supabase, data.orderId);
|
|
28
|
-
const { buildEngineOrderPayload, insertLogisticsEvent } = await import("./logistics-engine.server");
|
|
28
|
+
const { buildEngineOrderPayload, insertLogisticsEvent } = await import("./logistics-engine.server.js");
|
|
29
29
|
const payload = await buildEngineOrderPayload(order.id);
|
|
30
30
|
if (!payload)
|
|
31
31
|
throw new Error("Order niet gevonden");
|
|
@@ -44,7 +44,7 @@ export const listEngineTasks = createServerFn({ method: "POST" })
|
|
|
44
44
|
})
|
|
45
45
|
.parse(input ?? {}))
|
|
46
46
|
.handler(async ({ data, context }) => {
|
|
47
|
-
const { isEngineShadowMode } = await import("./logistics-engine.server");
|
|
47
|
+
const { isEngineShadowMode } = await import("./logistics-engine.server.js");
|
|
48
48
|
let query = context.supabase
|
|
49
49
|
.from("logistics_tasks")
|
|
50
50
|
.select("*")
|
|
@@ -98,8 +98,8 @@ export const getEngineBufferForOrder = createServerFn({ method: "POST" })
|
|
|
98
98
|
.middleware([requireSupabaseAuth])
|
|
99
99
|
.inputValidator((input) => z.object({ orderId: z.string().min(1) }).parse(input))
|
|
100
100
|
.handler(async ({ data, context }) => {
|
|
101
|
-
const { isEngineShadowMode } = await import("./logistics-engine.server");
|
|
102
|
-
const { getEngineBufferDecision, BUFFER_DECISION_UNAVAILABLE } = await import("./logistics-buffer.server");
|
|
101
|
+
const { isEngineShadowMode } = await import("./logistics-engine.server.js");
|
|
102
|
+
const { getEngineBufferDecision, BUFFER_DECISION_UNAVAILABLE } = await import("./logistics-buffer.server.js");
|
|
103
103
|
const shadow = isEngineShadowMode();
|
|
104
104
|
// DTO-id kan een Floriday salesOrderId zijn.
|
|
105
105
|
const order = await resolveOrderRow(context.supabase, data.orderId);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EngineLoadCarrierCode } from "./load-carriers";
|
|
1
|
+
import type { EngineLoadCarrierCode } from "./load-carriers.js";
|
|
2
2
|
export type LoadCarrierType = EngineLoadCarrierCode;
|
|
3
3
|
export type EngineTaskStatus = "planned" | "ready" | "in_progress" | "done" | "skipped" | "cancelled" | "failed";
|
|
4
4
|
export interface EngineOrderPayload {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// De Engine beslist over buffering, belading, picken, controle, printen en
|
|
4
4
|
// transport. Deze module meldt alleen gebeurtenissen (rij in logistics_events)
|
|
5
5
|
// en voert taken uit (logistics_tasks). Geen HTTP, geen secret.
|
|
6
|
-
import { normalizeLoadCarrierCode } from "./load-carriers";
|
|
6
|
+
import { normalizeLoadCarrierCode } from "./load-carriers.js";
|
|
7
7
|
export function isEngineShadowMode() {
|
|
8
8
|
const raw = (process.env.LOGISTICS_ENGINE_SHADOW ?? "true").toLowerCase();
|
|
9
9
|
return raw !== "false" && raw !== "0";
|
|
@@ -13,7 +13,7 @@ export function isEngineShadowMode() {
|
|
|
13
13
|
* Gebruikt de service-role client zodat het ook vanuit cron werkt.
|
|
14
14
|
*/
|
|
15
15
|
export async function buildEngineOrderPayload(orderId) {
|
|
16
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
16
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
17
17
|
const { data: order } = await supabaseAdmin
|
|
18
18
|
.from("orders")
|
|
19
19
|
.select("id, order_number, customer_id, delivery_date, custom_fields, buffer_id")
|
|
@@ -25,7 +25,7 @@ export async function buildEngineOrderPayload(orderId) {
|
|
|
25
25
|
const cf = (o.custom_fields ?? {});
|
|
26
26
|
// Karren uit de Engine-leesfunctie (gedeelde bufferkarren inbegrepen).
|
|
27
27
|
// Fail closed: lukt de vraag niet, dan geen payload (zoals voorheen bij een leesfout).
|
|
28
|
-
const { loadPlanCoverage } = await import("./plan-coverage.server");
|
|
28
|
+
const { loadPlanCoverage } = await import("./plan-coverage.server.js");
|
|
29
29
|
const cov = (await loadPlanCoverage(supabaseAdmin, [orderId])).get(orderId);
|
|
30
30
|
if (!cov || cov.state === "onbekend") {
|
|
31
31
|
throw new Error(cov?.error ?? "Indeling niet beschikbaar bij de Logistiek Engine");
|
|
@@ -63,7 +63,7 @@ export async function buildEngineOrderPayload(orderId) {
|
|
|
63
63
|
}
|
|
64
64
|
/** Meld een gebeurtenis aan de Engine: rij in logistics_events. */
|
|
65
65
|
export async function insertLogisticsEvent(input) {
|
|
66
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
66
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
67
67
|
const { orderRef, ...rest } = input.order;
|
|
68
68
|
const { data, error } = await supabaseAdmin
|
|
69
69
|
.from("logistics_events")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Voorraadcontrole voor een (concept)order. Antwoord nooit cachen. */
|
|
2
2
|
export declare const checkOrderStockAllowed: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
3
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
3
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
4
4
|
userId: string;
|
|
5
5
|
claims: import("@supabase/auth-js").User;
|
|
6
6
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -9,10 +9,10 @@ export declare const checkOrderStockAllowed: import("@tanstack/start-client-core
|
|
|
9
9
|
quantity: number;
|
|
10
10
|
}[];
|
|
11
11
|
strategyId?: string | null | undefined;
|
|
12
|
-
}, Promise<import("./logistics-stock.server").StockCheckResult>>;
|
|
12
|
+
}, Promise<import("./logistics-stock.server.js").StockCheckResult>>;
|
|
13
13
|
/** Alleen de Engine-instelling opvragen (uitleveren zonder voorraad ja/nee). */
|
|
14
14
|
export declare const getBackorderAllowed: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
15
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
15
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
16
16
|
userId: string;
|
|
17
17
|
claims: import("@supabase/auth-js").User;
|
|
18
18
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Server functions voor de voorraadcontrole van de Logistics Engine.
|
|
2
2
|
import { createServerFn } from "@tanstack/react-start";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
4
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
5
5
|
const LinesInput = z.object({
|
|
6
6
|
lines: z
|
|
7
7
|
.array(z.object({ productId: z.string().min(1), quantity: z.number() }))
|
|
@@ -13,7 +13,7 @@ export const checkOrderStockAllowed = createServerFn({ method: "POST" })
|
|
|
13
13
|
.middleware([requireSupabaseAuth])
|
|
14
14
|
.inputValidator((input) => LinesInput.parse(input ?? {}))
|
|
15
15
|
.handler(async ({ data, context }) => {
|
|
16
|
-
const { checkOrderAllowed } = await import("./logistics-stock.server");
|
|
16
|
+
const { checkOrderAllowed } = await import("./logistics-stock.server.js");
|
|
17
17
|
return await checkOrderAllowed(context.supabase, data.lines, data.strategyId ?? null);
|
|
18
18
|
});
|
|
19
19
|
/** Alleen de Engine-instelling opvragen (uitleveren zonder voorraad ja/nee). */
|
|
@@ -21,6 +21,6 @@ export const getBackorderAllowed = createServerFn({ method: "POST" })
|
|
|
21
21
|
.middleware([requireSupabaseAuth])
|
|
22
22
|
.inputValidator((input) => z.object({ strategyId: z.string().uuid().nullable().optional() }).parse(input ?? {}))
|
|
23
23
|
.handler(async ({ data, context }) => {
|
|
24
|
-
const { backorderAllowed } = await import("./logistics-stock.server");
|
|
24
|
+
const { backorderAllowed } = await import("./logistics-stock.server.js");
|
|
25
25
|
return { allowed: await backorderAllowed(context.supabase, data.strategyId ?? null) };
|
|
26
26
|
});
|
|
@@ -12,7 +12,7 @@ export interface OrderAddress {
|
|
|
12
12
|
* orders.id (uuid) of een Floriday sales-order-id zijn.
|
|
13
13
|
*/
|
|
14
14
|
export declare const getOrderAddresses: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
15
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
15
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
16
16
|
userId: string;
|
|
17
17
|
claims: import("@supabase/auth-js").User;
|
|
18
18
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Adresgegevens (aflever- en ophaaladres) voor een order of orderbuffer.
|
|
2
2
|
import { createServerFn } from "@tanstack/react-start";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
5
|
-
import { resolveOrderRow } from "./order-row.server";
|
|
4
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
5
|
+
import { resolveOrderRow } from "./order-row.server.js";
|
|
6
6
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
7
7
|
function s(v) {
|
|
8
8
|
if (v == null)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
//
|
|
7
7
|
// De mail wordt in public.email_auth_outbox gezet; de e-mailmodule verstuurt
|
|
8
8
|
// hem in haar eigen verwerkingsronde.
|
|
9
|
-
import { buildBlockMailLines, buyerLabel } from "./engine-block-alerts";
|
|
9
|
+
import { buildBlockMailLines, buyerLabel } from "./engine-block-alerts.js";
|
|
10
10
|
const EMAIL_PURPOSE = "internal";
|
|
11
11
|
function escapeHtml(value) {
|
|
12
12
|
return value
|
|
@@ -25,7 +25,7 @@ export async function notifyOrderBlocked(input) {
|
|
|
25
25
|
if (orderIds.length === 0)
|
|
26
26
|
return { sent: 0, warnings };
|
|
27
27
|
try {
|
|
28
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
28
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
29
29
|
// 1) Claim per order+reden. Alleen nieuw geclaimde orders worden gemaild.
|
|
30
30
|
const claimed = [];
|
|
31
31
|
for (const orderId of orderIds) {
|
|
@@ -136,7 +136,7 @@ export async function clearOrderBlockNotifications(orderIds) {
|
|
|
136
136
|
if (ids.length === 0)
|
|
137
137
|
return;
|
|
138
138
|
try {
|
|
139
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
139
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
140
140
|
await supabaseAdmin.from("order_block_notifications").delete().in("order_id", ids);
|
|
141
141
|
}
|
|
142
142
|
catch (err) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Leest de door de Engine gezette buffer-id van een order (alleen lezen). */
|
|
2
2
|
export declare function resolveBufferForOrderInternal(orderId: string): Promise<string | null>;
|
|
3
3
|
export declare const resolveBufferForOrder: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
4
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
4
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
5
5
|
userId: string;
|
|
6
6
|
claims: import("@supabase/auth-js").User;
|
|
7
7
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -11,7 +11,7 @@ export declare const resolveBufferForOrder: import("@tanstack/start-client-core"
|
|
|
11
11
|
}>>;
|
|
12
12
|
/** Haalt alle orders van dezelfde buffer als de gegeven order. */
|
|
13
13
|
export declare const listOrdersInBufferOfOrder: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
14
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
14
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
15
15
|
userId: string;
|
|
16
16
|
claims: import("@supabase/auth-js").User;
|
|
17
17
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -26,7 +26,7 @@ export declare const listOrdersInBufferOfOrder: import("@tanstack/start-client-c
|
|
|
26
26
|
order_number: string;
|
|
27
27
|
customer_name: string;
|
|
28
28
|
delivery_date: string | null;
|
|
29
|
-
custom_fields: import("../integrations/supabase/types").Json;
|
|
29
|
+
custom_fields: import("../integrations/supabase/types.js").Json;
|
|
30
30
|
}[];
|
|
31
31
|
}>>;
|
|
32
32
|
//# sourceMappingURL=order-buffers.functions.d.ts.map
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
// Logistics Engine. Leeg = losse order.
|
|
4
4
|
import { createServerFn } from "@tanstack/react-start";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
7
|
-
import { resolveOrderRow } from "./order-row.server";
|
|
6
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
7
|
+
import { resolveOrderRow } from "./order-row.server.js";
|
|
8
8
|
/** Leest de door de Engine gezette buffer-id van een order (alleen lezen). */
|
|
9
9
|
export async function resolveBufferForOrderInternal(orderId) {
|
|
10
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
10
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
11
11
|
const { data } = await supabaseAdmin
|
|
12
12
|
.from("orders")
|
|
13
13
|
.select("buffer_id")
|
|
@@ -11,7 +11,7 @@ export const CANCELLED_STATUS = "geannuleerd";
|
|
|
11
11
|
* Retourneert het aantal geraakte voorraadsleutels en logregels.
|
|
12
12
|
*/
|
|
13
13
|
export async function reverseOrderStockMutations(orderId, opts) {
|
|
14
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
14
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
15
15
|
const { data: mutations, error: mErr } = await supabaseAdmin
|
|
16
16
|
.from("stock_mutation_log")
|
|
17
17
|
.select("trade_item_key, qty_delta, physical_before, physical_after, reserved_before, reserved_after, mutation_type")
|
|
@@ -79,7 +79,7 @@ export async function reverseOrderStockMutations(orderId, opts) {
|
|
|
79
79
|
}
|
|
80
80
|
/** Annuleert één lokale order: voorraad terug, uit planning, status geannuleerd. */
|
|
81
81
|
export async function cancelLocalOrderInternal(input) {
|
|
82
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
82
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
83
83
|
const { data: order, error: oErr } = await supabaseAdmin
|
|
84
84
|
.from("orders")
|
|
85
85
|
.select("id, status, custom_fields, order_source, floriday_sales_order_id")
|
|
@@ -120,7 +120,7 @@ export async function cancelLocalOrderInternal(input) {
|
|
|
120
120
|
throw new Error(`Annuleren faalde: ${uErr.message}`);
|
|
121
121
|
// Engine informeren zodat buffering/transport de order laat vallen.
|
|
122
122
|
try {
|
|
123
|
-
const { notifyEngineOrder } = await import("./logistics-engine.server");
|
|
123
|
+
const { notifyEngineOrder } = await import("./logistics-engine.server.js");
|
|
124
124
|
await notifyEngineOrder(input.orderId, "order.changed");
|
|
125
125
|
}
|
|
126
126
|
catch (err) {
|
|
@@ -137,7 +137,7 @@ export const FLORIDAY_CANCEL_PICKED_MESSAGE = "Koper heeft geannuleerd in Florid
|
|
|
137
137
|
* melding voor handmatige beoordeling. Schrijft nooit order_carts (Engine).
|
|
138
138
|
*/
|
|
139
139
|
export async function handleFloridayCancellation(orderId) {
|
|
140
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
140
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
141
141
|
const { data: order, error } = await supabaseAdmin
|
|
142
142
|
.from("orders")
|
|
143
143
|
.select("id, status, plan_locked_at, custom_fields, order_source")
|
|
@@ -155,7 +155,7 @@ export async function handleFloridayCancellation(orderId) {
|
|
|
155
155
|
// Pickstand alleen uit de Engine; fail closed.
|
|
156
156
|
let picked = null;
|
|
157
157
|
try {
|
|
158
|
-
const { loadPlanCoverage } = await import("./plan-coverage.server");
|
|
158
|
+
const { loadPlanCoverage } = await import("./plan-coverage.server.js");
|
|
159
159
|
const cov = (await loadPlanCoverage(supabaseAdmin, [orderId], "detail")).get(orderId);
|
|
160
160
|
if (cov && cov.state !== "onbekend") {
|
|
161
161
|
picked =
|
|
@@ -209,7 +209,7 @@ export async function handleFloridayCancellation(orderId) {
|
|
|
209
209
|
if (uErr)
|
|
210
210
|
throw new Error(`Annuleren faalde: ${uErr.message}`);
|
|
211
211
|
try {
|
|
212
|
-
const { notifyEngineOrder } = await import("./logistics-engine.server");
|
|
212
|
+
const { notifyEngineOrder } = await import("./logistics-engine.server.js");
|
|
213
213
|
await notifyEngineOrder(orderId, "order.changed");
|
|
214
214
|
}
|
|
215
215
|
catch (err) {
|
|
@@ -3,7 +3,7 @@ export interface CarrierOption {
|
|
|
3
3
|
name: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const getOrderCarrier: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
6
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
6
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
7
7
|
userId: string;
|
|
8
8
|
claims: import("@supabase/auth-js").User;
|
|
9
9
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -15,7 +15,7 @@ export declare const getOrderCarrier: import("@tanstack/start-client-core").Opti
|
|
|
15
15
|
options: CarrierOption[];
|
|
16
16
|
}>>;
|
|
17
17
|
export declare const setOrderCarrier: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
18
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
18
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
19
19
|
userId: string;
|
|
20
20
|
claims: import("@supabase/auth-js").User;
|
|
21
21
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Vervoerder (carrier) van een order of orderbuffer lezen en wijzigen.
|
|
2
2
|
import { createServerFn } from "@tanstack/react-start";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
5
|
-
import { assertRowsAffected, resolveOrderRow } from "./order-row.server";
|
|
4
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
5
|
+
import { assertRowsAffected, resolveOrderRow } from "./order-row.server.js";
|
|
6
6
|
async function findOrder(supabase, orderId) {
|
|
7
7
|
// DTO-id kan een Floriday salesOrderId zijn; resolveOrderRow vertaalt dat.
|
|
8
8
|
const row = await resolveOrderRow(supabase, orderId);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const markOrdersShipped: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
2
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
2
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
3
3
|
userId: string;
|
|
4
4
|
claims: import("@supabase/auth-js").User;
|
|
5
5
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// vereist bewijs van vertrek (alle karren verzonden of dekkende zendingen).
|
|
4
4
|
import { createServerFn } from "@tanstack/react-start";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware";
|
|
7
|
-
import { resolveOrderRow } from "./order-row.server";
|
|
6
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
7
|
+
import { resolveOrderRow } from "./order-row.server.js";
|
|
8
8
|
const Input = z.object({
|
|
9
9
|
orderIds: z.array(z.string().min(1)).min(1).max(200),
|
|
10
10
|
});
|
|
@@ -12,7 +12,7 @@ export const markOrdersShipped = createServerFn({ method: "POST" })
|
|
|
12
12
|
.middleware([requireSupabaseAuth])
|
|
13
13
|
.inputValidator((input) => Input.parse(input))
|
|
14
14
|
.handler(async ({ data, context }) => {
|
|
15
|
-
const { supabaseAdmin } = await import("../integrations/supabase/client.server");
|
|
15
|
+
const { supabaseAdmin } = await import("../integrations/supabase/client.server.js");
|
|
16
16
|
const results = [];
|
|
17
17
|
for (const raw of data.orderIds) {
|
|
18
18
|
try {
|
|
@@ -14,7 +14,7 @@ export interface OrderItemPackingRow {
|
|
|
14
14
|
* Floriday sales-order-id zijn (resolveOrderRow vertaalt dat).
|
|
15
15
|
*/
|
|
16
16
|
export declare const listOrderItemPacking: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
17
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
17
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
18
18
|
userId: string;
|
|
19
19
|
claims: import("@supabase/auth-js").User;
|
|
20
20
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -24,7 +24,7 @@ export declare const listOrderItemPacking: import("@tanstack/start-client-core")
|
|
|
24
24
|
}>>;
|
|
25
25
|
/** Zet de belading van één orderregel handmatig vast. */
|
|
26
26
|
export declare const setOrderItemPacking: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
27
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
27
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
28
28
|
userId: string;
|
|
29
29
|
claims: import("@supabase/auth-js").User;
|
|
30
30
|
}, undefined, undefined, undefined>], (input: unknown) => {
|
|
@@ -38,7 +38,7 @@ export declare const setOrderItemPacking: import("@tanstack/start-client-core").
|
|
|
38
38
|
}>>;
|
|
39
39
|
/** Haal de handmatige markering weg; de regel volgt weer de standaardbelading. */
|
|
40
40
|
export declare const clearOrderItemPackingLock: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
41
|
-
supabase: import("../integrations/supabase/auth-middleware").AuthedSupabaseClient;
|
|
41
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
42
42
|
userId: string;
|
|
43
43
|
claims: import("@supabase/auth-js").User;
|
|
44
44
|
}, undefined, undefined, undefined>], (input: unknown) => {
|