@cosmicdrift/kumiko-dev-server 0.1.0 → 0.2.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/LICENSE ADDED
@@ -0,0 +1,57 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: Marc Frost
6
+
7
+ Licensed Work: @cosmicdrift/kumiko-framework
8
+ The Licensed Work is © 2026 Marc Frost.
9
+
10
+ Additional Use Grant:
11
+ You may use the Licensed Work in production for any purpose, including
12
+ commercially, EXCEPT for the Restricted Use.
13
+
14
+ "Restricted Use" is defined as using the Licensed Work to provide a platform
15
+ or service to third parties that allows them to host, deploy, or run their
16
+ own applications built with the Licensed Work. This includes, but is not
17
+ limited to: managed hosting services, software-as-a-service (SaaS) platforms,
18
+ platform-as-a-service (PaaS), developer platforms, or any multi-tenant
19
+ managed offering of the Licensed Work.
20
+
21
+ This restriction does not apply to the Licensor, any entity controlled by,
22
+ controlling, or under common control with the Licensor ("Affiliates"), or
23
+ contractors acting on their behalf. The Licensor remains free to use the
24
+ Licensed Work for any purpose, including for the operation of kumiko.so.
25
+
26
+ Change Date: 2030-05-05
27
+ Change License: Apache License, Version 2.0
28
+
29
+
30
+ Terms
31
+
32
+ The Licensor hereby grants you the right to copy, modify, create derivative works,
33
+ redistribute, and make non-production use of the Licensed Work. The Licensor may
34
+ make an Additional Use Grant, above, permitting limited production use.
35
+
36
+ Effective on the Change Date, or the fourth anniversary of the first publicly
37
+ available distribution of the Licensed Work under this License, whichever comes
38
+ first, this License will convert to the Change License.
39
+
40
+ This Business Source License governs use of the Licensed Work in all cases, except
41
+ as to any use that is explicitly granted in the Additional Use Grant above or
42
+ under the Change License after the Change Date.
43
+
44
+ If your use of the Licensed Work does not comply with the requirements of this
45
+ License, you must cease use of the Licensed Work immediately.
46
+
47
+ All copies of the Licensed Work, and all derivative works thereof, must include
48
+ this License.
49
+
50
+ This License does not grant you any right, title, or interest in any trademark,
51
+ logo, or branding of the Licensor, except as required to comply with this License.
52
+
53
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN
54
+ “AS IS” BASIS. LICENSOR DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
55
+ WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
56
+ TITLE, AND NON-INFRINGEMENT. IN NO EVENT WILL LICENSOR BE LIABLE FOR ANY DAMAGES
57
+ ARISING OUT OF OR RELATED TO THIS LICENSE OR THE USE OF THE LICENSED WORK.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-dev-server",
3
- "version": "0.1.0",
3
+ "version": "0.2.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>",
@@ -36,11 +36,11 @@ import { seedTenantMembership } from "@cosmicdrift/kumiko-bundled-features/tenan
36
36
  import { UserHandlers, userEntity, userTable } from "@cosmicdrift/kumiko-bundled-features/user";
37
37
  import type { TenantId } from "@cosmicdrift/kumiko-framework/engine";
38
38
  import {
39
- createEntityTable,
40
- pushTables,
41
39
  setupTestStack,
42
40
  type TestStack,
43
41
  TestUsers,
42
+ unsafeCreateEntityTable,
43
+ unsafePushTables,
44
44
  } from "@cosmicdrift/kumiko-framework/stack";
45
45
  import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
46
46
  import { composeFeatures } from "../compose-features";
@@ -110,9 +110,9 @@ async function bootStack(
110
110
  },
111
111
  });
112
112
 
113
- await createEntityTable(stack.db, userEntity);
114
- await createEntityTable(stack.db, tenantEntity);
115
- await pushTables(stack.db, { configValuesTable, tenantMembershipsTable });
113
+ await unsafeCreateEntityTable(stack.db, userEntity);
114
+ await unsafeCreateEntityTable(stack.db, tenantEntity);
115
+ await unsafePushTables(stack.db, { configValuesTable, tenantMembershipsTable });
116
116
 
117
117
  return { stack, resetEmails, verifyEmails };
118
118
  }
@@ -27,7 +27,7 @@ import {
27
27
  createEventConsumerStateTable,
28
28
  createProjectionStateTable,
29
29
  } from "@cosmicdrift/kumiko-framework/pipeline";
30
- import { ensureEntityTable } from "@cosmicdrift/kumiko-framework/stack";
30
+ import { unsafeEnsureEntityTable } from "@cosmicdrift/kumiko-framework/stack";
31
31
  import { sql } from "drizzle-orm";
32
32
  import postgres from "postgres";
33
33
  import { afterEach, beforeAll, describe, expect, test } from "vitest";
@@ -116,7 +116,7 @@ async function migrateTestDb(): Promise<void> {
116
116
  await createArchivedStreamsTable(db);
117
117
  await createProjectionStateTable(db);
118
118
  await createEventConsumerStateTable(db);
119
- await ensureEntityTable(db, widgetEntity, "widget");
119
+ await unsafeEnsureEntityTable(db, widgetEntity, "widget");
120
120
  } finally {
121
121
  await close();
122
122
  }
@@ -167,7 +167,7 @@ describe("runProdApp", () => {
167
167
  test("second boot against the same DB is idempotent — no crash, no duplicate tables", async () => {
168
168
  await boot();
169
169
  // First boot left tables in place. Restart on the same DB —
170
- // ensureEntityTable should be a no-op for the existing rows.
170
+ // unsafeEnsureEntityTable should be a no-op for the existing rows.
171
171
  const second = await boot();
172
172
 
173
173
  const res = await second.entrypoint.app.fetch(new Request("http://test/health"));
@@ -23,7 +23,7 @@ import { type AuthRoutesConfig, generateToken } from "@cosmicdrift/kumiko-framew
23
23
  import { buildAppSchema, type FeatureDefinition } from "@cosmicdrift/kumiko-framework/engine";
24
24
  import { createEventsTable } from "@cosmicdrift/kumiko-framework/event-store";
25
25
  import {
26
- ensureEntityTable,
26
+ pushEntityProjectionTables,
27
27
  setupTestStack,
28
28
  type TestStack,
29
29
  type TestStackOptions,
@@ -171,7 +171,7 @@ export type CreateKumikoServerOptions = {
171
171
  * Header/Cookie/Default; siehe AnonymousAccessConfig. */
172
172
  readonly anonymousAccess?: TestStackOptions["anonymousAccess"];
173
173
  /** Wird nach dem Aufsetzen der Entity-Tabellen aufgerufen. Hook für
174
- * non-entity-tables (pushTables) und Seeding (admin user, initial
174
+ * non-entity-tables (unsafePushTables) und Seeding (admin user, initial
175
175
  * tenant, …). Muss idempotent sein — im persistent-DB-Modus läuft
176
176
  * es bei jedem Boot. */
177
177
  readonly onAfterSetup?: (stack: TestStack) => Promise<void>;
@@ -526,26 +526,6 @@ async function startTailwindWatcher(
526
526
  };
527
527
  }
528
528
 
529
- // Create all entity tables declared by the given features. Uses
530
- // ensureEntityTable so a persistent DB (KUMIKO_DEV_DB_NAME) can
531
- // reuse tables from the previous boot without the caller having to
532
- // check.
533
- async function createEntityTablesForFeatures(
534
- stack: TestStack,
535
- features: readonly FeatureDefinition[],
536
- ): Promise<void> {
537
- for (const feature of features) {
538
- for (const [entityName, entity] of Object.entries(feature.entities)) {
539
- const created = await ensureEntityTable(stack.db, entity, entityName);
540
- if (!created) {
541
- logInfo(
542
- `[kumiko-server] table ${entity.table ?? entityName} already exists — skipping create`,
543
- );
544
- }
545
- }
546
- }
547
- }
548
-
549
529
  /** @internal — normalisierte Client-Entry-Form, einheitlich über
550
530
  * Single-Mode (`clientEntry`) und Multi-Mode (`clientEntries`). */
551
531
  type NormalizedEntry = {
@@ -663,7 +643,7 @@ export async function createKumikoServer(
663
643
  ...(options.anonymousAccess !== undefined && { anonymousAccess: options.anonymousAccess }),
664
644
  });
665
645
  await createEventsTable(stack.db);
666
- await createEntityTablesForFeatures(stack, options.features);
646
+ await pushEntityProjectionTables(stack, stack.registry);
667
647
 
668
648
  // Hook für Caller-spezifische Tables + Seed. Läuft nach den Entity-
669
649
  // Tabellen damit das Sample auf `stack.db` / `stack.dispatcher`