@almadar/core 10.28.0 → 10.29.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-BN3WLFYM.d.ts → builders-DcBjE_Uw.d.ts} +308 -2306
- package/dist/builders.d.ts +4 -4
- package/dist/builders.js +23 -7
- package/dist/builders.js.map +1 -1
- package/dist/{expression-C6X4A8L7.d.ts → expression-CB9R3KWk.d.ts} +4 -1
- package/dist/factory/index.d.ts +5 -5
- package/dist/factory-runtime/index.d.ts +21 -5
- package/dist/factory-runtime/index.js +85 -9
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/index.d.ts +50 -10
- package/dist/index.js +631 -24
- package/dist/index.js.map +1 -1
- package/dist/pattern-types-JZordBZv.d.ts +4635 -0
- package/dist/patterns/component-mapping.json +1 -1
- package/dist/patterns/event-contracts.json +1 -1
- package/dist/patterns/index.d.ts +1003 -24
- package/dist/patterns/index.js +460 -13
- package/dist/patterns/index.js.map +1 -1
- package/dist/patterns/patterns-registry.json +458 -11
- package/dist/patterns/registry.json +458 -11
- package/dist/state-machine/index.d.ts +1 -1
- package/dist/{trait-DZkS625T.d.ts → trait-B_CzfDSi.d.ts} +187 -643
- package/dist/types/index.d.ts +17 -12
- package/dist/types/index.js +69 -12
- package/dist/types/index.js.map +1 -1
- package/dist/{types-DFn3sWpV.d.ts → types-CGC5A1-T.d.ts} +45 -2
- package/package.json +1 -1
- package/src/types/bindings.ts +8 -2
- package/dist/pattern-types-BeQXwgpZ.d.ts +0 -4584
|
@@ -129,8 +129,11 @@ interface ParsedBinding {
|
|
|
129
129
|
* `user` is the authenticated user / agent context (see binding.ts) and is
|
|
130
130
|
* read-only in guards/effects/ticks — atoms reference `@user.id` and
|
|
131
131
|
* `@user.role` for ownership / role-based gating.
|
|
132
|
+
* `callsitePayload` is the call-site-captured event payload emitted by the
|
|
133
|
+
* compiler's inline-trait hoisting; the runtime BindingResolver resolves it
|
|
134
|
+
* at the composing effect.
|
|
132
135
|
*/
|
|
133
|
-
declare const CORE_BINDINGS: readonly ["entity", "payload", "state", "now", "config", "computed", "trait", "user"];
|
|
136
|
+
declare const CORE_BINDINGS: readonly ["entity", "payload", "state", "now", "config", "computed", "trait", "user", "callsitePayload"];
|
|
134
137
|
type CoreBinding = (typeof CORE_BINDINGS)[number];
|
|
135
138
|
/**
|
|
136
139
|
* Parses a binding reference into its components.
|
package/dist/factory/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { h as FactoryParamValue, c as FactoryConfigTier, b as FactoryConfigParam, F as FactoryCallSite, j as FactorySignature, R as RuleOverlay, r as RuleOverlayEntry, q as PresentationOverlay, s as TraitOverlay } from '../types-
|
|
2
|
-
export { a as FactoryCallSiteParams, d as FactoryEntitySignature, e as FactoryEventSignature, f as FactoryExposure, g as FactoryPageSignature, i as FactoryProvenance, k as FactorySignatureCatalog, l as FactorySignatureEntityField, m as FactoryTraitSignature, o as JsonSchema, p as JsonSchemaType, J as JsonValue, O as OwnershipOverlayEntry, P as PresentationNavItem, S as SchemaFieldType, t as TraitOverlayEntry, u as TraitOverlayListener } from '../types-
|
|
3
|
-
import { a as EntityPersistence, E as EntityField } from '../pattern-types-
|
|
4
|
-
import { a as TraitReference } from '../trait-
|
|
1
|
+
import { h as FactoryParamValue, c as FactoryConfigTier, b as FactoryConfigParam, F as FactoryCallSite, j as FactorySignature, R as RuleOverlay, r as RuleOverlayEntry, q as PresentationOverlay, s as TraitOverlay } from '../types-CGC5A1-T.js';
|
|
2
|
+
export { a as FactoryCallSiteParams, d as FactoryEntitySignature, e as FactoryEventSignature, f as FactoryExposure, g as FactoryPageSignature, i as FactoryProvenance, k as FactorySignatureCatalog, l as FactorySignatureEntityField, m as FactoryTraitSignature, o as JsonSchema, p as JsonSchemaType, J as JsonValue, O as OwnershipOverlayEntry, P as PresentationNavItem, S as SchemaFieldType, t as TraitOverlayEntry, u as TraitOverlayListener } from '../types-CGC5A1-T.js';
|
|
3
|
+
import { a as EntityPersistence, E as EntityField } from '../pattern-types-JZordBZv.js';
|
|
4
|
+
import { a as TraitReference } from '../trait-B_CzfDSi.js';
|
|
5
5
|
import 'zod';
|
|
6
|
-
import '../expression-
|
|
6
|
+
import '../expression-CB9R3KWk.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Typed questionnaire surface — shapes the studio renders + answers.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { O as OrbitalSchema, M as MakeTraitRefOpts, a as OrbitalDefinition } from '../builders-
|
|
2
|
-
import { C as CallSiteConfig, b as CallSiteConfigEntry, c as Trait } from '../trait-
|
|
3
|
-
import { E as EntityField, a as EntityPersistence } from '../pattern-types-
|
|
1
|
+
import { O as OrbitalSchema, M as MakeTraitRefOpts, a as OrbitalDefinition } from '../builders-DcBjE_Uw.js';
|
|
2
|
+
import { C as CallSiteConfig, b as CallSiteConfigEntry, c as Trait } from '../trait-B_CzfDSi.js';
|
|
3
|
+
import { E as EntityField, a as EntityPersistence } from '../pattern-types-JZordBZv.js';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import '../expression-
|
|
5
|
+
import '../expression-CB9R3KWk.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Orbital factory manifest types — shared across all packages.
|
|
@@ -148,6 +148,22 @@ declare function rewriteEntityInInlineTrait(trait: Trait, oldName: string, newNa
|
|
|
148
148
|
* - generated `mergeExtraTraitWithOverlay` in dispatch.ts
|
|
149
149
|
*/
|
|
150
150
|
declare function mergeCallSiteConfigOverrides(base: CallSiteConfig, overrides: CallSiteConfig): Record<string, CallSiteConfigEntry>;
|
|
151
|
+
/**
|
|
152
|
+
* Rewrite every reference to a renamed trait so a
|
|
153
|
+
* `traitOverrides.<T>.name` override keeps the orbital internally
|
|
154
|
+
* consistent. A rename changes ONLY the trait's local name; without this
|
|
155
|
+
* pass the factory output still carries the canonical name in:
|
|
156
|
+
* - `pages[].traits[].ref` (→ ORB_P_INVALID_TRAIT_REF: "referenced on
|
|
157
|
+
* page does not exist" — the exact demotion storm the dashboard
|
|
158
|
+
* param-fill hit when the LLM renamed its chart traits), and
|
|
159
|
+
* - `@trait.<canonical>` tokens inside sibling traits' config (layout
|
|
160
|
+
* tile slots like `tile1Trait: "@trait.DefaultRevenueChart"`).
|
|
161
|
+
*
|
|
162
|
+
* Single canonical implementation shared by `applyParamsToOrb` (runtime
|
|
163
|
+
* factory overlay) and every generated factory body (via the packages'
|
|
164
|
+
* `factory-runtime` re-export shims). Pure — returns a new definition.
|
|
165
|
+
*/
|
|
166
|
+
declare function applyTraitRenames(orbital: OrbitalDefinition, renames: ReadonlyMap<string, string>): OrbitalDefinition;
|
|
151
167
|
/**
|
|
152
168
|
* The overlay. Resolves the effective entity name + collection, calls
|
|
153
169
|
* `makeOrbitalWithUses` with the rewritten data, then applies the params'
|
|
@@ -171,4 +187,4 @@ declare function applyParamsToOrb(orb: OrbitalSchema, orbitalName: string, _mani
|
|
|
171
187
|
|
|
172
188
|
declare function applyParamsToWholeOrb(orb: OrbitalSchema, manifests: readonly OrbitalParamsManifest[], params: OrbitalFactoryParams): OrbitalSchema;
|
|
173
189
|
|
|
174
|
-
export { type OrbitalFactoryParams, type OrbitalParamsManifest, type OrbitalTraitOverride, type ParamFieldDescriptor, type ParamValidationError, type ParamValidationResult, applyParamsToOrb, applyParamsToWholeOrb, extractManifest, mergeCallSiteConfigOverrides, rebindInlineTraitEntity, rewriteEntityInInlineTrait, validateOrbitalFactoryParams };
|
|
190
|
+
export { type OrbitalFactoryParams, type OrbitalParamsManifest, type OrbitalTraitOverride, type ParamFieldDescriptor, type ParamValidationError, type ParamValidationResult, applyParamsToOrb, applyParamsToWholeOrb, applyTraitRenames, extractManifest, mergeCallSiteConfigOverrides, rebindInlineTraitEntity, rewriteEntityInInlineTrait, validateOrbitalFactoryParams };
|
|
@@ -324,7 +324,8 @@ var StateSchema = z.object({
|
|
|
324
324
|
var PayloadFieldSchema = z.object({
|
|
325
325
|
name: z.string().min(1),
|
|
326
326
|
type: z.string().min(1),
|
|
327
|
-
required: z.boolean().optional()
|
|
327
|
+
required: z.boolean().optional(),
|
|
328
|
+
properties: z.lazy(() => z.array(PayloadFieldSchema)).optional()
|
|
328
329
|
});
|
|
329
330
|
var EventSchema = z.object({
|
|
330
331
|
key: z.string().min(1, "Event key is required"),
|
|
@@ -371,14 +372,24 @@ var TraitConfigSchema = z.record(TraitConfigValueSchema);
|
|
|
371
372
|
function isCallSiteConfigDeclaration(entry) {
|
|
372
373
|
return typeof entry === "object" && entry !== null && !Array.isArray(entry) && "type" in entry && typeof entry.type === "string" && "default" in entry;
|
|
373
374
|
}
|
|
375
|
+
var ConfigFieldItemsDeclarationSchema = z.lazy(
|
|
376
|
+
() => z.object({
|
|
377
|
+
type: z.string().optional(),
|
|
378
|
+
properties: z.record(TraitEntityFieldSchema).optional(),
|
|
379
|
+
items: ConfigFieldItemsDeclarationSchema.optional()
|
|
380
|
+
})
|
|
381
|
+
);
|
|
374
382
|
var ConfigFieldDeclarationSchema = z.object({
|
|
375
383
|
type: z.string(),
|
|
376
384
|
default: TraitConfigValueSchema.optional(),
|
|
385
|
+
required: z.boolean().optional(),
|
|
377
386
|
label: z.string().optional(),
|
|
378
387
|
description: z.string().optional(),
|
|
379
388
|
tier: z.string().optional(),
|
|
380
389
|
values: z.array(z.string()).optional(),
|
|
381
|
-
synonyms: z.string().optional()
|
|
390
|
+
synonyms: z.string().optional(),
|
|
391
|
+
items: ConfigFieldItemsDeclarationSchema.optional(),
|
|
392
|
+
properties: z.lazy(() => z.record(TraitEntityFieldSchema)).optional()
|
|
382
393
|
});
|
|
383
394
|
var DeclaredTraitConfigSchema = z.record(
|
|
384
395
|
ConfigFieldDeclarationSchema
|
|
@@ -415,7 +426,9 @@ var TraitEntityFieldSchema = z.object({
|
|
|
415
426
|
]),
|
|
416
427
|
required: z.boolean().optional(),
|
|
417
428
|
default: z.unknown().optional(),
|
|
418
|
-
values: z.array(z.string()).optional()
|
|
429
|
+
values: z.array(z.string()).optional(),
|
|
430
|
+
items: ConfigFieldItemsDeclarationSchema.optional(),
|
|
431
|
+
properties: z.lazy(() => z.record(TraitEntityFieldSchema)).optional()
|
|
419
432
|
});
|
|
420
433
|
var TraitDataEntitySchema = z.object({
|
|
421
434
|
name: z.string().min(1),
|
|
@@ -454,7 +467,8 @@ var EventPayloadFieldSchema = z.object({
|
|
|
454
467
|
type: z.string().min(1),
|
|
455
468
|
required: z.boolean().optional(),
|
|
456
469
|
description: z.string().optional(),
|
|
457
|
-
entityType: z.string().optional()
|
|
470
|
+
entityType: z.string().optional(),
|
|
471
|
+
properties: z.lazy(() => z.array(EventPayloadFieldSchema)).optional()
|
|
458
472
|
});
|
|
459
473
|
var TraitEventContractSchema = z.object({
|
|
460
474
|
/**
|
|
@@ -462,11 +476,13 @@ var TraitEventContractSchema = z.object({
|
|
|
462
476
|
* starts with a letter, then any letters / digits / underscores. Both
|
|
463
477
|
* UPPER_SNAKE_CASE and PascalCase shapes are valid identifiers in the
|
|
464
478
|
* post-Phase 2.5 nominal-event type system (events declared via
|
|
465
|
-
* `type X = Event<T>`).
|
|
479
|
+
* `type X = Event<T>`). A pre-resolution `@config.<knob>` reference
|
|
480
|
+
* (Option B) is also legal — inline/resolve substitutes it with the
|
|
481
|
+
* knob's effective literal before codegen/runtime consume it.
|
|
466
482
|
*/
|
|
467
483
|
event: z.string().min(1).regex(
|
|
468
|
-
/^[A-Za-z][A-Za-z0-9_]
|
|
469
|
-
"Event name must start with a letter and contain only letters, digits, and underscores"
|
|
484
|
+
/^([A-Za-z][A-Za-z0-9_]*|@config\.[A-Za-z_][A-Za-z0-9_]*)$/,
|
|
485
|
+
"Event name must start with a letter and contain only letters, digits, and underscores, or be a `@config.<knob>` reference"
|
|
470
486
|
),
|
|
471
487
|
description: z.string().optional(),
|
|
472
488
|
synonyms: z.string().optional(),
|
|
@@ -1683,6 +1699,62 @@ function mergeCallSiteConfigOverrides(base, overrides) {
|
|
|
1683
1699
|
}
|
|
1684
1700
|
return next;
|
|
1685
1701
|
}
|
|
1702
|
+
function applyTraitRenames(orbital, renames) {
|
|
1703
|
+
if (renames.size === 0) return orbital;
|
|
1704
|
+
const TRAIT_TOKEN = "@trait.";
|
|
1705
|
+
const renameToken = (v) => {
|
|
1706
|
+
if (!v.startsWith(TRAIT_TOKEN)) return v;
|
|
1707
|
+
const renamed = renames.get(v.slice(TRAIT_TOKEN.length));
|
|
1708
|
+
return renamed !== void 0 ? `${TRAIT_TOKEN}${renamed}` : v;
|
|
1709
|
+
};
|
|
1710
|
+
const rewriteValue = (v) => {
|
|
1711
|
+
if (typeof v === "string") return renameToken(v);
|
|
1712
|
+
if (Array.isArray(v)) return v.map(rewriteValue);
|
|
1713
|
+
if (v !== null && typeof v === "object") {
|
|
1714
|
+
const out = {};
|
|
1715
|
+
for (const [k, x] of Object.entries(v)) out[k] = rewriteValue(x);
|
|
1716
|
+
return out;
|
|
1717
|
+
}
|
|
1718
|
+
return v;
|
|
1719
|
+
};
|
|
1720
|
+
const rewriteEntry = (e) => {
|
|
1721
|
+
if (isCallSiteConfigDeclaration(e)) {
|
|
1722
|
+
return e.default !== void 0 ? { ...e, default: rewriteValue(e.default) } : e;
|
|
1723
|
+
}
|
|
1724
|
+
return rewriteValue(e);
|
|
1725
|
+
};
|
|
1726
|
+
const rewriteConfig = (config) => {
|
|
1727
|
+
const out = {};
|
|
1728
|
+
for (const [k, e] of Object.entries(config)) out[k] = rewriteEntry(e);
|
|
1729
|
+
return out;
|
|
1730
|
+
};
|
|
1731
|
+
const rewriteStateMachine = (sm) => JSON.parse(
|
|
1732
|
+
JSON.stringify(sm),
|
|
1733
|
+
(_k, v) => typeof v === "string" ? renameToken(v) : v
|
|
1734
|
+
);
|
|
1735
|
+
const traits = (orbital.traits ?? []).map((t) => {
|
|
1736
|
+
if (typeof t !== "object" || t === null) return t;
|
|
1737
|
+
if ("ref" in t) {
|
|
1738
|
+
return t.config !== void 0 ? { ...t, config: rewriteConfig(t.config) } : t;
|
|
1739
|
+
}
|
|
1740
|
+
const withConfig = t.config !== void 0 ? { ...t, config: rewriteConfig(t.config) } : t;
|
|
1741
|
+
return withConfig.stateMachine !== void 0 ? { ...withConfig, stateMachine: rewriteStateMachine(withConfig.stateMachine) } : withConfig;
|
|
1742
|
+
});
|
|
1743
|
+
const renamePageTrait = (entry) => {
|
|
1744
|
+
if (typeof entry === "string") return renames.get(entry) ?? entry;
|
|
1745
|
+
if ("ref" in entry && typeof entry.ref === "string") {
|
|
1746
|
+
const renamed = renames.get(entry.ref);
|
|
1747
|
+
return renamed !== void 0 ? { ...entry, ref: renamed } : entry;
|
|
1748
|
+
}
|
|
1749
|
+
return entry;
|
|
1750
|
+
};
|
|
1751
|
+
const pages = (orbital.pages ?? []).map((p) => {
|
|
1752
|
+
if (typeof p !== "object" || p === null) return p;
|
|
1753
|
+
if (!Array.isArray(p.traits)) return p;
|
|
1754
|
+
return { ...p, traits: p.traits.map(renamePageTrait) };
|
|
1755
|
+
});
|
|
1756
|
+
return { ...orbital, traits, pages };
|
|
1757
|
+
}
|
|
1686
1758
|
function applyParamsToOrb(orb, orbitalName, _manifest, params) {
|
|
1687
1759
|
const orbital = findOrbitalOrThrow(orb, orbitalName);
|
|
1688
1760
|
const canonicalEntity = assertResolvedEntity(orbital.entity, orbitalName, orb.name);
|
|
@@ -1697,11 +1769,15 @@ function applyParamsToOrb(orb, orbitalName, _manifest, params) {
|
|
|
1697
1769
|
traits: rebuildTraits(ctx, effectiveEntityName, orbital.traits),
|
|
1698
1770
|
pages: rebuildPages(ctx, effectiveEntityName, orbital.pages)
|
|
1699
1771
|
});
|
|
1772
|
+
const traitRenames = /* @__PURE__ */ new Map();
|
|
1700
1773
|
if (built.traits && params.traitOverrides !== void 0) {
|
|
1701
1774
|
built.traits = built.traits.map((t) => {
|
|
1702
1775
|
if (!isTraitReferenceObject(t) || typeof t.name !== "string") return t;
|
|
1703
1776
|
const override = params.traitOverrides?.[t.name];
|
|
1704
1777
|
if (!override) return t;
|
|
1778
|
+
if (override.name !== void 0 && override.name !== t.name) {
|
|
1779
|
+
traitRenames.set(t.name, override.name);
|
|
1780
|
+
}
|
|
1705
1781
|
const merged = { ...t };
|
|
1706
1782
|
if (override.config !== void 0) {
|
|
1707
1783
|
merged.config = mergeCallSiteConfigOverrides(t.config ?? {}, override.config);
|
|
@@ -1734,7 +1810,7 @@ function applyParamsToOrb(orb, orbitalName, _manifest, params) {
|
|
|
1734
1810
|
return { ...p, path: params.pagePath };
|
|
1735
1811
|
});
|
|
1736
1812
|
}
|
|
1737
|
-
return built;
|
|
1813
|
+
return applyTraitRenames(built, traitRenames);
|
|
1738
1814
|
}
|
|
1739
1815
|
|
|
1740
1816
|
// src/factory-runtime/apply-params-to-whole-orb.ts
|
|
@@ -1755,6 +1831,6 @@ function applyParamsToWholeOrb(orb, manifests, params) {
|
|
|
1755
1831
|
return { ...orb, orbitals: rebuilt };
|
|
1756
1832
|
}
|
|
1757
1833
|
|
|
1758
|
-
export { applyParamsToOrb, applyParamsToWholeOrb, extractManifest, mergeCallSiteConfigOverrides, rebindInlineTraitEntity, rewriteEntityInInlineTrait, validateOrbitalFactoryParams };
|
|
1834
|
+
export { applyParamsToOrb, applyParamsToWholeOrb, applyTraitRenames, extractManifest, mergeCallSiteConfigOverrides, rebindInlineTraitEntity, rewriteEntityInInlineTrait, validateOrbitalFactoryParams };
|
|
1759
1835
|
//# sourceMappingURL=index.js.map
|
|
1760
1836
|
//# sourceMappingURL=index.js.map
|