@almadar/core 2.14.3 → 3.0.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.
@@ -1,4 +1,4 @@
1
- import { O as OrbitalDefinition, c as OrbitalSchema } from './schema-BFnZrBhm.js';
1
+ import { O as OrbitalDefinition, c as OrbitalSchema } from './schema-COvHzxfu.js';
2
2
 
3
3
  /**
4
4
  * Event Wiring
@@ -1,4 +1,4 @@
1
- import { bE as SExpr, e as Entity, P as Page, c as OrbitalSchema, d as Trait } from '../schema-BFnZrBhm.js';
1
+ import { bG as SExpr, e as Entity, P as Page, c as OrbitalSchema, d as Trait } from '../schema-COvHzxfu.js';
2
2
  import 'zod';
3
3
  import '@almadar/patterns';
4
4
 
@@ -3680,6 +3680,8 @@ var RequiredFieldSchema = z.object({
3680
3680
  z.object({
3681
3681
  ref: z.string().min(1),
3682
3682
  linkedEntity: z.string().optional(),
3683
+ name: z.string().optional(),
3684
+ events: z.record(z.string(), z.string()).optional(),
3683
3685
  config: z.record(z.record(z.unknown())).optional(),
3684
3686
  appliesTo: z.array(z.string()).optional()
3685
3687
  });
@@ -3703,7 +3705,9 @@ var TraitRefSchema = z.union([
3703
3705
  z.object({
3704
3706
  ref: z.string().min(1),
3705
3707
  config: z.record(z.unknown()).optional(),
3706
- linkedEntity: z.string().optional()
3708
+ linkedEntity: z.string().optional(),
3709
+ name: z.string().optional(),
3710
+ events: z.record(z.string(), z.string()).optional()
3707
3711
  }),
3708
3712
  TraitSchema
3709
3713
  // Allow inline trait definitions
@@ -3962,11 +3966,28 @@ var UseDeclarationSchema = z.object({
3962
3966
  function isEntityReference(entity) {
3963
3967
  return typeof entity === "string";
3964
3968
  }
3969
+ function isEntityCall(entity) {
3970
+ return typeof entity === "object" && entity !== null && "extends" in entity;
3971
+ }
3965
3972
  var EntityRefStringSchema = z.string().regex(
3966
3973
  /^[A-Z][a-zA-Z0-9]*\.entity$/,
3967
3974
  'Entity reference must be in format "Alias.entity" (e.g., "Goblin.entity")'
3968
3975
  );
3969
- var EntityRefSchema = z.union([EntitySchema, EntityRefStringSchema]);
3976
+ var EntityCallSchema = z.object({
3977
+ extends: z.string().regex(
3978
+ /^[A-Z][a-zA-Z0-9]*\.entity$/,
3979
+ 'EntityCall "extends" must be in format "Alias.entity"'
3980
+ ),
3981
+ name: z.string().optional(),
3982
+ fields: z.array(EntityFieldSchema).optional(),
3983
+ persistence: EntityPersistenceSchema.optional(),
3984
+ collection: z.string().optional()
3985
+ });
3986
+ var EntityRefSchema = z.union([
3987
+ EntitySchema,
3988
+ EntityRefStringSchema,
3989
+ EntityCallSchema
3990
+ ]);
3970
3991
  function isPageReferenceString(page) {
3971
3992
  return typeof page === "string";
3972
3993
  }
@@ -3979,7 +4000,9 @@ var PageRefStringSchema = z.string().regex(
3979
4000
  );
3980
4001
  var PageRefObjectSchema = z.object({
3981
4002
  ref: PageRefStringSchema,
3982
- path: z.string().startsWith("/").optional()
4003
+ path: z.string().startsWith("/").optional(),
4004
+ linkedEntity: z.string().optional(),
4005
+ traits: z.array(TraitRefSchema).optional()
3983
4006
  });
3984
4007
  var PageRefSchema = z.union([
3985
4008
  PageSchema,
@@ -5258,10 +5281,13 @@ function getEntityName(entity) {
5258
5281
  if (isEntityReference(entity)) {
5259
5282
  return entity.replace(".entity", "");
5260
5283
  }
5284
+ if (isEntityCall(entity)) {
5285
+ return entity.name ?? entity.extends.replace(".entity", "");
5286
+ }
5261
5287
  return entity.name;
5262
5288
  }
5263
5289
  function isInlineEntity(entity) {
5264
- return !isEntityReference(entity);
5290
+ return !isEntityReference(entity) && !isEntityCall(entity);
5265
5291
  }
5266
5292
  function isInlinePage(page) {
5267
5293
  return !isPageReferenceString(page) && !isPageReferenceObject(page);
@@ -5556,6 +5582,9 @@ function getEntityName2(entity) {
5556
5582
  if (isEntityReference(entity)) {
5557
5583
  return entity.replace(".entity", "");
5558
5584
  }
5585
+ if (isEntityCall(entity)) {
5586
+ return entity.name ?? entity.extends.replace(".entity", "");
5587
+ }
5559
5588
  return entity.name;
5560
5589
  }
5561
5590
  function getPageName(page) {