@almadar/core 8.5.1 → 8.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.
- package/dist/builders.d.ts +3 -3
- package/dist/builders.js +62 -50
- package/dist/builders.js.map +1 -1
- package/dist/{compose-behaviors-TSp2c_dn.d.ts → compose-behaviors-CzTKCtrh.d.ts} +1 -1
- package/dist/factory/index.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +96 -59
- package/dist/index.js.map +1 -1
- package/dist/{schema-Dp98Xt5i.d.ts → schema--EDm7mx5.d.ts} +1 -1
- package/dist/{trait-BV1DyJ2A.d.ts → trait-D1kGh81D.d.ts} +55 -12
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.js +61 -49
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
package/dist/builders.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { bK as UISlot, t as Effect, bg as Trait, aC as RenderUIEffect, bs as TraitEventContract, y as Entity, bu as TraitEventListener, bj as TraitConfig, B as EntityField, H as EntityPersistence, L as EntityRow, bx as TraitRef, bz as TraitReference } from './trait-
|
|
2
|
-
import { aA as UseDeclaration, B as EntityRef, ab as PageRef, X as OrbitalDefinition, a3 as OrbitalSchema, aa as Page, ac as PageRefObject } from './schema
|
|
1
|
+
import { bK as UISlot, t as Effect, bg as Trait, aC as RenderUIEffect, bs as TraitEventContract, y as Entity, bu as TraitEventListener, bj as TraitConfig, B as EntityField, H as EntityPersistence, L as EntityRow, bx as TraitRef, bz as TraitReference } from './trait-D1kGh81D.js';
|
|
2
|
+
import { aA as UseDeclaration, B as EntityRef, ab as PageRef, X as OrbitalDefinition, a3 as OrbitalSchema, aa as Page, ac as PageRefObject } from './schema--EDm7mx5.js';
|
|
3
3
|
import { S as SExpr } from './expression-BVRFm0sV.js';
|
|
4
|
-
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-
|
|
4
|
+
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-CzTKCtrh.js';
|
|
5
5
|
import { AnyPatternConfig } from '@almadar/patterns';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
package/dist/builders.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
// src/types/orbital.ts
|
|
4
|
-
|
|
4
|
+
z.enum([
|
|
5
5
|
"string",
|
|
6
6
|
"number",
|
|
7
7
|
"boolean",
|
|
@@ -55,58 +55,70 @@ var FIELD_TYPE_ALIASES = {
|
|
|
55
55
|
float: "number",
|
|
56
56
|
ts: "timestamp"
|
|
57
57
|
};
|
|
58
|
-
var EntityFieldSchema = z.lazy(
|
|
59
|
-
|
|
58
|
+
var EntityFieldSchema = z.lazy(() => {
|
|
59
|
+
const baseFieldShape = {
|
|
60
|
+
name: z.string().min(1, "Field name is required").optional(),
|
|
61
|
+
required: z.boolean().optional(),
|
|
62
|
+
default: z.unknown().optional(),
|
|
63
|
+
format: FieldFormatSchema.optional(),
|
|
64
|
+
min: z.number().optional(),
|
|
65
|
+
max: z.number().optional(),
|
|
66
|
+
properties: z.record(EntityFieldSchema).optional()
|
|
67
|
+
};
|
|
68
|
+
function scalarVariant(t) {
|
|
69
|
+
return z.object({
|
|
70
|
+
...baseFieldShape,
|
|
71
|
+
type: z.literal(t),
|
|
72
|
+
values: z.array(z.string()).optional()
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return z.preprocess(
|
|
60
76
|
(input) => {
|
|
61
|
-
if (input
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
if (input === null || typeof input !== "object" || !("type" in input) || typeof input.type !== "string") {
|
|
78
|
+
return input;
|
|
79
|
+
}
|
|
80
|
+
const obj = input;
|
|
81
|
+
const next = { ...obj };
|
|
82
|
+
const aliased = FIELD_TYPE_ALIASES[obj.type];
|
|
83
|
+
if (aliased !== void 0) next["type"] = aliased;
|
|
84
|
+
if (next["enum"] !== void 0 && next["values"] === void 0) {
|
|
85
|
+
next["values"] = next["enum"];
|
|
67
86
|
}
|
|
68
|
-
|
|
87
|
+
delete next["enum"];
|
|
88
|
+
return next;
|
|
69
89
|
},
|
|
70
|
-
z.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
(field) => {
|
|
103
|
-
if (field.type !== "array") return true;
|
|
104
|
-
return field.items !== void 0;
|
|
105
|
-
},
|
|
106
|
-
{ message: "Array field requires an `items` schema describing each element", path: ["items"] }
|
|
107
|
-
)
|
|
108
|
-
)
|
|
109
|
-
);
|
|
90
|
+
z.discriminatedUnion("type", [
|
|
91
|
+
scalarVariant("string"),
|
|
92
|
+
scalarVariant("number"),
|
|
93
|
+
scalarVariant("boolean"),
|
|
94
|
+
scalarVariant("date"),
|
|
95
|
+
scalarVariant("timestamp"),
|
|
96
|
+
scalarVariant("datetime"),
|
|
97
|
+
scalarVariant("object"),
|
|
98
|
+
scalarVariant("trait"),
|
|
99
|
+
scalarVariant("slot"),
|
|
100
|
+
scalarVariant("pattern"),
|
|
101
|
+
// Enum variant — REQUIRES non-empty values.
|
|
102
|
+
z.object({
|
|
103
|
+
...baseFieldShape,
|
|
104
|
+
type: z.literal("enum"),
|
|
105
|
+
values: z.array(z.string()).min(1, "Enum field requires a non-empty `values` array")
|
|
106
|
+
}),
|
|
107
|
+
// Relation variant — REQUIRES relation config.
|
|
108
|
+
z.object({
|
|
109
|
+
...baseFieldShape,
|
|
110
|
+
type: z.literal("relation"),
|
|
111
|
+
relation: RelationConfigSchema
|
|
112
|
+
}),
|
|
113
|
+
// Array variant — REQUIRES items schema.
|
|
114
|
+
z.object({
|
|
115
|
+
...baseFieldShape,
|
|
116
|
+
type: z.literal("array"),
|
|
117
|
+
items: EntityFieldSchema
|
|
118
|
+
})
|
|
119
|
+
])
|
|
120
|
+
);
|
|
121
|
+
});
|
|
110
122
|
var ENTITY_ROLES = [
|
|
111
123
|
"player",
|
|
112
124
|
"enemy",
|