@flowselections/floriday-afhandeling-module 1.0.25 → 1.0.26
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/afhandeling/CapacityWarning.d.ts +10 -0
- package/dist-lib/components/afhandeling/CapacityWarning.d.ts.map +1 -0
- package/dist-lib/components/afhandeling/CapacityWarning.js +12 -0
- package/dist-lib/components/afhandeling/ControlePage.d.ts.map +1 -1
- package/dist-lib/components/afhandeling/ControlePage.js +7 -2
- package/dist-lib/components/afhandeling/DagDetailDialog.d.ts.map +1 -1
- package/dist-lib/components/afhandeling/DagDetailDialog.js +158 -62
- package/dist-lib/components/afhandeling/LeveringenPage.d.ts.map +1 -1
- package/dist-lib/components/afhandeling/LeveringenPage.js +2 -10
- package/dist-lib/components/afhandeling/PickAgendaView.d.ts.map +1 -1
- package/dist-lib/components/afhandeling/PickAgendaView.js +4 -11
- package/dist-lib/components/afhandeling/VervoerdersPage.d.ts.map +1 -1
- package/dist-lib/components/afhandeling/VervoerdersPage.js +2 -5
- package/dist-lib/components/afhandeling/VerzetOrderDialog.d.ts +14 -0
- package/dist-lib/components/afhandeling/VerzetOrderDialog.d.ts.map +1 -0
- package/dist-lib/components/afhandeling/VerzetOrderDialog.js +203 -0
- package/dist-lib/components/afhandeling/WeekAgendaView.d.ts.map +1 -1
- package/dist-lib/components/afhandeling/WeekAgendaView.js +7 -3
- package/dist-lib/components/pickstation/PickstationPage.d.ts.map +1 -1
- package/dist-lib/components/pickstation/PickstationPage.js +1 -0
- package/dist-lib/components/settings/VervoerdersSettingsCard.d.ts.map +1 -1
- package/dist-lib/components/settings/VervoerdersSettingsCard.js +2 -5
- package/dist-lib/hooks/useCapacityCheck.d.ts +10 -0
- package/dist-lib/hooks/useCapacityCheck.d.ts.map +1 -0
- package/dist-lib/hooks/useCapacityCheck.js +22 -0
- package/dist-lib/hooks/useEngineTasks.d.ts +14 -0
- package/dist-lib/hooks/useEngineTasks.d.ts.map +1 -0
- package/dist-lib/hooks/useEngineTasks.js +49 -0
- package/dist-lib/hooks/useOrderPlanning.d.ts +8 -2
- package/dist-lib/hooks/useOrderPlanning.d.ts.map +1 -1
- package/dist-lib/hooks/useOrderPlanning.js +95 -93
- package/dist-lib/index.d.ts +0 -3
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +1 -5
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +9010 -5433
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +9010 -5433
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +9010 -5433
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +9184 -5544
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/afhandelingSettings.functions.d.ts +7186 -32
- package/dist-lib/lib/afhandelingSettings.functions.d.ts.map +1 -1
- package/dist-lib/lib/carriers.functions.d.ts +17965 -80
- package/dist-lib/lib/carriers.functions.d.ts.map +1 -1
- package/dist-lib/lib/cartAssignments.functions.d.ts +17965 -80
- package/dist-lib/lib/cartAssignments.functions.d.ts.map +1 -1
- package/dist-lib/lib/cartControl.functions.d.ts +35962 -170
- package/dist-lib/lib/cartControl.functions.d.ts.map +1 -1
- package/dist-lib/lib/cartControl.functions.js +103 -13
- package/dist-lib/lib/floriday.functions.d.ts +9010 -5433
- package/dist-lib/lib/floriday.functions.d.ts.map +1 -1
- package/dist-lib/lib/logisticsEngine/capacity.d.ts +19 -0
- package/dist-lib/lib/logisticsEngine/capacity.d.ts.map +1 -0
- package/dist-lib/lib/logisticsEngine/capacity.js +91 -0
- package/dist-lib/lib/logisticsEngine/engine.d.ts +99 -0
- package/dist-lib/lib/logisticsEngine/engine.d.ts.map +1 -0
- package/dist-lib/lib/logisticsEngine/engine.js +102 -0
- package/dist-lib/lib/logisticsEngine/reschedule.d.ts +65 -0
- package/dist-lib/lib/logisticsEngine/reschedule.d.ts.map +1 -0
- package/dist-lib/lib/logisticsEngine/reschedule.js +86 -0
- package/dist-lib/lib/logisticsEngine/staffPlanning.d.ts +37 -0
- package/dist-lib/lib/logisticsEngine/staffPlanning.d.ts.map +1 -0
- package/dist-lib/lib/logisticsEngine/staffPlanning.js +100 -0
- package/dist-lib/lib/serverFnError.d.ts +10 -0
- package/dist-lib/lib/serverFnError.d.ts.map +1 -0
- package/dist-lib/lib/serverFnError.js +29 -0
- package/dist-lib/lib/serverRoutes/index.d.ts +0 -1
- package/dist-lib/lib/serverRoutes/index.d.ts.map +1 -1
- package/dist-lib/lib/serverRoutes/index.js +0 -1
- package/dist-lib/lib/timezone.d.ts +27 -0
- package/dist-lib/lib/timezone.d.ts.map +1 -0
- package/dist-lib/lib/timezone.js +68 -0
- package/package.json +6 -21
- package/dist-lib/components/engine/CapaciteitsmaatregelenPage.d.ts +0 -2
- package/dist-lib/components/engine/CapaciteitsmaatregelenPage.d.ts.map +0 -1
- package/dist-lib/components/engine/CapaciteitsmaatregelenPage.js +0 -40
- package/dist-lib/components/engine/CapaciteitsmonitorPage.d.ts +0 -2
- package/dist-lib/components/engine/CapaciteitsmonitorPage.d.ts.map +0 -1
- package/dist-lib/components/engine/CapaciteitsmonitorPage.js +0 -49
- package/dist-lib/components/engine/FormulesPage.d.ts +0 -2
- package/dist-lib/components/engine/FormulesPage.d.ts.map +0 -1
- package/dist-lib/components/engine/FormulesPage.js +0 -252
- package/dist-lib/components/engine/PlaceholderPage.d.ts +0 -6
- package/dist-lib/components/engine/PlaceholderPage.d.ts.map +0 -1
- package/dist-lib/components/engine/PlaceholderPage.js +0 -6
- package/dist-lib/components/engine/StrategieenPage.d.ts +0 -2
- package/dist-lib/components/engine/StrategieenPage.d.ts.map +0 -1
- package/dist-lib/components/engine/StrategieenPage.js +0 -80
- package/dist-lib/lib/logisticsEngine/capacity.functions.d.ts +0 -64978
- package/dist-lib/lib/logisticsEngine/capacity.functions.d.ts.map +0 -1
- package/dist-lib/lib/logisticsEngine/capacity.functions.js +0 -90
- package/dist-lib/lib/logisticsEngine/config.d.ts +0 -140
- package/dist-lib/lib/logisticsEngine/config.d.ts.map +0 -1
- package/dist-lib/lib/logisticsEngine/config.js +0 -488
- package/dist-lib/lib/logisticsEngine/enginePickTime.d.ts +0 -29
- package/dist-lib/lib/logisticsEngine/enginePickTime.d.ts.map +0 -1
- package/dist-lib/lib/logisticsEngine/enginePickTime.js +0 -136
- package/dist-lib/lib/logisticsEngine/evaluate.functions.d.ts +0 -16278
- package/dist-lib/lib/logisticsEngine/evaluate.functions.d.ts.map +0 -1
- package/dist-lib/lib/logisticsEngine/evaluate.functions.js +0 -104
- package/dist-lib/lib/logisticsEngine/expression.d.ts +0 -21
- package/dist-lib/lib/logisticsEngine/expression.d.ts.map +0 -1
- package/dist-lib/lib/logisticsEngine/expression.js +0 -263
- package/dist-lib/lib/logisticsEngine/formulas.functions.d.ts +0 -32512
- package/dist-lib/lib/logisticsEngine/formulas.functions.d.ts.map +0 -1
- package/dist-lib/lib/logisticsEngine/formulas.functions.js +0 -58
- package/dist-lib/lib/logisticsEngine/safetyLayer.d.ts +0 -83
- package/dist-lib/lib/logisticsEngine/safetyLayer.d.ts.map +0 -1
- package/dist-lib/lib/logisticsEngine/safetyLayer.js +0 -182
- package/dist-lib/lib/logisticsEngine/strategies.functions.d.ts +0 -129961
- package/dist-lib/lib/logisticsEngine/strategies.functions.d.ts.map +0 -1
- package/dist-lib/lib/logisticsEngine/strategies.functions.js +0 -176
- package/dist-lib/lib/logisticsEngine/variables.d.ts +0 -29
- package/dist-lib/lib/logisticsEngine/variables.d.ts.map +0 -1
- package/dist-lib/lib/logisticsEngine/variables.js +0 -144
- package/dist-lib/lib/logisticsEngine/wizard.functions.d.ts +0 -64976
- package/dist-lib/lib/logisticsEngine/wizard.functions.d.ts.map +0 -1
- package/dist-lib/lib/logisticsEngine/wizard.functions.js +0 -175
- package/dist-lib/lib/serverRoutes/logisticsTick.handler.d.ts +0 -3
- package/dist-lib/lib/serverRoutes/logisticsTick.handler.d.ts.map +0 -1
- package/dist-lib/lib/serverRoutes/logisticsTick.handler.js +0 -42
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { createServerFn } from "@tanstack/react-start";
|
|
2
|
-
import { generateObject } from "ai";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { requireSupabaseAuth } from "../../integrations/supabase/auth-middleware";
|
|
5
|
-
import { createLovableAiGatewayProvider } from "../ai-gateway.server";
|
|
6
|
-
import { CONFIG_SLOT, DEFAULT_CONFIG, compileConfig } from "./config";
|
|
7
|
-
/** Bulk-save: compileer wizard-config en sla alle slots + de raw-config zelf op. */
|
|
8
|
-
export const saveWizardConfig = createServerFn({ method: "POST" })
|
|
9
|
-
.middleware([requireSupabaseAuth])
|
|
10
|
-
.inputValidator((d) => ({
|
|
11
|
-
strategy_id: String(d.strategy_id),
|
|
12
|
-
config: d.config,
|
|
13
|
-
}))
|
|
14
|
-
.handler(async ({ data, context }) => {
|
|
15
|
-
const supabase = context.supabase;
|
|
16
|
-
const compiled = compileConfig(data.config);
|
|
17
|
-
const rows = [
|
|
18
|
-
...compiled.map((f) => ({
|
|
19
|
-
user_id: context.userId,
|
|
20
|
-
strategy_id: data.strategy_id,
|
|
21
|
-
slot: f.slot,
|
|
22
|
-
expression: f.expression,
|
|
23
|
-
notes: null,
|
|
24
|
-
})),
|
|
25
|
-
{
|
|
26
|
-
user_id: context.userId,
|
|
27
|
-
strategy_id: data.strategy_id,
|
|
28
|
-
slot: CONFIG_SLOT,
|
|
29
|
-
expression: JSON.stringify(data.config),
|
|
30
|
-
notes: "wizard-config",
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
const { error } = await supabase
|
|
34
|
-
.from("logistics_formulas")
|
|
35
|
-
.upsert(rows, { onConflict: "strategy_id,slot" });
|
|
36
|
-
if (error)
|
|
37
|
-
throw new Error(error.message);
|
|
38
|
-
return { ok: true, saved: compiled.length };
|
|
39
|
-
});
|
|
40
|
-
/** Laad de opgeslagen wizard-config (of default). */
|
|
41
|
-
export const loadWizardConfig = createServerFn({ method: "GET" })
|
|
42
|
-
.middleware([requireSupabaseAuth])
|
|
43
|
-
.inputValidator((d) => ({ strategy_id: String(d.strategy_id) }))
|
|
44
|
-
.handler(async ({ data, context }) => {
|
|
45
|
-
const supabase = context.supabase;
|
|
46
|
-
const { data: row, error } = await supabase
|
|
47
|
-
.from("logistics_formulas")
|
|
48
|
-
.select("expression")
|
|
49
|
-
.eq("user_id", context.userId)
|
|
50
|
-
.eq("strategy_id", data.strategy_id)
|
|
51
|
-
.eq("slot", CONFIG_SLOT)
|
|
52
|
-
.maybeSingle();
|
|
53
|
-
if (error)
|
|
54
|
-
throw new Error(error.message);
|
|
55
|
-
if (!row?.expression)
|
|
56
|
-
return { config: DEFAULT_CONFIG, existed: false };
|
|
57
|
-
try {
|
|
58
|
-
const parsed = JSON.parse(row.expression);
|
|
59
|
-
return { config: { ...DEFAULT_CONFIG, ...parsed }, existed: true };
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
return { config: DEFAULT_CONFIG, existed: false };
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
/**
|
|
66
|
-
* Laad de wizard-config van de actieve strategie van de gebruiker.
|
|
67
|
-
* Geeft `null` terug als er nog geen (opgeslagen) actieve strategie is.
|
|
68
|
-
*/
|
|
69
|
-
export const getActiveWizardConfig = createServerFn({ method: "GET" })
|
|
70
|
-
.middleware([requireSupabaseAuth])
|
|
71
|
-
.handler(async ({ context }) => {
|
|
72
|
-
const supabase = context.supabase;
|
|
73
|
-
const { data: strategy } = await supabase
|
|
74
|
-
.from("logistics_strategies")
|
|
75
|
-
.select("id")
|
|
76
|
-
.eq("user_id", context.userId)
|
|
77
|
-
.eq("is_active", true)
|
|
78
|
-
.maybeSingle();
|
|
79
|
-
if (!strategy)
|
|
80
|
-
return { config: null, strategyId: null };
|
|
81
|
-
const { data: row } = await supabase
|
|
82
|
-
.from("logistics_formulas")
|
|
83
|
-
.select("expression")
|
|
84
|
-
.eq("user_id", context.userId)
|
|
85
|
-
.eq("strategy_id", strategy.id)
|
|
86
|
-
.eq("slot", CONFIG_SLOT)
|
|
87
|
-
.maybeSingle();
|
|
88
|
-
if (!row?.expression)
|
|
89
|
-
return { config: null, strategyId: strategy.id };
|
|
90
|
-
try {
|
|
91
|
-
const parsed = JSON.parse(row.expression);
|
|
92
|
-
return { config: { ...DEFAULT_CONFIG, ...parsed }, strategyId: strategy.id };
|
|
93
|
-
}
|
|
94
|
-
catch {
|
|
95
|
-
return { config: null, strategyId: strategy.id };
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
// AI-configurator: neem vrije tekst en stel wizard-config voor.
|
|
99
|
-
const configSchema = z.object({
|
|
100
|
-
orderMode: z.enum(["per-order", "per-customer", "per-location", "per-cart", "custom"]),
|
|
101
|
-
combine: z.object({
|
|
102
|
-
mode: z.enum(["none", "auction", "bvo", "all"]),
|
|
103
|
-
maxLayersOwnCart: z.number().int().min(1).max(20),
|
|
104
|
-
maxCustomersPerCart: z.number().int().min(1).max(20),
|
|
105
|
-
sameCarrier: z.boolean(),
|
|
106
|
-
sameRoute: z.boolean(),
|
|
107
|
-
sameCrateType: z.boolean(),
|
|
108
|
-
sameDeliveryDate: z.boolean(),
|
|
109
|
-
}),
|
|
110
|
-
cartFull: z.object({
|
|
111
|
-
mode: z.enum(["100", "98", "layers", "weight", "custom"]),
|
|
112
|
-
fillPct: z.number().min(1).max(100),
|
|
113
|
-
maxLayers: z.number().int().min(1).max(20),
|
|
114
|
-
maxWeight: z.number().min(1).max(2000),
|
|
115
|
-
customExpression: z.string(),
|
|
116
|
-
}),
|
|
117
|
-
cartClose: z.object({
|
|
118
|
-
whenFull: z.boolean(),
|
|
119
|
-
whenCapacityReached: z.boolean(),
|
|
120
|
-
when30minLeft: z.boolean(),
|
|
121
|
-
onlyManual: z.boolean(),
|
|
122
|
-
}),
|
|
123
|
-
documents: z.object({
|
|
124
|
-
packingSlip: z.enum(["cart-full", "batch-close", "pickstation"]),
|
|
125
|
-
deliveryNote: z.enum(["floriday", "pickstation", "manual"]),
|
|
126
|
-
}),
|
|
127
|
-
pickstationVisibility: z.object({
|
|
128
|
-
batchClosed: z.boolean(),
|
|
129
|
-
packingSlip: z.boolean(),
|
|
130
|
-
plannerApproved: z.boolean(),
|
|
131
|
-
controlDone: z.boolean(),
|
|
132
|
-
manual: z.boolean(),
|
|
133
|
-
}),
|
|
134
|
-
pickPlanningRelease: z.object({
|
|
135
|
-
mode: z.enum(["latest", "hours-before-departure", "between-signup-window", "fixed-time", "days-before-delivery", "manual", "custom"]),
|
|
136
|
-
hoursBeforeDeparture: z.number().min(0).max(72),
|
|
137
|
-
fixedTime: z.string(),
|
|
138
|
-
daysBeforeDelivery: z.number().int().min(0).max(30),
|
|
139
|
-
safetyBufferMinutes: z.number().int().min(0).max(240),
|
|
140
|
-
customExpression: z.string(),
|
|
141
|
-
hoursBeforeSignupWindow: z.number().min(0).max(72).optional().default(4),
|
|
142
|
-
earlyPickHours: z.number().min(0).max(72).optional().default(2),
|
|
143
|
-
incompleteCartsBeforeSignup: z.boolean().optional().default(false),
|
|
144
|
-
safetyBufferMode: z.enum(["minutes", "percent"]).optional().default("minutes"),
|
|
145
|
-
safetyBufferPercent: z.number().min(0).max(100).optional().default(20),
|
|
146
|
-
}),
|
|
147
|
-
startMoment: z.object({
|
|
148
|
-
autoWhenCapacity: z.boolean(),
|
|
149
|
-
safetyBufferMinutes: z.number().int().min(0).max(240),
|
|
150
|
-
capacityMode: z.enum(["carts-per-hour", "minutes-per-cart"]),
|
|
151
|
-
pickCapacityPerHour: z.number().min(1).max(200),
|
|
152
|
-
minutesPerCart: z.number().min(1).max(240),
|
|
153
|
-
}),
|
|
154
|
-
});
|
|
155
|
-
export const aiSuggestConfig = createServerFn({ method: "POST" })
|
|
156
|
-
.middleware([requireSupabaseAuth])
|
|
157
|
-
.inputValidator((d) => ({
|
|
158
|
-
description: String(d.description ?? "").slice(0, 4000),
|
|
159
|
-
current: d.current ?? DEFAULT_CONFIG,
|
|
160
|
-
}))
|
|
161
|
-
.handler(async ({ data }) => {
|
|
162
|
-
const key = process.env.LOVABLE_API_KEY;
|
|
163
|
-
if (!key)
|
|
164
|
-
throw new Error("LOVABLE_API_KEY ontbreekt");
|
|
165
|
-
const gateway = createLovableAiGatewayProvider(key);
|
|
166
|
-
const { object } = await generateObject({
|
|
167
|
-
model: gateway("google/gemini-2.5-flash"),
|
|
168
|
-
schema: configSchema,
|
|
169
|
-
system: "Je bent een logistieke configurator. Vertaal de beschrijving van de gebruiker naar een complete wizard-configuratie. " +
|
|
170
|
-
"Behoud bestaande instellingen wanneer de beschrijving daar niets over zegt. Antwoord uitsluitend met het JSON-schema.",
|
|
171
|
-
prompt: `Huidige configuratie (JSON):\n${JSON.stringify(data.current)}\n\n` +
|
|
172
|
-
`Beschrijving van de gewenste werkwijze:\n${data.description}`,
|
|
173
|
-
});
|
|
174
|
-
return { config: object };
|
|
175
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logisticsTick.handler.d.ts","sourceRoot":"","sources":["../../../src/lib/serverRoutes/logisticsTick.handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG1E,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,EAChB,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,QAAQ,CAAC,CAoCnB"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Handler-lift van /api/public/hooks/logistics-tick. Byte-identiek gedrag.
|
|
2
|
-
// NB: dit endpoint is publiek en heeft géén auth-check — nog niet in het shell-manifest.
|
|
3
|
-
import { createClient } from "@supabase/supabase-js";
|
|
4
|
-
import { runStrategyPlannerForUser } from "../logisticsEngine/evaluate.functions";
|
|
5
|
-
export async function handleLogisticsTick(request, injected) {
|
|
6
|
-
const apikey = request.headers.get("apikey") ?? request.headers.get("x-api-key");
|
|
7
|
-
const expected = process.env.SUPABASE_PUBLISHABLE_KEY;
|
|
8
|
-
if (!expected || !apikey || apikey !== expected) {
|
|
9
|
-
return new Response("Unauthorized", { status: 401 });
|
|
10
|
-
}
|
|
11
|
-
let admin;
|
|
12
|
-
if (injected) {
|
|
13
|
-
admin = injected;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
const url = process.env.SUPABASE_URL;
|
|
17
|
-
const key = process.env.SUPABASE_SERVICE_ROLE_KEY;
|
|
18
|
-
if (!url || !key)
|
|
19
|
-
return new Response("Missing env", { status: 500 });
|
|
20
|
-
admin = createClient(url, key, {
|
|
21
|
-
auth: { persistSession: false, autoRefreshToken: false },
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
const { data: userIds, error } = await admin
|
|
25
|
-
.from("logistics_strategy_schedules")
|
|
26
|
-
.select("user_id")
|
|
27
|
-
.eq("is_enabled", true);
|
|
28
|
-
if (error)
|
|
29
|
-
return Response.json({ error: error.message }, { status: 500 });
|
|
30
|
-
const unique = Array.from(new Set((userIds ?? []).map((r) => r.user_id)));
|
|
31
|
-
const results = [];
|
|
32
|
-
for (const uid of unique) {
|
|
33
|
-
try {
|
|
34
|
-
const r = await runStrategyPlannerForUser(admin, uid, {});
|
|
35
|
-
results.push({ user: uid, ...r });
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
results.push({ user: uid, reason: e instanceof Error ? e.message : String(e) });
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return Response.json({ ok: true, processed: unique.length, results });
|
|
42
|
-
}
|