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