@cosmicdrift/kumiko-dev-server 0.125.1 → 0.126.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-dev-server",
3
- "version": "0.125.1",
3
+ "version": "0.126.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>",
@@ -50,8 +50,8 @@
50
50
  "kumiko-schema-check": "./bin/kumiko-schema-check.ts"
51
51
  },
52
52
  "dependencies": {
53
- "@cosmicdrift/kumiko-bundled-features": "0.125.1",
54
- "@cosmicdrift/kumiko-framework": "0.125.1",
53
+ "@cosmicdrift/kumiko-bundled-features": "0.126.0",
54
+ "@cosmicdrift/kumiko-framework": "0.126.0",
55
55
  "ts-morph": "^28.0.0"
56
56
  },
57
57
  "publishConfig": {
@@ -35,6 +35,10 @@ import {
35
35
  type SessionCallbacks,
36
36
  } from "@cosmicdrift/kumiko-bundled-features/sessions";
37
37
  import { TenantQueries } from "@cosmicdrift/kumiko-bundled-features/tenant";
38
+ import {
39
+ resolveTenantLifecycleGate,
40
+ TENANT_LIFECYCLE_FEATURE,
41
+ } from "@cosmicdrift/kumiko-bundled-features/tenant-lifecycle";
38
42
  import type { PatResolver, SessionMetadata } from "@cosmicdrift/kumiko-framework/api";
39
43
  import { createInMemoryLoginRateLimiter } from "@cosmicdrift/kumiko-framework/api";
40
44
  import {
@@ -42,6 +46,7 @@ import {
42
46
  configurePiiSubjectKms,
43
47
  type KmsAdapter,
44
48
  } from "@cosmicdrift/kumiko-framework/crypto";
49
+ import type { DbConnection } from "@cosmicdrift/kumiko-framework/db";
45
50
  import { configureEntityFieldEncryption } from "@cosmicdrift/kumiko-framework/db";
46
51
  import {
47
52
  collectWriteHandlerQns,
@@ -396,7 +401,9 @@ export async function runDevApp(options: RunDevAppOptions): Promise<KumikoServer
396
401
  // db (only concrete after setupTestStack). Wired when the feature is mounted;
397
402
  // scopes come from the feature's exports (single source with its handlers).
398
403
  let patResolver: PatResolver | undefined;
404
+ let lifecycleDb: DbConnection | undefined;
399
405
  const patFeature = features.find((f) => f.name === PAT_FEATURE);
406
+ const tenantLifecycleFeature = features.find((f) => f.name === TENANT_LIFECYCLE_FEATURE);
400
407
  const patAuthFragment = patFeature
401
408
  ? {
402
409
  patResolver: (rawToken: string) => {
@@ -412,6 +419,18 @@ export async function runDevApp(options: RunDevAppOptions): Promise<KumikoServer
412
419
  }
413
420
  : {};
414
421
 
422
+ const tenantLifecycleAuthFragment = tenantLifecycleFeature
423
+ ? {
424
+ resolveTenantLifecycleStatus: async (tenantId: string) => {
425
+ if (!lifecycleDb) {
426
+ throw new Error("[runDevApp] tenant-lifecycle gate accessed before onAfterSetup");
427
+ }
428
+ const gate = await resolveTenantLifecycleGate(lifecycleDb, tenantId);
429
+ return gate ? { status: gate.status } : null;
430
+ },
431
+ }
432
+ : {};
433
+
415
434
  const sessionAuthFragment =
416
435
  effectiveAuth?.sessions !== undefined
417
436
  ? {
@@ -466,6 +485,7 @@ export async function runDevApp(options: RunDevAppOptions): Promise<KumikoServer
466
485
  }),
467
486
  ...sessionAuthFragment,
468
487
  ...patAuthFragment,
488
+ ...tenantLifecycleAuthFragment,
469
489
  ...(effectiveAuth.passwordReset && {
470
490
  passwordReset: {
471
491
  requestHandler: AuthHandlers.requestPasswordReset,
@@ -494,6 +514,7 @@ export async function runDevApp(options: RunDevAppOptions): Promise<KumikoServer
494
514
  },
495
515
  }),
496
516
  onAfterSetup: async (stack) => {
517
+ lifecycleDb = stack.db;
497
518
  // Sprint-8a: build tier-resolver BEFORE any seeds so seeds can rely
498
519
  // on the resolver being live (e.g. seed that writes a SystemAdmin's
499
520
  // tier-assignment can immediately read tier-cuts).
@@ -66,6 +66,10 @@ import {
66
66
  SESSIONS_FEATURE,
67
67
  } from "@cosmicdrift/kumiko-bundled-features/sessions";
68
68
  import { TenantQueries } from "@cosmicdrift/kumiko-bundled-features/tenant";
69
+ import {
70
+ resolveTenantLifecycleGate,
71
+ TENANT_LIFECYCLE_FEATURE,
72
+ } from "@cosmicdrift/kumiko-bundled-features/tenant-lifecycle";
69
73
  import { createTextContentApi } from "@cosmicdrift/kumiko-bundled-features/text-content";
70
74
  import { UserQueries } from "@cosmicdrift/kumiko-bundled-features/user";
71
75
  import {
@@ -1036,6 +1040,16 @@ export async function runProdApp(options: RunProdAppOptions): Promise<ProdAppHan
1036
1040
  };
1037
1041
  }
1038
1042
 
1043
+ const tenantLifecycleFeature = features.find((f) => f.name === TENANT_LIFECYCLE_FEATURE);
1044
+ const tenantLifecycleAuthFragment = tenantLifecycleFeature
1045
+ ? {
1046
+ resolveTenantLifecycleStatus: async (tenantId: string) => {
1047
+ const gate = await resolveTenantLifecycleGate(db, tenantId);
1048
+ return gate ? { status: gate.status } : null;
1049
+ },
1050
+ }
1051
+ : undefined;
1052
+
1039
1053
  const baseEntrypointOptions = {
1040
1054
  registry,
1041
1055
  context: {
@@ -1074,6 +1088,7 @@ export async function runProdApp(options: RunProdAppOptions): Promise<ProdAppHan
1074
1088
  }),
1075
1089
  ...sessionAuthFragment,
1076
1090
  ...patAuthFragment,
1091
+ ...tenantLifecycleAuthFragment,
1077
1092
  ...(effectiveAuth.passwordReset && {
1078
1093
  passwordReset: {
1079
1094
  requestHandler: AuthHandlers.requestPasswordReset,