@almadar/core 4.4.2 → 4.6.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, c as OrbitalSchema } from './schema-B0Yin-RM.js';
1
+ import { O as OrbitalDefinition, d as OrbitalSchema } from './schema-CLFPg1xW.js';
2
2
 
3
3
  /**
4
4
  * Event Wiring
@@ -1,4 +1,4 @@
1
- import { bR as SExpr, e as Entity, P as Page, c as OrbitalSchema, d as Trait } from '../schema-B0Yin-RM.js';
1
+ import { bS as SExpr, f as Entity, P as Page, d as OrbitalSchema, e as Trait } from '../schema-CLFPg1xW.js';
2
2
  import 'zod';
3
3
  import '@almadar/patterns';
4
4
 
@@ -3356,34 +3356,61 @@ var FieldFormatSchema = z.enum([
3356
3356
  "datetime",
3357
3357
  "uuid"
3358
3358
  ]);
3359
+ var FIELD_TYPE_ALIASES = {
3360
+ text: "string",
3361
+ int: "number",
3362
+ float: "number",
3363
+ ts: "timestamp"
3364
+ };
3359
3365
  var EntityFieldSchema = z.lazy(
3360
- () => z.object({
3361
- name: z.string().min(1, "Field name is required"),
3362
- type: FieldTypeSchema,
3363
- required: z.boolean().optional(),
3364
- default: z.unknown().optional(),
3365
- values: z.array(z.string()).optional(),
3366
- enum: z.array(z.string()).optional(),
3367
- format: FieldFormatSchema.optional(),
3368
- min: z.number().optional(),
3369
- max: z.number().optional(),
3370
- items: EntityFieldSchema.optional(),
3371
- relation: RelationConfigSchema.optional()
3372
- }).refine(
3373
- (field) => field.type !== "relation" || field.relation !== void 0,
3374
- { message: 'Relation config is required when type is "relation"', path: ["relation"] }
3375
- ).refine(
3376
- // Enum fields must carry their allowed values. Without this refine,
3377
- // the type was lying about what's valid — bare `type: 'enum'` without
3378
- // `values` passed zod but failed `orb validate` downstream with
3379
- // ORB_E_EMPTY_ENUM_VALUES, stalling the agent pipeline for 20 minutes.
3380
- // `enum` is the legacy field-name alias; accept either.
3381
- (field) => {
3382
- if (field.type !== "enum") return true;
3383
- const vals = field.values ?? field.enum;
3384
- return Array.isArray(vals) && vals.length > 0;
3366
+ () => z.preprocess(
3367
+ (input) => {
3368
+ if (input !== null && typeof input === "object" && "type" in input && typeof input.type === "string") {
3369
+ const raw = input.type;
3370
+ const canonical = FIELD_TYPE_ALIASES[raw];
3371
+ if (canonical !== void 0) {
3372
+ return { ...input, type: canonical };
3373
+ }
3374
+ }
3375
+ return input;
3385
3376
  },
3386
- { message: "Enum field requires a non-empty `values` array", path: ["values"] }
3377
+ z.object({
3378
+ name: z.string().min(1, "Field name is required"),
3379
+ type: FieldTypeSchema,
3380
+ required: z.boolean().optional(),
3381
+ default: z.unknown().optional(),
3382
+ values: z.array(z.string()).optional(),
3383
+ enum: z.array(z.string()).optional(),
3384
+ format: FieldFormatSchema.optional(),
3385
+ min: z.number().optional(),
3386
+ max: z.number().optional(),
3387
+ items: EntityFieldSchema.optional(),
3388
+ relation: RelationConfigSchema.optional()
3389
+ }).refine(
3390
+ (field) => field.type !== "relation" || field.relation !== void 0,
3391
+ { message: 'Relation config is required when type is "relation"', path: ["relation"] }
3392
+ ).refine(
3393
+ // Enum fields must carry their allowed values. Without this refine,
3394
+ // the type was lying about what's valid — bare `type: 'enum'` without
3395
+ // `values` passed zod but failed `orb validate` downstream with
3396
+ // ORB_E_EMPTY_ENUM_VALUES, stalling the agent pipeline for 20 minutes.
3397
+ // `enum` is the legacy field-name alias; accept either.
3398
+ (field) => {
3399
+ if (field.type !== "enum") return true;
3400
+ const vals = field.values ?? field.enum;
3401
+ return Array.isArray(vals) && vals.length > 0;
3402
+ },
3403
+ { message: "Enum field requires a non-empty `values` array", path: ["values"] }
3404
+ ).refine(
3405
+ // Array fields must describe their element shape. Bare `type: 'array'`
3406
+ // with no `items` forces downstream consumers (builders, UI renderers,
3407
+ // persistence) to guess, so reject it at the schema boundary.
3408
+ (field) => {
3409
+ if (field.type !== "array") return true;
3410
+ return field.items !== void 0;
3411
+ },
3412
+ { message: "Array field requires an `items` schema describing each element", path: ["items"] }
3413
+ )
3387
3414
  )
3388
3415
  );
3389
3416
  var ENTITY_ROLES = [
@@ -3691,6 +3718,8 @@ var RequiredFieldSchema = z.object({
3691
3718
  });
3692
3719
  z.object({
3693
3720
  ref: z.string().min(1),
3721
+ // Phase 1.2: optional registry path disambiguator, pairs with `ref`.
3722
+ from: z.string().optional(),
3694
3723
  linkedEntity: z.string().optional(),
3695
3724
  name: z.string().optional(),
3696
3725
  events: z.record(
@@ -4071,6 +4100,8 @@ var PageRefStringSchema = z.string().regex(
4071
4100
  );
4072
4101
  var PageRefObjectSchema = z.object({
4073
4102
  ref: PageRefStringSchema,
4103
+ // Phase 1.2: optional registry path disambiguator, pairs with `ref`.
4104
+ from: z.string().optional(),
4074
4105
  path: z.string().startsWith("/").optional(),
4075
4106
  linkedEntity: z.string().optional(),
4076
4107
  traits: z.array(TraitRefSchema).optional()