@almadar/ui 4.5.3 → 4.6.1

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.
@@ -15725,7 +15725,7 @@ function extractEntityFields(schema) {
15725
15725
  if (!entity || typeof entity !== "object" || !("fields" in entity)) return [];
15726
15726
  const inlineEntity = entity;
15727
15727
  if (!inlineEntity.fields) return [];
15728
- return inlineEntity.fields.map((f3) => f3.name);
15728
+ return inlineEntity.fields.map((f3) => f3.name).filter((n) => typeof n === "string" && n.length > 0);
15729
15729
  }
15730
15730
  function toStateMachineDefinition(sm) {
15731
15731
  return {
@@ -51477,6 +51477,7 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
51477
51477
  console.log("[TraitStateMachine] Processing event:", normalizedEvent, "payload:", payload);
51478
51478
  const bindingMap = new Map(bindings.map((b) => [b.trait.name, b]));
51479
51479
  const results = currentManager.sendEvent(normalizedEvent, payload);
51480
+ const emittedByTrait = /* @__PURE__ */ new Map();
51480
51481
  for (const { traitName, result } of results) {
51481
51482
  const binding = bindingMap.get(traitName);
51482
51483
  const traitState = currentManager.getState(traitName);
@@ -51595,7 +51596,17 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
51595
51596
  linkedEntity,
51596
51597
  entityId
51597
51598
  };
51598
- const executor = new runtime.EffectExecutor({ handlers, bindings: bindingCtx, context: effectContext });
51599
+ const emittedDuringExec = [];
51600
+ emittedByTrait.set(traitName, emittedDuringExec);
51601
+ const baseEmit = handlers.emit;
51602
+ const trackingHandlers = {
51603
+ ...handlers,
51604
+ emit: (event, eventPayload, source) => {
51605
+ emittedDuringExec.push(event);
51606
+ baseEmit(event, eventPayload, source);
51607
+ }
51608
+ };
51609
+ const executor = new runtime.EffectExecutor({ handlers: trackingHandlers, bindings: bindingCtx, context: effectContext });
51599
51610
  try {
51600
51611
  await executor.executeAll(result.effects);
51601
51612
  console.log(
@@ -51667,13 +51678,33 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
51667
51678
  };
51668
51679
  }
51669
51680
  );
51681
+ const emittedEvents = emittedByTrait.get(traitName) ?? [];
51670
51682
  recordTransition({
51671
51683
  traitName,
51672
51684
  from: result.previousState,
51673
51685
  to: result.newState,
51674
51686
  event: normalizedEvent,
51675
51687
  effects: effectTraces,
51676
- timestamp: Date.now()
51688
+ timestamp: Date.now(),
51689
+ // Populate ServerResponseTrace.emittedEvents whenever this
51690
+ // trait's effects fired anything via handlers.emit (e.g.
51691
+ // a persist's declared emit.success → ITEM_CREATED).
51692
+ // Without this, the verifier's data-mutation observer's
51693
+ // `frame.serverResponse?.emittedEvents` arrives null and
51694
+ // the cascade-was-empty fail surfaces despite the runtime
51695
+ // having dispatched the event correctly.
51696
+ ...emittedEvents.length > 0 && {
51697
+ serverResponse: {
51698
+ // orbitalName is metadata for the debug timeline;
51699
+ // the verifier reads emittedEvents only.
51700
+ orbitalName: "",
51701
+ success: true,
51702
+ clientEffects: effectTraces.length,
51703
+ dataEntities: {},
51704
+ emittedEvents,
51705
+ timestamp: Date.now()
51706
+ }
51707
+ }
51677
51708
  });
51678
51709
  }
51679
51710
  }
@@ -51965,7 +51996,7 @@ init_verificationRegistry();
51965
51996
  function generateEntityRow(entity, idx) {
51966
51997
  const row = { id: String(idx) };
51967
51998
  for (const f3 of entity.fields) {
51968
- if (f3.name === "id") continue;
51999
+ if (f3.name === void 0 || f3.name === "id") continue;
51969
52000
  row[f3.name] = generateFieldValue(entity.name, f3, idx);
51970
52001
  }
51971
52002
  return row;
@@ -51974,9 +52005,10 @@ function generateFieldValue(entityName, field, idx) {
51974
52005
  if (field.values && field.values.length > 0) {
51975
52006
  return field.values[(idx - 1) % field.values.length];
51976
52007
  }
52008
+ const fieldName = field.name ?? "";
51977
52009
  switch (field.type) {
51978
52010
  case "string":
51979
- return `${entityName} ${field.name.charAt(0).toUpperCase() + field.name.slice(1)} ${idx}`;
52011
+ return `${entityName} ${fieldName.charAt(0).toUpperCase() + fieldName.slice(1)} ${idx}`;
51980
52012
  case "number":
51981
52013
  return idx * 10;
51982
52014
  case "boolean":
package/dist/avl/index.js CHANGED
@@ -15679,7 +15679,7 @@ function extractEntityFields(schema) {
15679
15679
  if (!entity || typeof entity !== "object" || !("fields" in entity)) return [];
15680
15680
  const inlineEntity = entity;
15681
15681
  if (!inlineEntity.fields) return [];
15682
- return inlineEntity.fields.map((f3) => f3.name);
15682
+ return inlineEntity.fields.map((f3) => f3.name).filter((n) => typeof n === "string" && n.length > 0);
15683
15683
  }
15684
15684
  function toStateMachineDefinition(sm) {
15685
15685
  return {
@@ -51431,6 +51431,7 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
51431
51431
  console.log("[TraitStateMachine] Processing event:", normalizedEvent, "payload:", payload);
51432
51432
  const bindingMap = new Map(bindings.map((b) => [b.trait.name, b]));
51433
51433
  const results = currentManager.sendEvent(normalizedEvent, payload);
51434
+ const emittedByTrait = /* @__PURE__ */ new Map();
51434
51435
  for (const { traitName, result } of results) {
51435
51436
  const binding = bindingMap.get(traitName);
51436
51437
  const traitState = currentManager.getState(traitName);
@@ -51549,7 +51550,17 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
51549
51550
  linkedEntity,
51550
51551
  entityId
51551
51552
  };
51552
- const executor = new EffectExecutor({ handlers, bindings: bindingCtx, context: effectContext });
51553
+ const emittedDuringExec = [];
51554
+ emittedByTrait.set(traitName, emittedDuringExec);
51555
+ const baseEmit = handlers.emit;
51556
+ const trackingHandlers = {
51557
+ ...handlers,
51558
+ emit: (event, eventPayload, source) => {
51559
+ emittedDuringExec.push(event);
51560
+ baseEmit(event, eventPayload, source);
51561
+ }
51562
+ };
51563
+ const executor = new EffectExecutor({ handlers: trackingHandlers, bindings: bindingCtx, context: effectContext });
51553
51564
  try {
51554
51565
  await executor.executeAll(result.effects);
51555
51566
  console.log(
@@ -51621,13 +51632,33 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
51621
51632
  };
51622
51633
  }
51623
51634
  );
51635
+ const emittedEvents = emittedByTrait.get(traitName) ?? [];
51624
51636
  recordTransition({
51625
51637
  traitName,
51626
51638
  from: result.previousState,
51627
51639
  to: result.newState,
51628
51640
  event: normalizedEvent,
51629
51641
  effects: effectTraces,
51630
- timestamp: Date.now()
51642
+ timestamp: Date.now(),
51643
+ // Populate ServerResponseTrace.emittedEvents whenever this
51644
+ // trait's effects fired anything via handlers.emit (e.g.
51645
+ // a persist's declared emit.success → ITEM_CREATED).
51646
+ // Without this, the verifier's data-mutation observer's
51647
+ // `frame.serverResponse?.emittedEvents` arrives null and
51648
+ // the cascade-was-empty fail surfaces despite the runtime
51649
+ // having dispatched the event correctly.
51650
+ ...emittedEvents.length > 0 && {
51651
+ serverResponse: {
51652
+ // orbitalName is metadata for the debug timeline;
51653
+ // the verifier reads emittedEvents only.
51654
+ orbitalName: "",
51655
+ success: true,
51656
+ clientEffects: effectTraces.length,
51657
+ dataEntities: {},
51658
+ emittedEvents,
51659
+ timestamp: Date.now()
51660
+ }
51661
+ }
51631
51662
  });
51632
51663
  }
51633
51664
  }
@@ -51919,7 +51950,7 @@ init_verificationRegistry();
51919
51950
  function generateEntityRow(entity, idx) {
51920
51951
  const row = { id: String(idx) };
51921
51952
  for (const f3 of entity.fields) {
51922
- if (f3.name === "id") continue;
51953
+ if (f3.name === void 0 || f3.name === "id") continue;
51923
51954
  row[f3.name] = generateFieldValue(entity.name, f3, idx);
51924
51955
  }
51925
51956
  return row;
@@ -51928,9 +51959,10 @@ function generateFieldValue(entityName, field, idx) {
51928
51959
  if (field.values && field.values.length > 0) {
51929
51960
  return field.values[(idx - 1) % field.values.length];
51930
51961
  }
51962
+ const fieldName = field.name ?? "";
51931
51963
  switch (field.type) {
51932
51964
  case "string":
51933
- return `${entityName} ${field.name.charAt(0).toUpperCase() + field.name.slice(1)} ${idx}`;
51965
+ return `${entityName} ${fieldName.charAt(0).toUpperCase() + fieldName.slice(1)} ${idx}`;
51934
51966
  case "number":
51935
51967
  return idx * 10;
51936
51968
  case "boolean":
@@ -11022,7 +11022,7 @@ function extractEntityFields(schema) {
11022
11022
  if (!entity || typeof entity !== "object" || !("fields" in entity)) return [];
11023
11023
  const inlineEntity = entity;
11024
11024
  if (!inlineEntity.fields) return [];
11025
- return inlineEntity.fields.map((f3) => f3.name);
11025
+ return inlineEntity.fields.map((f3) => f3.name).filter((n) => typeof n === "string" && n.length > 0);
11026
11026
  }
11027
11027
  function toStateMachineDefinition(sm) {
11028
11028
  return {
@@ -10977,7 +10977,7 @@ function extractEntityFields(schema) {
10977
10977
  if (!entity || typeof entity !== "object" || !("fields" in entity)) return [];
10978
10978
  const inlineEntity = entity;
10979
10979
  if (!inlineEntity.fields) return [];
10980
- return inlineEntity.fields.map((f3) => f3.name);
10980
+ return inlineEntity.fields.map((f3) => f3.name).filter((n) => typeof n === "string" && n.length > 0);
10981
10981
  }
10982
10982
  function toStateMachineDefinition(sm) {
10983
10983
  return {
@@ -12565,7 +12565,7 @@ function extractEntityFields(schema) {
12565
12565
  if (!entity || typeof entity !== "object" || !("fields" in entity)) return [];
12566
12566
  const inlineEntity = entity;
12567
12567
  if (!inlineEntity.fields) return [];
12568
- return inlineEntity.fields.map((f3) => f3.name);
12568
+ return inlineEntity.fields.map((f3) => f3.name).filter((n) => typeof n === "string" && n.length > 0);
12569
12569
  }
12570
12570
  function toStateMachineDefinition(sm) {
12571
12571
  return {
@@ -12520,7 +12520,7 @@ function extractEntityFields(schema) {
12520
12520
  if (!entity || typeof entity !== "object" || !("fields" in entity)) return [];
12521
12521
  const inlineEntity = entity;
12522
12522
  if (!inlineEntity.fields) return [];
12523
- return inlineEntity.fields.map((f3) => f3.name);
12523
+ return inlineEntity.fields.map((f3) => f3.name).filter((n) => typeof n === "string" && n.length > 0);
12524
12524
  }
12525
12525
  function toStateMachineDefinition(sm) {
12526
12526
  return {
@@ -12450,7 +12450,7 @@ function extractEntityFields(schema) {
12450
12450
  if (!entity || typeof entity !== "object" || !("fields" in entity)) return [];
12451
12451
  const inlineEntity = entity;
12452
12452
  if (!inlineEntity.fields) return [];
12453
- return inlineEntity.fields.map((f3) => f3.name);
12453
+ return inlineEntity.fields.map((f3) => f3.name).filter((n) => typeof n === "string" && n.length > 0);
12454
12454
  }
12455
12455
  function toStateMachineDefinition(sm) {
12456
12456
  return {
@@ -38195,6 +38195,7 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38195
38195
  console.log("[TraitStateMachine] Processing event:", normalizedEvent, "payload:", payload);
38196
38196
  const bindingMap = new Map(bindings.map((b) => [b.trait.name, b]));
38197
38197
  const results = currentManager.sendEvent(normalizedEvent, payload);
38198
+ const emittedByTrait = /* @__PURE__ */ new Map();
38198
38199
  for (const { traitName, result } of results) {
38199
38200
  const binding = bindingMap.get(traitName);
38200
38201
  const traitState = currentManager.getState(traitName);
@@ -38313,7 +38314,17 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38313
38314
  linkedEntity,
38314
38315
  entityId
38315
38316
  };
38316
- const executor = new runtime.EffectExecutor({ handlers, bindings: bindingCtx, context: effectContext });
38317
+ const emittedDuringExec = [];
38318
+ emittedByTrait.set(traitName, emittedDuringExec);
38319
+ const baseEmit = handlers.emit;
38320
+ const trackingHandlers = {
38321
+ ...handlers,
38322
+ emit: (event, eventPayload, source) => {
38323
+ emittedDuringExec.push(event);
38324
+ baseEmit(event, eventPayload, source);
38325
+ }
38326
+ };
38327
+ const executor = new runtime.EffectExecutor({ handlers: trackingHandlers, bindings: bindingCtx, context: effectContext });
38317
38328
  try {
38318
38329
  await executor.executeAll(result.effects);
38319
38330
  console.log(
@@ -38385,13 +38396,33 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38385
38396
  };
38386
38397
  }
38387
38398
  );
38399
+ const emittedEvents = emittedByTrait.get(traitName) ?? [];
38388
38400
  recordTransition({
38389
38401
  traitName,
38390
38402
  from: result.previousState,
38391
38403
  to: result.newState,
38392
38404
  event: normalizedEvent,
38393
38405
  effects: effectTraces,
38394
- timestamp: Date.now()
38406
+ timestamp: Date.now(),
38407
+ // Populate ServerResponseTrace.emittedEvents whenever this
38408
+ // trait's effects fired anything via handlers.emit (e.g.
38409
+ // a persist's declared emit.success → ITEM_CREATED).
38410
+ // Without this, the verifier's data-mutation observer's
38411
+ // `frame.serverResponse?.emittedEvents` arrives null and
38412
+ // the cascade-was-empty fail surfaces despite the runtime
38413
+ // having dispatched the event correctly.
38414
+ ...emittedEvents.length > 0 && {
38415
+ serverResponse: {
38416
+ // orbitalName is metadata for the debug timeline;
38417
+ // the verifier reads emittedEvents only.
38418
+ orbitalName: "",
38419
+ success: true,
38420
+ clientEffects: effectTraces.length,
38421
+ dataEntities: {},
38422
+ emittedEvents,
38423
+ timestamp: Date.now()
38424
+ }
38425
+ }
38395
38426
  });
38396
38427
  }
38397
38428
  }
@@ -38805,7 +38836,7 @@ init_verificationRegistry();
38805
38836
  function generateEntityRow(entity, idx) {
38806
38837
  const row = { id: String(idx) };
38807
38838
  for (const f3 of entity.fields) {
38808
- if (f3.name === "id") continue;
38839
+ if (f3.name === void 0 || f3.name === "id") continue;
38809
38840
  row[f3.name] = generateFieldValue(entity.name, f3, idx);
38810
38841
  }
38811
38842
  return row;
@@ -38814,9 +38845,10 @@ function generateFieldValue(entityName, field, idx) {
38814
38845
  if (field.values && field.values.length > 0) {
38815
38846
  return field.values[(idx - 1) % field.values.length];
38816
38847
  }
38848
+ const fieldName = field.name ?? "";
38817
38849
  switch (field.type) {
38818
38850
  case "string":
38819
- return `${entityName} ${field.name.charAt(0).toUpperCase() + field.name.slice(1)} ${idx}`;
38851
+ return `${entityName} ${fieldName.charAt(0).toUpperCase() + fieldName.slice(1)} ${idx}`;
38820
38852
  case "number":
38821
38853
  return idx * 10;
38822
38854
  case "boolean":
@@ -12405,7 +12405,7 @@ function extractEntityFields(schema) {
12405
12405
  if (!entity || typeof entity !== "object" || !("fields" in entity)) return [];
12406
12406
  const inlineEntity = entity;
12407
12407
  if (!inlineEntity.fields) return [];
12408
- return inlineEntity.fields.map((f3) => f3.name);
12408
+ return inlineEntity.fields.map((f3) => f3.name).filter((n) => typeof n === "string" && n.length > 0);
12409
12409
  }
12410
12410
  function toStateMachineDefinition(sm) {
12411
12411
  return {
@@ -38150,6 +38150,7 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38150
38150
  console.log("[TraitStateMachine] Processing event:", normalizedEvent, "payload:", payload);
38151
38151
  const bindingMap = new Map(bindings.map((b) => [b.trait.name, b]));
38152
38152
  const results = currentManager.sendEvent(normalizedEvent, payload);
38153
+ const emittedByTrait = /* @__PURE__ */ new Map();
38153
38154
  for (const { traitName, result } of results) {
38154
38155
  const binding = bindingMap.get(traitName);
38155
38156
  const traitState = currentManager.getState(traitName);
@@ -38268,7 +38269,17 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38268
38269
  linkedEntity,
38269
38270
  entityId
38270
38271
  };
38271
- const executor = new EffectExecutor({ handlers, bindings: bindingCtx, context: effectContext });
38272
+ const emittedDuringExec = [];
38273
+ emittedByTrait.set(traitName, emittedDuringExec);
38274
+ const baseEmit = handlers.emit;
38275
+ const trackingHandlers = {
38276
+ ...handlers,
38277
+ emit: (event, eventPayload, source) => {
38278
+ emittedDuringExec.push(event);
38279
+ baseEmit(event, eventPayload, source);
38280
+ }
38281
+ };
38282
+ const executor = new EffectExecutor({ handlers: trackingHandlers, bindings: bindingCtx, context: effectContext });
38272
38283
  try {
38273
38284
  await executor.executeAll(result.effects);
38274
38285
  console.log(
@@ -38340,13 +38351,33 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
38340
38351
  };
38341
38352
  }
38342
38353
  );
38354
+ const emittedEvents = emittedByTrait.get(traitName) ?? [];
38343
38355
  recordTransition({
38344
38356
  traitName,
38345
38357
  from: result.previousState,
38346
38358
  to: result.newState,
38347
38359
  event: normalizedEvent,
38348
38360
  effects: effectTraces,
38349
- timestamp: Date.now()
38361
+ timestamp: Date.now(),
38362
+ // Populate ServerResponseTrace.emittedEvents whenever this
38363
+ // trait's effects fired anything via handlers.emit (e.g.
38364
+ // a persist's declared emit.success → ITEM_CREATED).
38365
+ // Without this, the verifier's data-mutation observer's
38366
+ // `frame.serverResponse?.emittedEvents` arrives null and
38367
+ // the cascade-was-empty fail surfaces despite the runtime
38368
+ // having dispatched the event correctly.
38369
+ ...emittedEvents.length > 0 && {
38370
+ serverResponse: {
38371
+ // orbitalName is metadata for the debug timeline;
38372
+ // the verifier reads emittedEvents only.
38373
+ orbitalName: "",
38374
+ success: true,
38375
+ clientEffects: effectTraces.length,
38376
+ dataEntities: {},
38377
+ emittedEvents,
38378
+ timestamp: Date.now()
38379
+ }
38380
+ }
38350
38381
  });
38351
38382
  }
38352
38383
  }
@@ -38760,7 +38791,7 @@ init_verificationRegistry();
38760
38791
  function generateEntityRow(entity, idx) {
38761
38792
  const row = { id: String(idx) };
38762
38793
  for (const f3 of entity.fields) {
38763
- if (f3.name === "id") continue;
38794
+ if (f3.name === void 0 || f3.name === "id") continue;
38764
38795
  row[f3.name] = generateFieldValue(entity.name, f3, idx);
38765
38796
  }
38766
38797
  return row;
@@ -38769,9 +38800,10 @@ function generateFieldValue(entityName, field, idx) {
38769
38800
  if (field.values && field.values.length > 0) {
38770
38801
  return field.values[(idx - 1) % field.values.length];
38771
38802
  }
38803
+ const fieldName = field.name ?? "";
38772
38804
  switch (field.type) {
38773
38805
  case "string":
38774
- return `${entityName} ${field.name.charAt(0).toUpperCase() + field.name.slice(1)} ${idx}`;
38806
+ return `${entityName} ${fieldName.charAt(0).toUpperCase() + fieldName.slice(1)} ${idx}`;
38775
38807
  case "number":
38776
38808
  return idx * 10;
38777
38809
  case "boolean":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.5.3",
3
+ "version": "4.6.1",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/components/index.js",
@@ -118,7 +118,7 @@
118
118
  "access": "public"
119
119
  },
120
120
  "dependencies": {
121
- "@almadar/core": ">=5.7.0",
121
+ "@almadar/core": "^7.0.0",
122
122
  "@almadar/evaluator": ">=2.9.2",
123
123
  "@almadar/patterns": ">=2.17.1",
124
124
  "@almadar/runtime": "^4.11.1",