@almadar/core 7.19.1 → 7.20.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/domain-language/index.d.ts +251 -2
- package/dist/domain-language/index.js +381 -16
- package/dist/domain-language/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +381 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { A as AGENT_DOMAIN_CATEGORIES, a as ALLOWED_CUSTOM_COMPONENTS, b as Agen
|
|
|
3
3
|
export { C as CORE_BINDINGS, a as CoreBinding, E as EvalContext, b as EventPayload, c as EventPayloadValue, d as Expression, e as ExpressionInput, f as ExpressionSchema, L as LogMeta, P as ParsedBinding, S as SExpr, g as SExprAtom, h as SExprAtomSchema, i as SExprInput, j as SExprSchema, k as collectBindings, l as getArgs, m as getOperator, n as isBinding, o as isSExpr, p as isSExprAtom, q as isSExprCall, r as isValidBinding, s as parseBinding, t as sexpr, w as walkSExpr } from './expression-BVRFm0sV.js';
|
|
4
4
|
import { ResolvedIR, ResolvedEntity, ResolvedPage, ResolvedTrait, ChangesetValue, SchemaChange, CategorizedRemovals, PageContentReduction, SemanticSchemaChange } from './types/index.js';
|
|
5
5
|
export { AgentCodeSearchResult, AgentCompactResult, AgentCompactStrategy, AgentContext, AgentGenerateOptions, AgentMemoryCategory, AgentMemoryRecord, AppSummary, AssetLoadStatus, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingContext, BindingRoot, BindingSchema, BridgeHealth, BusEvent, BusEventListener, BusEventSource, ChangeAuthor, ChangeSetDocument, ChangeSummary, CheckStatus, ContextExtensions, CreateFlow, DEFAULT_INTERACTION_MODELS, DeleteFlow, EditFlow, EffectTrace, EventEmit, EventKey, EventListen, EventLogEntry, GitHubLink, HistoryMeta, InteractionModel, InteractionModelInput, InteractionModelSchema, LazyService, ListInteraction, OrbitalVerificationAPI, PatternTypeSchema, PersistActionName, ResolvedEntityBinding, ResolvedField, ResolvedNavigation, ResolvedPattern, ResolvedSection, ResolvedSectionEvent, ResolvedTraitBinding, ResolvedTraitDataEntity, ResolvedTraitEvent, ResolvedTraitGuard, ResolvedTraitListener, ResolvedTraitState, ResolvedTraitTick, ResolvedTraitTransition, ResolvedTraitUIBinding, SaveOptions, SaveResult, SemanticChangeKind, ServerResponseTrace, ServiceAction, ServiceActionName, ServiceContract, ServiceEvents, SnapshotDocument, StatsView, StoreContract, StoreFilter, StoreFilterOp, TraitFieldRef, TraitFieldRefSchema, TraitStateSnapshot, TransitionFrom, TransitionTrace, Unsubscribe, ValidationDocument, ValidationIssue, ValidationMeta, ValidationResults, VerificationCheck, VerificationSnapshot, VerificationSummary, ViewFlow, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, getAllPatternTypes, getBindingExamples, getInteractionModelForDomain, inferTsType, isResolvedIR, isTraitFieldRef, toBindingRoot, validateBindingInContext } from './types/index.js';
|
|
6
|
-
export { ASTNode, ComparisonCondition, ComparisonOperator, DomainBehavior, DomainChunk, DomainDocument, DomainEffect, DomainEntity, DomainField, DomainFieldDefault, DomainFieldItems, DomainFieldType, DomainGuard, DomainPage, DomainPageAction, DomainPageSection, DomainRelationship, DomainTick, DomainToSchemaResult, DomainTransition, EFFECT_REGISTRY, EffectMapping, EffectType, FIELD_TYPE_REGISTRY, FactoryEntitySignature, FactoryPageSignature, FactorySignature, FactorySignatureCatalog, FactorySignatureEntityField, FactoryTraitSignature, FieldCheckCondition, FieldReference, FieldTypeMapping, GUARD_REGISTRY, GuardCondition, GuardMapping, KEYWORDS, Lexer, LogicalCondition, LogicalOperator, MULTI_WORD_KEYWORDS, MappingStore, MergeResult, ParseError, ParseResult, RelationshipType, SchemaFieldType, SchemaToDomainResult, SectionMapping, SourceLocation, SourceRange, Token, TokenType, UserCheckCondition, applySectionUpdate, computeSchemaHash, convertDomainToSchema, convertEntitiesToDomain, convertPagesToDomain, convertSchemaToDomain, convertTraitsToDomain, createMappingStore, deleteSection, detectChanges, domainKeywordToSchemaType, findMapping, findMappingByPath, findMappingsByType, formatBehaviorToDomain, formatBehaviorToSchema, formatDomainGuardToSchema, formatEntityToDomain, formatEntityToSchema, formatGuardConditionToDomain, formatGuardToDomain, formatGuardToSchema, formatMergeSummary, formatPageToDomain, formatPageToSchema, formatSchemaEntityToDomain, formatSchemaGuardToDomain, formatSchemaPageToDomain, formatSchemaTraitToDomain, generateDomainLanguageReference, generateSectionId, getEffectMapping, getFieldTypeMapping, getGuardMapping, getRegisteredEffects, getRegisteredFieldTypes, getRegisteredGuards, getRegistryStats, getSchemaPath, hasSchemaChanged, isEffectRegistered, isFieldTypeRegistered, isGuardRegistered, mergeDomainChunks, parseBehavior, parseDomainEffect, parseDomainEffects, parseDomainGuard, parseEntity, parseGuard, parsePage, parseSectionId, removeMapping, resolveConflict, schemaEntityToDomainEntity, schemaPageToDomainPage, schemaTraitToDomainBehavior, schemaTypeToDomainKeyword, tokenize, updateMappingRange, updateSchemaHash, upsertMapping, validateDomainChunk } from './domain-language/index.js';
|
|
6
|
+
export { ASTNode, CallSiteDiff, ComparisonCondition, ComparisonOperator, DomainBehavior, DomainChunk, DomainDocument, DomainEffect, DomainEntity, DomainField, DomainFieldDefault, DomainFieldItems, DomainFieldType, DomainGuard, DomainMutation, DomainPage, DomainPageAction, DomainPageSection, DomainRelationship, DomainTick, DomainToSchemaResult, DomainTransition, EFFECT_REGISTRY, EffectMapping, EffectType, FIELD_TYPE_REGISTRY, FactoryCallSite, FactoryCallSiteParams, FactoryEntitySignature, FactoryPageSignature, FactoryParamValue, FactorySignature, FactorySignatureCatalog, FactorySignatureEntityField, FactoryTraitSignature, FieldCheckCondition, FieldReference, FieldTypeMapping, GUARD_REGISTRY, GuardCondition, GuardMapping, KEYWORDS, Lexer, LogicalCondition, LogicalOperator, MULTI_WORD_KEYWORDS, MappingStore, MergeResult, ParseError, ParseResult, PresentationNavItem, PresentationOverlay, RelationshipType, SchemaFieldType, SchemaToDomainResult, SectionMapping, SourceLocation, SourceRange, Token, TokenType, TranslationBinding, TranslationResult, TranslationWarning, UserCheckCondition, applyMutation, applySectionUpdate, computeSchemaHash, convertDomainToSchema, convertEntitiesToDomain, convertPagesToDomain, convertSchemaToDomain, convertTraitsToDomain, createMappingStore, deleteSection, detectChanges, diffFactoryCalls, domainKeywordToSchemaType, findMapping, findMappingByPath, findMappingsByType, formatBehaviorToDomain, formatBehaviorToSchema, formatDomainGuardToSchema, formatEntityToDomain, formatEntityToSchema, formatGuardConditionToDomain, formatGuardToDomain, formatGuardToSchema, formatMergeSummary, formatPageToDomain, formatPageToSchema, formatSchemaEntityToDomain, formatSchemaGuardToDomain, formatSchemaPageToDomain, formatSchemaTraitToDomain, generateDomainLanguageReference, generateSectionId, getEffectMapping, getFieldTypeMapping, getGuardMapping, getRegisteredEffects, getRegisteredFieldTypes, getRegisteredGuards, getRegistryStats, getSchemaPath, hasSchemaChanged, isEffectRegistered, isFieldTypeRegistered, isGuardRegistered, mergeDomainChunks, parseBehavior, parseDomainEffect, parseDomainEffects, parseDomainGuard, parseEntity, parseGuard, parsePage, parseSectionId, removeMapping, resolveConflict, schemaEntityToDomainEntity, schemaPageToDomainPage, schemaTraitToDomainBehavior, schemaTypeToDomainKeyword, tokenize, translateDomainToParams, updateMappingRange, updateSchemaHash, upsertMapping, validateDomainChunk } from './domain-language/index.js';
|
|
7
7
|
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-DWMFJEz3.js';
|
|
8
8
|
export { PATTERN_TYPES, PatternConfig, PatternType, isValidPatternType } from '@almadar/patterns';
|
|
9
9
|
export { BFSNode, BFSPathNode, EdgeWalkTransition, GraphTransition, GuardPayload, ReplayStep, ReplayTransition, StateEdge, WalkStep, buildEdgeCoveringWalk, buildGuardPayloads, buildReplayPaths, buildStateGraph, collectReachableStates, extractPayloadFieldRef, walkStatePairs } from './state-machine/index.js';
|
package/dist/index.js
CHANGED
|
@@ -7672,6 +7672,251 @@ function parseEffectFromText(text) {
|
|
|
7672
7672
|
}
|
|
7673
7673
|
}
|
|
7674
7674
|
|
|
7675
|
+
// src/domain-language/types.ts
|
|
7676
|
+
var DOMAIN_TO_SCHEMA_FIELD_TYPE = {
|
|
7677
|
+
"text": "string",
|
|
7678
|
+
"long text": "string",
|
|
7679
|
+
"number": "number",
|
|
7680
|
+
"currency": "number",
|
|
7681
|
+
"yes/no": "boolean",
|
|
7682
|
+
"date": "date",
|
|
7683
|
+
"timestamp": "timestamp",
|
|
7684
|
+
"datetime": "datetime",
|
|
7685
|
+
"list": "array",
|
|
7686
|
+
"object": "object",
|
|
7687
|
+
"enum": "enum",
|
|
7688
|
+
"relation": "relation"
|
|
7689
|
+
};
|
|
7690
|
+
var UI_SLOTS2 = [
|
|
7691
|
+
"main",
|
|
7692
|
+
"sidebar",
|
|
7693
|
+
"modal",
|
|
7694
|
+
"drawer",
|
|
7695
|
+
"overlay",
|
|
7696
|
+
"center",
|
|
7697
|
+
"toast",
|
|
7698
|
+
"hud-top",
|
|
7699
|
+
"hud-bottom",
|
|
7700
|
+
"floating",
|
|
7701
|
+
"system"
|
|
7702
|
+
];
|
|
7703
|
+
|
|
7704
|
+
// src/domain-language/sync/translate-domain-to-params.ts
|
|
7705
|
+
function translateDomainToParams(binding, signature, presentation) {
|
|
7706
|
+
const warnings = [];
|
|
7707
|
+
const params = {};
|
|
7708
|
+
applyEntityName(binding.entity, signature, params);
|
|
7709
|
+
applyEntityFields(binding.entity, signature, params, warnings);
|
|
7710
|
+
applyPersistence(binding.entity, signature, params, warnings);
|
|
7711
|
+
applyPagePaths(binding.pages ?? [], signature, params, warnings);
|
|
7712
|
+
applyPresentation(presentation, signature, params, warnings);
|
|
7713
|
+
return {
|
|
7714
|
+
callSite: {
|
|
7715
|
+
organism: signature.organism,
|
|
7716
|
+
orbital: signature.orbital,
|
|
7717
|
+
factoryPath: signature.factoryPath,
|
|
7718
|
+
params
|
|
7719
|
+
},
|
|
7720
|
+
warnings
|
|
7721
|
+
};
|
|
7722
|
+
}
|
|
7723
|
+
function applyEntityName(entity, signature, params) {
|
|
7724
|
+
if (signature.entities.length === 0) return;
|
|
7725
|
+
if (entity.name === signature.entities[0].name) return;
|
|
7726
|
+
params.entityName = entity.name;
|
|
7727
|
+
}
|
|
7728
|
+
function applyEntityFields(entity, signature, params, warnings) {
|
|
7729
|
+
if (signature.entities.length === 0) {
|
|
7730
|
+
if (entity.fields.length > 0) {
|
|
7731
|
+
warnings.push({
|
|
7732
|
+
field: `entity.${entity.name}.fields`,
|
|
7733
|
+
reason: "factory signature does not advertise an entity surface"
|
|
7734
|
+
});
|
|
7735
|
+
}
|
|
7736
|
+
return;
|
|
7737
|
+
}
|
|
7738
|
+
const canonical = new Set(signature.entities[0].fields.map((f) => f.name));
|
|
7739
|
+
const extras = [];
|
|
7740
|
+
for (const f of entity.fields) {
|
|
7741
|
+
if (canonical.has(f.name)) continue;
|
|
7742
|
+
const lowered = lowerField(f);
|
|
7743
|
+
if (lowered) extras.push(lowered);
|
|
7744
|
+
}
|
|
7745
|
+
if (extras.length > 0) params.entityFields = extras;
|
|
7746
|
+
}
|
|
7747
|
+
function applyPersistence(entity, signature, params, warnings) {
|
|
7748
|
+
if (!entity.persistence) return;
|
|
7749
|
+
if (signature.entities.length === 0) {
|
|
7750
|
+
warnings.push({
|
|
7751
|
+
field: `entity.${entity.name}.persistence`,
|
|
7752
|
+
reason: "factory signature has no entity to apply persistence to"
|
|
7753
|
+
});
|
|
7754
|
+
return;
|
|
7755
|
+
}
|
|
7756
|
+
if (entity.persistence === signature.entities[0].persistence) return;
|
|
7757
|
+
params.persistence = entity.persistence;
|
|
7758
|
+
}
|
|
7759
|
+
function applyPagePaths(pages, signature, params, warnings) {
|
|
7760
|
+
if (pages.length === 0) return;
|
|
7761
|
+
const sigPages = new Map(signature.pages.map((p) => [p.name, p]));
|
|
7762
|
+
const overrides = {};
|
|
7763
|
+
for (const p of pages) {
|
|
7764
|
+
const sig = sigPages.get(p.name);
|
|
7765
|
+
if (!sig) {
|
|
7766
|
+
warnings.push({
|
|
7767
|
+
field: `page.${p.name}.url`,
|
|
7768
|
+
reason: `factory signature has no page named "${p.name}"`
|
|
7769
|
+
});
|
|
7770
|
+
continue;
|
|
7771
|
+
}
|
|
7772
|
+
if (sig.defaultPath !== p.url) overrides[p.name] = p.url;
|
|
7773
|
+
}
|
|
7774
|
+
if (Object.keys(overrides).length > 0) params.pagePaths = overrides;
|
|
7775
|
+
}
|
|
7776
|
+
function applyPresentation(overlay, signature, params, warnings) {
|
|
7777
|
+
if (!overlay?.navAdditions || overlay.navAdditions.length === 0) return;
|
|
7778
|
+
const target = signature.traits.find(
|
|
7779
|
+
(t) => t.overridableConfigKeys.includes("navItems")
|
|
7780
|
+
);
|
|
7781
|
+
if (!target) {
|
|
7782
|
+
warnings.push({
|
|
7783
|
+
field: "presentation.navAdditions",
|
|
7784
|
+
reason: "factory signature has no trait advertising a `navItems` config key"
|
|
7785
|
+
});
|
|
7786
|
+
return;
|
|
7787
|
+
}
|
|
7788
|
+
const existing = params.traitOverrides?.[target.name] ?? {};
|
|
7789
|
+
const existingConfig = existing.config ?? {};
|
|
7790
|
+
const items = overlay.navAdditions.map(
|
|
7791
|
+
navItemToParamValue
|
|
7792
|
+
);
|
|
7793
|
+
params.traitOverrides = {
|
|
7794
|
+
...params.traitOverrides,
|
|
7795
|
+
[target.name]: {
|
|
7796
|
+
...existing,
|
|
7797
|
+
config: { ...existingConfig, navItems: items }
|
|
7798
|
+
}
|
|
7799
|
+
};
|
|
7800
|
+
}
|
|
7801
|
+
function lowerField(f) {
|
|
7802
|
+
const schemaType = DOMAIN_TO_SCHEMA_FIELD_TYPE[f.fieldType];
|
|
7803
|
+
if (!schemaType) return void 0;
|
|
7804
|
+
const out = {
|
|
7805
|
+
name: f.name,
|
|
7806
|
+
type: schemaType
|
|
7807
|
+
};
|
|
7808
|
+
if (f.required === true) out.required = true;
|
|
7809
|
+
if (f.enumValues && f.enumValues.length > 0) out.values = [...f.enumValues];
|
|
7810
|
+
if (f.default !== void 0) out.default = lowerDefault(f.default);
|
|
7811
|
+
if (f.items) {
|
|
7812
|
+
const itemSchema = DOMAIN_TO_SCHEMA_FIELD_TYPE[f.items.type];
|
|
7813
|
+
if (itemSchema) out.items = { type: itemSchema };
|
|
7814
|
+
}
|
|
7815
|
+
return out;
|
|
7816
|
+
}
|
|
7817
|
+
function lowerDefault(d) {
|
|
7818
|
+
if (d === void 0 || d === null) return d;
|
|
7819
|
+
if (typeof d === "string" || typeof d === "number" || typeof d === "boolean") {
|
|
7820
|
+
return d;
|
|
7821
|
+
}
|
|
7822
|
+
if (Array.isArray(d)) {
|
|
7823
|
+
return d.map(lowerDefault);
|
|
7824
|
+
}
|
|
7825
|
+
if (typeof d === "object") {
|
|
7826
|
+
const out = {};
|
|
7827
|
+
for (const [k, v] of Object.entries(d)) out[k] = lowerDefault(v);
|
|
7828
|
+
return out;
|
|
7829
|
+
}
|
|
7830
|
+
return void 0;
|
|
7831
|
+
}
|
|
7832
|
+
function navItemToParamValue(item) {
|
|
7833
|
+
const out = {
|
|
7834
|
+
label: item.label,
|
|
7835
|
+
path: item.path
|
|
7836
|
+
};
|
|
7837
|
+
if (item.icon) out.icon = item.icon;
|
|
7838
|
+
return out;
|
|
7839
|
+
}
|
|
7840
|
+
|
|
7841
|
+
// src/domain-language/sync/diff-factory-calls.ts
|
|
7842
|
+
function diffFactoryCalls(prior, next) {
|
|
7843
|
+
const out = [];
|
|
7844
|
+
const priorByKey = new Map(prior.map((c) => [callKey(c), c]));
|
|
7845
|
+
const nextByKey = new Map(next.map((c) => [callKey(c), c]));
|
|
7846
|
+
for (const [key, p] of priorByKey) {
|
|
7847
|
+
const n = nextByKey.get(key);
|
|
7848
|
+
if (!n) {
|
|
7849
|
+
out.push({ kind: "delete", orbitalName: p.orbital, prior: p });
|
|
7850
|
+
continue;
|
|
7851
|
+
}
|
|
7852
|
+
if (paramsEqual(p.params, n.params)) {
|
|
7853
|
+
out.push({ kind: "keep", orbitalName: p.orbital, call: n });
|
|
7854
|
+
} else {
|
|
7855
|
+
out.push({ kind: "edit", orbitalName: p.orbital, prior: p, next: n });
|
|
7856
|
+
}
|
|
7857
|
+
}
|
|
7858
|
+
for (const [key, n] of nextByKey) {
|
|
7859
|
+
if (!priorByKey.has(key)) {
|
|
7860
|
+
out.push({ kind: "add", orbitalName: n.orbital, next: n });
|
|
7861
|
+
}
|
|
7862
|
+
}
|
|
7863
|
+
return out;
|
|
7864
|
+
}
|
|
7865
|
+
function callKey(c) {
|
|
7866
|
+
return `${c.organism}::${c.orbital}`;
|
|
7867
|
+
}
|
|
7868
|
+
function paramsEqual(a, b) {
|
|
7869
|
+
return canonicalParams(a) === canonicalParams(b);
|
|
7870
|
+
}
|
|
7871
|
+
function canonicalParams(p) {
|
|
7872
|
+
const keys = [
|
|
7873
|
+
"entityFields",
|
|
7874
|
+
"entityName",
|
|
7875
|
+
"extraTraits",
|
|
7876
|
+
"pagePaths",
|
|
7877
|
+
"persistence",
|
|
7878
|
+
"traitOverrides"
|
|
7879
|
+
];
|
|
7880
|
+
const parts = [];
|
|
7881
|
+
for (const k of keys) {
|
|
7882
|
+
const v = p[k];
|
|
7883
|
+
if (v === void 0) continue;
|
|
7884
|
+
parts.push(`${k}:${canonicalNode(v)}`);
|
|
7885
|
+
}
|
|
7886
|
+
return `{${parts.join(",")}}`;
|
|
7887
|
+
}
|
|
7888
|
+
function canonicalNode(v) {
|
|
7889
|
+
if (v === void 0) return "u";
|
|
7890
|
+
if (typeof v === "string") return JSON.stringify(v);
|
|
7891
|
+
if (Array.isArray(v)) {
|
|
7892
|
+
return `[${v.map((x) => canonicalParamValue(x)).join(",")}]`;
|
|
7893
|
+
}
|
|
7894
|
+
const keys = Object.keys(v).sort();
|
|
7895
|
+
const parts = [];
|
|
7896
|
+
for (const k of keys) {
|
|
7897
|
+
const child = v[k];
|
|
7898
|
+
parts.push(`${JSON.stringify(k)}:${canonicalParamValue(child)}`);
|
|
7899
|
+
}
|
|
7900
|
+
return `{${parts.join(",")}}`;
|
|
7901
|
+
}
|
|
7902
|
+
function canonicalParamValue(v) {
|
|
7903
|
+
if (v === null || v === void 0) return "u";
|
|
7904
|
+
if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
|
|
7905
|
+
return JSON.stringify(v);
|
|
7906
|
+
}
|
|
7907
|
+
if (Array.isArray(v)) {
|
|
7908
|
+
return `[${v.map(canonicalParamValue).join(",")}]`;
|
|
7909
|
+
}
|
|
7910
|
+
const keys = Object.keys(v).sort();
|
|
7911
|
+
const parts = [];
|
|
7912
|
+
for (const k of keys) {
|
|
7913
|
+
const child = v[k];
|
|
7914
|
+
if (child === void 0) continue;
|
|
7915
|
+
parts.push(`${JSON.stringify(k)}:${canonicalParamValue(child)}`);
|
|
7916
|
+
}
|
|
7917
|
+
return `{${parts.join(",")}}`;
|
|
7918
|
+
}
|
|
7919
|
+
|
|
7675
7920
|
// src/domain-language/sync/section-mapping.ts
|
|
7676
7921
|
function createMappingStore(mappings = []) {
|
|
7677
7922
|
return {
|
|
@@ -7892,21 +8137,6 @@ function formatMergeSummary(result) {
|
|
|
7892
8137
|
return parts.join(", ") || "empty";
|
|
7893
8138
|
}
|
|
7894
8139
|
|
|
7895
|
-
// src/domain-language/types.ts
|
|
7896
|
-
var UI_SLOTS2 = [
|
|
7897
|
-
"main",
|
|
7898
|
-
"sidebar",
|
|
7899
|
-
"modal",
|
|
7900
|
-
"drawer",
|
|
7901
|
-
"overlay",
|
|
7902
|
-
"center",
|
|
7903
|
-
"toast",
|
|
7904
|
-
"hud-top",
|
|
7905
|
-
"hud-bottom",
|
|
7906
|
-
"floating",
|
|
7907
|
-
"system"
|
|
7908
|
-
];
|
|
7909
|
-
|
|
7910
8140
|
// src/domain-language/registry.ts
|
|
7911
8141
|
var FIELD_TYPE_REGISTRY = {
|
|
7912
8142
|
string: {
|
|
@@ -8344,6 +8574,141 @@ function generateDomainLanguageReference() {
|
|
|
8344
8574
|
return lines.join("\n");
|
|
8345
8575
|
}
|
|
8346
8576
|
|
|
8577
|
+
// src/domain-language/applyMutation.ts
|
|
8578
|
+
function applyMutation(doc, mut) {
|
|
8579
|
+
switch (mut.kind) {
|
|
8580
|
+
case "add-entity":
|
|
8581
|
+
return { ...doc, entities: [...doc.entities, mut.entity] };
|
|
8582
|
+
case "remove-entity":
|
|
8583
|
+
return {
|
|
8584
|
+
...doc,
|
|
8585
|
+
entities: doc.entities.filter((e) => e.name !== mut.entityName)
|
|
8586
|
+
};
|
|
8587
|
+
case "rename-entity":
|
|
8588
|
+
return {
|
|
8589
|
+
...doc,
|
|
8590
|
+
entities: replaceEntity(doc.entities, mut.from, (e) => ({
|
|
8591
|
+
...e,
|
|
8592
|
+
name: mut.to
|
|
8593
|
+
}))
|
|
8594
|
+
};
|
|
8595
|
+
case "update-entity":
|
|
8596
|
+
return {
|
|
8597
|
+
...doc,
|
|
8598
|
+
entities: replaceEntity(doc.entities, mut.entityName, () => mut.entity)
|
|
8599
|
+
};
|
|
8600
|
+
case "add-field":
|
|
8601
|
+
return {
|
|
8602
|
+
...doc,
|
|
8603
|
+
entities: replaceEntity(doc.entities, mut.entityName, (e) => ({
|
|
8604
|
+
...e,
|
|
8605
|
+
fields: [...e.fields, mut.field]
|
|
8606
|
+
}))
|
|
8607
|
+
};
|
|
8608
|
+
case "remove-field":
|
|
8609
|
+
return {
|
|
8610
|
+
...doc,
|
|
8611
|
+
entities: replaceEntity(doc.entities, mut.entityName, (e) => ({
|
|
8612
|
+
...e,
|
|
8613
|
+
fields: e.fields.filter((f) => f.name !== mut.fieldName)
|
|
8614
|
+
}))
|
|
8615
|
+
};
|
|
8616
|
+
case "update-field":
|
|
8617
|
+
return {
|
|
8618
|
+
...doc,
|
|
8619
|
+
entities: replaceEntity(doc.entities, mut.entityName, (e) => ({
|
|
8620
|
+
...e,
|
|
8621
|
+
fields: replaceField(e.fields, mut.field)
|
|
8622
|
+
}))
|
|
8623
|
+
};
|
|
8624
|
+
case "add-page":
|
|
8625
|
+
return { ...doc, pages: [...doc.pages, mut.page] };
|
|
8626
|
+
case "remove-page":
|
|
8627
|
+
return {
|
|
8628
|
+
...doc,
|
|
8629
|
+
pages: doc.pages.filter((p) => p.name !== mut.pageName)
|
|
8630
|
+
};
|
|
8631
|
+
case "update-page":
|
|
8632
|
+
return {
|
|
8633
|
+
...doc,
|
|
8634
|
+
pages: replacePage(doc.pages, mut.pageName, () => mut.page)
|
|
8635
|
+
};
|
|
8636
|
+
case "add-behavior":
|
|
8637
|
+
return { ...doc, behaviors: [...doc.behaviors, mut.behavior] };
|
|
8638
|
+
case "remove-behavior":
|
|
8639
|
+
return {
|
|
8640
|
+
...doc,
|
|
8641
|
+
behaviors: doc.behaviors.filter((b) => b.name !== mut.behaviorName)
|
|
8642
|
+
};
|
|
8643
|
+
case "update-behavior":
|
|
8644
|
+
return {
|
|
8645
|
+
...doc,
|
|
8646
|
+
behaviors: replaceBehavior(
|
|
8647
|
+
doc.behaviors,
|
|
8648
|
+
mut.behaviorName,
|
|
8649
|
+
() => mut.behavior
|
|
8650
|
+
)
|
|
8651
|
+
};
|
|
8652
|
+
case "add-transition":
|
|
8653
|
+
return {
|
|
8654
|
+
...doc,
|
|
8655
|
+
behaviors: replaceBehavior(doc.behaviors, mut.behaviorName, (b) => ({
|
|
8656
|
+
...b,
|
|
8657
|
+
transitions: [...b.transitions, mut.transition]
|
|
8658
|
+
}))
|
|
8659
|
+
};
|
|
8660
|
+
case "remove-transition":
|
|
8661
|
+
return {
|
|
8662
|
+
...doc,
|
|
8663
|
+
behaviors: replaceBehavior(doc.behaviors, mut.behaviorName, (b) => ({
|
|
8664
|
+
...b,
|
|
8665
|
+
transitions: b.transitions.filter(
|
|
8666
|
+
(t) => !matchesTransition(t, mut.from, mut.to, mut.event)
|
|
8667
|
+
)
|
|
8668
|
+
}))
|
|
8669
|
+
};
|
|
8670
|
+
case "add-relationship":
|
|
8671
|
+
return {
|
|
8672
|
+
...doc,
|
|
8673
|
+
entities: replaceEntity(doc.entities, mut.entityName, (e) => ({
|
|
8674
|
+
...e,
|
|
8675
|
+
relationships: [...e.relationships, mut.relationship]
|
|
8676
|
+
}))
|
|
8677
|
+
};
|
|
8678
|
+
case "remove-relationship":
|
|
8679
|
+
return {
|
|
8680
|
+
...doc,
|
|
8681
|
+
entities: replaceEntity(doc.entities, mut.entityName, (e) => ({
|
|
8682
|
+
...e,
|
|
8683
|
+
relationships: e.relationships.filter(
|
|
8684
|
+
(r) => !matchesRelationship(r, mut.targetEntity, mut.relationshipType)
|
|
8685
|
+
)
|
|
8686
|
+
}))
|
|
8687
|
+
};
|
|
8688
|
+
default: {
|
|
8689
|
+
return doc;
|
|
8690
|
+
}
|
|
8691
|
+
}
|
|
8692
|
+
}
|
|
8693
|
+
function replaceEntity(entities, name, update) {
|
|
8694
|
+
return entities.map((e) => e.name === name ? update(e) : e);
|
|
8695
|
+
}
|
|
8696
|
+
function replaceField(fields, next) {
|
|
8697
|
+
return fields.map((f) => f.name === next.name ? next : f);
|
|
8698
|
+
}
|
|
8699
|
+
function replacePage(pages, name, update) {
|
|
8700
|
+
return pages.map((p) => p.name === name ? update(p) : p);
|
|
8701
|
+
}
|
|
8702
|
+
function replaceBehavior(behaviors, name, update) {
|
|
8703
|
+
return behaviors.map((b) => b.name === name ? update(b) : b);
|
|
8704
|
+
}
|
|
8705
|
+
function matchesTransition(t, from, to, event) {
|
|
8706
|
+
return t.fromState === from && t.toState === to && t.event === event;
|
|
8707
|
+
}
|
|
8708
|
+
function matchesRelationship(r, targetEntity, relationshipType) {
|
|
8709
|
+
return r.targetEntity === targetEntity && r.relationshipType === relationshipType;
|
|
8710
|
+
}
|
|
8711
|
+
|
|
8347
8712
|
// src/builders/layout-strategy.ts
|
|
8348
8713
|
function hasSequentialChain(wiring) {
|
|
8349
8714
|
if (wiring.length < 2) {
|
|
@@ -8902,6 +9267,6 @@ function buildPayloadForEdge(transition, guardCase) {
|
|
|
8902
9267
|
return {};
|
|
8903
9268
|
}
|
|
8904
9269
|
|
|
8905
|
-
export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, AgentDomainCategorySchema, AnimationDefSchema, AssetMapSchema, AssetMappingSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingSchema, CORE_BINDINGS, ComputedEventContractSchema, ComputedEventListenerSchema, ConfigFieldDeclarationSchema, CustomPatternDefinitionSchema, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DeclaredTraitConfigSchema, DesignPreferencesSchema, DesignTokensSchema, DomainCategorySchema, DomainContextSchema, DomainVocabularySchema, EFFECT_REGISTRY, ENTITY_ROLES, EffectSchema, EntityCallSchema, EntityFieldSchema, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FIELD_TYPE_REGISTRY, FieldFormatSchema, FieldSchema, FieldTypeSchema, GAME_TYPES, GUARD_REGISTRY, GameSubCategorySchema, GameTypeSchema, GuardSchema, InteractionModelSchema, KEYWORDS, Lexer, ListenSourceSchema, MULTI_WORD_KEYWORDS, McpServiceDefSchema, NodeClassificationSchema, OrbitalConfigSchema, OrbitalDefinitionSchema, OrbitalEntitySchema, OrbitalPageSchema, OrbitalPageStrictSchema, OrbitalSchemaSchema, OrbitalTraitRefSchema, OrbitalUnitSchema, OrbitalSchema as OrbitalZodSchema, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRefSchema, PatternTypeSchema, PayloadFieldSchema, RelatedLinkSchema, RelationConfigSchema, RequiredFieldSchema, ResolvedAssetSchema, RestAuthConfigSchema, RestServiceDefSchema, SERVICE_TYPES, SExprAtomSchema, SExprSchema, SemanticAssetRefSchema, ServiceDefinitionSchema, ServiceRefObjectSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SocketEventsSchema, SocketServiceDefSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SuggestedGuardSchema, ThemeDefinitionSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TokenType, TraitCategorySchema, TraitConfigSchema, TraitConfigValueSchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitFieldRefSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, applyEventWiring, applySectionUpdate, atomic, buildEdgeCoveringWalk, buildGuardPayloads, buildReplayPaths, buildStateGraph, callService, categorizeRemovals, classifyWorkflow, clearSchemaCache, collectBindings, collectReachableStates, composeBehaviors, computeSchemaHash, convertDomainToSchema, convertEntitiesToDomain, convertPagesToDomain, convertSchemaToDomain, convertTraitsToDomain, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createMappingStore, createResolvedField, createTypedEventBus, deleteSection, deref, deriveCollection, despawn, detectChanges, detectLayoutStrategy, detectPageContentReduction, diffOrbitalSchemas, diffSchemaSemantics, diffSchemas, doEffects, domainKeywordToSchemaType, emit, extractPayloadFieldRef, findMapping, findMappingByPath, findMappingsByType, findService, formatBehaviorToDomain, formatBehaviorToSchema, formatDomainGuardToSchema, formatEntityToDomain, formatEntityToSchema, formatGuardConditionToDomain, formatGuardToDomain, formatGuardToSchema, formatMergeSummary, formatPageToDomain, formatPageToSchema, formatSchemaEntityToDomain, formatSchemaGuardToDomain, formatSchemaPageToDomain, formatSchemaTraitToDomain, generateDomainLanguageReference, generateSectionId, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getEffectMapping, getEntity, getFieldTypeMapping, getGuardMapping, getInteractionModelForDomain, getOperator, getPage, getPages, getRegisteredEffects, getRegisteredFieldTypes, getRegisteredGuards, getRegistryStats, getRemovals, getSchemaCacheStats, getSchemaPath, getServiceNames, getTrait, getTraitConfig, getTraitName, hasSchemaChanged, hasService, hasSignificantPageReduction, inferTsType, isBinding, isCircuitEvent, isDestructiveChange, isEffect, isEffectRegistered, isEntityCall, isEntityReference, isEntityReferenceAny, isFieldTypeRegistered, isGuardRegistered, isImportedTraitRef, isInlineTrait, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isServiceReferenceObject, isSingletonEntity, isSocketService, isThemeReference, isTraitFieldRef, isValidBinding, mergeDomainChunks, navigate, normalizeTraitRef, notify, parseAssetKey, parseBehavior, parseBinding, parseDomainEffect, parseDomainEffects, parseDomainGuard, parseEntity, parseEntityRef, parseGuard, parseImportedTraitRef, parseOrbitalSchema, parsePage, parsePageRef, parseSectionId, parseServiceRef, persist, ref, removeMapping, renderUI, requiresConfirmation, resolveConflict, safeParseOrbitalSchema, schemaEntityToDomainEntity, schemaPageToDomainPage, schemaToIR, schemaTraitToDomainBehavior, schemaTypeToDomainKeyword, set, sexpr, spawn, summarizeOrbital, summarizeSchema, swap, toBindingRoot, tokenize, updateMappingRange, updateSchemaHash, upsertMapping, validateAssetAnimations, validateBindingInContext, validateDomainChunk, walkSExpr, walkStatePairs, watch };
|
|
9270
|
+
export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, AgentDomainCategorySchema, AnimationDefSchema, AssetMapSchema, AssetMappingSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingSchema, CORE_BINDINGS, ComputedEventContractSchema, ComputedEventListenerSchema, ConfigFieldDeclarationSchema, CustomPatternDefinitionSchema, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DeclaredTraitConfigSchema, DesignPreferencesSchema, DesignTokensSchema, DomainCategorySchema, DomainContextSchema, DomainVocabularySchema, EFFECT_REGISTRY, ENTITY_ROLES, EffectSchema, EntityCallSchema, EntityFieldSchema, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FIELD_TYPE_REGISTRY, FieldFormatSchema, FieldSchema, FieldTypeSchema, GAME_TYPES, GUARD_REGISTRY, GameSubCategorySchema, GameTypeSchema, GuardSchema, InteractionModelSchema, KEYWORDS, Lexer, ListenSourceSchema, MULTI_WORD_KEYWORDS, McpServiceDefSchema, NodeClassificationSchema, OrbitalConfigSchema, OrbitalDefinitionSchema, OrbitalEntitySchema, OrbitalPageSchema, OrbitalPageStrictSchema, OrbitalSchemaSchema, OrbitalTraitRefSchema, OrbitalUnitSchema, OrbitalSchema as OrbitalZodSchema, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRefSchema, PatternTypeSchema, PayloadFieldSchema, RelatedLinkSchema, RelationConfigSchema, RequiredFieldSchema, ResolvedAssetSchema, RestAuthConfigSchema, RestServiceDefSchema, SERVICE_TYPES, SExprAtomSchema, SExprSchema, SemanticAssetRefSchema, ServiceDefinitionSchema, ServiceRefObjectSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SocketEventsSchema, SocketServiceDefSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SuggestedGuardSchema, ThemeDefinitionSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TokenType, TraitCategorySchema, TraitConfigSchema, TraitConfigValueSchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitFieldRefSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, applyEventWiring, applyMutation, applySectionUpdate, atomic, buildEdgeCoveringWalk, buildGuardPayloads, buildReplayPaths, buildStateGraph, callService, categorizeRemovals, classifyWorkflow, clearSchemaCache, collectBindings, collectReachableStates, composeBehaviors, computeSchemaHash, convertDomainToSchema, convertEntitiesToDomain, convertPagesToDomain, convertSchemaToDomain, convertTraitsToDomain, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createMappingStore, createResolvedField, createTypedEventBus, deleteSection, deref, deriveCollection, despawn, detectChanges, detectLayoutStrategy, detectPageContentReduction, diffFactoryCalls, diffOrbitalSchemas, diffSchemaSemantics, diffSchemas, doEffects, domainKeywordToSchemaType, emit, extractPayloadFieldRef, findMapping, findMappingByPath, findMappingsByType, findService, formatBehaviorToDomain, formatBehaviorToSchema, formatDomainGuardToSchema, formatEntityToDomain, formatEntityToSchema, formatGuardConditionToDomain, formatGuardToDomain, formatGuardToSchema, formatMergeSummary, formatPageToDomain, formatPageToSchema, formatSchemaEntityToDomain, formatSchemaGuardToDomain, formatSchemaPageToDomain, formatSchemaTraitToDomain, generateDomainLanguageReference, generateSectionId, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getEffectMapping, getEntity, getFieldTypeMapping, getGuardMapping, getInteractionModelForDomain, getOperator, getPage, getPages, getRegisteredEffects, getRegisteredFieldTypes, getRegisteredGuards, getRegistryStats, getRemovals, getSchemaCacheStats, getSchemaPath, getServiceNames, getTrait, getTraitConfig, getTraitName, hasSchemaChanged, hasService, hasSignificantPageReduction, inferTsType, isBinding, isCircuitEvent, isDestructiveChange, isEffect, isEffectRegistered, isEntityCall, isEntityReference, isEntityReferenceAny, isFieldTypeRegistered, isGuardRegistered, isImportedTraitRef, isInlineTrait, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isServiceReferenceObject, isSingletonEntity, isSocketService, isThemeReference, isTraitFieldRef, isValidBinding, mergeDomainChunks, navigate, normalizeTraitRef, notify, parseAssetKey, parseBehavior, parseBinding, parseDomainEffect, parseDomainEffects, parseDomainGuard, parseEntity, parseEntityRef, parseGuard, parseImportedTraitRef, parseOrbitalSchema, parsePage, parsePageRef, parseSectionId, parseServiceRef, persist, ref, removeMapping, renderUI, requiresConfirmation, resolveConflict, safeParseOrbitalSchema, schemaEntityToDomainEntity, schemaPageToDomainPage, schemaToIR, schemaTraitToDomainBehavior, schemaTypeToDomainKeyword, set, sexpr, spawn, summarizeOrbital, summarizeSchema, swap, toBindingRoot, tokenize, translateDomainToParams, updateMappingRange, updateSchemaHash, upsertMapping, validateAssetAnimations, validateBindingInContext, validateDomainChunk, walkSExpr, walkStatePairs, watch };
|
|
8906
9271
|
//# sourceMappingURL=index.js.map
|
|
8907
9272
|
//# sourceMappingURL=index.js.map
|