@flowselections/layout-maker 1.6.6 → 1.7.1
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 +30 -0
- package/dist-lib/index.d.ts +1 -0
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +2 -1
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +347 -0
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +347 -0
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +347 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/aiLayout.functions.d.ts +347 -0
- package/dist-lib/lib/aiLayout.functions.d.ts.map +1 -1
- package/dist-lib/lib/orderData.server.d.ts.map +1 -1
- package/dist-lib/lib/orderData.server.js +28 -14
- package/dist-lib/lib/printApi.d.ts.map +1 -1
- package/dist-lib/lib/printApi.js +13 -0
- package/dist-lib/lib/printService.functions.d.ts +1735 -0
- package/dist-lib/lib/printService.functions.d.ts.map +1 -1
- package/dist-lib/lib/queueTick.d.ts +6 -0
- package/dist-lib/lib/queueTick.d.ts.map +1 -0
- package/dist-lib/lib/queueTick.js +44 -0
- package/package.json +10 -1
- package/dist-lib/components/settings/MijnModuleSettingsCard.d.ts +0 -2
- package/dist-lib/components/settings/MijnModuleSettingsCard.d.ts.map +0 -1
- package/dist-lib/components/settings/MijnModuleSettingsCard.js +0 -42
- package/dist-lib/hooks/useMijnModuleData.d.ts +0 -13
- package/dist-lib/hooks/useMijnModuleData.d.ts.map +0 -1
- package/dist-lib/hooks/useMijnModuleData.js +0 -49
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queueTick.d.ts","sourceRoot":"","sources":["../../src/lib/queueTick.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmC3E"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// src/lib/queueTick.ts — afhandeling van /api/public/print/queue-tick.
|
|
3
|
+
// Wordt door de module geleverd zodat elke shell dit eindpunt met een
|
|
4
|
+
// routebestandje van drie regels kan hosten. Bovenaan staan géén server-only
|
|
5
|
+
// imports: die worden pas binnen de handler dynamisch geladen.
|
|
6
|
+
// ============================================================================
|
|
7
|
+
function gelijk(a, b) {
|
|
8
|
+
if (a.length !== b.length)
|
|
9
|
+
return false;
|
|
10
|
+
let verschil = 0;
|
|
11
|
+
for (let i = 0; i < a.length; i++)
|
|
12
|
+
verschil |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
13
|
+
return verschil === 0;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Verwerkt een tick-verzoek: controleert de sleutel, houdt de shell-registratie
|
|
17
|
+
* levend en drukt een paar wachtende opdrachten af.
|
|
18
|
+
*/
|
|
19
|
+
export async function behandelQueueTick(request) {
|
|
20
|
+
const projectSleutel = process.env["SUPABASE_PUBLISHABLE_KEY"] ??
|
|
21
|
+
process.env["VITE_SUPABASE_PUBLISHABLE_KEY"] ??
|
|
22
|
+
"";
|
|
23
|
+
const meegegeven = request.headers.get("apikey") ??
|
|
24
|
+
(request.headers.get("authorization") ?? "").replace(/^Bearer\s+/i, "");
|
|
25
|
+
const { isRunnerSleutel, meldRunnerAan } = await import("./runnerRegistry.server");
|
|
26
|
+
const toegestaan = !!meegegeven &&
|
|
27
|
+
((!!projectSleutel && gelijk(projectSleutel, meegegeven)) ||
|
|
28
|
+
(await isRunnerSleutel(meegegeven)));
|
|
29
|
+
if (!toegestaan) {
|
|
30
|
+
return new Response(JSON.stringify({ ok: false }), {
|
|
31
|
+
status: 401,
|
|
32
|
+
headers: { "Content-Type": "application/json" },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
void meldRunnerAan();
|
|
36
|
+
const { verwerkWachtrij } = await import("./printQueue.server");
|
|
37
|
+
try {
|
|
38
|
+
const resultaat = await verwerkWachtrij(5);
|
|
39
|
+
return Response.json({ ok: true, ...resultaat });
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
return new Response(JSON.stringify({ ok: false, fout: e instanceof Error ? e.message : "Mislukt" }), { status: 500, headers: { "Content-Type": "application/json" } });
|
|
43
|
+
}
|
|
44
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowselections/layout-maker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"flowselections": {
|
|
5
5
|
"moduleId": "layout-maker",
|
|
6
6
|
"pages": [
|
|
@@ -44,6 +44,15 @@
|
|
|
44
44
|
"route": "layouts-printers/productiebon/$layoutId",
|
|
45
45
|
"title": "Productiebon opbouw"
|
|
46
46
|
}
|
|
47
|
+
],
|
|
48
|
+
"serverRoutes": [
|
|
49
|
+
{
|
|
50
|
+
"path": "api/public/print/queue-tick",
|
|
51
|
+
"export": "behandelQueueTick",
|
|
52
|
+
"methods": [
|
|
53
|
+
"POST"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
47
56
|
]
|
|
48
57
|
},
|
|
49
58
|
"private": false,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MijnModuleSettingsCard.d.ts","sourceRoot":"","sources":["../../../src/components/settings/MijnModuleSettingsCard.tsx"],"names":[],"mappings":"AAiCA,wBAAgB,sBAAsB,gCA+CrC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// ============================================================================
|
|
3
|
-
// src/components/settings/MijnModuleSettingsCard.tsx — EXAMPLE SETTINGS CARD
|
|
4
|
-
// ============================================================================
|
|
5
|
-
// This is an example of a settings card for your module.
|
|
6
|
-
// It appears on the main settings page when registered in src/index.ts.
|
|
7
|
-
//
|
|
8
|
-
// RULES:
|
|
9
|
-
// - Must return a <Card> as its root element
|
|
10
|
-
// - Handles its own data fetching — no props are passed by the core
|
|
11
|
-
// - Use the same Card primitives from @flowselections/core
|
|
12
|
-
//
|
|
13
|
-
// WHAT TO DO:
|
|
14
|
-
// - Rename this file to match your card's purpose
|
|
15
|
-
// - Add your real settings UI
|
|
16
|
-
// - Register it in src/index.ts under settingsCards
|
|
17
|
-
// - Delete this file entirely if your module has no settings
|
|
18
|
-
// ============================================================================
|
|
19
|
-
import { useState } from "react";
|
|
20
|
-
import { Card, CardContent, CardDescription, CardHeader, CardTitle, Button, Input, Label, toast, } from "@flowselections/core";
|
|
21
|
-
import { Settings2 } from "lucide-react";
|
|
22
|
-
export function MijnModuleSettingsCard() {
|
|
23
|
-
// Replace with your real settings state
|
|
24
|
-
const [setting, setSetting] = useState("");
|
|
25
|
-
const [saving, setSaving] = useState(false);
|
|
26
|
-
const handleSave = async () => {
|
|
27
|
-
setSaving(true);
|
|
28
|
-
try {
|
|
29
|
-
// Example: save to a table — replace with your real query
|
|
30
|
-
// const { error } = await supabase.from("my_settings").upsert({ ... });
|
|
31
|
-
// if (error) throw error;
|
|
32
|
-
toast.success("Instellingen opgeslagen");
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
toast.error("Fout bij het opslaan");
|
|
36
|
-
}
|
|
37
|
-
finally {
|
|
38
|
-
setSaving(false);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Settings2, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { children: "Module Instellingen" }), " "] }), _jsx(CardDescription, { children: "Beheer de instellingen voor deze module " })] }), _jsxs(CardContent, { className: "space-y-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "setting", children: "Instelling" }), _jsx(Input, { id: "setting", value: setting, onChange: (e) => setSetting(e.target.value), placeholder: "Waarde..." })] }), _jsx(Button, { onClick: handleSave, disabled: saving, children: saving ? "Opslaan..." : "Opslaan" })] })] }));
|
|
42
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface MijnItem {
|
|
2
|
-
id: string;
|
|
3
|
-
created_at: string;
|
|
4
|
-
[key: string]: unknown;
|
|
5
|
-
}
|
|
6
|
-
export declare function useMijnModuleData(): {
|
|
7
|
-
items: MijnItem[];
|
|
8
|
-
loading: boolean;
|
|
9
|
-
error: string | null;
|
|
10
|
-
reload: () => Promise<void>;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=useMijnModuleData.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMijnModuleData.d.ts","sourceRoot":"","sources":["../../src/hooks/useMijnModuleData.ts"],"names":[],"mappings":"AAkBA,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAgB,iBAAiB;;;;;EAkChC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// src/hooks/useMijnModuleData.ts — EXAMPLE DATA HOOK
|
|
3
|
-
// ============================================================================
|
|
4
|
-
// Put your data fetching logic in hooks like this, not directly in components.
|
|
5
|
-
// This keeps your pages clean and makes it easy to reuse data across pages.
|
|
6
|
-
//
|
|
7
|
-
// WHAT TO DO:
|
|
8
|
-
// - Rename to match your data (e.g. useProducts, useOrders, useSuppliers)
|
|
9
|
-
// - Replace the example query with your real Supabase query
|
|
10
|
-
// - Replace MijnItem with your actual table's row type
|
|
11
|
-
// - Import and use in your page components
|
|
12
|
-
// - Delete this file if you prefer a different pattern
|
|
13
|
-
// ============================================================================
|
|
14
|
-
import { useState, useEffect, useCallback } from "react";
|
|
15
|
-
import { supabase, toast } from "@flowselections/core";
|
|
16
|
-
export function useMijnModuleData() {
|
|
17
|
-
const [items, setItems] = useState([]);
|
|
18
|
-
const [loading, setLoading] = useState(true);
|
|
19
|
-
const [error, setError] = useState(null);
|
|
20
|
-
const load = useCallback(async () => {
|
|
21
|
-
setLoading(true);
|
|
22
|
-
setError(null);
|
|
23
|
-
try {
|
|
24
|
-
const { data, error } = await supabase
|
|
25
|
-
.from("products") // ← CHANGE THIS to your table
|
|
26
|
-
.select("*")
|
|
27
|
-
.order("created_at", { ascending: false });
|
|
28
|
-
if (error)
|
|
29
|
-
throw error;
|
|
30
|
-
setItems(data ?? []);
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
setError("Fout bij het laden van gegevens");
|
|
34
|
-
toast.error("Fout bij het laden van gegevens");
|
|
35
|
-
}
|
|
36
|
-
finally {
|
|
37
|
-
setLoading(false);
|
|
38
|
-
}
|
|
39
|
-
}, []);
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
load();
|
|
42
|
-
}, [load]);
|
|
43
|
-
return {
|
|
44
|
-
items,
|
|
45
|
-
loading,
|
|
46
|
-
error,
|
|
47
|
-
reload: load,
|
|
48
|
-
};
|
|
49
|
-
}
|