@cosmicdrift/kumiko-samples 0.379.0 → 0.381.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-samples",
3
- "version": "0.379.0",
3
+ "version": "0.381.0",
4
4
  "description": "Source trees of the Kumiko sample recipes, sample apps and bundled features in repo layout, for tooling such as few-shot corpus builds.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-bundled-features",
3
- "version": "0.379.0",
3
+ "version": "0.381.0",
4
4
  "description": "Built-in features — tenant, user, auth, delivery. The stuff you'd rewrite anyway, already typed.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -6,9 +6,9 @@ import {
6
6
  integer,
7
7
  table as pgTable,
8
8
  requireEntityTableMeta,
9
- type SchemaTable,
10
9
  sql,
11
10
  text,
11
+ type WritableSchemaTable,
12
12
  } from "@cosmicdrift/kumiko-framework/db";
13
13
  import type { TenancyBrand } from "@cosmicdrift/kumiko-types/tenancy-brand";
14
14
 
@@ -20,18 +20,19 @@ import type { TenancyBrand } from "@cosmicdrift/kumiko-types/tenancy-brand";
20
20
  // name IS the identity here. No tenantId: this is a global override that
21
21
  // applies across every tenant (per-tenant toggles are intentionally out of
22
22
  // scope, see core-feature-toggles.md).
23
- export const globalFeatureStateTable: SchemaTable & TenancyBrand<"global"> = declareGlobalTenancy(
24
- pgTable("store_global_feature_state", {
25
- featureName: text("feature_name").primaryKey(),
26
- enabled: boolean("enabled").notNull(),
27
- // Optimistic-lock column: the set-handler updates `WHERE feature_name = ? AND
28
- // version = ?`; a 0-row update means a concurrent write, so it retries the fetch.
29
- version: integer("version").notNull().default(1),
30
- updatedAt: instant("updated_at").default(sql`now()`).notNull(),
31
- // UserId (text — SessionUser.id is a uuid string post-ES).
32
- updatedBy: text("updated_by"),
33
- }),
34
- );
23
+ export const globalFeatureStateTable: WritableSchemaTable & TenancyBrand<"global"> =
24
+ declareGlobalTenancy(
25
+ pgTable("store_global_feature_state", {
26
+ featureName: text("feature_name").primaryKey(),
27
+ enabled: boolean("enabled").notNull(),
28
+ // Optimistic-lock column: the set-handler updates `WHERE feature_name = ? AND
29
+ // version = ?`; a 0-row update means a concurrent write, so it retries the fetch.
30
+ version: integer("version").notNull().default(1),
31
+ updatedAt: instant("updated_at").default(sql`now()`).notNull(),
32
+ // UserId (text — SessionUser.id is a uuid string post-ES).
33
+ updatedBy: text("updated_by"),
34
+ }),
35
+ );
35
36
 
36
37
  // r.storeTable meta — without this, collectTableMetas(FEATURES) never
37
38
  // sees the table, so `kumiko schema generate` reports no changes and no
@@ -6,6 +6,7 @@ import {
6
6
  table as pgTable,
7
7
  serial,
8
8
  text,
9
+ type WritableTable,
9
10
  } from "@cosmicdrift/kumiko-framework/db";
10
11
  import {
11
12
  createEntity,
@@ -67,11 +68,11 @@ export const jobRunEntity = createEntity({
67
68
  indexes: [{ columns: ["startedAt"] }],
68
69
  });
69
70
 
70
- // Plain EntityTableMeta, NOT a branded EntityTable (buildEntityTable would
71
- // mark it executor-only): job-run is an unmanaged direct-write store, so
71
+ // Unmanaged meta, NOT buildEntityTable (its table is not Writable and only the
72
+ // executor may write it): job-run is an unmanaged direct-write store, so
72
73
  // onJobStart/-Complete/-Failed need to write via ctx.db/insertOne directly
73
74
  // (same pattern as sessions/schema/user-session.ts).
74
- export const jobRunsTable: EntityTableMeta = deriveEntityTableMeta("job-run", jobRunEntity, {
75
+ export const jobRunsTable: WritableTable = deriveEntityTableMeta("job-run", jobRunEntity, {
75
76
  source: "unmanaged",
76
77
  });
77
78
  export const jobRunsTableMeta = jobRunsTable;
@@ -86,8 +86,8 @@ export const apiTokenEntity = createEntity({
86
86
  });
87
87
 
88
88
  // deriveEntityTableMeta (not buildEntityTable): this is a direct-write store, so
89
- // the table must be a WritableTable (post ES-write-brand #742) — same as
90
- // sessions' userSessionTable. buildEntityTable is branded executor-only.
89
+ // the table must be Writable, which only source: "unmanaged" yields — same as
90
+ // sessions' userSessionTable.
91
91
  export const apiTokenTable = deriveEntityTableMeta(API_TOKEN_ENTITY_NAME, apiTokenEntity, {
92
92
  source: "unmanaged",
93
93
  });
@@ -81,10 +81,9 @@ export const userSessionEntity = createEntity({
81
81
  indexes: [{ columns: ["tenantId", "lastSeenAt"] }],
82
82
  });
83
83
 
84
- // Plain EntityTableMeta, NOT a branded EntityTable: user-session is an
85
- // unmanaged direct-write store (r.storeTable in feature.ts, no event stream —
84
+ // Unmanaged direct-write store (r.storeTable in feature.ts, no event stream —
86
85
  // revocation is a column write, not an aggregate). Handlers write via ctx.db;
87
- // the meta carries no executor-only brand so those writes stay legal. See
86
+ // source: "unmanaged" makes the meta Writable so those writes compile. See
88
87
  // feature.ts for the rebuild-exclusion rationale (#494/#498).
89
88
  export const userSessionTable = deriveEntityTableMeta(USER_SESSION_ENTITY_NAME, userSessionEntity, {
90
89
  source: "unmanaged",