@almadar/core 1.0.0 → 1.0.9

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 CHANGED
@@ -1,2 +1,86 @@
1
- export { ALLOWED_CUSTOM_COMPONENTS, AllowedCustomComponent, AnimationDef, AnimationDefInput, AnimationDefSchema, AppSchema, 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, OPERATORS, OPERATOR_CATEGORIES, OperatorCategory, OperatorMeta, OperatorName, FullOrbitalUnit as Orbital, OrbitalConfig, OrbitalConfigInput, OrbitalConfigSchema, OrbitalDefinition, OrbitalDefinitionSchema, OrbitalEntity, OrbitalEntityInput, OrbitalEntitySchema, OrbitalInput, OrbitalPage, OrbitalPageInput, OrbitalPageSchema, OrbitalPageStrictInput, OrbitalPageStrictSchema, AppSchema as OrbitalSchema, OrbitalSchemaInput, OrbitalSchemaSchema, OrbitalTraitRef, OrbitalTraitRefSchema, OrbitalUnit, OrbitalUnitSchema, OrbitalZodSchema, PATTERN_TYPES, Page, PageRef, PageRefObject, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRef, PageTraitRefSchema, ParsedBinding, PatternConfig, PatternType, PatternTypeSchema, PayloadField, PayloadFieldSchema, PresentationType, RelatedLink, RelatedLinkSchema, RelationConfig, RelationConfigSchema, RequiredField, RequiredFieldSchema, ResolvedAsset, ResolvedAssetInput, ResolvedAssetSchema, ResolvedEntity, ResolvedEntityBinding, ResolvedField, ResolvedIR, ResolvedNavigation, ResolvedPage, ResolvedPattern, ResolvedSection, ResolvedSectionEvent, ResolvedTrait, 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, getOperatorMeta, getOperatorsByCategory, getServiceNames, getTraitConfig, getTraitName, hasService, inferTsType, isBinding, isEffect, isEffectOperator, isEntityReference, isGuardOperator, isImportedTraitRef, isInlineTrait, isKnownOperator, isMcpService, isOrbitalDefinition, isPageReference, isPageReferenceObject, isPageReferenceString, isResolvedIR, isRestService, isRuntimeEntity, isSExpr, isSExprAtom, isSExprCall, isSExprEffect, isServiceReference, isSingletonEntity, isSocketService, isThemeReference, isValidBinding, isValidPatternType, navigate, normalizeTraitRef, notify, parseAssetKey, parseBinding, parseEntityRef, parseImportedTraitRef, parseOrbitalSchema, parsePageRef, parseServiceRef, persist, renderUI, safeParseOrbitalSchema, set, sexpr, spawn, validateAssetAnimations, validateBindingInContext, validateOperatorArity, walkSExpr } from './src/types/index.js';
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';
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
+ export { PATTERN_TYPES, PatternConfig, PatternType, isValidPatternType } from '@almadar/patterns';
2
5
  import 'zod';
6
+
7
+ /**
8
+ * Schema Resolver
9
+ *
10
+ * Converts OrbitalSchema to Intermediate Representation (IR).
11
+ * Resolves all entity references, expands traits, and prepares schema for compilation/runtime.
12
+ *
13
+ * @packageDocumentation
14
+ */
15
+
16
+ /**
17
+ * Clear the schema resolution cache.
18
+ * Useful for hot-reloading during development.
19
+ */
20
+ declare function clearSchemaCache(): void;
21
+ /**
22
+ * Get cache statistics (for debugging)
23
+ */
24
+ declare function getSchemaCacheStats(): {
25
+ size: number;
26
+ keys: string[];
27
+ };
28
+ /**
29
+ * Convert OrbitalSchema to Intermediate Representation (IR).
30
+ *
31
+ * This function:
32
+ * 1. Resolves all entity references
33
+ * 2. Expands trait definitions (inline or from library)
34
+ * 3. Resolves page bindings
35
+ * 4. Creates the IR structure used by compiler and runtime
36
+ *
37
+ * @param schema - OrbitalSchema to convert
38
+ * @param useCache - Whether to use cached result (default: true)
39
+ * @returns Fully resolved IR
40
+ *
41
+ * @example
42
+ * const schema = { name: 'MyApp', orbitals: [...] };
43
+ * const ir = schemaToIR(schema);
44
+ * console.log(ir.entities.size); // Number of entities
45
+ * console.log(ir.pages.size); // Number of pages
46
+ */
47
+ declare function schemaToIR(schema: OrbitalSchema, useCache?: boolean): ResolvedIR;
48
+ /**
49
+ * Get a specific page from resolved IR by name.
50
+ * If no name is provided, returns the first page.
51
+ *
52
+ * @param ir - Resolved IR
53
+ * @param pageName - Optional page name to find
54
+ * @returns Resolved page or undefined
55
+ *
56
+ * @example
57
+ * const ir = schemaToIR(schema);
58
+ * const homePage = getPage(ir, 'HomePage');
59
+ * const firstPage = getPage(ir); // No name = first page
60
+ */
61
+ declare function getPage(ir: ResolvedIR, pageName?: string): ResolvedPage | undefined;
62
+ /**
63
+ * Get all pages from resolved IR as an array
64
+ *
65
+ * @param ir - Resolved IR
66
+ * @returns Array of resolved pages
67
+ */
68
+ declare function getPages(ir: ResolvedIR): ResolvedPage[];
69
+ /**
70
+ * Get a specific entity from resolved IR by name
71
+ *
72
+ * @param ir - Resolved IR
73
+ * @param entityName - Entity name to find
74
+ * @returns Resolved entity or undefined
75
+ */
76
+ declare function getEntity(ir: ResolvedIR, entityName: string): ResolvedEntity | undefined;
77
+ /**
78
+ * Get a specific trait from resolved IR by name
79
+ *
80
+ * @param ir - Resolved IR
81
+ * @param traitName - Trait name to find
82
+ * @returns Resolved trait or undefined
83
+ */
84
+ declare function getTrait(ir: ResolvedIR, traitName: string): ResolvedTrait | undefined;
85
+
86
+ export { OrbitalSchema as AppSchema, OrbitalSchema, ResolvedEntity, ResolvedIR, ResolvedPage, ResolvedTrait, clearSchemaCache, getEntity, getPage, getPages, getSchemaCacheStats, getTrait, schemaToIR };