@almadar/core 7.23.0 → 7.25.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 { a6 as EntityField, a9 as EntityPersistence, cX as TraitReference, c$ as TraitScope, a2 as Entity, br as Page, bh as OrbitalSchema, cE as Trait } from '../schema-BVni4uNf.js';
|
|
1
|
+
import { a6 as EntityField, a9 as EntityPersistence, cX as TraitReference, c$ as TraitScope, cS as TraitEventListener, a2 as Entity, br as Page, bh as OrbitalSchema, cE as Trait } from '../schema-BVni4uNf.js';
|
|
2
2
|
import { S as SExpr } from '../expression-BVRFm0sV.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '@almadar/patterns';
|
|
@@ -114,6 +114,14 @@ interface DomainEntity extends ASTNode {
|
|
|
114
114
|
* the entity section.
|
|
115
115
|
*/
|
|
116
116
|
persistence?: EntityPersistence;
|
|
117
|
+
/**
|
|
118
|
+
* Storage collection key. Mirrors `OrbitalSchema.entities[i].collection`.
|
|
119
|
+
* Omitted ⇒ defaults to `plural(name).toLowerCase()`. Surfaced to the
|
|
120
|
+
* factory translator so the LLM can override the storage key without
|
|
121
|
+
* touching the entity name (e.g. entity `Product` → collection
|
|
122
|
+
* `"catalog"`).
|
|
123
|
+
*/
|
|
124
|
+
collection?: string;
|
|
117
125
|
}
|
|
118
126
|
interface DomainPageSection extends ASTNode {
|
|
119
127
|
type: 'page_section';
|
|
@@ -361,6 +369,10 @@ interface FactoryCallSiteParams {
|
|
|
361
369
|
entityFields?: ReadonlyArray<EntityField>;
|
|
362
370
|
/** Override `signature.entities[0].persistence`. */
|
|
363
371
|
persistence?: EntityPersistence;
|
|
372
|
+
/** Override the entity's storage collection key. Defaults to
|
|
373
|
+
* `plural(entityName).toLowerCase()` at factory dispatch time
|
|
374
|
+
* when omitted. */
|
|
375
|
+
collection?: string;
|
|
364
376
|
/** Per-page path overrides keyed by `signature.pages[i].name`. */
|
|
365
377
|
pagePaths?: Readonly<Record<string, string>>;
|
|
366
378
|
/** Trait config overrides keyed by `signature.traits[i].name`. Each
|
|
@@ -487,15 +499,15 @@ interface TraitOverlayEntry {
|
|
|
487
499
|
events?: Readonly<Record<string, string>>;
|
|
488
500
|
name?: string;
|
|
489
501
|
emitsScope?: 'internal' | 'external';
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
source?: {
|
|
495
|
-
orbital?: string;
|
|
496
|
-
trait?: string;
|
|
497
|
-
};
|
|
502
|
+
/** Reuses `TraitEventListener` from `@almadar/core/types/trait` so the
|
|
503
|
+
* overlay's listen entries carry the same `event` / `triggers` /
|
|
504
|
+
* `source` / `guard` shape as everywhere else — no narrower clone. */
|
|
505
|
+
listens?: ReadonlyArray<TraitEventListener>;
|
|
498
506
|
}
|
|
507
|
+
/** @deprecated Phase 4.1 placeholder — use `TraitEventListener` instead.
|
|
508
|
+
* Kept as a structural type alias so callers that imported it keep
|
|
509
|
+
* compiling through the transition; will be removed in 7.25.0. */
|
|
510
|
+
type TraitOverlayListener = TraitEventListener;
|
|
499
511
|
/**
|
|
500
512
|
* Rules carry a free-form `capability: string` that the translator
|
|
501
513
|
* matches against `signature.traits[].capabilities` (source-tagged
|
|
@@ -6436,6 +6436,7 @@ function translateDomainToParams(binding, signature, presentation, ruleOverlay,
|
|
|
6436
6436
|
applyEntityName(binding.entity, signature, params);
|
|
6437
6437
|
applyEntityFields(binding.entity, signature, params, warnings);
|
|
6438
6438
|
applyPersistence(binding.entity, signature, params, warnings);
|
|
6439
|
+
applyCollection(binding.entity, params);
|
|
6439
6440
|
applyPagePaths(binding.pages ?? [], signature, params, warnings);
|
|
6440
6441
|
applyPresentation(presentation, signature, params, warnings);
|
|
6441
6442
|
applyTraitOverlay(traitOverlay, signature, params, warnings);
|
|
@@ -6486,6 +6487,10 @@ function applyPersistence(entity, signature, params, warnings) {
|
|
|
6486
6487
|
if (entity.persistence === signature.entities[0].persistence) return;
|
|
6487
6488
|
params.persistence = entity.persistence;
|
|
6488
6489
|
}
|
|
6490
|
+
function applyCollection(entity, params) {
|
|
6491
|
+
if (!entity.collection) return;
|
|
6492
|
+
params.collection = entity.collection;
|
|
6493
|
+
}
|
|
6489
6494
|
function applyPagePaths(pages, signature, params, warnings) {
|
|
6490
6495
|
if (pages.length === 0) return;
|
|
6491
6496
|
const sigPages = new Map(signature.pages.map((p) => [p.name, p]));
|