@almadar/core 5.1.0 → 5.2.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 +5 -24
- package/dist/builders.js +56 -33
- package/dist/builders.js.map +1 -1
- package/dist/{compose-behaviors-vE2bU7TB.d.ts → compose-behaviors-BOy-gFQn.d.ts} +1 -1
- package/dist/domain-language/index.d.ts +1 -1
- package/dist/domain-language/index.js +56 -33
- package/dist/domain-language/index.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +62 -35
- package/dist/index.js.map +1 -1
- package/dist/{schema-CsX_xlhO.d.ts → schema-ks5fDpzp.d.ts} +4932 -3580
- package/dist/types/index.d.ts +36 -14
- package/dist/types/index.js +57 -34
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
package/dist/builders.d.ts
CHANGED
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
import { T as TraitEventContract, E as Entity, S as SExpr, a as TraitEventListener, b as
|
|
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-
|
|
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-ks5fDpzp.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-BOy-gFQn.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '@almadar/patterns';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Orbital Builders
|
|
8
|
-
*
|
|
9
|
-
* Pure functions for constructing and composing Orbitals.
|
|
10
|
-
* No new types. Everything uses existing core types:
|
|
11
|
-
* Entity, Trait, Page, OrbitalDefinition, OrbitalSchema.
|
|
12
|
-
*
|
|
13
|
-
* Three categories:
|
|
14
|
-
* 1. Builders: construct Entity, Page from common params
|
|
15
|
-
* 2. Utilities: ensureIdField, resolveDefaults
|
|
16
|
-
* 3. Composition: connect, compose, pipe
|
|
17
|
-
*
|
|
18
|
-
* @packageDocumentation
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
6
|
/**
|
|
22
7
|
* Ensure the fields array has an `id` field. Prepends one if missing.
|
|
23
8
|
*/
|
|
@@ -78,12 +63,8 @@ interface MakeTraitRefOpts {
|
|
|
78
63
|
listens?: TraitEventListener[];
|
|
79
64
|
/** Set every emit's scope. */
|
|
80
65
|
emitsScope?: 'internal' | 'external';
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
* shape: `Record<string, Record<string, unknown>>` (the outer key is the
|
|
84
|
-
* config field name, the inner record is its value shape).
|
|
85
|
-
*/
|
|
86
|
-
config?: Record<string, Record<string, unknown>>;
|
|
66
|
+
/** Call-site config overrides. Matches {@link TraitReference.config}. */
|
|
67
|
+
config?: TraitConfig;
|
|
87
68
|
}
|
|
88
69
|
/**
|
|
89
70
|
* Build a {@link TraitReference} from options.
|
|
@@ -155,7 +136,7 @@ interface MakeAtomOrbitalTraitOverrides {
|
|
|
155
136
|
effects?: Record<string, SExpr[]>;
|
|
156
137
|
listens?: TraitEventListener[];
|
|
157
138
|
emitsScope?: 'internal' | 'external';
|
|
158
|
-
config?:
|
|
139
|
+
config?: TraitConfig;
|
|
159
140
|
}
|
|
160
141
|
/**
|
|
161
142
|
* Options for {@link makeAtomOrbital}.
|
package/dist/builders.js
CHANGED
|
@@ -185,36 +185,6 @@ var OrbitalEntitySchema = z.object({
|
|
|
185
185
|
assetRef: SemanticAssetRefSchema.optional()
|
|
186
186
|
});
|
|
187
187
|
var EntitySchema = OrbitalEntitySchema;
|
|
188
|
-
var ViewTypeSchema = z.enum([
|
|
189
|
-
"list",
|
|
190
|
-
"detail",
|
|
191
|
-
"create",
|
|
192
|
-
"edit",
|
|
193
|
-
"dashboard",
|
|
194
|
-
"custom"
|
|
195
|
-
]);
|
|
196
|
-
var PageTraitRefSchema = z.object({
|
|
197
|
-
ref: z.string().min(1, "Trait ref is required"),
|
|
198
|
-
linkedEntity: z.string().optional(),
|
|
199
|
-
config: z.record(z.unknown()).optional()
|
|
200
|
-
});
|
|
201
|
-
z.object({
|
|
202
|
-
name: z.string().min(1, "Page name is required"),
|
|
203
|
-
path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
|
|
204
|
-
primaryEntity: z.string().min(1, "Primary entity is required"),
|
|
205
|
-
traits: z.array(PageTraitRefSchema).min(1, "Page must have at least one trait"),
|
|
206
|
-
title: z.string().optional()
|
|
207
|
-
}).strict();
|
|
208
|
-
var OrbitalPageSchema = z.object({
|
|
209
|
-
name: z.string().min(1, "Page name is required"),
|
|
210
|
-
path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
|
|
211
|
-
viewType: ViewTypeSchema.optional(),
|
|
212
|
-
title: z.string().optional(),
|
|
213
|
-
primaryEntity: z.string().optional(),
|
|
214
|
-
traits: z.array(PageTraitRefSchema).optional(),
|
|
215
|
-
isInitial: z.boolean().optional()
|
|
216
|
-
}).strict();
|
|
217
|
-
var PageSchema = OrbitalPageSchema;
|
|
218
188
|
var UI_SLOTS = [
|
|
219
189
|
// App slots
|
|
220
190
|
"main",
|
|
@@ -311,6 +281,17 @@ var StateMachineSchema = z.object({
|
|
|
311
281
|
});
|
|
312
282
|
|
|
313
283
|
// src/types/trait.ts
|
|
284
|
+
var TraitConfigValueSchema = z.lazy(
|
|
285
|
+
() => z.union([
|
|
286
|
+
z.string(),
|
|
287
|
+
z.number(),
|
|
288
|
+
z.boolean(),
|
|
289
|
+
z.null(),
|
|
290
|
+
z.array(TraitConfigValueSchema),
|
|
291
|
+
z.record(TraitConfigValueSchema)
|
|
292
|
+
])
|
|
293
|
+
);
|
|
294
|
+
var TraitConfigSchema = z.record(TraitConfigValueSchema);
|
|
314
295
|
var TraitCategorySchema = z.enum([
|
|
315
296
|
"lifecycle",
|
|
316
297
|
"temporal",
|
|
@@ -383,12 +364,22 @@ var TraitEventContractSchema = z.object({
|
|
|
383
364
|
payload: z.array(EventPayloadFieldSchema).optional(),
|
|
384
365
|
scope: EventScopeSchema.optional()
|
|
385
366
|
});
|
|
367
|
+
var ListenSourceSchema = z.union([
|
|
368
|
+
z.object({ kind: z.literal("any") }),
|
|
369
|
+
z.object({ kind: z.literal("trait"), trait: z.string().min(1) }),
|
|
370
|
+
z.object({
|
|
371
|
+
kind: z.literal("orbital"),
|
|
372
|
+
orbital: z.string().min(1),
|
|
373
|
+
trait: z.string().min(1)
|
|
374
|
+
})
|
|
375
|
+
]);
|
|
386
376
|
var TraitEventListenerSchema = z.object({
|
|
387
377
|
event: z.string().min(1),
|
|
388
378
|
triggers: z.string().min(1),
|
|
389
379
|
guard: ExpressionSchema.optional(),
|
|
390
380
|
scope: EventScopeSchema.optional(),
|
|
391
|
-
payloadMapping: z.record(z.string()).optional()
|
|
381
|
+
payloadMapping: z.record(z.string()).optional(),
|
|
382
|
+
source: ListenSourceSchema.optional()
|
|
392
383
|
});
|
|
393
384
|
var RequiredFieldSchema = z.object({
|
|
394
385
|
name: z.string().min(1),
|
|
@@ -405,7 +396,7 @@ z.object({
|
|
|
405
396
|
z.string().min(1, "events key (atom event name) must be non-empty"),
|
|
406
397
|
z.string().min(1, "events value (caller event name) must be non-empty")
|
|
407
398
|
).optional(),
|
|
408
|
-
config:
|
|
399
|
+
config: TraitConfigSchema.optional(),
|
|
409
400
|
appliesTo: z.array(z.string()).optional(),
|
|
410
401
|
// Phase F.7: zod accepts an array (the inliner validates element
|
|
411
402
|
// shape). The full ListenDefinition shape isn't recursively encoded
|
|
@@ -456,7 +447,7 @@ var TraitRefSchema = z.union([
|
|
|
456
447
|
z.string().min(1),
|
|
457
448
|
z.object({
|
|
458
449
|
ref: z.string().min(1),
|
|
459
|
-
config:
|
|
450
|
+
config: TraitConfigSchema.optional(),
|
|
460
451
|
linkedEntity: z.string().optional(),
|
|
461
452
|
name: z.string().optional(),
|
|
462
453
|
// Phase F.4: same non-empty refine as TraitReferenceSchema.events.
|
|
@@ -473,6 +464,38 @@ var TraitRefSchema = z.union([
|
|
|
473
464
|
function isInlineTrait(traitRef) {
|
|
474
465
|
return typeof traitRef === "object" && "name" in traitRef && !("ref" in traitRef);
|
|
475
466
|
}
|
|
467
|
+
|
|
468
|
+
// src/types/page.ts
|
|
469
|
+
var ViewTypeSchema = z.enum([
|
|
470
|
+
"list",
|
|
471
|
+
"detail",
|
|
472
|
+
"create",
|
|
473
|
+
"edit",
|
|
474
|
+
"dashboard",
|
|
475
|
+
"custom"
|
|
476
|
+
]);
|
|
477
|
+
var PageTraitRefSchema = z.object({
|
|
478
|
+
ref: z.string().min(1, "Trait ref is required"),
|
|
479
|
+
linkedEntity: z.string().optional(),
|
|
480
|
+
config: TraitConfigSchema.optional()
|
|
481
|
+
});
|
|
482
|
+
z.object({
|
|
483
|
+
name: z.string().min(1, "Page name is required"),
|
|
484
|
+
path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
|
|
485
|
+
primaryEntity: z.string().min(1, "Primary entity is required"),
|
|
486
|
+
traits: z.array(PageTraitRefSchema).min(1, "Page must have at least one trait"),
|
|
487
|
+
title: z.string().optional()
|
|
488
|
+
}).strict();
|
|
489
|
+
var OrbitalPageSchema = z.object({
|
|
490
|
+
name: z.string().min(1, "Page name is required"),
|
|
491
|
+
path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
|
|
492
|
+
viewType: ViewTypeSchema.optional(),
|
|
493
|
+
title: z.string().optional(),
|
|
494
|
+
primaryEntity: z.string().optional(),
|
|
495
|
+
traits: z.array(PageTraitRefSchema).optional(),
|
|
496
|
+
isInitial: z.boolean().optional()
|
|
497
|
+
}).strict();
|
|
498
|
+
var PageSchema = OrbitalPageSchema;
|
|
476
499
|
z.enum([
|
|
477
500
|
"healthcare",
|
|
478
501
|
"education",
|