@almadar/core 4.4.1 → 4.5.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.
- package/dist/builders.d.ts +2 -2
- package/dist/builders.js +58 -15
- package/dist/builders.js.map +1 -1
- package/dist/{compose-behaviors-Da0YDcli.d.ts → compose-behaviors-BtjmpmIC.d.ts} +1 -1
- package/dist/domain-language/index.d.ts +1 -1
- package/dist/domain-language/index.js +58 -15
- package/dist/domain-language/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +58 -15
- package/dist/index.js.map +1 -1
- package/dist/{schema-B0Yin-RM.d.ts → schema-D4VBpRZI.d.ts} +97 -46
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +58 -15
- package/dist/types/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -3356,22 +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.
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
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;
|
|
3376
|
+
},
|
|
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
|
+
)
|
|
3375
3414
|
)
|
|
3376
3415
|
);
|
|
3377
3416
|
var ENTITY_ROLES = [
|
|
@@ -3679,6 +3718,8 @@ var RequiredFieldSchema = z.object({
|
|
|
3679
3718
|
});
|
|
3680
3719
|
z.object({
|
|
3681
3720
|
ref: z.string().min(1),
|
|
3721
|
+
// Phase 1.2: optional registry path disambiguator, pairs with `ref`.
|
|
3722
|
+
from: z.string().optional(),
|
|
3682
3723
|
linkedEntity: z.string().optional(),
|
|
3683
3724
|
name: z.string().optional(),
|
|
3684
3725
|
events: z.record(
|
|
@@ -4059,6 +4100,8 @@ var PageRefStringSchema = z.string().regex(
|
|
|
4059
4100
|
);
|
|
4060
4101
|
var PageRefObjectSchema = z.object({
|
|
4061
4102
|
ref: PageRefStringSchema,
|
|
4103
|
+
// Phase 1.2: optional registry path disambiguator, pairs with `ref`.
|
|
4104
|
+
from: z.string().optional(),
|
|
4062
4105
|
path: z.string().startsWith("/").optional(),
|
|
4063
4106
|
linkedEntity: z.string().optional(),
|
|
4064
4107
|
traits: z.array(TraitRefSchema).optional()
|