@almadar/core 7.7.0 → 7.7.1

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/index.js CHANGED
@@ -1531,12 +1531,21 @@ function schemaToIR(schema, useCache = true) {
1531
1531
  featureName: page.name.toLowerCase(),
1532
1532
  viewType: page.viewType && ["list", "detail", "create", "edit", "dashboard"].includes(page.viewType) ? page.viewType : void 0,
1533
1533
  sections: [],
1534
- traits: (page.traits || []).map((traitRef) => ({
1535
- ref: traitRef.ref,
1536
- trait: resolveTraitRef(traitRef, ir.traits, orbital.traits || []),
1537
- linkedEntity: traitRef.linkedEntity ?? (orbital.entity ? typeof orbital.entity === "string" ? orbital.entity.replace(".entity", "") : orbital.entity.name : void 0),
1538
- config: traitRef.config
1539
- })),
1534
+ traits: (page.traits || []).map((traitRef) => {
1535
+ const resolvedTrait = resolveTraitRef(traitRef, ir.traits, orbital.traits || []);
1536
+ const orbitalTrait = (orbital.traits || []).find(
1537
+ (t) => typeof t === "object" && t !== null && ("name" in t && t.name === traitRef.ref || "ref" in t && t.ref === traitRef.ref)
1538
+ );
1539
+ const orbitalTraitWrapped = orbitalTrait;
1540
+ const wrapperLinked = orbitalTraitWrapped?.linkedEntity ?? orbitalTraitWrapped?._resolved?.linkedEntity;
1541
+ const resolvedLinked = resolvedTrait?.linkedEntity;
1542
+ return {
1543
+ ref: traitRef.ref,
1544
+ trait: resolvedTrait,
1545
+ linkedEntity: traitRef.linkedEntity ?? wrapperLinked ?? resolvedLinked ?? (orbital.entity ? typeof orbital.entity === "string" ? orbital.entity.replace(".entity", "") : orbital.entity.name : void 0),
1546
+ config: traitRef.config
1547
+ };
1548
+ }),
1540
1549
  entityBindings: [],
1541
1550
  navigation: [],
1542
1551
  singletonEntities: []