@almadar/core 10.29.0 → 10.31.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-DcBjE_Uw.d.ts → builders-DDcCVboe.d.ts} +2567 -906
- package/dist/builders.d.ts +3 -3
- package/dist/builders.js +161 -17
- package/dist/builders.js.map +1 -1
- package/dist/factory/index.d.ts +5 -4
- package/dist/factory-runtime/index.d.ts +63 -18
- package/dist/factory-runtime/index.js +202 -94
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/index.d.ts +8 -9
- package/dist/index.js +1308 -592
- package/dist/index.js.map +1 -1
- package/dist/{pattern-types-JZordBZv.d.ts → pattern-types-VDIr2TkX.d.ts} +375 -48
- package/dist/patterns/component-mapping.json +13 -3
- package/dist/patterns/event-contracts.json +10 -3
- package/dist/patterns/index.d.ts +2167 -787
- package/dist/patterns/index.js +1063 -563
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/patterns-registry.json +995 -554
- package/dist/patterns/registry.json +995 -554
- package/dist/{trait-B_CzfDSi.d.ts → trait-DE6VU4Cd.d.ts} +507 -128
- package/dist/types/index.d.ts +47 -19
- package/dist/types/index.js +222 -24
- package/dist/types/index.js.map +1 -1
- package/dist/{types-CGC5A1-T.d.ts → types-DSfz2mr5.d.ts} +3 -59
- package/package.json +1 -1
package/dist/builders.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import './pattern-types-
|
|
2
|
-
export { i as ComposeBehaviorsInput, j as ComposeBehaviorsResult, c7 as ComposeConnection, c8 as ComposePage, a6 as EventWiringEntry, aq as LayoutStrategy, c9 as MakeAtomOrbitalOpts, ca as MakeAtomOrbitalTraitOverrides, cb as MakeEntityOpts, cc as MakeLayoutTraitOpts, cd as MakeOrbitalWithUsesOpts, ce as MakePageOpts, cf as MakePageRefOpts, cg as MakePageRefOptsTyped, M as MakeTraitRefOpts, ch as MakeTraitRefOptsTyped, bS as applyEventWiring, ci as applyTraitConfigOverrides, cj as compose, bT as composeBehaviors, ck as connect, bU as detectLayoutStrategy, cl as ensureIdField, cm as extractTrait, cn as makeAtomOrbital, co as makeEntity, cp as makeLayoutTrait, cq as makeOrbital, cr as makeOrbitalWithUses, cs as makePage, ct as makePageRef, cu as makeRenderUI, cv as makeSchema, cw as makeSlot, cx as makeTraitRef, cy as
|
|
3
|
-
import './trait-
|
|
1
|
+
import './pattern-types-VDIr2TkX.js';
|
|
2
|
+
export { i as ComposeBehaviorsInput, j as ComposeBehaviorsResult, c7 as ComposeConnection, c8 as ComposePage, a6 as EventWiringEntry, aq as LayoutStrategy, c9 as MakeAtomOrbitalOpts, ca as MakeAtomOrbitalTraitOverrides, cb as MakeEntityOpts, cc as MakeLayoutTraitOpts, cd as MakeOrbitalWithUsesOpts, ce as MakePageOpts, cf as MakePageRefOpts, cg as MakePageRefOptsTyped, M as MakeTraitRefOpts, ch as MakeTraitRefOptsTyped, bS as applyEventWiring, ci as applyTraitConfigOverrides, cj as compose, bT as composeBehaviors, ck as connect, bU as detectLayoutStrategy, cl as ensureIdField, cm as extractTrait, cn as makeAtomOrbital, co as makeEntity, cp as makeLayoutTrait, cq as makeOrbital, cr as makeOrbitalWithUses, cs as makePage, ct as makePageRef, cu as makeRenderUI, cv as makeSchema, cw as makeSlot, cx as makeTraitRef, cy as mergeLedgers, cz as mergeOrbitals, cA as pipe, cB as plural, cC as wire } from './builders-DDcCVboe.js';
|
|
3
|
+
import './trait-DE6VU4Cd.js';
|
|
4
4
|
import './expression-CB9R3KWk.js';
|
|
5
5
|
import 'zod';
|
package/dist/builders.js
CHANGED
|
@@ -1,6 +1,85 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
// src/types/orbital.ts
|
|
4
|
+
var ID_PREFIXES = {
|
|
5
|
+
orbital: "orb_",
|
|
6
|
+
entity: "ent_",
|
|
7
|
+
trait: "trt_",
|
|
8
|
+
event: "evt_",
|
|
9
|
+
page: "pag_",
|
|
10
|
+
service: "svc_",
|
|
11
|
+
theme: "thm_",
|
|
12
|
+
palette: "pal_"
|
|
13
|
+
};
|
|
14
|
+
function brand(value) {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function makeIdKind(kind) {
|
|
18
|
+
const prefix = ID_PREFIXES[kind];
|
|
19
|
+
const is = (value) => value.startsWith(prefix) && value.length > prefix.length;
|
|
20
|
+
const as = (value) => {
|
|
21
|
+
if (!is(value)) {
|
|
22
|
+
throw new Error(
|
|
23
|
+
`Expected ${kind} id (prefix "${prefix}"), got: ${JSON.stringify(value)}`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
return brand(value);
|
|
27
|
+
};
|
|
28
|
+
return { prefix, is, as };
|
|
29
|
+
}
|
|
30
|
+
var orbitalKind = makeIdKind("orbital");
|
|
31
|
+
var entityKind = makeIdKind("entity");
|
|
32
|
+
var traitKind = makeIdKind("trait");
|
|
33
|
+
var eventKind = makeIdKind("event");
|
|
34
|
+
var pageKind = makeIdKind("page");
|
|
35
|
+
var serviceKind = makeIdKind("service");
|
|
36
|
+
var themeKind = makeIdKind("theme");
|
|
37
|
+
var paletteKind = makeIdKind("palette");
|
|
38
|
+
var isOrbitalId = orbitalKind.is;
|
|
39
|
+
var isEntityId = entityKind.is;
|
|
40
|
+
var isTraitId = traitKind.is;
|
|
41
|
+
var isEventId = eventKind.is;
|
|
42
|
+
var isPageId = pageKind.is;
|
|
43
|
+
var isServiceId = serviceKind.is;
|
|
44
|
+
var isThemeId = themeKind.is;
|
|
45
|
+
var isPaletteEntryId = paletteKind.is;
|
|
46
|
+
var OrbitalIdSchema = z.string().refine(isOrbitalId, { message: `Expected an orbital id (prefix "${ID_PREFIXES.orbital}")` });
|
|
47
|
+
var EntityIdSchema = z.string().refine(isEntityId, { message: `Expected an entity id (prefix "${ID_PREFIXES.entity}")` });
|
|
48
|
+
var TraitIdSchema = z.string().refine(isTraitId, { message: `Expected a trait id (prefix "${ID_PREFIXES.trait}")` });
|
|
49
|
+
var EventIdSchema = z.string().refine(isEventId, { message: `Expected an event id (prefix "${ID_PREFIXES.event}")` });
|
|
50
|
+
var PageIdSchema = z.string().refine(isPageId, { message: `Expected a page id (prefix "${ID_PREFIXES.page}")` });
|
|
51
|
+
z.string().refine(isServiceId, { message: `Expected a service id (prefix "${ID_PREFIXES.service}")` });
|
|
52
|
+
z.string().refine(isThemeId, { message: `Expected a theme id (prefix "${ID_PREFIXES.theme}")` });
|
|
53
|
+
z.string().refine(isPaletteEntryId, { message: `Expected a palette-entry id (prefix "${ID_PREFIXES.palette}")` });
|
|
54
|
+
var LedgerKindSchema = z.enum([
|
|
55
|
+
"orbital",
|
|
56
|
+
"entity",
|
|
57
|
+
"trait",
|
|
58
|
+
"event",
|
|
59
|
+
"page",
|
|
60
|
+
"service",
|
|
61
|
+
"theme"
|
|
62
|
+
]);
|
|
63
|
+
var LedgerEntrySchema = z.object({
|
|
64
|
+
id: z.string(),
|
|
65
|
+
kind: LedgerKindSchema,
|
|
66
|
+
bakedName: z.string(),
|
|
67
|
+
curName: z.string(),
|
|
68
|
+
renames: z.array(
|
|
69
|
+
z.object({ from: z.string(), to: z.string(), at: z.string() })
|
|
70
|
+
),
|
|
71
|
+
owner: z.enum(["std", "io", "workspace"]),
|
|
72
|
+
parent: TraitIdSchema.optional()
|
|
73
|
+
});
|
|
74
|
+
z.object({
|
|
75
|
+
schemaVersion: z.literal(1),
|
|
76
|
+
entries: z.record(LedgerEntrySchema)
|
|
77
|
+
});
|
|
78
|
+
var JsonValueSchema = z.lazy(
|
|
79
|
+
() => z.union([z.string(), z.number(), z.boolean(), z.null(), z.array(JsonValueSchema), z.record(JsonValueSchema)])
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
// src/types/field.ts
|
|
4
83
|
z.enum([
|
|
5
84
|
"string",
|
|
6
85
|
"number",
|
|
@@ -25,6 +104,7 @@ var RelationCardinalitySchema = z.enum([
|
|
|
25
104
|
]);
|
|
26
105
|
var RelationConfigSchema = z.object({
|
|
27
106
|
entity: z.string().min(1, "Target entity is required"),
|
|
107
|
+
entityId: EntityIdSchema.optional(),
|
|
28
108
|
field: z.string().optional(),
|
|
29
109
|
cardinality: RelationCardinalitySchema.optional(),
|
|
30
110
|
onDelete: z.enum(["cascade", "nullify", "restrict"]).optional(),
|
|
@@ -35,6 +115,7 @@ var RelationConfigSchema = z.object({
|
|
|
35
115
|
}).transform((data) => {
|
|
36
116
|
const normalized = {
|
|
37
117
|
entity: data.entity || data.target || "",
|
|
118
|
+
entityId: data.entityId,
|
|
38
119
|
cardinality: data.cardinality || data.type,
|
|
39
120
|
field: data.field,
|
|
40
121
|
onDelete: data.onDelete
|
|
@@ -62,7 +143,7 @@ var EntityFieldSchema = z.lazy(() => {
|
|
|
62
143
|
const baseFieldShape = {
|
|
63
144
|
name: z.string().min(1, "Field name is required").optional(),
|
|
64
145
|
required: z.boolean().optional(),
|
|
65
|
-
default:
|
|
146
|
+
default: JsonValueSchema.optional(),
|
|
66
147
|
format: FieldFormatSchema.optional(),
|
|
67
148
|
min: z.number().optional(),
|
|
68
149
|
max: z.number().optional(),
|
|
@@ -326,6 +407,7 @@ var PayloadFieldSchema = z.object({
|
|
|
326
407
|
});
|
|
327
408
|
var EventSchema = z.object({
|
|
328
409
|
key: z.string().min(1, "Event key is required"),
|
|
410
|
+
id: EventIdSchema.optional(),
|
|
329
411
|
name: z.string().min(1, "Event name is required"),
|
|
330
412
|
description: z.string().optional(),
|
|
331
413
|
synonyms: z.string().optional(),
|
|
@@ -343,6 +425,7 @@ var TransitionSchema = z.object({
|
|
|
343
425
|
from: z.string().min(1, "Transition source state is required"),
|
|
344
426
|
to: z.string().min(1, "Transition target state is required"),
|
|
345
427
|
event: z.string().min(1, "Transition event is required"),
|
|
428
|
+
eventId: EventIdSchema.optional(),
|
|
346
429
|
guard: ExpressionSchema.nullish(),
|
|
347
430
|
effects: z.array(EffectSchema).optional(),
|
|
348
431
|
description: z.string().nullish()
|
|
@@ -379,6 +462,7 @@ var ConfigFieldItemsDeclarationSchema = z.lazy(
|
|
|
379
462
|
var ConfigFieldDeclarationSchema = z.object({
|
|
380
463
|
type: z.string(),
|
|
381
464
|
default: TraitConfigValueSchema.optional(),
|
|
465
|
+
refId: z.string().optional(),
|
|
382
466
|
required: z.boolean().optional(),
|
|
383
467
|
label: z.string().optional(),
|
|
384
468
|
description: z.string().optional(),
|
|
@@ -422,7 +506,7 @@ var TraitEntityFieldSchema = z.object({
|
|
|
422
506
|
"enum"
|
|
423
507
|
]),
|
|
424
508
|
required: z.boolean().optional(),
|
|
425
|
-
default:
|
|
509
|
+
default: TraitConfigValueSchema.optional(),
|
|
426
510
|
values: z.array(z.string()).optional(),
|
|
427
511
|
items: ConfigFieldItemsDeclarationSchema.optional(),
|
|
428
512
|
properties: z.lazy(() => z.record(TraitEntityFieldSchema)).optional()
|
|
@@ -444,9 +528,11 @@ var TraitTickSchema = z.object({
|
|
|
444
528
|
interval: z.union([z.literal("frame"), z.number().positive()]),
|
|
445
529
|
appliesTo: z.array(z.string()).optional(),
|
|
446
530
|
pages: z.array(z.string()).optional(),
|
|
531
|
+
pageIds: z.array(PageIdSchema).optional(),
|
|
447
532
|
guard: ExpressionSchema.optional(),
|
|
448
533
|
effects: z.array(EffectSchema).min(1),
|
|
449
|
-
emits: z.array(z.string()).optional()
|
|
534
|
+
emits: z.array(z.string()).optional(),
|
|
535
|
+
emitIds: z.array(EventIdSchema).optional()
|
|
450
536
|
});
|
|
451
537
|
var EventScopeSchema = z.enum(["internal", "external"]);
|
|
452
538
|
var EventPayloadFieldSchema = z.object({
|
|
@@ -481,6 +567,7 @@ var TraitEventContractSchema = z.object({
|
|
|
481
567
|
/^([A-Za-z][A-Za-z0-9_]*|@config\.[A-Za-z_][A-Za-z0-9_]*)$/,
|
|
482
568
|
"Event name must start with a letter and contain only letters, digits, and underscores, or be a `@config.<knob>` reference"
|
|
483
569
|
),
|
|
570
|
+
eventId: EventIdSchema.optional(),
|
|
484
571
|
description: z.string().optional(),
|
|
485
572
|
synonyms: z.string().optional(),
|
|
486
573
|
tier: z.string().optional(),
|
|
@@ -489,16 +576,24 @@ var TraitEventContractSchema = z.object({
|
|
|
489
576
|
});
|
|
490
577
|
var ListenSourceSchema = z.union([
|
|
491
578
|
z.object({ kind: z.literal("any") }),
|
|
492
|
-
z.object({
|
|
579
|
+
z.object({
|
|
580
|
+
kind: z.literal("trait"),
|
|
581
|
+
trait: z.string().min(1),
|
|
582
|
+
traitId: TraitIdSchema.optional()
|
|
583
|
+
}),
|
|
493
584
|
z.object({
|
|
494
585
|
kind: z.literal("orbital"),
|
|
495
586
|
orbital: z.string().min(1),
|
|
496
|
-
trait: z.string().min(1)
|
|
587
|
+
trait: z.string().min(1),
|
|
588
|
+
orbitalId: OrbitalIdSchema.optional(),
|
|
589
|
+
traitId: TraitIdSchema.optional()
|
|
497
590
|
})
|
|
498
591
|
]);
|
|
499
592
|
var TraitEventListenerSchema = z.object({
|
|
500
593
|
event: z.string().min(1),
|
|
594
|
+
eventId: EventIdSchema.optional(),
|
|
501
595
|
triggers: z.string().min(1),
|
|
596
|
+
triggersId: EventIdSchema.optional(),
|
|
502
597
|
description: z.string().optional(),
|
|
503
598
|
synonyms: z.string().optional(),
|
|
504
599
|
tier: z.string().optional(),
|
|
@@ -514,14 +609,20 @@ var RequiredFieldSchema = z.object({
|
|
|
514
609
|
});
|
|
515
610
|
z.object({
|
|
516
611
|
ref: z.string().min(1),
|
|
612
|
+
refId: TraitIdSchema.optional(),
|
|
613
|
+
// V4 local declaration id (see the interface doc) — declared so the
|
|
614
|
+
// strip-mode zod gate carries it through instead of dropping it.
|
|
615
|
+
id: TraitIdSchema.optional(),
|
|
517
616
|
// Phase 1.2: optional registry path disambiguator, pairs with `ref`.
|
|
518
617
|
from: z.string().optional(),
|
|
519
618
|
linkedEntity: z.string().optional(),
|
|
619
|
+
linkedEntityId: EntityIdSchema.optional(),
|
|
520
620
|
name: z.string().optional(),
|
|
521
621
|
events: z.record(
|
|
522
622
|
z.string().min(1, "events key (atom event name) must be non-empty"),
|
|
523
623
|
z.string().min(1, "events value (caller event name) must be non-empty")
|
|
524
624
|
).optional(),
|
|
625
|
+
eventIds: z.record(z.string().min(1), EventIdSchema).optional(),
|
|
525
626
|
fields: z.record(
|
|
526
627
|
z.string().min(1, "fields key (canonical field name) must be non-empty"),
|
|
527
628
|
z.string().min(1, "fields value (consumer field name) must be non-empty")
|
|
@@ -540,12 +641,11 @@ z.object({
|
|
|
540
641
|
listens: z.array(z.unknown()).optional(),
|
|
541
642
|
emitsScope: z.enum(["internal", "external"]).optional(),
|
|
542
643
|
// Phase F.8: per-transition effects override. The keys are event
|
|
543
|
-
// names (the transition triggers AFTER renames)
|
|
544
|
-
//
|
|
545
|
-
// shape during application, so the schema accepts loose `unknown[]`.
|
|
644
|
+
// names (the transition triggers AFTER renames); values are SExpr
|
|
645
|
+
// effect tuples.
|
|
546
646
|
effects: z.record(
|
|
547
647
|
z.string().min(1, "effects override key (event name) must be non-empty"),
|
|
548
|
-
z.array(
|
|
648
|
+
z.array(SExprSchema)
|
|
549
649
|
).optional()
|
|
550
650
|
}).refine(
|
|
551
651
|
(ref) => {
|
|
@@ -571,6 +671,7 @@ var SourceBehaviorMetadataSchema = z.object({
|
|
|
571
671
|
originalName: z.string().min(1)
|
|
572
672
|
});
|
|
573
673
|
var TraitSchema = z.object({
|
|
674
|
+
id: TraitIdSchema.optional(),
|
|
574
675
|
name: z.string().min(1),
|
|
575
676
|
description: z.string().optional(),
|
|
576
677
|
description_visual_prompt: z.string().optional(),
|
|
@@ -582,6 +683,9 @@ var TraitSchema = z.object({
|
|
|
582
683
|
capabilities: z.array(z.string()).optional(),
|
|
583
684
|
scope: TraitScopeSchema,
|
|
584
685
|
linkedEntity: z.string().optional(),
|
|
686
|
+
linkedEntityId: EntityIdSchema.optional(),
|
|
687
|
+
entityRefIds: z.record(z.string().min(1), EntityIdSchema).optional(),
|
|
688
|
+
traitEmbedIds: z.record(z.string().min(1), TraitIdSchema).optional(),
|
|
585
689
|
requiredFields: z.array(RequiredFieldSchema).optional(),
|
|
586
690
|
dataEntities: z.array(TraitDataEntitySchema).optional(),
|
|
587
691
|
stateMachine: StateMachineSchema.optional(),
|
|
@@ -627,10 +731,13 @@ var ViewTypeSchema = z.enum([
|
|
|
627
731
|
]);
|
|
628
732
|
var PageTraitRefSchema = z.object({
|
|
629
733
|
ref: z.string().min(1, "Trait ref is required"),
|
|
734
|
+
refId: TraitIdSchema.optional(),
|
|
630
735
|
linkedEntity: z.string().optional(),
|
|
736
|
+
linkedEntityId: EntityIdSchema.optional(),
|
|
631
737
|
config: TraitConfigSchema.optional()
|
|
632
738
|
});
|
|
633
739
|
z.object({
|
|
740
|
+
id: PageIdSchema.optional(),
|
|
634
741
|
name: z.string().min(1, "Page name is required"),
|
|
635
742
|
path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
|
|
636
743
|
primaryEntity: z.string().min(1, "Primary entity is required"),
|
|
@@ -638,6 +745,7 @@ z.object({
|
|
|
638
745
|
title: z.string().optional()
|
|
639
746
|
}).strict();
|
|
640
747
|
var OrbitalPageSchema = z.object({
|
|
748
|
+
id: PageIdSchema.optional(),
|
|
641
749
|
name: z.string().min(1, "Page name is required"),
|
|
642
750
|
path: z.string().min(1, "Page path is required").startsWith("/", "Path must start with /"),
|
|
643
751
|
viewType: ViewTypeSchema.optional(),
|
|
@@ -1159,11 +1267,14 @@ var PageRefStringSchema = z.string().regex(
|
|
|
1159
1267
|
);
|
|
1160
1268
|
var PageRefObjectSchema = z.object({
|
|
1161
1269
|
ref: PageRefStringSchema,
|
|
1270
|
+
refId: PageIdSchema.optional(),
|
|
1162
1271
|
// Phase 1.2: optional registry path disambiguator, pairs with `ref`.
|
|
1163
1272
|
from: z.string().optional(),
|
|
1164
1273
|
path: z.string().startsWith("/").optional(),
|
|
1165
1274
|
linkedEntity: z.string().optional(),
|
|
1166
|
-
|
|
1275
|
+
linkedEntityId: EntityIdSchema.optional(),
|
|
1276
|
+
traits: z.array(TraitRefSchema).optional(),
|
|
1277
|
+
traitRefIds: z.array(TraitIdSchema).optional()
|
|
1167
1278
|
});
|
|
1168
1279
|
var PageRefSchema = z.union([
|
|
1169
1280
|
PageSchema,
|
|
@@ -1204,6 +1315,7 @@ var ComputedEventListenerSchema = z.object({
|
|
|
1204
1315
|
payloadMapping: z.record(z.string()).optional()
|
|
1205
1316
|
});
|
|
1206
1317
|
z.object({
|
|
1318
|
+
id: OrbitalIdSchema.optional(),
|
|
1207
1319
|
name: z.string().min(1, "Orbital name is required"),
|
|
1208
1320
|
description: z.string().optional(),
|
|
1209
1321
|
visual_prompt: z.string().optional(),
|
|
@@ -1386,13 +1498,40 @@ function applyEventWiring(orbitals, wiring) {
|
|
|
1386
1498
|
}
|
|
1387
1499
|
|
|
1388
1500
|
// src/builders/compose-behaviors.ts
|
|
1501
|
+
function isSchema(input) {
|
|
1502
|
+
return "orbitals" in input && Array.isArray(input.orbitals);
|
|
1503
|
+
}
|
|
1389
1504
|
function asDefinitions(inputs) {
|
|
1390
|
-
return inputs.flatMap(
|
|
1391
|
-
|
|
1392
|
-
|
|
1505
|
+
return inputs.flatMap(
|
|
1506
|
+
(input) => isSchema(input) ? input.orbitals : [input]
|
|
1507
|
+
);
|
|
1508
|
+
}
|
|
1509
|
+
function mergeLedgers(inputs) {
|
|
1510
|
+
const merged = /* @__PURE__ */ new Map();
|
|
1511
|
+
let sawLedger = false;
|
|
1512
|
+
for (const input of inputs) {
|
|
1513
|
+
if (!isSchema(input) || input.ledger === void 0) continue;
|
|
1514
|
+
sawLedger = true;
|
|
1515
|
+
for (const [id, entry] of Object.entries(input.ledger.entries)) {
|
|
1516
|
+
if (!merged.has(id)) merged.set(id, entry);
|
|
1393
1517
|
}
|
|
1394
|
-
|
|
1395
|
-
|
|
1518
|
+
}
|
|
1519
|
+
if (!sawLedger) return void 0;
|
|
1520
|
+
const entries = {};
|
|
1521
|
+
for (const [id, entry] of [...merged.entries()].sort(
|
|
1522
|
+
([a], [b]) => a < b ? -1 : a > b ? 1 : 0
|
|
1523
|
+
)) {
|
|
1524
|
+
entries[id] = entry;
|
|
1525
|
+
}
|
|
1526
|
+
return { schemaVersion: 1, entries };
|
|
1527
|
+
}
|
|
1528
|
+
function mergeSchemaVersions(inputs) {
|
|
1529
|
+
let max;
|
|
1530
|
+
for (const input of inputs) {
|
|
1531
|
+
if (!isSchema(input) || input.schemaVersion === void 0) continue;
|
|
1532
|
+
max = max === void 0 ? input.schemaVersion : Math.max(max, input.schemaVersion);
|
|
1533
|
+
}
|
|
1534
|
+
return max;
|
|
1396
1535
|
}
|
|
1397
1536
|
function toKebabCase(name) {
|
|
1398
1537
|
return name.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
@@ -1462,10 +1601,14 @@ function composeBehaviors(input) {
|
|
|
1462
1601
|
pages: page ? [page] : []
|
|
1463
1602
|
};
|
|
1464
1603
|
});
|
|
1604
|
+
const ledger = mergeLedgers(rawInputs);
|
|
1605
|
+
const schemaVersion = mergeSchemaVersions(rawInputs);
|
|
1465
1606
|
const schema = {
|
|
1466
1607
|
name: appName,
|
|
1467
1608
|
version: "1.0.0",
|
|
1468
|
-
orbitals: orbitalsWithPages
|
|
1609
|
+
orbitals: orbitalsWithPages,
|
|
1610
|
+
...schemaVersion !== void 0 ? { schemaVersion } : {},
|
|
1611
|
+
...ledger !== void 0 ? { ledger } : {}
|
|
1469
1612
|
};
|
|
1470
1613
|
return {
|
|
1471
1614
|
schema,
|
|
@@ -1604,6 +1747,7 @@ function makeTraitRef(opts) {
|
|
|
1604
1747
|
if (opts.from !== void 0) ref.from = opts.from;
|
|
1605
1748
|
if (opts.name !== void 0) ref.name = opts.name;
|
|
1606
1749
|
if (opts.linkedEntity !== void 0) ref.linkedEntity = opts.linkedEntity;
|
|
1750
|
+
if (opts.linkedEntityId !== void 0) ref.linkedEntityId = opts.linkedEntityId;
|
|
1607
1751
|
if (opts.events !== void 0) ref.events = opts.events;
|
|
1608
1752
|
if (opts.fields !== void 0) ref.fields = opts.fields;
|
|
1609
1753
|
if (opts.effects !== void 0) ref.effects = opts.effects;
|
|
@@ -1805,6 +1949,6 @@ function pipe(orbitals, events, appName) {
|
|
|
1805
1949
|
};
|
|
1806
1950
|
}
|
|
1807
1951
|
|
|
1808
|
-
export { applyEventWiring, applyTraitConfigOverrides, compose, composeBehaviors, connect, detectLayoutStrategy, ensureIdField, extractTrait, makeAtomOrbital, makeEntity, makeLayoutTrait, makeOrbital, makeOrbitalWithUses, makePage, makePageRef, makeRenderUI, makeSchema, makeSlot, makeTraitRef, mergeOrbitals, pipe, plural, wire };
|
|
1952
|
+
export { applyEventWiring, applyTraitConfigOverrides, compose, composeBehaviors, connect, detectLayoutStrategy, ensureIdField, extractTrait, makeAtomOrbital, makeEntity, makeLayoutTrait, makeOrbital, makeOrbitalWithUses, makePage, makePageRef, makeRenderUI, makeSchema, makeSlot, makeTraitRef, mergeLedgers, mergeOrbitals, pipe, plural, wire };
|
|
1809
1953
|
//# sourceMappingURL=builders.js.map
|
|
1810
1954
|
//# sourceMappingURL=builders.js.map
|