@flowselections/core 1.0.22 → 1.0.24
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 +80 -0
- package/dist/auth/redirect.d.ts +33 -4
- package/dist/auth/redirect.d.ts.map +1 -1
- package/dist/auth/redirect.js +58 -7
- package/dist/auth/roles.d.ts +10 -0
- package/dist/auth/roles.d.ts.map +1 -0
- package/dist/auth/roles.js +11 -0
- package/dist/auth/useAuth.d.ts +1 -1
- package/dist/auth/useAuth.d.ts.map +1 -1
- package/dist/auth/useAuth.js +1 -1
- package/dist/auth/useIsSuperadmin.d.ts +19 -0
- package/dist/auth/useIsSuperadmin.d.ts.map +1 -0
- package/dist/auth/useIsSuperadmin.js +16 -0
- package/dist/components/instellingen/NotificationSettingsCard.js +3 -3
- package/dist/components/layout/AuthenticatedLayout.d.ts +19 -10
- package/dist/components/layout/AuthenticatedLayout.d.ts.map +1 -1
- package/dist/components/layout/AuthenticatedLayout.js +43 -9
- package/dist/components/layout/BugsDialog.js +10 -10
- package/dist/components/layout/HandoverPage.d.ts +5 -1
- package/dist/components/layout/HandoverPage.d.ts.map +1 -1
- package/dist/components/layout/HandoverPage.js +24 -7
- package/dist/components/layout/Header.js +4 -4
- package/dist/components/layout/InstellingenPage.d.ts +1 -1
- package/dist/components/layout/InstellingenPage.d.ts.map +1 -1
- package/dist/components/layout/InstellingenPage.js +15 -7
- package/dist/components/layout/LoginPage.js +7 -7
- package/dist/components/layout/NotificationBell.js +4 -4
- package/dist/components/layout/ResetWachtwoordPage.d.ts +3 -1
- package/dist/components/layout/ResetWachtwoordPage.d.ts.map +1 -1
- package/dist/components/layout/ResetWachtwoordPage.js +10 -8
- package/dist/components/layout/Sidebar.d.ts +31 -7
- package/dist/components/layout/Sidebar.d.ts.map +1 -1
- package/dist/components/layout/Sidebar.js +33 -11
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.js +2 -2
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/avatar.js +1 -1
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/calendar.d.ts +1 -1
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar.js +2 -2
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/carousel.d.ts +2 -2
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +2 -2
- package/dist/components/ui/chart.d.ts +10 -10
- package/dist/components/ui/chart.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/command.js +2 -2
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/drawer.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/form.js +2 -2
- package/dist/components/ui/hover-card.js +1 -1
- package/dist/components/ui/icon-picker.js +3 -3
- package/dist/components/ui/input-otp.d.ts.map +1 -1
- package/dist/components/ui/input-otp.js +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/pagination.d.ts +1 -1
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js +2 -2
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/progress.js +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/resizable.js +1 -1
- package/dist/components/ui/scroll-area.js +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.d.ts +2 -2
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +8 -8
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/slider.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/toggle-group.js +2 -2
- package/dist/components/ui/toggle.js +1 -1
- package/dist/components/ui/tooltip.js +1 -1
- package/dist/extensions/ShellExtensions.d.ts +14 -1
- package/dist/extensions/ShellExtensions.d.ts.map +1 -1
- package/dist/extensions/ShellExtensions.js +21 -2
- package/dist/hooks/useLogoSrc.d.ts +7 -0
- package/dist/hooks/useLogoSrc.d.ts.map +1 -0
- package/dist/hooks/useLogoSrc.js +29 -0
- package/dist/index.d.ts +53 -44
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -35
- package/dist/permissions/resolve.d.ts +22 -0
- package/dist/permissions/resolve.d.ts.map +1 -0
- package/dist/permissions/resolve.js +76 -0
- package/dist/permissions/store.d.ts +38 -0
- package/dist/permissions/store.d.ts.map +1 -0
- package/dist/permissions/store.js +180 -0
- package/dist/permissions/useModulePermission.d.ts +52 -32
- package/dist/permissions/useModulePermission.d.ts.map +1 -1
- package/dist/permissions/useModulePermission.js +72 -104
- package/dist/routes/index.d.ts +50 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +63 -0
- package/dist/server/handover-handler.d.ts +24 -0
- package/dist/server/handover-handler.d.ts.map +1 -0
- package/dist/server/handover-handler.js +59 -0
- package/dist/server/index.d.ts +4 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -1
- package/dist/server/permissions.server.d.ts +14 -8
- package/dist/server/permissions.server.d.ts.map +1 -1
- package/dist/server/permissions.server.js +46 -9
- package/dist/shell/ShellContext.d.ts +26 -0
- package/dist/shell/ShellContext.d.ts.map +1 -0
- package/dist/shell/ShellContext.js +14 -0
- package/dist/styles.css +127 -0
- package/dist/supabase/auth-middleware.d.ts +16 -16
- package/dist/supabase/auth-middleware.d.ts.map +1 -1
- package/dist/supabase/client.d.ts +16 -16
- package/dist/supabase/client.d.ts.map +1 -1
- package/dist/supabase/client.server.d.ts +16 -16
- package/dist/supabase/client.server.d.ts.map +1 -1
- package/dist/types/module.d.ts +39 -4
- package/dist/types/module.d.ts.map +1 -1
- package/dist/types/module.js +33 -5
- package/package.json +14 -5
- package/dist/auth/handover.functions.d.ts +0 -16
- package/dist/auth/handover.functions.d.ts.map +0 -1
- package/dist/auth/handover.functions.js +0 -23
package/dist/types/module.d.ts
CHANGED
|
@@ -4,11 +4,35 @@ export interface NavItem {
|
|
|
4
4
|
label: string;
|
|
5
5
|
href: string;
|
|
6
6
|
icon: LucideIcon;
|
|
7
|
+
/**
|
|
8
|
+
* Optionele feature-id voor rechten (sinds 1.0.23). Zonder deze waarde leidt
|
|
9
|
+
* core hem af uit `href` via `featureKey()`.
|
|
10
|
+
* Zichtbaarheid, geen beveiliging.
|
|
11
|
+
*/
|
|
12
|
+
featureId?: string;
|
|
7
13
|
children?: Omit<NavItem, "children">[];
|
|
8
14
|
}
|
|
9
15
|
export interface SettingsCard {
|
|
10
16
|
component: ComponentType;
|
|
11
17
|
order: number;
|
|
18
|
+
/**
|
|
19
|
+
* Optioneel (sinds 1.0.23): module waar de kaart rechten van erft. Standaard
|
|
20
|
+
* de module waarin de kaart staat. Zichtbaarheid, geen beveiliging.
|
|
21
|
+
*/
|
|
22
|
+
moduleId?: string;
|
|
23
|
+
/** Optioneel (sinds 1.0.23): feature-id; zonder → moduleniveau. Zichtbaarheid, geen beveiliging. */
|
|
24
|
+
featureId?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Featureregistratie (sinds 1.0.23). Alleen typen; schrijven doet de adminmodule
|
|
28
|
+
* (die `label` naar `name` mapt). Zichtbaarheid, geen beveiliging.
|
|
29
|
+
*/
|
|
30
|
+
export interface FeatureDefinition {
|
|
31
|
+
/** Pad onder het modulesegment, `/`-gescheiden, bijv. `prijsgroepen/nieuw`. */
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
/** Alleen UI-groepering; de database kent geen hiërarchie. */
|
|
35
|
+
parent?: string;
|
|
12
36
|
}
|
|
13
37
|
export interface FlowModule {
|
|
14
38
|
id: string;
|
|
@@ -22,6 +46,8 @@ export interface FlowModule {
|
|
|
22
46
|
* gelijk is aan de registry-slug.
|
|
23
47
|
*/
|
|
24
48
|
registryKey?: string;
|
|
49
|
+
/** Optioneel (sinds 1.0.23). Zonder → afgeleid uit `nav.children` (`moduleFeatures`). */
|
|
50
|
+
features?: FeatureDefinition[];
|
|
25
51
|
}
|
|
26
52
|
/**
|
|
27
53
|
* De externe modulesleutel.
|
|
@@ -32,12 +58,21 @@ export interface FlowModule {
|
|
|
32
58
|
* 3. afsluitende underscores worden gestript.
|
|
33
59
|
*
|
|
34
60
|
* Waarom (3): een afsluitende underscore in een routepad is een TanStack
|
|
35
|
-
* un-nesting-conventie (`/voorraad_/detail`), geen betekenisvol segment.
|
|
36
|
-
* strippen levert dezelfde module twee sleutels op (`voorraad` en `voorraad_`)
|
|
37
|
-
* en verdwijnt hij half uit de zijbalk. Strippen is gekozen boven "registryKey
|
|
38
|
-
* verplicht maken", omdat dat laatste bestaande modules stil zou breken.
|
|
61
|
+
* un-nesting-conventie (`/voorraad_/detail`), geen betekenisvol segment.
|
|
39
62
|
*/
|
|
40
63
|
export declare function moduleKey(mod: FlowModule): string;
|
|
41
64
|
/** Zelfde afleidingsregel, maar voor een los pad (nav-children, URL-pathname). */
|
|
42
65
|
export declare function navKey(href: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Feature-id uit een pad (sinds 1.0.23): alles na het modulesegment,
|
|
68
|
+
* `/`-gescheiden; `index` en `$param`-segmenten vallen weg.
|
|
69
|
+
* `/klanten/prijsgroepen/nieuw` → `prijsgroepen/nieuw`; `/klanten` → `""`.
|
|
70
|
+
* Zichtbaarheid, geen beveiliging.
|
|
71
|
+
*/
|
|
72
|
+
export declare function featureKey(href: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Features van een module (sinds 1.0.23): `features` als opgegeven, anders
|
|
75
|
+
* afgeleid uit `nav.children`. Zichtbaarheid, geen beveiliging.
|
|
76
|
+
*/
|
|
77
|
+
export declare function moduleFeatures(mod: FlowModule): FeatureDefinition[];
|
|
43
78
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/core/types/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,aAAa,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/core/types/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,aAAa,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oGAAoG;IACpG,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAGjD;AAMD,kFAAkF;AAClF,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG3C;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,iBAAiB,EAAE,CAQnE"}
|
package/dist/types/module.js
CHANGED
|
@@ -7,18 +7,46 @@
|
|
|
7
7
|
* 3. afsluitende underscores worden gestript.
|
|
8
8
|
*
|
|
9
9
|
* Waarom (3): een afsluitende underscore in een routepad is een TanStack
|
|
10
|
-
* un-nesting-conventie (`/voorraad_/detail`), geen betekenisvol segment.
|
|
11
|
-
* strippen levert dezelfde module twee sleutels op (`voorraad` en `voorraad_`)
|
|
12
|
-
* en verdwijnt hij half uit de zijbalk. Strippen is gekozen boven "registryKey
|
|
13
|
-
* verplicht maken", omdat dat laatste bestaande modules stil zou breken.
|
|
10
|
+
* un-nesting-conventie (`/voorraad_/detail`), geen betekenisvol segment.
|
|
14
11
|
*/
|
|
15
12
|
export function moduleKey(mod) {
|
|
16
13
|
if (mod.registryKey)
|
|
17
14
|
return mod.registryKey;
|
|
18
15
|
return navKey(mod.nav.href);
|
|
19
16
|
}
|
|
17
|
+
function segments(href) {
|
|
18
|
+
return href.split("?")[0].split("#")[0].split("/").filter(Boolean);
|
|
19
|
+
}
|
|
20
20
|
/** Zelfde afleidingsregel, maar voor een los pad (nav-children, URL-pathname). */
|
|
21
21
|
export function navKey(href) {
|
|
22
|
-
const segment = href
|
|
22
|
+
const segment = segments(href)[0] ?? "";
|
|
23
23
|
return segment.replace(/_+$/, "");
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Feature-id uit een pad (sinds 1.0.23): alles na het modulesegment,
|
|
27
|
+
* `/`-gescheiden; `index` en `$param`-segmenten vallen weg.
|
|
28
|
+
* `/klanten/prijsgroepen/nieuw` → `prijsgroepen/nieuw`; `/klanten` → `""`.
|
|
29
|
+
* Zichtbaarheid, geen beveiliging.
|
|
30
|
+
*/
|
|
31
|
+
export function featureKey(href) {
|
|
32
|
+
return segments(href)
|
|
33
|
+
.slice(1)
|
|
34
|
+
.filter((s) => s !== "index" && !s.startsWith("$"))
|
|
35
|
+
.map((s) => s.replace(/_+$/, ""))
|
|
36
|
+
.join("/");
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Features van een module (sinds 1.0.23): `features` als opgegeven, anders
|
|
40
|
+
* afgeleid uit `nav.children`. Zichtbaarheid, geen beveiliging.
|
|
41
|
+
*/
|
|
42
|
+
export function moduleFeatures(mod) {
|
|
43
|
+
if (mod.features)
|
|
44
|
+
return mod.features;
|
|
45
|
+
const out = [];
|
|
46
|
+
for (const child of mod.nav.children ?? []) {
|
|
47
|
+
const id = child.featureId ?? featureKey(child.href);
|
|
48
|
+
if (id && !out.some((f) => f.id === id))
|
|
49
|
+
out.push({ id, label: child.label });
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowselections/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,12 @@
|
|
|
14
14
|
"./server": {
|
|
15
15
|
"types": "./dist/server/index.d.ts",
|
|
16
16
|
"default": "./dist/server/index.js"
|
|
17
|
-
}
|
|
17
|
+
},
|
|
18
|
+
"./routes": {
|
|
19
|
+
"types": "./dist/routes/index.d.ts",
|
|
20
|
+
"default": "./dist/routes/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./styles.css": "./dist/styles.css"
|
|
18
23
|
},
|
|
19
24
|
"files": [
|
|
20
25
|
"dist"
|
|
@@ -23,9 +28,12 @@
|
|
|
23
28
|
"dev": "vite dev",
|
|
24
29
|
"build": "vite build",
|
|
25
30
|
"build:dev": "vite build --mode development",
|
|
26
|
-
"build:pkg": "tsc -p tsconfig.build.json",
|
|
31
|
+
"build:pkg": "node scripts/clean-dist.mjs && tsc -p tsconfig.build.json && node scripts/copy-styles.mjs && node scripts/check-pkg.mjs && node scripts/check-client-graph.mjs",
|
|
32
|
+
"verify:consumer": "node scripts/verify-consumer.mjs",
|
|
27
33
|
"preview": "vite preview",
|
|
28
|
-
"lint": "eslint ."
|
|
34
|
+
"lint": "eslint .",
|
|
35
|
+
"test": "vitest run",
|
|
36
|
+
"prepublishOnly": "npm run build:pkg"
|
|
29
37
|
},
|
|
30
38
|
"dependencies": {
|
|
31
39
|
"@cloudflare/vite-plugin": "^1.25.5",
|
|
@@ -102,6 +110,7 @@
|
|
|
102
110
|
"globals": "^15.15.0",
|
|
103
111
|
"typescript": "^5.8.3",
|
|
104
112
|
"typescript-eslint": "^8.56.1",
|
|
105
|
-
"vite": "^7.3.1"
|
|
113
|
+
"vite": "^7.3.1",
|
|
114
|
+
"vitest": "^3"
|
|
106
115
|
}
|
|
107
116
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface HandoverExchangeResult {
|
|
2
|
-
accessToken: string;
|
|
3
|
-
refreshToken: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Wisselt een eenmalige handover-code in voor een Supabase-sessie.
|
|
7
|
-
*
|
|
8
|
-
* Fail-closed: bij elke fout gooit deze functie en krijgt de client alleen een
|
|
9
|
-
* generieke foutmelding. De code wordt nooit gelogd.
|
|
10
|
-
*/
|
|
11
|
-
export declare const exchangeHandover: import("@tanstack/start-client-core").RequiredFetcher<undefined, (data: {
|
|
12
|
-
code: string;
|
|
13
|
-
}) => {
|
|
14
|
-
code: string;
|
|
15
|
-
}, Promise<HandoverExchangeResult>>;
|
|
16
|
-
//# sourceMappingURL=handover.functions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handover.functions.d.ts","sourceRoot":"","sources":["../../src/core/auth/handover.functions.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,0EACJ;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;;mCASrC,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createServerFn } from "@tanstack/react-start";
|
|
2
|
-
// Top-level import van het server-only bestand: de Start-compiler haalt de
|
|
3
|
-
// handler-body (en dus deze aanroep) uit de clientbundel. Met een testbuild
|
|
4
|
-
// gecontroleerd: het central-auth-secret en het exchange-pad komen niet in de
|
|
5
|
-
// clientchunks voor.
|
|
6
|
-
import { exchangeHandoverCode } from "../server/provider-token.js";
|
|
7
|
-
/**
|
|
8
|
-
* Wisselt een eenmalige handover-code in voor een Supabase-sessie.
|
|
9
|
-
*
|
|
10
|
-
* Fail-closed: bij elke fout gooit deze functie en krijgt de client alleen een
|
|
11
|
-
* generieke foutmelding. De code wordt nooit gelogd.
|
|
12
|
-
*/
|
|
13
|
-
export const exchangeHandover = createServerFn({ method: "POST" })
|
|
14
|
-
.inputValidator((data) => {
|
|
15
|
-
if (!data || typeof data.code !== "string" || data.code.trim() === "") {
|
|
16
|
-
throw new Error("invalid_request");
|
|
17
|
-
}
|
|
18
|
-
return { code: data.code };
|
|
19
|
-
})
|
|
20
|
-
.handler(async ({ data }) => {
|
|
21
|
-
const session = await exchangeHandoverCode(data.code);
|
|
22
|
-
return { accessToken: session.accessToken, refreshToken: session.refreshToken };
|
|
23
|
-
});
|