@almadar/core 10.86.0 → 10.87.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.
Files changed (41) hide show
  1. package/dist/builders.d.ts +5 -4
  2. package/dist/builders.js +68 -29
  3. package/dist/builders.js.map +1 -1
  4. package/dist/{effect-BgDiw_bG.d.ts → effect-DMA97JxX.d.ts} +22 -6
  5. package/dist/{entityAccess-DK5S_2cT.d.ts → entityAccess-DNDEF75i.d.ts} +2 -2
  6. package/dist/{expression-Fk8bQWef.d.ts → expression-WfTp2arD.d.ts} +2 -65
  7. package/dist/factory/index.d.ts +6 -5
  8. package/dist/factory/index.js +1194 -401
  9. package/dist/factory/index.js.map +1 -1
  10. package/dist/factory-runtime/index.d.ts +35 -5
  11. package/dist/factory-runtime/index.js +127 -52
  12. package/dist/factory-runtime/index.js.map +1 -1
  13. package/dist/i18n/index.d.ts +111 -1
  14. package/dist/i18n/index.js +500 -19
  15. package/dist/i18n/index.js.map +1 -1
  16. package/dist/{index-ChYsqVJj.d.ts → index-xZP_Ajx3.d.ts} +18 -5
  17. package/dist/index.d.ts +82 -14
  18. package/dist/index.js +1876 -333
  19. package/dist/index.js.map +1 -1
  20. package/dist/json-D8gmyK3l.d.ts +65 -0
  21. package/dist/mock/index.d.ts +129 -12
  22. package/dist/mock/index.js +192 -61
  23. package/dist/mock/index.js.map +1 -1
  24. package/dist/patterns/component-mapping.json +1 -1
  25. package/dist/patterns/event-contracts.json +1 -1
  26. package/dist/patterns/index.d.ts +2525 -609
  27. package/dist/patterns/index.js +1238 -384
  28. package/dist/patterns/index.js.map +1 -1
  29. package/dist/patterns/integrators-registry.json +107 -23
  30. package/dist/patterns/patterns-registry.json +1170 -400
  31. package/dist/patterns/registry.json +1170 -400
  32. package/dist/patterns/services-registry.json +170 -35
  33. package/dist/{schema-BhfQb1oe.d.ts → schema-_SPrm5Ic.d.ts} +46381 -21335
  34. package/dist/state-machine/index.d.ts +2 -1
  35. package/dist/trait-9tfq2tQb.d.ts +10554 -0
  36. package/dist/types/index.d.ts +7 -6
  37. package/dist/types/index.js +132 -43
  38. package/dist/types/index.js.map +1 -1
  39. package/dist/{types-CCAmdxcH.d.ts → types-CjRjhiaO.d.ts} +19 -3
  40. package/package.json +2 -2
  41. package/dist/trait-pavNlGqm.d.ts +0 -5385
@@ -1,8 +1,9 @@
1
- import { I as IdentityLedger, A as AnyPatternConfig, U as UISlot, c as Effect, h as RenderBinding, i as RenderUIEffect, d as EntityId, e as Entity, E as EntityField, a as EntityPersistence, f as EntityRow } from './effect-BgDiw_bG.js';
2
- import { a as OrbitalDefinition, O as OrbitalSchema, U as UseDeclaration, E as EntityRef, b as ExpectDeclaration, P as PageRef, c as Page, d as PageRefObject } from './schema-BhfQb1oe.js';
3
- import { b as TraitConfig, h as Trait, T as TraitEventListener, i as CallSiteConfig, k as TraitEventContract, d as TraitRef, a as TraitReference } from './trait-pavNlGqm.js';
4
- import { S as SExpr } from './expression-Fk8bQWef.js';
1
+ import { I as IdentityLedger, A as AnyPatternConfig, U as UISlot, c as Effect, i as RenderBinding, j as RenderUIEffect, d as EntityId, e as Entity, E as EntityField, a as EntityPersistence, g as EntityRow } from './effect-DMA97JxX.js';
2
+ import { a as OrbitalDefinition, O as OrbitalSchema, U as UseDeclaration, E as EntityRef, b as ExpectDeclaration, P as PageRef, c as Page, d as PageRefObject } from './schema-_SPrm5Ic.js';
3
+ import { b as TraitConfig, h as Trait, T as TraitEventListener, i as CallSiteConfig, k as TraitEventContract, d as TraitRef, a as TraitReference } from './trait-9tfq2tQb.js';
4
+ import { S as SExpr } from './expression-WfTp2arD.js';
5
5
  import 'zod';
6
+ import './json-D8gmyK3l.js';
6
7
 
7
8
  /**
8
9
  * Event Wiring
package/dist/builders.js CHANGED
@@ -419,6 +419,9 @@ var EntityPersistenceSchema = z.enum([
419
419
  ]);
420
420
  var OrbitalEntitySchema = z.object({
421
421
  name: z.string().min(1, "Entity name is required"),
422
+ // V4 arena id (`EntityDefinition.id`); declared so the strip-mode zod gate
423
+ // carries an imported entity's id through instead of erasing it.
424
+ id: EntityIdSchema.optional(),
422
425
  persistence: EntityPersistenceSchema.default("persistent"),
423
426
  shared: z.boolean().optional(),
424
427
  // Must stay in step with the Rust serde field (`EntityDefinition.identity`,
@@ -507,7 +510,8 @@ var PayloadFieldSchema = z.object({
507
510
  type: z.string().min(1),
508
511
  required: z.boolean().optional(),
509
512
  properties: z.lazy(() => z.array(PayloadFieldSchema)).optional(),
510
- typeWhen: z.array(PayloadTypeWhenSchema).optional()
513
+ typeWhen: z.array(PayloadTypeWhenSchema).optional(),
514
+ entity: z.string().min(1).optional()
511
515
  });
512
516
  var EventSchema = z.object({
513
517
  key: z.string().min(1, "Event key is required"),
@@ -575,7 +579,8 @@ var ConfigFieldDeclarationSchema = z.object({
575
579
  values: z.array(z.string()).optional(),
576
580
  synonyms: z.string().optional(),
577
581
  items: ConfigFieldItemsDeclarationSchema.optional(),
578
- properties: z.lazy(() => z.record(TraitEntityFieldSchema)).optional()
582
+ properties: z.lazy(() => z.record(TraitEntityFieldSchema)).optional(),
583
+ forwardedFrom: z.string().optional()
579
584
  });
580
585
  var DeclaredTraitConfigSchema = z.record(
581
586
  ConfigFieldDeclarationSchema
@@ -597,31 +602,32 @@ var TraitCategorySchema = z.enum([
597
602
  "game-board",
598
603
  "game-puzzle"
599
604
  ]);
605
+ var TRAIT_FIELD_TYPES = [
606
+ "string",
607
+ "number",
608
+ "boolean",
609
+ "date",
610
+ "array",
611
+ "object",
612
+ "timestamp",
613
+ "datetime",
614
+ "enum",
615
+ "email",
616
+ "url",
617
+ "phone",
618
+ "uuid",
619
+ "image",
620
+ "trait",
621
+ "slot",
622
+ "pattern",
623
+ "node",
624
+ "event",
625
+ "scalar",
626
+ "union"
627
+ ];
600
628
  var TraitEntityFieldSchema = z.object({
601
629
  name: z.string().min(1),
602
- type: z.enum([
603
- "string",
604
- "number",
605
- "boolean",
606
- "date",
607
- "array",
608
- "object",
609
- "timestamp",
610
- "datetime",
611
- "enum",
612
- "email",
613
- "url",
614
- "phone",
615
- "uuid",
616
- "image",
617
- "trait",
618
- "slot",
619
- "pattern",
620
- // `node` was missing here while being a real `TraitFieldType` member
621
- // — the same latent-drift trap `event` would otherwise repeat.
622
- "node",
623
- "event"
624
- ]),
630
+ type: z.enum(TRAIT_FIELD_TYPES),
625
631
  required: z.boolean().optional(),
626
632
  default: TraitConfigValueSchema.optional(),
627
633
  values: z.array(z.string()).optional(),
@@ -676,7 +682,7 @@ var EventPayloadFieldSchema = z.object({
676
682
  type: z.string().min(1),
677
683
  required: z.boolean().optional(),
678
684
  description: z.string().optional(),
679
- entityType: z.string().optional(),
685
+ entity: z.string().optional(),
680
686
  properties: z.lazy(() => z.array(EventPayloadFieldSchema)).optional(),
681
687
  typeWhen: z.array(PayloadTypeWhenSchema).optional()
682
688
  });
@@ -733,8 +739,7 @@ var TraitEventListenerSchema = z.object({
733
739
  });
734
740
  var RequiredFieldSchema = z.object({
735
741
  name: z.string().min(1),
736
- // `node` was missing here too (same drift as TraitEntityFieldSchema above).
737
- type: z.enum(["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum", "email", "url", "phone", "uuid", "image", "trait", "slot", "pattern", "node", "event"]),
742
+ type: z.enum(TRAIT_FIELD_TYPES),
738
743
  description: z.string().optional()
739
744
  });
740
745
  var TraitReferenceSchema = z.object({
@@ -753,6 +758,7 @@ var TraitReferenceSchema = z.object({
753
758
  z.string().min(1, "events value (caller event name) must be non-empty")
754
759
  ).optional(),
755
760
  eventIds: z.record(z.string().min(1), EventIdSchema).optional(),
761
+ _resolved: z.lazy(() => TraitSchema).optional(),
756
762
  // 3-II type-parameter arguments (see `TraitReference.typeArgs`).
757
763
  typeArgs: z.record(
758
764
  z.string().min(1, "typeArgs key (declared param name) must be non-empty"),
@@ -1374,7 +1380,8 @@ var UseDeclarationSchema = z.object({
1374
1380
  as: z.string().min(1, "Alias is required").regex(
1375
1381
  /^[A-Z][a-zA-Z0-9]*$/,
1376
1382
  'Alias must be PascalCase (e.g., "Health", "GameCore")'
1377
- )
1383
+ ),
1384
+ config: DeclaredTraitConfigSchema.optional()
1378
1385
  });
1379
1386
  var ExpectDeclarationSchema = z.discriminatedUnion("kind", [
1380
1387
  z.object({
@@ -1457,6 +1464,25 @@ var PageRefSchema = z.union([
1457
1464
  PageRefStringSchema,
1458
1465
  PageRefObjectSchema
1459
1466
  ]);
1467
+ var OrbitalRefStringSchema = z.string().regex(
1468
+ /^[A-Z][a-zA-Z0-9]*\.orbitals\.[A-Z][a-zA-Z0-9]*$/,
1469
+ 'Orbital reference must be "Alias.orbitals.OrbitalName"'
1470
+ );
1471
+ var OrbitalRefObjectSchema = z.object({
1472
+ ref: OrbitalRefStringSchema,
1473
+ refId: OrbitalIdSchema.optional(),
1474
+ entity: z.string().optional(),
1475
+ fields: z.record(z.string()).optional(),
1476
+ pages: z.record(z.string()).optional(),
1477
+ omit: z.array(z.string()).optional(),
1478
+ only: z.array(z.string()).optional(),
1479
+ config: DeclaredTraitConfigSchema.optional(),
1480
+ events: z.record(z.string()).optional(),
1481
+ roles: z.record(z.string(), z.array(z.string())).optional(),
1482
+ entities: z.record(z.string(), z.string()).optional(),
1483
+ mounts: z.record(z.string(), z.array(z.string())).optional(),
1484
+ extend: z.array(EntityFieldSchema).optional()
1485
+ });
1460
1486
  z.string().regex(
1461
1487
  /^([A-Z][a-zA-Z0-9]*\.traits\.)?[A-Z][a-zA-Z0-9]*$/,
1462
1488
  'Trait reference must be "TraitName" or "Alias.traits.TraitName"'
@@ -1504,6 +1530,15 @@ z.object({
1504
1530
  services: z.array(ServiceRefSchema).optional(),
1505
1531
  // Components (inline or reference)
1506
1532
  entity: EntityRefSchema,
1533
+ // Mirrors the `OrbitalDefinition.auxiliaryEntities` type field — WAS
1534
+ // undeclared here, so `OrbitalSchemaSchema.safeParse` (every load through
1535
+ // `external-loader.ts`) silently stripped it on every externally-loaded
1536
+ // orbital (zod drops unrecognized keys by default), while a schema parsed
1537
+ // directly via `JSON.parse` kept it. Found via the entity-field auto-merge
1538
+ // rebind-target fallback landing on the wrong entity for any RECURSIVELY
1539
+ // loaded `uses` file (`packages/almadar-runtime/src/resolver/
1540
+ // reference-resolver.ts`'s `mergeImportedEntityFieldsIntoOrbital`).
1541
+ auxiliaryEntities: z.array(EntityRefSchema).optional(),
1507
1542
  traits: z.array(TraitRefSchema),
1508
1543
  pages: z.array(PageRefSchema),
1509
1544
  // Event interface (trait-centric model) - computed by resolver
@@ -1511,6 +1546,10 @@ z.object({
1511
1546
  listens: z.array(ComputedEventListenerSchema).optional(),
1512
1547
  // Filter for exposed events (trait-centric model)
1513
1548
  exposes: z.array(z.string()).optional(),
1549
+ // This orbital's own declared knobs (§4.5)
1550
+ config: DeclaredTraitConfigSchema.optional(),
1551
+ // Transient — set by lowering, cleared by inline/resolve
1552
+ reference: OrbitalRefObjectSchema.optional(),
1514
1553
  // Context fields - persisted throughout orbital lifecycle
1515
1554
  domainContext: DomainContextSchema.optional(),
1516
1555
  design: DesignPreferencesSchema.optional(),