@almadar/core 9.1.1 → 9.3.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,7 +1,7 @@
1
- import { bR as UISlot, u as Effect, bm as Trait, aH as RenderUIEffect, by as TraitEventContract, z as Entity, bA as TraitEventListener, bp as TraitConfig, F as EntityField, K as EntityPersistence, O as EntityRow, bD as TraitRef, bF as TraitReference } from './trait-DvvM-71c.js';
2
- import { bC as UseDeclaration, Q as EntityRef, aT as PageRef, aD as OrbitalDefinition, aL as OrbitalSchema, aS as Page, aU as PageRefObject } from './schema-B6gRJD4J.js';
1
+ import { bR as UISlot, u as Effect, bm as Trait, aH as RenderUIEffect, by as TraitEventContract, z as Entity, bA as TraitEventListener, bp as TraitConfig, F as EntityField, K as EntityPersistence, O as EntityRow, bD as TraitRef, bF as TraitReference } from './trait-DmoY7UHh.js';
2
+ import { bC as UseDeclaration, Q as EntityRef, aT as PageRef, aD as OrbitalDefinition, aL as OrbitalSchema, aS as Page, aU as PageRefObject } from './schema-BdATnYqq.js';
3
3
  import { S as SExpr } from './expression-BVRFm0sV.js';
4
- export { C as ComposeBehaviorsInput, a as ComposeBehaviorsResult, E as EventWiringEntry, L as LayoutStrategy, b as applyEventWiring, c as composeBehaviors, d as detectLayoutStrategy } from './compose-behaviors-Bn9WPGfr.js';
4
+ export { C as ComposeBehaviorsInput, a as ComposeBehaviorsResult, E as EventWiringEntry, L as LayoutStrategy, b as applyEventWiring, c as composeBehaviors, d as detectLayoutStrategy } from './compose-behaviors-BuJL_Mv8.js';
5
5
  import { AnyPatternConfig } from '@almadar/patterns';
6
6
  import 'zod';
7
7
 
@@ -204,6 +204,12 @@ interface MakeTraitRefOpts {
204
204
  linkedEntity?: string;
205
205
  /** Per-key rename map, e.g. `{ OPEN: "ADD_ITEM" }`. */
206
206
  events?: Record<string, string>;
207
+ /**
208
+ * Entity-field remap, e.g. `{ name: "title", folder: "parentId" }`. Rewrites
209
+ * the inlined trait's canonical `@entity.X` / `@payload.row.X` references to
210
+ * the consumer entity's field names. Mirrors {@link TraitReference.fields}.
211
+ */
212
+ fields?: Record<string, string>;
207
213
  /**
208
214
  * Per-event SExpression effect replacement. Keys are POST-rename event
209
215
  * names. See {@link TraitReference.effects} for the full contract.
package/dist/builders.js CHANGED
@@ -47,7 +47,10 @@ var FieldFormatSchema = z.enum([
47
47
  "phone",
48
48
  "date",
49
49
  "datetime",
50
- "uuid"
50
+ "uuid",
51
+ "image",
52
+ "avatar",
53
+ "thumbnail"
51
54
  ]);
52
55
  var FIELD_TYPE_ALIASES = {
53
56
  text: "string",
@@ -436,6 +439,10 @@ z.object({
436
439
  z.string().min(1, "events key (atom event name) must be non-empty"),
437
440
  z.string().min(1, "events value (caller event name) must be non-empty")
438
441
  ).optional(),
442
+ fields: z.record(
443
+ z.string().min(1, "fields key (canonical field name) must be non-empty"),
444
+ z.string().min(1, "fields value (consumer field name) must be non-empty")
445
+ ).optional(),
439
446
  config: TraitConfigSchema.optional(),
440
447
  appliesTo: z.array(z.string()).optional(),
441
448
  // Phase F.7: zod accepts an array (the inliner validates element
@@ -1464,6 +1471,7 @@ function makeTraitRef(opts) {
1464
1471
  if (opts.name !== void 0) ref.name = opts.name;
1465
1472
  if (opts.linkedEntity !== void 0) ref.linkedEntity = opts.linkedEntity;
1466
1473
  if (opts.events !== void 0) ref.events = opts.events;
1474
+ if (opts.fields !== void 0) ref.fields = opts.fields;
1467
1475
  if (opts.effects !== void 0) ref.effects = opts.effects;
1468
1476
  if (opts.listens !== void 0) ref.listens = opts.listens;
1469
1477
  if (opts.emitsScope !== void 0) ref.emitsScope = opts.emitsScope;