@almadar/core 1.0.13 → 1.0.14
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/index.d.ts +54 -3
- package/dist/index.js +193 -1
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +281 -87
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ResolvedIR, ResolvedEntity, ResolvedPage, ResolvedTrait, AppSchema as OrbitalSchema } from './types/index.js';
|
|
2
|
-
export { ALLOWED_CUSTOM_COMPONENTS, AllowedCustomComponent, AnimationDef, AnimationDefInput, AnimationDefSchema, AssetMap, AssetMapInput, AssetMapSchema, AssetMapping, AssetMappingInput, AssetMappingSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BindingContext, BindingSchema, CORE_BINDINGS, CallServiceConfig, ComputedEventContract, ComputedEventContractSchema, ComputedEventListener, ComputedEventListenerSchema, CoreBinding, CreateFlow, CustomPatternDefinition, CustomPatternDefinitionInput, CustomPatternDefinitionSchema, CustomPatternMap, CustomPatternMapInput, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DeleteFlow, DesignPreferences, DesignPreferencesInput, DesignPreferencesSchema, DesignTokens, DesignTokensInput, DesignTokensSchema, DomainCategory, DomainCategorySchema, DomainContext, DomainContextInput, DomainContextSchema, DomainVocabulary, DomainVocabularySchema, ENTITY_ROLES, EditFlow, Effect, EffectInput, EffectSchema, Entity, EntityField, EntityFieldInput, EntityFieldSchema, EntityPersistence, EntityPersistenceSchema, EntityRef, EntityRefSchema, EntityRefStringSchema, EntityRole, EntityRoleSchema, EntitySchema, EntitySemanticRole, EntitySemanticRoleSchema, Event, EventInput, EventListener, EventListenerSchema, EventPayloadField, EventPayloadFieldSchema, EventSchema, EventScope, EventScopeSchema, EventSemanticRole, EventSemanticRoleSchema, EventSource, EventSourceSchema, Expression, ExpressionInput, ExpressionSchema, Field, FieldFormat, FieldFormatSchema, FieldSchema, FieldType, FieldTypeSchema, FullOrbitalUnit, GAME_TYPES, GameSubCategory, GameSubCategorySchema, GameType, GameTypeSchema, Guard, GuardInput, GuardSchema, InteractionModel, InteractionModelInput, InteractionModelSchema, ListInteraction, McpServiceDef, McpServiceDefSchema, NodeClassification, NodeClassificationSchema, OperatorName, FullOrbitalUnit as Orbital, OrbitalConfig, OrbitalConfigInput, OrbitalConfigSchema, OrbitalDefinition, OrbitalDefinitionSchema, OrbitalEntity, OrbitalEntityInput, OrbitalEntitySchema, OrbitalInput, OrbitalPage, OrbitalPageInput, OrbitalPageSchema, OrbitalPageStrictInput, OrbitalPageStrictSchema, OrbitalSchemaInput, OrbitalSchemaSchema, OrbitalTraitRef, OrbitalTraitRefSchema, OrbitalUnit, OrbitalUnitSchema, OrbitalZodSchema, Page, PageRef, PageRefObject, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRef, PageTraitRefSchema, ParsedBinding, PatternTypeSchema, PayloadField, PayloadFieldSchema, PresentationType, RelatedLink, RelatedLinkSchema, RelationConfig, RelationConfigSchema, RenderUIConfig, RequiredField, RequiredFieldSchema, ResolvedAsset, ResolvedAssetInput, ResolvedAssetSchema, ResolvedEntityBinding, ResolvedField, ResolvedNavigation, ResolvedPattern, ResolvedSection, ResolvedSectionEvent, ResolvedTraitBinding, ResolvedTraitDataEntity, ResolvedTraitEvent, ResolvedTraitGuard, ResolvedTraitListener, ResolvedTraitState, ResolvedTraitTick, ResolvedTraitTransition, ResolvedTraitUIBinding, RestAuthConfig, RestAuthConfigSchema, RestServiceDef, RestServiceDefSchema, SERVICE_TYPES, SExpr, SExprAtom, SExprAtomSchema, SExprInput, SExprSchema, SemanticAssetRef, SemanticAssetRefInput, SemanticAssetRefSchema, ServiceDefinition, ServiceDefinitionSchema, ServiceRef, ServiceRefSchema, ServiceRefStringSchema, ServiceType, ServiceTypeSchema, SocketEvents, SocketEventsSchema, SocketServiceDef, SocketServiceDefSchema, State, StateInput, StateMachine, StateMachineInput, StateMachineSchema, StateSchema, StateSemanticRole, StateSemanticRoleSchema, SuggestedGuard, SuggestedGuardSchema, ThemeDefinition, ThemeDefinitionSchema, ThemeRef, ThemeRefSchema, ThemeRefStringSchema, ThemeTokens, ThemeTokensSchema, ThemeVariant, ThemeVariantSchema, Trait, TraitCategory, TraitCategorySchema, TraitDataEntity, TraitDataEntitySchema, TraitEntityField, TraitEntityFieldSchema, TraitEventContract, TraitEventContractSchema, TraitEventListener, TraitEventListenerSchema, TraitInput, TraitRef, TraitRefSchema, TraitReference, TraitReferenceInput, TraitReferenceSchema, TraitSchema, TraitTick, TraitTickSchema, TraitUIBinding, Transition, TransitionFrom, TransitionInput, TransitionSchema, UISlot, UISlotSchema, UI_SLOTS, UXHints, UXHintsSchema, UseDeclaration, UseDeclarationSchema, UserPersona, UserPersonaInput, UserPersonaSchema, VISUAL_STYLES, ViewFlow, ViewType, ViewTypeSchema, VisualStyle, VisualStyleSchema, callService, collectBindings, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createResolvedField, deriveCollection, despawn, doEffects, emit, findService, getAllOperators, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getServiceNames, getTraitConfig, getTraitName, hasService, inferTsType, isBinding, isCircuitEvent, isEffect, isEntityReference, isImportedTraitRef, isInlineTrait, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isSingletonEntity, isSocketService, isThemeReference, isValidBinding, navigate, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, renderUI, safeParseOrbitalSchema, set, sexpr, spawn, validateAssetAnimations, validateBindingInContext, walkSExpr } from './types/index.js';
|
|
1
|
+
import { ResolvedIR, ResolvedEntity, ResolvedPage, ResolvedTrait, AppSchema as OrbitalSchema, SchemaChange, CategorizedRemovals, PageContentReduction } from './types/index.js';
|
|
2
|
+
export { ALLOWED_CUSTOM_COMPONENTS, AllowedCustomComponent, AnimationDef, AnimationDefInput, AnimationDefSchema, AppSummary, AssetMap, AssetMapInput, AssetMapSchema, AssetMapping, AssetMappingInput, AssetMappingSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BindingContext, BindingSchema, CORE_BINDINGS, CallServiceConfig, ChangeAuthor, ChangeSetDocument, ChangeSummary, ComputedEventContract, ComputedEventContractSchema, ComputedEventListener, ComputedEventListenerSchema, CoreBinding, CreateFlow, CustomPatternDefinition, CustomPatternDefinitionInput, CustomPatternDefinitionSchema, CustomPatternMap, CustomPatternMapInput, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DeleteFlow, DesignPreferences, DesignPreferencesInput, DesignPreferencesSchema, DesignTokens, DesignTokensInput, DesignTokensSchema, DomainCategory, DomainCategorySchema, DomainContext, DomainContextInput, DomainContextSchema, DomainVocabulary, DomainVocabularySchema, ENTITY_ROLES, EditFlow, Effect, EffectInput, EffectSchema, Entity, EntityField, EntityFieldInput, EntityFieldSchema, EntityPersistence, EntityPersistenceSchema, EntityRef, EntityRefSchema, EntityRefStringSchema, EntityRole, EntityRoleSchema, EntitySchema, EntitySemanticRole, EntitySemanticRoleSchema, Event, EventInput, EventListener, EventListenerSchema, EventPayloadField, EventPayloadFieldSchema, EventSchema, EventScope, EventScopeSchema, EventSemanticRole, EventSemanticRoleSchema, EventSource, EventSourceSchema, Expression, ExpressionInput, ExpressionSchema, Field, FieldFormat, FieldFormatSchema, FieldSchema, FieldType, FieldTypeSchema, FullOrbitalUnit, GAME_TYPES, GameSubCategory, GameSubCategorySchema, GameType, GameTypeSchema, Guard, GuardInput, GuardSchema, HistoryMeta, InteractionModel, InteractionModelInput, InteractionModelSchema, ListInteraction, McpServiceDef, McpServiceDefSchema, NodeClassification, NodeClassificationSchema, OperatorName, FullOrbitalUnit as Orbital, OrbitalConfig, OrbitalConfigInput, OrbitalConfigSchema, OrbitalDefinition, OrbitalDefinitionSchema, OrbitalEntity, OrbitalEntityInput, OrbitalEntitySchema, OrbitalInput, OrbitalPage, OrbitalPageInput, OrbitalPageSchema, OrbitalPageStrictInput, OrbitalPageStrictSchema, OrbitalSchemaInput, OrbitalSchemaSchema, OrbitalTraitRef, OrbitalTraitRefSchema, OrbitalUnit, OrbitalUnitSchema, OrbitalZodSchema, Page, PageRef, PageRefObject, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRef, PageTraitRefSchema, ParsedBinding, PatternTypeSchema, PayloadField, PayloadFieldSchema, PresentationType, RelatedLink, RelatedLinkSchema, RelationConfig, RelationConfigSchema, RenderUIConfig, RequiredField, RequiredFieldSchema, ResolvedAsset, ResolvedAssetInput, ResolvedAssetSchema, ResolvedEntityBinding, ResolvedField, ResolvedNavigation, ResolvedPattern, ResolvedSection, ResolvedSectionEvent, ResolvedTraitBinding, ResolvedTraitDataEntity, ResolvedTraitEvent, ResolvedTraitGuard, ResolvedTraitListener, ResolvedTraitState, ResolvedTraitTick, ResolvedTraitTransition, ResolvedTraitUIBinding, RestAuthConfig, RestAuthConfigSchema, RestServiceDef, RestServiceDefSchema, SERVICE_TYPES, SExpr, SExprAtom, SExprAtomSchema, SExprInput, SExprSchema, SaveOptions, SaveResult, SemanticAssetRef, SemanticAssetRefInput, SemanticAssetRefSchema, ServiceDefinition, ServiceDefinitionSchema, ServiceRef, ServiceRefSchema, ServiceRefStringSchema, ServiceType, ServiceTypeSchema, SnapshotDocument, SocketEvents, SocketEventsSchema, SocketServiceDef, SocketServiceDefSchema, State, StateInput, StateMachine, StateMachineInput, StateMachineSchema, StateSchema, StateSemanticRole, StateSemanticRoleSchema, StatsView, SuggestedGuard, SuggestedGuardSchema, ThemeDefinition, ThemeDefinitionSchema, ThemeRef, ThemeRefSchema, ThemeRefStringSchema, ThemeTokens, ThemeTokensSchema, ThemeVariant, ThemeVariantSchema, Trait, TraitCategory, TraitCategorySchema, TraitDataEntity, TraitDataEntitySchema, TraitEntityField, TraitEntityFieldSchema, TraitEventContract, TraitEventContractSchema, TraitEventListener, TraitEventListenerSchema, TraitInput, TraitRef, TraitRefSchema, TraitReference, TraitReferenceInput, TraitReferenceSchema, TraitSchema, TraitTick, TraitTickSchema, TraitUIBinding, Transition, TransitionFrom, TransitionInput, TransitionSchema, UISlot, UISlotSchema, UI_SLOTS, UXHints, UXHintsSchema, UseDeclaration, UseDeclarationSchema, UserPersona, UserPersonaInput, UserPersonaSchema, VISUAL_STYLES, ValidationDocument, ValidationIssue, ValidationMeta, ValidationResults, ViewFlow, ViewType, ViewTypeSchema, VisualStyle, VisualStyleSchema, callService, collectBindings, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createResolvedField, deriveCollection, despawn, doEffects, emit, findService, getAllOperators, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getInteractionModelForDomain, getOperator, getServiceNames, getTraitConfig, getTraitName, hasService, inferTsType, isBinding, isCircuitEvent, isEffect, isEntityReference, isImportedTraitRef, isInlineTrait, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isSingletonEntity, isSocketService, isThemeReference, isValidBinding, navigate, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, renderUI, safeParseOrbitalSchema, set, sexpr, spawn, validateAssetAnimations, validateBindingInContext, walkSExpr } from './types/index.js';
|
|
3
3
|
export { CATEGORIES, CategoryMeta, OPERATORS, OPERATORS_SCHEMA, OPERATOR_NAMES, OperatorCategory, OperatorMeta, OperatorStats, OperatorsSchema, TargetPlatform, getOperatorMeta, getOperatorStats, getOperatorsByCategory, getOperatorsForTarget, isEffectOperator, isGuardOperator, isKnownOperator, validateOperatorArity } from '@almadar/operators';
|
|
4
4
|
export { PATTERN_TYPES, PatternConfig, PatternType, isValidPatternType } from '@almadar/patterns';
|
|
5
5
|
import 'zod';
|
|
@@ -83,4 +83,55 @@ declare function getEntity(ir: ResolvedIR, entityName: string): ResolvedEntity |
|
|
|
83
83
|
*/
|
|
84
84
|
declare function getTrait(ir: ResolvedIR, traitName: string): ResolvedTrait | undefined;
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Schema Diffing & Protection
|
|
88
|
+
*
|
|
89
|
+
* Pure functions for comparing OrbitalSchema objects, detecting destructive changes,
|
|
90
|
+
* and categorizing removals. No I/O — operates on in-memory schema objects.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Diff two OrbitalSchema objects and produce a list of changes.
|
|
95
|
+
* Compares orbitals, entities, traits, pages, services, and top-level fields.
|
|
96
|
+
*/
|
|
97
|
+
declare function diffSchemas(before: OrbitalSchema, after: OrbitalSchema): {
|
|
98
|
+
changes: SchemaChange[];
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Check if a changeset contains any removals.
|
|
102
|
+
*/
|
|
103
|
+
declare function isDestructiveChange(changeSet: {
|
|
104
|
+
changes: SchemaChange[];
|
|
105
|
+
}): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Extract all removal operations from a changeset.
|
|
108
|
+
*/
|
|
109
|
+
declare function getRemovals(changeSet: {
|
|
110
|
+
changes: SchemaChange[];
|
|
111
|
+
}): SchemaChange[];
|
|
112
|
+
/**
|
|
113
|
+
* Categorize removals by severity.
|
|
114
|
+
*
|
|
115
|
+
* - Critical: orbitals, entities, states, pages (require confirmation)
|
|
116
|
+
* - Standard: fields, actions, traits (auto-snapshotted)
|
|
117
|
+
* - Minor: transitions, guards (tracked)
|
|
118
|
+
*/
|
|
119
|
+
declare function categorizeRemovals(changeSet: {
|
|
120
|
+
changes: SchemaChange[];
|
|
121
|
+
}): CategorizedRemovals;
|
|
122
|
+
/**
|
|
123
|
+
* Check if critical removals require explicit confirmation.
|
|
124
|
+
*/
|
|
125
|
+
declare function requiresConfirmation(removals: CategorizedRemovals): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Detect implicit content reduction within pages.
|
|
128
|
+
* Catches cases where a page 'modify' reduces components/actions/displays
|
|
129
|
+
* without an explicit 'remove' operation.
|
|
130
|
+
*/
|
|
131
|
+
declare function detectPageContentReduction(beforePages: unknown[], afterPages: unknown[]): PageContentReduction[];
|
|
132
|
+
/**
|
|
133
|
+
* Check if page content reductions are significant.
|
|
134
|
+
*/
|
|
135
|
+
declare function hasSignificantPageReduction(reductions: PageContentReduction[]): boolean;
|
|
136
|
+
|
|
137
|
+
export { OrbitalSchema as AppSchema, CategorizedRemovals, OrbitalSchema, PageContentReduction, ResolvedEntity, ResolvedIR, ResolvedPage, ResolvedTrait, SchemaChange, categorizeRemovals, clearSchemaCache, detectPageContentReduction, diffSchemas, getEntity, getPage, getPages, getRemovals, getSchemaCacheStats, getTrait, hasSignificantPageReduction, isDestructiveChange, requiresConfirmation, schemaToIR };
|
package/dist/index.js
CHANGED
|
@@ -1329,6 +1329,198 @@ function getTrait(ir, traitName) {
|
|
|
1329
1329
|
return ir.traits.get(traitName);
|
|
1330
1330
|
}
|
|
1331
1331
|
|
|
1332
|
-
|
|
1332
|
+
// src/diff.ts
|
|
1333
|
+
function diffSchemas(before, after) {
|
|
1334
|
+
const changes = [];
|
|
1335
|
+
let changeId = 0;
|
|
1336
|
+
const nextId = () => `change-${++changeId}`;
|
|
1337
|
+
if (before.name !== after.name) {
|
|
1338
|
+
changes.push({
|
|
1339
|
+
id: nextId(),
|
|
1340
|
+
operation: "modify",
|
|
1341
|
+
target: "schema",
|
|
1342
|
+
path: ["name"],
|
|
1343
|
+
before: before.name,
|
|
1344
|
+
after: after.name,
|
|
1345
|
+
description: `Renamed schema from "${before.name}" to "${after.name}"`
|
|
1346
|
+
});
|
|
1347
|
+
}
|
|
1348
|
+
if (before.description !== after.description) {
|
|
1349
|
+
changes.push({
|
|
1350
|
+
id: nextId(),
|
|
1351
|
+
operation: "modify",
|
|
1352
|
+
target: "schema",
|
|
1353
|
+
path: ["description"],
|
|
1354
|
+
before: before.description,
|
|
1355
|
+
after: after.description,
|
|
1356
|
+
description: `Modified schema description`
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
const beforeOrbitals = new Map(
|
|
1360
|
+
(before.orbitals || []).map((o, i) => [o.name, { orbital: o, index: i }])
|
|
1361
|
+
);
|
|
1362
|
+
const afterOrbitals = new Map(
|
|
1363
|
+
(after.orbitals || []).map((o, i) => [o.name, { orbital: o, index: i }])
|
|
1364
|
+
);
|
|
1365
|
+
for (const [name, { index }] of beforeOrbitals) {
|
|
1366
|
+
if (!afterOrbitals.has(name)) {
|
|
1367
|
+
changes.push({
|
|
1368
|
+
id: nextId(),
|
|
1369
|
+
operation: "remove",
|
|
1370
|
+
target: "orbital",
|
|
1371
|
+
path: ["orbitals", index],
|
|
1372
|
+
before: name,
|
|
1373
|
+
description: `Removed orbital: ${name}`
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
for (const [name, { index }] of afterOrbitals) {
|
|
1378
|
+
if (!beforeOrbitals.has(name)) {
|
|
1379
|
+
changes.push({
|
|
1380
|
+
id: nextId(),
|
|
1381
|
+
operation: "add",
|
|
1382
|
+
target: "orbital",
|
|
1383
|
+
path: ["orbitals", index],
|
|
1384
|
+
after: name,
|
|
1385
|
+
description: `Added orbital: ${name}`
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
for (const [name, { orbital: afterOrbital, index }] of afterOrbitals) {
|
|
1390
|
+
const beforeEntry = beforeOrbitals.get(name);
|
|
1391
|
+
if (beforeEntry) {
|
|
1392
|
+
const beforeJson = JSON.stringify(beforeEntry.orbital);
|
|
1393
|
+
const afterJson = JSON.stringify(afterOrbital);
|
|
1394
|
+
if (beforeJson !== afterJson) {
|
|
1395
|
+
changes.push({
|
|
1396
|
+
id: nextId(),
|
|
1397
|
+
operation: "modify",
|
|
1398
|
+
target: "orbital",
|
|
1399
|
+
path: ["orbitals", index],
|
|
1400
|
+
description: `Modified orbital: ${name}`
|
|
1401
|
+
});
|
|
1402
|
+
const beforeEntity = beforeEntry.orbital.entity;
|
|
1403
|
+
const afterEntity = afterOrbital.entity;
|
|
1404
|
+
if (JSON.stringify(beforeEntity) !== JSON.stringify(afterEntity)) {
|
|
1405
|
+
const entityName = typeof afterEntity === "string" ? afterEntity : afterEntity && typeof afterEntity === "object" && "name" in afterEntity ? afterEntity.name : "entity";
|
|
1406
|
+
changes.push({
|
|
1407
|
+
id: nextId(),
|
|
1408
|
+
operation: "modify",
|
|
1409
|
+
target: "entity",
|
|
1410
|
+
path: ["orbitals", index, "entity"],
|
|
1411
|
+
description: `Modified entity: ${entityName}`
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
const beforeTraits = beforeEntry.orbital.traits || [];
|
|
1415
|
+
const afterTraits = afterOrbital.traits || [];
|
|
1416
|
+
if (JSON.stringify(beforeTraits) !== JSON.stringify(afterTraits)) {
|
|
1417
|
+
changes.push({
|
|
1418
|
+
id: nextId(),
|
|
1419
|
+
operation: "modify",
|
|
1420
|
+
target: "traits",
|
|
1421
|
+
path: ["orbitals", index, "traits"],
|
|
1422
|
+
description: `Modified traits in orbital: ${name}`
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
const beforePages = beforeEntry.orbital.pages || [];
|
|
1426
|
+
const afterPages = afterOrbital.pages || [];
|
|
1427
|
+
if (JSON.stringify(beforePages) !== JSON.stringify(afterPages)) {
|
|
1428
|
+
changes.push({
|
|
1429
|
+
id: nextId(),
|
|
1430
|
+
operation: "modify",
|
|
1431
|
+
target: "pages",
|
|
1432
|
+
path: ["orbitals", index, "pages"],
|
|
1433
|
+
description: `Modified pages in orbital: ${name}`
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
const beforeServices = JSON.stringify(before.services || []);
|
|
1440
|
+
const afterServices = JSON.stringify(after.services || []);
|
|
1441
|
+
if (beforeServices !== afterServices) {
|
|
1442
|
+
changes.push({
|
|
1443
|
+
id: nextId(),
|
|
1444
|
+
operation: "modify",
|
|
1445
|
+
target: "services",
|
|
1446
|
+
path: ["services"],
|
|
1447
|
+
description: "Modified services"
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
return { changes };
|
|
1451
|
+
}
|
|
1452
|
+
function isDestructiveChange(changeSet) {
|
|
1453
|
+
return changeSet.changes.some((c) => c.operation === "remove");
|
|
1454
|
+
}
|
|
1455
|
+
function getRemovals(changeSet) {
|
|
1456
|
+
return changeSet.changes.filter((c) => c.operation === "remove");
|
|
1457
|
+
}
|
|
1458
|
+
function categorizeRemovals(changeSet) {
|
|
1459
|
+
const critical = [];
|
|
1460
|
+
const standard = [];
|
|
1461
|
+
const minor = [];
|
|
1462
|
+
for (const change of changeSet.changes) {
|
|
1463
|
+
if (change.operation !== "remove") continue;
|
|
1464
|
+
const target = change.target.toLowerCase();
|
|
1465
|
+
if (target === "orbital" || target === "entity" || target === "state" || target === "page") {
|
|
1466
|
+
critical.push(change);
|
|
1467
|
+
} else if (target === "field" || target === "action" || target === "trait" || target === "traits") {
|
|
1468
|
+
standard.push(change);
|
|
1469
|
+
} else {
|
|
1470
|
+
minor.push(change);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
return { critical, standard, minor, pageContentReductions: [] };
|
|
1474
|
+
}
|
|
1475
|
+
function requiresConfirmation(removals) {
|
|
1476
|
+
return removals.critical.length > 0;
|
|
1477
|
+
}
|
|
1478
|
+
function detectPageContentReduction(beforePages, afterPages) {
|
|
1479
|
+
const reductions = [];
|
|
1480
|
+
const getPageName = (p) => {
|
|
1481
|
+
if (p && typeof p === "object" && "name" in p) {
|
|
1482
|
+
return p.name;
|
|
1483
|
+
}
|
|
1484
|
+
return null;
|
|
1485
|
+
};
|
|
1486
|
+
const countContent = (page) => {
|
|
1487
|
+
if (!page || typeof page !== "object") return { sections: 0, actions: 0 };
|
|
1488
|
+
const p = page;
|
|
1489
|
+
const traits = Array.isArray(p.traits) ? p.traits : [];
|
|
1490
|
+
return { sections: traits.length, actions: 0 };
|
|
1491
|
+
};
|
|
1492
|
+
const beforeMap = /* @__PURE__ */ new Map();
|
|
1493
|
+
for (const p of beforePages) {
|
|
1494
|
+
const name = getPageName(p);
|
|
1495
|
+
if (name) beforeMap.set(name, p);
|
|
1496
|
+
}
|
|
1497
|
+
for (const afterPage of afterPages) {
|
|
1498
|
+
const name = getPageName(afterPage);
|
|
1499
|
+
if (!name) continue;
|
|
1500
|
+
const beforePage = beforeMap.get(name);
|
|
1501
|
+
if (!beforePage) continue;
|
|
1502
|
+
const beforeContent = countContent(beforePage);
|
|
1503
|
+
const afterContent = countContent(afterPage);
|
|
1504
|
+
const sectionsRemoved = beforeContent.sections - afterContent.sections;
|
|
1505
|
+
const actionsRemoved = beforeContent.actions - afterContent.actions;
|
|
1506
|
+
if (sectionsRemoved > 0 || actionsRemoved > 0) {
|
|
1507
|
+
reductions.push({
|
|
1508
|
+
pageName: name,
|
|
1509
|
+
componentsRemoved: sectionsRemoved,
|
|
1510
|
+
actionsRemoved,
|
|
1511
|
+
displaysRemoved: 0,
|
|
1512
|
+
before: beforeContent,
|
|
1513
|
+
after: afterContent,
|
|
1514
|
+
isSignificant: sectionsRemoved > 0
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
return reductions;
|
|
1519
|
+
}
|
|
1520
|
+
function hasSignificantPageReduction(reductions) {
|
|
1521
|
+
return reductions.some((r) => r.isSignificant);
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
export { ALLOWED_CUSTOM_COMPONENTS, AnimationDefSchema, AssetMapSchema, AssetMappingSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BindingSchema, CORE_BINDINGS, ComputedEventContractSchema, ComputedEventListenerSchema, CustomPatternDefinitionSchema, CustomPatternMapSchema, DEFAULT_INTERACTION_MODELS, DesignPreferencesSchema, DesignTokensSchema, DomainCategorySchema, DomainContextSchema, DomainVocabularySchema, ENTITY_ROLES, EffectSchema, EntityFieldSchema, EntityPersistenceSchema, EntityRefSchema, EntityRefStringSchema, EntityRoleSchema, EntitySchema, EntitySemanticRoleSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSemanticRoleSchema, EventSourceSchema, ExpressionSchema, FieldFormatSchema, FieldSchema, FieldTypeSchema, GAME_TYPES, GameSubCategorySchema, GameTypeSchema, GuardSchema, InteractionModelSchema, 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, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SocketEventsSchema, SocketServiceDefSchema, StateMachineSchema, StateSchema, StateSemanticRoleSchema, SuggestedGuardSchema, ThemeDefinitionSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TraitCategorySchema, TraitDataEntitySchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitTickSchema, TransitionSchema, UISlotSchema, UI_SLOTS, UXHintsSchema, UseDeclarationSchema, UserPersonaSchema, VISUAL_STYLES, ViewTypeSchema, VisualStyleSchema, callService, categorizeRemovals, clearSchemaCache, collectBindings, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createResolvedField, deriveCollection, despawn, detectPageContentReduction, diffSchemas, doEffects, emit, findService, getAllOperators, getAllPatternTypes, getArgs, getBindingExamples, getDefaultAnimationsForRole, getEntity, getInteractionModelForDomain, getOperator, getPage, getPages, getRemovals, getSchemaCacheStats, getServiceNames, getTrait, getTraitConfig, getTraitName, hasService, hasSignificantPageReduction, inferTsType, isBinding, isCircuitEvent, isDestructiveChange, isEffect, isEntityReference, isImportedTraitRef, isInlineTrait, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isSingletonEntity, isSocketService, isThemeReference, isValidBinding, navigate, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, renderUI, requiresConfirmation, safeParseOrbitalSchema, schemaToIR, set, sexpr, spawn, validateAssetAnimations, validateBindingInContext, walkSExpr };
|
|
1333
1525
|
//# sourceMappingURL=index.js.map
|
|
1334
1526
|
//# sourceMappingURL=index.js.map
|