@cosmicdrift/kumiko-dev-server 0.38.0 → 0.39.0
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/package.json +3 -3
- package/src/run-dev-app.ts +6 -0
- package/src/run-prod-app.ts +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-dev-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "Development server bootstrap for Kumiko apps. Bundles the client, mints dev-JWTs, injects the resolved AppSchema, and seeds an admin. Not for production.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"kumiko-schema-check": "./bin/kumiko-schema-check.ts"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
50
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
49
|
+
"@cosmicdrift/kumiko-bundled-features": "0.38.0",
|
|
50
|
+
"@cosmicdrift/kumiko-framework": "0.38.0",
|
|
51
51
|
"ts-morph": "^28.0.0"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
package/src/run-dev-app.ts
CHANGED
|
@@ -90,6 +90,9 @@ export type RunDevAppAuthOptions = {
|
|
|
90
90
|
readonly signup?: SignupSetup;
|
|
91
91
|
/** Tenant-Invite flow (Magic-Link). Symmetric. */
|
|
92
92
|
readonly invite?: InviteSetup;
|
|
93
|
+
/** Domain attribute for both auth cookies (see
|
|
94
|
+
* AuthRoutesConfig.cookieDomain). Symmetric zu RunProdAppAuthOptions. */
|
|
95
|
+
readonly cookieDomain?: string;
|
|
93
96
|
};
|
|
94
97
|
|
|
95
98
|
/** Hook for app-specific seeding (demo data, fixtures). Runs after the
|
|
@@ -268,6 +271,9 @@ export async function runDevApp(options: RunDevAppOptions): Promise<KumikoServer
|
|
|
268
271
|
[AuthErrors.invalidCredentials]: 401,
|
|
269
272
|
[AuthErrors.noMembership]: 403,
|
|
270
273
|
},
|
|
274
|
+
...(options.auth.cookieDomain !== undefined && {
|
|
275
|
+
cookieDomain: options.auth.cookieDomain,
|
|
276
|
+
}),
|
|
271
277
|
...sessionAuthFragment,
|
|
272
278
|
...(options.auth.passwordReset && {
|
|
273
279
|
passwordReset: {
|
package/src/run-prod-app.ts
CHANGED
|
@@ -276,6 +276,10 @@ export type RunProdAppAuthOptions = {
|
|
|
276
276
|
* /api/auth/invite-accept-with-login, /api/auth/invite-signup-complete
|
|
277
277
|
* are mounted. */
|
|
278
278
|
readonly invite?: InviteSetup;
|
|
279
|
+
/** Domain attribute for both auth cookies (see
|
|
280
|
+
* AuthRoutesConfig.cookieDomain). Set to the registrable parent
|
|
281
|
+
* domain when login and app live on different subdomains. */
|
|
282
|
+
readonly cookieDomain?: string;
|
|
279
283
|
};
|
|
280
284
|
|
|
281
285
|
/** Hook for app-specific seeding — runs after the admin (when auth is
|
|
@@ -334,6 +338,10 @@ export type HostDispatchResult =
|
|
|
334
338
|
export type HostDispatchFn = (req: {
|
|
335
339
|
readonly host: string;
|
|
336
340
|
readonly path: string;
|
|
341
|
+
/** Query-String inkl. führendem `?`, `""` wenn keiner. Redirects die
|
|
342
|
+
* den Pfad auf einen anderen Host umbiegen (z.B. Auth-Routen mit
|
|
343
|
+
* `?token=` aus alten Mail-Links) MÜSSEN ihn an `to` anhängen. */
|
|
344
|
+
readonly search: string;
|
|
337
345
|
}) => HostDispatchResult;
|
|
338
346
|
|
|
339
347
|
export type RunProdAppOptions = {
|
|
@@ -714,6 +722,9 @@ export async function runProdApp(options: RunProdAppOptions): Promise<ProdAppHan
|
|
|
714
722
|
[AuthErrors.invalidCredentials]: 401,
|
|
715
723
|
[AuthErrors.noMembership]: 403,
|
|
716
724
|
},
|
|
725
|
+
...(options.auth.cookieDomain !== undefined && {
|
|
726
|
+
cookieDomain: options.auth.cookieDomain,
|
|
727
|
+
}),
|
|
717
728
|
...sessionAuthFragment,
|
|
718
729
|
...(options.auth.passwordReset && {
|
|
719
730
|
passwordReset: {
|
|
@@ -1027,7 +1038,7 @@ function buildStaticFallback(
|
|
|
1027
1038
|
if (!hostDispatch) return null;
|
|
1028
1039
|
const url = new URL(req.url);
|
|
1029
1040
|
const host = req.headers.get("host") ?? url.host;
|
|
1030
|
-
const result = hostDispatch({ host, path: url.pathname });
|
|
1041
|
+
const result = hostDispatch({ host, path: url.pathname, search: url.search });
|
|
1031
1042
|
if (result.kind === "not-found") {
|
|
1032
1043
|
return new Response("Not Found", { status: 404 });
|
|
1033
1044
|
}
|