@almadar/core 10.86.0 → 10.87.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 -4
- package/dist/builders.js +68 -29
- package/dist/builders.js.map +1 -1
- package/dist/{effect-BgDiw_bG.d.ts → effect-DMA97JxX.d.ts} +22 -6
- package/dist/{entityAccess-DK5S_2cT.d.ts → entityAccess-DNDEF75i.d.ts} +2 -2
- package/dist/{expression-Fk8bQWef.d.ts → expression-WfTp2arD.d.ts} +2 -65
- package/dist/factory/index.d.ts +6 -5
- package/dist/factory/index.js +1194 -401
- package/dist/factory/index.js.map +1 -1
- package/dist/factory-runtime/index.d.ts +35 -5
- package/dist/factory-runtime/index.js +127 -52
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/i18n/index.d.ts +111 -1
- package/dist/i18n/index.js +500 -19
- package/dist/i18n/index.js.map +1 -1
- package/dist/{index-ChYsqVJj.d.ts → index-xZP_Ajx3.d.ts} +18 -5
- package/dist/index.d.ts +82 -14
- package/dist/index.js +1876 -333
- package/dist/index.js.map +1 -1
- package/dist/json-D8gmyK3l.d.ts +65 -0
- package/dist/mock/index.d.ts +129 -12
- package/dist/mock/index.js +192 -61
- package/dist/mock/index.js.map +1 -1
- package/dist/patterns/component-mapping.json +1 -1
- package/dist/patterns/event-contracts.json +1 -1
- package/dist/patterns/index.d.ts +2525 -609
- package/dist/patterns/index.js +1238 -384
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/integrators-registry.json +107 -23
- package/dist/patterns/patterns-registry.json +1170 -400
- package/dist/patterns/registry.json +1170 -400
- package/dist/patterns/services-registry.json +170 -35
- package/dist/{schema-BhfQb1oe.d.ts → schema-_SPrm5Ic.d.ts} +46381 -21335
- package/dist/state-machine/index.d.ts +2 -1
- package/dist/trait-9tfq2tQb.d.ts +10554 -0
- package/dist/types/index.d.ts +7 -6
- package/dist/types/index.js +132 -43
- package/dist/types/index.js.map +1 -1
- package/dist/{types-CCAmdxcH.d.ts → types-CjRjhiaO.d.ts} +19 -3
- package/package.json +2 -2
- package/dist/trait-pavNlGqm.d.ts +0 -5385
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { O as OrbitalSchema, a as OrbitalDefinition } from '../schema-
|
|
2
|
-
import { i as CallSiteConfig, j as CallSiteConfigEntry, h as Trait } from '../trait-
|
|
3
|
-
import { E as EntityField, a as EntityPersistence } from '../effect-
|
|
1
|
+
import { O as OrbitalSchema, a as OrbitalDefinition } from '../schema-_SPrm5Ic.js';
|
|
2
|
+
import { g as TraitConfigValue, i as CallSiteConfig, j as CallSiteConfigEntry, h as Trait } from '../trait-9tfq2tQb.js';
|
|
3
|
+
import { E as EntityField, a as EntityPersistence } from '../effect-DMA97JxX.js';
|
|
4
4
|
import { MakeTraitRefOpts } from '../builders.js';
|
|
5
|
-
import '../
|
|
5
|
+
import '../json-D8gmyK3l.js';
|
|
6
|
+
import '../expression-WfTp2arD.js';
|
|
6
7
|
import 'zod';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -25,6 +26,14 @@ interface OrbitalParamsManifest {
|
|
|
25
26
|
paramFields: readonly ParamFieldDescriptor[];
|
|
26
27
|
traitNames: readonly string[];
|
|
27
28
|
inlineTraitNames: readonly string[];
|
|
29
|
+
/**
|
|
30
|
+
* The orbital's own declared config knob names (`Orbital.config`), the
|
|
31
|
+
* `config` param's allow-list. Present only when the orbital declares at
|
|
32
|
+
* least one knob of its own — mirrors `paramFields`' persistence-style
|
|
33
|
+
* gate (see `extractManifest`). Absent means `config` is not a valid
|
|
34
|
+
* top-level param for this orbital at all.
|
|
35
|
+
*/
|
|
36
|
+
configKeys?: readonly string[];
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
/**
|
|
@@ -36,6 +45,13 @@ interface OrbitalParamsManifest {
|
|
|
36
45
|
* @packageDocumentation
|
|
37
46
|
*/
|
|
38
47
|
|
|
48
|
+
/**
|
|
49
|
+
* The param descriptors this orbital actually accepts — the closed L1 delta
|
|
50
|
+
* allow-list, gated per orbital exactly like `persistence`/`collection`
|
|
51
|
+
* (dropped when the entity's persistence mode disallows overrides): `config`
|
|
52
|
+
* is dropped when the orbital declares no config knobs of its own.
|
|
53
|
+
*/
|
|
54
|
+
declare function paramFieldsFor(_orb: OrbitalSchema, orbital: OrbitalSchema['orbitals'][number]): readonly ParamFieldDescriptor[];
|
|
39
55
|
declare function extractManifest(orb: OrbitalSchema): readonly OrbitalParamsManifest[];
|
|
40
56
|
|
|
41
57
|
/**
|
|
@@ -80,6 +96,13 @@ interface OrbitalFactoryParams {
|
|
|
80
96
|
readonly collection?: string;
|
|
81
97
|
/** Per-imported-trait overrides, keyed on the trait's canonical `name`. */
|
|
82
98
|
readonly traitOverrides?: Readonly<Record<string, OrbitalTraitOverride | undefined>>;
|
|
99
|
+
/**
|
|
100
|
+
* Override this orbital's OWN declared config knobs (`Orbital.config`) by
|
|
101
|
+
* key. Only present when the manifest carries `configKeys` (the orbital
|
|
102
|
+
* declares at least one knob of its own); every key must be a member of
|
|
103
|
+
* `configKeys` or validation rejects it.
|
|
104
|
+
*/
|
|
105
|
+
readonly config?: Readonly<Record<string, TraitConfigValue>>;
|
|
83
106
|
}
|
|
84
107
|
/**
|
|
85
108
|
* Discriminated failure shape for params validation against a manifest. Each
|
|
@@ -99,6 +122,13 @@ type ParamValidationError = {
|
|
|
99
122
|
} | {
|
|
100
123
|
readonly kind: 'trait-overrides-not-object';
|
|
101
124
|
readonly received: string;
|
|
125
|
+
} | {
|
|
126
|
+
readonly kind: 'config-not-object';
|
|
127
|
+
readonly received: string;
|
|
128
|
+
} | {
|
|
129
|
+
readonly kind: 'unknown-config-key';
|
|
130
|
+
readonly key: string;
|
|
131
|
+
readonly allowed: readonly string[];
|
|
102
132
|
};
|
|
103
133
|
/** Discriminated result type for validation. Caller never widens. */
|
|
104
134
|
type ParamValidationResult = {
|
|
@@ -286,4 +316,4 @@ declare function applyParamsToOrb(orb: OrbitalSchema, orbitalName: string, _mani
|
|
|
286
316
|
|
|
287
317
|
declare function applyParamsToWholeOrb(orb: OrbitalSchema, manifests: readonly OrbitalParamsManifest[], params: OrbitalFactoryParams): OrbitalSchema;
|
|
288
318
|
|
|
289
|
-
export { type EntityDeclarationRename, type OrbitalFactoryParams, type OrbitalParamsManifest, type OrbitalTraitOverride, type ParamFieldDescriptor, type ParamValidationError, type ParamValidationResult, type WalkableData, applyDeclarationEntityRename, applyDeclarationTraitRenames, applyParamsToOrb, applyParamsToWholeOrb, extractManifest, healEntityLedgerRows, healTraitLedgerRows, mergeCallSiteConfigOverrides, rebindInlineTraitEntity, rewriteEntityInInlineTrait, rewriteTraitRefsInTree, validateOrbitalFactoryParams };
|
|
319
|
+
export { type EntityDeclarationRename, type OrbitalFactoryParams, type OrbitalParamsManifest, type OrbitalTraitOverride, type ParamFieldDescriptor, type ParamValidationError, type ParamValidationResult, type WalkableData, applyDeclarationEntityRename, applyDeclarationTraitRenames, applyParamsToOrb, applyParamsToWholeOrb, extractManifest, healEntityLedgerRows, healTraitLedgerRows, mergeCallSiteConfigOverrides, paramFieldsFor, rebindInlineTraitEntity, rewriteEntityInInlineTrait, rewriteTraitRefsInTree, validateOrbitalFactoryParams };
|
|
@@ -429,6 +429,9 @@ var EntityPersistenceSchema = z.enum([
|
|
|
429
429
|
]);
|
|
430
430
|
var OrbitalEntitySchema = z.object({
|
|
431
431
|
name: z.string().min(1, "Entity name is required"),
|
|
432
|
+
// V4 arena id (`EntityDefinition.id`); declared so the strip-mode zod gate
|
|
433
|
+
// carries an imported entity's id through instead of erasing it.
|
|
434
|
+
id: EntityIdSchema.optional(),
|
|
432
435
|
persistence: EntityPersistenceSchema.default("persistent"),
|
|
433
436
|
shared: z.boolean().optional(),
|
|
434
437
|
// Must stay in step with the Rust serde field (`EntityDefinition.identity`,
|
|
@@ -520,7 +523,8 @@ var PayloadFieldSchema = z.object({
|
|
|
520
523
|
type: z.string().min(1),
|
|
521
524
|
required: z.boolean().optional(),
|
|
522
525
|
properties: z.lazy(() => z.array(PayloadFieldSchema)).optional(),
|
|
523
|
-
typeWhen: z.array(PayloadTypeWhenSchema).optional()
|
|
526
|
+
typeWhen: z.array(PayloadTypeWhenSchema).optional(),
|
|
527
|
+
entity: z.string().min(1).optional()
|
|
524
528
|
});
|
|
525
529
|
var EventSchema = z.object({
|
|
526
530
|
key: z.string().min(1, "Event key is required"),
|
|
@@ -569,6 +573,19 @@ var TraitConfigSchema = z.record(TraitConfigValueSchema);
|
|
|
569
573
|
function isCallSiteConfigDeclaration(entry) {
|
|
570
574
|
return typeof entry === "object" && entry !== null && !Array.isArray(entry) && "type" in entry && typeof entry.type === "string" && "default" in entry;
|
|
571
575
|
}
|
|
576
|
+
function overrideDeclaredKnobs(declared, overrides) {
|
|
577
|
+
const out = { ...declared };
|
|
578
|
+
for (const key of Object.keys(overrides)) {
|
|
579
|
+
const field = declared[key];
|
|
580
|
+
if (field === void 0) {
|
|
581
|
+
throw new Error(
|
|
582
|
+
`overrideDeclaredKnobs: config override "${key}" is not a declared knob (ORB_O_CONFIG_UNKNOWN_KEY). Declared: ${Object.keys(declared).join(", ") || "(none)"}`
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
out[key] = { ...field, default: overrides[key] };
|
|
586
|
+
}
|
|
587
|
+
return out;
|
|
588
|
+
}
|
|
572
589
|
var ConfigFieldItemsDeclarationSchema = z.lazy(
|
|
573
590
|
() => z.object({
|
|
574
591
|
type: z.string().optional(),
|
|
@@ -588,7 +605,8 @@ var ConfigFieldDeclarationSchema = z.object({
|
|
|
588
605
|
values: z.array(z.string()).optional(),
|
|
589
606
|
synonyms: z.string().optional(),
|
|
590
607
|
items: ConfigFieldItemsDeclarationSchema.optional(),
|
|
591
|
-
properties: z.lazy(() => z.record(TraitEntityFieldSchema)).optional()
|
|
608
|
+
properties: z.lazy(() => z.record(TraitEntityFieldSchema)).optional(),
|
|
609
|
+
forwardedFrom: z.string().optional()
|
|
592
610
|
});
|
|
593
611
|
var DeclaredTraitConfigSchema = z.record(
|
|
594
612
|
ConfigFieldDeclarationSchema
|
|
@@ -610,31 +628,32 @@ var TraitCategorySchema = z.enum([
|
|
|
610
628
|
"game-board",
|
|
611
629
|
"game-puzzle"
|
|
612
630
|
]);
|
|
631
|
+
var TRAIT_FIELD_TYPES = [
|
|
632
|
+
"string",
|
|
633
|
+
"number",
|
|
634
|
+
"boolean",
|
|
635
|
+
"date",
|
|
636
|
+
"array",
|
|
637
|
+
"object",
|
|
638
|
+
"timestamp",
|
|
639
|
+
"datetime",
|
|
640
|
+
"enum",
|
|
641
|
+
"email",
|
|
642
|
+
"url",
|
|
643
|
+
"phone",
|
|
644
|
+
"uuid",
|
|
645
|
+
"image",
|
|
646
|
+
"trait",
|
|
647
|
+
"slot",
|
|
648
|
+
"pattern",
|
|
649
|
+
"node",
|
|
650
|
+
"event",
|
|
651
|
+
"scalar",
|
|
652
|
+
"union"
|
|
653
|
+
];
|
|
613
654
|
var TraitEntityFieldSchema = z.object({
|
|
614
655
|
name: z.string().min(1),
|
|
615
|
-
type: z.enum(
|
|
616
|
-
"string",
|
|
617
|
-
"number",
|
|
618
|
-
"boolean",
|
|
619
|
-
"date",
|
|
620
|
-
"array",
|
|
621
|
-
"object",
|
|
622
|
-
"timestamp",
|
|
623
|
-
"datetime",
|
|
624
|
-
"enum",
|
|
625
|
-
"email",
|
|
626
|
-
"url",
|
|
627
|
-
"phone",
|
|
628
|
-
"uuid",
|
|
629
|
-
"image",
|
|
630
|
-
"trait",
|
|
631
|
-
"slot",
|
|
632
|
-
"pattern",
|
|
633
|
-
// `node` was missing here while being a real `TraitFieldType` member
|
|
634
|
-
// — the same latent-drift trap `event` would otherwise repeat.
|
|
635
|
-
"node",
|
|
636
|
-
"event"
|
|
637
|
-
]),
|
|
656
|
+
type: z.enum(TRAIT_FIELD_TYPES),
|
|
638
657
|
required: z.boolean().optional(),
|
|
639
658
|
default: TraitConfigValueSchema.optional(),
|
|
640
659
|
values: z.array(z.string()).optional(),
|
|
@@ -689,7 +708,7 @@ var EventPayloadFieldSchema = z.object({
|
|
|
689
708
|
type: z.string().min(1),
|
|
690
709
|
required: z.boolean().optional(),
|
|
691
710
|
description: z.string().optional(),
|
|
692
|
-
|
|
711
|
+
entity: z.string().optional(),
|
|
693
712
|
properties: z.lazy(() => z.array(EventPayloadFieldSchema)).optional(),
|
|
694
713
|
typeWhen: z.array(PayloadTypeWhenSchema).optional()
|
|
695
714
|
});
|
|
@@ -746,8 +765,7 @@ var TraitEventListenerSchema = z.object({
|
|
|
746
765
|
});
|
|
747
766
|
var RequiredFieldSchema = z.object({
|
|
748
767
|
name: z.string().min(1),
|
|
749
|
-
|
|
750
|
-
type: z.enum(["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum", "email", "url", "phone", "uuid", "image", "trait", "slot", "pattern", "node", "event"]),
|
|
768
|
+
type: z.enum(TRAIT_FIELD_TYPES),
|
|
751
769
|
description: z.string().optional()
|
|
752
770
|
});
|
|
753
771
|
var TraitReferenceSchema = z.object({
|
|
@@ -766,6 +784,7 @@ var TraitReferenceSchema = z.object({
|
|
|
766
784
|
z.string().min(1, "events value (caller event name) must be non-empty")
|
|
767
785
|
).optional(),
|
|
768
786
|
eventIds: z.record(z.string().min(1), EventIdSchema).optional(),
|
|
787
|
+
_resolved: z.lazy(() => TraitSchema).optional(),
|
|
769
788
|
// 3-II type-parameter arguments (see `TraitReference.typeArgs`).
|
|
770
789
|
typeArgs: z.record(
|
|
771
790
|
z.string().min(1, "typeArgs key (declared param name) must be non-empty"),
|
|
@@ -1384,7 +1403,8 @@ var UseDeclarationSchema = z.object({
|
|
|
1384
1403
|
as: z.string().min(1, "Alias is required").regex(
|
|
1385
1404
|
/^[A-Z][a-zA-Z0-9]*$/,
|
|
1386
1405
|
'Alias must be PascalCase (e.g., "Health", "GameCore")'
|
|
1387
|
-
)
|
|
1406
|
+
),
|
|
1407
|
+
config: DeclaredTraitConfigSchema.optional()
|
|
1388
1408
|
});
|
|
1389
1409
|
var ExpectDeclarationSchema = z.discriminatedUnion("kind", [
|
|
1390
1410
|
z.object({
|
|
@@ -1461,6 +1481,25 @@ var PageRefSchema = z.union([
|
|
|
1461
1481
|
PageRefStringSchema,
|
|
1462
1482
|
PageRefObjectSchema
|
|
1463
1483
|
]);
|
|
1484
|
+
var OrbitalRefStringSchema = z.string().regex(
|
|
1485
|
+
/^[A-Z][a-zA-Z0-9]*\.orbitals\.[A-Z][a-zA-Z0-9]*$/,
|
|
1486
|
+
'Orbital reference must be "Alias.orbitals.OrbitalName"'
|
|
1487
|
+
);
|
|
1488
|
+
var OrbitalRefObjectSchema = z.object({
|
|
1489
|
+
ref: OrbitalRefStringSchema,
|
|
1490
|
+
refId: OrbitalIdSchema.optional(),
|
|
1491
|
+
entity: z.string().optional(),
|
|
1492
|
+
fields: z.record(z.string()).optional(),
|
|
1493
|
+
pages: z.record(z.string()).optional(),
|
|
1494
|
+
omit: z.array(z.string()).optional(),
|
|
1495
|
+
only: z.array(z.string()).optional(),
|
|
1496
|
+
config: DeclaredTraitConfigSchema.optional(),
|
|
1497
|
+
events: z.record(z.string()).optional(),
|
|
1498
|
+
roles: z.record(z.string(), z.array(z.string())).optional(),
|
|
1499
|
+
entities: z.record(z.string(), z.string()).optional(),
|
|
1500
|
+
mounts: z.record(z.string(), z.array(z.string())).optional(),
|
|
1501
|
+
extend: z.array(EntityFieldSchema).optional()
|
|
1502
|
+
});
|
|
1464
1503
|
z.string().regex(
|
|
1465
1504
|
/^([A-Z][a-zA-Z0-9]*\.traits\.)?[A-Z][a-zA-Z0-9]*$/,
|
|
1466
1505
|
'Trait reference must be "TraitName" or "Alias.traits.TraitName"'
|
|
@@ -1503,6 +1542,15 @@ var OrbitalDefinitionSchema = z.object({
|
|
|
1503
1542
|
services: z.array(ServiceRefSchema).optional(),
|
|
1504
1543
|
// Components (inline or reference)
|
|
1505
1544
|
entity: EntityRefSchema,
|
|
1545
|
+
// Mirrors the `OrbitalDefinition.auxiliaryEntities` type field — WAS
|
|
1546
|
+
// undeclared here, so `OrbitalSchemaSchema.safeParse` (every load through
|
|
1547
|
+
// `external-loader.ts`) silently stripped it on every externally-loaded
|
|
1548
|
+
// orbital (zod drops unrecognized keys by default), while a schema parsed
|
|
1549
|
+
// directly via `JSON.parse` kept it. Found via the entity-field auto-merge
|
|
1550
|
+
// rebind-target fallback landing on the wrong entity for any RECURSIVELY
|
|
1551
|
+
// loaded `uses` file (`packages/almadar-runtime/src/resolver/
|
|
1552
|
+
// reference-resolver.ts`'s `mergeImportedEntityFieldsIntoOrbital`).
|
|
1553
|
+
auxiliaryEntities: z.array(EntityRefSchema).optional(),
|
|
1506
1554
|
traits: z.array(TraitRefSchema),
|
|
1507
1555
|
pages: z.array(PageRefSchema),
|
|
1508
1556
|
// Event interface (trait-centric model) - computed by resolver
|
|
@@ -1510,6 +1558,10 @@ var OrbitalDefinitionSchema = z.object({
|
|
|
1510
1558
|
listens: z.array(ComputedEventListenerSchema).optional(),
|
|
1511
1559
|
// Filter for exposed events (trait-centric model)
|
|
1512
1560
|
exposes: z.array(z.string()).optional(),
|
|
1561
|
+
// This orbital's own declared knobs (§4.5)
|
|
1562
|
+
config: DeclaredTraitConfigSchema.optional(),
|
|
1563
|
+
// Transient — set by lowering, cleared by inline/resolve
|
|
1564
|
+
reference: OrbitalRefObjectSchema.optional(),
|
|
1513
1565
|
// Context fields - persisted throughout orbital lifecycle
|
|
1514
1566
|
domainContext: DomainContextSchema.optional(),
|
|
1515
1567
|
design: DesignPreferencesSchema.optional(),
|
|
@@ -1517,18 +1569,6 @@ var OrbitalDefinitionSchema = z.object({
|
|
|
1517
1569
|
types: z.record(z.string(), z.array(EventPayloadFieldSchema)).optional()
|
|
1518
1570
|
});
|
|
1519
1571
|
var OrbitalSchema = OrbitalDefinitionSchema;
|
|
1520
|
-
var OrbitalConfigSchema = z.object({
|
|
1521
|
-
theme: z.object({
|
|
1522
|
-
primary: z.string().optional(),
|
|
1523
|
-
secondary: z.string().optional(),
|
|
1524
|
-
mode: z.enum(["light", "dark", "system"]).optional()
|
|
1525
|
-
}).optional(),
|
|
1526
|
-
features: z.record(z.boolean()).optional(),
|
|
1527
|
-
api: z.object({
|
|
1528
|
-
baseUrl: z.string().optional(),
|
|
1529
|
-
timeout: z.number().optional()
|
|
1530
|
-
}).optional()
|
|
1531
|
-
});
|
|
1532
1572
|
var ConfigProvenanceRecordSchema = z.object({
|
|
1533
1573
|
trait: z.string(),
|
|
1534
1574
|
patternPath: z.string().optional(),
|
|
@@ -1554,7 +1594,7 @@ z.object({
|
|
|
1554
1594
|
customPatterns: CustomPatternMapSchema,
|
|
1555
1595
|
orbitals: z.array(OrbitalSchema).min(1, "At least one orbital is required"),
|
|
1556
1596
|
services: z.array(ServiceDefinitionSchema).optional(),
|
|
1557
|
-
config:
|
|
1597
|
+
config: DeclaredTraitConfigSchema.optional(),
|
|
1558
1598
|
_metadata: SchemaMetadataSchema.optional(),
|
|
1559
1599
|
// V4 identity — optional/dual-carry until the Phase-7 flip. Present on
|
|
1560
1600
|
// id-carrying `.orb` files so `parseOrbitalSchema` preserves them instead
|
|
@@ -1628,6 +1668,11 @@ var STATIC_PARAM_FIELDS = [
|
|
|
1628
1668
|
name: "traitOverrides",
|
|
1629
1669
|
type: "Partial<Record<TraitName, { config?, linkedEntity?, events?, name?, emitsScope?, listens? }>>",
|
|
1630
1670
|
description: ".lolo's native trait-composition surface 1:1: per-imported-trait config, linkedEntity, events, name, emitsScope, listens. effects is excluded (atom-owned; use listens via a sibling trait)."
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
name: "config",
|
|
1674
|
+
type: "Readonly<Record<string, TraitConfigValue>>",
|
|
1675
|
+
description: "Override this orbital's own declared config knobs (Orbital.config) by key."
|
|
1631
1676
|
}
|
|
1632
1677
|
];
|
|
1633
1678
|
function entityPersistence(entity) {
|
|
@@ -1636,11 +1681,21 @@ function entityPersistence(entity) {
|
|
|
1636
1681
|
}
|
|
1637
1682
|
return void 0;
|
|
1638
1683
|
}
|
|
1639
|
-
function
|
|
1640
|
-
if (
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1684
|
+
function declaredConfigKeys(config) {
|
|
1685
|
+
if (config === void 0) return void 0;
|
|
1686
|
+
const keys = Object.keys(config).sort();
|
|
1687
|
+
return keys.length > 0 ? keys : void 0;
|
|
1688
|
+
}
|
|
1689
|
+
function paramFieldsFor(_orb, orbital) {
|
|
1690
|
+
const allowPersistenceOverride = persistenceModeAllowsOverrides(entityPersistence(orbital.entity));
|
|
1691
|
+
const hasConfig = declaredConfigKeys(orbital.config) !== void 0;
|
|
1692
|
+
return STATIC_PARAM_FIELDS.filter((f) => {
|
|
1693
|
+
if ((f.name === "persistence" || f.name === "collection") && !allowPersistenceOverride) {
|
|
1694
|
+
return false;
|
|
1695
|
+
}
|
|
1696
|
+
if (f.name === "config" && !hasConfig) return false;
|
|
1697
|
+
return true;
|
|
1698
|
+
});
|
|
1644
1699
|
}
|
|
1645
1700
|
function splitTraits(traits) {
|
|
1646
1701
|
const refTraitNames = [];
|
|
@@ -1661,12 +1716,14 @@ function extractManifest(orb) {
|
|
|
1661
1716
|
const behaviorName = orb.name;
|
|
1662
1717
|
return orb.orbitals.map((orbital) => {
|
|
1663
1718
|
const { refTraitNames, inlineTraitNames } = splitTraits(orbital.traits);
|
|
1719
|
+
const configKeys = declaredConfigKeys(orbital.config);
|
|
1664
1720
|
return {
|
|
1665
1721
|
organism: behaviorName,
|
|
1666
1722
|
orbitalName: orbital.name,
|
|
1667
|
-
paramFields:
|
|
1723
|
+
paramFields: paramFieldsFor(orb, orbital),
|
|
1668
1724
|
traitNames: refTraitNames,
|
|
1669
|
-
inlineTraitNames
|
|
1725
|
+
inlineTraitNames,
|
|
1726
|
+
...configKeys !== void 0 ? { configKeys } : {}
|
|
1670
1727
|
};
|
|
1671
1728
|
});
|
|
1672
1729
|
}
|
|
@@ -1748,6 +1805,21 @@ function validateOrbitalFactoryParams(manifest, raw) {
|
|
|
1748
1805
|
}
|
|
1749
1806
|
}
|
|
1750
1807
|
}
|
|
1808
|
+
if (candidate.config !== void 0) {
|
|
1809
|
+
const cfg = candidate.config;
|
|
1810
|
+
if (cfg === null || typeof cfg !== "object" || Array.isArray(cfg)) {
|
|
1811
|
+
return {
|
|
1812
|
+
ok: false,
|
|
1813
|
+
error: { kind: "config-not-object", received: Array.isArray(cfg) ? "array" : typeof cfg }
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
const allowedKeys = manifest.configKeys ?? [];
|
|
1817
|
+
for (const key of Object.keys(cfg)) {
|
|
1818
|
+
if (!allowedKeys.includes(key)) {
|
|
1819
|
+
return { ok: false, error: { kind: "unknown-config-key", key, allowed: allowedKeys } };
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1751
1823
|
return { ok: true, params: candidate };
|
|
1752
1824
|
}
|
|
1753
1825
|
function assertResolvedEntity(entity, orbitalName, orbName) {
|
|
@@ -1901,8 +1973,8 @@ function rewriteEventContract(contract, oldName, newName) {
|
|
|
1901
1973
|
...contract,
|
|
1902
1974
|
payloadSchema: contract.payloadSchema.map((f) => {
|
|
1903
1975
|
const next = { ...f, type: rewritePayloadFieldType(f.type, oldName, newName) };
|
|
1904
|
-
if (typeof f.
|
|
1905
|
-
next.
|
|
1976
|
+
if (typeof f.entity === "string" && f.entity === oldName) {
|
|
1977
|
+
next.entity = newName;
|
|
1906
1978
|
}
|
|
1907
1979
|
return next;
|
|
1908
1980
|
})
|
|
@@ -2162,6 +2234,9 @@ function applyParamsToOrb(orb, orbitalName, _manifest, params) {
|
|
|
2162
2234
|
traits: rebuildTraits(orbital.traits),
|
|
2163
2235
|
pages: rebuildPages(orbital.pages)
|
|
2164
2236
|
});
|
|
2237
|
+
if (orbital.config !== void 0) {
|
|
2238
|
+
built.config = params.config !== void 0 ? overrideDeclaredKnobs(orbital.config, params.config) : orbital.config;
|
|
2239
|
+
}
|
|
2165
2240
|
if (built.traits && params.traitOverrides !== void 0) {
|
|
2166
2241
|
built.traits = built.traits.map((t) => {
|
|
2167
2242
|
if (!isTraitReferenceObject(t) || typeof t.name !== "string") return t;
|
|
@@ -2219,6 +2294,6 @@ function applyParamsToWholeOrb(orb, manifests, params) {
|
|
|
2219
2294
|
return { ...orb, orbitals: rebuilt };
|
|
2220
2295
|
}
|
|
2221
2296
|
|
|
2222
|
-
export { applyDeclarationEntityRename, applyDeclarationTraitRenames, applyParamsToOrb, applyParamsToWholeOrb, extractManifest, healEntityLedgerRows, healTraitLedgerRows, mergeCallSiteConfigOverrides, rebindInlineTraitEntity, rewriteEntityInInlineTrait, rewriteTraitRefsInTree, validateOrbitalFactoryParams };
|
|
2297
|
+
export { applyDeclarationEntityRename, applyDeclarationTraitRenames, applyParamsToOrb, applyParamsToWholeOrb, extractManifest, healEntityLedgerRows, healTraitLedgerRows, mergeCallSiteConfigOverrides, paramFieldsFor, rebindInlineTraitEntity, rewriteEntityInInlineTrait, rewriteTraitRefsInTree, validateOrbitalFactoryParams };
|
|
2223
2298
|
//# sourceMappingURL=index.js.map
|
|
2224
2299
|
//# sourceMappingURL=index.js.map
|