@cosmicdrift/kumiko-bundled-features 0.384.0 → 0.386.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.
@@ -1,18 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // Shared Web-Primitives für die Auth-Screens. Nur noch Layout/Style-
3
- // Helpers — Form/Field/Input/Button/Banner kommen jetzt über
4
- // usePrimitives() aus dem Framework-Vertrag, damit Native dieselben
5
- // Auth-Screens rendern kann (renderer-native registriert eigene
6
- // Implementations).
2
+ // Shared web primitives for the auth screens. Only layout/style helpers are
3
+ // left here; Form/Field/Input/Button/Banner come through usePrimitives() from
4
+ // the framework contract, so apps and tests can override the implementations
5
+ // via PrimitivesProvider.
7
6
  //
8
- // <AuthCard> — Card-Wrapper für die Auth-Screen-Layouts
9
- // (full-screen, zentriert, max-w-sm). Web-only;
10
- // eine Native-Variante landet bei Bedarf
11
- // daneben (z.B. SafeArea + ScrollView).
12
- // parseUrlToken — URL-Param-Helper (window.location.search).
7
+ // <AuthCard> — card wrapper for the auth screen layouts
8
+ // (full-screen, centered, max-w-sm). Web-only.
9
+ // parseUrlToken — URL param helper (window.location.search).
13
10
  //
14
- // Link-Styles laufen über das Link-Primitive (variant="button"/"muted") —
15
- // die früheren authButtonClass/authMutedLinkClass sind dorthin gewandert.
11
+ // Link styles go through the Link primitive (variant="button"/"muted"); the
12
+ // former authButtonClass/authMutedLinkClass moved there.
16
13
  import { usePrimitives } from "@cosmicdrift/kumiko-renderer";
17
14
  import { BareFormProvider, cn } from "@cosmicdrift/kumiko-renderer/web";
18
15
  import { createContext, useContext, useEffect, useState } from "react";
@@ -13,7 +13,7 @@ export const unreadCountQuery = defineQueryHandler({
13
13
  },
14
14
  description: "Counts the calling user's unread in-app notification messages; use it for an inbox badge or to check whether a user has pending notifications.",
15
15
  handler: async (query, ctx) => {
16
- // bun-db hat keinen aggregate-helper — selectMany alle matching rows,
16
+ // The query helpers in db/query.ts have no aggregate helper — selectMany alle matching rows,
17
17
  // count() in JS. Pragma: unread-counts sind low-cardinality (user-
18
18
  // scoped, max ~hunderte rows). Wenn das wachsen sollte: raw .unsafe()
19
19
  // mit COUNT(*).
@@ -5,7 +5,7 @@ function quoteTable(tableName) {
5
5
  function bindJsonbParam(value) {
6
6
  // Scalar JSON primitives can't bind directly to ::jsonb — Postgres rejects a
7
7
  // bound boolean/number with "cannot cast type boolean/integer to jsonb" (and
8
- // Bun.SQL infers boolean[] candidates). Route them through ::text::jsonb with
8
+ // the driver may infer array candidates). Route them through ::text::jsonb with
9
9
  // a JSON-encoded literal. Objects/arrays/strings already bind as ::jsonb.
10
10
  if (typeof value === "boolean" || typeof value === "number") {
11
11
  return { sql: "$1::text::jsonb", bound: JSON.stringify(value) };
@@ -119,7 +119,7 @@ export function createFileDerivativesFeature(opts = {}) {
119
119
  // answer identically, no name-oracle. fileRefsTable.id is a UUID
120
120
  // column — a malformed id must fail here, not at the DB. Without
121
121
  // this, an anonymous, internet-facing caller can throw a Postgres
122
- // 22P02 on every request (Bun.SQL pools the failed connection), a
122
+ // 22P02 on every request (the pooled connection is affected), a
123
123
  // DoS primitive with no auth required.
124
124
  if (!fileRefId || !variant || !VARIANT_NAME_RE.test(variant) || !isUuid(fileRefId)) {
125
125
  return c.text("not found", 404);
@@ -1,7 +1,7 @@
1
1
  // Client-safe ledger surface: QN constants, the pure recurring helpers
2
2
  // (projection + Soll/Ist merge), and the Zod payload schemas (for client-side
3
3
  // pre-validation before dispatch) — nothing else. The full `../ledger` entry
4
- // re-exports the feature/handlers/executor, which pull bun-db/postgres — a
4
+ // re-exports the feature/handlers/executor, which pull postgres-js — a
5
5
  // browser bundle that imports from there fails on Node builtins. A client screen
6
6
  // (e.g. a rent-cashflow view) imports the dispatch QNs + the pure forecast/merge
7
7
  // from HERE, then dispatches via the renderer's useDispatcher.
@@ -51,7 +51,7 @@ export function createAddNoteHandler(access = DEFAULT_NOTES_HISTORY_ACCESS, entr
51
51
  let authorName = null;
52
52
  try {
53
53
  // read_users is tenant-agnostic → ctx.db.unsafeRaw, not the tenant-scoped ctx.db.
54
- // Bun.SQL poisons the whole tx after any error inside it, even one that's
54
+ // postgres-js poisons the whole tx after any error inside it, even one that's
55
55
  // caught — so the lookup runs in a savepoint where available, otherwise directly
56
56
  // (pool statements are their own units).
57
57
  authorName = await runInSavepointIfSupported(ctx.db.unsafeRaw(), async (sp) => {
@@ -1,4 +1,5 @@
1
1
  import type { PatScopeConfig } from "./web/scopes.ts";
2
+ export declare const patScopeOptionKey: (domain: string, level: "read" | "write") => string;
2
3
  type LocalizedString = {
3
4
  readonly en: string;
4
5
  };
@@ -3,6 +3,8 @@ import { fieldLabelKey, fieldOptionLabelKey } from "@cosmicdrift/kumiko-renderer
3
3
  import { PAT_FEATURE } from "./web/constants.js";
4
4
  const mintFieldKey = (field) => fieldLabelKey(PAT_FEATURE, ACTION_FORM_ENTITY, field);
5
5
  const scopeOptionKey = (grant) => fieldOptionLabelKey(PAT_FEATURE, ACTION_FORM_ENTITY, "scopes", grant);
6
+ // The generated scope labels are English only; apps translate them under this key.
7
+ export const patScopeOptionKey = (domain, level) => scopeOptionKey(`${domain}:${level}`);
6
8
  export const PAT_FEATURE_I18N = {
7
9
  "screen:api-tokens.title": { en: "Personal Access Tokens" },
8
10
  "screen:api-token-create.title": { en: "Create a new token" },
@@ -4,6 +4,7 @@ export type { BindPatAutoRevokeOnPasswordChange, PersonalAccessTokensOptions } f
4
4
  export { bindPatAutoRevokeOnPasswordChangeFromFeature, createPersonalAccessTokensFeature, } from "./feature.ts";
5
5
  export type { CreatePatOptions, PatMfaVerifyResult } from "./handlers/create.write.ts";
6
6
  export { hashPatToken, mintPatToken } from "./hash.ts";
7
+ export { patScopeOptionKey } from "./i18n.ts";
7
8
  export { PAT_REVOKED_AGGREGATE_TYPE, PAT_REVOKED_EVENT_QN, PAT_REVOKED_EVENT_SHORT, type PatRevokedPayload, patRevokedSchema, } from "./pat-revoked-event.ts";
8
9
  export { createPatResolver } from "./resolver.ts";
9
10
  export { revokeAllPatTokensForUser } from "./revoke-for-user.ts";
@@ -1,6 +1,7 @@
1
1
  import { PAT_DEFAULT_RATE_LIMIT } from "./web/constants.js";
2
2
  export { bindPatAutoRevokeOnPasswordChangeFromFeature, createPersonalAccessTokensFeature, } from "./feature.js";
3
3
  export { hashPatToken, mintPatToken } from "./hash.js";
4
+ export { patScopeOptionKey } from "./i18n.js";
4
5
  export { PAT_REVOKED_AGGREGATE_TYPE, PAT_REVOKED_EVENT_QN, PAT_REVOKED_EVENT_SHORT, patRevokedSchema, } from "./pat-revoked-event.js";
5
6
  export { createPatResolver } from "./resolver.js";
6
7
  export { revokeAllPatTokensForUser } from "./revoke-for-user.js";
@@ -1,5 +1,5 @@
1
1
  // Per-unit sub-transaction (one user, one purged row), nesting-aware across both db shapes:
2
- // - top-level connection (Bun.SQL / postgres-js Sql) → `.begin` (BEGIN)
2
+ // - top-level connection (postgres-js Sql) → `.begin` (BEGIN)
3
3
  // - TransactionSql (inside the dispatcher's outer tx, where every
4
4
  // writeHandler already runs) → `.savepoint` (SAVEPOINT)
5
5
  // A TransactionSql has no `.begin`, so the previous unconditional `.begin`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-bundled-features",
3
- "version": "0.384.0",
3
+ "version": "0.386.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>",
@@ -544,9 +544,9 @@
544
544
  }
545
545
  },
546
546
  "dependencies": {
547
- "@cosmicdrift/kumiko-framework": "0.384.0",
548
- "@cosmicdrift/kumiko-renderer": "0.384.0",
549
- "@cosmicdrift/kumiko-types": "0.384.0",
547
+ "@cosmicdrift/kumiko-framework": "0.386.0",
548
+ "@cosmicdrift/kumiko-renderer": "0.386.0",
549
+ "@cosmicdrift/kumiko-types": "0.386.0",
550
550
  "@mollie/api-client": "^4.5.0",
551
551
  "@node-rs/argon2": "^2.0.2",
552
552
  "@tiptap/core": "3.31.3",
@@ -1116,15 +1116,15 @@
1116
1116
  ],
1117
1117
  "devDependencies": {
1118
1118
  "@testing-library/user-event": "^14.6.1",
1119
- "@cosmicdrift/kumiko-locale-de": "0.384.0",
1120
- "@cosmicdrift/kumiko-locale-es": "0.384.0",
1121
- "@cosmicdrift/kumiko-renderer-mail-html": "0.384.0",
1119
+ "@cosmicdrift/kumiko-locale-de": "0.386.0",
1120
+ "@cosmicdrift/kumiko-locale-es": "0.386.0",
1121
+ "@cosmicdrift/kumiko-renderer-mail-html": "0.386.0",
1122
1122
  "jsqr": "^1.4.0",
1123
1123
  "unpdf": "^1.8.1",
1124
- "@cosmicdrift/kumiko-testing": "0.384.0"
1124
+ "@cosmicdrift/kumiko-testing": "0.386.0"
1125
1125
  },
1126
1126
  "peerDependencies": {
1127
- "@cosmicdrift/kumiko-testing": "0.384.0"
1127
+ "@cosmicdrift/kumiko-testing": "0.386.0"
1128
1128
  },
1129
1129
  "peerDependenciesMeta": {
1130
1130
  "@cosmicdrift/kumiko-testing": {
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.385.0",
4
+ "type": "improvement",
5
+ "title": "Denser common-password list, comments name postgres-js as the only driver",
6
+ "detail": "The common-password list is wrapped densely and split on whitespace; a test pins its 2086 entries. Comments across the bundled features that referred to the removed Bun.SQL driver now name postgres-js. No behavior change."
7
+ },
2
8
  {
3
9
  "version": "0.384.0",
4
10
  "type": "improvement",
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "version": "0.385.0",
4
+ "type": "improvement",
5
+ "title": "patScopeOptionKey for translating token scope labels",
6
+ "detail": "The scope labels personal-access-tokens generates from `scopes[domain].label` are English only. `patScopeOptionKey(domain, \"read\" | \"write\")` returns their translation key, so an app feature can add the other locales with `r.translations`.",
7
+ "migration": "Apps that mount personal-access-tokens and set `requiredLocales` with a locale other than `en` translate each generated scope label (`read`, plus `write` where the domain offers it) under `patScopeOptionKey`."
8
+ },
2
9
  {
3
10
  "version": "0.372.0",
4
11
  "type": "fix",