@almadar/core 2.1.0 → 2.1.1
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 +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +21 -1
- package/dist/types/index.js +11 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -495,6 +495,26 @@ interface ServiceEvents<EventMap extends Record<string, Record<string, unknown>>
|
|
|
495
495
|
emit<E extends keyof EventMap & string>(event: E, payload: EventMap[E]): void;
|
|
496
496
|
on<E extends keyof EventMap & string>(event: E, handler: (payload: EventMap[E]) => void): () => void;
|
|
497
497
|
}
|
|
498
|
+
/**
|
|
499
|
+
* Create a typed view of an untyped EventBus. Wraps the raw EventBus
|
|
500
|
+
* with compile-time type checking while keeping runtime behavior identical.
|
|
501
|
+
*
|
|
502
|
+
* @example
|
|
503
|
+
* ```typescript
|
|
504
|
+
* type LLMEventMap = {
|
|
505
|
+
* LLM_RESPONSE: { requestId: string; content: string };
|
|
506
|
+
* LLM_ERROR: { requestId: string; error: string };
|
|
507
|
+
* };
|
|
508
|
+
*
|
|
509
|
+
* const typedBus = createTypedEventBus<LLMEventMap>(getServerEventBus());
|
|
510
|
+
* typedBus.emit('LLM_RESPONSE', { requestId: '1', content: '...' }); // type-safe
|
|
511
|
+
* typedBus.on('LLM_ERROR', (payload) => { payload.error; }); // payload is typed
|
|
512
|
+
* ```
|
|
513
|
+
*/
|
|
514
|
+
declare function createTypedEventBus<EventMap extends Record<string, Record<string, unknown>>>(bus: {
|
|
515
|
+
emit(event: string, payload?: unknown, meta?: Record<string, unknown>): void;
|
|
516
|
+
on(event: string, handler: (payload: unknown, meta?: Record<string, unknown>) => void): () => void;
|
|
517
|
+
}): ServiceEvents<EventMap>;
|
|
498
518
|
/** Filter operator for store queries. */
|
|
499
519
|
type StoreFilterOp = "==" | "!=" | "<" | "<=" | ">" | ">=" | "in" | "not-in" | "contains";
|
|
500
520
|
/** A single filter clause for store queries. */
|
|
@@ -823,4 +843,4 @@ declare function createResolvedField(field: {
|
|
|
823
843
|
}): ResolvedField;
|
|
824
844
|
declare function isResolvedIR(ir: unknown): ir is ResolvedIR;
|
|
825
845
|
|
|
826
|
-
export { type AppSummary, BINDING_CONTEXT_RULES, BINDING_DOCS, type BindingContext, BindingSchema, type CategorizedRemovals, type ChangeAuthor, type ChangeSetDocument, type ChangeSummary, type CreateFlow, DEFAULT_INTERACTION_MODELS, type DeleteFlow, type EditFlow, type GitHubLink, type HistoryMeta, type InteractionModel, type InteractionModelInput, InteractionModelSchema, type LazyService, type ListInteraction, type OperatorName, type PageContentReduction, PatternTypeSchema, type ResolvedEntity, type ResolvedEntityBinding, type ResolvedField, type ResolvedIR, type ResolvedNavigation, type ResolvedPage, type ResolvedPattern, type ResolvedSection, type ResolvedSectionEvent, type ResolvedTrait, type ResolvedTraitBinding, type ResolvedTraitDataEntity, type ResolvedTraitEvent, type ResolvedTraitGuard, type ResolvedTraitListener, type ResolvedTraitState, type ResolvedTraitTick, type ResolvedTraitTransition, type ResolvedTraitUIBinding, SExpr, type SaveOptions, type SaveResult, type SchemaChange, type ServiceAction, type ServiceContract, type ServiceEvents, type SnapshotDocument, type StatsView, type StoreContract, type StoreFilter, type StoreFilterOp, type TransitionFrom, type ValidationDocument, type ValidationIssue, type ValidationMeta, type ValidationResults, type ViewFlow, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, getAllOperators, getAllPatternTypes, getBindingExamples, getInteractionModelForDomain, inferTsType, isResolvedIR, validateBindingInContext };
|
|
846
|
+
export { type AppSummary, BINDING_CONTEXT_RULES, BINDING_DOCS, type BindingContext, BindingSchema, type CategorizedRemovals, type ChangeAuthor, type ChangeSetDocument, type ChangeSummary, type CreateFlow, DEFAULT_INTERACTION_MODELS, type DeleteFlow, type EditFlow, type GitHubLink, type HistoryMeta, type InteractionModel, type InteractionModelInput, InteractionModelSchema, type LazyService, type ListInteraction, type OperatorName, type PageContentReduction, PatternTypeSchema, type ResolvedEntity, type ResolvedEntityBinding, type ResolvedField, type ResolvedIR, type ResolvedNavigation, type ResolvedPage, type ResolvedPattern, type ResolvedSection, type ResolvedSectionEvent, type ResolvedTrait, type ResolvedTraitBinding, type ResolvedTraitDataEntity, type ResolvedTraitEvent, type ResolvedTraitGuard, type ResolvedTraitListener, type ResolvedTraitState, type ResolvedTraitTick, type ResolvedTraitTransition, type ResolvedTraitUIBinding, SExpr, type SaveOptions, type SaveResult, type SchemaChange, type ServiceAction, type ServiceContract, type ServiceEvents, type SnapshotDocument, type StatsView, type StoreContract, type StoreFilter, type StoreFilterOp, type TransitionFrom, type ValidationDocument, type ValidationIssue, type ValidationMeta, type ValidationResults, type ViewFlow, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, getAllOperators, getAllPatternTypes, getBindingExamples, getInteractionModelForDomain, inferTsType, isResolvedIR, validateBindingInContext };
|
package/dist/types/index.js
CHANGED
|
@@ -1125,6 +1125,16 @@ function getAllPatternTypes() {
|
|
|
1125
1125
|
}
|
|
1126
1126
|
|
|
1127
1127
|
// src/service-types.ts
|
|
1128
|
+
function createTypedEventBus(bus) {
|
|
1129
|
+
return {
|
|
1130
|
+
emit(event, payload) {
|
|
1131
|
+
bus.emit(event, payload);
|
|
1132
|
+
},
|
|
1133
|
+
on(event, handler) {
|
|
1134
|
+
return bus.on(event, handler);
|
|
1135
|
+
}
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1128
1138
|
function createLazyService(factory) {
|
|
1129
1139
|
let instance = null;
|
|
1130
1140
|
return {
|
|
@@ -1202,6 +1212,6 @@ function isResolvedIR(ir) {
|
|
|
1202
1212
|
return typeof r.appName === "string" && r.traits instanceof Map && r.pages instanceof Map;
|
|
1203
1213
|
}
|
|
1204
1214
|
|
|
1205
|
-
export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, AgentDomainCategorySchema, 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, collectBindings, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, 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 };
|
|
1215
|
+
export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, AgentDomainCategorySchema, 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, collectBindings, createAssetKey, createEmptyResolvedPage, createEmptyResolvedTrait, createLazyService, createResolvedField, createTypedEventBus, 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 };
|
|
1206
1216
|
//# sourceMappingURL=index.js.map
|
|
1207
1217
|
//# sourceMappingURL=index.js.map
|