@almadar/core 6.0.0 → 7.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, h as OrbitalSchema } from './schema-DnLtWO4e.js';
1
+ import { O as OrbitalDefinition, h as OrbitalSchema } from './schema-BmRZkOwH.js';
2
2
 
3
3
  /**
4
4
  * Event Wiring
@@ -1,4 +1,4 @@
1
- import { S as SExpr, E as Entity, j as Page, h as OrbitalSchema, i as Trait } from '../schema-DnLtWO4e.js';
1
+ import { S as SExpr, E as Entity, j as Page, h as OrbitalSchema, i as Trait } from '../schema-BmRZkOwH.js';
2
2
  import 'zod';
3
3
  import '@almadar/patterns';
4
4
 
@@ -3374,7 +3374,7 @@ var EntityFieldSchema = z.lazy(
3374
3374
  return input;
3375
3375
  },
3376
3376
  z.object({
3377
- name: z.string().min(1, "Field name is required"),
3377
+ name: z.string().min(1, "Field name is required").optional(),
3378
3378
  type: FieldTypeSchema,
3379
3379
  required: z.boolean().optional(),
3380
3380
  default: z.unknown().optional(),
@@ -3569,7 +3569,7 @@ var StateSchema = z.object({
3569
3569
  });
3570
3570
  var PayloadFieldSchema = z.object({
3571
3571
  name: z.string().min(1),
3572
- type: z.enum(["string", "number", "boolean", "object", "array"]),
3572
+ type: z.string().min(1),
3573
3573
  required: z.boolean().optional()
3574
3574
  });
3575
3575
  var EventSchema = z.object({
@@ -3670,15 +3670,32 @@ var TraitTickSchema = z.object({
3670
3670
  var EventScopeSchema = z.enum(["internal", "external"]);
3671
3671
  var EventPayloadFieldSchema = z.object({
3672
3672
  name: z.string().min(1),
3673
- type: z.enum(["string", "number", "boolean", "object", "array", "entity"]),
3673
+ /**
3674
+ * Field type. Mirrors the Rust validator's acceptance: any non-empty
3675
+ * string. Primitives ('string' | 'number' | 'boolean' | 'object' |
3676
+ * 'array') are the canonical values; entity-name references like
3677
+ * 'ModalRecord' and array-of-entity references like '[ModalRecord]'
3678
+ * are also valid because the Rust IR's PayloadField.field_type is
3679
+ * just a String. Only enforced narrowly at the call site (e.g.
3680
+ * emit-literal type-mismatch warnings in
3681
+ * orbital-compiler/phases/validation/emit_payload.rs) — not here.
3682
+ */
3683
+ type: z.string().min(1),
3674
3684
  required: z.boolean().optional(),
3675
3685
  description: z.string().optional(),
3676
3686
  entityType: z.string().optional()
3677
3687
  });
3678
3688
  var TraitEventContractSchema = z.object({
3689
+ /**
3690
+ * Event name. Mirrors the Rust validator's `is_valid_event_identifier`:
3691
+ * starts with a letter, then any letters / digits / underscores. Both
3692
+ * UPPER_SNAKE_CASE and PascalCase shapes are valid identifiers in the
3693
+ * post-Phase 2.5 nominal-event type system (events declared via
3694
+ * `type X = Event<T>`).
3695
+ */
3679
3696
  event: z.string().min(1).regex(
3680
- /^[A-Z][A-Z0-9_]*$/,
3681
- "Event name must be UPPER_SNAKE_CASE"
3697
+ /^[A-Za-z][A-Za-z0-9_]*$/,
3698
+ "Event name must start with a letter and contain only letters, digits, and underscores"
3682
3699
  ),
3683
3700
  description: z.string().optional(),
3684
3701
  payloadSchema: z.array(EventPayloadFieldSchema).optional(),
@@ -4097,6 +4114,7 @@ var EntityCallSchema = z.object({
4097
4114
  if (!call.fields) return true;
4098
4115
  const seen = /* @__PURE__ */ new Set();
4099
4116
  for (const field of call.fields) {
4117
+ if (field.name === void 0) continue;
4100
4118
  if (seen.has(field.name)) return false;
4101
4119
  seen.add(field.name);
4102
4120
  }