@almadar/core 5.9.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,5 +1,5 @@
1
- import { T as TraitEventContract, E as Entity, S as SExpr, a as TraitEventListener, b as TraitConfig, c as EntityField, d as EntityPersistence, e as EntityRow, U as UseDeclaration, f as EntityRef, g as TraitRef, P as PageRef, O as OrbitalDefinition, h as OrbitalSchema, i as Trait, j as Page, k as PageRefObject, l as TraitReference } from './schema-jvDmDqz7.js';
2
- 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-CrvkqqKZ.js';
1
+ import { T as TraitEventContract, E as Entity, S as SExpr, a as TraitEventListener, b as TraitConfig, c as EntityField, d as EntityPersistence, e as EntityRow, U as UseDeclaration, f as EntityRef, g as TraitRef, P as PageRef, O as OrbitalDefinition, h as OrbitalSchema, i as Trait, j as Page, k as PageRefObject, l as TraitReference } from './schema-BmRZkOwH.js';
2
+ 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-Bb1eCS7J.js';
3
3
  import 'zod';
4
4
  import '@almadar/patterns';
5
5
 
package/dist/builders.js CHANGED
@@ -65,7 +65,7 @@ var EntityFieldSchema = z.lazy(
65
65
  return input;
66
66
  },
67
67
  z.object({
68
- name: z.string().min(1, "Field name is required"),
68
+ name: z.string().min(1, "Field name is required").optional(),
69
69
  type: FieldTypeSchema,
70
70
  required: z.boolean().optional(),
71
71
  default: z.unknown().optional(),
@@ -249,7 +249,7 @@ var StateSchema = z.object({
249
249
  });
250
250
  var PayloadFieldSchema = z.object({
251
251
  name: z.string().min(1),
252
- type: z.enum(["string", "number", "boolean", "object", "array"]),
252
+ type: z.string().min(1),
253
253
  required: z.boolean().optional()
254
254
  });
255
255
  var EventSchema = z.object({
@@ -350,18 +350,35 @@ var TraitTickSchema = z.object({
350
350
  var EventScopeSchema = z.enum(["internal", "external"]);
351
351
  var EventPayloadFieldSchema = z.object({
352
352
  name: z.string().min(1),
353
- type: z.enum(["string", "number", "boolean", "object", "array", "entity"]),
353
+ /**
354
+ * Field type. Mirrors the Rust validator's acceptance: any non-empty
355
+ * string. Primitives ('string' | 'number' | 'boolean' | 'object' |
356
+ * 'array') are the canonical values; entity-name references like
357
+ * 'ModalRecord' and array-of-entity references like '[ModalRecord]'
358
+ * are also valid because the Rust IR's PayloadField.field_type is
359
+ * just a String. Only enforced narrowly at the call site (e.g.
360
+ * emit-literal type-mismatch warnings in
361
+ * orbital-compiler/phases/validation/emit_payload.rs) — not here.
362
+ */
363
+ type: z.string().min(1),
354
364
  required: z.boolean().optional(),
355
365
  description: z.string().optional(),
356
366
  entityType: z.string().optional()
357
367
  });
358
368
  var TraitEventContractSchema = z.object({
369
+ /**
370
+ * Event name. Mirrors the Rust validator's `is_valid_event_identifier`:
371
+ * starts with a letter, then any letters / digits / underscores. Both
372
+ * UPPER_SNAKE_CASE and PascalCase shapes are valid identifiers in the
373
+ * post-Phase 2.5 nominal-event type system (events declared via
374
+ * `type X = Event<T>`).
375
+ */
359
376
  event: z.string().min(1).regex(
360
- /^[A-Z][A-Z0-9_]*$/,
361
- "Event name must be UPPER_SNAKE_CASE"
377
+ /^[A-Za-z][A-Za-z0-9_]*$/,
378
+ "Event name must start with a letter and contain only letters, digits, and underscores"
362
379
  ),
363
380
  description: z.string().optional(),
364
- payload: z.array(EventPayloadFieldSchema).optional(),
381
+ payloadSchema: z.array(EventPayloadFieldSchema).optional(),
365
382
  scope: EventScopeSchema.optional()
366
383
  });
367
384
  var ListenSourceSchema = z.union([
@@ -768,6 +785,7 @@ var EntityCallSchema = z.object({
768
785
  if (!call.fields) return true;
769
786
  const seen = /* @__PURE__ */ new Set();
770
787
  for (const field of call.fields) {
788
+ if (field.name === void 0) continue;
771
789
  if (seen.has(field.name)) return false;
772
790
  seen.add(field.name);
773
791
  }