@entifix/core 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entity-definition/describe/describe-entity-columns.d.ts +3 -1
- package/dist/entity-definition/describe/describe-entity-columns.d.ts.map +1 -1
- package/dist/entity-definition/describe/describe-entity-columns.js +27 -1
- package/dist/entity-definition/describe/describe-entity-columns.js.map +1 -1
- package/dist/entity-definition/describe/query-property.d.ts +11 -0
- package/dist/entity-definition/describe/query-property.d.ts.map +1 -1
- package/dist/entity-definition/describe/query-property.js +19 -0
- package/dist/entity-definition/describe/query-property.js.map +1 -1
- package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.d.ts +16 -0
- package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.d.ts.map +1 -1
- package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.js +11 -0
- package/dist/entity-definition/meta-entities/meta-accessor/meta-accessor.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CardRole, type ChildConstructor, type EntityLinkSerialization, type MemberReference, MetaAccessorType, type MoneyFormat } from '../meta-entities/meta-accessor/index.js';
|
|
1
|
+
import { type CardRole, type ChildConstructor, type EntityLinkSerialization, type EnumTone, type MemberReference, MetaAccessorType, type MoneyFormat } from '../meta-entities/meta-accessor/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* A displayable member of an entity, resolved from its accessor metadata. This
|
|
4
4
|
* is the contract generic UI builds itself from — a table's columns today, a
|
|
@@ -29,6 +29,8 @@ export interface EntityFieldDescriptor {
|
|
|
29
29
|
enumValues?: readonly string[];
|
|
30
30
|
/** Catalog prefix for {@link enumValues}; a value reads as `${enumLabelKey}.${value}`. */
|
|
31
31
|
enumLabelKey?: string;
|
|
32
|
+
/** The tone each value reads in as a status, when the member declares them. */
|
|
33
|
+
enumTones?: Readonly<Record<string, EnumTone>>;
|
|
32
34
|
/** Property of a `link` target used as its display label. */
|
|
33
35
|
linkLabelProperty: string;
|
|
34
36
|
/** Property of a `link` target a picker searches on. Defaults to the label. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe-entity-columns.d.ts","sourceRoot":"","sources":["../../../src/entity-definition/describe/describe-entity-columns.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EAEpB,gBAAgB,EAChB,KAAK,WAAW,EACjB,MAAM,yCAAyC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,QAAQ,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,0FAA0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0EAA0E;IAC1E,iBAAiB,EAAE,uBAAuB,CAAC;IAC3C;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;;OAGG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,6EAA6E;AAC7E,eAAO,MAAM,YAAY,EAAE,SAAS,gBAAgB,EAMnD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,gBAAgB,EAIvD,CAAC;
|
|
1
|
+
{"version":3,"file":"describe-entity-columns.d.ts","sourceRoot":"","sources":["../../../src/entity-definition/describe/describe-entity-columns.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,QAAQ,EAEb,KAAK,eAAe,EAEpB,gBAAgB,EAChB,KAAK,WAAW,EACjB,MAAM,yCAAyC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,QAAQ,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,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AE,QAQJ;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,SAAS;IAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B,EAAE,QAWJ;AA+DD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,MAAM,EAC1D,iBAAiB,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAC5C,MAAM,CAAC,EAAE,OAAO,GACf,qBAAqB,EAAE,CAqBzB"}
|
|
@@ -3,6 +3,7 @@ import { extractMetaAccessors, findMetaEntity } from '../helpers/index.js';
|
|
|
3
3
|
import { EntityCollectionLink } from '../links/entity-collection-link/index.js';
|
|
4
4
|
import { EntityLink } from '../links/entity-link/index.js';
|
|
5
5
|
import { assertBounds } from '../meta-entities/bounds.js';
|
|
6
|
+
import { EnumTones } from '../meta-entities/meta-accessor/index.js';
|
|
6
7
|
/** Types whose values are scalars a user can meaningfully sort/filter on. */ export const SCALAR_TYPES = [
|
|
7
8
|
'string',
|
|
8
9
|
'number',
|
|
@@ -141,6 +142,27 @@ import { assertBounds } from '../meta-entities/bounds.js';
|
|
|
141
142
|
if (metaAccessor.money === undefined || type === 'number') return;
|
|
142
143
|
throw new Error(`"${String(metaAccessor.name)}" is a ${type} and declares money — only a number member can be an amount.`);
|
|
143
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Tones belong to an enum's values: on any other member, or keyed by a value
|
|
147
|
+
* the enum does not have, they would colour nothing — or the wrong thing.
|
|
148
|
+
*/ function assertEnumTones(metaAccessor, type) {
|
|
149
|
+
var _metaAccessor_enumValues;
|
|
150
|
+
const { enumTones } = metaAccessor;
|
|
151
|
+
if (enumTones === undefined) return;
|
|
152
|
+
const name = String(metaAccessor.name);
|
|
153
|
+
if (type !== 'enum') {
|
|
154
|
+
throw new Error(`"${name}" is a ${type} and declares enumTones — only an enum member's values have a tone.`);
|
|
155
|
+
}
|
|
156
|
+
const values = (_metaAccessor_enumValues = metaAccessor.enumValues) != null ? _metaAccessor_enumValues : [];
|
|
157
|
+
for (const [value, tone] of Object.entries(enumTones)){
|
|
158
|
+
if (!values.includes(value)) {
|
|
159
|
+
throw new Error(`"${name}" declares a tone for "${value}", which is not one of its enumValues (${values.join(', ')}).`);
|
|
160
|
+
}
|
|
161
|
+
if (!EnumTones.includes(tone)) {
|
|
162
|
+
throw new Error(`"${name}" declares tone "${String(tone)}" for "${value}" — a tone is one of ${EnumTones.join(', ')}.`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
144
166
|
/** A width is a positive length; zero or less would never switch layouts. */ function assertMinWidth(metaAccessor) {
|
|
145
167
|
const { minWidth } = metaAccessor;
|
|
146
168
|
if (minWidth === undefined || Number.isFinite(minWidth) && minWidth > 0) return;
|
|
@@ -191,6 +213,7 @@ function toDescriptor(target, metaAccessor, index, sample) {
|
|
|
191
213
|
assertParentType(metaAccessor, type);
|
|
192
214
|
assertReference(target, metaAccessor, type);
|
|
193
215
|
assertMoneyType(metaAccessor, type);
|
|
216
|
+
assertEnumTones(metaAccessor, type);
|
|
194
217
|
assertMinWidth(metaAccessor);
|
|
195
218
|
// A localized member is queried one locale at a time (`name.en`), which
|
|
196
219
|
// makes it as queryable as the text each locale holds.
|
|
@@ -208,7 +231,10 @@ function toDescriptor(target, metaAccessor, index, sample) {
|
|
|
208
231
|
readonly: (_metaAccessor_readonly = metaAccessor.readonly) != null ? _metaAccessor_readonly : false,
|
|
209
232
|
required: (_metaAccessor_required = metaAccessor.required) != null ? _metaAccessor_required : false,
|
|
210
233
|
enumValues: metaAccessor.enumValues,
|
|
211
|
-
enumLabelKey: metaAccessor.enumLabelKey
|
|
234
|
+
enumLabelKey: metaAccessor.enumLabelKey
|
|
235
|
+
}, metaAccessor.enumTones === undefined ? {} : {
|
|
236
|
+
enumTones: metaAccessor.enumTones
|
|
237
|
+
}, {
|
|
212
238
|
linkLabelProperty,
|
|
213
239
|
linkSearchProperty: (_metaAccessor_linkSearchProperty = metaAccessor.linkSearchProperty) != null ? _metaAccessor_linkSearchProperty : linkLabelProperty,
|
|
214
240
|
linkSerialization: (_metaAccessor_linkSerialization = metaAccessor.linkSerialization) != null ? _metaAccessor_linkSerialization : 'id',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/entity-definition/describe/describe-entity-columns.ts"],"sourcesContent":["import { extractMetaAccessors, findMetaEntity } from '../helpers/index.js';\nimport { EntityCollectionLink } from '../links/entity-collection-link/index.js';\nimport { EntityLink } from '../links/entity-link/index.js';\nimport { assertBounds } from '../meta-entities/bounds.js';\nimport {\n type CardRole,\n type ChildConstructor,\n type EntityLinkSerialization,\n type MemberReference,\n MetaAccessor,\n MetaAccessorType,\n type MoneyFormat,\n} from '../meta-entities/meta-accessor/index.js';\n\n/**\n * A displayable member of an entity, resolved from its accessor metadata. This\n * is the contract generic UI builds itself from — a table's columns today, a\n * form's fields later — so it stays framework-free and lives next to the\n * metadata it derives from.\n */\nexport interface EntityFieldDescriptor {\n /** Accessor name. The stable identity used by preferences and slots. */\n name: string;\n /** Wire/property key: `alias ?? name`. */\n key: string;\n label: string;\n /**\n * Catalog key for {@link label}, when the entity declared one. Resolution is\n * the presentation layer's job — core has no locale and no catalogs, and the\n * same descriptor feeds the server-side filter allowlist, where a translated\n * label would be meaningless.\n */\n labelKey?: string;\n type: MetaAccessorType;\n sortable: boolean;\n filterable: boolean;\n order: number;\n /** Cannot be written back. A form shows it but disables its input. */\n readonly: boolean;\n /** Must hold a value. A form rejects submit while it is empty. */\n required: boolean;\n enumValues?: readonly string[];\n /** Catalog prefix for {@link enumValues}; a value reads as `${enumLabelKey}.${value}`. */\n enumLabelKey?: string;\n /** Property of a `link` target used as its display label. */\n linkLabelProperty: string;\n /** Property of a `link` target a picker searches on. Defaults to the label. */\n linkSearchProperty: string;\n /** Whether a `link` writes back its foreign key or the inlined target. */\n linkSerialization: EntityLinkSerialization;\n /**\n * The class describing one row of a `composition` member, resolved from the\n * accessor's thunk. Absent on every other type.\n */\n childType?: ChildConstructor;\n /**\n * The member is dropped when the record is copied — a unique code, an audit\n * stamp. The identity member is always reset and is not flagged.\n */\n resetOnClone: boolean;\n /** The fewest values a collection member may hold. */\n minItems?: number;\n /** The most values a collection member may hold. */\n maxItems?: number;\n /** The `date` member this one may not precede. */\n notBefore?: string;\n /** The member is an amount of money, read as this declares. `number` members only. */\n money?: MoneyFormat;\n /** The narrowest the member's column reads at, in `rem`, when declared. */\n minWidth?: number;\n /** The part the member plays on a record's card, when declared. */\n card?: CardRole;\n /** The member's HTML autofill token, when declared. */\n autocomplete?: string;\n /** This member holds the parent record's id: the entity forms a tree. */\n parent?: boolean;\n /**\n * This member holds the id of a record of another entity, named `domain:key`.\n * A screen shows that record's name in its place.\n */\n references?: MemberReference;\n}\n\n/** Types whose values are scalars a user can meaningfully sort/filter on. */\nexport const SCALAR_TYPES: readonly MetaAccessorType[] = [\n 'string',\n 'number',\n 'boolean',\n 'date',\n 'enum',\n];\n\n/**\n * Types whose value is a collection. None of them may ever be sorted or\n * filtered: this descriptor is also the **server-side RSQL allowlist**, and an\n * array compared as a scalar matches nothing — so the query would not fail, it\n * would quietly return an empty page.\n *\n * Exported so `describe-entity-columns.spec.ts` can assert that this list,\n * {@link SCALAR_TYPES}, the two reference types and `localized` partition\n * `MetaAccessorTypes` exactly. Nothing in the repo guards `MetaAccessorType`\n * exhaustively — every switch over it has a `default` that treats the value as\n * a string — so that partition spec is what makes an eleventh type impossible\n * to add silently.\n */\nexport const COLLECTION_TYPES: readonly MetaAccessorType[] = [\n 'linkCollection',\n 'composition',\n 'scalarCollection',\n];\n\n/** `productCode` / `product-code` / `product_code` → `Product Code`. */\nfunction humanize(name: string): string {\n return name\n .replace(/[-_]+/g, ' ')\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replace(/\\s+/g, ' ')\n .trim()\n .replace(/^./, first => first.toUpperCase());\n}\n\n/**\n * Best-effort type for accessors that did not declare one. Entities are not\n * required to annotate every member, so a sample row keeps a bare `@accessor()`\n * usable; a declared `type` always wins over this.\n */\nfunction inferType(name: string, value: unknown): MetaAccessorType {\n if (value instanceof EntityLink) return 'link';\n if (value instanceof EntityCollectionLink) return 'linkCollection';\n if (value instanceof Date) return 'date';\n if (typeof value === 'number') return 'number';\n if (typeof value === 'boolean') return 'boolean';\n if (name === 'id') return 'id';\n return 'string';\n}\n\n/**\n * A collection member declared queryable is always a mistake, so it breaks the\n * developer rather than the query — the same posture as `applyEntityLinks`\n * throwing on an `embedded` link it cannot build.\n *\n * Silently clamping to `false` was the alternative and is worse: the author\n * keeps a declaration that reads as honoured, and the symptom is an empty\n * result page rather than an error anyone can act on.\n */\nfunction assertNotQueryable(\n metaAccessor: MetaAccessor,\n type: MetaAccessorType,\n) {\n if (!COLLECTION_TYPES.includes(type)) return;\n if (metaAccessor.sortable !== true && metaAccessor.filterable !== true)\n return;\n throw new Error(\n `\"${String(metaAccessor.name)}\" is a ${type} and cannot be sortable or filterable — member metadata is the server-side query allowlist, and a collection compared as a scalar matches nothing.`,\n );\n}\n\n/**\n * Item counts belong to a collection, and must be counts. A `minItems` on a\n * string would read as honoured and constrain nothing.\n */\nfunction assertItemCounts(metaAccessor: MetaAccessor, type: MetaAccessorType) {\n const { minItems, maxItems } = metaAccessor;\n if (minItems === undefined && maxItems === undefined) return;\n const name = String(metaAccessor.name);\n if (!COLLECTION_TYPES.includes(type)) {\n throw new Error(\n `\"${name}\" is a ${type}, and only a collection can declare minItems or maxItems.`,\n );\n }\n assertBounds(`\"${name}\"`, { min: minItems, max: maxItems });\n}\n\n/**\n * `notBefore` compares two instants, so both ends must be `date` members of\n * the same entity. Checked once every member is described, since the one it\n * names may be declared after it.\n */\nfunction assertNotBefore(descriptors: readonly EntityFieldDescriptor[]) {\n for (const descriptor of descriptors) {\n if (descriptor.notBefore === undefined) continue;\n const earlier = descriptors.find(\n other => other.name === descriptor.notBefore,\n );\n if (descriptor.type !== 'date' || earlier?.type !== 'date') {\n throw new Error(\n `\"${descriptor.name}\" declares notBefore \"${descriptor.notBefore}\", and both must be date members of the entity.`,\n );\n }\n }\n}\n\n/**\n * A parent is one record's id, so it is an `id` or a `string` member — a\n * number or a date cannot name a record, and a collection would be two\n * parents. Checked per member, since the type is only known once inferred.\n */\nfunction assertParentType(metaAccessor: MetaAccessor, type: MetaAccessorType) {\n if (metaAccessor.parent !== true) return;\n if (type === 'id' || type === 'string') return;\n throw new Error(\n `\"${String(metaAccessor.name)}\" is a ${type} and cannot be the parent member — a parent is one record's id, so it is an id or a string.`,\n );\n}\n\n/** A reference's entity, as `@entity({ domain, key })` names it: two kebab-case words. */\nconst REFERENCE_KEY = /^[a-z0-9]+(?:-[a-z0-9]+)*:[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n/**\n * A reference holds one record's id, so it is an `id` or a `string` member, and\n * names its target as `domain:key`. On the `parent` member it may only name the\n * entity itself — a parent is a record of the same entity, built into a tree —\n * which is what lets a list show a branch's parent by name.\n */\nfunction assertReference(\n target: ChildConstructor,\n metaAccessor: MetaAccessor,\n type: MetaAccessorType,\n) {\n const { references } = metaAccessor;\n if (references === undefined) return;\n const name = String(metaAccessor.name);\n if (type !== 'id' && type !== 'string') {\n throw new Error(\n `\"${name}\" is a ${type} and declares references — a reference holds one record's id, so it is an id or a string.`,\n );\n }\n if (!REFERENCE_KEY.test(references.entity)) {\n throw new Error(\n `\"${name}\" references \"${references.entity}\", which is not an entity's \"domain:key\" — the pair its @entity({ domain, key }) declares.`,\n );\n }\n const own = findMetaEntity(target);\n if (\n metaAccessor.parent === true &&\n references.entity !== `${own?.domain}:${own?.key}`\n ) {\n throw new Error(\n `\"${name}\" is the parent member and references \"${references.entity}\" — a parent is a record of the same entity, so it can only reference ${target.name} itself.`,\n );\n }\n}\n\n/** Members whose value can name a record: a text, a number, or a reference to one. */\nconst LABEL_TYPES: readonly MetaAccessorType[] = [\n 'string',\n 'number',\n 'localized',\n];\n\n/**\n * An entity's `labelMember` must be a visible member that holds one value a\n * person can read: a hidden one never reaches the client, and a collection is\n * many names. Checked against every accessor, since a hidden member is exactly\n * the one describing would never see.\n */\nfunction assertLabelMember(\n target: ChildConstructor,\n descriptors: readonly EntityFieldDescriptor[],\n) {\n const labelMember = findMetaEntity(target)?.labelMember;\n if (labelMember === undefined) return;\n const declared = extractMetaAccessors(target).some(\n metaAccessor => String(metaAccessor.name) === labelMember,\n );\n const descriptor = descriptors.find(other => other.name === labelMember);\n if (descriptor === undefined) {\n throw new Error(\n declared\n ? `${target.name} is called by \"${labelMember}\", which is hidden — a hidden member never reaches the client, so nothing could show the name.`\n : `${target.name} is called by \"${labelMember}\", which is not a member of the entity.`,\n );\n }\n if (\n descriptor.references === undefined &&\n !LABEL_TYPES.includes(descriptor.type)\n ) {\n throw new Error(\n `${target.name} is called by \"${labelMember}\", a ${descriptor.type} — a record is called by a string, a localized text, a number or a reference.`,\n );\n }\n}\n\n/** Money is a reading of a number; any other member declaring it is a mistake. */\nfunction assertMoneyType(metaAccessor: MetaAccessor, type: MetaAccessorType) {\n if (metaAccessor.money === undefined || type === 'number') return;\n throw new Error(\n `\"${String(metaAccessor.name)}\" is a ${type} and declares money — only a number member can be an amount.`,\n );\n}\n\n/** A width is a positive length; zero or less would never switch layouts. */\nfunction assertMinWidth(metaAccessor: MetaAccessor) {\n const { minWidth } = metaAccessor;\n if (minWidth === undefined || (Number.isFinite(minWidth) && minWidth > 0))\n return;\n throw new Error(\n `\"${String(metaAccessor.name)}\" declares minWidth ${String(minWidth)} — a column's narrowest width is a positive number of rem.`,\n );\n}\n\n/**\n * A `currencyMember` must be a visible `string` member of the same entity: a\n * hidden one never reaches the client, so the amount would print with no\n * currency and nothing would say why.\n */\nfunction assertCurrencyMembers(descriptors: readonly EntityFieldDescriptor[]) {\n for (const descriptor of descriptors) {\n const member = descriptor.money?.currencyMember;\n if (member === undefined) continue;\n const currency = descriptors.find(other => other.name === member);\n if (currency?.type !== 'string') {\n throw new Error(\n `\"${descriptor.name}\" reads its currency from \"${member}\", which must be a visible string member of the entity.`,\n );\n }\n }\n}\n\n/**\n * One parent member per entity. Two would be two trees over the same records,\n * and which one a table indents by would depend on declaration order.\n */\nexport function assertOneParent(\n members: readonly {\n readonly name: string | symbol;\n readonly parent?: boolean;\n }[],\n) {\n const parents = members.filter(member => member.parent === true);\n if (parents.length > 1) {\n throw new Error(\n `An entity declares one parent member at most; found ${parents.map(member => `\"${String(member.name)}\"`).join(', ')}.`,\n );\n }\n}\n\n/**\n * ⚠️ **A parent member must travel.** The serializer skips a `hidden` or\n * `readonly` member in both directions, so the parent key would not survive a\n * single trip over the wire and the tree would arrive flat, with nothing\n * failing. Hide it from a table or a form with a slot instead. Checked before\n * hidden members are dropped, since a hidden parent is exactly the one\n * describing would never see.\n */\nexport function assertParentVisible(\n members: readonly {\n readonly name: string | symbol;\n readonly parent?: boolean;\n readonly hidden?: boolean;\n readonly readonly?: boolean;\n }[],\n) {\n const stuck = members.find(\n member =>\n member.parent === true &&\n (member.hidden === true || member.readonly === true),\n );\n if (stuck === undefined) return;\n throw new Error(\n `\"${String(stuck.name)}\" is the parent member and is ${stuck.hidden === true ? 'hidden' : 'readonly'} — such a member is never serialized, so the tree would arrive flat. Hide it with a slot instead.`,\n );\n}\n\nfunction toDescriptor(\n target: ChildConstructor,\n metaAccessor: MetaAccessor,\n index: number,\n sample: unknown,\n): EntityFieldDescriptor {\n const name = String(metaAccessor.name);\n const type =\n metaAccessor.type ??\n inferType(name, (sample as Record<string, unknown> | undefined)?.[name]);\n assertNotQueryable(metaAccessor, type);\n assertItemCounts(metaAccessor, type);\n assertParentType(metaAccessor, type);\n assertReference(target, metaAccessor, type);\n assertMoneyType(metaAccessor, type);\n assertMinWidth(metaAccessor);\n // A localized member is queried one locale at a time (`name.en`), which\n // makes it as queryable as the text each locale holds.\n const isScalar = SCALAR_TYPES.includes(type) || type === 'localized';\n const linkLabelProperty = metaAccessor.linkLabelProperty ?? 'name';\n\n return {\n name,\n key: String(metaAccessor.alias ?? metaAccessor.name),\n label: metaAccessor.label ?? humanize(name),\n labelKey: metaAccessor.labelKey,\n type,\n sortable: metaAccessor.sortable ?? isScalar,\n filterable: metaAccessor.filterable ?? isScalar,\n order: metaAccessor.order ?? index,\n readonly: metaAccessor.readonly ?? false,\n required: metaAccessor.required ?? false,\n enumValues: metaAccessor.enumValues,\n enumLabelKey: metaAccessor.enumLabelKey,\n linkLabelProperty,\n linkSearchProperty: metaAccessor.linkSearchProperty ?? linkLabelProperty,\n linkSerialization: metaAccessor.linkSerialization ?? 'id',\n childType: metaAccessor.childType?.(),\n resetOnClone: metaAccessor.resetOnClone ?? false,\n minItems: metaAccessor.minItems,\n maxItems: metaAccessor.maxItems,\n notBefore: metaAccessor.notBefore,\n ...(metaAccessor.money === undefined ? {} : { money: metaAccessor.money }),\n ...(metaAccessor.minWidth === undefined\n ? {}\n : { minWidth: metaAccessor.minWidth }),\n ...(metaAccessor.card === undefined ? {} : { card: metaAccessor.card }),\n ...(metaAccessor.autocomplete === undefined\n ? {}\n : { autocomplete: metaAccessor.autocomplete }),\n parent: metaAccessor.parent ?? false,\n ...(metaAccessor.references === undefined\n ? {}\n : { references: metaAccessor.references }),\n };\n}\n\n/**\n * Resolves an entity's displayable members from its accessor metadata, sorted by\n * `order` (declaration order when undeclared).\n *\n * Getter-kind and non-`hidden` mirror the filter {@link serializeEntity} walks,\n * minus its `readonly` exclusion: a read-only member is still worth showing,\n * it just cannot be written back.\n *\n * `sample` is an optional instance used only to infer the `type` of accessors\n * that did not declare one.\n *\n * The target is a {@link ChildConstructor} rather than an `EntityConstructor`,\n * which is wider than it looks: nothing here reads `id`, and a `composition`\n * member's child is a **value** with accessors and no identity. So the same\n * walk describes an entity and describes one row of the collection it owns,\n * from one implementation.\n */\nexport function describeEntityColumns<TTarget extends object>(\n entityConstructor: ChildConstructor<TTarget>,\n sample?: TTarget,\n): EntityFieldDescriptor[] {\n const seen = new Set<string>();\n assertParentVisible(extractMetaAccessors(entityConstructor));\n\n const descriptors = extractMetaAccessors(entityConstructor)\n .filter(metaAccessor => {\n if (metaAccessor.hidden || metaAccessor.kind !== 'getter') return false;\n const name = String(metaAccessor.name);\n if (seen.has(name)) return false;\n seen.add(name);\n return true;\n })\n .map((metaAccessor, index) =>\n toDescriptor(entityConstructor, metaAccessor, index, sample),\n )\n .sort((left, right) => left.order - right.order);\n assertNotBefore(descriptors);\n assertCurrencyMembers(descriptors);\n assertOneParent(descriptors);\n assertLabelMember(entityConstructor, descriptors);\n return descriptors;\n}\n"],"names":["extractMetaAccessors","findMetaEntity","EntityCollectionLink","EntityLink","assertBounds","SCALAR_TYPES","COLLECTION_TYPES","humanize","name","replace","trim","first","toUpperCase","inferType","value","Date","assertNotQueryable","metaAccessor","type","includes","sortable","filterable","Error","String","assertItemCounts","minItems","maxItems","undefined","min","max","assertNotBefore","descriptors","descriptor","notBefore","earlier","find","other","assertParentType","parent","REFERENCE_KEY","assertReference","target","references","test","entity","own","domain","key","LABEL_TYPES","assertLabelMember","labelMember","declared","some","assertMoneyType","money","assertMinWidth","minWidth","Number","isFinite","assertCurrencyMembers","member","currencyMember","currency","assertOneParent","members","parents","filter","length","map","join","assertParentVisible","stuck","hidden","readonly","toDescriptor","index","sample","isScalar","linkLabelProperty","alias","label","labelKey","order","required","enumValues","enumLabelKey","linkSearchProperty","linkSerialization","childType","resetOnClone","card","autocomplete","describeEntityColumns","entityConstructor","seen","Set","kind","has","add","sort","left","right"],"mappings":";AAAA,SAASA,oBAAoB,EAAEC,cAAc,QAAQ,sBAAsB;AAC3E,SAASC,oBAAoB,QAAQ,2CAA2C;AAChF,SAASC,UAAU,QAAQ,gCAAgC;AAC3D,SAASC,YAAY,QAAQ,6BAA6B;AAgF1D,2EA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C;AAEA;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASkD,sBACdC,iBAA4C,EAC5CjB,MAAgB;IAEhB,MAAMkB,OAAO,IAAIC;IACjBzB,oBAAoBtE,qBAAqB6F;IAEzC,MAAM9D,cAAc/B,qBAAqB6F,mBACtC3B,MAAM,CAACjD,CAAAA;QACN,IAAIA,aAAauD,MAAM,IAAIvD,aAAa+E,IAAI,KAAK,UAAU,OAAO;QAClE,MAAMxF,OAAOe,OAAON,aAAaT,IAAI;QACrC,IAAIsF,KAAKG,GAAG,CAACzF,OAAO,OAAO;QAC3BsF,KAAKI,GAAG,CAAC1F;QACT,OAAO;IACT,GACC4D,GAAG,CAAC,CAACnD,cAAc0D,QAClBD,aAAamB,mBAAmB5E,cAAc0D,OAAOC,SAEtDuB,IAAI,CAAC,CAACC,MAAMC,QAAUD,KAAKlB,KAAK,GAAGmB,MAAMnB,KAAK;IACjDpD,gBAAgBC;IAChB4B,sBAAsB5B;IACtBgC,gBAAgBhC;IAChBkB,kBAAkB4C,mBAAmB9D;IACrC,OAAOA;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../src/entity-definition/describe/describe-entity-columns.ts"],"sourcesContent":["import { extractMetaAccessors, findMetaEntity } from '../helpers/index.js';\nimport { EntityCollectionLink } from '../links/entity-collection-link/index.js';\nimport { EntityLink } from '../links/entity-link/index.js';\nimport { assertBounds } from '../meta-entities/bounds.js';\nimport {\n type CardRole,\n type ChildConstructor,\n type EntityLinkSerialization,\n type EnumTone,\n EnumTones,\n type MemberReference,\n MetaAccessor,\n MetaAccessorType,\n type MoneyFormat,\n} from '../meta-entities/meta-accessor/index.js';\n\n/**\n * A displayable member of an entity, resolved from its accessor metadata. This\n * is the contract generic UI builds itself from — a table's columns today, a\n * form's fields later — so it stays framework-free and lives next to the\n * metadata it derives from.\n */\nexport interface EntityFieldDescriptor {\n /** Accessor name. The stable identity used by preferences and slots. */\n name: string;\n /** Wire/property key: `alias ?? name`. */\n key: string;\n label: string;\n /**\n * Catalog key for {@link label}, when the entity declared one. Resolution is\n * the presentation layer's job — core has no locale and no catalogs, and the\n * same descriptor feeds the server-side filter allowlist, where a translated\n * label would be meaningless.\n */\n labelKey?: string;\n type: MetaAccessorType;\n sortable: boolean;\n filterable: boolean;\n order: number;\n /** Cannot be written back. A form shows it but disables its input. */\n readonly: boolean;\n /** Must hold a value. A form rejects submit while it is empty. */\n required: boolean;\n enumValues?: readonly string[];\n /** Catalog prefix for {@link enumValues}; a value reads as `${enumLabelKey}.${value}`. */\n enumLabelKey?: string;\n /** The tone each value reads in as a status, when the member declares them. */\n enumTones?: Readonly<Record<string, EnumTone>>;\n /** Property of a `link` target used as its display label. */\n linkLabelProperty: string;\n /** Property of a `link` target a picker searches on. Defaults to the label. */\n linkSearchProperty: string;\n /** Whether a `link` writes back its foreign key or the inlined target. */\n linkSerialization: EntityLinkSerialization;\n /**\n * The class describing one row of a `composition` member, resolved from the\n * accessor's thunk. Absent on every other type.\n */\n childType?: ChildConstructor;\n /**\n * The member is dropped when the record is copied — a unique code, an audit\n * stamp. The identity member is always reset and is not flagged.\n */\n resetOnClone: boolean;\n /** The fewest values a collection member may hold. */\n minItems?: number;\n /** The most values a collection member may hold. */\n maxItems?: number;\n /** The `date` member this one may not precede. */\n notBefore?: string;\n /** The member is an amount of money, read as this declares. `number` members only. */\n money?: MoneyFormat;\n /** The narrowest the member's column reads at, in `rem`, when declared. */\n minWidth?: number;\n /** The part the member plays on a record's card, when declared. */\n card?: CardRole;\n /** The member's HTML autofill token, when declared. */\n autocomplete?: string;\n /** This member holds the parent record's id: the entity forms a tree. */\n parent?: boolean;\n /**\n * This member holds the id of a record of another entity, named `domain:key`.\n * A screen shows that record's name in its place.\n */\n references?: MemberReference;\n}\n\n/** Types whose values are scalars a user can meaningfully sort/filter on. */\nexport const SCALAR_TYPES: readonly MetaAccessorType[] = [\n 'string',\n 'number',\n 'boolean',\n 'date',\n 'enum',\n];\n\n/**\n * Types whose value is a collection. None of them may ever be sorted or\n * filtered: this descriptor is also the **server-side RSQL allowlist**, and an\n * array compared as a scalar matches nothing — so the query would not fail, it\n * would quietly return an empty page.\n *\n * Exported so `describe-entity-columns.spec.ts` can assert that this list,\n * {@link SCALAR_TYPES}, the two reference types and `localized` partition\n * `MetaAccessorTypes` exactly. Nothing in the repo guards `MetaAccessorType`\n * exhaustively — every switch over it has a `default` that treats the value as\n * a string — so that partition spec is what makes an eleventh type impossible\n * to add silently.\n */\nexport const COLLECTION_TYPES: readonly MetaAccessorType[] = [\n 'linkCollection',\n 'composition',\n 'scalarCollection',\n];\n\n/** `productCode` / `product-code` / `product_code` → `Product Code`. */\nfunction humanize(name: string): string {\n return name\n .replace(/[-_]+/g, ' ')\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replace(/\\s+/g, ' ')\n .trim()\n .replace(/^./, first => first.toUpperCase());\n}\n\n/**\n * Best-effort type for accessors that did not declare one. Entities are not\n * required to annotate every member, so a sample row keeps a bare `@accessor()`\n * usable; a declared `type` always wins over this.\n */\nfunction inferType(name: string, value: unknown): MetaAccessorType {\n if (value instanceof EntityLink) return 'link';\n if (value instanceof EntityCollectionLink) return 'linkCollection';\n if (value instanceof Date) return 'date';\n if (typeof value === 'number') return 'number';\n if (typeof value === 'boolean') return 'boolean';\n if (name === 'id') return 'id';\n return 'string';\n}\n\n/**\n * A collection member declared queryable is always a mistake, so it breaks the\n * developer rather than the query — the same posture as `applyEntityLinks`\n * throwing on an `embedded` link it cannot build.\n *\n * Silently clamping to `false` was the alternative and is worse: the author\n * keeps a declaration that reads as honoured, and the symptom is an empty\n * result page rather than an error anyone can act on.\n */\nfunction assertNotQueryable(\n metaAccessor: MetaAccessor,\n type: MetaAccessorType,\n) {\n if (!COLLECTION_TYPES.includes(type)) return;\n if (metaAccessor.sortable !== true && metaAccessor.filterable !== true)\n return;\n throw new Error(\n `\"${String(metaAccessor.name)}\" is a ${type} and cannot be sortable or filterable — member metadata is the server-side query allowlist, and a collection compared as a scalar matches nothing.`,\n );\n}\n\n/**\n * Item counts belong to a collection, and must be counts. A `minItems` on a\n * string would read as honoured and constrain nothing.\n */\nfunction assertItemCounts(metaAccessor: MetaAccessor, type: MetaAccessorType) {\n const { minItems, maxItems } = metaAccessor;\n if (minItems === undefined && maxItems === undefined) return;\n const name = String(metaAccessor.name);\n if (!COLLECTION_TYPES.includes(type)) {\n throw new Error(\n `\"${name}\" is a ${type}, and only a collection can declare minItems or maxItems.`,\n );\n }\n assertBounds(`\"${name}\"`, { min: minItems, max: maxItems });\n}\n\n/**\n * `notBefore` compares two instants, so both ends must be `date` members of\n * the same entity. Checked once every member is described, since the one it\n * names may be declared after it.\n */\nfunction assertNotBefore(descriptors: readonly EntityFieldDescriptor[]) {\n for (const descriptor of descriptors) {\n if (descriptor.notBefore === undefined) continue;\n const earlier = descriptors.find(\n other => other.name === descriptor.notBefore,\n );\n if (descriptor.type !== 'date' || earlier?.type !== 'date') {\n throw new Error(\n `\"${descriptor.name}\" declares notBefore \"${descriptor.notBefore}\", and both must be date members of the entity.`,\n );\n }\n }\n}\n\n/**\n * A parent is one record's id, so it is an `id` or a `string` member — a\n * number or a date cannot name a record, and a collection would be two\n * parents. Checked per member, since the type is only known once inferred.\n */\nfunction assertParentType(metaAccessor: MetaAccessor, type: MetaAccessorType) {\n if (metaAccessor.parent !== true) return;\n if (type === 'id' || type === 'string') return;\n throw new Error(\n `\"${String(metaAccessor.name)}\" is a ${type} and cannot be the parent member — a parent is one record's id, so it is an id or a string.`,\n );\n}\n\n/** A reference's entity, as `@entity({ domain, key })` names it: two kebab-case words. */\nconst REFERENCE_KEY = /^[a-z0-9]+(?:-[a-z0-9]+)*:[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n/**\n * A reference holds one record's id, so it is an `id` or a `string` member, and\n * names its target as `domain:key`. On the `parent` member it may only name the\n * entity itself — a parent is a record of the same entity, built into a tree —\n * which is what lets a list show a branch's parent by name.\n */\nfunction assertReference(\n target: ChildConstructor,\n metaAccessor: MetaAccessor,\n type: MetaAccessorType,\n) {\n const { references } = metaAccessor;\n if (references === undefined) return;\n const name = String(metaAccessor.name);\n if (type !== 'id' && type !== 'string') {\n throw new Error(\n `\"${name}\" is a ${type} and declares references — a reference holds one record's id, so it is an id or a string.`,\n );\n }\n if (!REFERENCE_KEY.test(references.entity)) {\n throw new Error(\n `\"${name}\" references \"${references.entity}\", which is not an entity's \"domain:key\" — the pair its @entity({ domain, key }) declares.`,\n );\n }\n const own = findMetaEntity(target);\n if (\n metaAccessor.parent === true &&\n references.entity !== `${own?.domain}:${own?.key}`\n ) {\n throw new Error(\n `\"${name}\" is the parent member and references \"${references.entity}\" — a parent is a record of the same entity, so it can only reference ${target.name} itself.`,\n );\n }\n}\n\n/** Members whose value can name a record: a text, a number, or a reference to one. */\nconst LABEL_TYPES: readonly MetaAccessorType[] = [\n 'string',\n 'number',\n 'localized',\n];\n\n/**\n * An entity's `labelMember` must be a visible member that holds one value a\n * person can read: a hidden one never reaches the client, and a collection is\n * many names. Checked against every accessor, since a hidden member is exactly\n * the one describing would never see.\n */\nfunction assertLabelMember(\n target: ChildConstructor,\n descriptors: readonly EntityFieldDescriptor[],\n) {\n const labelMember = findMetaEntity(target)?.labelMember;\n if (labelMember === undefined) return;\n const declared = extractMetaAccessors(target).some(\n metaAccessor => String(metaAccessor.name) === labelMember,\n );\n const descriptor = descriptors.find(other => other.name === labelMember);\n if (descriptor === undefined) {\n throw new Error(\n declared\n ? `${target.name} is called by \"${labelMember}\", which is hidden — a hidden member never reaches the client, so nothing could show the name.`\n : `${target.name} is called by \"${labelMember}\", which is not a member of the entity.`,\n );\n }\n if (\n descriptor.references === undefined &&\n !LABEL_TYPES.includes(descriptor.type)\n ) {\n throw new Error(\n `${target.name} is called by \"${labelMember}\", a ${descriptor.type} — a record is called by a string, a localized text, a number or a reference.`,\n );\n }\n}\n\n/** Money is a reading of a number; any other member declaring it is a mistake. */\nfunction assertMoneyType(metaAccessor: MetaAccessor, type: MetaAccessorType) {\n if (metaAccessor.money === undefined || type === 'number') return;\n throw new Error(\n `\"${String(metaAccessor.name)}\" is a ${type} and declares money — only a number member can be an amount.`,\n );\n}\n\n/**\n * Tones belong to an enum's values: on any other member, or keyed by a value\n * the enum does not have, they would colour nothing — or the wrong thing.\n */\nfunction assertEnumTones(metaAccessor: MetaAccessor, type: MetaAccessorType) {\n const { enumTones } = metaAccessor;\n if (enumTones === undefined) return;\n const name = String(metaAccessor.name);\n if (type !== 'enum') {\n throw new Error(\n `\"${name}\" is a ${type} and declares enumTones — only an enum member's values have a tone.`,\n );\n }\n const values = metaAccessor.enumValues ?? [];\n for (const [value, tone] of Object.entries(enumTones)) {\n if (!values.includes(value)) {\n throw new Error(\n `\"${name}\" declares a tone for \"${value}\", which is not one of its enumValues (${values.join(', ')}).`,\n );\n }\n if (!(EnumTones as readonly string[]).includes(tone)) {\n throw new Error(\n `\"${name}\" declares tone \"${String(tone)}\" for \"${value}\" — a tone is one of ${EnumTones.join(', ')}.`,\n );\n }\n }\n}\n\n/** A width is a positive length; zero or less would never switch layouts. */\nfunction assertMinWidth(metaAccessor: MetaAccessor) {\n const { minWidth } = metaAccessor;\n if (minWidth === undefined || (Number.isFinite(minWidth) && minWidth > 0))\n return;\n throw new Error(\n `\"${String(metaAccessor.name)}\" declares minWidth ${String(minWidth)} — a column's narrowest width is a positive number of rem.`,\n );\n}\n\n/**\n * A `currencyMember` must be a visible `string` member of the same entity: a\n * hidden one never reaches the client, so the amount would print with no\n * currency and nothing would say why.\n */\nfunction assertCurrencyMembers(descriptors: readonly EntityFieldDescriptor[]) {\n for (const descriptor of descriptors) {\n const member = descriptor.money?.currencyMember;\n if (member === undefined) continue;\n const currency = descriptors.find(other => other.name === member);\n if (currency?.type !== 'string') {\n throw new Error(\n `\"${descriptor.name}\" reads its currency from \"${member}\", which must be a visible string member of the entity.`,\n );\n }\n }\n}\n\n/**\n * One parent member per entity. Two would be two trees over the same records,\n * and which one a table indents by would depend on declaration order.\n */\nexport function assertOneParent(\n members: readonly {\n readonly name: string | symbol;\n readonly parent?: boolean;\n }[],\n) {\n const parents = members.filter(member => member.parent === true);\n if (parents.length > 1) {\n throw new Error(\n `An entity declares one parent member at most; found ${parents.map(member => `\"${String(member.name)}\"`).join(', ')}.`,\n );\n }\n}\n\n/**\n * ⚠️ **A parent member must travel.** The serializer skips a `hidden` or\n * `readonly` member in both directions, so the parent key would not survive a\n * single trip over the wire and the tree would arrive flat, with nothing\n * failing. Hide it from a table or a form with a slot instead. Checked before\n * hidden members are dropped, since a hidden parent is exactly the one\n * describing would never see.\n */\nexport function assertParentVisible(\n members: readonly {\n readonly name: string | symbol;\n readonly parent?: boolean;\n readonly hidden?: boolean;\n readonly readonly?: boolean;\n }[],\n) {\n const stuck = members.find(\n member =>\n member.parent === true &&\n (member.hidden === true || member.readonly === true),\n );\n if (stuck === undefined) return;\n throw new Error(\n `\"${String(stuck.name)}\" is the parent member and is ${stuck.hidden === true ? 'hidden' : 'readonly'} — such a member is never serialized, so the tree would arrive flat. Hide it with a slot instead.`,\n );\n}\n\nfunction toDescriptor(\n target: ChildConstructor,\n metaAccessor: MetaAccessor,\n index: number,\n sample: unknown,\n): EntityFieldDescriptor {\n const name = String(metaAccessor.name);\n const type =\n metaAccessor.type ??\n inferType(name, (sample as Record<string, unknown> | undefined)?.[name]);\n assertNotQueryable(metaAccessor, type);\n assertItemCounts(metaAccessor, type);\n assertParentType(metaAccessor, type);\n assertReference(target, metaAccessor, type);\n assertMoneyType(metaAccessor, type);\n assertEnumTones(metaAccessor, type);\n assertMinWidth(metaAccessor);\n // A localized member is queried one locale at a time (`name.en`), which\n // makes it as queryable as the text each locale holds.\n const isScalar = SCALAR_TYPES.includes(type) || type === 'localized';\n const linkLabelProperty = metaAccessor.linkLabelProperty ?? 'name';\n\n return {\n name,\n key: String(metaAccessor.alias ?? metaAccessor.name),\n label: metaAccessor.label ?? humanize(name),\n labelKey: metaAccessor.labelKey,\n type,\n sortable: metaAccessor.sortable ?? isScalar,\n filterable: metaAccessor.filterable ?? isScalar,\n order: metaAccessor.order ?? index,\n readonly: metaAccessor.readonly ?? false,\n required: metaAccessor.required ?? false,\n enumValues: metaAccessor.enumValues,\n enumLabelKey: metaAccessor.enumLabelKey,\n ...(metaAccessor.enumTones === undefined\n ? {}\n : { enumTones: metaAccessor.enumTones }),\n linkLabelProperty,\n linkSearchProperty: metaAccessor.linkSearchProperty ?? linkLabelProperty,\n linkSerialization: metaAccessor.linkSerialization ?? 'id',\n childType: metaAccessor.childType?.(),\n resetOnClone: metaAccessor.resetOnClone ?? false,\n minItems: metaAccessor.minItems,\n maxItems: metaAccessor.maxItems,\n notBefore: metaAccessor.notBefore,\n ...(metaAccessor.money === undefined ? {} : { money: metaAccessor.money }),\n ...(metaAccessor.minWidth === undefined\n ? {}\n : { minWidth: metaAccessor.minWidth }),\n ...(metaAccessor.card === undefined ? {} : { card: metaAccessor.card }),\n ...(metaAccessor.autocomplete === undefined\n ? {}\n : { autocomplete: metaAccessor.autocomplete }),\n parent: metaAccessor.parent ?? false,\n ...(metaAccessor.references === undefined\n ? {}\n : { references: metaAccessor.references }),\n };\n}\n\n/**\n * Resolves an entity's displayable members from its accessor metadata, sorted by\n * `order` (declaration order when undeclared).\n *\n * Getter-kind and non-`hidden` mirror the filter {@link serializeEntity} walks,\n * minus its `readonly` exclusion: a read-only member is still worth showing,\n * it just cannot be written back.\n *\n * `sample` is an optional instance used only to infer the `type` of accessors\n * that did not declare one.\n *\n * The target is a {@link ChildConstructor} rather than an `EntityConstructor`,\n * which is wider than it looks: nothing here reads `id`, and a `composition`\n * member's child is a **value** with accessors and no identity. So the same\n * walk describes an entity and describes one row of the collection it owns,\n * from one implementation.\n */\nexport function describeEntityColumns<TTarget extends object>(\n entityConstructor: ChildConstructor<TTarget>,\n sample?: TTarget,\n): EntityFieldDescriptor[] {\n const seen = new Set<string>();\n assertParentVisible(extractMetaAccessors(entityConstructor));\n\n const descriptors = extractMetaAccessors(entityConstructor)\n .filter(metaAccessor => {\n if (metaAccessor.hidden || metaAccessor.kind !== 'getter') return false;\n const name = String(metaAccessor.name);\n if (seen.has(name)) return false;\n seen.add(name);\n return true;\n })\n .map((metaAccessor, index) =>\n toDescriptor(entityConstructor, metaAccessor, index, sample),\n )\n .sort((left, right) => left.order - right.order);\n assertNotBefore(descriptors);\n assertCurrencyMembers(descriptors);\n assertOneParent(descriptors);\n assertLabelMember(entityConstructor, descriptors);\n return descriptors;\n}\n"],"names":["extractMetaAccessors","findMetaEntity","EntityCollectionLink","EntityLink","assertBounds","EnumTones","SCALAR_TYPES","COLLECTION_TYPES","humanize","name","replace","trim","first","toUpperCase","inferType","value","Date","assertNotQueryable","metaAccessor","type","includes","sortable","filterable","Error","String","assertItemCounts","minItems","maxItems","undefined","min","max","assertNotBefore","descriptors","descriptor","notBefore","earlier","find","other","assertParentType","parent","REFERENCE_KEY","assertReference","target","references","test","entity","own","domain","key","LABEL_TYPES","assertLabelMember","labelMember","declared","some","assertMoneyType","money","assertEnumTones","enumTones","values","enumValues","tone","Object","entries","join","assertMinWidth","minWidth","Number","isFinite","assertCurrencyMembers","member","currencyMember","currency","assertOneParent","members","parents","filter","length","map","assertParentVisible","stuck","hidden","readonly","toDescriptor","index","sample","isScalar","linkLabelProperty","alias","label","labelKey","order","required","enumLabelKey","linkSearchProperty","linkSerialization","childType","resetOnClone","card","autocomplete","describeEntityColumns","entityConstructor","seen","Set","kind","has","add","sort","left","right"],"mappings":";AAAA,SAASA,oBAAoB,EAAEC,cAAc,QAAQ,sBAAsB;AAC3E,SAASC,oBAAoB,QAAQ,2CAA2C;AAChF,SAASC,UAAU,QAAQ,gCAAgC;AAC3D,SAASC,YAAY,QAAQ,6BAA6B;AAC1D,SAKEC,SAAS,QAKJ,0CAA0C;AAyEjD,2EAA2E,GAC3E,OAAO,MAAMC,eAA4C;IACvD;IACA;IACA;IACA;IACA;CACD,CAAC;AAEF;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMC,mBAAgD;IAC3D;IACA;IACA;CACD,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CoE,GAAG,CAAC,CAAC3D,cAAciE,QAClBD,aAAakB,mBAAmBlF,cAAciE,OAAOC,SAEtDsB,IAAI,CAAC,CAACC,MAAMC,QAAUD,KAAKjB,KAAK,GAAGkB,MAAMlB,KAAK;IACjD3D,gBAAgBC;IAChBoC,sBAAsBpC;IACtBwC,gBAAgBxC;IAChBkB,kBAAkBkD,mBAAmBpE;IACrC,OAAOA;AACT"}
|
|
@@ -8,6 +8,17 @@ import type { EntityFieldDescriptor } from './describe-entity-columns.js';
|
|
|
8
8
|
* refuses.
|
|
9
9
|
*/
|
|
10
10
|
export declare function queryPropertyFor(descriptor: EntityFieldDescriptor, locale: Locale): string;
|
|
11
|
+
/**
|
|
12
|
+
* The property a filter or sort names for a member, and how one of its values
|
|
13
|
+
* reads, in a given locale — the pair a control that both queries a member and
|
|
14
|
+
* shows it needs. A `localized` member is queried as `title.<locale>` and read
|
|
15
|
+
* in that locale (falling back to the default one); any other member is its
|
|
16
|
+
* wire key and reads as itself.
|
|
17
|
+
*/
|
|
18
|
+
export declare function localizedQueryProperty(descriptor: EntityFieldDescriptor, locale: Locale): {
|
|
19
|
+
readonly property: string;
|
|
20
|
+
readonly read: (value: unknown) => string | undefined;
|
|
21
|
+
};
|
|
11
22
|
/**
|
|
12
23
|
* The member an applied filter or sort names — by its accessor name, its wire
|
|
13
24
|
* key, or a locale path into a `localized` one — so a control can show what is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-property.d.ts","sourceRoot":"","sources":["../../../src/entity-definition/describe/query-property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"query-property.d.ts","sourceRoot":"","sources":["../../../src/entity-definition/describe/query-property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,qBAAqB,EACjC,MAAM,EAAE,MAAM,GACb,MAAM,CAIR;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,qBAAqB,EACjC,MAAM,EAAE,MAAM,GACb;IACD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;CACvD,CAWA;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,SAAS,qBAAqB,EAAE,EAC7C,QAAQ,EAAE,MAAM,GACf,qBAAqB,GAAG,SAAS,CASnC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isLocalizedText, localize } from '../../i18n/localized-text.js';
|
|
1
2
|
/**
|
|
2
3
|
* The property a filter or sort names for a member: its wire key, or for a
|
|
3
4
|
* `localized` member the path to one locale's text — the only way one is
|
|
@@ -7,6 +8,24 @@
|
|
|
7
8
|
*/ export function queryPropertyFor(descriptor, locale) {
|
|
8
9
|
return descriptor.type === 'localized' ? `${descriptor.key}.${locale}` : descriptor.key;
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* The property a filter or sort names for a member, and how one of its values
|
|
13
|
+
* reads, in a given locale — the pair a control that both queries a member and
|
|
14
|
+
* shows it needs. A `localized` member is queried as `title.<locale>` and read
|
|
15
|
+
* in that locale (falling back to the default one); any other member is its
|
|
16
|
+
* wire key and reads as itself.
|
|
17
|
+
*/ export function localizedQueryProperty(descriptor, locale) {
|
|
18
|
+
return {
|
|
19
|
+
property: queryPropertyFor(descriptor, locale),
|
|
20
|
+
read: (value)=>{
|
|
21
|
+
if (value == null) return undefined;
|
|
22
|
+
if (descriptor.type === 'localized') {
|
|
23
|
+
return isLocalizedText(value) ? localize(value, locale) : undefined;
|
|
24
|
+
}
|
|
25
|
+
return String(value);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
10
29
|
/**
|
|
11
30
|
* The member an applied filter or sort names — by its accessor name, its wire
|
|
12
31
|
* key, or a locale path into a `localized` one — so a control can show what is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/entity-definition/describe/query-property.ts"],"sourcesContent":["import type { Locale } from '../../i18n/locales.js';\nimport type { EntityFieldDescriptor } from './describe-entity-columns.js';\n\n/**\n * The property a filter or sort names for a member: its wire key, or for a\n * `localized` member the path to one locale's text — the only way one is\n * queried (`title.en`). A control building a query from a descriptor asks this\n * rather than reading `key`, so it never sends the bare object the server\n * refuses.\n */\nexport function queryPropertyFor(\n descriptor: EntityFieldDescriptor,\n locale: Locale,\n): string {\n return descriptor.type === 'localized'\n ? `${descriptor.key}.${locale}`\n : descriptor.key;\n}\n\n/**\n * The member an applied filter or sort names — by its accessor name, its wire\n * key, or a locale path into a `localized` one — so a control can show what is\n * in effect.\n */\nexport function findQueriedDescriptor(\n descriptors: readonly EntityFieldDescriptor[],\n property: string,\n): EntityFieldDescriptor | undefined {\n return descriptors.find(\n descriptor =>\n descriptor.key === property ||\n descriptor.name === property ||\n (descriptor.type === 'localized' &&\n (property.startsWith(`${descriptor.key}.`) ||\n property.startsWith(`${descriptor.name}.`))),\n );\n}\n"],"names":["queryPropertyFor","descriptor","locale","type","key","
|
|
1
|
+
{"version":3,"sources":["../../../src/entity-definition/describe/query-property.ts"],"sourcesContent":["import type { Locale } from '../../i18n/locales.js';\nimport { isLocalizedText, localize } from '../../i18n/localized-text.js';\nimport type { EntityFieldDescriptor } from './describe-entity-columns.js';\n\n/**\n * The property a filter or sort names for a member: its wire key, or for a\n * `localized` member the path to one locale's text — the only way one is\n * queried (`title.en`). A control building a query from a descriptor asks this\n * rather than reading `key`, so it never sends the bare object the server\n * refuses.\n */\nexport function queryPropertyFor(\n descriptor: EntityFieldDescriptor,\n locale: Locale,\n): string {\n return descriptor.type === 'localized'\n ? `${descriptor.key}.${locale}`\n : descriptor.key;\n}\n\n/**\n * The property a filter or sort names for a member, and how one of its values\n * reads, in a given locale — the pair a control that both queries a member and\n * shows it needs. A `localized` member is queried as `title.<locale>` and read\n * in that locale (falling back to the default one); any other member is its\n * wire key and reads as itself.\n */\nexport function localizedQueryProperty(\n descriptor: EntityFieldDescriptor,\n locale: Locale,\n): {\n readonly property: string;\n readonly read: (value: unknown) => string | undefined;\n} {\n return {\n property: queryPropertyFor(descriptor, locale),\n read: value => {\n if (value == null) return undefined;\n if (descriptor.type === 'localized') {\n return isLocalizedText(value) ? localize(value, locale) : undefined;\n }\n return String(value);\n },\n };\n}\n\n/**\n * The member an applied filter or sort names — by its accessor name, its wire\n * key, or a locale path into a `localized` one — so a control can show what is\n * in effect.\n */\nexport function findQueriedDescriptor(\n descriptors: readonly EntityFieldDescriptor[],\n property: string,\n): EntityFieldDescriptor | undefined {\n return descriptors.find(\n descriptor =>\n descriptor.key === property ||\n descriptor.name === property ||\n (descriptor.type === 'localized' &&\n (property.startsWith(`${descriptor.key}.`) ||\n property.startsWith(`${descriptor.name}.`))),\n );\n}\n"],"names":["isLocalizedText","localize","queryPropertyFor","descriptor","locale","type","key","localizedQueryProperty","property","read","value","undefined","String","findQueriedDescriptor","descriptors","find","name","startsWith"],"mappings":"AACA,SAASA,eAAe,EAAEC,QAAQ,QAAQ,+BAA+B;AAGzE;;;;;;CAMC,GACD,OAAO,SAASC,iBACdC,UAAiC,EACjCC,MAAc;IAEd,OAAOD,WAAWE,IAAI,KAAK,cACvB,GAAGF,WAAWG,GAAG,CAAC,CAAC,EAAEF,QAAQ,GAC7BD,WAAWG,GAAG;AACpB;AAEA;;;;;;CAMC,GACD,OAAO,SAASC,uBACdJ,UAAiC,EACjCC,MAAc;IAKd,OAAO;QACLI,UAAUN,iBAAiBC,YAAYC;QACvCK,MAAMC,CAAAA;YACJ,IAAIA,SAAS,MAAM,OAAOC;YAC1B,IAAIR,WAAWE,IAAI,KAAK,aAAa;gBACnC,OAAOL,gBAAgBU,SAAST,SAASS,OAAON,UAAUO;YAC5D;YACA,OAAOC,OAAOF;QAChB;IACF;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASG,sBACdC,WAA6C,EAC7CN,QAAgB;IAEhB,OAAOM,YAAYC,IAAI,CACrBZ,CAAAA,aACEA,WAAWG,GAAG,KAAKE,YACnBL,WAAWa,IAAI,KAAKR,YACnBL,WAAWE,IAAI,KAAK,eAClBG,CAAAA,SAASS,UAAU,CAAC,GAAGd,WAAWG,GAAG,CAAC,CAAC,CAAC,KACvCE,SAASS,UAAU,CAAC,GAAGd,WAAWa,IAAI,CAAC,CAAC,CAAC,CAAA;AAEnD"}
|
|
@@ -66,6 +66,15 @@ export interface MetaAccessorOptions {
|
|
|
66
66
|
* shared with another member can point both at one vocabulary.
|
|
67
67
|
*/
|
|
68
68
|
enumLabelKey?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The tone each value reads in where it is shown as a status: `success`,
|
|
71
|
+
* `warning`, `danger`, `info` or `neutral`. Legal only on an `enum` member,
|
|
72
|
+
* and every key must be one of its {@link enumValues}; a value left out reads
|
|
73
|
+
* `neutral`. Declared, a screen shows the value as a tag in that tone beside
|
|
74
|
+
* its words; undeclared, the value stays plain text — not every enum is a
|
|
75
|
+
* status. Presentation only.
|
|
76
|
+
*/
|
|
77
|
+
enumTones?: Readonly<Record<string, EnumTone>>;
|
|
69
78
|
/** Property of a `link` target used as its display label. Default `name`. */
|
|
70
79
|
linkLabelProperty?: string;
|
|
71
80
|
/**
|
|
@@ -189,6 +198,12 @@ export interface MetaAccessorOptions {
|
|
|
189
198
|
*/
|
|
190
199
|
autocomplete?: string;
|
|
191
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* The tone an enum value reads in as a status. Words always go beside it — a
|
|
203
|
+
* tone never carries a meaning alone.
|
|
204
|
+
*/
|
|
205
|
+
export declare const EnumTones: readonly ["success", "warning", "danger", "info", "neutral"];
|
|
206
|
+
export type EnumTone = (typeof EnumTones)[number];
|
|
192
207
|
/** The entity a reference member points at, as `domain:key`. */
|
|
193
208
|
export interface MemberReference {
|
|
194
209
|
readonly entity: string;
|
|
@@ -224,6 +239,7 @@ export declare class MetaAccessor {
|
|
|
224
239
|
readonly order?: number;
|
|
225
240
|
readonly enumValues?: readonly string[];
|
|
226
241
|
readonly enumLabelKey?: string;
|
|
242
|
+
readonly enumTones?: Readonly<Record<string, EnumTone>>;
|
|
227
243
|
readonly linkLabelProperty?: string;
|
|
228
244
|
readonly linkSearchProperty?: string;
|
|
229
245
|
readonly linkSerialization?: EntityLinkSerialization;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta-accessor.d.ts","sourceRoot":"","sources":["../../../../src/entity-definition/meta-entities/meta-accessor/meta-accessor.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEnD;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,0IAYpB,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,IAAI,KAI7D,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,MAAM,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,6BAA8B,CAAC;AACpE,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhF,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAA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AC,EAAE,eAAe,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;gBAM7B,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,IAAI,EAAE,gBAAgB,EACtB,OAAO,CAAC,EAAE,mBAAmB;CAuChC"}
|
|
@@ -27,6 +27,16 @@
|
|
|
27
27
|
'id',
|
|
28
28
|
'embedded'
|
|
29
29
|
];
|
|
30
|
+
/**
|
|
31
|
+
* The tone an enum value reads in as a status. Words always go beside it — a
|
|
32
|
+
* tone never carries a meaning alone.
|
|
33
|
+
*/ export const EnumTones = [
|
|
34
|
+
'success',
|
|
35
|
+
'warning',
|
|
36
|
+
'danger',
|
|
37
|
+
'info',
|
|
38
|
+
'neutral'
|
|
39
|
+
];
|
|
30
40
|
export class MetaAccessor {
|
|
31
41
|
//#endregion
|
|
32
42
|
//#region Constructors
|
|
@@ -45,6 +55,7 @@ export class MetaAccessor {
|
|
|
45
55
|
this.order = options == null ? void 0 : options.order;
|
|
46
56
|
this.enumValues = options == null ? void 0 : options.enumValues;
|
|
47
57
|
this.enumLabelKey = options == null ? void 0 : options.enumLabelKey;
|
|
58
|
+
this.enumTones = options == null ? void 0 : options.enumTones;
|
|
48
59
|
this.linkLabelProperty = options == null ? void 0 : options.linkLabelProperty;
|
|
49
60
|
this.linkSearchProperty = options == null ? void 0 : options.linkSearchProperty;
|
|
50
61
|
this.linkSerialization = options == null ? void 0 : options.linkSerialization;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/entity-definition/meta-entities/meta-accessor/meta-accessor.ts"],"sourcesContent":["export type MetaAccessorKind = 'getter' | 'setter';\n\n/**\n * The kinds of value an accessor can hold, as far as generic UI and adapters\n * care. It is deliberately a presentation/behaviour taxonomy rather than a\n * TypeScript mirror: `id` and `enum` are strings at runtime but are rendered,\n * sorted and filtered differently.\n *\n * `localized` holds a text per locale (`LocalizedText`). It is queried only\n * through one locale at a time — `name.en` — never as the whole object.\n */\nexport const MetaAccessorTypes = [\n 'string',\n 'number',\n 'boolean',\n 'date',\n 'enum',\n 'id',\n 'link',\n 'linkCollection',\n 'composition',\n 'scalarCollection',\n 'localized',\n] as const;\nexport type MetaAccessorType = (typeof MetaAccessorTypes)[number];\n\n/**\n * The class whose accessors describe one row of a `composition` member.\n *\n * Deliberately not `EntityConstructor`: a child of a composition is a **value**,\n * not an entity. It has no identity of its own, is never addressed apart from\n * the master that holds it, and therefore has no `id` for `Entity` to require.\n * What it does have is `@accessor()` metadata, which is written to its own\n * class's `Symbol.metadata` bag independently of `@entity()` — so a child is\n * described by its accessors and by nothing else.\n *\n * ⚠️ It is a **shape declaration, not a runtime constructor contract.** Children\n * arrive off the wire as plain objects — the serializer walks `instanceof\n * EntityLink`, not the declared type, so an embedded array passes straight\n * through — and an autosaved draft may hold nothing that does not survive a\n * JSON round trip anyway. Nothing may branch on `instanceof` against this constructor.\n */\nexport type ChildConstructor<TChild extends object = object> = new (\n // Mirrors `EntityConstructor`: the arguments are the child's business, only\n // the class identity matters here.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...args: any[]\n) => TChild;\n\n/**\n * The wire shape a relation takes: the target's foreign key, or the whole\n * target inlined. Declared here rather than next to `EntityLink` because it is\n * metadata about a member, not state of a link instance.\n */\nexport const EntityLinkSerializations = ['id', 'embedded'] as const;\nexport type EntityLinkSerialization = (typeof EntityLinkSerializations)[number];\n\nexport interface MetaAccessorOptions {\n alias?: string;\n type?: MetaAccessorType;\n readonly?: boolean;\n hidden?: boolean;\n /** Member must hold a value. Drives form validation; defaults to optional. */\n required?: boolean;\n /** Human label for UI. Falls back to a humanized `name`. */\n label?: string;\n /**\n * Translation key for the label, resolved by the presentation layer. Takes\n * precedence over `label`, which stays as the untranslated fallback for a\n * member that has no catalog entry yet.\n *\n * Keys mirror the entity's own `@entity({ key })`, so they are derivable\n * rather than invented: `entity:product-specification.fields.code`.\n */\n labelKey?: string;\n /** Opt in/out of sorting controls. Defaults per `type`. */\n sortable?: boolean;\n /** Opt in/out of filtering controls. Defaults per `type`. */\n filterable?: boolean;\n /** Default position among the entity's members; ties keep declaration order. */\n order?: number;\n /** Allowed values when `type` is `enum` — drives the filter value control. */\n enumValues?: readonly string[];\n /**\n * Catalog prefix for those values; a value's label is `${enumLabelKey}.${value}`.\n * Explicit rather than derived from `labelKey`, so a member whose values are\n * shared with another member can point both at one vocabulary.\n */\n enumLabelKey?: string;\n /** Property of a `link` target used as its display label. Default `name`. */\n linkLabelProperty?: string;\n /**\n * Property of a `link` target a picker searches on. Defaults to\n * {@link linkLabelProperty} — you search for what you read. It must be\n * `filterable` on the target entity, since member metadata is also the\n * server-side filter allowlist.\n */\n linkSearchProperty?: string;\n /**\n * How a `link` travels when its owner is serialized: as the target's scalar\n * foreign key (`id`, the default) or with the whole target inlined\n * (`embedded`). The serializer decides per *link instance* — it inlines\n * whatever `isLoaded` — so without this the shape a write takes would depend\n * on whether the form happened to hold the target. Declaring it on the entity\n * makes the wire shape a property of the relation instead of an accident of\n * the UI.\n */\n linkSerialization?: EntityLinkSerialization;\n /**\n * The class describing one row of a `composition` member — the child's own\n * `@accessor()` metadata is what a detail grid renders its columns from.\n *\n * A **thunk**, because a child module and the entity that owns it are usually\n * declared in the same package and a direct reference makes the decorator's\n * evaluation order load-bearing. Deferring the read to first use removes the\n * ordering question entirely, which is the same reason a to-one relation's\n * target is reached through a resolver rather than an import.\n *\n * Meaningless on any other type. There is no inference fallback: an empty\n * array cannot be told apart from an empty `string[]` at runtime, so a\n * collection must be declared.\n */\n childType?: () => ChildConstructor;\n /**\n * Reset this member when the record is copied.\n *\n * It lives on the **accessor**, not on a use case's descriptor, and that is a\n * decision already made: `UseCaseDescriptor` is closed against per-verb\n * payloads, and this is the exact case, because a descriptor that\n * grows a field per verb ends up a union of every verb's arguments. Which\n * members a copy must not carry is a property of the *member* — a unique\n * code, an audit stamp, a sequence number — and it is the same answer however\n * the copy is triggered.\n *\n * The identity member is always reset and needs no flag.\n */\n resetOnClone?: boolean;\n /**\n * The fewest values a collection member may hold — `1` for \"not empty\". Only\n * meaningful on a collection type (`scalarCollection`, `linkCollection`,\n * `composition`); declaring it elsewhere fails when the entity is described.\n *\n * Distinct from {@link required}: on a collection `required` already means\n * \"at least one\", and a `minItems` of two is a fact `required` cannot state.\n */\n minItems?: number;\n /** The most values a collection member may hold. Collection types only. */\n maxItems?: number;\n /**\n * Another `date` member this one may not precede — a period's `end` declares\n * `notBefore: 'start'`. Checked only when both hold a value. Both members must\n * be `date`s, or describing the entity fails.\n */\n notBefore?: string;\n /**\n * This member holds the id of the record's **parent**, another record of\n * the same entity — so the entity forms a tree. At most one member per\n * entity, and it must be an `id` or a `string`; describing the entity fails\n * otherwise.\n *\n * An id rather than a `link` on purpose. A tree is always built from the\n * whole set of its records ({@link buildTree}), never by resolving one parent\n * at a time, so a link's lazy resolution would be a fetch per node that\n * nothing needs. Absent means a root.\n */\n parent?: boolean;\n /**\n * This `id` or `string` member holds the id of a record of another entity,\n * named by the `domain:key` pair that entity's `@entity({ domain, key })`\n * declares — so the declaring package imports nothing of the target's. A\n * screen reads the target's name in its place through the host's\n * `ReferenceLabelsTag` registry, rather than showing the key.\n *\n * Not a `link` on purpose: the target may live in another store, and a\n * `link` invites the storage-layer join that would couple the two, while its\n * accessor would import the target's class across a domain boundary.\n * Presentation and resolution only — to validation, queries, serialization\n * and every adapter the member is still its id.\n */\n references?: MemberReference;\n /**\n * This `number` member is an amount of money, and how to read it: its\n * currency, fixed or held by another member of the same record, and whether\n * the number counts the currency's minor units (cents) or its major ones.\n * Presentation only — the member is still a number to validation, queries\n * and every adapter — so a table prints `Q64,99` rather than `6499`, and a\n * form edits the major amount and writes back the stored one.\n */\n money?: MoneyFormat;\n /**\n * The narrowest this member's column reads at, in `rem`. A table whose\n * visible columns no longer fit side by side becomes a list of cards, so the\n * sum of these is where it switches. Undeclared, the member's type decides.\n * Presentation only.\n */\n minWidth?: number;\n /**\n * The part this member plays on a record's card: its `title` — the heading\n * that links to the record — a `subtitle` under it, a `badge`, a line of\n * `meta`, or `hidden` from the card. Undeclared, the record's first\n * filled-in member is the title, an id is hidden, the first enum is the\n * badge and up to three more members are meta. Presentation only.\n */\n card?: CardRole;\n /**\n * What the member holds about the person filling it in, as an HTML autofill\n * token — `email`, `given-name`, `tel`, `street-address` — so a browser can\n * fill it and assistive tech can say what it is for (WCAG 1.3.5).\n * Presentation only.\n */\n autocomplete?: string;\n}\n\n/** The entity a reference member points at, as `domain:key`. */\nexport interface MemberReference {\n readonly entity: string;\n}\n\n/** The part a member plays on a record's card. */\nexport type CardRole = 'title' | 'subtitle' | 'badge' | 'meta' | 'hidden';\n\n/**\n * How a `number` member reads as money: `currency` fixed, or\n * `currencyMember` naming the record's own ISO 4217 code member; `unit`\n * whether the stored number counts minor units (`6499` for 64.99) or major.\n */\nexport type MoneyFormat = { readonly unit: 'minor' | 'major' } & (\n | { readonly currency: string; readonly currencyMember?: never }\n | { readonly currencyMember: string; readonly currency?: never }\n);\n\nexport class MetaAccessor {\n //#region Properties\n\n readonly name: string | symbol;\n readonly kind: MetaAccessorKind;\n readonly alias?: string;\n readonly type?: MetaAccessorType;\n readonly readonly?: boolean;\n readonly hidden?: boolean;\n readonly required?: boolean;\n readonly label?: string;\n readonly labelKey?: string;\n readonly sortable?: boolean;\n readonly filterable?: boolean;\n readonly order?: number;\n readonly enumValues?: readonly string[];\n readonly enumLabelKey?: string;\n readonly linkLabelProperty?: string;\n readonly linkSearchProperty?: string;\n readonly linkSerialization?: EntityLinkSerialization;\n readonly childType?: () => ChildConstructor;\n readonly resetOnClone?: boolean;\n readonly minItems?: number;\n readonly maxItems?: number;\n readonly notBefore?: string;\n readonly parent?: boolean;\n readonly references?: MemberReference;\n readonly money?: MoneyFormat;\n readonly minWidth?: number;\n readonly card?: CardRole;\n readonly autocomplete?: string;\n\n //#endregion\n\n //#region Constructors\n constructor(\n name: string | symbol,\n kind: MetaAccessorKind,\n options?: MetaAccessorOptions,\n ) {\n this.name = name;\n this.kind = kind;\n this.alias = options?.alias;\n this.type = options?.type;\n this.readonly = options?.readonly;\n this.hidden = options?.hidden;\n this.required = options?.required;\n this.label = options?.label;\n this.labelKey = options?.labelKey;\n this.sortable = options?.sortable;\n this.filterable = options?.filterable;\n this.order = options?.order;\n this.enumValues = options?.enumValues;\n this.enumLabelKey = options?.enumLabelKey;\n this.linkLabelProperty = options?.linkLabelProperty;\n this.linkSearchProperty = options?.linkSearchProperty;\n this.linkSerialization = options?.linkSerialization;\n this.childType = options?.childType;\n this.resetOnClone = options?.resetOnClone;\n this.minItems = options?.minItems;\n this.maxItems = options?.maxItems;\n this.notBefore = options?.notBefore;\n this.parent = options?.parent;\n this.references = options?.references;\n this.money = options?.money;\n this.minWidth = options?.minWidth;\n this.card = options?.card;\n this.autocomplete = options?.autocomplete;\n }\n //#endregion\n\n //#region Methods\n //#endregion\n\n //#region Accessors\n //#endregion\n}\n"],"names":["MetaAccessorTypes","EntityLinkSerializations","MetaAccessor","name","kind","options","alias","type","readonly","hidden","required","label","labelKey","sortable","filterable","order","enumValues","enumLabelKey","linkLabelProperty","linkSearchProperty","linkSerialization","childType","resetOnClone","minItems","maxItems","notBefore","parent","references","money","minWidth","card","autocomplete"],"mappings":"AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMA,oBAAoB;IAC/B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAU;AA0BX;;;;CAIC,GACD,OAAO,MAAMC,2BAA2B;IAAC;IAAM;CAAW,CAAU;AAiLpE,OAAO,MAAMC;IAgCX,YAAY;IAEZ,sBAAsB;IACtB,YACEC,IAAqB,EACrBC,IAAsB,EACtBC,OAA6B,CAC7B;QACA,IAAI,CAACF,IAAI,GAAGA;QACZ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CAACC,KAAK,GAAGvB,2BAAAA,QAASuB,KAAK;QAC3B,IAAI,CAACC,QAAQ,GAAGxB,2BAAAA,QAASwB,QAAQ;QACjC,IAAI,CAACC,IAAI,GAAGzB,2BAAAA,QAASyB,IAAI;QACzB,IAAI,CAACC,YAAY,GAAG1B,2BAAAA,QAAS0B,YAAY;IAC3C;AAQF"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/entity-definition/meta-entities/meta-accessor/meta-accessor.ts"],"sourcesContent":["export type MetaAccessorKind = 'getter' | 'setter';\n\n/**\n * The kinds of value an accessor can hold, as far as generic UI and adapters\n * care. It is deliberately a presentation/behaviour taxonomy rather than a\n * TypeScript mirror: `id` and `enum` are strings at runtime but are rendered,\n * sorted and filtered differently.\n *\n * `localized` holds a text per locale (`LocalizedText`). It is queried only\n * through one locale at a time — `name.en` — never as the whole object.\n */\nexport const MetaAccessorTypes = [\n 'string',\n 'number',\n 'boolean',\n 'date',\n 'enum',\n 'id',\n 'link',\n 'linkCollection',\n 'composition',\n 'scalarCollection',\n 'localized',\n] as const;\nexport type MetaAccessorType = (typeof MetaAccessorTypes)[number];\n\n/**\n * The class whose accessors describe one row of a `composition` member.\n *\n * Deliberately not `EntityConstructor`: a child of a composition is a **value**,\n * not an entity. It has no identity of its own, is never addressed apart from\n * the master that holds it, and therefore has no `id` for `Entity` to require.\n * What it does have is `@accessor()` metadata, which is written to its own\n * class's `Symbol.metadata` bag independently of `@entity()` — so a child is\n * described by its accessors and by nothing else.\n *\n * ⚠️ It is a **shape declaration, not a runtime constructor contract.** Children\n * arrive off the wire as plain objects — the serializer walks `instanceof\n * EntityLink`, not the declared type, so an embedded array passes straight\n * through — and an autosaved draft may hold nothing that does not survive a\n * JSON round trip anyway. Nothing may branch on `instanceof` against this constructor.\n */\nexport type ChildConstructor<TChild extends object = object> = new (\n // Mirrors `EntityConstructor`: the arguments are the child's business, only\n // the class identity matters here.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...args: any[]\n) => TChild;\n\n/**\n * The wire shape a relation takes: the target's foreign key, or the whole\n * target inlined. Declared here rather than next to `EntityLink` because it is\n * metadata about a member, not state of a link instance.\n */\nexport const EntityLinkSerializations = ['id', 'embedded'] as const;\nexport type EntityLinkSerialization = (typeof EntityLinkSerializations)[number];\n\nexport interface MetaAccessorOptions {\n alias?: string;\n type?: MetaAccessorType;\n readonly?: boolean;\n hidden?: boolean;\n /** Member must hold a value. Drives form validation; defaults to optional. */\n required?: boolean;\n /** Human label for UI. Falls back to a humanized `name`. */\n label?: string;\n /**\n * Translation key for the label, resolved by the presentation layer. Takes\n * precedence over `label`, which stays as the untranslated fallback for a\n * member that has no catalog entry yet.\n *\n * Keys mirror the entity's own `@entity({ key })`, so they are derivable\n * rather than invented: `entity:product-specification.fields.code`.\n */\n labelKey?: string;\n /** Opt in/out of sorting controls. Defaults per `type`. */\n sortable?: boolean;\n /** Opt in/out of filtering controls. Defaults per `type`. */\n filterable?: boolean;\n /** Default position among the entity's members; ties keep declaration order. */\n order?: number;\n /** Allowed values when `type` is `enum` — drives the filter value control. */\n enumValues?: readonly string[];\n /**\n * Catalog prefix for those values; a value's label is `${enumLabelKey}.${value}`.\n * Explicit rather than derived from `labelKey`, so a member whose values are\n * shared with another member can point both at one vocabulary.\n */\n enumLabelKey?: string;\n /**\n * The tone each value reads in where it is shown as a status: `success`,\n * `warning`, `danger`, `info` or `neutral`. Legal only on an `enum` member,\n * and every key must be one of its {@link enumValues}; a value left out reads\n * `neutral`. Declared, a screen shows the value as a tag in that tone beside\n * its words; undeclared, the value stays plain text — not every enum is a\n * status. Presentation only.\n */\n enumTones?: Readonly<Record<string, EnumTone>>;\n /** Property of a `link` target used as its display label. Default `name`. */\n linkLabelProperty?: string;\n /**\n * Property of a `link` target a picker searches on. Defaults to\n * {@link linkLabelProperty} — you search for what you read. It must be\n * `filterable` on the target entity, since member metadata is also the\n * server-side filter allowlist.\n */\n linkSearchProperty?: string;\n /**\n * How a `link` travels when its owner is serialized: as the target's scalar\n * foreign key (`id`, the default) or with the whole target inlined\n * (`embedded`). The serializer decides per *link instance* — it inlines\n * whatever `isLoaded` — so without this the shape a write takes would depend\n * on whether the form happened to hold the target. Declaring it on the entity\n * makes the wire shape a property of the relation instead of an accident of\n * the UI.\n */\n linkSerialization?: EntityLinkSerialization;\n /**\n * The class describing one row of a `composition` member — the child's own\n * `@accessor()` metadata is what a detail grid renders its columns from.\n *\n * A **thunk**, because a child module and the entity that owns it are usually\n * declared in the same package and a direct reference makes the decorator's\n * evaluation order load-bearing. Deferring the read to first use removes the\n * ordering question entirely, which is the same reason a to-one relation's\n * target is reached through a resolver rather than an import.\n *\n * Meaningless on any other type. There is no inference fallback: an empty\n * array cannot be told apart from an empty `string[]` at runtime, so a\n * collection must be declared.\n */\n childType?: () => ChildConstructor;\n /**\n * Reset this member when the record is copied.\n *\n * It lives on the **accessor**, not on a use case's descriptor, and that is a\n * decision already made: `UseCaseDescriptor` is closed against per-verb\n * payloads, and this is the exact case, because a descriptor that\n * grows a field per verb ends up a union of every verb's arguments. Which\n * members a copy must not carry is a property of the *member* — a unique\n * code, an audit stamp, a sequence number — and it is the same answer however\n * the copy is triggered.\n *\n * The identity member is always reset and needs no flag.\n */\n resetOnClone?: boolean;\n /**\n * The fewest values a collection member may hold — `1` for \"not empty\". Only\n * meaningful on a collection type (`scalarCollection`, `linkCollection`,\n * `composition`); declaring it elsewhere fails when the entity is described.\n *\n * Distinct from {@link required}: on a collection `required` already means\n * \"at least one\", and a `minItems` of two is a fact `required` cannot state.\n */\n minItems?: number;\n /** The most values a collection member may hold. Collection types only. */\n maxItems?: number;\n /**\n * Another `date` member this one may not precede — a period's `end` declares\n * `notBefore: 'start'`. Checked only when both hold a value. Both members must\n * be `date`s, or describing the entity fails.\n */\n notBefore?: string;\n /**\n * This member holds the id of the record's **parent**, another record of\n * the same entity — so the entity forms a tree. At most one member per\n * entity, and it must be an `id` or a `string`; describing the entity fails\n * otherwise.\n *\n * An id rather than a `link` on purpose. A tree is always built from the\n * whole set of its records ({@link buildTree}), never by resolving one parent\n * at a time, so a link's lazy resolution would be a fetch per node that\n * nothing needs. Absent means a root.\n */\n parent?: boolean;\n /**\n * This `id` or `string` member holds the id of a record of another entity,\n * named by the `domain:key` pair that entity's `@entity({ domain, key })`\n * declares — so the declaring package imports nothing of the target's. A\n * screen reads the target's name in its place through the host's\n * `ReferenceLabelsTag` registry, rather than showing the key.\n *\n * Not a `link` on purpose: the target may live in another store, and a\n * `link` invites the storage-layer join that would couple the two, while its\n * accessor would import the target's class across a domain boundary.\n * Presentation and resolution only — to validation, queries, serialization\n * and every adapter the member is still its id.\n */\n references?: MemberReference;\n /**\n * This `number` member is an amount of money, and how to read it: its\n * currency, fixed or held by another member of the same record, and whether\n * the number counts the currency's minor units (cents) or its major ones.\n * Presentation only — the member is still a number to validation, queries\n * and every adapter — so a table prints `Q64,99` rather than `6499`, and a\n * form edits the major amount and writes back the stored one.\n */\n money?: MoneyFormat;\n /**\n * The narrowest this member's column reads at, in `rem`. A table whose\n * visible columns no longer fit side by side becomes a list of cards, so the\n * sum of these is where it switches. Undeclared, the member's type decides.\n * Presentation only.\n */\n minWidth?: number;\n /**\n * The part this member plays on a record's card: its `title` — the heading\n * that links to the record — a `subtitle` under it, a `badge`, a line of\n * `meta`, or `hidden` from the card. Undeclared, the record's first\n * filled-in member is the title, an id is hidden, the first enum is the\n * badge and up to three more members are meta. Presentation only.\n */\n card?: CardRole;\n /**\n * What the member holds about the person filling it in, as an HTML autofill\n * token — `email`, `given-name`, `tel`, `street-address` — so a browser can\n * fill it and assistive tech can say what it is for (WCAG 1.3.5).\n * Presentation only.\n */\n autocomplete?: string;\n}\n\n/**\n * The tone an enum value reads in as a status. Words always go beside it — a\n * tone never carries a meaning alone.\n */\nexport const EnumTones = [\n 'success',\n 'warning',\n 'danger',\n 'info',\n 'neutral',\n] as const;\nexport type EnumTone = (typeof EnumTones)[number];\n\n/** The entity a reference member points at, as `domain:key`. */\nexport interface MemberReference {\n readonly entity: string;\n}\n\n/** The part a member plays on a record's card. */\nexport type CardRole = 'title' | 'subtitle' | 'badge' | 'meta' | 'hidden';\n\n/**\n * How a `number` member reads as money: `currency` fixed, or\n * `currencyMember` naming the record's own ISO 4217 code member; `unit`\n * whether the stored number counts minor units (`6499` for 64.99) or major.\n */\nexport type MoneyFormat = { readonly unit: 'minor' | 'major' } & (\n | { readonly currency: string; readonly currencyMember?: never }\n | { readonly currencyMember: string; readonly currency?: never }\n);\n\nexport class MetaAccessor {\n //#region Properties\n\n readonly name: string | symbol;\n readonly kind: MetaAccessorKind;\n readonly alias?: string;\n readonly type?: MetaAccessorType;\n readonly readonly?: boolean;\n readonly hidden?: boolean;\n readonly required?: boolean;\n readonly label?: string;\n readonly labelKey?: string;\n readonly sortable?: boolean;\n readonly filterable?: boolean;\n readonly order?: number;\n readonly enumValues?: readonly string[];\n readonly enumLabelKey?: string;\n readonly enumTones?: Readonly<Record<string, EnumTone>>;\n readonly linkLabelProperty?: string;\n readonly linkSearchProperty?: string;\n readonly linkSerialization?: EntityLinkSerialization;\n readonly childType?: () => ChildConstructor;\n readonly resetOnClone?: boolean;\n readonly minItems?: number;\n readonly maxItems?: number;\n readonly notBefore?: string;\n readonly parent?: boolean;\n readonly references?: MemberReference;\n readonly money?: MoneyFormat;\n readonly minWidth?: number;\n readonly card?: CardRole;\n readonly autocomplete?: string;\n\n //#endregion\n\n //#region Constructors\n constructor(\n name: string | symbol,\n kind: MetaAccessorKind,\n options?: MetaAccessorOptions,\n ) {\n this.name = name;\n this.kind = kind;\n this.alias = options?.alias;\n this.type = options?.type;\n this.readonly = options?.readonly;\n this.hidden = options?.hidden;\n this.required = options?.required;\n this.label = options?.label;\n this.labelKey = options?.labelKey;\n this.sortable = options?.sortable;\n this.filterable = options?.filterable;\n this.order = options?.order;\n this.enumValues = options?.enumValues;\n this.enumLabelKey = options?.enumLabelKey;\n this.enumTones = options?.enumTones;\n this.linkLabelProperty = options?.linkLabelProperty;\n this.linkSearchProperty = options?.linkSearchProperty;\n this.linkSerialization = options?.linkSerialization;\n this.childType = options?.childType;\n this.resetOnClone = options?.resetOnClone;\n this.minItems = options?.minItems;\n this.maxItems = options?.maxItems;\n this.notBefore = options?.notBefore;\n this.parent = options?.parent;\n this.references = options?.references;\n this.money = options?.money;\n this.minWidth = options?.minWidth;\n this.card = options?.card;\n this.autocomplete = options?.autocomplete;\n }\n //#endregion\n\n //#region Methods\n //#endregion\n\n //#region Accessors\n //#endregion\n}\n"],"names":["MetaAccessorTypes","EntityLinkSerializations","EnumTones","MetaAccessor","name","kind","options","alias","type","readonly","hidden","required","label","labelKey","sortable","filterable","order","enumValues","enumLabelKey","enumTones","linkLabelProperty","linkSearchProperty","linkSerialization","childType","resetOnClone","minItems","maxItems","notBefore","parent","references","money","minWidth","card","autocomplete"],"mappings":"AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMA,oBAAoB;IAC/B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAU;AA0BX;;;;CAIC,GACD,OAAO,MAAMC,2BAA2B;IAAC;IAAM;CAAW,CAAU;AAwKpE;;;CAGC,GACD,OAAO,MAAMC,YAAY;IACvB;IACA;IACA;IACA;IACA;CACD,CAAU;AAqBX,OAAO,MAAMC;IAiCX,YAAY;IAEZ,sBAAsB;IACtB,YACEC,IAAqB,EACrBC,IAAsB,EACtBC,OAA6B,CAC7B;QACA,IAAI,CAACF,IAAI,GAAGA;QACZ,IAAI,CAACC,IAAI,GAAGA;QACZ,IAAI,CAACE,KAAK,GAAGD,2BAAAA,QAASC,KAAK;QAC3B,IAAI,CAACC,IAAI,GAAGF,2BAAAA,QAASE,IAAI;QACzB,IAAI,CAACC,QAAQ,GAAGH,2BAAAA,QAASG,QAAQ;QACjC,IAAI,CAACC,MAAM,GAAGJ,2BAAAA,QAASI,MAAM;QAC7B,IAAI,CAACC,QAAQ,GAAGL,2BAAAA,QAASK,QAAQ;QACjC,IAAI,CAACC,KAAK,GAAGN,2BAA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