@cosmicdrift/kumiko-framework 0.208.2 → 0.208.3
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-framework",
|
|
3
|
-
"version": "0.208.
|
|
3
|
+
"version": "0.208.3",
|
|
4
4
|
"description": "Framework core — engine, pipeline, API, DB, and every other bit that makes Kumiko go.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
"./package.json": "./package.json"
|
|
191
191
|
},
|
|
192
192
|
"dependencies": {
|
|
193
|
-
"@cosmicdrift/kumiko-types": "0.208.
|
|
193
|
+
"@cosmicdrift/kumiko-types": "0.208.3",
|
|
194
194
|
"bullmq": "^5.76.7",
|
|
195
195
|
"bun-types": "^1.3.13",
|
|
196
196
|
"hono": "^4.13.1",
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
"zod": "^4.4.3"
|
|
207
207
|
},
|
|
208
208
|
"devDependencies": {
|
|
209
|
-
"@cosmicdrift/kumiko-dispatcher-live": "0.208.
|
|
209
|
+
"@cosmicdrift/kumiko-dispatcher-live": "0.208.3",
|
|
210
210
|
"bun-types": "^1.3.13",
|
|
211
211
|
"pino-pretty": "^13.1.3"
|
|
212
212
|
},
|
|
@@ -137,6 +137,34 @@ describe("buildConfigFeatureSchema — structure", () => {
|
|
|
137
137
|
]);
|
|
138
138
|
});
|
|
139
139
|
|
|
140
|
+
test("screen layout renders full-width", () => {
|
|
141
|
+
expect(configScreen("billing-tenant").layout.width).toBe("full");
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test("section has no description when the feature never declares the '<feature>.settings.description' key", () => {
|
|
145
|
+
// billing declares no translations at all — the section must NOT carry a
|
|
146
|
+
// description prop (not just undefined), else the renderer would try to
|
|
147
|
+
// subtitle-render translate()'s undeclared-key fallback (the raw key).
|
|
148
|
+
const section = configScreen("billing-tenant").layout.sections[0];
|
|
149
|
+
expect(section && "description" in section).toBe(false);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test("section carries description when the feature declares '<feature>.settings.description'", () => {
|
|
153
|
+
const described = defineFeature("described", (r) => {
|
|
154
|
+
r.translations({ keys: { "described.settings.description": { en: "Manage settings." } } });
|
|
155
|
+
r.config({
|
|
156
|
+
keys: { flag: createTenantConfig("boolean", { mask: { title: "described.flag" } }) },
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
const out = buildConfigFeatureSchema(createRegistry([described]));
|
|
160
|
+
const screen = out.screens.find((s) => s.id === "described-tenant");
|
|
161
|
+
if (screen?.type !== "configEdit") throw new Error("expected configEdit screen");
|
|
162
|
+
const section = screen.layout.sections[0];
|
|
163
|
+
expect(section && "description" in section ? section.description : undefined).toBe(
|
|
164
|
+
"described.settings.description",
|
|
165
|
+
);
|
|
166
|
+
});
|
|
167
|
+
|
|
140
168
|
test("excludes unmasked keys and computed keys", () => {
|
|
141
169
|
const s = configScreen("billing-tenant");
|
|
142
170
|
// internal-flag has no mask, derived is computed → neither appears anywhere
|
|
@@ -109,6 +109,13 @@ export function buildConfigFeatureSchema(registry: Registry): ConfigFeatureSchem
|
|
|
109
109
|
const masked = collectMaskedKeys(registry);
|
|
110
110
|
if (masked.length === 0) return { screens: [], navs: [] };
|
|
111
111
|
|
|
112
|
+
// Verbatim (unprefixed) keys as the client sees them — NOT getAllTranslations()
|
|
113
|
+
// (server-merged, "feature:"-prefixed, see build-app-schema.ts:77-81).
|
|
114
|
+
const declaredTranslationKeys = new Set<string>();
|
|
115
|
+
for (const f of registry.features.values()) {
|
|
116
|
+
for (const key of Object.keys(f.translations ?? {})) declaredTranslationKeys.add(key);
|
|
117
|
+
}
|
|
118
|
+
|
|
112
119
|
const screens: ScreenDefinition[] = [];
|
|
113
120
|
const navs: NavDefinition[] = [];
|
|
114
121
|
|
|
@@ -131,7 +138,7 @@ export function buildConfigFeatureSchema(registry: Registry): ConfigFeatureSchem
|
|
|
131
138
|
const access = rolesToAccess(group.flatMap((v) => v.roles));
|
|
132
139
|
const shortId = `${feature}-${scope}`;
|
|
133
140
|
|
|
134
|
-
screens.push(buildScreen(shortId, scope, feature, ordered, access));
|
|
141
|
+
screens.push(buildScreen(shortId, scope, feature, ordered, access, declaredTranslationKeys));
|
|
135
142
|
navs.push({
|
|
136
143
|
id: shortId,
|
|
137
144
|
label: `${feature}.settings`,
|
|
@@ -201,6 +208,7 @@ function buildScreen(
|
|
|
201
208
|
feature: string,
|
|
202
209
|
keys: readonly MaskedKey[],
|
|
203
210
|
access: AccessRule,
|
|
211
|
+
declaredTranslationKeys: ReadonlySet<string>,
|
|
204
212
|
): ConfigEditScreenDefinition {
|
|
205
213
|
const configKeys: Record<string, string> = {};
|
|
206
214
|
const fields: Record<string, FieldDefinition> = {};
|
|
@@ -226,8 +234,11 @@ function buildScreen(
|
|
|
226
234
|
// mask is the visibility gate, so collectMaskedKeys guarantees it here.
|
|
227
235
|
if (k.def.mask) fieldLabels[id] = k.def.mask.title;
|
|
228
236
|
}
|
|
237
|
+
// translate() echoes an undeclared key, so an ungated description would render raw.
|
|
238
|
+
const descriptionKey = `${feature}.settings.description`;
|
|
229
239
|
const section: EditFieldsSection = {
|
|
230
240
|
title: `${feature}.settings`,
|
|
241
|
+
...(declaredTranslationKeys.has(descriptionKey) && { description: descriptionKey }),
|
|
231
242
|
fields: keys.map(fieldId),
|
|
232
243
|
};
|
|
233
244
|
return {
|
|
@@ -237,7 +248,7 @@ function buildScreen(
|
|
|
237
248
|
configKeys,
|
|
238
249
|
fields,
|
|
239
250
|
fieldLabels,
|
|
240
|
-
layout: { sections: [section] },
|
|
251
|
+
layout: { sections: [section], width: "full" },
|
|
241
252
|
access,
|
|
242
253
|
};
|
|
243
254
|
}
|
|
@@ -20,6 +20,10 @@ export const DEFAULT_CURRENCIES = [
|
|
|
20
20
|
"INR",
|
|
21
21
|
] as const;
|
|
22
22
|
|
|
23
|
+
// --- Locale ---
|
|
24
|
+
|
|
25
|
+
export const DEFAULT_LOCALES = ["de", "en"] as const;
|
|
26
|
+
|
|
23
27
|
export function isFileField(field: FieldDefinition | undefined): field is AnyFileFieldDef {
|
|
24
28
|
if (!field) return false;
|
|
25
29
|
return (
|
package/src/engine/index.ts
CHANGED
|
@@ -424,7 +424,7 @@ export type {
|
|
|
424
424
|
WriteHandlerFn,
|
|
425
425
|
WriteResult,
|
|
426
426
|
} from "./types";
|
|
427
|
-
export { DEFAULT_CURRENCIES, HookPhases } from "./types";
|
|
427
|
+
export { DEFAULT_CURRENCIES, DEFAULT_LOCALES, HookPhases } from "./types";
|
|
428
428
|
export { isSystemTenant, isUuid, parseTenantId, SYSTEM_TENANT_ID } from "./types/identifiers";
|
|
429
429
|
export type {
|
|
430
430
|
PipelineBuildCtx,
|
|
@@ -299,7 +299,7 @@ export type {
|
|
|
299
299
|
LifecycleHookType,
|
|
300
300
|
OnDeleteStrategy,
|
|
301
301
|
} from "../constants";
|
|
302
|
-
export { DEFAULT_CURRENCIES, isFileField } from "../field-helpers";
|
|
302
|
+
export { DEFAULT_CURRENCIES, DEFAULT_LOCALES, isFileField } from "../field-helpers";
|
|
303
303
|
export { resolveName, withResponseData } from "../handler-helpers";
|
|
304
304
|
export { HookPhases } from "../hook-helpers";
|
|
305
305
|
export {
|