From 276d7d956654ab6cbaecda5af0493378b0c3115b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 05:26:01 +0000 Subject: [PATCH 01/10] wip(spec): declare metadata list columns and serve them on /meta/types Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzg7mFFG5b13DcQ93kf --- .../src/protocol-discovery-and-bases.ts | 5 + .../src/protocol-meta-type-schema.ts | 12 +- .../src/protocol-meta-types-listing.ts | 4 +- packages/rest/src/rest-server.ts | 7 +- packages/spec/src/api/protocol.zod.ts | 3 +- packages/spec/src/system/i18n-resolver.ts | 32 +++ packages/spec/src/system/index.ts | 1 + .../spec/src/system/metadata-list-registry.ts | 223 ++++++++++++++++++ .../metadata-list-zod-reconciliation.test.ts | 182 ++++++++++++++ packages/spec/src/ui/view.zod.ts | 89 +++++++ 10 files changed, 553 insertions(+), 5 deletions(-) create mode 100644 packages/spec/src/system/metadata-list-registry.ts create mode 100644 packages/spec/src/system/metadata-list-zod-reconciliation.test.ts diff --git a/packages/metadata-protocol/src/protocol-discovery-and-bases.ts b/packages/metadata-protocol/src/protocol-discovery-and-bases.ts index 567127ec024..8fdb2e46311 100644 --- a/packages/metadata-protocol/src/protocol-discovery-and-bases.ts +++ b/packages/metadata-protocol/src/protocol-discovery-and-bases.ts @@ -56,6 +56,7 @@ import type { Equal, MetaTypesListing } from './protocol-meta-types-listing.js'; import { HAND_CRAFTED_SCHEMAS, TYPE_TO_FORM, + TYPE_TO_LIST, canonicalMetaType, toJsonSchemaSafe, } from './protocol-meta-type-schema.js'; @@ -651,6 +652,8 @@ export class ProtocolDiscoveryAndBasesFacet { const schema = (zodSchema ? toJsonSchemaSafe(zodSchema, singular) : undefined) ?? HAND_CRAFTED_SCHEMAS[singular]; const form = TYPE_TO_FORM[singular]; + // The Studio list layout, beside the form; omitted for a type with none. + const list = TYPE_TO_LIST[singular]; // Phase 2: the authoritative minimal create seed (single source of // truth in @objectstack/spec). Studio/CLI derive create defaults // from this via /meta/types instead of re-inventing them. @@ -677,6 +680,7 @@ export class ProtocolDiscoveryAndBasesFacet { : 'registry' as const, schema, form, + ...(list !== undefined ? { list } : {}), ...(createSeed !== undefined ? { createSeed } : {}), // Override the spread `base.actions` with the merged view // (declarative + plugin-registered). Omit when empty to @@ -754,6 +758,7 @@ export class ProtocolDiscoveryAndBasesFacet { overrideSource: writableOverrides.has(singular) ? 'env' as const : 'registry' as const, schema, form, + ...(list !== undefined ? { list } : {}), ...(createSeed !== undefined ? { createSeed } : {}), // Plugin-registered actions on a type with no registry entry. ...(typeActions.length ? { actions: typeActions } : {}), diff --git a/packages/metadata-protocol/src/protocol-meta-type-schema.ts b/packages/metadata-protocol/src/protocol-meta-type-schema.ts index 0d3d9a6f629..da71b122af2 100644 --- a/packages/metadata-protocol/src/protocol-meta-type-schema.ts +++ b/packages/metadata-protocol/src/protocol-meta-type-schema.ts @@ -26,8 +26,8 @@ import { stripInjectedSystemColumns, } from '@objectstack/metadata-core'; import { PLURAL_TO_SINGULAR, canonicalMetaUrlType, metaUrlSpellingRefusal } from '@objectstack/spec/shared'; -import { type FormView } from '@objectstack/spec/ui'; -import { METADATA_FORM_REGISTRY } from '@objectstack/spec/system'; +import { type FormView, type MetadataListViewParsed } from '@objectstack/spec/ui'; +import { METADATA_FORM_REGISTRY, METADATA_LIST_REGISTRY } from '@objectstack/spec/system'; import { getMetadataTypeSchema } from '@objectstack/spec/kernel'; import { z } from 'zod'; import { @@ -57,6 +57,13 @@ import { */ const TYPE_TO_FORM: Readonly> = METADATA_FORM_REGISTRY; +/** + * Canonical Studio list layout per metadata type — the columns its metadata + * list shows — from the shared {@link METADATA_LIST_REGISTRY}, served beside + * the form as `list`. Types without an entry get Studio's default list. + */ +const TYPE_TO_LIST: Readonly> = METADATA_LIST_REGISTRY; + /** * The ONE canonical spelling of a metadata type at the `/meta` read/write/delete * boundary (#4432). @@ -619,6 +626,7 @@ function declaredKeySchema(schema: unknown, key: string, depth: number): z.ZodTy export { HAND_CRAFTED_SCHEMAS, TYPE_TO_FORM, + TYPE_TO_LIST, canonicalizeMetaRequestType, resolveOverlaySchema, toJsonSchemaSafe, diff --git a/packages/metadata-protocol/src/protocol-meta-types-listing.ts b/packages/metadata-protocol/src/protocol-meta-types-listing.ts index 81483bc18bc..5b5cf694601 100644 --- a/packages/metadata-protocol/src/protocol-meta-types-listing.ts +++ b/packages/metadata-protocol/src/protocol-meta-types-listing.ts @@ -18,7 +18,7 @@ // Not exported from the package index: no new public name. import type { MetadataTypeRegistryEntryParsed } from '@objectstack/spec/kernel'; -import type { Action, FormView } from '@objectstack/spec/ui'; +import type { Action, FormView, MetadataListViewParsed } from '@objectstack/spec/ui'; /** Flattens an intersection into one object type, so it compares EQUAL to an inferred object literal. */ type Flatten = { [K in keyof T]: T[K] }; @@ -42,6 +42,8 @@ export type MetaTypesListingEntry = Flatten< schema: Record; /** Form layout of the type's editor. */ form: FormView; + /** Studio list layout of the type (`METADATA_LIST_REGISTRY`); absent for a type with none. */ + list?: MetadataListViewParsed; /** The minimal create seed, when the spec declares one. */ createSeed?: {} | null; /** diff --git a/packages/rest/src/rest-server.ts b/packages/rest/src/rest-server.ts index 81dac7a37d2..e33154f0d98 100644 --- a/packages/rest/src/rest-server.ts +++ b/packages/rest/src/rest-server.ts @@ -4768,7 +4768,8 @@ export class RestServer { * Translate the `entries` payload returned by `getMetaTypes()` — applies * the active locale to each entry's `label`, `description`, the * nested `form` layout (section labels, field labels, helpText, - * placeholders) and the derived JSON `schema` (a `title` per node the + * placeholders), the `list` layout's column headers (through the same + * field-label slots) and the derived JSON `schema` (a `title` per node the * bundle names — the only channel that reaches a repeater row's column * headers, #16458) via the `metadataForms.` translation namespace. * @@ -4787,6 +4788,7 @@ export class RestServer { resolveMetadataTypeDescription, resolveMetadataFormLabels, resolveMetadataFormSchemaTitles, + resolveMetadataListLabels, } = await import('@objectstack/spec/system'); const opts = RestServer.translateOptionsFor(i18n, locale); const entries = payload.entries.map((entry: any) => { @@ -4798,6 +4800,9 @@ export class RestServer { if (entry.form) { next.form = resolveMetadataFormLabels(entry.form, entry.type, bundle, opts); } + if (entry.list) { + next.list = resolveMetadataListLabels(entry.list, entry.type, bundle, opts); + } if (entry.schema && typeof entry.schema === 'object') { next.schema = resolveMetadataFormSchemaTitles(entry.schema, entry.type, bundle, opts); } diff --git a/packages/spec/src/api/protocol.zod.ts b/packages/spec/src/api/protocol.zod.ts index 2cc732b54d9..430c64f081b 100644 --- a/packages/spec/src/api/protocol.zod.ts +++ b/packages/spec/src/api/protocol.zod.ts @@ -1,7 +1,7 @@ // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. import { z } from 'zod'; -import { ViewSchema } from '../ui/view.zod'; +import { MetadataListViewSchema, ViewSchema } from '../ui/view.zod'; import { I18nLabelSchema } from '../ui/i18n.zod'; import { DiscoverySchema } from './discovery.zod'; import { @@ -223,6 +223,7 @@ export const GetMetaTypesResponseSchema = lazySchema(() => z.object({ domain: z.enum(['data', 'ui', 'automation', 'system', 'security', 'ai']).describe('Protocol domain'), overrideSource: z.enum(['registry', 'env']).describe('Whether allowEnvironmentOverlay comes from the static registry or is elevated by the OS_METADATA_WRITABLE environment variable'), createSeed: z.unknown().optional().describe('Authoritative minimal valid create seed for this type — Studio/CLI/API derive create defaults from it (single source of truth in @objectstack/spec). Absent for canvas-create types whose shape is built interactively.'), + list: MetadataListViewSchema.optional().describe('Studio list layout of this type: the columns its metadata list shows, each naming a key of the type schema, headers in the request locale. Absent for a type with no declared list, which Studio lists by name, label and description.'), })).optional().describe('Enriched per-type registry entries (Phase 3a)'), })); diff --git a/packages/spec/src/system/i18n-resolver.ts b/packages/spec/src/system/i18n-resolver.ts index b17df591156..1d2f0c95845 100644 --- a/packages/spec/src/system/i18n-resolver.ts +++ b/packages/spec/src/system/i18n-resolver.ts @@ -6336,6 +6336,38 @@ export function resolveMetadataFormLabels>( return next as T; } +/** + * Translate the column headers of a metadata type's Studio list layout (a + * `METADATA_LIST_REGISTRY` entry) against the active translation bundle. + * + * A column is translated through the slot of the type's form field of the + * same path, `metadataForms..fields..label`, so a column header + * and the form label of that key read the same words. A column whose slot has + * no translation keeps its English header. + * + * Returns a new list object; the input is not mutated. + * + * @example + * ```ts + * const localized = resolveMetadataListLabels(METADATA_LIST_REGISTRY.hook, 'hook', bundle, { locale: 'zh-CN' }); + * ``` + */ +export function resolveMetadataListLabels> }>( + list: T, + type: string, + bundle: TranslationBundle | undefined, + opts?: ResolveOptions, +): T { + if (!list || typeof list !== 'object' || !Array.isArray(list.columns)) return list; + if (!lookupMetadataForm(bundle, type, opts)) return list; + const columns = list.columns.map((column) => { + if (!column || typeof column !== 'object' || typeof column.field !== 'string') return column; + const label = lookupMetadataFormField(bundle, type, column.field, 'label', opts); + return label ? { ...column, label } : column; + }); + return { ...list, columns }; +} + /** * Every `metadataForms..fields.` key recorded at any locale of the * chain — the union, so a key one locale names and another does not is still diff --git a/packages/spec/src/system/index.ts b/packages/spec/src/system/index.ts index 433927f3d3e..fcd0abbdcf2 100644 --- a/packages/spec/src/system/index.ts +++ b/packages/spec/src/system/index.ts @@ -80,6 +80,7 @@ export * from './sms-config.zod'; export * from './push-config.zod'; export * from './push-device.zod'; export * from './metadata-form-registry'; +export * from './metadata-list-registry'; // compliance.zod (GDPR/HIPAA/PCI configs) and masking.zod (role-based data // masking) were REMOVED per ADR-0056 D8 "design+enforce or remove": both were // declared-but-never-enforced (no runtime consumer), and compliance-grade diff --git a/packages/spec/src/system/metadata-list-registry.ts b/packages/spec/src/system/metadata-list-registry.ts new file mode 100644 index 00000000000..805c415d3f0 --- /dev/null +++ b/packages/spec/src/system/metadata-list-registry.ts @@ -0,0 +1,223 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * Canonical registry of the Studio list layout of each metadata type: which + * columns the "All metadata" list of a type shows. The list counterpart of + * {@link METADATA_FORM_REGISTRY}, and consumed the same way: + * + * - `getMetaTypes()` in `@objectstack/metadata-protocol` serves each entry as + * `list` on the type's `/meta/types` row, beside `form`, so Studio, the CLI + * and AI clients read one declaration; + * - the REST `/meta/types` handler translates each column header through the + * type's form field slot, `metadataForms..fields..label`, so a + * column and the form field of the same key read the same words; + * - `os i18n extract` emits that slot for every column whose path the type's + * form does not already declare. + * + * Every column names a key of the type's own schema (or a dotted path into it). + * `metadata-list-zod-reconciliation.test.ts` refuses a column naming a key the + * schema does not declare, and a header that differs from the form field label + * of the same path (one translation slot, one English source). + * + * A type with no entry here gets the Studio default list (name, label, + * description). + * + * @see METADATA_FORM_REGISTRY — the form layouts this registry sits beside + */ + +import { defineList, type MetadataListViewParsed } from '../ui/view.zod'; + +const NAME = { field: 'name', label: 'Name' } as const; +const LABEL = { field: 'label', label: 'Label' } as const; +const DESCRIPTION = { field: 'description', label: 'Description' } as const; + +/** + * Frozen map of metadata type → canonical list layout. + * + * @example + * + * ```ts + * import { METADATA_LIST_REGISTRY } from '@objectstack/spec/system'; + * + * for (const [type, list] of Object.entries(METADATA_LIST_REGISTRY)) { + * console.log(type, list.columns.map((c) => c.field).join(', ')); + * } + * ``` + */ +export const METADATA_LIST_REGISTRY: Readonly> = Object.freeze({ + // ── data ────────────────────────────────────────────────────────────── + object: defineList({ + schemaId: 'object', + columns: [NAME, LABEL, { field: 'pluralLabel', label: 'Plural Label' }, { field: 'fields', label: 'Fields', type: 'count' }, DESCRIPTION], + }), + field: defineList({ + schemaId: 'field', + // A field row's `object` is stamped by the server, not a `FieldSchema` + // key, so the console appends it as its own column. + columns: [NAME, { field: 'type', label: 'Type', type: 'badge' }, LABEL], + }), + hook: defineList({ + schemaId: 'hook', + columns: [ + NAME, LABEL, + { field: 'object', label: 'Object', type: 'list' }, + { field: 'events', label: 'Events', type: 'list' }, + { field: 'priority', label: 'Priority' }, + { field: 'async', label: 'Async', type: 'boolean' }, + DESCRIPTION, + ], + }), + seed: defineList({ + schemaId: 'seed', + columns: [{ field: 'object', label: 'Object' }, { field: 'mode', label: 'Mode', type: 'badge' }], + }), + mapping: defineList({ + schemaId: 'mapping', + columns: [ + NAME, LABEL, + { field: 'targetObject', label: 'Target Object' }, + { field: 'mode', label: 'Mode', type: 'badge' }, + { field: 'sourceFormat', label: 'Source Format', type: 'badge' }, + ], + }), + picklist: defineList({ + schemaId: 'picklist', + columns: [NAME, LABEL, { field: 'options', label: 'Options', type: 'count' }, DESCRIPTION], + }), + + // ── ui ──────────────────────────────────────────────────────────────── + view: defineList({ + schemaId: 'view', + columns: [NAME, { field: 'object', label: 'Object' }, { field: 'type', label: 'Type', type: 'badge' }, LABEL], + }), + page: defineList({ + schemaId: 'page', + columns: [NAME, LABEL, { field: 'type', label: 'Type', type: 'badge' }, DESCRIPTION], + }), + dashboard: defineList({ + schemaId: 'dashboard', + columns: [NAME, LABEL, DESCRIPTION], + }), + action: defineList({ + schemaId: 'action', + columns: [NAME, LABEL, { field: 'type', label: 'Type', type: 'badge' }, { field: 'objectName', label: 'Object Name' }, DESCRIPTION], + }), + report: defineList({ + schemaId: 'report', + columns: [NAME, LABEL, { field: 'type', label: 'Type', type: 'badge' }, { field: 'dataset', label: 'Dataset' }, DESCRIPTION], + }), + dataset: defineList({ + schemaId: 'dataset', + columns: [NAME, LABEL, { field: 'object', label: 'Object' }, DESCRIPTION], + }), + + // ── automation ──────────────────────────────────────────────────────── + flow: defineList({ + schemaId: 'flow', + columns: [NAME, LABEL, { field: 'type', label: 'Type', type: 'badge' }, DESCRIPTION], + }), + job: defineList({ + schemaId: 'job', + columns: [ + NAME, LABEL, + { field: 'schedule', label: 'Schedule', type: 'summary' }, + { field: 'enabled', label: 'Enabled', type: 'boolean' }, + DESCRIPTION, + ], + }), + assignment_rule: defineList({ + schemaId: 'assignment_rule', + columns: [ + NAME, LABEL, + { field: 'object', label: 'Object' }, + { field: 'entries', label: 'Entries', type: 'count' }, + { field: 'active', label: 'Active', type: 'boolean' }, + DESCRIPTION, + ], + }), + + // ── system ──────────────────────────────────────────────────────────── + api: defineList({ + schemaId: 'api', + columns: [ + NAME, + { field: 'method', label: 'Method', type: 'badge' }, + { field: 'path', label: 'Path' }, + { field: 'type', label: 'Type', type: 'badge' }, + { field: 'objectParams.object', label: 'Object' }, + { field: 'objectParams.operation', label: 'Operation', type: 'badge' }, + ], + }), + translation: defineList({ + schemaId: 'translation', + columns: [NAME, LABEL, { field: 'locale', label: 'Locale', type: 'badge' }], + }), + email_template: defineList({ + schemaId: 'email_template', + columns: [ + NAME, LABEL, + { field: 'locale', label: 'Locale', type: 'badge' }, + { field: 'subject', label: 'Subject' }, + { field: 'active', label: 'Active', type: 'boolean' }, + DESCRIPTION, + ], + }), + doc: defineList({ + schemaId: 'doc', + columns: [NAME, LABEL, { field: 'group', label: 'Group' }, { field: 'tags', label: 'Tags', type: 'list' }, DESCRIPTION], + }), + book: defineList({ + schemaId: 'book', + columns: [NAME, LABEL, { field: 'audience', label: 'Audience' }, { field: 'groups', label: 'Groups', type: 'count' }, DESCRIPTION], + }), + + // ── security ────────────────────────────────────────────────────────── + permission: defineList({ + schemaId: 'permission', + columns: [NAME, LABEL, DESCRIPTION], + }), + position: defineList({ + schemaId: 'position', + columns: [NAME, LABEL, DESCRIPTION], + }), + sharing_rule: defineList({ + schemaId: 'sharing_rule', + columns: [ + NAME, LABEL, + { field: 'object', label: 'Object' }, + { field: 'sharedWith', label: 'Shared With', type: 'summary' }, + { field: 'accessLevel', label: 'Access Level', type: 'badge' }, + ], + }), + queue: defineList({ + schemaId: 'queue', + columns: [NAME, LABEL, { field: 'members', label: 'Members', type: 'count' }, DESCRIPTION], + }), + + // ── ai ──────────────────────────────────────────────────────────────── + agent: defineList({ + schemaId: 'agent', + columns: [ + NAME, LABEL, + { field: 'role', label: 'Role' }, + { field: 'model.model', label: 'Model' }, + { field: 'active', label: 'Active', type: 'boolean' }, + ], + }), + tool: defineList({ + schemaId: 'tool', + columns: [NAME, LABEL, { field: 'objectName', label: 'Object Name' }, DESCRIPTION], + }), + skill: defineList({ + schemaId: 'skill', + columns: [ + NAME, LABEL, + { field: 'tools', label: 'Tools', type: 'count' }, + { field: 'active', label: 'Active', type: 'boolean' }, + DESCRIPTION, + ], + }), +}); + +/** Union of metadata type keys with a registered list layout. */ +export type MetadataListType = keyof typeof METADATA_LIST_REGISTRY; diff --git a/packages/spec/src/system/metadata-list-zod-reconciliation.test.ts b/packages/spec/src/system/metadata-list-zod-reconciliation.test.ts new file mode 100644 index 00000000000..9bb690b11be --- /dev/null +++ b/packages/spec/src/system/metadata-list-zod-reconciliation.test.ts @@ -0,0 +1,182 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * **Metadata list ↔ Zod reconciliation.** + * + * Every column in {@link METADATA_LIST_REGISTRY} names a key of a Zod schema + * the registry never imports — the same hand-copied-list shape + * `metadata-form-zod-reconciliation.test.ts` closes for forms. A column naming + * a key the schema does not declare renders an empty cell on every row and + * fails nowhere else, so this file is where it fails: + * + * - every registered type has a schema, and its list binds to that type; + * - every column path resolves, segment by segment, to a declared key (unions + * looked through, the same walk the form gate uses) that is not a + * `retiredKey()` tombstone and not the provenance/lock overlay; + * - every header equals the English source of the slot it is translated + * through, `metadataForms..fields..label`: the form field's own + * label when the type's form declares that path, else the humanized path + * (what `os i18n extract` emits for it). Two English sources for one slot + * would leave one of them untranslated. + */ + +import { describe, it, expect } from 'vitest'; + +import { METADATA_LIST_REGISTRY } from './metadata-list-registry'; +import { METADATA_FORM_REGISTRY } from './metadata-form-registry'; +import { getMetadataTypeSchema } from '../kernel/metadata-type-schemas'; +import { defineList } from '../ui/view.zod'; + +/** Peel wrapper nodes until an object/union node is reached (the form gate's walk). */ +function unwrap(schema: unknown, depth = 0): any { + const s = schema as any; + if (!s || depth > 25) return s; + const d = s.def ?? s._def; + if (!d) return s; + switch (d.type) { + case 'optional': + case 'nullable': + case 'default': + case 'prefault': + case 'readonly': + case 'catch': + case 'nonoptional': + return unwrap(d.innerType, depth + 1); + case 'array': + return unwrap(d.element, depth + 1); + case 'record': + return unwrap(d.valueType, depth + 1); + case 'lazy': + return unwrap(d.getter(), depth + 1); + case 'pipe': { + const inner = unwrap(d.in, depth + 1); + const innerType = (inner?.def ?? inner?._def)?.type; + return innerType === 'transform' ? unwrap(d.out, depth + 1) : inner; + } + default: + return s; + } +} + +/** The property node under `key`, looking through union members; `undefined` when undeclared. */ +function propertyOf(schema: unknown, key: string): unknown { + const u = unwrap(schema); + const d = u?.def ?? u?._def; + if (d?.type === 'object') return (d.shape ?? u.shape ?? {})[key]; + if (d?.type === 'union' || d?.type === 'discriminated_union') { + for (const option of d.options ?? []) { + const found = propertyOf(option, key); + if (found !== undefined && !isRetiredNode(found)) return found; + } + for (const option of d.options ?? []) { + const found = propertyOf(option, key); + if (found !== undefined) return found; + } + } + return undefined; +} + +/** A `retiredKey()` tombstone: `z.never()` under its optional wrapper. */ +function isRetiredNode(prop: unknown): boolean { + const u = unwrap(prop); + return (u?.def ?? u?._def)?.type === 'never'; +} + +/** Why `path` does not resolve to a writable key of `root`, or `null` when it does. */ +function pathDefect(root: unknown, path: string): string | null { + let node: unknown = root; + for (const segment of path.split('.')) { + if (segment.startsWith('_')) return `\`${segment}\` is the provenance/lock overlay, not the type's own key`; + const next = propertyOf(node, segment); + if (next === undefined) return `\`${segment}\` is not declared`; + if (isRetiredNode(next)) return `\`${segment}\` is retired`; + node = next; + } + return null; +} + +/** The extractor's fallback label for a path with no declared label (`humanizeFieldPath`, `@objectstack/lint`). */ +function humanizeFieldPath(path: string): string { + const leaf = path.split('.').pop() ?? path; + return leaf + .replace(/([a-z0-9])([A-Z])/g, '$1 $2') + .replace(/[_-]+/g, ' ') + .replace(/\b\w/g, (c) => c.toUpperCase()); +} + +/** `path → English label` for every field the type's form declares, at every depth. */ +function formFieldLabels(type: string): Map { + const out = new Map(); + const form = METADATA_FORM_REGISTRY[type] as any; + const walk = (fields: any[] | undefined, parent: string) => { + for (const f of fields ?? []) { + if (!f || typeof f !== 'object') continue; + const path = typeof f.field === 'string' ? (parent ? `${parent}.${f.field}` : f.field) : parent; + if (path && typeof f.field === 'string') { + out.set(path, typeof f.label === 'string' ? f.label : humanizeFieldPath(path)); + } + walk(f.fields, path); + } + }; + for (const section of [...(form?.sections ?? []), ...(form?.groups ?? [])]) walk(section?.fields, ''); + return out; +} + +const TYPES = Object.keys(METADATA_LIST_REGISTRY); + +describe('METADATA_LIST_REGISTRY ↔ the type schemas', () => { + it('declares a list for the first-batch types and the nine types the console used to declare', () => { + expect(TYPES.sort()).toEqual([ + 'action', 'agent', 'api', 'assignment_rule', 'book', 'dashboard', 'dataset', 'doc', + 'email_template', 'field', 'flow', 'hook', 'job', 'mapping', 'object', 'page', + 'permission', 'picklist', 'position', 'queue', 'report', 'seed', 'sharing_rule', + 'skill', 'tool', 'translation', 'view', + ]); + }); + + it.each(TYPES)('%s: binds to its own type, which has a schema', (type) => { + const list = METADATA_LIST_REGISTRY[type] as any; + expect(list.data).toEqual({ provider: 'schema', schemaId: type }); + expect(getMetadataTypeSchema(type)).toBeDefined(); + }); + + it.each(TYPES)('%s: every column names a declared, writable key of the schema', (type) => { + const root = getMetadataTypeSchema(type); + const defects = METADATA_LIST_REGISTRY[type].columns + .map((c) => [c.field, pathDefect(root, c.field)] as const) + .filter(([, defect]) => defect !== null) + .map(([field, defect]) => `${type}.${field}: ${defect}`); + expect(defects).toEqual([]); + }); + + it.each(TYPES)('%s: no column is declared twice', (type) => { + const fields = METADATA_LIST_REGISTRY[type].columns.map((c) => c.field); + expect(new Set(fields).size).toBe(fields.length); + }); + + it.each(TYPES)('%s: every header is the English source of its translation slot', (type) => { + const formLabels = formFieldLabels(type); + const mismatches = METADATA_LIST_REGISTRY[type].columns + .map((c) => ({ field: c.field, label: c.label, source: formLabels.get(c.field) ?? humanizeFieldPath(c.field) })) + .filter((c) => c.label !== c.source) + .map((c) => `${type}.${c.field}: header ${JSON.stringify(c.label)}, slot source ${JSON.stringify(c.source)}`); + expect(mismatches).toEqual([]); + }); +}); + +describe('the gate can fail', () => { + it('names an undeclared key, a retired key and an overlay key', () => { + const hook = getMetadataTypeSchema('hook'); + expect(pathDefect(hook, 'objectName')).toBe('`objectName` is not declared'); + expect(pathDefect(hook, '_packageId')).toMatch(/overlay/); + expect(pathDefect(getMetadataTypeSchema('email_template'), 'category')).toBe('`category` is retired'); + expect(pathDefect(getMetadataTypeSchema('api'), 'objectParams.object')).toBeNull(); + expect(pathDefect(getMetadataTypeSchema('api'), 'objectParams.target')).toBe('`target` is not declared'); + }); + + it('defineList refuses a column with a renderer outside the closed vocabulary, or no columns', () => { + expect(() => defineList({ schemaId: 'hook', columns: [{ field: 'name', type: 'currency' as never }] })).toThrow(); + expect(() => defineList({ schemaId: 'hook', columns: [] })).toThrow(); + expect(() => defineList({ schemaId: 'hook', columns: [{ field: 'name', width: 120 } as never] })).toThrow(); + }); +}); diff --git a/packages/spec/src/ui/view.zod.ts b/packages/spec/src/ui/view.zod.ts index 1944dba063f..aa3bfb68844 100644 --- a/packages/spec/src/ui/view.zod.ts +++ b/packages/spec/src/ui/view.zod.ts @@ -3904,6 +3904,55 @@ export const ListViewSchema = lazySchema(() => .superRefine(checkListViewChartBinding) .superRefine(checkListViewTimesheetBinding)); +/** + * How a metadata list cell draws its value. The vocabulary is closed: each value + * names a renderer the Studio metadata list ships. + * + * - `text` (the default): the value as written. + * - `badge`: a short enum value, as a chip. + * - `boolean`: a yes/no mark. + * - `count`: how many entries an array or a keyed record holds. + * - `list`: the entries of an array, joined; a single value as itself. + * - `summary`: the scalar members of an object value, joined in key order. + */ +export const MetadataListCellTypeSchema = lazySchema(() => z.enum([ + 'text', + 'badge', + 'boolean', + 'count', + 'list', + 'summary', +]).describe('How a metadata list cell draws its value')); + +/** + * One column of a metadata type's list: {@link ListColumnSchema} narrowed to the + * three members a platform list declares. `field` names a key of the type's own + * schema (or a dotted path into it), `label` is the English header, and `type` + * picks the cell renderer from {@link MetadataListCellTypeSchema}. + * + * The header is translated through the same slot as the type's form field of + * that path: `metadataForms..fields..label`. + */ +export const MetadataListColumnSchema = lazySchema(() => ListColumnSchema + .pick({ field: true, label: true, type: true }) + .extend({ + field: z.string().min(1).describe('Key of the metadata type\'s schema: a top-level key, or a dotted path into it'), + type: MetadataListCellTypeSchema.optional().describe('Cell renderer; `text` when absent'), + }) + .describe('One column of a metadata type list')); + +/** + * The list layout of a metadata type in Studio: {@link ListViewSchema} narrowed + * to its data binding and its columns, the list counterpart of a + * {@link defineForm} layout. Build one with {@link defineList}. + */ +export const MetadataListViewSchema = lazySchema(() => ListViewShapeSchema + .pick({ data: true, columns: true }) + .extend({ + columns: z.array(MetadataListColumnSchema).min(1).describe('Columns of the list, in display order'), + }) + .describe('List layout of a metadata type: its schema binding and its columns')); + /** * [commit c459da6bc] Form-view select option — {@link SelectOptionSchema} minus the * per-option `default` key (maintainer-ruled narrowing, 2026-08-28, on the @@ -8202,6 +8251,39 @@ export function defineForm( throw refusal; } +/** + * Type-safe factory for a metadata type's Studio list layout — the list + * counterpart of {@link defineForm}. It binds the columns to the type's JSON + * Schema (`data.provider === 'schema'`) and validates them against + * {@link MetadataListViewSchema} at definition time, so a malformed column + * fails at module load. + * + * @example + * ```ts + * export const hookList = defineList({ + * schemaId: 'hook', + * columns: [ + * { field: 'name', label: 'Name' }, + * { field: 'object', label: 'Object', type: 'list' }, + * { field: 'events', label: 'Events', type: 'list' }, + * ], + * }); + * ``` + */ +export function defineList( + config: Omit, 'data'> & { schemaId: string }, +): MetadataListViewParsed { + const { schemaId, ...rest } = config; + const parsed = MetadataListViewSchema.safeParse({ + ...rest, + data: { provider: 'schema', schemaId }, + }); + if (parsed.success) return parsed.data; + const refusal = new z.ZodRealError(parsed.error.issues); + z.core.util.captureStackTrace(refusal, defineList); + throw refusal; +} + /** * [#19678] The remedy {@link defineForm}'s refusal of an unspellable inline * option `value` carries — ruling 乙 (record 5805845085, narrowing ruling @@ -8338,6 +8420,13 @@ export type FormSelectOptionParsed = z.infer; export type ListColumn = z.input; /** Post-parse shape of {@link ListColumn} — defaults applied, transforms run (ADR-0122). */ export type ListColumnParsed = z.infer; +export type MetadataListCellType = z.input; +export type MetadataListColumn = z.input; +/** Post-parse shape of {@link MetadataListColumn} — defaults applied, transforms run (ADR-0122). */ +export type MetadataListColumnParsed = z.infer; +export type MetadataListView = z.input; +/** Post-parse shape of {@link MetadataListView} — defaults applied, transforms run (ADR-0122). */ +export type MetadataListViewParsed = z.infer; // `FormField` is declared next to FormFieldSchema — it IS that schema's // annotation, so it cannot be inferred back out of it (#4171). export type SelectionConfig = z.input; From 440232f0f82885e742530bd6a4ace19c91a96d61 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 05:30:16 +0000 Subject: [PATCH 02/10] wip(console): read served metadata list columns first Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzg7mFFG5b13DcQ93kf --- packages/lint/src/i18n-walk.ts | 24 +- scripts/check-i18n-bundles.mjs | 4 + .../src/services/builtinComponents.tsx | 71 ++---- ...eListPage.servedListColumns-36860.test.tsx | 216 ++++++++++++++++++ .../views/metadata-admin/ResourceListPage.tsx | 18 +- .../src/views/metadata-admin/anchors.ts | 37 +-- .../src/views/metadata-admin/registry.ts | 33 ++- .../metadata-admin/servedListColumns.test.tsx | 87 +++++++ .../metadata-admin/servedListColumns.tsx | 156 +++++++++++++ .../src/views/metadata-admin/useMetadata.ts | 7 + 10 files changed, 562 insertions(+), 91 deletions(-) create mode 100644 ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx create mode 100644 ui/packages/app-shell/src/views/metadata-admin/servedListColumns.test.tsx create mode 100644 ui/packages/app-shell/src/views/metadata-admin/servedListColumns.tsx diff --git a/packages/lint/src/i18n-walk.ts b/packages/lint/src/i18n-walk.ts index fc71c5179bb..839003b0f47 100644 --- a/packages/lint/src/i18n-walk.ts +++ b/packages/lint/src/i18n-walk.ts @@ -161,9 +161,10 @@ * metadataForms..fields..label / .helpText / .placeholder * * The `metadataForms.*` surface is registry-driven (sourced from - * `METADATA_FORM_REGISTRY` + `DEFAULT_METADATA_TYPE_REGISTRY` in - * `@objectstack/spec`) — it is included unconditionally, independent of - * the supplied stack config. + * `METADATA_FORM_REGISTRY`, `METADATA_LIST_REGISTRY` and + * `DEFAULT_METADATA_TYPE_REGISTRY` in `@objectstack/spec`; a list column's + * header is the `fields..label` slot of its path) — it is included + * unconditionally, independent of the supplied stack config. * * Pure given its inputs: no network, and the only filesystem read is the * shipped liveness ledger behind {@link authorWarnedTranslationGroups} — @@ -175,6 +176,7 @@ import { METADATA_FORM_REGISTRY, + METADATA_LIST_REGISTRY, PAGE_COMPONENT_COPY_KEYS, FLOW_SCREEN_COPY_KEYS, FLOW_SCREEN_FIELD_COPY_KEYS, @@ -2757,6 +2759,22 @@ function walkMetadataForms(out: ExpectedEntry[]): void { } } } + + // 3) List column headers (`METADATA_LIST_REGISTRY`). A column is translated + // through the form field slot of the same path, so only a path the + // type's form does not already declare needs its own entry. + const formFieldSlots = new Set( + out + .filter((e) => e.source === 'metadataFormField' && e.path[0] === 'metadataForms' && e.path[2] === 'fields' && e.path[4] === 'label') + .map((e) => `${e.path[1]}\u0000${e.path[3]}`), + ); + for (const [type, list] of Object.entries(METADATA_LIST_REGISTRY)) { + for (const column of list.columns) { + if (formFieldSlots.has(`${type}\u0000${column.field}`)) continue; + formFieldSlots.add(`${type}\u0000${column.field}`); + pushEntry(out, ['metadataForms', type, 'fields', column.field, 'label'], inlineText(column.label) ?? humanizeFieldPath(column.field), 'metadataFormField', { metadataType: type }); + } + } } /** Recursive walker for FormField nodes, accumulating dot-path. */ diff --git a/scripts/check-i18n-bundles.mjs b/scripts/check-i18n-bundles.mjs index 39698702162..81af7abacef 100644 --- a/scripts/check-i18n-bundles.mjs +++ b/scripts/check-i18n-bundles.mjs @@ -183,6 +183,10 @@ const SURFACE_MODULE = 'scripts/i18n-bundle-surface.mjs'; */ const METADATA_TYPE_REGISTRY_MODULE = 'packages/spec/src/kernel/metadata-plugin.zod.ts'; const METADATA_FORM_REGISTRY_MODULE = 'packages/spec/src/system/metadata-form-registry.ts'; +// The list registry is a third producer of the same surface: `walkMetadataForms` +// emits `metadataForms..fields..label` for each list column whose +// path the type's form does not declare. +const METADATA_LIST_REGISTRY_MODULE = 'packages/spec/src/system/metadata-list-registry.ts'; /** The one command this gate invokes per package, as oclif topic/command parts. */ const EXTRACT_COMMAND_ID = ['i18n', 'extract']; diff --git a/ui/packages/app-shell/src/services/builtinComponents.tsx b/ui/packages/app-shell/src/services/builtinComponents.tsx index d986c460349..985d69311bf 100644 --- a/ui/packages/app-shell/src/services/builtinComponents.tsx +++ b/ui/packages/app-shell/src/services/builtinComponents.tsx @@ -317,11 +317,7 @@ registerMetadataResource({ description: 'Domain entities — tables in the data model. Each object owns its fields, relationships, validations, and lifecycle hooks.', domain: 'data', searchableFields: ['name', 'label', 'description'], - listColumns: [ - { key: 'name', label: 'Name', width: '25%' }, - { key: 'label', label: 'Label', width: '25%' }, - { key: 'description', label: 'Description' }, - ], + // objectstack#36860 — the list columns are the spec's (`METADATA_LIST_REGISTRY`). // objectui#10202 — the editor is seeded from the SERVED object, where a // picklist-bound field carries `picklist` plus the options resolved from the // list; the authoring door refuses the two together. The saved body drops @@ -337,12 +333,9 @@ registerMetadataResource({ description: 'Columns attached to objects — name, type, validation, and storage settings.', domain: 'data', searchableFields: ['name', 'label', 'object', 'type'], - listColumns: [ - { key: 'name', label: 'Name', width: '25%' }, - { key: 'object', label: 'Object', width: '20%' }, - { key: 'type', label: 'Type', width: '15%' }, - { key: 'label', label: 'Label' }, - ], + // objectstack#36860 — name / type / label are the spec's columns; a field + // row's `object` is stamped by the server, not a `FieldSchema` key. + listExtraColumns: [{ key: 'object', label: 'Object', width: '20%' }], }); /* -------------------------------------------------------------------------- */ @@ -360,12 +353,8 @@ registerMetadataResource({ // objectui#7611 — no `managedBy` column: the registry serves no such key on a // permission set (measured on objectstack main), so it read "Custom" for every // set, the platform's own included. Provenance is the list's own Source badge, - // read from the served `_packageId` / `_provenance`. - listColumns: [ - { key: 'name', label: 'Name', width: '30%' }, - { key: 'label', label: 'Label', width: '30%' }, - { key: 'description', label: 'Description' }, - ], + // read from the served `_packageId` / `_provenance`. objectstack#36860 — the + // columns are the spec's. }); // objectstack#25333 — the position list says who holds each position and which @@ -384,10 +373,9 @@ registerMetadataResource({ // admits a live position create (`allowRuntimeCreate`); under `?package=` // the create stays a package draft (ADR-0086). createLive: true, - listColumns: [ - { key: 'name', label: 'Name', width: '20%' }, - { key: 'label', label: 'Label', width: '20%' }, - { key: 'description', label: 'Description' }, + // objectstack#36860 — name / label / description are the spec's columns; the + // holder count and the granted sets are served beside each row. + listExtraColumns: [ { key: '_holderCount', label: 'Holders', @@ -413,20 +401,16 @@ registerMetadataResource({ label: 'Views', description: 'Saved list / kanban / calendar / gantt configurations on top of an object.', domain: 'ui', - listColumns: [ - { key: 'name', label: 'Name', width: '30%' }, - { key: 'object', label: 'Object', width: '20%' }, - { - key: 'type', - label: 'Type', + // objectstack#36860 — the columns are the spec's. + listCells: { + type: { width: '15%', // Expanded ViewItems keep their display type under `config.type` // and only the list/form family at the top level — derive it so the // column shows "calendar" / "grid" / "form" instead of "—". render: (_v, item) => viewDisplayType(item) ?? '—', }, - { key: 'label', label: 'Label' }, - ], + }, // ADR-0017 — the framework exposes each view as a canonical first-class // ViewItem ({ name, object, viewKind, label, config }). The inspector and // preview read that shape directly (`draft.config`), so NO toDraft/fromDraft @@ -441,11 +425,6 @@ registerMetadataResource({ label: 'Dashboards', description: 'Composed dashboards with charts, KPIs, and tables.', domain: 'ui', - listColumns: [ - { key: 'name', label: 'Name', width: '30%' }, - { key: 'label', label: 'Label', width: '30%' }, - { key: 'description', label: 'Description' }, - ], }); /** @@ -475,11 +454,6 @@ registerMetadataResource({ label: 'Pages', description: 'Visual page layouts authored as JSON metadata.', domain: 'ui', - listColumns: [ - { key: 'name', label: 'Name', width: '30%' }, - { key: 'label', label: 'Label', width: '30%' }, - { key: 'route', label: 'Route' }, - ], fromDraft: pageSaveBody, }); @@ -495,12 +469,10 @@ registerMetadataResource({ description: 'Documentation navigation spine — ordered groups with membership derived over docs (glob/tag rules), plus an explicit pages override for curated order.', domain: 'system', searchableFields: ['name', 'label', 'description', 'slug'], - listColumns: [ - { key: 'name', label: 'Name', width: '25%' }, - { key: 'label', label: 'Label', width: '25%' }, - { - key: 'audience', - label: 'Audience', + // objectstack#36860 — the columns are the spec's; the audience cell names + // the org default and a permission-set audience in words. + listCells: { + audience: { width: '12%', render: (v) => v == null @@ -509,12 +481,5 @@ registerMetadataResource({ ? `permission set: ${(v as { permissionSet: string }).permissionSet}` : String(v), }, - { - key: 'groups', - label: 'Groups', - width: '10%', - render: (v) => (Array.isArray(v) ? String(v.length) : '0'), - }, - { key: 'description', label: 'Description' }, - ], + }, }); diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx new file mode 100644 index 00000000000..d81bd263922 --- /dev/null +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx @@ -0,0 +1,216 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36860 — the generic metadata list reads the columns the type's + * `/meta/types` entry serves (`entries[].list`, the spec's + * `METADATA_LIST_REGISTRY`), ahead of the console's own declaration. + * + * What is pinned, each against a control: + * + * - a served list decides the columns and their order, and its headers are + * shown exactly as served (already in the reader's locale), never replaced + * by the console's `engine.list.col.*` text for the same key; + * - each declared renderer draws its cell: a list joins, a count counts, a + * boolean marks, a dotted path reads into the body; + * - a key the stored row leaves out shows the schema default the served JSON + * Schema declares (what the runtime uses), and a key with no default shows + * the empty cell; + * - a type serving no list keeps the default name / label / description; + * - a console `listCells` override draws the cell of a served column, and a + * console `listExtraColumns` column follows the served ones. + */ +import { describe, it, expect, vi, afterEach } from 'vitest'; +import { render, cleanup, screen, within } from '@testing-library/react'; +import '@testing-library/jest-dom'; +import * as React from 'react'; +import { MemoryRouter, Route, Routes } from 'react-router-dom'; + +const HOOKS: Record[] = [ + { name: 'stamp_owner', label: 'Stamp owner', object: 'account', events: ['beforeInsert', 'beforeUpdate'], async: true }, + // `priority` and `async` left at their schema defaults: stored rows omit them. + { name: 'audit_all', label: 'Audit all', object: ['account', 'contact'], events: ['afterDelete'] }, +]; +const AGENTS: Record[] = [{ name: 'helper', label: 'Helper', model: { provider: 'openai', model: 'gpt-4o' } }]; +const QUEUES: Record[] = [{ name: 'tier1', label: 'Tier 1', members: [{ type: 'user', id: 'a' }, { type: 'user', id: 'b' }] }]; +const VIEWS: Record[] = [ + { name: 'all_accounts', object: 'account', label: 'All accounts', viewKind: 'list', config: { type: 'kanban' } }, +]; + +const CLIENT = { + list: async (type: string) => + type === 'hook' ? HOOKS : type === 'agent' ? AGENTS : type === 'queue' ? QUEUES : type === 'view' ? VIEWS : [], +}; + +// Headers as the server serves them to a zh-CN reader. +const HOOK_ENTRY = { + type: 'hook', + label: '钩子', + allowEnvironmentOverlay: false, + allowRuntimeCreate: true, + schema: { + type: 'object', + properties: { + name: { type: 'string' }, + priority: { type: 'number', default: 100 }, + async: { type: 'boolean', default: false }, + events: { type: 'array', items: { type: 'string' } }, + }, + }, + list: { + data: { provider: 'schema', schemaId: 'hook' }, + columns: [ + { field: 'name', label: '名称' }, + { field: 'object', label: '对象', type: 'list' }, + { field: 'events', label: '事件', type: 'list' }, + { field: 'priority', label: '优先级' }, + { field: 'async', label: '异步', type: 'boolean' }, + { field: 'description', label: '描述' }, + ], + }, +}; +const AGENT_ENTRY = { + type: 'agent', + label: 'Agent', + allowEnvironmentOverlay: false, + allowRuntimeCreate: true, + list: { + data: { provider: 'schema', schemaId: 'agent' }, + columns: [ + { field: 'name', label: 'Name' }, + { field: 'model.model', label: 'Model' }, + ], + }, +}; +const QUEUE_ENTRY = { + type: 'queue', + label: 'Queue', + allowEnvironmentOverlay: false, + allowRuntimeCreate: true, + list: { + data: { provider: 'schema', schemaId: 'queue' }, + columns: [ + { field: 'name', label: 'Name' }, + { field: 'members', label: 'Members', type: 'count' }, + ], + }, +}; +// Control: a type that serves no list. +const SKILL_ENTRY = { type: 'skill', label: 'Skill', allowEnvironmentOverlay: false, allowRuntimeCreate: true }; +const VIEW_ENTRY = { + type: 'view', + label: 'View', + allowEnvironmentOverlay: false, + allowRuntimeCreate: true, + list: { + data: { provider: 'schema', schemaId: 'view' }, + columns: [ + { field: 'name', label: 'Name' }, + { field: 'type', label: 'Type', type: 'badge' }, + ], + }, +}; + +vi.mock('./useMetadata', async (importOriginal) => ({ + ...(await importOriginal>()), + useMetadataClient: () => CLIENT, + useMetadataTypes: () => ({ + loading: false, + error: null, + entries: [HOOK_ENTRY, AGENT_ENTRY, QUEUE_ENTRY, SKILL_ENTRY, VIEW_ENTRY], + }), +})); + +vi.mock('./i18n', async (importOriginal) => ({ + ...(await importOriginal>()), + useMetadataLocale: () => 'en-US', +})); + +vi.mock('../../hooks/useCanAuthorMetadata', () => ({ + useCanAuthorMetadata: () => true, +})); + +vi.mock('../../hooks/useTenancyPosture', async (importOriginal) => ({ + ...(await importOriginal>()), + useTenancyPosture: () => 'single', +})); + +// Imported AFTER the mocks so the page picks them up. +import { MetadataResourceListPage } from './ResourceListPage'; +import { registerBuiltinAnchors } from './anchors'; +import { registerMetadataResource } from './registry'; +import '../../services/builtinComponents'; + +registerBuiltinAnchors(); +registerMetadataResource({ + type: 'queue', + listCells: { members: { render: (v) => `${Array.isArray(v) ? v.length : 0} people` } }, + listExtraColumns: [{ key: '_packageId', label: 'Package' }], +}); + +afterEach(() => { + cleanup(); +}); + +function mount(type: string) { + return render( + + + } /> + + , + ); +} + +async function headersOf(): Promise { + const table = await screen.findByRole('table'); + return within(table) + .getAllByRole('columnheader') + .map((th) => th.textContent?.trim() ?? '') + .filter((text) => text !== ''); +} + +async function rowOf(name: string): Promise { + const cell = await screen.findByText(name); + const row = cell.closest('tr'); + if (!row) throw new Error(`no row for ${name}`); + return within(row).getAllByRole('cell').map((td) => td.textContent?.trim() ?? ''); +} + +describe('the generic list reads the served columns (objectstack#36860)', () => { + it('a served list decides the columns, in order, under the served headers', async () => { + mount('hook'); + const headers = await headersOf(); + expect(headers.slice(0, 6)).toEqual(['名称', '对象', '事件', '优先级', '异步', '描述']); + }); + + it('each declared renderer draws its cell, and an absent key shows its schema default', async () => { + mount('hook'); + expect((await rowOf('stamp_owner')).slice(0, 5)).toEqual(['stamp_owner', 'account', 'beforeInsert, beforeUpdate', '100', '✓']); + // `object` as a list of objects; `priority` / `async` absent → 100 / ✗. + expect((await rowOf('audit_all')).slice(0, 5)).toEqual(['audit_all', 'account, contact', 'afterDelete', '100', '✗']); + }); + + it('a dotted path reads into the body', async () => { + mount('agent'); + expect((await rowOf('helper')).slice(0, 2)).toEqual(['helper', 'gpt-4o']); + }); + + it('a type serving no list keeps the default columns (control)', async () => { + mount('skill'); + const headers = await headersOf(); + expect(headers).toContain('Name'); + expect(headers).toContain('Description'); + expect(headers).not.toContain('Tools'); + }); + + it('a console cell override draws a served column; a console extra column follows the served ones', async () => { + mount('queue'); + expect((await headersOf()).slice(0, 3)).toEqual(['Name', 'Members', 'Package']); + expect((await rowOf('tier1')).slice(0, 2)).toEqual(['tier1', '2 people']); + }); + + it('the view list keeps its derived display type through its cell override', async () => { + mount('view'); + expect((await rowOf('all_accounts')).slice(0, 2)).toEqual(['all_accounts', 'kanban']); + }); +}); diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx index fe624a36508..c291298966b 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx @@ -58,6 +58,7 @@ import { resolveResourceConfig, } from './registry.js'; import { t, tFormat, translateMetadataType, useMetadataLocale } from './i18n.js'; +import { servedListColumns, withExtraColumns, type ListColumns } from './servedListColumns.js'; import { buildPackageScopeOptions } from './package-scope.js'; import { ENVIRONMENT_SCOPE_QUERY, isEnvironmentScope, useWalledCatalogReadOnly } from './catalog-scope.js'; import { useMetadataAreaHost } from './metadataAreaHost.js'; @@ -714,8 +715,15 @@ function DefaultMetadataList({ type, appName }: { type: string; appName?: string [scopedItems], ); + // objectstack#36860 — the served list layout first, then the console's own + // columns, then the default (`servedListColumns.tsx` states the precedence). const columns = withBundleMemberColumn( - config.listColumns ?? defaultColumns(config.primaryKey ?? 'name'), + withExtraColumns( + servedListColumns(entry?.list, entry?.schema, config.listCells) + ?? config.listColumns + ?? defaultColumns(config.primaryKey ?? 'name'), + config.listExtraColumns, + ), config.bundleMemberField, ); const typeLabel = translateMetadataType(type, locale, entry?.label ?? type); @@ -742,9 +750,10 @@ function DefaultMetadataList({ type, appName }: { type: string; appName?: string // area never wait on them. const packagesPending = !envScope && !host && projectPackages === null; - // Localise default column labels — registered columns keep their - // hand-authored labels (consumers may want bespoke wording). - const localizeColumnLabel = (col: { key: string; label: string }) => { + // Localise a console column's header through `engine.list.col.`. A + // served header is already in the reader's locale and is shown as served. + const localizeColumnLabel = (col: { key: string; label: string; labelLocalized?: boolean }) => { + if (col.labelLocalized) return col.label; const tryKey = `engine.list.col.${col.key}`; const translated = t(tryKey, locale); return translated === tryKey ? col.label : translated; @@ -1389,7 +1398,6 @@ export function openRowFromClick(e: React.MouseEvent, open: () => v const ROW_OWN_CONTROLS = 'a,button,input,select,textarea,label,summary,[role="button"],[role="switch"],[role="checkbox"],[role="menuitem"],[role="link"],[contenteditable="true"]'; -type ListColumns = NonNullable; /** * objectstack#26649 — the member column of a type whose identity is a pair, diff --git a/ui/packages/app-shell/src/views/metadata-admin/anchors.ts b/ui/packages/app-shell/src/views/metadata-admin/anchors.ts index c839973fd13..d6e87cbb74c 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/anchors.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/anchors.ts @@ -571,26 +571,9 @@ export function registerBuiltinAnchors(): void { // seed it as an empty record so the saved body validates. createDefaults: { fields: {} }, searchableFields: ['name', 'label', 'pluralLabel', 'description'], - listColumns: [ - { key: 'name', label: 'Name', width: '24%' }, - { key: 'label', label: 'Label', width: '22%' }, - { key: 'pluralLabel', label: 'Plural', width: '22%' }, - { - key: 'fields', - label: 'Fields', - width: '90px', - render: (value) => { - if (value == null) return '—'; - const count = Array.isArray(value) - ? value.length - : typeof value === 'object' - ? Object.keys(value as Record).length - : 0; - return count; - }, - }, - { key: 'description', label: 'Description' }, - ], + // objectstack#36860 — the list columns are the spec's + // (`METADATA_LIST_REGISTRY`): name, label, plural label, field count, + // description. }); // objectui#12982 — the declared sharing rules Setup lists read-only @@ -600,19 +583,17 @@ export function registerBuiltinAnchors(): void { type: 'sharing_rule', iconName: 'share-2', searchableFields: ['name', 'label', 'description', 'object'], - listColumns: [ - { key: 'name', label: 'Name' }, - { key: 'label', label: 'Label' }, - { key: 'object', label: 'Object' }, - { - key: 'sharedWith', - label: 'Shared with', + // objectstack#36860 — name / label / object / shared with / access level + // are the spec's columns; the declaring package is served beside each row. + listCells: { + sharedWith: { render: (value) => { const v = value as { type?: unknown; value?: unknown } | null | undefined; return v && typeof v === 'object' ? `${String(v.type ?? '')}: ${String(v.value ?? '')}` : '—'; }, }, - { key: 'accessLevel', label: 'Access' }, + }, + listExtraColumns: [ { key: '_packageId', label: 'Package', diff --git a/ui/packages/app-shell/src/views/metadata-admin/registry.ts b/ui/packages/app-shell/src/views/metadata-admin/registry.ts index e1029d6af16..2c755bbc1b2 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/registry.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/registry.ts @@ -131,7 +131,7 @@ export interface MetadataResourceConfig { * What the list page asks the server to serve beside each item (the list * read's `include`). `'grants'` is the `position` list's holder count and * permission sets in force (objectstack#25333); the columns that read them - * are this type's own `listColumns`. Omit for the plain list. + * are this type's own `listExtraColumns`. Omit for the plain list. */ listInclude?: 'grants'; /** @@ -145,7 +145,13 @@ export interface MetadataResourceConfig { */ bundleMemberField?: string; - /** Columns rendered in the list page. */ + /** + * Columns rendered in the list page of a type that serves NO list layout + * (`/meta/types` `entries[].list`, the spec's `METADATA_LIST_REGISTRY`). + * A type that declares its list in the spec never reads this: its columns + * are the served ones, with {@link listCells} and {@link listExtraColumns} + * (`servedListColumns.tsx`). + */ listColumns?: Array<{ key: string; label: string; @@ -153,7 +159,30 @@ export interface MetadataResourceConfig { render?: (value: unknown, item: Record) => ReactNode; /** Column width hint in CSS (e.g. `'180px'`, `'30%'`). */ width?: string; + /** + * The header is already in the reader's locale (a served column), so it is + * shown as is and not looked up in the `engine.list.col.*` table. + */ + labelLocalized?: boolean; }>; + /** + * Console cell drawing for a column the served list layout declares, keyed by + * the column's `field`: a renderer for a value whose shape the declared + * renderer cannot draw well, and an optional width. The header stays the + * served one. + */ + listCells?: Record) => ReactNode; + width?: string; + }>; + /** + * Columns appended after the list's own (served, else {@link listColumns}, + * else the default): values the server stamps on a list row + * (`_holderCount`, `_packageId`, a field's `object`) that are not keys of the + * type's own schema, so the spec cannot declare them. + */ + listExtraColumns?: MetadataResourceConfig['listColumns']; /** * Fully custom list page. When provided, the generic shell is bypassed. * Receives `{ type }`. Use this for ObjectManager, etc. diff --git a/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.test.tsx new file mode 100644 index 00000000000..8397af98ffd --- /dev/null +++ b/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.test.tsx @@ -0,0 +1,87 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36860 — the cell renderers and the path/default readers behind + * the served list columns, pinned without the page around them. + */ +import { describe, it, expect } from 'vitest'; +import { render } from '@testing-library/react'; +import * as React from 'react'; + +import { renderListCell, schemaDefaultAt, servedListColumns, valueAtPath, withExtraColumns } from './servedListColumns'; + +function text(node: React.ReactNode): string { + const { container } = render(<>{node}); + return container.textContent ?? ''; +} + +describe('renderListCell', () => { + it('count counts an array and a keyed record', () => { + expect(text(renderListCell('count', [1, 2, 3]))).toBe('3'); + expect(text(renderListCell('count', { a: 1, b: 2 }))).toBe('2'); + expect(text(renderListCell('count', []))).toBe('0'); + }); + + it('list joins an array and shows a single value as itself', () => { + expect(text(renderListCell('list', ['a', 'b']))).toBe('a, b'); + expect(text(renderListCell('list', 'account'))).toBe('account'); + }); + + it('summary joins the scalar members of an object', () => { + expect(text(renderListCell('summary', { type: 'cron', expression: '0 0 * * *', timezone: 'UTC' }))).toBe('cron · 0 0 * * * · UTC'); + }); + + it('boolean marks, badge shows the value, text shows a scalar as written', () => { + expect(text(renderListCell('boolean', true))).toBe('✓'); + expect(text(renderListCell('boolean', false))).toBe('✗'); + expect(text(renderListCell('badge', 'GET'))).toBe('GET'); + expect(text(renderListCell(undefined, 42))).toBe('42'); + }); + + it('an empty value is the empty cell, not a blank and not a zero', () => { + const empty = text(renderListCell(undefined, undefined)); + expect(text(renderListCell('list', []))).toBe(empty); + expect(text(renderListCell('badge', ''))).toBe(empty); + expect(text(renderListCell('count', undefined))).toBe(empty); + }); +}); + +describe('valueAtPath / schemaDefaultAt', () => { + it('reads a dotted path and answers undefined past a missing segment', () => { + expect(valueAtPath({ model: { model: 'gpt-4o' } }, 'model.model')).toBe('gpt-4o'); + expect(valueAtPath({ model: 'x' }, 'model.model')).toBeUndefined(); + expect(valueAtPath({}, 'objectParams.object')).toBeUndefined(); + }); + + it('finds a default at a dotted path, through union arms', () => { + const schema = { + properties: { + priority: { type: 'number', default: 100 }, + schedule: { anyOf: [{ properties: { timezone: { default: 'UTC' } } }] }, + }, + }; + expect(schemaDefaultAt(schema, 'priority')).toBe(100); + expect(schemaDefaultAt(schema, 'schedule.timezone')).toBe('UTC'); + expect(schemaDefaultAt(schema, 'name')).toBeUndefined(); + expect(schemaDefaultAt(undefined, 'priority')).toBeUndefined(); + }); +}); + +describe('servedListColumns / withExtraColumns', () => { + it('answers undefined for a type that serves no list, so the caller falls back', () => { + expect(servedListColumns(undefined, undefined)).toBeUndefined(); + expect(servedListColumns({ columns: [] } as never, undefined)).toBeUndefined(); + }); + + it('marks every served header as already localized', () => { + const cols = servedListColumns({ columns: [{ field: 'name', label: '名称' }] }, undefined)!; + expect(cols).toEqual([expect.objectContaining({ key: 'name', label: '名称', labelLocalized: true })]); + }); + + it('appends only the extra columns the base does not already show', () => { + const base = [{ key: 'name', label: 'Name' }]; + const merged = withExtraColumns(base, [{ key: 'name', label: 'dup' }, { key: '_packageId', label: 'Package' }]); + expect(merged.map((c) => c.key)).toEqual(['name', '_packageId']); + expect(withExtraColumns(base, undefined)).toBe(base); + }); +}); diff --git a/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.tsx b/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.tsx new file mode 100644 index 00000000000..10a16f7ed88 --- /dev/null +++ b/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.tsx @@ -0,0 +1,156 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * The generic metadata list's columns from the type's served list layout + * (`/meta/types` `entries[].list`, the spec's `METADATA_LIST_REGISTRY`). + * + * Precedence, read by `ResourceListPage`: + * + * 1. the served list, when the type declares one — each column's cell drawn by + * its declared renderer, or by the console's `listCells` override for that + * key; + * 2. else the console's own `listColumns`; + * 3. else the default name / label / description; + * + * and after whichever applies, the console's `listExtraColumns`: values the + * server stamps on a row that are not keys of the type's schema. + * + * A served header is already in the reader's locale (the server translates it + * through the form field slot of the same path), so it is shown as served and + * never looked up again in the console's `engine.list.col.*` table. + * + * A stored row omits a key the author left at its schema default, so an absent + * value shows the default the served JSON Schema declares at that path: the + * value the runtime uses. + */ + +import * as React from 'react'; +import { Badge, EmptyValue } from '@object-ui/components'; +import type { MetadataListView } from '@objectstack/spec/ui'; + +import type { MetadataResourceConfig } from './registry.js'; + +export type ListColumns = NonNullable; +type ListCell = NonNullable[string]; + +/** The value at a dotted `path` of `item`; `undefined` when any segment is missing. */ +export function valueAtPath(item: Record, path: string): unknown { + let node: unknown = item; + for (const segment of path.split('.')) { + if (node == null || typeof node !== 'object' || Array.isArray(node)) return undefined; + node = (node as Record)[segment]; + } + return node; +} + +/** The JSON Schema node at a dotted `path`, looking through `anyOf` / `oneOf` / `allOf` arms. */ +function schemaNodeAt(schema: unknown, path: string): Record | undefined { + let node = schema as Record | undefined; + for (const segment of path.split('.')) { + node = propertyNode(node, segment); + if (!node) return undefined; + } + return node; +} + +function propertyNode(node: Record | undefined, key: string): Record | undefined { + if (!node || typeof node !== 'object') return undefined; + const props = node.properties as Record> | undefined; + if (props && typeof props === 'object' && props[key]) return props[key]; + for (const arms of [node.anyOf, node.oneOf, node.allOf]) { + if (!Array.isArray(arms)) continue; + for (const arm of arms) { + const found = propertyNode(arm as Record, key); + if (found) return found; + } + } + return undefined; +} + +/** The default the type's JSON Schema declares at `path`, or `undefined`. */ +export function schemaDefaultAt(schema: unknown, path: string): unknown { + const node = schemaNodeAt(schema, path); + return node && 'default' in node ? node.default : undefined; +} + +function isEmpty(value: unknown): boolean { + return value == null || value === '' || (Array.isArray(value) && value.length === 0); +} + +function scalarText(value: unknown): string | undefined { + if (typeof value === 'string') return value; + if (typeof value === 'number' || typeof value === 'bigint') return String(value); + if (typeof value === 'boolean') return value ? '✓' : '✗'; + return undefined; +} + +/** Draw one cell by the column's declared renderer. */ +export function renderListCell(type: string | undefined, value: unknown): React.ReactNode { + if (type === 'count') { + if (Array.isArray(value)) return value.length; + if (value && typeof value === 'object') return Object.keys(value).length; + return value == null ? : 0; + } + if (isEmpty(value)) return ; + switch (type) { + case 'boolean': + return value ? '✓' : '✗'; + case 'badge': + return ( + + {scalarText(value) ?? JSON.stringify(value)} + + ); + case 'list': + return (Array.isArray(value) ? value : [value]).map((v) => scalarText(v) ?? JSON.stringify(v)).join(', '); + case 'summary': { + if (value && typeof value === 'object' && !Array.isArray(value)) { + const parts = Object.values(value as Record) + .map(scalarText) + .filter((v): v is string => v !== undefined && v !== ''); + if (parts.length > 0) return parts.join(' · '); + } + return scalarText(value) ?? JSON.stringify(value); + } + default: { + const text = scalarText(value); + if (text !== undefined) return text; + return {JSON.stringify(value).slice(0, 60)}; + } + } +} + +/** + * The list page's columns from a served list layout, or `undefined` when the + * type serves none (the caller then falls back to the console's own columns). + */ +export function servedListColumns( + list: MetadataListView | undefined, + schema: Record | undefined, + cells?: Readonly>, +): ListColumns | undefined { + if (!list || !Array.isArray(list.columns) || list.columns.length === 0) return undefined; + return list.columns.map((column) => { + const override = cells?.[column.field]; + const fallback = schemaDefaultAt(schema, column.field); + const valueOf = (item: Record) => { + const value = valueAtPath(item, column.field); + return value === undefined ? fallback : value; + }; + return { + key: column.field, + label: typeof column.label === 'string' && column.label ? column.label : column.field, + labelLocalized: true, + ...(override?.width ? { width: override.width } : {}), + render: (_value: unknown, item: Record) => + override?.render ? override.render(valueOf(item), item) : renderListCell(column.type, valueOf(item)), + }; + }); +} + +/** `base`, then each of the console's extra columns whose key `base` does not already show. */ +export function withExtraColumns(base: ListColumns, extra: ListColumns | undefined): ListColumns { + if (!extra || extra.length === 0) return base; + const shown = new Set(base.map((c) => c.key)); + return [...base, ...extra.filter((c) => !shown.has(c.key))]; +} diff --git a/ui/packages/app-shell/src/views/metadata-admin/useMetadata.ts b/ui/packages/app-shell/src/views/metadata-admin/useMetadata.ts index b506b259d93..a84ad1fc932 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/useMetadata.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/useMetadata.ts @@ -25,6 +25,7 @@ import { createConsoleMetadataClient } from './metadataClientFactory.js'; import { dropPublishedViewList, installViewListDrop } from './viewListDrop.js'; import { emitSaveAdvisories, type TranslateFn } from '../../providers/saveAdvisoryToast.js'; import type { FormViewSpec } from './form-spec.js'; +import type { MetadataListView } from '@objectstack/spec/ui'; /** * A declarative **type-level** action surfaced on a metadata type by the @@ -119,6 +120,12 @@ export interface RichMetadataTypeEntry { * refuses one with no member source instead of assuming `fields`. */ form?: FormViewSpec; + /** + * The type's Studio list layout (objectstack#36860, the spec's + * `METADATA_LIST_REGISTRY`): its columns, headers in the request locale. + * Absent for a type with no declared list. Read by `servedListColumns`. + */ + list?: MetadataListView; /** UI hints (icon, color, etc.) the framework may include. */ ui?: Record; } From bebf96fc5621eb7aa6573dccbf7977c81c457e40 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 05:59:44 +0000 Subject: [PATCH 03/10] feat(spec): serve metadata list columns on /meta/types, hook first Trim the list registry to hook for the first half of the card (the other 26 types, their bundle leaves and the nine console moves follow in the second half), keep the console declarations as they were, regenerate the spec baselines and add the changeset. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzg7mFFG5b13DcQ93kf --- .changeset/36860-metadata-list-columns.md | 22 +++ content/docs/references/api/protocol.mdx | 1 + content/docs/references/index.mdx | 10 +- content/docs/references/ui/view.mdx | 81 ++++++++- packages/spec/api-surface/system.json | 3 + packages/spec/api-surface/ui.json | 10 ++ packages/spec/authorable-surface/ui.json | 5 + packages/spec/declaration-map/ui.json | 6 + packages/spec/export-origins/system.json | 3 + packages/spec/export-origins/ui.json | 10 ++ packages/spec/json-schema.manifest/ui.json | 3 + .../spec/src/system/metadata-list-registry.ts | 162 +----------------- .../metadata-list-zod-reconciliation.test.ts | 9 +- packages/spec/src/ui/view.zod.ts | 2 + .../src/services/builtinComponents.tsx | 71 ++++++-- ...eListPage.servedListColumns-36860.test.tsx | 36 ++-- .../src/views/metadata-admin/anchors.ts | 37 +++- 17 files changed, 243 insertions(+), 228 deletions(-) create mode 100644 .changeset/36860-metadata-list-columns.md diff --git a/.changeset/36860-metadata-list-columns.md b/.changeset/36860-metadata-list-columns.md new file mode 100644 index 00000000000..316bfb5e14d --- /dev/null +++ b/.changeset/36860-metadata-list-columns.md @@ -0,0 +1,22 @@ +--- +'@objectstack/spec': minor +'@objectstack/metadata-protocol': minor +'@objectstack/rest': minor +'@objectstack/lint': minor +'@object-ui/app-shell': minor +--- + +feat(spec): declare a metadata type's Studio list columns in the spec and serve them on `/meta/types` + +Clause-②: yes (widening: new exported schemas and a new optional `list` on each `/meta/types` entry) +Metadata-protocol: added +Skills-docs: none — no skill under `skills/**` teaches Studio's metadata list columns; `skills/objectstack-ui/SKILL.md` names `entries[].schema` only, which is unchanged + +Which columns Studio's generic list shows for a metadata type is now declared in the spec, beside the type's form, instead of in console code: + +- **Spec.** `MetadataListViewSchema` is a list layout bound to the type's own schema (`data: { provider: 'schema', schemaId }`) with its `columns`; each `MetadataListColumnSchema` names a key of that schema or a dotted path into it, a header, and a cell renderer (`MetadataListCellTypeSchema`: `text`, `badge`, `boolean`, `count`, `list`, `summary`). `defineList({ schemaId, columns })` builds one and refuses an unknown renderer, an empty column list and any `ListColumn` key outside `field` / `label` / `type`. `METADATA_LIST_REGISTRY` (`@objectstack/spec/system`) is the list counterpart of `METADATA_FORM_REGISTRY`; this release declares `hook`, and a type with no entry keeps Studio's default list. A reconciliation test refuses a column naming a key the type's schema does not declare (or declares retired, or as an overlay `_` key) and a header that differs from the form field label of the same path. +- **Serve.** `getMetaTypes()` serves the registry entry as `list` on the type's `/meta/types` row, next to `form`; `GetMetaTypesResponseSchema` declares it. The REST handler translates each header through the type's form field slot, `metadataForms..fields..label`, so a column and the form field of the same key read the same words. `resolveMetadataListLabels` (`@objectstack/spec/system`) does the lookup. +- **i18n.** `os i18n extract` emits that slot for every column whose path the type's form does not already label, with the column's header as the English source. Every `hook` header reuses a form label, so no bundle changes here. +- **Console.** Studio's generic list reads the served columns first: the served list, else the console's own `listColumns`, else name / label / description. A served header is shown as served, already in the reader's language. A key the stored row leaves out shows the default the type's JSON Schema declares there, the value the runtime uses. The console can still draw a served column's cell its own way (`listCells`) and append values the server stamps on a row that are not schema keys (`listExtraColumns`). + +New exports: `@objectstack/spec` adds `MetadataListCellTypeSchema`, `MetadataListColumnSchema`, `MetadataListViewSchema`, `defineList` and their types (`ui`), and `METADATA_LIST_REGISTRY`, `MetadataListType` and `resolveMetadataListLabels` (`system`). Nothing that was accepted before is refused, and a client that ignores `list` sees the `/meta/types` it saw before. diff --git a/content/docs/references/api/protocol.mdx b/content/docs/references/api/protocol.mdx index fc5064c4861..5190c1da149 100644 --- a/content/docs/references/api/protocol.mdx +++ b/content/docs/references/api/protocol.mdx @@ -1714,6 +1714,7 @@ One changed key path of the pending draft, and the last write that changed it. | **domain** | `Enum<'data' \| 'ui' \| 'automation' \| 'system' \| 'security' \| 'ai'>` | ✅ | Protocol domain | | **overrideSource** | `Enum<'registry' \| 'env'>` | ✅ | Whether allowEnvironmentOverlay comes from the static registry or is elevated by the OS_METADATA_WRITABLE environment variable | | **createSeed** | `any` | optional | Authoritative minimal valid create seed for this type — Studio/CLI/API derive create defaults from it (single source of truth in @objectstack/spec). Absent for canvas-create types whose shape is built interactively. | +| **list** | `{ data?: object \| object \| object; columns: object[] }` | optional | Studio list layout of this type: the columns its metadata list shows, each naming a key of the type schema, headers in the request locale. Absent for a type with no declared list, which Studio lists by name, label and description. | --- diff --git a/content/docs/references/index.mdx b/content/docs/references/index.mdx index e21f7d0c705..11ae8323d2a 100644 --- a/content/docs/references/index.mdx +++ b/content/docs/references/index.mdx @@ -1,7 +1,7 @@ --- title: Protocol reference — every schema by module navTitle: Protocol Reference -description: Every schema published by @objectstack/spec — 1714 schemas across 14 protocol modules +description: Every schema published by @objectstack/spec — 1717 schemas across 14 protocol modules --- {/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */} @@ -33,8 +33,8 @@ counts are sums of the rows they head. Regenerate with | [Shared Protocol](/docs/references/shared) | 10 | 31 | Primitives used across every protocol — identifiers, HTTP, expressions, error maps, enums. | | [Studio Protocol](/docs/references/studio) | 3 | 35 | Studio designer metadata — the authoring surfaces for the protocols above. | | [System Protocol](/docs/references/system) | 40 | 298 | The runtime environment — logging, jobs, cache, metrics, notifications, i18n and compliance. | -| [UI Protocol](/docs/references/ui) | 16 | 181 | Apps, pages, views, dashboards, reports, actions and themes — the ObjectUI layer. | -| **Total** | **219** | **1714** | 14 protocol modules | +| [UI Protocol](/docs/references/ui) | 16 | 184 | Apps, pages, views, dashboards, reports, actions and themes — the ObjectUI layer. | +| **Total** | **219** | **1717** | 14 protocol modules | --- @@ -386,7 +386,7 @@ The runtime environment — logging, jobs, cache, metrics, notifications, i18n a ## UI Protocol -**Source:** `packages/spec/src/ui/` · **Import:** `@objectstack/spec/ui` · **16 pages, 181 schemas** +**Source:** `packages/spec/src/ui/` · **Import:** `@objectstack/spec/ui` · **16 pages, 184 schemas** Apps, pages, views, dashboards, reports, actions and themes — the ObjectUI layer. @@ -407,7 +407,7 @@ Apps, pages, views, dashboards, reports, actions and themes — the ObjectUI lay | [`report.zod.ts`](/docs/references/ui/report) | `JoinedReportBlock`, `Report`, `ReportChart`, `ReportSort`, `ReportType` | | [`responsive.zod.ts`](/docs/references/ui/responsive) | `ResponsiveStyles`, `StyleMap` | | [`sharing.zod.ts`](/docs/references/ui/sharing) | `SharingConfig` | -| [`view.zod.ts`](/docs/references/ui/view) | `AddRecordConfig`, `AppearanceConfig`, `CalendarConfig`, `ColumnPrefix`, `ColumnSummary`, `ColumnSummaryConfig`, `EmptyState`, `FormButtonConfig`, `FormField`, `FormSection`, `FormSelectOption`, `FormView`, `GalleryConfig`, `GanttConfig`, `GanttQuickFilter`, `GroupingConfig`, `GroupingField`, `HttpMethodSubset`, `HttpRequest`, `KanbanConfig`, `KanbanLaneSummary`, `ListChartConfig`, `ListColumn`, `ListMapConfig`, `ListView`, `NavigationConfig`, `NavigationMode`, `ObjectListView`, `ObjectUserFilters`, `PaginationConfig`, `RowColorConfig`, `RowHeight`, `SelectionConfig`, `TimelineConfig`, `TimesheetConfig`, `TreeConfig`, `UserActionsConfig`, `UserFilterField`, `UserFilters`, `View`, `ViewData`, `ViewFilterElement`, `ViewFilterOrGroup`, `ViewFilterRule`, `ViewItem`, `ViewItemName`, `ViewItemWire`, `ViewKind`, `ViewScope`, `ViewSharing`, `ViewTab`, `VisualizationType` | +| [`view.zod.ts`](/docs/references/ui/view) | `AddRecordConfig`, `AppearanceConfig`, `CalendarConfig`, `ColumnPrefix`, `ColumnSummary`, `ColumnSummaryConfig`, `EmptyState`, `FormButtonConfig`, `FormField`, `FormSection`, `FormSelectOption`, `FormView`, `GalleryConfig`, `GanttConfig`, `GanttQuickFilter`, `GroupingConfig`, `GroupingField`, `HttpMethodSubset`, `HttpRequest`, `KanbanConfig`, `KanbanLaneSummary`, `ListChartConfig`, `ListColumn`, `ListMapConfig`, `ListView`, `MetadataListCellType`, `MetadataListColumn`, `MetadataListView`, `NavigationConfig`, `NavigationMode`, `ObjectListView`, `ObjectUserFilters`, `PaginationConfig`, `RowColorConfig`, `RowHeight`, `SelectionConfig`, `TimelineConfig`, `TimesheetConfig`, `TreeConfig`, `UserActionsConfig`, `UserFilterField`, `UserFilters`, `View`, `ViewData`, `ViewFilterElement`, `ViewFilterOrGroup`, `ViewFilterRule`, `ViewItem`, `ViewItemName`, `ViewItemWire`, `ViewKind`, `ViewScope`, `ViewSharing`, `ViewTab`, `VisualizationType` | --- diff --git a/content/docs/references/ui/view.mdx b/content/docs/references/ui/view.mdx index 79057ea8406..ff73f258cf3 100644 --- a/content/docs/references/ui/view.mdx +++ b/content/docs/references/ui/view.mdx @@ -59,8 +59,8 @@ nothing. The one item-name grammar itself lives in ## TypeScript Usage ```typescript -import { AddRecordConfigSchema, AppearanceConfigSchema, CalendarConfigSchema, ColumnPrefixSchema, ColumnSummarySchema, ColumnSummaryConfigSchema, EmptyStateSchema, FormButtonConfigSchema, FormFieldSchema, FormSectionSchema, FormSelectOptionSchema, FormViewSchema, GalleryConfigSchema, GanttConfigSchema, GanttQuickFilterSchema, GroupingConfigSchema, GroupingFieldSchema, HttpMethodSubsetSchema, HttpRequestSchema, KanbanConfigSchema, KanbanLaneSummarySchema, ListChartConfigSchema, ListColumnSchema, ListMapConfigSchema, ListViewSchema, NavigationConfigSchema, NavigationModeSchema, ObjectListViewSchema, ObjectUserFiltersSchema, PaginationConfigSchema, RowColorConfigSchema, RowHeightSchema, SelectionConfigSchema, TimelineConfigSchema, TimesheetConfigSchema, TreeConfigSchema, UserActionsConfigSchema, UserFilterFieldSchema, UserFiltersSchema, ViewSchema, ViewDataSchema, ViewFilterElementSchema, ViewFilterOrGroupSchema, ViewFilterRuleSchema, ViewItemSchema, ViewItemNameSchema, ViewItemWireSchema, ViewKindSchema, ViewScopeSchema, ViewSharingSchema, ViewTabSchema, VisualizationTypeSchema } from '@objectstack/spec/ui'; -import type { AddRecordConfig, AppearanceConfig, CalendarConfig, ColumnPrefix, ColumnSummary, ColumnSummaryConfig, EmptyState, FormButtonConfig, FormField, FormSection, FormSelectOption, FormView, GalleryConfig, GanttConfig, GanttQuickFilter, GroupingConfig, HttpMethodSubset, HttpRequest, KanbanConfig, KanbanLaneSummary, ListChartConfig, ListColumn, ListMapConfig, ListView, NavigationConfig, NavigationMode, PaginationConfig, RowColorConfig, RowHeight, SelectionConfig, TimelineConfig, TimesheetConfig, TreeConfig, UserActionsConfig, UserFilterField, UserFilters, View, ViewData, ViewFilterElement, ViewFilterOrGroup, ViewFilterRule, ViewItem, ViewItemName, ViewItemWire, ViewKind, ViewScope, ViewSharing, ViewTab, VisualizationType } from '@objectstack/spec/ui'; +import { AddRecordConfigSchema, AppearanceConfigSchema, CalendarConfigSchema, ColumnPrefixSchema, ColumnSummarySchema, ColumnSummaryConfigSchema, EmptyStateSchema, FormButtonConfigSchema, FormFieldSchema, FormSectionSchema, FormSelectOptionSchema, FormViewSchema, GalleryConfigSchema, GanttConfigSchema, GanttQuickFilterSchema, GroupingConfigSchema, GroupingFieldSchema, HttpMethodSubsetSchema, HttpRequestSchema, KanbanConfigSchema, KanbanLaneSummarySchema, ListChartConfigSchema, ListColumnSchema, ListMapConfigSchema, ListViewSchema, MetadataListCellTypeSchema, MetadataListColumnSchema, MetadataListViewSchema, NavigationConfigSchema, NavigationModeSchema, ObjectListViewSchema, ObjectUserFiltersSchema, PaginationConfigSchema, RowColorConfigSchema, RowHeightSchema, SelectionConfigSchema, TimelineConfigSchema, TimesheetConfigSchema, TreeConfigSchema, UserActionsConfigSchema, UserFilterFieldSchema, UserFiltersSchema, ViewSchema, ViewDataSchema, ViewFilterElementSchema, ViewFilterOrGroupSchema, ViewFilterRuleSchema, ViewItemSchema, ViewItemNameSchema, ViewItemWireSchema, ViewKindSchema, ViewScopeSchema, ViewSharingSchema, ViewTabSchema, VisualizationTypeSchema } from '@objectstack/spec/ui'; +import type { AddRecordConfig, AppearanceConfig, CalendarConfig, ColumnPrefix, ColumnSummary, ColumnSummaryConfig, EmptyState, FormButtonConfig, FormField, FormSection, FormSelectOption, FormView, GalleryConfig, GanttConfig, GanttQuickFilter, GroupingConfig, HttpMethodSubset, HttpRequest, KanbanConfig, KanbanLaneSummary, ListChartConfig, ListColumn, ListMapConfig, ListView, MetadataListCellType, MetadataListColumn, MetadataListView, NavigationConfig, NavigationMode, PaginationConfig, RowColorConfig, RowHeight, SelectionConfig, TimelineConfig, TimesheetConfig, TreeConfig, UserActionsConfig, UserFilterField, UserFilters, View, ViewData, ViewFilterElement, ViewFilterOrGroup, ViewFilterRule, ViewItem, ViewItemName, ViewItemWire, ViewKind, ViewScope, ViewSharing, ViewTab, VisualizationType } from '@objectstack/spec/ui'; // Validate data const result = AddRecordConfigSchema.parse(data); @@ -1200,6 +1200,83 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma | **role** | `string` | optional | WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert") | +--- + +## MetadataListCellType + +How a metadata list cell draws its value + +### Allowed Values + +* `text` +* `badge` +* `boolean` +* `count` +* `list` +* `summary` + + +--- + +## MetadataListColumn + +One column of a metadata type list + +### Properties + +| Property | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| **field** | `string` | ✅ | Key of the metadata type's schema: a top-level key, or a dotted path into it | +| **label** | `string \| Record` | optional | Display label override | +| **type** | `Enum<'text' \| 'badge' \| 'boolean' \| 'count' \| 'list' \| 'summary'>` | optional | Cell renderer; `text` when absent | + + +--- + +## MetadataListView + +List layout of a metadata type: its schema binding and its columns + +### Properties + +| Property | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| **data** | `{ provider: 'object'; object: string } \| { provider: 'value'; items: any[] } \| { provider: 'schema'; schemaId: string; schema?: Record }` | optional | Data source configuration (defaults to "object" provider) | +| **columns** | `{ field: string; label?: string \| Record; type?: Enum<'text' \| 'badge' \| 'boolean' \| 'count' \| 'list' \| 'summary'> }[]` | ✅ | Columns of the list, in display order | + +### Nested Shape: `MetadataListView.data[provider='object']` + +| Property | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| **provider** | `'object'` | ✅ | | +| **object** | `string` | ✅ | Target object name | + +### Nested Shape: `MetadataListView.data[provider='value']` + +| Property | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| **provider** | `'value'` | ✅ | | +| **items** | `any[]` | ✅ | Static data array | + +### Nested Shape: `MetadataListView.data[provider='schema']` + +| Property | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| **provider** | `'schema'` | ✅ | | +| **schemaId** | `string` | ✅ | Schema identifier — typically the metadata type name | +| **schema** | `Record` | optional | Inline JSON Schema (Draft 2020-12). Optional when schemaId is resolvable. | + +### Nested Shape: `MetadataListView.columns[number]` + +One column of a metadata type list + +| Property | Type | Required | Description | +| :--- | :--- | :--- | :--- | +| **field** | `string` | ✅ | Key of the metadata type's schema: a top-level key, or a dotted path into it | +| **label** | `string \| Record` | optional | Display label override | +| **type** | `Enum<'text' \| 'badge' \| 'boolean' \| 'count' \| 'list' \| 'summary'>` | optional | Cell renderer; `text` when absent | + + --- ## NavigationConfig diff --git a/packages/spec/api-surface/system.json b/packages/spec/api-surface/system.json index 588c3b5a96b..16e1d3e81f4 100644 --- a/packages/spec/api-surface/system.json +++ b/packages/spec/api-surface/system.json @@ -350,6 +350,7 @@ "MCP_DOOR_TOOL_NAMES (const)", "MCP_FILE_TOOL_NAMES (const)", "METADATA_FORM_REGISTRY (const)", + "METADATA_LIST_REGISTRY (const)", "MIGRATION_JOURNAL_KINDS (const)", "MIGRATION_JOURNAL_OBJECT (const)", "MappingLike (interface)", @@ -375,6 +376,7 @@ "MetadataHistoryRetentionPolicy (type)", "MetadataHistoryRetentionPolicyParsed (type)", "MetadataHistoryRetentionPolicySchema (const)", + "MetadataListType (type)", "MetadataLoadOptions (type)", "MetadataLoadOptionsSchema (const)", "MetadataLoadResult (type)", @@ -917,6 +919,7 @@ "resolveLocaleAmong (function)", "resolveMetadataFormLabels (function)", "resolveMetadataFormSchemaTitles (function)", + "resolveMetadataListLabels (function)", "resolveMetadataTypeDescription (function)", "resolveMetadataTypeLabel (function)", "resolveObjectFieldLabels (function)", diff --git a/packages/spec/api-surface/ui.json b/packages/spec/api-surface/ui.json index 8f67ffa931b..2c045b605a3 100644 --- a/packages/spec/api-surface/ui.json +++ b/packages/spec/api-surface/ui.json @@ -291,6 +291,15 @@ "ListViewGroupQuerySource (interface)", "ListViewParsed (type)", "ListViewSchema (const)", + "MetadataListCellType (type)", + "MetadataListCellTypeParsed (type)", + "MetadataListCellTypeSchema (const)", + "MetadataListColumn (type)", + "MetadataListColumnParsed (type)", + "MetadataListColumnSchema (const)", + "MetadataListView (type)", + "MetadataListViewParsed (type)", + "MetadataListViewSchema (const)", "NavigationArea (type)", "NavigationAreaParsed (type)", "NavigationAreaSchema (const)", @@ -572,6 +581,7 @@ "defineApp (function)", "defineDataset (function)", "defineForm (function)", + "defineList (function)", "definePage (function)", "defineReport (function)", "defineView (function)", diff --git a/packages/spec/authorable-surface/ui.json b/packages/spec/authorable-surface/ui.json index a510f9427e9..a2eb1f182f8 100644 --- a/packages/spec/authorable-surface/ui.json +++ b/packages/spec/authorable-surface/ui.json @@ -800,6 +800,11 @@ "ui/ListView:type", "ui/ListView:userActions", "ui/ListView:userFilters", + "ui/MetadataListColumn:field", + "ui/MetadataListColumn:label", + "ui/MetadataListColumn:type", + "ui/MetadataListView:columns", + "ui/MetadataListView:data", "ui/NavigationArea:description", "ui/NavigationArea:icon", "ui/NavigationArea:id", diff --git a/packages/spec/declaration-map/ui.json b/packages/spec/declaration-map/ui.json index bee4d67f93b..758905e105e 100644 --- a/packages/spec/declaration-map/ui.json +++ b/packages/spec/declaration-map/ui.json @@ -181,6 +181,12 @@ "ListMapConfigSchema": "ui/ListMapConfig", "ListView": "ui/ListView", "ListViewSchema": "ui/ListView", + "MetadataListCellType": "ui/MetadataListCellType", + "MetadataListCellTypeSchema": "ui/MetadataListCellType", + "MetadataListColumn": "ui/MetadataListColumn", + "MetadataListColumnSchema": "ui/MetadataListColumn", + "MetadataListView": "ui/MetadataListView", + "MetadataListViewSchema": "ui/MetadataListView", "NavigationArea": "ui/NavigationArea", "NavigationAreaSchema": "ui/NavigationArea", "NavigationConfig": "ui/NavigationConfig", diff --git a/packages/spec/export-origins/system.json b/packages/spec/export-origins/system.json index 5693886471c..e638da027a2 100644 --- a/packages/spec/export-origins/system.json +++ b/packages/spec/export-origins/system.json @@ -337,6 +337,7 @@ "MCP_DOOR_TOOL_NAMES": "src/system/constants/platform-tool-names.ts#MCP_DOOR_TOOL_NAMES (const)", "MCP_FILE_TOOL_NAMES": "src/system/constants/platform-tool-names.ts#MCP_FILE_TOOL_NAMES (const)", "METADATA_FORM_REGISTRY": "src/system/metadata-form-registry.ts#METADATA_FORM_REGISTRY (const)", + "METADATA_LIST_REGISTRY": "src/system/metadata-list-registry.ts#METADATA_LIST_REGISTRY (const)", "MIGRATION_JOURNAL_KINDS": "src/system/migration.zod.ts#MIGRATION_JOURNAL_KINDS (const)", "MIGRATION_JOURNAL_OBJECT": "src/system/migration.zod.ts#MIGRATION_JOURNAL_OBJECT (const)", "MappingLike": "src/system/i18n-resolver.ts#MappingLike (interface)", @@ -362,6 +363,7 @@ "MetadataHistoryRetentionPolicy": "src/system/metadata-persistence.zod.ts#MetadataHistoryRetentionPolicy (type)", "MetadataHistoryRetentionPolicyParsed": "src/system/metadata-persistence.zod.ts#MetadataHistoryRetentionPolicyParsed (type)", "MetadataHistoryRetentionPolicySchema": "src/system/metadata-persistence.zod.ts#MetadataHistoryRetentionPolicySchema (const)", + "MetadataListType": "src/system/metadata-list-registry.ts#MetadataListType (type)", "MetadataLoadOptions": "src/system/metadata-persistence.zod.ts#MetadataLoadOptions (type)", "MetadataLoadOptionsSchema": "src/system/metadata-persistence.zod.ts#MetadataLoadOptionsSchema (const)", "MetadataLoadResult": "src/system/metadata-persistence.zod.ts#MetadataLoadResult (type)", @@ -877,6 +879,7 @@ "resolveLocaleAmong": "src/system/i18n-resolver.ts#resolveLocaleAmong (function)", "resolveMetadataFormLabels": "src/system/i18n-resolver.ts#resolveMetadataFormLabels (function)", "resolveMetadataFormSchemaTitles": "src/system/i18n-resolver.ts#resolveMetadataFormSchemaTitles (function)", + "resolveMetadataListLabels": "src/system/i18n-resolver.ts#resolveMetadataListLabels (function)", "resolveMetadataTypeDescription": "src/system/i18n-resolver.ts#resolveMetadataTypeDescription (function)", "resolveMetadataTypeLabel": "src/system/i18n-resolver.ts#resolveMetadataTypeLabel (function)", "resolveObjectFieldLabels": "src/system/i18n-resolver.ts#resolveObjectFieldLabels (function)", diff --git a/packages/spec/export-origins/ui.json b/packages/spec/export-origins/ui.json index 656f4f5abf5..16278e9e5be 100644 --- a/packages/spec/export-origins/ui.json +++ b/packages/spec/export-origins/ui.json @@ -285,6 +285,15 @@ "ListViewGroupQuerySource": "src/ui/view-grouping-query.ts#ListViewGroupQuerySource (interface)", "ListViewParsed": "src/ui/view.zod.ts#ListViewParsed (type)", "ListViewSchema": "src/ui/view.zod.ts#ListViewSchema (const)", + "MetadataListCellType": "src/ui/view.zod.ts#MetadataListCellType (type)", + "MetadataListCellTypeParsed": "src/ui/view.zod.ts#MetadataListCellTypeParsed (type)", + "MetadataListCellTypeSchema": "src/ui/view.zod.ts#MetadataListCellTypeSchema (const)", + "MetadataListColumn": "src/ui/view.zod.ts#MetadataListColumn (type)", + "MetadataListColumnParsed": "src/ui/view.zod.ts#MetadataListColumnParsed (type)", + "MetadataListColumnSchema": "src/ui/view.zod.ts#MetadataListColumnSchema (const)", + "MetadataListView": "src/ui/view.zod.ts#MetadataListView (type)", + "MetadataListViewParsed": "src/ui/view.zod.ts#MetadataListViewParsed (type)", + "MetadataListViewSchema": "src/ui/view.zod.ts#MetadataListViewSchema (const)", "NavigationArea": "src/ui/app.zod.ts#NavigationArea (type)", "NavigationAreaParsed": "src/ui/app.zod.ts#NavigationAreaParsed (type)", "NavigationAreaSchema": "src/ui/app.zod.ts#NavigationAreaSchema (const)", @@ -555,6 +564,7 @@ "defineApp": "src/ui/app.zod.ts#defineApp (function)", "defineDataset": "src/ui/dataset.zod.ts#defineDataset (function)", "defineForm": "src/ui/view.zod.ts#defineForm (function)", + "defineList": "src/ui/view.zod.ts#defineList (function)", "definePage": "src/ui/page.zod.ts#definePage (function)", "defineReport": "src/ui/report.zod.ts#defineReport (function)", "defineView": "src/ui/view.zod.ts#defineView (function)", diff --git a/packages/spec/json-schema.manifest/ui.json b/packages/spec/json-schema.manifest/ui.json index 49e425745dc..3a43042256a 100644 --- a/packages/spec/json-schema.manifest/ui.json +++ b/packages/spec/json-schema.manifest/ui.json @@ -99,6 +99,9 @@ "ui/ListColumn", "ui/ListMapConfig", "ui/ListView", + "ui/MetadataListCellType", + "ui/MetadataListColumn", + "ui/MetadataListView", "ui/NavigationArea", "ui/NavigationConfig", "ui/NavigationContribution", diff --git a/packages/spec/src/system/metadata-list-registry.ts b/packages/spec/src/system/metadata-list-registry.ts index 805c415d3f0..2c9775e8030 100644 --- a/packages/spec/src/system/metadata-list-registry.ts +++ b/packages/spec/src/system/metadata-list-registry.ts @@ -45,17 +45,7 @@ const DESCRIPTION = { field: 'description', label: 'Description' } as const; * ``` */ export const METADATA_LIST_REGISTRY: Readonly> = Object.freeze({ - // ── data ────────────────────────────────────────────────────────────── - object: defineList({ - schemaId: 'object', - columns: [NAME, LABEL, { field: 'pluralLabel', label: 'Plural Label' }, { field: 'fields', label: 'Fields', type: 'count' }, DESCRIPTION], - }), - field: defineList({ - schemaId: 'field', - // A field row's `object` is stamped by the server, not a `FieldSchema` - // key, so the console appends it as its own column. - columns: [NAME, { field: 'type', label: 'Type', type: 'badge' }, LABEL], - }), + // ── logic ───────────────────────────────────────────────────────────── hook: defineList({ schemaId: 'hook', columns: [ @@ -67,156 +57,6 @@ export const METADATA_LIST_REGISTRY: Readonly { const TYPES = Object.keys(METADATA_LIST_REGISTRY); describe('METADATA_LIST_REGISTRY ↔ the type schemas', () => { - it('declares a list for the first-batch types and the nine types the console used to declare', () => { - expect(TYPES.sort()).toEqual([ - 'action', 'agent', 'api', 'assignment_rule', 'book', 'dashboard', 'dataset', 'doc', - 'email_template', 'field', 'flow', 'hook', 'job', 'mapping', 'object', 'page', - 'permission', 'picklist', 'position', 'queue', 'report', 'seed', 'sharing_rule', - 'skill', 'tool', 'translation', 'view', - ]); + it('declares the list of each type it covers, hook first', () => { + expect(TYPES.sort()).toEqual(['hook']); }); it.each(TYPES)('%s: binds to its own type, which has a schema', (type) => { diff --git a/packages/spec/src/ui/view.zod.ts b/packages/spec/src/ui/view.zod.ts index aa3bfb68844..cbd6921db46 100644 --- a/packages/spec/src/ui/view.zod.ts +++ b/packages/spec/src/ui/view.zod.ts @@ -8421,6 +8421,8 @@ export type ListColumn = z.input; /** Post-parse shape of {@link ListColumn} — defaults applied, transforms run (ADR-0122). */ export type ListColumnParsed = z.infer; export type MetadataListCellType = z.input; +/** Post-parse shape of {@link MetadataListCellType} (ADR-0122). */ +export type MetadataListCellTypeParsed = z.infer; export type MetadataListColumn = z.input; /** Post-parse shape of {@link MetadataListColumn} — defaults applied, transforms run (ADR-0122). */ export type MetadataListColumnParsed = z.infer; diff --git a/ui/packages/app-shell/src/services/builtinComponents.tsx b/ui/packages/app-shell/src/services/builtinComponents.tsx index 985d69311bf..d986c460349 100644 --- a/ui/packages/app-shell/src/services/builtinComponents.tsx +++ b/ui/packages/app-shell/src/services/builtinComponents.tsx @@ -317,7 +317,11 @@ registerMetadataResource({ description: 'Domain entities — tables in the data model. Each object owns its fields, relationships, validations, and lifecycle hooks.', domain: 'data', searchableFields: ['name', 'label', 'description'], - // objectstack#36860 — the list columns are the spec's (`METADATA_LIST_REGISTRY`). + listColumns: [ + { key: 'name', label: 'Name', width: '25%' }, + { key: 'label', label: 'Label', width: '25%' }, + { key: 'description', label: 'Description' }, + ], // objectui#10202 — the editor is seeded from the SERVED object, where a // picklist-bound field carries `picklist` plus the options resolved from the // list; the authoring door refuses the two together. The saved body drops @@ -333,9 +337,12 @@ registerMetadataResource({ description: 'Columns attached to objects — name, type, validation, and storage settings.', domain: 'data', searchableFields: ['name', 'label', 'object', 'type'], - // objectstack#36860 — name / type / label are the spec's columns; a field - // row's `object` is stamped by the server, not a `FieldSchema` key. - listExtraColumns: [{ key: 'object', label: 'Object', width: '20%' }], + listColumns: [ + { key: 'name', label: 'Name', width: '25%' }, + { key: 'object', label: 'Object', width: '20%' }, + { key: 'type', label: 'Type', width: '15%' }, + { key: 'label', label: 'Label' }, + ], }); /* -------------------------------------------------------------------------- */ @@ -353,8 +360,12 @@ registerMetadataResource({ // objectui#7611 — no `managedBy` column: the registry serves no such key on a // permission set (measured on objectstack main), so it read "Custom" for every // set, the platform's own included. Provenance is the list's own Source badge, - // read from the served `_packageId` / `_provenance`. objectstack#36860 — the - // columns are the spec's. + // read from the served `_packageId` / `_provenance`. + listColumns: [ + { key: 'name', label: 'Name', width: '30%' }, + { key: 'label', label: 'Label', width: '30%' }, + { key: 'description', label: 'Description' }, + ], }); // objectstack#25333 — the position list says who holds each position and which @@ -373,9 +384,10 @@ registerMetadataResource({ // admits a live position create (`allowRuntimeCreate`); under `?package=` // the create stays a package draft (ADR-0086). createLive: true, - // objectstack#36860 — name / label / description are the spec's columns; the - // holder count and the granted sets are served beside each row. - listExtraColumns: [ + listColumns: [ + { key: 'name', label: 'Name', width: '20%' }, + { key: 'label', label: 'Label', width: '20%' }, + { key: 'description', label: 'Description' }, { key: '_holderCount', label: 'Holders', @@ -401,16 +413,20 @@ registerMetadataResource({ label: 'Views', description: 'Saved list / kanban / calendar / gantt configurations on top of an object.', domain: 'ui', - // objectstack#36860 — the columns are the spec's. - listCells: { - type: { + listColumns: [ + { key: 'name', label: 'Name', width: '30%' }, + { key: 'object', label: 'Object', width: '20%' }, + { + key: 'type', + label: 'Type', width: '15%', // Expanded ViewItems keep their display type under `config.type` // and only the list/form family at the top level — derive it so the // column shows "calendar" / "grid" / "form" instead of "—". render: (_v, item) => viewDisplayType(item) ?? '—', }, - }, + { key: 'label', label: 'Label' }, + ], // ADR-0017 — the framework exposes each view as a canonical first-class // ViewItem ({ name, object, viewKind, label, config }). The inspector and // preview read that shape directly (`draft.config`), so NO toDraft/fromDraft @@ -425,6 +441,11 @@ registerMetadataResource({ label: 'Dashboards', description: 'Composed dashboards with charts, KPIs, and tables.', domain: 'ui', + listColumns: [ + { key: 'name', label: 'Name', width: '30%' }, + { key: 'label', label: 'Label', width: '30%' }, + { key: 'description', label: 'Description' }, + ], }); /** @@ -454,6 +475,11 @@ registerMetadataResource({ label: 'Pages', description: 'Visual page layouts authored as JSON metadata.', domain: 'ui', + listColumns: [ + { key: 'name', label: 'Name', width: '30%' }, + { key: 'label', label: 'Label', width: '30%' }, + { key: 'route', label: 'Route' }, + ], fromDraft: pageSaveBody, }); @@ -469,10 +495,12 @@ registerMetadataResource({ description: 'Documentation navigation spine — ordered groups with membership derived over docs (glob/tag rules), plus an explicit pages override for curated order.', domain: 'system', searchableFields: ['name', 'label', 'description', 'slug'], - // objectstack#36860 — the columns are the spec's; the audience cell names - // the org default and a permission-set audience in words. - listCells: { - audience: { + listColumns: [ + { key: 'name', label: 'Name', width: '25%' }, + { key: 'label', label: 'Label', width: '25%' }, + { + key: 'audience', + label: 'Audience', width: '12%', render: (v) => v == null @@ -481,5 +509,12 @@ registerMetadataResource({ ? `permission set: ${(v as { permissionSet: string }).permissionSet}` : String(v), }, - }, + { + key: 'groups', + label: 'Groups', + width: '10%', + render: (v) => (Array.isArray(v) ? String(v.length) : '0'), + }, + { key: 'description', label: 'Description' }, + ], }); diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx index d81bd263922..f0a411428ee 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx @@ -24,6 +24,10 @@ import { render, cleanup, screen, within } from '@testing-library/react'; import '@testing-library/jest-dom'; import * as React from 'react'; import { MemoryRouter, Route, Routes } from 'react-router-dom'; +// Dynamic imports the page's anchors and editors reach, paid at collection +// rather than inside a case's clocked window. +import '@object-ui/plugin-detail'; +import '@objectstack/lint'; const HOOKS: Record[] = [ { name: 'stamp_owner', label: 'Stamp owner', object: 'account', events: ['beforeInsert', 'beforeUpdate'], async: true }, @@ -32,13 +36,11 @@ const HOOKS: Record[] = [ ]; const AGENTS: Record[] = [{ name: 'helper', label: 'Helper', model: { provider: 'openai', model: 'gpt-4o' } }]; const QUEUES: Record[] = [{ name: 'tier1', label: 'Tier 1', members: [{ type: 'user', id: 'a' }, { type: 'user', id: 'b' }] }]; -const VIEWS: Record[] = [ - { name: 'all_accounts', object: 'account', label: 'All accounts', viewKind: 'list', config: { type: 'kanban' } }, -]; +const SKILLS: Record[] = [{ name: 'triage', label: 'Triage', tools: ['a', 'b'] }]; const CLIENT = { list: async (type: string) => - type === 'hook' ? HOOKS : type === 'agent' ? AGENTS : type === 'queue' ? QUEUES : type === 'view' ? VIEWS : [], + type === 'hook' ? HOOKS : type === 'agent' ? AGENTS : type === 'queue' ? QUEUES : type === 'skill' ? SKILLS : [], }; // Headers as the server serves them to a zh-CN reader. @@ -96,19 +98,6 @@ const QUEUE_ENTRY = { }; // Control: a type that serves no list. const SKILL_ENTRY = { type: 'skill', label: 'Skill', allowEnvironmentOverlay: false, allowRuntimeCreate: true }; -const VIEW_ENTRY = { - type: 'view', - label: 'View', - allowEnvironmentOverlay: false, - allowRuntimeCreate: true, - list: { - data: { provider: 'schema', schemaId: 'view' }, - columns: [ - { field: 'name', label: 'Name' }, - { field: 'type', label: 'Type', type: 'badge' }, - ], - }, -}; vi.mock('./useMetadata', async (importOriginal) => ({ ...(await importOriginal>()), @@ -116,7 +105,7 @@ vi.mock('./useMetadata', async (importOriginal) => ({ useMetadataTypes: () => ({ loading: false, error: null, - entries: [HOOK_ENTRY, AGENT_ENTRY, QUEUE_ENTRY, SKILL_ENTRY, VIEW_ENTRY], + entries: [HOOK_ENTRY, AGENT_ENTRY, QUEUE_ENTRY, SKILL_ENTRY], }), })); @@ -153,7 +142,7 @@ afterEach(() => { function mount(type: string) { return render( - + } /> @@ -198,8 +187,8 @@ describe('the generic list reads the served columns (objectstack#36860)', () => it('a type serving no list keeps the default columns (control)', async () => { mount('skill'); const headers = await headersOf(); - expect(headers).toContain('Name'); - expect(headers).toContain('Description'); + // The setup list's default: label first (#27356), then description. + expect(headers.slice(0, 2)).toEqual(['Label', 'Description']); expect(headers).not.toContain('Tools'); }); @@ -208,9 +197,4 @@ describe('the generic list reads the served columns (objectstack#36860)', () => expect((await headersOf()).slice(0, 3)).toEqual(['Name', 'Members', 'Package']); expect((await rowOf('tier1')).slice(0, 2)).toEqual(['tier1', '2 people']); }); - - it('the view list keeps its derived display type through its cell override', async () => { - mount('view'); - expect((await rowOf('all_accounts')).slice(0, 2)).toEqual(['all_accounts', 'kanban']); - }); }); diff --git a/ui/packages/app-shell/src/views/metadata-admin/anchors.ts b/ui/packages/app-shell/src/views/metadata-admin/anchors.ts index d6e87cbb74c..c839973fd13 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/anchors.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/anchors.ts @@ -571,9 +571,26 @@ export function registerBuiltinAnchors(): void { // seed it as an empty record so the saved body validates. createDefaults: { fields: {} }, searchableFields: ['name', 'label', 'pluralLabel', 'description'], - // objectstack#36860 — the list columns are the spec's - // (`METADATA_LIST_REGISTRY`): name, label, plural label, field count, - // description. + listColumns: [ + { key: 'name', label: 'Name', width: '24%' }, + { key: 'label', label: 'Label', width: '22%' }, + { key: 'pluralLabel', label: 'Plural', width: '22%' }, + { + key: 'fields', + label: 'Fields', + width: '90px', + render: (value) => { + if (value == null) return '—'; + const count = Array.isArray(value) + ? value.length + : typeof value === 'object' + ? Object.keys(value as Record).length + : 0; + return count; + }, + }, + { key: 'description', label: 'Description' }, + ], }); // objectui#12982 — the declared sharing rules Setup lists read-only @@ -583,17 +600,19 @@ export function registerBuiltinAnchors(): void { type: 'sharing_rule', iconName: 'share-2', searchableFields: ['name', 'label', 'description', 'object'], - // objectstack#36860 — name / label / object / shared with / access level - // are the spec's columns; the declaring package is served beside each row. - listCells: { - sharedWith: { + listColumns: [ + { key: 'name', label: 'Name' }, + { key: 'label', label: 'Label' }, + { key: 'object', label: 'Object' }, + { + key: 'sharedWith', + label: 'Shared with', render: (value) => { const v = value as { type?: unknown; value?: unknown } | null | undefined; return v && typeof v === 'object' ? `${String(v.type ?? '')}: ${String(v.value ?? '')}` : '—'; }, }, - }, - listExtraColumns: [ + { key: 'accessLevel', label: 'Access' }, { key: '_packageId', label: 'Package', From e5477f472565e9a104a232cc855c862a4cbe104b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 06:07:18 +0000 Subject: [PATCH 04/10] test(rest,metadata-protocol): pin the served list layout and its translated headers Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzg7mFFG5b13DcQ93kf --- ...tocol.meta-types-list-layout-36860.test.ts | 82 +++++++++++ .../rest/src/meta-types-list-headers.test.ts | 131 ++++++++++++++++++ 2 files changed, 213 insertions(+) create mode 100644 packages/metadata-protocol/src/protocol.meta-types-list-layout-36860.test.ts create mode 100644 packages/rest/src/meta-types-list-headers.test.ts diff --git a/packages/metadata-protocol/src/protocol.meta-types-list-layout-36860.test.ts b/packages/metadata-protocol/src/protocol.meta-types-list-layout-36860.test.ts new file mode 100644 index 00000000000..e0b04a6524a --- /dev/null +++ b/packages/metadata-protocol/src/protocol.meta-types-list-layout-36860.test.ts @@ -0,0 +1,82 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36860 — `getMetaTypes()` serves each type's declared list layout + * (`METADATA_LIST_REGISTRY`) as `list` on its entry, beside `form`. + * + * - every registry type is served with its own layout, the object the spec + * froze, not a copy that could drift; + * - a type the registry does not cover carries no `list` key at all, so a + * client that reads it falls back to its own columns (the control). + */ +import { describe, expect, it } from 'vitest'; +// `./protocol.js` reaches `import('@objectstack/lint')`; pay its first load at +// collection, never inside a clocked case. +import '@objectstack/lint'; +import { + assertEngineDeleteDispatch, + assertEngineUpdateDispatch, + assertEngineFindOnePredicate, + type EngineFindOneQueryInput, +} from '@objectstack/metadata-core'; +import { DEFAULT_METADATA_TYPE_REGISTRY } from '@objectstack/spec/kernel'; +import { METADATA_LIST_REGISTRY } from '@objectstack/spec/system'; +import { ObjectStackProtocolImplementation } from './protocol.js'; + +const SERVED_TYPES = Array.from(new Set(DEFAULT_METADATA_TYPE_REGISTRY.map((e) => e.type))); + +function makeProtocol() { + const engine: any = { + async findOne(object: string, query?: EngineFindOneQueryInput) { + assertEngineFindOnePredicate(object, query); return null; + }, + async find() { return []; }, + async insert() { return { id: 'unused' }; }, + async update(_t: string, data: Record, opts?: Record) { + assertEngineUpdateDispatch(data, opts); + return { id: null }; + }, + async delete(_t: string, opts?: Record) { + assertEngineDeleteDispatch(opts); + return { deleted: 1 }; + }, + async count() { return 0; }, + async transaction(fn: (ctx: unknown) => Promise) { return fn(undefined); }, + async execute() { return {}; }, + async getObjectSchema() { return undefined; }, + registry: { + getRegisteredTypes: () => [...SERVED_TYPES], + registerItem: () => {}, + registerObject: () => {}, + unregisterItem: () => {}, + listItems: () => [], + getItem: () => undefined, + getArtifactItem: () => undefined, + }, + }; + return new ObjectStackProtocolImplementation(engine, () => new Map(), undefined) as any; +} + +describe('GET /meta/types serves the declared list layout (objectstack#36860)', () => { + it('serves every registry type with its own frozen layout', async () => { + const { entries } = await makeProtocol().getMetaTypes(); + const byType = new Map(entries.map((e: any) => [e.type, e])); + const declared = Object.keys(METADATA_LIST_REGISTRY); + expect(declared.length).toBeGreaterThan(0); + for (const type of declared) { + const entry = byType.get(type); + expect(entry, `${type} is served`).toBeDefined(); + expect(entry.list).toBe(METADATA_LIST_REGISTRY[type]); + } + expect(byType.get('hook').list.columns.map((c: any) => c.field)).toEqual([ + 'name', 'label', 'object', 'events', 'priority', 'async', 'description', + ]); + }); + + it('control — a type with no declared list carries no `list` key', async () => { + const { entries } = await makeProtocol().getMetaTypes(); + const undeclared = entries.filter((e: any) => !(e.type in METADATA_LIST_REGISTRY)); + expect(undeclared.length).toBeGreaterThan(0); + for (const entry of undeclared) expect(Object.prototype.hasOwnProperty.call(entry, 'list'), entry.type).toBe(false); + }); +}); diff --git a/packages/rest/src/meta-types-list-headers.test.ts b/packages/rest/src/meta-types-list-headers.test.ts new file mode 100644 index 00000000000..2a1923e8a68 --- /dev/null +++ b/packages/rest/src/meta-types-list-headers.test.ts @@ -0,0 +1,131 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36860 — `GET /meta` localises the headers of a type's served + * list layout (`entries[].list`) through the type's form field slot, + * `metadataForms..fields..label`, the slot the form field of the + * same key reads. + * + * The rule lives in `@objectstack/spec/system` (`resolveMetadataListLabels`); + * what is pinned here is the plumbing: `translateMetaTypesResponse` hands + * `entry.list` through it with the bundle and locale it hands `entry.form`. + */ + +import { describe, it, expect, vi } from 'vitest'; +import { RestServer } from './rest-server.js'; + +const LIST = () => ({ + data: { provider: 'schema', schemaId: 'hook' }, + columns: [ + { field: 'name', label: 'Name' }, + { field: 'events', label: 'Events', type: 'list' }, + { field: 'retryPolicy.maxRetries', label: 'Max Retries' }, + ], +}); + +const ZH_DATA = { + metadataForms: { + hook: { + label: '钩子', + fields: { + name: { label: '名称' }, + events: { label: '事件' }, + 'retryPolicy.maxRetries': { label: '最大重试次数' }, + }, + }, + }, +}; + +function i18nFor(bundles: Record) { + return { + getLocales: () => Object.keys(bundles), + getTranslations: (locale: string) => bundles[locale] ?? {}, + getDefaultLocale: () => 'en', + getFallbackLocale: () => 'en', + }; +} + +function mockServer() { + return { + get: vi.fn(), post: vi.fn(), put: vi.fn(), delete: vi.fn(), patch: vi.fn(), + use: vi.fn(), listen: vi.fn().mockResolvedValue(undefined), close: vi.fn().mockResolvedValue(undefined), + }; +} + +function mockRes() { + return { json: vi.fn(), status: vi.fn().mockReturnThis(), header: vi.fn(), send: vi.fn() }; +} + +function protocol() { + return { + getDiscovery: vi.fn().mockResolvedValue({ + version: 'v0', + routes: { data: '', metadata: '', ui: '', auth: '/auth' }, + }), + getMetaTypes: vi.fn(async () => ({ + entries: [ + { type: 'hook', label: 'Hook', list: LIST() }, + // Control: a type serving no list. + { type: 'skill', label: 'Skill' }, + ], + types: ['hook', 'skill'], + registered: ['hook', 'skill'], + })), + getMetaItems: vi.fn(async () => []), + getMetaItem: vi.fn(async () => undefined), + getMetaItemCached: undefined as any, + findData: vi.fn().mockResolvedValue([]), + }; +} + +function makeRest(i18n: any) { + const rest = new RestServer( + mockServer() as any, protocol() as any, { api: { requireAuth: false } } as any, + undefined, undefined, undefined, undefined, undefined, + undefined, undefined, undefined, undefined, undefined, + async () => i18n, + ); + (rest as any).resolveExecCtx = async () => ({ userId: 'u1', systemPermissions: [] }); + rest.registerRoutes(); + return rest; +} + +async function readTypes(rest: RestServer, locale: string | undefined): Promise { + const route = (rest as any).getRoutes().find((r: any) => r.method === 'GET' && r.path === '/api/v1/meta'); + if (!route) throw new Error('route not registered: GET /api/v1/meta'); + const res = mockRes(); + await route.handler( + { method: 'GET', params: {}, query: {}, body: {}, headers: locale ? { 'accept-language': locale } : {} }, + res, + ); + const calls = res.json.mock.calls; + return calls.length ? calls[calls.length - 1][0] : undefined; +} + +const headers = (entry: any) => entry.list.columns.map((c: any) => c.label); + +describe('GET /meta serves the list headers in the reader\'s language (objectstack#36860)', () => { + const bundles = () => ({ en: {}, 'zh-CN': ZH_DATA }); + + it('a zh-CN request names each column through its form field slot, dotted paths included', async () => { + const body = await readTypes(makeRest(i18nFor(bundles())), 'zh-CN'); + const entry = body.entries.find((e: any) => e.type === 'hook'); + expect(headers(entry)).toEqual(['名称', '事件', '最大重试次数']); + // Only the header is rewritten. + expect(entry.list.columns[1]).toEqual({ field: 'events', label: '事件', type: 'list' }); + expect(entry.list.data).toEqual({ provider: 'schema', schemaId: 'hook' }); + }); + + it('control — an en request keeps the declared headers, and a type serving no list gains none', async () => { + const body = await readTypes(makeRest(i18nFor(bundles())), 'en'); + expect(headers(body.entries.find((e: any) => e.type === 'hook'))).toEqual(['Name', 'Events', 'Max Retries']); + expect('list' in body.entries.find((e: any) => e.type === 'skill')).toBe(false); + }); + + it('control — the served list is not rewritten in place across requests', async () => { + const rest = makeRest(i18nFor(bundles())); + await readTypes(rest, 'zh-CN'); + const body = await readTypes(rest, 'en'); + expect(headers(body.entries.find((e: any) => e.type === 'hook'))).toEqual(['Name', 'Events', 'Max Retries']); + }); +}); From 597f70e74069d518950e6ea574de3ac32c71e2e1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 06:49:15 +0000 Subject: [PATCH 05/10] test: pay the objectql load at collection, record the new engine doubles Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzg7mFFG5b13DcQ93kf --- packages/rest/src/meta-types-list-headers.test.ts | 3 +++ scripts/engine-double-contract.pinned.json | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/packages/rest/src/meta-types-list-headers.test.ts b/packages/rest/src/meta-types-list-headers.test.ts index 2a1923e8a68..a75102b80d4 100644 --- a/packages/rest/src/meta-types-list-headers.test.ts +++ b/packages/rest/src/meta-types-list-headers.test.ts @@ -12,6 +12,9 @@ */ import { describe, it, expect, vi } from 'vitest'; +// The server's routes reach `import('@objectstack/objectql')`; pay its first +// load at collection, never inside a clocked case. +import '@objectstack/objectql'; import { RestServer } from './rest-server.js'; const LIST = () => ({ diff --git a/scripts/engine-double-contract.pinned.json b/scripts/engine-double-contract.pinned.json index a323e3980b2..27475b530e1 100644 --- a/scripts/engine-double-contract.pinned.json +++ b/scripts/engine-double-contract.pinned.json @@ -1396,6 +1396,21 @@ "verb": "update", "pinned": 1 }, + { + "file": "packages/metadata-protocol/src/protocol.meta-types-list-layout-36860.test.ts", + "verb": "delete", + "pinned": 1 + }, + { + "file": "packages/metadata-protocol/src/protocol.meta-types-list-layout-36860.test.ts", + "verb": "findOne", + "pinned": 1 + }, + { + "file": "packages/metadata-protocol/src/protocol.meta-types-list-layout-36860.test.ts", + "verb": "update", + "pinned": 1 + }, { "file": "packages/metadata-protocol/src/protocol.meta-types-mint-door-agreement.test.ts", "verb": "delete", From 2fe89a7959206e08fd39cbaacaf0f12e3e4575b1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 08:40:45 +0000 Subject: [PATCH 06/10] feat(spec): Studio list columns for 27 metadata types, translated on both doors Declare the list columns of the first-batch types and of the eight types the console declared itself, with their header leaves in the 11 platform bundles; move the console declarations into the spec; translate the runtime dispatcher's types listing through the function RestServer runs. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzg7mFFG5b13DcQ93kf --- .../36860-metadata-list-columns-batch.md | 17 ++ .../docs/protocol/kernel/i18n-standard.mdx | 9 +- .../i18n-walk.metadata-list-columns.test.ts | 52 +++++ .../ar.metadata-forms.generated.ts | 200 +++++++++++++++++- .../de.metadata-forms.generated.ts | 200 +++++++++++++++++- .../de.source-hashes.generated.ts | 10 + .../en.metadata-forms.generated.ts | 200 +++++++++++++++++- .../es-ES.metadata-forms.generated.ts | 200 +++++++++++++++++- .../fr.metadata-forms.generated.ts | 200 +++++++++++++++++- .../fr.source-hashes.generated.ts | 10 + .../ja-JP.metadata-forms.generated.ts | 200 +++++++++++++++++- .../ko.metadata-forms.generated.ts | 200 +++++++++++++++++- .../pt-BR.metadata-forms.generated.ts | 200 +++++++++++++++++- .../ru.metadata-forms.generated.ts | 200 +++++++++++++++++- .../zh-CN.metadata-forms.generated.ts | 200 +++++++++++++++++- .../zh-Hant.metadata-forms.generated.ts | 200 +++++++++++++++++- packages/rest/src/index.ts | 1 + packages/rest/src/meta-item-read-gate.ts | 47 ++++ packages/rest/src/rest-server.ts | 42 +--- ...eta-types-translation-parity-36886.test.ts | 122 +++++++++++ packages/runtime/src/domains/meta.ts | 19 +- .../spec/src/system/metadata-list-registry.ts | 162 +++++++++++++- .../metadata-list-zod-reconciliation.test.ts | 9 +- .../src/services/builtinComponents.tsx | 71 ++----- ...eListPage.servedListColumns-36860.test.tsx | 26 ++- .../src/views/metadata-admin/anchors.ts | 37 +--- 26 files changed, 2591 insertions(+), 243 deletions(-) create mode 100644 .changeset/36860-metadata-list-columns-batch.md create mode 100644 packages/lint/src/i18n-walk.metadata-list-columns.test.ts create mode 100644 packages/runtime/src/domains/meta-types-translation-parity-36886.test.ts diff --git a/.changeset/36860-metadata-list-columns-batch.md b/.changeset/36860-metadata-list-columns-batch.md new file mode 100644 index 00000000000..2fb048e0473 --- /dev/null +++ b/.changeset/36860-metadata-list-columns-batch.md @@ -0,0 +1,17 @@ +--- +'@objectstack/spec': patch +'@objectstack/rest': patch +'@objectstack/runtime': patch +'@objectstack/platform-objects': patch +--- + +feat(spec): Studio list columns for 27 metadata types, served in the reader's language on both doors + +Clause-②: yes (widening: `/meta/types` serves `list` on 26 more entries, and the runtime dispatcher's listing is now translated) +Metadata-protocol: none + +`METADATA_LIST_REGISTRY` now declares the Studio list columns of 27 metadata types: the first batch (`hook`, `flow`, `job`, `api`, `action`, `report`, `dataset`, `email_template`, `assignment_rule`, `sharing_rule`, `queue`, `agent`, `tool`, `skill`, `doc`, `seed`, `mapping`, `picklist`, `translation`) and the eight types the console used to declare itself (`object`, `field`, `view`, `page`, `dashboard`, `permission`, `position`, `book`). Every column names a key the type's schema declares, checked by the reconciliation test. Nothing an author writes changes: the registry is the spec's own constant. + +- **Headers in every shipped language.** The 52 headers no form field already labels get their own `metadataForms..fields..label` leaf in the 11 platform bundles (`@objectstack/platform-objects`), translated in all ten non-English locales. A column the form labels reads the form's words. +- **Both doors translate the listing.** The runtime dispatcher's `GET /meta` and `GET /meta/types` now answer the types listing in the request's language, as `RestServer`'s `GET /meta` does: type labels, form labels, list headers and schema titles. Both run one function, `translateMetaTypesListing` (`@objectstack/rest`). Before this, a host served through the dispatcher answered all of it in English. +- **The console's own declarations move into the spec.** Studio's lists of objects, fields, views, pages, dashboards, permission sets, positions and books read the served columns. The console keeps only what the schema cannot say: a field row's server-stamped `object`, a position's holder count and granted permission sets, a view's derived display type, a book's audience and a sharing rule's `sharedWith` rendering. The console declared `object`'s columns twice, in two registrations that disagreed (the later one won); both declarations are gone, so one remains, in the spec. A page's former `route` column named no `PageSchema` key and is dropped. diff --git a/content/docs/protocol/kernel/i18n-standard.mdx b/content/docs/protocol/kernel/i18n-standard.mdx index 56347ce7918..ba8b38db68f 100644 --- a/content/docs/protocol/kernel/i18n-standard.mdx +++ b/content/docs/protocol/kernel/i18n-standard.mdx @@ -574,9 +574,14 @@ through the one the renderer reads for that node: |:---|:---|:---| | a form field, a composite's child | `FormFieldSpec.label` / `helpText` / `placeholder` | `resolveMetadataFormLabels(form, type, bundle, opts)` | | a property of a repeater row (a table column header) | the JSON Schema `items.properties[k].title` | `resolveMetadataFormSchemaTitles(schema, type, bundle, opts)` | +| a column of the type's Studio list (`METADATA_LIST_REGISTRY`) | the served `list.columns[].label` | `resolveMetadataListLabels(list, type, bundle, opts)` | -Both run in `GET /api/v1/meta`, which serves every type's `form` and `schema` -already localised for the request's locale; a client deriving the schema itself +A list column reads the field slot of its own path, so a column and the form +field of the same key read the same words. `os i18n extract` emits that slot for +a column path the form does not declare, with the column's header as the source. + +All three run in `GET /api/v1/meta`, which serves every type's `form`, `list` +and `schema` already localised for the request's locale; a client deriving the schema itself with `z.toJSONSchema` applies the second one to its own copy, over a bundle it carries itself. Only `label` crosses over to the schema (as `title`); `helpText` and `placeholder` stay on the form. diff --git a/packages/lint/src/i18n-walk.metadata-list-columns.test.ts b/packages/lint/src/i18n-walk.metadata-list-columns.test.ts new file mode 100644 index 00000000000..adfc5eb3edf --- /dev/null +++ b/packages/lint/src/i18n-walk.metadata-list-columns.test.ts @@ -0,0 +1,52 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36860 — `walkMetadataForms` emits the form field slot + * `metadataForms..fields..label` for every Studio list column + * (`METADATA_LIST_REGISTRY`), so the server can translate each header. + * + * - a column whose path the type's form does not label (a type with no form, + * or a path the form leaves out) gets its own entry, seeded with the + * column's header; + * - a column the form already labels keeps the form's entry, so the slot + * holds one English source; + * - every column of every type has an entry, so no header reaches a reader + * untranslatable. + */ +import { describe, it, expect } from 'vitest'; +import { METADATA_LIST_REGISTRY } from '@objectstack/spec/system'; +import { collectExpectedEntries } from './i18n-walk.js'; + +const entries = collectExpectedEntries({}, { warnedGroups: new Set() }); +const slot = (type: string, path: string) => + entries.filter((e) => e.path.join('\u0000') === ['metadataForms', type, 'fields', path, 'label'].join('\u0000')); + +describe('list column headers are walked into the form field slot (objectstack#36860)', () => { + it('a column on a type with no form gets its own entry, seeded with the header', () => { + const [entry] = slot('job', 'schedule'); + expect(entry).toBeDefined(); + expect(entry.sourceValue).toBe('Schedule'); + }); + + it('a dotted column path the form does not label gets its own entry', () => { + const [entry] = slot('agent', 'model.model'); + expect(entry).toBeDefined(); + expect(entry.sourceValue).toBe('Model'); + }); + + it('a column the form already labels keeps one entry, the form field\'s', () => { + const found = slot('hook', 'events'); + expect(found).toHaveLength(1); + expect(found[0].source).toBe('metadataFormField'); + }); + + it('every column of every declared list has an entry at its slot', () => { + const missing: string[] = []; + for (const [type, list] of Object.entries(METADATA_LIST_REGISTRY)) { + for (const column of list.columns) { + if (slot(type, column.field).length !== 1) missing.push(`${type}.${column.field}`); + } + } + expect(missing).toEqual([]); + }); +}); diff --git a/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts index cfc8205f2b4..791bf9ae07f 100644 --- a/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ar.metadata-forms.generated.ts @@ -1088,15 +1088,54 @@ export const arMetadataForms: NonNullable = { }, seed: { label: "البيانات الأولية", - description: "بيانات تجهيز / تهيئة تُطبَّق عند النشر" + description: "بيانات تجهيز / تهيئة تُطبَّق عند النشر", + fields: { + object: { + label: "الكائن" + }, + mode: { + label: "الوضع" + } + } }, picklist: { label: "قائمة الاختيار", - description: "قائمة خيارات مشتركة تشير إليها حقول الاختيار بالاسم" + description: "قائمة خيارات مشتركة تشير إليها حقول الاختيار بالاسم", + fields: { + name: { + label: "الاسم" + }, + label: { + label: "التسمية" + }, + options: { + label: "الخيارات" + }, + description: { + label: "الوصف" + } + } }, mapping: { label: "تعيين الاستيراد", - description: "تعيين حقول قابل لإعادة الاستخدام للاستيراد/التصدير (إعادة تسمية + تحويلات)، يُشار إليه بالاسم عند الاستيراد" + description: "تعيين حقول قابل لإعادة الاستخدام للاستيراد/التصدير (إعادة تسمية + تحويلات)، يُشار إليه بالاسم عند الاستيراد", + fields: { + name: { + label: "الاسم" + }, + label: { + label: "التسمية" + }, + targetObject: { + label: "الكائن الهدف" + }, + mode: { + label: "الوضع" + }, + sourceFormat: { + label: "تنسيق المصدر" + } + } }, view: { label: "طريقة العرض", @@ -1420,6 +1459,9 @@ export const arMetadataForms: NonNullable = { "sharing.lockedBy": { label: "مقفل بواسطة", helpText: "المستخدم الذي قفل تهيئة طريقة العرض" + }, + object: { + label: "الكائن" } } }, @@ -2576,7 +2618,24 @@ export const arMetadataForms: NonNullable = { } }, job: { - label: "مهمة خلفية" + label: "مهمة خلفية", + fields: { + name: { + label: "الاسم" + }, + label: { + label: "التسمية" + }, + schedule: { + label: "الجدول الزمني" + }, + enabled: { + label: "مُفعَّل" + }, + description: { + label: "الوصف" + } + } }, datasource: { label: "مصدر البيانات" @@ -2586,10 +2645,41 @@ export const arMetadataForms: NonNullable = { }, api: { label: "نقطة نهاية API", - description: "عنوان HTTP ثابت تستدعيه الأنظمة الأخرى لتشغيل تدفق أو للعمل مع السجلات في التطبيق" + description: "عنوان HTTP ثابت تستدعيه الأنظمة الأخرى لتشغيل تدفق أو للعمل مع السجلات في التطبيق", + fields: { + name: { + label: "الاسم" + }, + method: { + label: "الأسلوب" + }, + path: { + label: "المسار" + }, + type: { + label: "النوع" + }, + "objectParams.object": { + label: "الكائن" + }, + "objectParams.operation": { + label: "العملية" + } + } }, translation: { - label: "الترجمة" + label: "الترجمة", + fields: { + name: { + label: "الاسم" + }, + label: { + label: "التسمية" + }, + locale: { + label: "اللغة" + } + } }, email_template: { label: "قالب البريد الإلكتروني", @@ -2666,11 +2756,45 @@ export const arMetadataForms: NonNullable = { }, doc: { label: "الوثائق", - description: "صفحة مساعدة مكتوبة بصيغة Markdown تشحنها حزمة أو تكتبها بنفسك" + description: "صفحة مساعدة مكتوبة بصيغة Markdown تشحنها حزمة أو تكتبها بنفسك", + fields: { + name: { + label: "الاسم" + }, + label: { + label: "التسمية" + }, + group: { + label: "المجموعة" + }, + tags: { + label: "الوسوم" + }, + description: { + label: "الوصف" + } + } }, book: { label: "كتاب الوثائق", - description: "جدول محتويات يجمّع صفحات المساعدة في أقسام مرتبة" + description: "جدول محتويات يجمّع صفحات المساعدة في أقسام مرتبة", + fields: { + name: { + label: "الاسم" + }, + label: { + label: "التسمية" + }, + audience: { + label: "الجمهور" + }, + groups: { + label: "المجموعات" + }, + description: { + label: "الوصف" + } + } }, permission: { label: "مجموعة الأذونات", @@ -2774,15 +2898,66 @@ export const arMetadataForms: NonNullable = { }, sharing_rule: { label: "قاعدة المشاركة", - description: "قاعدة تعلنها حزمة لمشاركة السجلات؛ وتؤلّف المؤسسات قواعدها الخاصة في الإعداد" + description: "قاعدة تعلنها حزمة لمشاركة السجلات؛ وتؤلّف المؤسسات قواعدها الخاصة في الإعداد", + fields: { + name: { + label: "الاسم" + }, + label: { + label: "التسمية" + }, + object: { + label: "الكائن" + }, + sharedWith: { + label: "مُشارَك مع" + }, + accessLevel: { + label: "مستوى الوصول" + } + } }, queue: { label: "قائمة الانتظار", - description: "مجموعة مُسمّاة من الأشخاص يمكن أن تبقى السجلات فيها حتى يتولّى أحدهم السجل؛ وتزوّد المؤسسات قوائمها بالأشخاص في الإعداد" + description: "مجموعة مُسمّاة من الأشخاص يمكن أن تبقى السجلات فيها حتى يتولّى أحدهم السجل؛ وتزوّد المؤسسات قوائمها بالأشخاص في الإعداد", + fields: { + name: { + label: "الاسم" + }, + label: { + label: "التسمية" + }, + members: { + label: "الأعضاء" + }, + description: { + label: "الوصف" + } + } }, assignment_rule: { label: "قاعدة الإسناد", - description: "قاعدة تعلنها حزمة لتوجيه السجلات الجديدة إلى قائمة انتظار أو إلى شخص" + description: "قاعدة تعلنها حزمة لتوجيه السجلات الجديدة إلى قائمة انتظار أو إلى شخص", + fields: { + name: { + label: "الاسم" + }, + label: { + label: "التسمية" + }, + object: { + label: "الكائن" + }, + entries: { + label: "الإدخالات" + }, + active: { + label: "نشط" + }, + description: { + label: "الوصف" + } + } }, agent: { label: "وكيل الذكاء الاصطناعي", @@ -2864,6 +3039,9 @@ export const arMetadataForms: NonNullable = { guardrails: { label: "حواجز الحماية", helpText: "قواعد السلامة وسياسات المحتوى" + }, + "model.model": { + label: "النموذج" } } }, diff --git a/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts index 3b154fb6f6e..e8953e10931 100644 --- a/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/de.metadata-forms.generated.ts @@ -1088,15 +1088,54 @@ export const deMetadataForms: NonNullable = { }, seed: { label: "Startdaten", - description: "Fixture- bzw. Initialisierungsdaten, die bei der Veröffentlichung angewendet werden" + description: "Fixture- bzw. Initialisierungsdaten, die bei der Veröffentlichung angewendet werden", + fields: { + object: { + label: "Objekt" + }, + mode: { + label: "Modus" + } + } }, picklist: { label: "Auswahlliste", - description: "Gemeinsame Optionsliste, auf die Auswahlfelder per Name verweisen" + description: "Gemeinsame Optionsliste, auf die Auswahlfelder per Name verweisen", + fields: { + name: { + label: "Name" + }, + label: { + label: "Bezeichnung" + }, + options: { + label: "Optionen" + }, + description: { + label: "Beschreibung" + } + } }, mapping: { label: "Importzuordnung", - description: "Wiederverwendbare Feldzuordnung für Import/Export (Umbenennung + Transformationen), beim Import per Name referenziert" + description: "Wiederverwendbare Feldzuordnung für Import/Export (Umbenennung + Transformationen), beim Import per Name referenziert", + fields: { + name: { + label: "Name" + }, + label: { + label: "Bezeichnung" + }, + targetObject: { + label: "Zielobjekt" + }, + mode: { + label: "Modus" + }, + sourceFormat: { + label: "Quellformat" + } + } }, view: { label: "Ansicht", @@ -1420,6 +1459,9 @@ export const deMetadataForms: NonNullable = { "sharing.lockedBy": { label: "Gesperrt von", helpText: "Benutzer, der die Ansichtskonfiguration gesperrt hat" + }, + object: { + label: "Objekt" } } }, @@ -2576,7 +2618,24 @@ export const deMetadataForms: NonNullable = { } }, job: { - label: "Hintergrundjob" + label: "Hintergrundjob", + fields: { + name: { + label: "Name" + }, + label: { + label: "Bezeichnung" + }, + schedule: { + label: "Zeitplan" + }, + enabled: { + label: "Aktiviert" + }, + description: { + label: "Beschreibung" + } + } }, datasource: { label: "Datenquelle" @@ -2586,10 +2645,41 @@ export const deMetadataForms: NonNullable = { }, api: { label: "API-Endpunkt", - description: "Eine stabile HTTP-URL, die andere Systeme aufrufen, um einen Flow auszuführen oder mit Datensätzen der App zu arbeiten" + description: "Eine stabile HTTP-URL, die andere Systeme aufrufen, um einen Flow auszuführen oder mit Datensätzen der App zu arbeiten", + fields: { + name: { + label: "Name" + }, + method: { + label: "Methode" + }, + path: { + label: "Pfad" + }, + type: { + label: "Typ" + }, + "objectParams.object": { + label: "Objekt" + }, + "objectParams.operation": { + label: "Vorgang" + } + } }, translation: { - label: "Übersetzung" + label: "Übersetzung", + fields: { + name: { + label: "Name" + }, + label: { + label: "Bezeichnung" + }, + locale: { + label: "Gebietsschema" + } + } }, email_template: { label: "E-Mail-Vorlage", @@ -2666,11 +2756,45 @@ export const deMetadataForms: NonNullable = { }, doc: { label: "Dokumentation", - description: "Eine in Markdown geschriebene Hilfeseite, die ein Paket mitliefert oder die Sie selbst schreiben" + description: "Eine in Markdown geschriebene Hilfeseite, die ein Paket mitliefert oder die Sie selbst schreiben", + fields: { + name: { + label: "Name" + }, + label: { + label: "Bezeichnung" + }, + group: { + label: "Gruppe" + }, + tags: { + label: "Schlagwörter" + }, + description: { + label: "Beschreibung" + } + } }, book: { label: "Dokumentationsbuch", - description: "Ein Inhaltsverzeichnis, das Hilfeseiten in geordnete Abschnitte gruppiert" + description: "Ein Inhaltsverzeichnis, das Hilfeseiten in geordnete Abschnitte gruppiert", + fields: { + name: { + label: "Name" + }, + label: { + label: "Bezeichnung" + }, + audience: { + label: "Zielgruppe" + }, + groups: { + label: "Gruppen" + }, + description: { + label: "Beschreibung" + } + } }, permission: { label: "Berechtigungssatz", @@ -2774,15 +2898,66 @@ export const deMetadataForms: NonNullable = { }, sharing_rule: { label: "Freigaberegel", - description: "Eine Regel, die ein Paket zur Freigabe von Datensätzen deklariert; Organisationen erstellen ihre eigenen in Setup" + description: "Eine Regel, die ein Paket zur Freigabe von Datensätzen deklariert; Organisationen erstellen ihre eigenen in Setup", + fields: { + name: { + label: "Name" + }, + label: { + label: "Bezeichnung" + }, + object: { + label: "Objekt" + }, + sharedWith: { + label: "Geteilt mit" + }, + accessLevel: { + label: "Zugriffsebene" + } + } }, queue: { label: "Warteschlange", - description: "Eine benannte Gruppe von Personen, in der Datensätze liegen können, bis eine von ihnen den Datensatz übernimmt; Organisationen besetzen ihre eigenen in Setup" + description: "Eine benannte Gruppe von Personen, in der Datensätze liegen können, bis eine von ihnen den Datensatz übernimmt; Organisationen besetzen ihre eigenen in Setup", + fields: { + name: { + label: "Name" + }, + label: { + label: "Bezeichnung" + }, + members: { + label: "Mitglieder" + }, + description: { + label: "Beschreibung" + } + } }, assignment_rule: { label: "Zuweisungsregel", - description: "Eine Regel, die ein Paket deklariert, um neue Datensätze an eine Warteschlange oder eine Person zu leiten" + description: "Eine Regel, die ein Paket deklariert, um neue Datensätze an eine Warteschlange oder eine Person zu leiten", + fields: { + name: { + label: "Name" + }, + label: { + label: "Bezeichnung" + }, + object: { + label: "Objekt" + }, + entries: { + label: "Einträge" + }, + active: { + label: "Aktiv" + }, + description: { + label: "Beschreibung" + } + } }, agent: { label: "KI-Agent", @@ -2864,6 +3039,9 @@ export const deMetadataForms: NonNullable = { guardrails: { label: "Schutzmaßnahmen", helpText: "Sicherheitsregeln und Inhaltsrichtlinien" + }, + "model.model": { + label: "Modell" } } }, diff --git a/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts index 71b47238cd1..ab96959e638 100644 --- a/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/de.source-hashes.generated.ts @@ -23,11 +23,14 @@ export const deGeneratedSourceHashes: Readonly> = { "metadataForms.action.fields.refusals.status.label": "64a420165247654b", "metadataForms.agent.fields.avatar.label": "0f06369995b69b8b", "metadataForms.agent.fields.name.label": "5274417ff1ccaf01", + "metadataForms.api.fields.name.label": "5274417ff1ccaf01", "metadataForms.app.fields.branding.label": "ec6e391065514b64", "metadataForms.app.fields.name.label": "5274417ff1ccaf01", "metadataForms.app.fields.navigation.label": "51cd9fc784a9643f", "metadataForms.app.sections.branding.label": "ec6e391065514b64", "metadataForms.app.sections.navigation.label": "51cd9fc784a9643f", + "metadataForms.assignment_rule.fields.name.label": "5274417ff1ccaf01", + "metadataForms.book.fields.name.label": "5274417ff1ccaf01", "metadataForms.dashboard.fields.name.label": "5274417ff1ccaf01", "metadataForms.dashboard.fields.widgets.label": "bd4bf82396edd638", "metadataForms.dashboard.label": "b03d84f15ecdbb1e", @@ -36,6 +39,7 @@ export const deGeneratedSourceHashes: Readonly> = { "metadataForms.dataset.fields.filter.label": "802895ec427fc6af", "metadataForms.dataset.fields.name.label": "5274417ff1ccaf01", "metadataForms.dataset.label": "19647dcb84ce82d3", + "metadataForms.doc.fields.name.label": "5274417ff1ccaf01", "metadataForms.email_template.fields.fromOverride.helpText": "c5e29fa12ee1525b", "metadataForms.email_template.fields.name.label": "5274417ff1ccaf01", "metadataForms.email_template.fields.variables.helpText": "27197774c2cda633", @@ -50,6 +54,8 @@ export const deGeneratedSourceHashes: Readonly> = { "metadataForms.hook.fields.name.label": "5274417ff1ccaf01", "metadataForms.hook.fields.refusals.status.label": "64a420165247654b", "metadataForms.hook.label": "248bb1cdc692252d", + "metadataForms.job.fields.name.label": "5274417ff1ccaf01", + "metadataForms.mapping.fields.name.label": "5274417ff1ccaf01", "metadataForms.object.fields.enable.feeds.label": "669c64671f632139", "metadataForms.object.fields.lifecycle.storage.shards.label": "739988affb36b2e0", "metadataForms.object.fields.name.label": "5274417ff1ccaf01", @@ -60,10 +66,12 @@ export const deGeneratedSourceHashes: Readonly> = { "metadataForms.permission.fields.name.label": "5274417ff1ccaf01", "metadataForms.permission.fields.objects.helpText": "e2512cfb3b501aae", "metadataForms.permission.fields.tabPermissions.helpText": "8942e2aebe59897c", + "metadataForms.picklist.fields.name.label": "5274417ff1ccaf01", "metadataForms.position.fields.name.helpText": "3594bba7cc2a3c8a", "metadataForms.position.fields.name.label": "5274417ff1ccaf01", "metadataForms.position.label": "9a24c02e441eb0b4", "metadataForms.position.sections.position.label": "9a24c02e441eb0b4", + "metadataForms.queue.fields.name.label": "5274417ff1ccaf01", "metadataForms.report.fields.dataset.label": "19647dcb84ce82d3", "metadataForms.report.fields.dateRange.allowCustomRange.helpText": "eb95a6b1536e22fd", "metadataForms.report.fields.dateRange.allowCustomRange.label": "a1fb0e1cf5fe5d8e", @@ -80,9 +88,11 @@ export const deGeneratedSourceHashes: Readonly> = { "metadataForms.report.fields.exportOptions.includeHeaders.helpText": "44cbc80015ff051d", "metadataForms.report.fields.exportOptions.includeHeaders.label": "f114a4778c9727ae", "metadataForms.report.fields.name.label": "5274417ff1ccaf01", + "metadataForms.sharing_rule.fields.name.label": "5274417ff1ccaf01", "metadataForms.skill.fields.name.label": "5274417ff1ccaf01", "metadataForms.tool.fields.name.label": "5274417ff1ccaf01", "metadataForms.tool.sections.schemas.label": "e288a14c24f0afe7", + "metadataForms.translation.fields.name.label": "5274417ff1ccaf01", "metadataForms.view.fields.filter.label": "802895ec427fc6af", "metadataForms.view.fields.gantt.label": "57ffc6ef520edfc5", "metadataForms.view.fields.kanban.label": "dd95c452aa71459e", diff --git a/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts index edcb34c6063..036ccf92f12 100644 --- a/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts @@ -1088,15 +1088,54 @@ export const enMetadataForms: NonNullable = { }, seed: { label: "Seed Data", - description: "Fixture / initialization data applied on publish" + description: "Fixture / initialization data applied on publish", + fields: { + object: { + label: "Object" + }, + mode: { + label: "Mode" + } + } }, picklist: { label: "Picklist", - description: "Shared option list that select fields reference by name" + description: "Shared option list that select fields reference by name", + fields: { + name: { + label: "Name" + }, + label: { + label: "Label" + }, + options: { + label: "Options" + }, + description: { + label: "Description" + } + } }, mapping: { label: "Import Mapping", - description: "Reusable import/export field mapping (rename + transforms), referenced by name at import" + description: "Reusable import/export field mapping (rename + transforms), referenced by name at import", + fields: { + name: { + label: "Name" + }, + label: { + label: "Label" + }, + targetObject: { + label: "Target Object" + }, + mode: { + label: "Mode" + }, + sourceFormat: { + label: "Source Format" + } + } }, view: { label: "View", @@ -1420,6 +1459,9 @@ export const enMetadataForms: NonNullable = { "sharing.lockedBy": { label: "Locked By", helpText: "User who locked the view configuration" + }, + object: { + label: "Object" } } }, @@ -2576,7 +2618,24 @@ export const enMetadataForms: NonNullable = { } }, job: { - label: "Background Job" + label: "Background Job", + fields: { + name: { + label: "Name" + }, + label: { + label: "Label" + }, + schedule: { + label: "Schedule" + }, + enabled: { + label: "Enabled" + }, + description: { + label: "Description" + } + } }, datasource: { label: "Datasource" @@ -2586,10 +2645,41 @@ export const enMetadataForms: NonNullable = { }, api: { label: "API Endpoint", - description: "A stable HTTP URL that other systems call to run a flow or work with records in the app" + description: "A stable HTTP URL that other systems call to run a flow or work with records in the app", + fields: { + name: { + label: "Name" + }, + method: { + label: "Method" + }, + path: { + label: "Path" + }, + type: { + label: "Type" + }, + "objectParams.object": { + label: "Object" + }, + "objectParams.operation": { + label: "Operation" + } + } }, translation: { - label: "Translation" + label: "Translation", + fields: { + name: { + label: "Name" + }, + label: { + label: "Label" + }, + locale: { + label: "Locale" + } + } }, email_template: { label: "Email Template", @@ -2666,11 +2756,45 @@ export const enMetadataForms: NonNullable = { }, doc: { label: "Documentation", - description: "A help page written in Markdown that a package ships or you write yourself" + description: "A help page written in Markdown that a package ships or you write yourself", + fields: { + name: { + label: "Name" + }, + label: { + label: "Label" + }, + group: { + label: "Group" + }, + tags: { + label: "Tags" + }, + description: { + label: "Description" + } + } }, book: { label: "Documentation Book", - description: "A table of contents that groups help pages into ordered sections" + description: "A table of contents that groups help pages into ordered sections", + fields: { + name: { + label: "Name" + }, + label: { + label: "Label" + }, + audience: { + label: "Audience" + }, + groups: { + label: "Groups" + }, + description: { + label: "Description" + } + } }, permission: { label: "Permission Set", @@ -2774,15 +2898,66 @@ export const enMetadataForms: NonNullable = { }, sharing_rule: { label: "Sharing Rule", - description: "A rule a package declares to share records; organizations author their own in Setup" + description: "A rule a package declares to share records; organizations author their own in Setup", + fields: { + name: { + label: "Name" + }, + label: { + label: "Label" + }, + object: { + label: "Object" + }, + sharedWith: { + label: "Shared With" + }, + accessLevel: { + label: "Access Level" + } + } }, queue: { label: "Queue", - description: "A named set of people records can sit in until one of them takes the record; organizations staff their own in Setup" + description: "A named set of people records can sit in until one of them takes the record; organizations staff their own in Setup", + fields: { + name: { + label: "Name" + }, + label: { + label: "Label" + }, + members: { + label: "Members" + }, + description: { + label: "Description" + } + } }, assignment_rule: { label: "Assignment Rule", - description: "A rule a package declares to route new records to a queue or a person" + description: "A rule a package declares to route new records to a queue or a person", + fields: { + name: { + label: "Name" + }, + label: { + label: "Label" + }, + object: { + label: "Object" + }, + entries: { + label: "Entries" + }, + active: { + label: "Active" + }, + description: { + label: "Description" + } + } }, agent: { label: "AI Agent", @@ -2864,6 +3039,9 @@ export const enMetadataForms: NonNullable = { guardrails: { label: "Guardrails", helpText: "Safety rules and content policies" + }, + "model.model": { + label: "Model" } } }, diff --git a/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts index ecd06c12f2b..1452be609c0 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts @@ -1088,15 +1088,54 @@ export const esESMetadataForms: NonNullable = }, seed: { label: "Datos semilla", - description: "Datos predefinidos / de inicialización aplicados al publicar" + description: "Datos predefinidos / de inicialización aplicados al publicar", + fields: { + object: { + label: "Objeto" + }, + mode: { + label: "Modo" + } + } }, picklist: { label: "Lista de selección", - description: "Lista de opciones compartida a la que los campos de selección hacen referencia por nombre" + description: "Lista de opciones compartida a la que los campos de selección hacen referencia por nombre", + fields: { + name: { + label: "Nombre" + }, + label: { + label: "Etiqueta" + }, + options: { + label: "Opciones" + }, + description: { + label: "Descripción" + } + } }, mapping: { label: "Mapeo de importación", - description: "Mapeo de campos de importación/exportación reutilizable (renombrado + transformaciones), referenciado por nombre al importar" + description: "Mapeo de campos de importación/exportación reutilizable (renombrado + transformaciones), referenciado por nombre al importar", + fields: { + name: { + label: "Nombre" + }, + label: { + label: "Etiqueta" + }, + targetObject: { + label: "Objeto de destino" + }, + mode: { + label: "Modo" + }, + sourceFormat: { + label: "Formato de origen" + } + } }, view: { label: "Vista", @@ -1420,6 +1459,9 @@ export const esESMetadataForms: NonNullable = "sharing.lockedBy": { label: "Bloqueado por", helpText: "Usuario que bloqueó la configuración de la vista" + }, + object: { + label: "Objeto" } } }, @@ -2576,7 +2618,24 @@ export const esESMetadataForms: NonNullable = } }, job: { - label: "Trabajo en segundo plano" + label: "Trabajo en segundo plano", + fields: { + name: { + label: "Nombre" + }, + label: { + label: "Etiqueta" + }, + schedule: { + label: "Programación" + }, + enabled: { + label: "Habilitado" + }, + description: { + label: "Descripción" + } + } }, datasource: { label: "Fuente de datos" @@ -2586,10 +2645,41 @@ export const esESMetadataForms: NonNullable = }, api: { label: "Endpoint API", - description: "URL HTTP estable a la que llaman otros sistemas para ejecutar un flujo o trabajar con los registros de la aplicación" + description: "URL HTTP estable a la que llaman otros sistemas para ejecutar un flujo o trabajar con los registros de la aplicación", + fields: { + name: { + label: "Nombre" + }, + method: { + label: "Método" + }, + path: { + label: "Ruta" + }, + type: { + label: "Tipo" + }, + "objectParams.object": { + label: "Objeto" + }, + "objectParams.operation": { + label: "Operación" + } + } }, translation: { - label: "Traducción" + label: "Traducción", + fields: { + name: { + label: "Nombre" + }, + label: { + label: "Etiqueta" + }, + locale: { + label: "Configuración regional" + } + } }, email_template: { label: "Plantilla de email", @@ -2666,11 +2756,45 @@ export const esESMetadataForms: NonNullable = }, doc: { label: "Documentación", - description: "Página de ayuda en Markdown, incluida en un paquete o redactada directamente" + description: "Página de ayuda en Markdown, incluida en un paquete o redactada directamente", + fields: { + name: { + label: "Nombre" + }, + label: { + label: "Etiqueta" + }, + group: { + label: "Grupo" + }, + tags: { + label: "Etiquetas" + }, + description: { + label: "Descripción" + } + } }, book: { label: "Libro de documentación", - description: "Índice que organiza las páginas de ayuda en secciones ordenadas" + description: "Índice que organiza las páginas de ayuda en secciones ordenadas", + fields: { + name: { + label: "Nombre" + }, + label: { + label: "Etiqueta" + }, + audience: { + label: "Audiencia" + }, + groups: { + label: "Grupos" + }, + description: { + label: "Descripción" + } + } }, permission: { label: "Conjunto de permisos", @@ -2774,15 +2898,66 @@ export const esESMetadataForms: NonNullable = }, sharing_rule: { label: "Regla de Compartición", - description: "Una regla que un paquete declara para compartir registros; las organizaciones crean las suyas en Configuración" + description: "Una regla que un paquete declara para compartir registros; las organizaciones crean las suyas en Configuración", + fields: { + name: { + label: "Nombre" + }, + label: { + label: "Etiqueta" + }, + object: { + label: "Objeto" + }, + sharedWith: { + label: "Compartido con" + }, + accessLevel: { + label: "Nivel de acceso" + } + } }, queue: { label: "Cola", - description: "Un conjunto de personas con nombre donde los registros esperan hasta que una de ellas los toma; las organizaciones preparan las suyas en Configuración" + description: "Un conjunto de personas con nombre donde los registros esperan hasta que una de ellas los toma; las organizaciones preparan las suyas en Configuración", + fields: { + name: { + label: "Nombre" + }, + label: { + label: "Etiqueta" + }, + members: { + label: "Miembros" + }, + description: { + label: "Descripción" + } + } }, assignment_rule: { label: "Regla de Asignación", - description: "Una regla que un paquete declara para dirigir los registros nuevos a una cola o a una persona" + description: "Una regla que un paquete declara para dirigir los registros nuevos a una cola o a una persona", + fields: { + name: { + label: "Nombre" + }, + label: { + label: "Etiqueta" + }, + object: { + label: "Objeto" + }, + entries: { + label: "Entradas" + }, + active: { + label: "Activo" + }, + description: { + label: "Descripción" + } + } }, agent: { label: "Agente de IA", @@ -2864,6 +3039,9 @@ export const esESMetadataForms: NonNullable = guardrails: { label: "Reglas de protección", helpText: "Reglas de seguridad y políticas de contenido" + }, + "model.model": { + label: "Modelo" } } }, diff --git a/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts index f35a77852a6..36f3645c703 100644 --- a/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/fr.metadata-forms.generated.ts @@ -1088,15 +1088,54 @@ export const frMetadataForms: NonNullable = { }, seed: { label: "Données d’amorçage", - description: "Données de fixture / d’initialisation appliquées à la publication" + description: "Données de fixture / d’initialisation appliquées à la publication", + fields: { + object: { + label: "Objet" + }, + mode: { + label: "Mode" + } + } }, picklist: { label: "Liste de sélection", - description: "Liste d’options partagée que les champs de sélection référencent par son nom" + description: "Liste d’options partagée que les champs de sélection référencent par son nom", + fields: { + name: { + label: "Nom" + }, + label: { + label: "Libellé" + }, + options: { + label: "Options" + }, + description: { + label: "Description" + } + } }, mapping: { label: "Mappage d’import", - description: "Mappage de champs d’import/export réutilisable (renommage + transformations), référencé par son nom lors de l’import" + description: "Mappage de champs d’import/export réutilisable (renommage + transformations), référencé par son nom lors de l’import", + fields: { + name: { + label: "Nom" + }, + label: { + label: "Libellé" + }, + targetObject: { + label: "Objet cible" + }, + mode: { + label: "Mode" + }, + sourceFormat: { + label: "Format source" + } + } }, view: { label: "Vue", @@ -1420,6 +1459,9 @@ export const frMetadataForms: NonNullable = { "sharing.lockedBy": { label: "Verrouillé par", helpText: "Utilisateur qui a verrouillé la configuration de la vue" + }, + object: { + label: "Objet" } } }, @@ -2576,7 +2618,24 @@ export const frMetadataForms: NonNullable = { } }, job: { - label: "Tâche en arrière-plan" + label: "Tâche en arrière-plan", + fields: { + name: { + label: "Nom" + }, + label: { + label: "Libellé" + }, + schedule: { + label: "Planification" + }, + enabled: { + label: "Activé" + }, + description: { + label: "Description" + } + } }, datasource: { label: "Source de données" @@ -2586,10 +2645,41 @@ export const frMetadataForms: NonNullable = { }, api: { label: "Point de terminaison d’API", - description: "Une URL HTTP stable que d’autres systèmes appellent pour exécuter un flux ou manipuler les enregistrements de l’application" + description: "Une URL HTTP stable que d’autres systèmes appellent pour exécuter un flux ou manipuler les enregistrements de l’application", + fields: { + name: { + label: "Nom" + }, + method: { + label: "Méthode" + }, + path: { + label: "Chemin" + }, + type: { + label: "Type" + }, + "objectParams.object": { + label: "Objet" + }, + "objectParams.operation": { + label: "Opération" + } + } }, translation: { - label: "Traduction" + label: "Traduction", + fields: { + name: { + label: "Nom" + }, + label: { + label: "Libellé" + }, + locale: { + label: "Langue" + } + } }, email_template: { label: "Modèle d’e-mail", @@ -2666,11 +2756,45 @@ export const frMetadataForms: NonNullable = { }, doc: { label: "Documentation", - description: "Une page d’aide rédigée en Markdown, fournie par un package ou écrite par vous-même" + description: "Une page d’aide rédigée en Markdown, fournie par un package ou écrite par vous-même", + fields: { + name: { + label: "Nom" + }, + label: { + label: "Libellé" + }, + group: { + label: "Groupe" + }, + tags: { + label: "Mots-clés" + }, + description: { + label: "Description" + } + } }, book: { label: "Livre de documentation", - description: "Une table des matières qui regroupe les pages d’aide en sections ordonnées" + description: "Une table des matières qui regroupe les pages d’aide en sections ordonnées", + fields: { + name: { + label: "Nom" + }, + label: { + label: "Libellé" + }, + audience: { + label: "Public" + }, + groups: { + label: "Groupes" + }, + description: { + label: "Description" + } + } }, permission: { label: "Ensemble d’autorisations", @@ -2774,15 +2898,66 @@ export const frMetadataForms: NonNullable = { }, sharing_rule: { label: "Règle de partage", - description: "Une règle qu’un package déclare pour partager des enregistrements ; les organisations créent les leurs dans Configuration" + description: "Une règle qu’un package déclare pour partager des enregistrements ; les organisations créent les leurs dans Configuration", + fields: { + name: { + label: "Nom" + }, + label: { + label: "Libellé" + }, + object: { + label: "Objet" + }, + sharedWith: { + label: "Partagé avec" + }, + accessLevel: { + label: "Niveau d’accès" + } + } }, queue: { label: "File d’attente", - description: "Un groupe nommé de personnes dans lequel des enregistrements peuvent attendre jusqu’à ce que l’une d’elles prenne l’enregistrement ; les organisations y affectent leurs propres membres dans Configuration" + description: "Un groupe nommé de personnes dans lequel des enregistrements peuvent attendre jusqu’à ce que l’une d’elles prenne l’enregistrement ; les organisations y affectent leurs propres membres dans Configuration", + fields: { + name: { + label: "Nom" + }, + label: { + label: "Libellé" + }, + members: { + label: "Membres" + }, + description: { + label: "Description" + } + } }, assignment_rule: { label: "Règle d’attribution", - description: "Une règle qu’un package déclare pour acheminer les nouveaux enregistrements vers une file d’attente ou une personne" + description: "Une règle qu’un package déclare pour acheminer les nouveaux enregistrements vers une file d’attente ou une personne", + fields: { + name: { + label: "Nom" + }, + label: { + label: "Libellé" + }, + object: { + label: "Objet" + }, + entries: { + label: "Entrées" + }, + active: { + label: "Actif" + }, + description: { + label: "Description" + } + } }, agent: { label: "Agent IA", @@ -2864,6 +3039,9 @@ export const frMetadataForms: NonNullable = { guardrails: { label: "Garde-fous", helpText: "Règles de sécurité et politiques de contenu" + }, + "model.model": { + label: "Modèle" } } }, diff --git a/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts b/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts index 9c91ffbb3e9..baedb51b0d7 100644 --- a/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts +++ b/packages/platform-objects/src/apps/translations/fr.source-hashes.generated.ts @@ -30,12 +30,15 @@ export const frGeneratedSourceHashes: Readonly> = { "metadataForms.agent.fields.avatar.label": "0f06369995b69b8b", "metadataForms.agent.fields.instructions.label": "ed1cc73e669573d0", "metadataForms.agent.fields.surface.label": "5f41277948ff2598", + "metadataForms.api.fields.type.label": "901bb552898b2cab", "metadataForms.app.fields.active.label": "eee107cf4e466779", "metadataForms.app.fields.description.label": "779a4342c8eb6707", "metadataForms.app.fields.name.helpText": "d600b805aeb8983a", "metadataForms.app.fields.navigation.label": "51cd9fc784a9643f", "metadataForms.app.label": "409ceb97d1ea6644", "metadataForms.app.sections.navigation.label": "51cd9fc784a9643f", + "metadataForms.assignment_rule.fields.description.label": "779a4342c8eb6707", + "metadataForms.book.fields.description.label": "779a4342c8eb6707", "metadataForms.dashboard.fields.description.label": "779a4342c8eb6707", "metadataForms.dashboard.fields.widgets.label": "bd4bf82396edd638", "metadataForms.dashboard.sections.widgets.label": "bd4bf82396edd638", @@ -43,6 +46,7 @@ export const frGeneratedSourceHashes: Readonly> = { "metadataForms.dataset.fields.dimensions.label": "d75e6dd9d87e93b4", "metadataForms.dataset.sections.dimensions.label": "d75e6dd9d87e93b4", "metadataForms.dataset.sections.source.label": "8fe786e8e29c8cec", + "metadataForms.doc.fields.description.label": "779a4342c8eb6707", "metadataForms.doc.label": "3f35cf5088b999ad", "metadataForms.email_template.fields.description.label": "779a4342c8eb6707", "metadataForms.email_template.fields.fromOverride.helpText": "c5e29fa12ee1525b", @@ -71,6 +75,8 @@ export const frGeneratedSourceHashes: Readonly> = { "metadataForms.hook.fields.refusals.reasons.message.label": "2af15199795c25b9", "metadataForms.hook.fields.texts.message.label": "2af15199795c25b9", "metadataForms.hook.label": "248bb1cdc692252d", + "metadataForms.job.fields.description.label": "779a4342c8eb6707", + "metadataForms.mapping.fields.mode.label": "74dde5013435abdc", "metadataForms.object.fields.description.label": "779a4342c8eb6707", "metadataForms.object.fields.fields.description.label": "779a4342c8eb6707", "metadataForms.object.fields.fields.expression.label": "cd1b52ad1588075e", @@ -95,8 +101,11 @@ export const frGeneratedSourceHashes: Readonly> = { "metadataForms.permission.fields.fields.helpText": "887a0bae04a950e2", "metadataForms.permission.fields.objects.helpText": "e2512cfb3b501aae", "metadataForms.permission.fields.tabPermissions.helpText": "8942e2aebe59897c", + "metadataForms.picklist.fields.description.label": "779a4342c8eb6707", + "metadataForms.picklist.fields.options.label": "2cc9eb8d0c8ec657", "metadataForms.position.fields.description.label": "779a4342c8eb6707", "metadataForms.position.fields.name.helpText": "3594bba7cc2a3c8a", + "metadataForms.queue.fields.description.label": "779a4342c8eb6707", "metadataForms.report.fields.dateRange.allowCustomRange.helpText": "eb95a6b1536e22fd", "metadataForms.report.fields.dateRange.allowCustomRange.label": "a1fb0e1cf5fe5d8e", "metadataForms.report.fields.dateRange.defaultRange.helpText": "03ccdb24491c9b5f", @@ -112,6 +121,7 @@ export const frGeneratedSourceHashes: Readonly> = { "metadataForms.report.fields.exportOptions.includeHeaders.helpText": "44cbc80015ff051d", "metadataForms.report.fields.exportOptions.includeHeaders.label": "f114a4778c9727ae", "metadataForms.report.fields.type.label": "901bb552898b2cab", + "metadataForms.seed.fields.mode.label": "74dde5013435abdc", "metadataForms.skill.fields.active.label": "eee107cf4e466779", "metadataForms.skill.fields.description.label": "779a4342c8eb6707", "metadataForms.skill.fields.instructions.label": "ed1cc73e669573d0", diff --git a/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts index e4b7872ff84..6806a3cd1c3 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts @@ -1088,15 +1088,54 @@ export const jaJPMetadataForms: NonNullable = }, seed: { label: "シードデータ", - description: "公開時に適用されるフィクスチャ/初期化データ" + description: "公開時に適用されるフィクスチャ/初期化データ", + fields: { + object: { + label: "オブジェクト" + }, + mode: { + label: "モード" + } + } }, picklist: { label: "選択リスト", - description: "選択フィールドが名前で参照する共有の選択肢リスト" + description: "選択フィールドが名前で参照する共有の選択肢リスト", + fields: { + name: { + label: "名前" + }, + label: { + label: "表示名" + }, + options: { + label: "選択肢" + }, + description: { + label: "説明" + } + } }, mapping: { label: "インポートマッピング", - description: "再利用可能なインポート/エクスポートのフィールドマッピング(リネーム + 変換)。インポート時に名前で参照します" + description: "再利用可能なインポート/エクスポートのフィールドマッピング(リネーム + 変換)。インポート時に名前で参照します", + fields: { + name: { + label: "名前" + }, + label: { + label: "表示名" + }, + targetObject: { + label: "対象オブジェクト" + }, + mode: { + label: "モード" + }, + sourceFormat: { + label: "ソース形式" + } + } }, view: { label: "ビュー", @@ -1420,6 +1459,9 @@ export const jaJPMetadataForms: NonNullable = "sharing.lockedBy": { label: "ロックしたユーザー", helpText: "ビューの設定をロックしたユーザー" + }, + object: { + label: "オブジェクト" } } }, @@ -2576,7 +2618,24 @@ export const jaJPMetadataForms: NonNullable = } }, job: { - label: "バックグラウンドジョブ" + label: "バックグラウンドジョブ", + fields: { + name: { + label: "名前" + }, + label: { + label: "表示名" + }, + schedule: { + label: "スケジュール" + }, + enabled: { + label: "有効" + }, + description: { + label: "説明" + } + } }, datasource: { label: "データソース" @@ -2586,10 +2645,41 @@ export const jaJPMetadataForms: NonNullable = }, api: { label: "API エンドポイント", - description: "他のシステムが呼び出す固定の HTTP URL。フローを実行したり、アプリのレコードを操作したりします" + description: "他のシステムが呼び出す固定の HTTP URL。フローを実行したり、アプリのレコードを操作したりします", + fields: { + name: { + label: "名前" + }, + method: { + label: "メソッド" + }, + path: { + label: "パス" + }, + type: { + label: "型" + }, + "objectParams.object": { + label: "オブジェクト" + }, + "objectParams.operation": { + label: "操作" + } + } }, translation: { - label: "翻訳" + label: "翻訳", + fields: { + name: { + label: "名前" + }, + label: { + label: "表示名" + }, + locale: { + label: "ロケール" + } + } }, email_template: { label: "メールテンプレート", @@ -2666,11 +2756,45 @@ export const jaJPMetadataForms: NonNullable = }, doc: { label: "ドキュメント", - description: "Markdown で書かれたヘルプページ。パッケージに同梱されるほか、自分で作成することもできます" + description: "Markdown で書かれたヘルプページ。パッケージに同梱されるほか、自分で作成することもできます", + fields: { + name: { + label: "名前" + }, + label: { + label: "表示名" + }, + group: { + label: "グループ" + }, + tags: { + label: "タグ" + }, + description: { + label: "説明" + } + } }, book: { label: "ドキュメントブック", - description: "ヘルプページを順序付きのセクションにまとめた目次" + description: "ヘルプページを順序付きのセクションにまとめた目次", + fields: { + name: { + label: "名前" + }, + label: { + label: "表示名" + }, + audience: { + label: "対象者" + }, + groups: { + label: "グループ" + }, + description: { + label: "説明" + } + } }, permission: { label: "権限セット", @@ -2774,15 +2898,66 @@ export const jaJPMetadataForms: NonNullable = }, sharing_rule: { label: "共有ルール", - description: "パッケージが宣言するレコード共有ルール。組織は自身のルールを設定で作成します" + description: "パッケージが宣言するレコード共有ルール。組織は自身のルールを設定で作成します", + fields: { + name: { + label: "名前" + }, + label: { + label: "表示名" + }, + object: { + label: "オブジェクト" + }, + sharedWith: { + label: "共有先" + }, + accessLevel: { + label: "アクセスレベル" + } + } }, queue: { label: "キュー", - description: "名前付きの担当者の集まり。レコードはその中の誰かが引き受けるまでここに置かれます。組織は自身のキューを設定で用意します" + description: "名前付きの担当者の集まり。レコードはその中の誰かが引き受けるまでここに置かれます。組織は自身のキューを設定で用意します", + fields: { + name: { + label: "名前" + }, + label: { + label: "表示名" + }, + members: { + label: "メンバー" + }, + description: { + label: "説明" + } + } }, assignment_rule: { label: "割り当てルール", - description: "パッケージが宣言するルール。新しいレコードをキューまたは担当者に振り分けます" + description: "パッケージが宣言するルール。新しいレコードをキューまたは担当者に振り分けます", + fields: { + name: { + label: "名前" + }, + label: { + label: "表示名" + }, + object: { + label: "オブジェクト" + }, + entries: { + label: "エントリ" + }, + active: { + label: "有効" + }, + description: { + label: "説明" + } + } }, agent: { label: "AI エージェント", @@ -2864,6 +3039,9 @@ export const jaJPMetadataForms: NonNullable = guardrails: { label: "ガードレール", helpText: "安全ルールとコンテンツポリシー" + }, + "model.model": { + label: "モデル" } } }, diff --git a/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts index 73d0d716862..144f9f6bf48 100644 --- a/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ko.metadata-forms.generated.ts @@ -1088,15 +1088,54 @@ export const koMetadataForms: NonNullable = { }, seed: { label: "시드 데이터", - description: "게시할 때 적용되는 픽스처 / 초기화 데이터" + description: "게시할 때 적용되는 픽스처 / 초기화 데이터", + fields: { + object: { + label: "객체" + }, + mode: { + label: "모드" + } + } }, picklist: { label: "선택 목록", - description: "선택 필드가 이름으로 참조하는 공유 옵션 목록" + description: "선택 필드가 이름으로 참조하는 공유 옵션 목록", + fields: { + name: { + label: "이름" + }, + label: { + label: "레이블" + }, + options: { + label: "옵션" + }, + description: { + label: "설명" + } + } }, mapping: { label: "가져오기 매핑", - description: "가져올 때 이름으로 참조하는 재사용 가능한 가져오기/내보내기 필드 매핑(이름 변경 + 변환)" + description: "가져올 때 이름으로 참조하는 재사용 가능한 가져오기/내보내기 필드 매핑(이름 변경 + 변환)", + fields: { + name: { + label: "이름" + }, + label: { + label: "레이블" + }, + targetObject: { + label: "대상 객체" + }, + mode: { + label: "모드" + }, + sourceFormat: { + label: "원본 형식" + } + } }, view: { label: "뷰", @@ -1420,6 +1459,9 @@ export const koMetadataForms: NonNullable = { "sharing.lockedBy": { label: "잠근 작업자", helpText: "뷰 구성을 잠근 사용자" + }, + object: { + label: "객체" } } }, @@ -2576,7 +2618,24 @@ export const koMetadataForms: NonNullable = { } }, job: { - label: "백그라운드 작업" + label: "백그라운드 작업", + fields: { + name: { + label: "이름" + }, + label: { + label: "레이블" + }, + schedule: { + label: "일정" + }, + enabled: { + label: "사용" + }, + description: { + label: "설명" + } + } }, datasource: { label: "데이터 소스" @@ -2586,10 +2645,41 @@ export const koMetadataForms: NonNullable = { }, api: { label: "API 엔드포인트", - description: "다른 시스템이 호출해 플로우를 실행하거나 앱의 레코드를 다루는 안정적인 HTTP URL" + description: "다른 시스템이 호출해 플로우를 실행하거나 앱의 레코드를 다루는 안정적인 HTTP URL", + fields: { + name: { + label: "이름" + }, + method: { + label: "메서드" + }, + path: { + label: "경로" + }, + type: { + label: "유형" + }, + "objectParams.object": { + label: "객체" + }, + "objectParams.operation": { + label: "작업" + } + } }, translation: { - label: "번역" + label: "번역", + fields: { + name: { + label: "이름" + }, + label: { + label: "레이블" + }, + locale: { + label: "로캘" + } + } }, email_template: { label: "이메일 템플릿", @@ -2666,11 +2756,45 @@ export const koMetadataForms: NonNullable = { }, doc: { label: "문서", - description: "패키지가 제공하거나 직접 작성하는 Markdown 도움말 페이지" + description: "패키지가 제공하거나 직접 작성하는 Markdown 도움말 페이지", + fields: { + name: { + label: "이름" + }, + label: { + label: "레이블" + }, + group: { + label: "그룹" + }, + tags: { + label: "태그" + }, + description: { + label: "설명" + } + } }, book: { label: "문서 책", - description: "도움말 페이지를 순서 있는 섹션으로 묶는 목차" + description: "도움말 페이지를 순서 있는 섹션으로 묶는 목차", + fields: { + name: { + label: "이름" + }, + label: { + label: "레이블" + }, + audience: { + label: "대상" + }, + groups: { + label: "그룹" + }, + description: { + label: "설명" + } + } }, permission: { label: "권한 세트", @@ -2774,15 +2898,66 @@ export const koMetadataForms: NonNullable = { }, sharing_rule: { label: "공유 규칙", - description: "패키지가 레코드를 공유하기 위해 선언하는 규칙으로, 조직은 설정에서 자체 규칙을 작성합니다" + description: "패키지가 레코드를 공유하기 위해 선언하는 규칙으로, 조직은 설정에서 자체 규칙을 작성합니다", + fields: { + name: { + label: "이름" + }, + label: { + label: "레이블" + }, + object: { + label: "객체" + }, + sharedWith: { + label: "공유 대상" + }, + accessLevel: { + label: "액세스 수준" + } + } }, queue: { label: "대기열", - description: "구성원 중 한 명이 레코드를 맡을 때까지 레코드가 머무를 수 있는 이름 있는 사람 집합으로, 조직은 설정에서 자체 대기열의 인원을 구성합니다" + description: "구성원 중 한 명이 레코드를 맡을 때까지 레코드가 머무를 수 있는 이름 있는 사람 집합으로, 조직은 설정에서 자체 대기열의 인원을 구성합니다", + fields: { + name: { + label: "이름" + }, + label: { + label: "레이블" + }, + members: { + label: "구성원" + }, + description: { + label: "설명" + } + } }, assignment_rule: { label: "배정 규칙", - description: "패키지가 새 레코드를 대기열이나 사람에게 보내기 위해 선언하는 규칙" + description: "패키지가 새 레코드를 대기열이나 사람에게 보내기 위해 선언하는 규칙", + fields: { + name: { + label: "이름" + }, + label: { + label: "레이블" + }, + object: { + label: "객체" + }, + entries: { + label: "항목" + }, + active: { + label: "활성" + }, + description: { + label: "설명" + } + } }, agent: { label: "AI 에이전트", @@ -2864,6 +3039,9 @@ export const koMetadataForms: NonNullable = { guardrails: { label: "보호 장치", helpText: "안전 규칙과 콘텐츠 정책" + }, + "model.model": { + label: "모델" } } }, diff --git a/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts index 72120930288..b913320ef10 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.metadata-forms.generated.ts @@ -1088,15 +1088,54 @@ export const ptBRMetadataForms: NonNullable = }, seed: { label: "Dados iniciais", - description: "Dados de fixture / inicialização aplicados na publicação" + description: "Dados de fixture / inicialização aplicados na publicação", + fields: { + object: { + label: "Objeto" + }, + mode: { + label: "Modo" + } + } }, picklist: { label: "Lista de opções", - description: "Lista de opções compartilhada que os campos de seleção referenciam pelo nome" + description: "Lista de opções compartilhada que os campos de seleção referenciam pelo nome", + fields: { + name: { + label: "Nome" + }, + label: { + label: "Rótulo" + }, + options: { + label: "Opções" + }, + description: { + label: "Descrição" + } + } }, mapping: { label: "Mapeamento de importação", - description: "Mapeamento de campos reutilizável para importação/exportação (renomeação + transformações), referenciado pelo nome na importação" + description: "Mapeamento de campos reutilizável para importação/exportação (renomeação + transformações), referenciado pelo nome na importação", + fields: { + name: { + label: "Nome" + }, + label: { + label: "Rótulo" + }, + targetObject: { + label: "Objeto de destino" + }, + mode: { + label: "Modo" + }, + sourceFormat: { + label: "Formato de origem" + } + } }, view: { label: "Visualização", @@ -1420,6 +1459,9 @@ export const ptBRMetadataForms: NonNullable = "sharing.lockedBy": { label: "Bloqueado por", helpText: "Usuário que bloqueou a configuração da visualização" + }, + object: { + label: "Objeto" } } }, @@ -2576,7 +2618,24 @@ export const ptBRMetadataForms: NonNullable = } }, job: { - label: "Tarefa em segundo plano" + label: "Tarefa em segundo plano", + fields: { + name: { + label: "Nome" + }, + label: { + label: "Rótulo" + }, + schedule: { + label: "Agendamento" + }, + enabled: { + label: "Ativado" + }, + description: { + label: "Descrição" + } + } }, datasource: { label: "Fonte de dados" @@ -2586,10 +2645,41 @@ export const ptBRMetadataForms: NonNullable = }, api: { label: "Endpoint de API", - description: "Uma URL HTTP estável que outros sistemas chamam para executar um fluxo ou trabalhar com registros no app" + description: "Uma URL HTTP estável que outros sistemas chamam para executar um fluxo ou trabalhar com registros no app", + fields: { + name: { + label: "Nome" + }, + method: { + label: "Método" + }, + path: { + label: "Caminho" + }, + type: { + label: "Tipo" + }, + "objectParams.object": { + label: "Objeto" + }, + "objectParams.operation": { + label: "Operação" + } + } }, translation: { - label: "Tradução" + label: "Tradução", + fields: { + name: { + label: "Nome" + }, + label: { + label: "Rótulo" + }, + locale: { + label: "Idioma" + } + } }, email_template: { label: "Modelo de e-mail", @@ -2666,11 +2756,45 @@ export const ptBRMetadataForms: NonNullable = }, doc: { label: "Documentação", - description: "Uma página de ajuda escrita em Markdown que um pacote fornece ou que você mesmo escreve" + description: "Uma página de ajuda escrita em Markdown que um pacote fornece ou que você mesmo escreve", + fields: { + name: { + label: "Nome" + }, + label: { + label: "Rótulo" + }, + group: { + label: "Grupo" + }, + tags: { + label: "Marcadores" + }, + description: { + label: "Descrição" + } + } }, book: { label: "Livro de documentação", - description: "Um sumário que agrupa páginas de ajuda em seções ordenadas" + description: "Um sumário que agrupa páginas de ajuda em seções ordenadas", + fields: { + name: { + label: "Nome" + }, + label: { + label: "Rótulo" + }, + audience: { + label: "Público" + }, + groups: { + label: "Grupos" + }, + description: { + label: "Descrição" + } + } }, permission: { label: "Conjunto de permissões", @@ -2774,15 +2898,66 @@ export const ptBRMetadataForms: NonNullable = }, sharing_rule: { label: "Regra de compartilhamento", - description: "Uma regra que um pacote declara para compartilhar registros; as organizações criam as suas na Configuração" + description: "Uma regra que um pacote declara para compartilhar registros; as organizações criam as suas na Configuração", + fields: { + name: { + label: "Nome" + }, + label: { + label: "Rótulo" + }, + object: { + label: "Objeto" + }, + sharedWith: { + label: "Compartilhado com" + }, + accessLevel: { + label: "Nível de acesso" + } + } }, queue: { label: "Fila", - description: "Um conjunto nomeado de pessoas em que os registros podem ficar até que uma delas assuma o registro; as organizações montam as suas na Configuração" + description: "Um conjunto nomeado de pessoas em que os registros podem ficar até que uma delas assuma o registro; as organizações montam as suas na Configuração", + fields: { + name: { + label: "Nome" + }, + label: { + label: "Rótulo" + }, + members: { + label: "Membros" + }, + description: { + label: "Descrição" + } + } }, assignment_rule: { label: "Regra de atribuição", - description: "Uma regra que um pacote declara para encaminhar novos registros a uma fila ou a uma pessoa" + description: "Uma regra que um pacote declara para encaminhar novos registros a uma fila ou a uma pessoa", + fields: { + name: { + label: "Nome" + }, + label: { + label: "Rótulo" + }, + object: { + label: "Objeto" + }, + entries: { + label: "Entradas" + }, + active: { + label: "Ativo" + }, + description: { + label: "Descrição" + } + } }, agent: { label: "Agente de IA", @@ -2864,6 +3039,9 @@ export const ptBRMetadataForms: NonNullable = guardrails: { label: "Salvaguardas", helpText: "Regras de segurança e políticas de conteúdo" + }, + "model.model": { + label: "Modelo" } } }, diff --git a/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts index 3d9914781af..9aaa635859d 100644 --- a/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/ru.metadata-forms.generated.ts @@ -1088,15 +1088,54 @@ export const ruMetadataForms: NonNullable = { }, seed: { label: "Начальные данные", - description: "Тестовые / инициализирующие данные, применяемые при публикации" + description: "Тестовые / инициализирующие данные, применяемые при публикации", + fields: { + object: { + label: "Объект" + }, + mode: { + label: "Режим" + } + } }, picklist: { label: "Список вариантов", - description: "Общий список вариантов, на который поля выбора ссылаются по имени" + description: "Общий список вариантов, на который поля выбора ссылаются по имени", + fields: { + name: { + label: "Имя" + }, + label: { + label: "Метка" + }, + options: { + label: "Варианты" + }, + description: { + label: "Описание" + } + } }, mapping: { label: "Сопоставление импорта", - description: "Повторно используемое сопоставление полей для импорта/экспорта (переименование + преобразования), на которое ссылаются по имени при импорте" + description: "Повторно используемое сопоставление полей для импорта/экспорта (переименование + преобразования), на которое ссылаются по имени при импорте", + fields: { + name: { + label: "Имя" + }, + label: { + label: "Метка" + }, + targetObject: { + label: "Целевой объект" + }, + mode: { + label: "Режим" + }, + sourceFormat: { + label: "Формат источника" + } + } }, view: { label: "Представление", @@ -1420,6 +1459,9 @@ export const ruMetadataForms: NonNullable = { "sharing.lockedBy": { label: "Кем заблокировано", helpText: "Пользователь, заблокировавший настройку представления" + }, + object: { + label: "Объект" } } }, @@ -2576,7 +2618,24 @@ export const ruMetadataForms: NonNullable = { } }, job: { - label: "Фоновое задание" + label: "Фоновое задание", + fields: { + name: { + label: "Имя" + }, + label: { + label: "Метка" + }, + schedule: { + label: "Расписание" + }, + enabled: { + label: "Включено" + }, + description: { + label: "Описание" + } + } }, datasource: { label: "Источник данных" @@ -2586,10 +2645,41 @@ export const ruMetadataForms: NonNullable = { }, api: { label: "Конечная точка API", - description: "Постоянный HTTP-URL, который вызывают другие системы, чтобы запустить поток или работать с записями в приложении" + description: "Постоянный HTTP-URL, который вызывают другие системы, чтобы запустить поток или работать с записями в приложении", + fields: { + name: { + label: "Имя" + }, + method: { + label: "Метод" + }, + path: { + label: "Путь" + }, + type: { + label: "Тип" + }, + "objectParams.object": { + label: "Объект" + }, + "objectParams.operation": { + label: "Операция" + } + } }, translation: { - label: "Перевод" + label: "Перевод", + fields: { + name: { + label: "Имя" + }, + label: { + label: "Метка" + }, + locale: { + label: "Язык" + } + } }, email_template: { label: "Шаблон письма", @@ -2666,11 +2756,45 @@ export const ruMetadataForms: NonNullable = { }, doc: { label: "Документация", - description: "Страница справки в Markdown, которую поставляет пакет или пишете вы сами" + description: "Страница справки в Markdown, которую поставляет пакет или пишете вы сами", + fields: { + name: { + label: "Имя" + }, + label: { + label: "Метка" + }, + group: { + label: "Группа" + }, + tags: { + label: "Теги" + }, + description: { + label: "Описание" + } + } }, book: { label: "Книга документации", - description: "Оглавление, группирующее страницы справки в упорядоченные разделы" + description: "Оглавление, группирующее страницы справки в упорядоченные разделы", + fields: { + name: { + label: "Имя" + }, + label: { + label: "Метка" + }, + audience: { + label: "Аудитория" + }, + groups: { + label: "Группы" + }, + description: { + label: "Описание" + } + } }, permission: { label: "Набор разрешений", @@ -2774,15 +2898,66 @@ export const ruMetadataForms: NonNullable = { }, sharing_rule: { label: "Правило общего доступа", - description: "Правило, которое пакет объявляет для открытия доступа к записям; организации создают собственные в Настройке" + description: "Правило, которое пакет объявляет для открытия доступа к записям; организации создают собственные в Настройке", + fields: { + name: { + label: "Имя" + }, + label: { + label: "Метка" + }, + object: { + label: "Объект" + }, + sharedWith: { + label: "Доступ для" + }, + accessLevel: { + label: "Уровень доступа" + } + } }, queue: { label: "Очередь", - description: "Именованная группа людей, в которой записи могут находиться, пока кто-то из них не возьмёт запись; организации формируют собственные в Настройке" + description: "Именованная группа людей, в которой записи могут находиться, пока кто-то из них не возьмёт запись; организации формируют собственные в Настройке", + fields: { + name: { + label: "Имя" + }, + label: { + label: "Метка" + }, + members: { + label: "Участники" + }, + description: { + label: "Описание" + } + } }, assignment_rule: { label: "Правило назначения", - description: "Правило, которое пакет объявляет для направления новых записей в очередь или человеку" + description: "Правило, которое пакет объявляет для направления новых записей в очередь или человеку", + fields: { + name: { + label: "Имя" + }, + label: { + label: "Метка" + }, + object: { + label: "Объект" + }, + entries: { + label: "Записи" + }, + active: { + label: "Активен" + }, + description: { + label: "Описание" + } + } }, agent: { label: "ИИ-агент", @@ -2864,6 +3039,9 @@ export const ruMetadataForms: NonNullable = { guardrails: { label: "Меры защиты", helpText: "Правила безопасности и политики содержимого" + }, + "model.model": { + label: "Модель" } } }, diff --git a/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts index eed2607f37d..bd5eca943b5 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts @@ -1088,15 +1088,54 @@ export const zhCNMetadataForms: NonNullable = }, seed: { label: "种子数据", - description: "发布时应用的预置/初始化数据" + description: "发布时应用的预置/初始化数据", + fields: { + object: { + label: "对象" + }, + mode: { + label: "模式" + } + } }, picklist: { label: "共享选项集", - description: "选择字段按名称引用的共享选项列表" + description: "选择字段按名称引用的共享选项列表", + fields: { + name: { + label: "名称" + }, + label: { + label: "显示名称" + }, + options: { + label: "选项" + }, + description: { + label: "描述" + } + } }, mapping: { label: "导入映射", - description: "可复用的导入/导出字段映射(重命名 + 转换),在导入时按名称引用" + description: "可复用的导入/导出字段映射(重命名 + 转换),在导入时按名称引用", + fields: { + name: { + label: "名称" + }, + label: { + label: "显示名称" + }, + targetObject: { + label: "目标对象" + }, + mode: { + label: "模式" + }, + sourceFormat: { + label: "源格式" + } + } }, view: { label: "视图", @@ -1420,6 +1459,9 @@ export const zhCNMetadataForms: NonNullable = "sharing.lockedBy": { label: "锁定者", helpText: "锁定该视图配置的用户" + }, + object: { + label: "对象" } } }, @@ -2576,7 +2618,24 @@ export const zhCNMetadataForms: NonNullable = } }, job: { - label: "后台作业" + label: "后台作业", + fields: { + name: { + label: "名称" + }, + label: { + label: "显示名称" + }, + schedule: { + label: "调度计划" + }, + enabled: { + label: "已启用" + }, + description: { + label: "描述" + } + } }, datasource: { label: "数据源" @@ -2586,10 +2645,41 @@ export const zhCNMetadataForms: NonNullable = }, api: { label: "API 端点", - description: "其他系统调用的稳定 HTTP URL,用于运行流程或操作应用中的记录" + description: "其他系统调用的稳定 HTTP URL,用于运行流程或操作应用中的记录", + fields: { + name: { + label: "名称" + }, + method: { + label: "方法" + }, + path: { + label: "路径" + }, + type: { + label: "类型" + }, + "objectParams.object": { + label: "对象" + }, + "objectParams.operation": { + label: "操作" + } + } }, translation: { - label: "翻译" + label: "翻译", + fields: { + name: { + label: "名称" + }, + label: { + label: "显示名称" + }, + locale: { + label: "语言区域" + } + } }, email_template: { label: "邮件模板", @@ -2666,11 +2756,45 @@ export const zhCNMetadataForms: NonNullable = }, doc: { label: "文档", - description: "以 Markdown 编写的帮助页面,可由软件包随附,也可自行编写" + description: "以 Markdown 编写的帮助页面,可由软件包随附,也可自行编写", + fields: { + name: { + label: "名称" + }, + label: { + label: "显示名称" + }, + group: { + label: "分组" + }, + tags: { + label: "标签" + }, + description: { + label: "描述" + } + } }, book: { label: "文档手册", - description: "将帮助页面按顺序分节组织的目录" + description: "将帮助页面按顺序分节组织的目录", + fields: { + name: { + label: "名称" + }, + label: { + label: "显示名称" + }, + audience: { + label: "受众" + }, + groups: { + label: "分组" + }, + description: { + label: "描述" + } + } }, permission: { label: "权限集", @@ -2774,15 +2898,66 @@ export const zhCNMetadataForms: NonNullable = }, sharing_rule: { label: "共享规则", - description: "软件包声明的记录共享规则;组织在设置中编写自己的规则" + description: "软件包声明的记录共享规则;组织在设置中编写自己的规则", + fields: { + name: { + label: "名称" + }, + label: { + label: "显示名称" + }, + object: { + label: "对象" + }, + sharedWith: { + label: "共享给" + }, + accessLevel: { + label: "访问级别" + } + } }, queue: { label: "队列", - description: "一组具名的人员,记录可停留其中,直到其中一人认领;组织在设置中配置自己的队列" + description: "一组具名的人员,记录可停留其中,直到其中一人认领;组织在设置中配置自己的队列", + fields: { + name: { + label: "名称" + }, + label: { + label: "显示名称" + }, + members: { + label: "成员" + }, + description: { + label: "描述" + } + } }, assignment_rule: { label: "分配规则", - description: "软件包声明的规则,把新记录分配到某个队列或某个人" + description: "软件包声明的规则,把新记录分配到某个队列或某个人", + fields: { + name: { + label: "名称" + }, + label: { + label: "显示名称" + }, + object: { + label: "对象" + }, + entries: { + label: "条目" + }, + active: { + label: "启用" + }, + description: { + label: "描述" + } + } }, agent: { label: "AI 代理", @@ -2864,6 +3039,9 @@ export const zhCNMetadataForms: NonNullable = guardrails: { label: "护栏", helpText: "安全规则与内容策略" + }, + "model.model": { + label: "模型" } } }, diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts b/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts index 2c8c7a7bfdf..1770bc25a68 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.metadata-forms.generated.ts @@ -1088,15 +1088,54 @@ export const zhHantMetadataForms: NonNullable }, seed: { label: "種子資料", - description: "發布時套用的預置/初始化資料" + description: "發布時套用的預置/初始化資料", + fields: { + object: { + label: "物件" + }, + mode: { + label: "模式" + } + } }, picklist: { label: "共用選項集", - description: "選擇欄位依名稱參照的共用選項清單" + description: "選擇欄位依名稱參照的共用選項清單", + fields: { + name: { + label: "名稱" + }, + label: { + label: "顯示名稱" + }, + options: { + label: "選項" + }, + description: { + label: "描述" + } + } }, mapping: { label: "匯入對應", - description: "可複用的匯入/匯出欄位對應(重新命名 + 轉換),在匯入時依名稱參照" + description: "可複用的匯入/匯出欄位對應(重新命名 + 轉換),在匯入時依名稱參照", + fields: { + name: { + label: "名稱" + }, + label: { + label: "顯示名稱" + }, + targetObject: { + label: "目標物件" + }, + mode: { + label: "模式" + }, + sourceFormat: { + label: "來源格式" + } + } }, view: { label: "檢視", @@ -1420,6 +1459,9 @@ export const zhHantMetadataForms: NonNullable "sharing.lockedBy": { label: "鎖定者", helpText: "鎖定該檢視設定的使用者" + }, + object: { + label: "物件" } } }, @@ -2576,7 +2618,24 @@ export const zhHantMetadataForms: NonNullable } }, job: { - label: "背景工作" + label: "背景工作", + fields: { + name: { + label: "名稱" + }, + label: { + label: "顯示名稱" + }, + schedule: { + label: "排程" + }, + enabled: { + label: "已啟用" + }, + description: { + label: "描述" + } + } }, datasource: { label: "資料來源" @@ -2586,10 +2645,41 @@ export const zhHantMetadataForms: NonNullable }, api: { label: "API 端點", - description: "其他系統呼叫的穩定 HTTP URL,用於執行流程或操作應用程式中的記錄" + description: "其他系統呼叫的穩定 HTTP URL,用於執行流程或操作應用程式中的記錄", + fields: { + name: { + label: "名稱" + }, + method: { + label: "方法" + }, + path: { + label: "路徑" + }, + type: { + label: "類型" + }, + "objectParams.object": { + label: "物件" + }, + "objectParams.operation": { + label: "操作" + } + } }, translation: { - label: "翻譯" + label: "翻譯", + fields: { + name: { + label: "名稱" + }, + label: { + label: "顯示名稱" + }, + locale: { + label: "地區語言" + } + } }, email_template: { label: "郵件範本", @@ -2666,11 +2756,45 @@ export const zhHantMetadataForms: NonNullable }, doc: { label: "文件", - description: "以 Markdown 編寫的說明頁面,可由套件隨附,也可自行編寫" + description: "以 Markdown 編寫的說明頁面,可由套件隨附,也可自行編寫", + fields: { + name: { + label: "名稱" + }, + label: { + label: "顯示名稱" + }, + group: { + label: "分組" + }, + tags: { + label: "標籤" + }, + description: { + label: "描述" + } + } }, book: { label: "文件手冊", - description: "將說明頁面依順序分節組織的目錄" + description: "將說明頁面依順序分節組織的目錄", + fields: { + name: { + label: "名稱" + }, + label: { + label: "顯示名稱" + }, + audience: { + label: "受眾" + }, + groups: { + label: "分組" + }, + description: { + label: "描述" + } + } }, permission: { label: "權限集", @@ -2774,15 +2898,66 @@ export const zhHantMetadataForms: NonNullable }, sharing_rule: { label: "共用規則", - description: "套件宣告的記錄共用規則;組織在設定中編寫自己的規則" + description: "套件宣告的記錄共用規則;組織在設定中編寫自己的規則", + fields: { + name: { + label: "名稱" + }, + label: { + label: "顯示名稱" + }, + object: { + label: "物件" + }, + sharedWith: { + label: "共用對象" + }, + accessLevel: { + label: "存取層級" + } + } }, queue: { label: "佇列", - description: "一組具名的人員,記錄可停留其中,直到其中一人認領;組織在設定中設定自己的佇列" + description: "一組具名的人員,記錄可停留其中,直到其中一人認領;組織在設定中設定自己的佇列", + fields: { + name: { + label: "名稱" + }, + label: { + label: "顯示名稱" + }, + members: { + label: "成員" + }, + description: { + label: "描述" + } + } }, assignment_rule: { label: "指派規則", - description: "套件宣告的規則,把新記錄指派到某個佇列或某個人" + description: "套件宣告的規則,把新記錄指派到某個佇列或某個人", + fields: { + name: { + label: "名稱" + }, + label: { + label: "顯示名稱" + }, + object: { + label: "物件" + }, + entries: { + label: "條目" + }, + active: { + label: "啟用" + }, + description: { + label: "描述" + } + } }, agent: { label: "AI 代理", @@ -2864,6 +3039,9 @@ export const zhHantMetadataForms: NonNullable guardrails: { label: "護欄", helpText: "安全規則與內容策略" + }, + "model.model": { + label: "模型" } } }, diff --git a/packages/rest/src/index.ts b/packages/rest/src/index.ts index b7359ede047..1d964c7c6f1 100644 --- a/packages/rest/src/index.ts +++ b/packages/rest/src/index.ts @@ -192,6 +192,7 @@ export { STORED_VERSION_DOOR_POLICY, translateMetaEnvelope, translateMetaList, + translateMetaTypesListing, wantsMetaItemLayers, metaCallerPackageQuery, } from './meta-item-read-gate.js'; diff --git a/packages/rest/src/meta-item-read-gate.ts b/packages/rest/src/meta-item-read-gate.ts index 3b1e09164a8..0f5a395e302 100644 --- a/packages/rest/src/meta-item-read-gate.ts +++ b/packages/rest/src/meta-item-read-gate.ts @@ -3651,6 +3651,53 @@ export interface MetaListTranslationSources { reportTranslationFault?(warning: string): void; } +/** + * The `/meta/types` listing in the request's locale: each entry's type label + * and description, its `form` labels, its `list` headers and its JSON Schema + * titles, all through the `metadataForms.` group of the bundle. + * + * The one translation both doors run (objectstack#36886): `RestServer`'s + * `GET /meta/types` and the runtime dispatcher's `GET /metadata/types`, so a + * reader gets the same words whichever door their host serves. + * + * No bundle or no locale answers the listing as it came; an entry is never + * rewritten in place. + */ +export async function translateMetaTypesListing( + sources: Pick, + payload: unknown, +): Promise { + const listing: any = payload; + if (!listing || typeof listing !== 'object' || !Array.isArray(listing.entries)) return payload; + const i18n = await sources.resolveI18nService(); + const bundle = translationBundleOf(i18n, (warning) => sources.reportTranslationFault?.(warning)); + if (!bundle) return payload; + const locale = sources.requestLocale(i18n); + if (!locale) return payload; + const { + resolveMetadataTypeLabel, + resolveMetadataTypeDescription, + resolveMetadataFormLabels, + resolveMetadataFormSchemaTitles, + resolveMetadataListLabels, + } = await import('@objectstack/spec/system'); + const opts = metaTranslateOptions(i18n, locale); + const entries = listing.entries.map((entry: any) => { + if (!entry || typeof entry !== 'object' || typeof entry.type !== 'string') return entry; + const next: any = { ...entry }; + next.label = resolveMetadataTypeLabel(bundle, entry.type, entry.label ?? entry.type, opts); + const desc = resolveMetadataTypeDescription(bundle, entry.type, entry.description, opts); + if (desc !== undefined) next.description = desc; + if (entry.form) next.form = resolveMetadataFormLabels(entry.form, entry.type, bundle, opts); + if (entry.list) next.list = resolveMetadataListLabels(entry.list, entry.type, bundle, opts); + if (entry.schema && typeof entry.schema === 'object') { + next.schema = resolveMetadataFormSchemaTitles(entry.schema, entry.type, bundle, opts); + } + return next; + }); + return { ...listing, entries }; +} + /** * [#20320] Translate a metadata LIST — a bare array or the * `{ type, items }` envelope, answered in the shape it came in — for the diff --git a/packages/rest/src/rest-server.ts b/packages/rest/src/rest-server.ts index e33154f0d98..77d2dded763 100644 --- a/packages/rest/src/rest-server.ts +++ b/packages/rest/src/rest-server.ts @@ -4777,38 +4777,16 @@ export class RestServer { * so this is safe to call unconditionally from the `/meta` handler. */ private async translateMetaTypesResponse(req: any, environmentId: string | undefined, payload: any): Promise { - if (!payload || typeof payload !== 'object' || !Array.isArray(payload.entries)) return payload; - const i18n = await this.resolveI18nService(environmentId, req); - const bundle = this.buildTranslationBundle(i18n); - if (!bundle) return payload; - const locale = this.extractLocale(req, i18n); - if (!locale) return payload; - const { - resolveMetadataTypeLabel, - resolveMetadataTypeDescription, - resolveMetadataFormLabels, - resolveMetadataFormSchemaTitles, - resolveMetadataListLabels, - } = await import('@objectstack/spec/system'); - const opts = RestServer.translateOptionsFor(i18n, locale); - const entries = payload.entries.map((entry: any) => { - if (!entry || typeof entry !== 'object' || typeof entry.type !== 'string') return entry; - const next: any = { ...entry }; - next.label = resolveMetadataTypeLabel(bundle, entry.type, entry.label ?? entry.type, opts); - const desc = resolveMetadataTypeDescription(bundle, entry.type, entry.description, opts); - if (desc !== undefined) next.description = desc; - if (entry.form) { - next.form = resolveMetadataFormLabels(entry.form, entry.type, bundle, opts); - } - if (entry.list) { - next.list = resolveMetadataListLabels(entry.list, entry.type, bundle, opts); - } - if (entry.schema && typeof entry.schema === 'object') { - next.schema = resolveMetadataFormSchemaTitles(entry.schema, entry.type, bundle, opts); - } - return next; - }); - return { ...payload, entries }; + // [#36886] The one translation the runtime dispatcher's + // `/metadata/types` runs too: `translateMetaTypesListing` in + // `./meta-item-read-gate.ts`. + return metaReadGate.translateMetaTypesListing( + { + resolveI18nService: () => this.resolveI18nService(environmentId, req), + requestLocale: (i18n) => this.extractLocale(req, i18n), + }, + payload, + ); } /** diff --git a/packages/runtime/src/domains/meta-types-translation-parity-36886.test.ts b/packages/runtime/src/domains/meta-types-translation-parity-36886.test.ts new file mode 100644 index 00000000000..7d7fdc8fef9 --- /dev/null +++ b/packages/runtime/src/domains/meta-types-translation-parity-36886.test.ts @@ -0,0 +1,122 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36886 — the runtime dispatcher answers the metadata types + * listing in the reader's language, through the one translation + * `RestServer`'s `GET /meta` runs (`translateMetaTypesListing`). + * + * Before this the dispatcher served `getMetaTypes()` as it came, so a zh-CN + * reader of a host served through it got English type labels, form labels + * and — since objectstack#36860 — English list headers, while the same reader + * of a `RestServer` host got Chinese. + * + * Pinned, each against a control: both dispatcher doors (`GET /meta` and + * `GET /meta/types`) answer the same entries as `RestServer`, translated; an + * en request and a host with no i18n service answer the listing untranslated. + */ +import { describe, it, expect, vi } from 'vitest'; +// Paid at collection: the dispatcher reaches it through a dynamic import. +import '@objectstack/metadata'; +import { RestServer } from '@objectstack/rest'; +import { HttpDispatcher } from '../http-dispatcher.js'; + +const listing = () => ({ + types: ['hook'], + entries: [ + { + type: 'hook', + label: 'Hook', + form: { schemaId: 'hook', type: 'simple', sections: [{ label: 'Basics', fields: [{ field: 'events' }] }] }, + list: { + data: { provider: 'schema', schemaId: 'hook' }, + columns: [ + { field: 'name', label: 'Name' }, + { field: 'events', label: 'Events', type: 'list' }, + ], + }, + }, + ], +}); + +const BUNDLE: Record = { + en: {}, + 'zh-CN': { + metadataForms: { + hook: { + label: '钩子', + fields: { name: { label: '名称' }, events: { label: '事件' } }, + }, + }, + }, +}; + +const i18nDouble = { + getLocales: () => Object.keys(BUNDLE), + getTranslations: (locale: string) => BUNDLE[locale], + getDefaultLocale: () => 'en', +}; + +const protocolDouble = () => ({ getMetaTypes: vi.fn(async () => listing()) }); + +const CTX = { userId: 'u_admin', isSystem: false, systemPermissions: ['studio.access'] }; + +function bootDispatcher(withI18n = true) { + const services: Record = { protocol: protocolDouble(), ...(withI18n ? { i18n: i18nDouble } : {}) }; + const get = (n: string) => services[n] ?? null; + const kernel: any = { context: { getService: get }, getService: get, getServiceAsync: async (n: string) => get(n) }; + const dispatcher = new HttpDispatcher(kernel); + (dispatcher as any).timedResolveExecutionContext = async () => ({ ...CTX }); + return async (path: string, locale: string) => { + const request = { headers: { 'accept-language': locale }, url: `http://localhost/api/v1${path}` }; + const res = await dispatcher.dispatch('GET', path, undefined, {}, { request } as any); + expect(res.response?.status).toBe(200); + return (res.response?.body as any)?.data; + }; +} + +function bootRest() { + const server = { + get: vi.fn(), post: vi.fn(), put: vi.fn(), delete: vi.fn(), patch: vi.fn(), use: vi.fn(), + listen: vi.fn().mockResolvedValue(undefined), close: vi.fn().mockResolvedValue(undefined), + }; + const rest: any = new RestServer(server as any, protocolDouble() as any, {} as any); + rest.resolveExecCtx = async () => ({ ...CTX }); + rest.i18nServiceProvider = async () => i18nDouble; + rest.registerRoutes(); + const route = rest.getRoutes().find((r: any) => r.method === 'GET' && r.path === '/api/v1/meta'); + return async (locale: string) => { + let body: any; + const res: any = { status: vi.fn(() => res), header: vi.fn(() => res), send: vi.fn(() => res), json: vi.fn((b: any) => { body = b; return res; }) }; + await route.handler({ method: 'GET', params: {}, query: {}, body: {}, headers: { 'accept-language': locale } }, res); + return body; + }; +} + +const read = (data: any) => { + const hook = data.entries.find((e: any) => e.type === 'hook'); + return { + label: hook.label, + form: hook.form.sections[0].fields[0].label, + headers: hook.list.columns.map((c: any) => c.label), + }; +}; + +describe('the dispatcher translates the types listing as RestServer does (objectstack#36886)', () => { + it('both dispatcher doors answer zh-CN with the labels, form and list headers RestServer answers', async () => { + const reference = read(await bootRest()('zh-CN')); + expect(reference).toEqual({ label: '钩子', form: '事件', headers: ['名称', '事件'] }); + const dispatch = bootDispatcher(); + expect(read(await dispatch('/meta', 'zh-CN'))).toEqual(reference); + expect(read(await dispatch('/meta/types', 'zh-CN'))).toEqual(reference); + }); + + it('control — an en request answers the listing as declared', async () => { + const dispatch = bootDispatcher(); + expect(read(await dispatch('/meta', 'en'))).toEqual({ label: 'Hook', form: undefined, headers: ['Name', 'Events'] }); + }); + + it('control — a host with no i18n service answers the listing as declared', async () => { + const dispatch = bootDispatcher(false); + expect(read(await dispatch('/meta/types', 'zh-CN'))).toEqual({ label: 'Hook', form: undefined, headers: ['Name', 'Events'] }); + }); +}); diff --git a/packages/runtime/src/domains/meta.ts b/packages/runtime/src/domains/meta.ts index 8bf3b57b2d3..18b337ef8fc 100644 --- a/packages/runtime/src/domains/meta.ts +++ b/packages/runtime/src/domains/meta.ts @@ -104,6 +104,7 @@ import { STORED_VERSION_DOOR_POLICY, translateMetaEnvelope, translateMetaList, + translateMetaTypesListing, wantsMetaItemLayers, type MetaHolderItemReader, type MetaItemAnswer, @@ -1388,7 +1389,14 @@ export async function handleMetadataRequest(deps: DomainHandlerDeps, path: strin if (protocol && typeof protocol.getMetaTypes === 'function') { try { const result = await protocol.getMetaTypes({}); - return { handled: true, response: deps.success(result) }; + // [#36886] In the reader's language, through the one + // translation `RestServer`'s `/meta/types` runs. + const translated = await translateMetaTypesListing( + metaTranslationSources(deps, _context, protocol, (i18n) => + metaRequestLocale({ headers: _context.request?.headers, query }, i18n)), + result, + ); + return { handled: true, response: deps.success(translated) }; } catch (e: any) { console.warn('[HttpDispatcher] protocol.getMetaTypes() failed:', e?.message); } @@ -2885,7 +2893,14 @@ export async function handleMetadataRequest(deps: DomainHandlerDeps, path: strin if (protocol && typeof protocol.getMetaTypes === 'function') { try { const result = await protocol.getMetaTypes({}); - return { handled: true, response: deps.success(result) }; + // [#36886] In the reader's language, through the one + // translation `RestServer`'s `/meta/types` runs. + const translated = await translateMetaTypesListing( + metaTranslationSources(deps, _context, protocol, (i18n) => + metaRequestLocale({ headers: _context.request?.headers, query }, i18n)), + result, + ); + return { handled: true, response: deps.success(translated) }; } catch { /* fall through */ } } const metadataService = await deps.resolveService(_context, 'metadata', _context.environmentId); diff --git a/packages/spec/src/system/metadata-list-registry.ts b/packages/spec/src/system/metadata-list-registry.ts index 2c9775e8030..360dfce0cba 100644 --- a/packages/spec/src/system/metadata-list-registry.ts +++ b/packages/spec/src/system/metadata-list-registry.ts @@ -45,7 +45,17 @@ const DESCRIPTION = { field: 'description', label: 'Description' } as const; * ``` */ export const METADATA_LIST_REGISTRY: Readonly> = Object.freeze({ - // ── logic ───────────────────────────────────────────────────────────── + // ── data ────────────────────────────────────────────────────────────── + object: defineList({ + schemaId: 'object', + columns: [NAME, LABEL, { field: 'pluralLabel', label: 'Plural Label' }, { field: 'fields', label: 'Fields', type: 'count' }, DESCRIPTION], + }), + field: defineList({ + schemaId: 'field', + // A field row's `object` is stamped by the server, not a `FieldSchema` + // key, so the console appends it as its own column. + columns: [NAME, { field: 'type', label: 'Type', type: 'badge' }, LABEL], + }), hook: defineList({ schemaId: 'hook', columns: [ @@ -57,6 +67,156 @@ export const METADATA_LIST_REGISTRY: Readonly { const TYPES = Object.keys(METADATA_LIST_REGISTRY); describe('METADATA_LIST_REGISTRY ↔ the type schemas', () => { - it('declares the list of each type it covers, hook first', () => { - expect(TYPES.sort()).toEqual(['hook']); + it('declares a list for the first-batch types and the nine types the console used to declare', () => { + expect(TYPES.sort()).toEqual([ + 'action', 'agent', 'api', 'assignment_rule', 'book', 'dashboard', 'dataset', 'doc', + 'email_template', 'field', 'flow', 'hook', 'job', 'mapping', 'object', 'page', + 'permission', 'picklist', 'position', 'queue', 'report', 'seed', 'sharing_rule', + 'skill', 'tool', 'translation', 'view', + ]); }); it.each(TYPES)('%s: binds to its own type, which has a schema', (type) => { diff --git a/ui/packages/app-shell/src/services/builtinComponents.tsx b/ui/packages/app-shell/src/services/builtinComponents.tsx index d986c460349..985d69311bf 100644 --- a/ui/packages/app-shell/src/services/builtinComponents.tsx +++ b/ui/packages/app-shell/src/services/builtinComponents.tsx @@ -317,11 +317,7 @@ registerMetadataResource({ description: 'Domain entities — tables in the data model. Each object owns its fields, relationships, validations, and lifecycle hooks.', domain: 'data', searchableFields: ['name', 'label', 'description'], - listColumns: [ - { key: 'name', label: 'Name', width: '25%' }, - { key: 'label', label: 'Label', width: '25%' }, - { key: 'description', label: 'Description' }, - ], + // objectstack#36860 — the list columns are the spec's (`METADATA_LIST_REGISTRY`). // objectui#10202 — the editor is seeded from the SERVED object, where a // picklist-bound field carries `picklist` plus the options resolved from the // list; the authoring door refuses the two together. The saved body drops @@ -337,12 +333,9 @@ registerMetadataResource({ description: 'Columns attached to objects — name, type, validation, and storage settings.', domain: 'data', searchableFields: ['name', 'label', 'object', 'type'], - listColumns: [ - { key: 'name', label: 'Name', width: '25%' }, - { key: 'object', label: 'Object', width: '20%' }, - { key: 'type', label: 'Type', width: '15%' }, - { key: 'label', label: 'Label' }, - ], + // objectstack#36860 — name / type / label are the spec's columns; a field + // row's `object` is stamped by the server, not a `FieldSchema` key. + listExtraColumns: [{ key: 'object', label: 'Object', width: '20%' }], }); /* -------------------------------------------------------------------------- */ @@ -360,12 +353,8 @@ registerMetadataResource({ // objectui#7611 — no `managedBy` column: the registry serves no such key on a // permission set (measured on objectstack main), so it read "Custom" for every // set, the platform's own included. Provenance is the list's own Source badge, - // read from the served `_packageId` / `_provenance`. - listColumns: [ - { key: 'name', label: 'Name', width: '30%' }, - { key: 'label', label: 'Label', width: '30%' }, - { key: 'description', label: 'Description' }, - ], + // read from the served `_packageId` / `_provenance`. objectstack#36860 — the + // columns are the spec's. }); // objectstack#25333 — the position list says who holds each position and which @@ -384,10 +373,9 @@ registerMetadataResource({ // admits a live position create (`allowRuntimeCreate`); under `?package=` // the create stays a package draft (ADR-0086). createLive: true, - listColumns: [ - { key: 'name', label: 'Name', width: '20%' }, - { key: 'label', label: 'Label', width: '20%' }, - { key: 'description', label: 'Description' }, + // objectstack#36860 — name / label / description are the spec's columns; the + // holder count and the granted sets are served beside each row. + listExtraColumns: [ { key: '_holderCount', label: 'Holders', @@ -413,20 +401,16 @@ registerMetadataResource({ label: 'Views', description: 'Saved list / kanban / calendar / gantt configurations on top of an object.', domain: 'ui', - listColumns: [ - { key: 'name', label: 'Name', width: '30%' }, - { key: 'object', label: 'Object', width: '20%' }, - { - key: 'type', - label: 'Type', + // objectstack#36860 — the columns are the spec's. + listCells: { + type: { width: '15%', // Expanded ViewItems keep their display type under `config.type` // and only the list/form family at the top level — derive it so the // column shows "calendar" / "grid" / "form" instead of "—". render: (_v, item) => viewDisplayType(item) ?? '—', }, - { key: 'label', label: 'Label' }, - ], + }, // ADR-0017 — the framework exposes each view as a canonical first-class // ViewItem ({ name, object, viewKind, label, config }). The inspector and // preview read that shape directly (`draft.config`), so NO toDraft/fromDraft @@ -441,11 +425,6 @@ registerMetadataResource({ label: 'Dashboards', description: 'Composed dashboards with charts, KPIs, and tables.', domain: 'ui', - listColumns: [ - { key: 'name', label: 'Name', width: '30%' }, - { key: 'label', label: 'Label', width: '30%' }, - { key: 'description', label: 'Description' }, - ], }); /** @@ -475,11 +454,6 @@ registerMetadataResource({ label: 'Pages', description: 'Visual page layouts authored as JSON metadata.', domain: 'ui', - listColumns: [ - { key: 'name', label: 'Name', width: '30%' }, - { key: 'label', label: 'Label', width: '30%' }, - { key: 'route', label: 'Route' }, - ], fromDraft: pageSaveBody, }); @@ -495,12 +469,10 @@ registerMetadataResource({ description: 'Documentation navigation spine — ordered groups with membership derived over docs (glob/tag rules), plus an explicit pages override for curated order.', domain: 'system', searchableFields: ['name', 'label', 'description', 'slug'], - listColumns: [ - { key: 'name', label: 'Name', width: '25%' }, - { key: 'label', label: 'Label', width: '25%' }, - { - key: 'audience', - label: 'Audience', + // objectstack#36860 — the columns are the spec's; the audience cell names + // the org default and a permission-set audience in words. + listCells: { + audience: { width: '12%', render: (v) => v == null @@ -509,12 +481,5 @@ registerMetadataResource({ ? `permission set: ${(v as { permissionSet: string }).permissionSet}` : String(v), }, - { - key: 'groups', - label: 'Groups', - width: '10%', - render: (v) => (Array.isArray(v) ? String(v.length) : '0'), - }, - { key: 'description', label: 'Description' }, - ], + }, }); diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx index f0a411428ee..47634f4f36d 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.servedListColumns-36860.test.tsx @@ -38,9 +38,13 @@ const AGENTS: Record[] = [{ name: 'helper', label: 'Helper', mo const QUEUES: Record[] = [{ name: 'tier1', label: 'Tier 1', members: [{ type: 'user', id: 'a' }, { type: 'user', id: 'b' }] }]; const SKILLS: Record[] = [{ name: 'triage', label: 'Triage', tools: ['a', 'b'] }]; +const VIEWS: Record[] = [ + { name: 'all_accounts', object: 'account', label: 'All accounts', viewKind: 'list', config: { type: 'kanban' } }, +]; + const CLIENT = { list: async (type: string) => - type === 'hook' ? HOOKS : type === 'agent' ? AGENTS : type === 'queue' ? QUEUES : type === 'skill' ? SKILLS : [], + type === 'hook' ? HOOKS : type === 'agent' ? AGENTS : type === 'queue' ? QUEUES : type === 'skill' ? SKILLS : type === 'view' ? VIEWS : [], }; // Headers as the server serves them to a zh-CN reader. @@ -98,6 +102,19 @@ const QUEUE_ENTRY = { }; // Control: a type that serves no list. const SKILL_ENTRY = { type: 'skill', label: 'Skill', allowEnvironmentOverlay: false, allowRuntimeCreate: true }; +const VIEW_ENTRY = { + type: 'view', + label: 'View', + allowEnvironmentOverlay: false, + allowRuntimeCreate: true, + list: { + data: { provider: 'schema', schemaId: 'view' }, + columns: [ + { field: 'name', label: 'Name' }, + { field: 'type', label: 'Type', type: 'badge' }, + ], + }, +}; vi.mock('./useMetadata', async (importOriginal) => ({ ...(await importOriginal>()), @@ -105,7 +122,7 @@ vi.mock('./useMetadata', async (importOriginal) => ({ useMetadataTypes: () => ({ loading: false, error: null, - entries: [HOOK_ENTRY, AGENT_ENTRY, QUEUE_ENTRY, SKILL_ENTRY], + entries: [HOOK_ENTRY, AGENT_ENTRY, QUEUE_ENTRY, SKILL_ENTRY, VIEW_ENTRY], }), })); @@ -197,4 +214,9 @@ describe('the generic list reads the served columns (objectstack#36860)', () => expect((await headersOf()).slice(0, 3)).toEqual(['Name', 'Members', 'Package']); expect((await rowOf('tier1')).slice(0, 2)).toEqual(['tier1', '2 people']); }); + + it('the view list keeps its derived display type through its console cell override', async () => { + mount('view'); + expect((await rowOf('all_accounts')).slice(0, 2)).toEqual(['all_accounts', 'kanban']); + }); }); diff --git a/ui/packages/app-shell/src/views/metadata-admin/anchors.ts b/ui/packages/app-shell/src/views/metadata-admin/anchors.ts index c839973fd13..d6e87cbb74c 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/anchors.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/anchors.ts @@ -571,26 +571,9 @@ export function registerBuiltinAnchors(): void { // seed it as an empty record so the saved body validates. createDefaults: { fields: {} }, searchableFields: ['name', 'label', 'pluralLabel', 'description'], - listColumns: [ - { key: 'name', label: 'Name', width: '24%' }, - { key: 'label', label: 'Label', width: '22%' }, - { key: 'pluralLabel', label: 'Plural', width: '22%' }, - { - key: 'fields', - label: 'Fields', - width: '90px', - render: (value) => { - if (value == null) return '—'; - const count = Array.isArray(value) - ? value.length - : typeof value === 'object' - ? Object.keys(value as Record).length - : 0; - return count; - }, - }, - { key: 'description', label: 'Description' }, - ], + // objectstack#36860 — the list columns are the spec's + // (`METADATA_LIST_REGISTRY`): name, label, plural label, field count, + // description. }); // objectui#12982 — the declared sharing rules Setup lists read-only @@ -600,19 +583,17 @@ export function registerBuiltinAnchors(): void { type: 'sharing_rule', iconName: 'share-2', searchableFields: ['name', 'label', 'description', 'object'], - listColumns: [ - { key: 'name', label: 'Name' }, - { key: 'label', label: 'Label' }, - { key: 'object', label: 'Object' }, - { - key: 'sharedWith', - label: 'Shared with', + // objectstack#36860 — name / label / object / shared with / access level + // are the spec's columns; the declaring package is served beside each row. + listCells: { + sharedWith: { render: (value) => { const v = value as { type?: unknown; value?: unknown } | null | undefined; return v && typeof v === 'object' ? `${String(v.type ?? '')}: ${String(v.value ?? '')}` : '—'; }, }, - { key: 'accessLevel', label: 'Access' }, + }, + listExtraColumns: [ { key: '_packageId', label: 'Package', From 9ce7a6d0ff0e085427e942fc02c39778d8aad63e Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 09:39:56 +0000 Subject: [PATCH 07/10] fix(runtime): vary the dispatcher's translated types listing on Accept-Language Both dispatcher doors that now translate the /meta types listing answer with Vary: Accept-Language, as RestServer and the rest of the meta domain do; the parity test reads the header. The changeset names @object-ui/app-shell for the visible Studio list changes. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzg7mFFG5b13DcQ93kf --- .../36860-metadata-list-columns-batch.md | 3 +- ...eta-types-translation-parity-36886.test.ts | 36 +++++++++++++------ packages/runtime/src/domains/meta.ts | 10 +++--- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/.changeset/36860-metadata-list-columns-batch.md b/.changeset/36860-metadata-list-columns-batch.md index 2fb048e0473..53043e811ea 100644 --- a/.changeset/36860-metadata-list-columns-batch.md +++ b/.changeset/36860-metadata-list-columns-batch.md @@ -3,6 +3,7 @@ '@objectstack/rest': patch '@objectstack/runtime': patch '@objectstack/platform-objects': patch +'@object-ui/app-shell': patch --- feat(spec): Studio list columns for 27 metadata types, served in the reader's language on both doors @@ -14,4 +15,4 @@ Metadata-protocol: none - **Headers in every shipped language.** The 52 headers no form field already labels get their own `metadataForms..fields..label` leaf in the 11 platform bundles (`@objectstack/platform-objects`), translated in all ten non-English locales. A column the form labels reads the form's words. - **Both doors translate the listing.** The runtime dispatcher's `GET /meta` and `GET /meta/types` now answer the types listing in the request's language, as `RestServer`'s `GET /meta` does: type labels, form labels, list headers and schema titles. Both run one function, `translateMetaTypesListing` (`@objectstack/rest`). Before this, a host served through the dispatcher answered all of it in English. -- **The console's own declarations move into the spec.** Studio's lists of objects, fields, views, pages, dashboards, permission sets, positions and books read the served columns. The console keeps only what the schema cannot say: a field row's server-stamped `object`, a position's holder count and granted permission sets, a view's derived display type, a book's audience and a sharing rule's `sharedWith` rendering. The console declared `object`'s columns twice, in two registrations that disagreed (the later one won); both declarations are gone, so one remains, in the spec. A page's former `route` column named no `PageSchema` key and is dropped. +- **The console's own declarations move into the spec.** Studio's lists of objects, fields, views, pages, dashboards, permission sets, positions and books read the served columns. The console keeps only what the schema cannot say: a field row's server-stamped `object`, a position's holder count and granted permission sets, a view's derived display type, a book's audience and a sharing rule's `sharedWith` rendering. The console declared `object`'s columns twice, in two registrations that disagreed (the later one won); both declarations are gone, so one remains, in the spec. A page's former `route` column named no `PageSchema` key and is dropped. What an admin sees in Studio (`@object-ui/app-shell`): the metadata lists of all 27 types show the spec's columns, in the declared order, with headers in the reader's language; a type with no declared list keeps the name, label and description columns. diff --git a/packages/runtime/src/domains/meta-types-translation-parity-36886.test.ts b/packages/runtime/src/domains/meta-types-translation-parity-36886.test.ts index 7d7fdc8fef9..51739219650 100644 --- a/packages/runtime/src/domains/meta-types-translation-parity-36886.test.ts +++ b/packages/runtime/src/domains/meta-types-translation-parity-36886.test.ts @@ -11,8 +11,10 @@ * of a `RestServer` host got Chinese. * * Pinned, each against a control: both dispatcher doors (`GET /meta` and - * `GET /meta/types`) answer the same entries as `RestServer`, translated; an - * en request and a host with no i18n service answer the listing untranslated. + * `GET /meta/types`) answer the same entries as `RestServer`, translated, and + * carry `Vary: Accept-Language` as `RestServer` does, so a shared cache never + * hands one reader's language to another; an en request and a host with no + * i18n service answer the listing untranslated. */ import { describe, it, expect, vi } from 'vitest'; // Paid at collection: the dispatcher reaches it through a dynamic import. @@ -70,7 +72,7 @@ function bootDispatcher(withI18n = true) { const request = { headers: { 'accept-language': locale }, url: `http://localhost/api/v1${path}` }; const res = await dispatcher.dispatch('GET', path, undefined, {}, { request } as any); expect(res.response?.status).toBe(200); - return (res.response?.body as any)?.data; + return { data: (res.response?.body as any)?.data, vary: (res.response as any)?.headers?.Vary }; }; } @@ -86,9 +88,15 @@ function bootRest() { const route = rest.getRoutes().find((r: any) => r.method === 'GET' && r.path === '/api/v1/meta'); return async (locale: string) => { let body: any; - const res: any = { status: vi.fn(() => res), header: vi.fn(() => res), send: vi.fn(() => res), json: vi.fn((b: any) => { body = b; return res; }) }; + const headers: Record = {}; + const res: any = { + status: vi.fn(() => res), + header: vi.fn((name: string, value: string) => { headers[name] = value; return res; }), + send: vi.fn(() => res), + json: vi.fn((b: any) => { body = b; return res; }), + }; await route.handler({ method: 'GET', params: {}, query: {}, body: {}, headers: { 'accept-language': locale } }, res); - return body; + return { data: body, vary: headers.Vary }; }; } @@ -103,20 +111,28 @@ const read = (data: any) => { describe('the dispatcher translates the types listing as RestServer does (objectstack#36886)', () => { it('both dispatcher doors answer zh-CN with the labels, form and list headers RestServer answers', async () => { - const reference = read(await bootRest()('zh-CN')); + const rest = await bootRest()('zh-CN'); + const reference = read(rest.data); expect(reference).toEqual({ label: '钩子', form: '事件', headers: ['名称', '事件'] }); const dispatch = bootDispatcher(); - expect(read(await dispatch('/meta', 'zh-CN'))).toEqual(reference); - expect(read(await dispatch('/meta/types', 'zh-CN'))).toEqual(reference); + expect(read((await dispatch('/meta', 'zh-CN')).data)).toEqual(reference); + expect(read((await dispatch('/meta/types', 'zh-CN')).data)).toEqual(reference); + }); + + it('both dispatcher doors vary on Accept-Language, as RestServer does', async () => { + expect((await bootRest()('zh-CN')).vary).toBe('Accept-Language'); + const dispatch = bootDispatcher(); + expect((await dispatch('/meta', 'zh-CN')).vary).toBe('Accept-Language'); + expect((await dispatch('/meta/types', 'zh-CN')).vary).toBe('Accept-Language'); }); it('control — an en request answers the listing as declared', async () => { const dispatch = bootDispatcher(); - expect(read(await dispatch('/meta', 'en'))).toEqual({ label: 'Hook', form: undefined, headers: ['Name', 'Events'] }); + expect(read((await dispatch('/meta', 'en')).data)).toEqual({ label: 'Hook', form: undefined, headers: ['Name', 'Events'] }); }); it('control — a host with no i18n service answers the listing as declared', async () => { const dispatch = bootDispatcher(false); - expect(read(await dispatch('/meta/types', 'zh-CN'))).toEqual({ label: 'Hook', form: undefined, headers: ['Name', 'Events'] }); + expect(read((await dispatch('/meta/types', 'zh-CN')).data)).toEqual({ label: 'Hook', form: undefined, headers: ['Name', 'Events'] }); }); }); diff --git a/packages/runtime/src/domains/meta.ts b/packages/runtime/src/domains/meta.ts index 18b337ef8fc..10da6116133 100644 --- a/packages/runtime/src/domains/meta.ts +++ b/packages/runtime/src/domains/meta.ts @@ -1390,13 +1390,14 @@ export async function handleMetadataRequest(deps: DomainHandlerDeps, path: strin try { const result = await protocol.getMetaTypes({}); // [#36886] In the reader's language, through the one - // translation `RestServer`'s `/meta/types` runs. + // translation `RestServer`'s `/meta/types` runs; the body is + // translated per request, so it varies on `Accept-Language`. const translated = await translateMetaTypesListing( metaTranslationSources(deps, _context, protocol, (i18n) => metaRequestLocale({ headers: _context.request?.headers, query }, i18n)), result, ); - return { handled: true, response: deps.success(translated) }; + return successWithHeaders(deps, translated, { Vary: 'Accept-Language' }); } catch (e: any) { console.warn('[HttpDispatcher] protocol.getMetaTypes() failed:', e?.message); } @@ -2894,13 +2895,14 @@ export async function handleMetadataRequest(deps: DomainHandlerDeps, path: strin try { const result = await protocol.getMetaTypes({}); // [#36886] In the reader's language, through the one - // translation `RestServer`'s `/meta/types` runs. + // translation `RestServer`'s `/meta/types` runs; the body is + // translated per request, so it varies on `Accept-Language`. const translated = await translateMetaTypesListing( metaTranslationSources(deps, _context, protocol, (i18n) => metaRequestLocale({ headers: _context.request?.headers, query }, i18n)), result, ); - return { handled: true, response: deps.success(translated) }; + return successWithHeaders(deps, translated, { Vary: 'Accept-Language' }); } catch { /* fall through */ } } const metadataService = await deps.resolveService(_context, 'metadata', _context.environmentId); From 137ae10f08aef58a5ec8f8b84f52115741d869bd Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 09:41:51 +0000 Subject: [PATCH 08/10] docs(changeset): name the visible Studio list changes for app-shell Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzg7mFFG5b13DcQ93kf --- .changeset/36860-metadata-list-columns-batch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/36860-metadata-list-columns-batch.md b/.changeset/36860-metadata-list-columns-batch.md index 53043e811ea..1847ab77a05 100644 --- a/.changeset/36860-metadata-list-columns-batch.md +++ b/.changeset/36860-metadata-list-columns-batch.md @@ -15,4 +15,4 @@ Metadata-protocol: none - **Headers in every shipped language.** The 52 headers no form field already labels get their own `metadataForms..fields..label` leaf in the 11 platform bundles (`@objectstack/platform-objects`), translated in all ten non-English locales. A column the form labels reads the form's words. - **Both doors translate the listing.** The runtime dispatcher's `GET /meta` and `GET /meta/types` now answer the types listing in the request's language, as `RestServer`'s `GET /meta` does: type labels, form labels, list headers and schema titles. Both run one function, `translateMetaTypesListing` (`@objectstack/rest`). Before this, a host served through the dispatcher answered all of it in English. -- **The console's own declarations move into the spec.** Studio's lists of objects, fields, views, pages, dashboards, permission sets, positions and books read the served columns. The console keeps only what the schema cannot say: a field row's server-stamped `object`, a position's holder count and granted permission sets, a view's derived display type, a book's audience and a sharing rule's `sharedWith` rendering. The console declared `object`'s columns twice, in two registrations that disagreed (the later one won); both declarations are gone, so one remains, in the spec. A page's former `route` column named no `PageSchema` key and is dropped. What an admin sees in Studio (`@object-ui/app-shell`): the metadata lists of all 27 types show the spec's columns, in the declared order, with headers in the reader's language; a type with no declared list keeps the name, label and description columns. +- **The console's own declarations move into the spec.** Studio's lists of objects, fields, views, pages, dashboards, permission sets, positions and books read the served columns. The console keeps only what the schema cannot say: a field row's server-stamped `object`, a position's holder count and granted permission sets, a view's derived display type, a book's audience and a sharing rule's `sharedWith` rendering. The console declared `object`'s columns twice, in two registrations that disagreed (the later one won); both declarations are gone, so one remains, in the spec. A page's former `route` column named no `PageSchema` key and is dropped. What an admin sees in Studio (`@object-ui/app-shell`): the metadata lists of all 27 types show the spec's columns, in the declared order, with headers in the reader's language. The moved lists lose the console's fixed column widths (the view list's display type and the book list's audience keep theirs), the Fields list reads name, type, label, then object, the sharing-rule list's header reads "Access Level" where it read "Access", and the Pages list shows type and description in place of the dropped route column. From 06064a11a214fd9a92621ff80d58021706bdcc39 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 09:45:07 +0000 Subject: [PATCH 09/10] test(platform-objects): count the list column header rows in the echo ledgers The bare-type ledger reads a type as bare when its catalog entry has no form sections; a type with no form now carries fields for its list column headers and stays bare. The metadata-form catalog count grows by the 52 header rows. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzg7mFFG5b13DcQ93kf --- .../translations/bare-type-display-echo-decisions.test.ts | 5 ++++- .../object-lifecycle-panel-echo-decisions.test.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/platform-objects/src/apps/translations/bare-type-display-echo-decisions.test.ts b/packages/platform-objects/src/apps/translations/bare-type-display-echo-decisions.test.ts index e32c634d108..2be08f1302c 100644 --- a/packages/platform-objects/src/apps/translations/bare-type-display-echo-decisions.test.ts +++ b/packages/platform-objects/src/apps/translations/bare-type-display-echo-decisions.test.ts @@ -431,7 +431,10 @@ function carriesToken(text: string, token: string): boolean { */ function isBare(type: string): boolean { const entry = (enMetadataForms as Record)[type]; - return !!entry && entry.fields === undefined && entry.sections === undefined; + // A form panel is what carries `sections`. Since #36860 a type with no form + // may still carry `fields` — the headers of its Studio list columns + // (`METADATA_LIST_REGISTRY`) — and stays bare: it has no panel. + return !!entry && entry.sections === undefined; } interface BareLeaf { diff --git a/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts b/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts index f0228ef0277..ddf8ea52b0c 100644 --- a/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts +++ b/packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts @@ -1319,7 +1319,10 @@ describe('#19403 round 10 — the verdicts, on the live bundles', () => { // 771 since #36447: the report form declares the `dateRange` and // `exportOptions` children — six row labels, authored in all three // locales. - expect(translated.length, `${locale} positive control`).toBe(771); + // 823 since #36860: the Studio list column headers no form field + // labels get their own `fields..label` row (`METADATA_LIST_REGISTRY`) + // — fifty-two row labels, authored in all three locales. + expect(translated.length, `${locale} positive control`).toBe(823); } // ⭐ DARK — the blindness, executable. On a synthetic two-locale catalog the // all-three predicate returns 0 while the per-locale one returns 1, so the From f2edd9de647b49671897c76b43af74b42ac4019f Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 10:07:24 +0000 Subject: [PATCH 10/10] fix(app-shell): show a cron schedule's expression in the Jobs list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The summary cell now reads an expression envelope member ({ dialect, source }) as its source, so a served cron schedule reads cron · 0 2 * * * · UTC instead of cron · UTC. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzg7mFFG5b13DcQ93kf --- .changeset/36860-metadata-list-columns-batch.md | 2 +- .../metadata-admin/servedListColumns.test.tsx | 7 +++++++ .../views/metadata-admin/servedListColumns.tsx | 17 ++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.changeset/36860-metadata-list-columns-batch.md b/.changeset/36860-metadata-list-columns-batch.md index 1847ab77a05..b02acb17e5a 100644 --- a/.changeset/36860-metadata-list-columns-batch.md +++ b/.changeset/36860-metadata-list-columns-batch.md @@ -15,4 +15,4 @@ Metadata-protocol: none - **Headers in every shipped language.** The 52 headers no form field already labels get their own `metadataForms..fields..label` leaf in the 11 platform bundles (`@objectstack/platform-objects`), translated in all ten non-English locales. A column the form labels reads the form's words. - **Both doors translate the listing.** The runtime dispatcher's `GET /meta` and `GET /meta/types` now answer the types listing in the request's language, as `RestServer`'s `GET /meta` does: type labels, form labels, list headers and schema titles. Both run one function, `translateMetaTypesListing` (`@objectstack/rest`). Before this, a host served through the dispatcher answered all of it in English. -- **The console's own declarations move into the spec.** Studio's lists of objects, fields, views, pages, dashboards, permission sets, positions and books read the served columns. The console keeps only what the schema cannot say: a field row's server-stamped `object`, a position's holder count and granted permission sets, a view's derived display type, a book's audience and a sharing rule's `sharedWith` rendering. The console declared `object`'s columns twice, in two registrations that disagreed (the later one won); both declarations are gone, so one remains, in the spec. A page's former `route` column named no `PageSchema` key and is dropped. What an admin sees in Studio (`@object-ui/app-shell`): the metadata lists of all 27 types show the spec's columns, in the declared order, with headers in the reader's language. The moved lists lose the console's fixed column widths (the view list's display type and the book list's audience keep theirs), the Fields list reads name, type, label, then object, the sharing-rule list's header reads "Access Level" where it read "Access", and the Pages list shows type and description in place of the dropped route column. +- **The console's own declarations move into the spec.** Studio's lists of objects, fields, views, pages, dashboards, permission sets, positions and books read the served columns. The console keeps only what the schema cannot say: a field row's server-stamped `object`, a position's holder count and granted permission sets, a view's derived display type, a book's audience and a sharing rule's `sharedWith` rendering. The console declared `object`'s columns twice, in two registrations that disagreed (the later one won); both declarations are gone, so one remains, in the spec. A page's former `route` column named no `PageSchema` key and is dropped. What an admin sees in Studio (`@object-ui/app-shell`): the metadata lists of all 27 types show the spec's columns, in the declared order, with headers in the reader's language. The moved lists lose the console's fixed column widths (the view list's display type and the book list's audience keep theirs), the Fields list reads name, type, label, then object, the sharing-rule list's header reads "Access Level" where it read "Access", and the Pages list shows type and description in place of the dropped route column. A summary cell reads an expression member as its source, so the Jobs list's schedule shows a cron job's expression (`cron · 0 2 * * * · UTC`), not only its kind and time zone. diff --git a/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.test.tsx index 8397af98ffd..d5d179d702e 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.test.tsx @@ -31,6 +31,13 @@ describe('renderListCell', () => { expect(text(renderListCell('summary', { type: 'cron', expression: '0 0 * * *', timezone: 'UTC' }))).toBe('cron · 0 0 * * * · UTC'); }); + it('summary reads an expression envelope member as its source — a served cron schedule shows when it runs', () => { + const served = { type: 'cron', expression: { dialect: 'cron', source: '0 2 * * *' }, timezone: 'UTC' }; + expect(text(renderListCell('summary', served))).toBe('cron · 0 2 * * * · UTC'); + // Control: an object member with no `source` stays out, as before. + expect(text(renderListCell('summary', { type: 'cron', expression: { dialect: 'cron' }, timezone: 'UTC' }))).toBe('cron · UTC'); + }); + it('boolean marks, badge shows the value, text shows a scalar as written', () => { expect(text(renderListCell('boolean', true))).toBe('✓'); expect(text(renderListCell('boolean', false))).toBe('✗'); diff --git a/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.tsx b/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.tsx index 10a16f7ed88..3fced9e3d2f 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/servedListColumns.tsx @@ -84,6 +84,21 @@ function scalarText(value: unknown): string | undefined { return undefined; } +/** + * A summary member as text: a scalar as written, or an expression envelope + * (`{ dialect, source }`, how the spec serves a cron schedule's `expression`) + * as its authored `source`. Any other object member is left out. + */ +function memberText(value: unknown): string | undefined { + const text = scalarText(value); + if (text !== undefined) return text; + if (value && typeof value === 'object' && !Array.isArray(value)) { + const source = (value as { source?: unknown }).source; + if (typeof source === 'string') return source; + } + return undefined; +} + /** Draw one cell by the column's declared renderer. */ export function renderListCell(type: string | undefined, value: unknown): React.ReactNode { if (type === 'count') { @@ -106,7 +121,7 @@ export function renderListCell(type: string | undefined, value: unknown): React. case 'summary': { if (value && typeof value === 'object' && !Array.isArray(value)) { const parts = Object.values(value as Record) - .map(scalarText) + .map(memberText) .filter((v): v is string => v !== undefined && v !== ''); if (parts.length > 0) return parts.join(' · '); }