@almadar/core 8.5.1 → 8.6.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.d.ts +3 -3
- package/dist/builders.js +58 -50
- package/dist/builders.js.map +1 -1
- package/dist/{compose-behaviors-TSp2c_dn.d.ts → compose-behaviors-DUv4yYRF.d.ts} +1 -1
- package/dist/factory/index.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +92 -59
- package/dist/index.js.map +1 -1
- package/dist/{schema-Dp98Xt5i.d.ts → schema-TBowD2oF.d.ts} +1 -1
- package/dist/{trait-BV1DyJ2A.d.ts → trait-CvzQvW-e.d.ts} +47 -12
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.js +57 -49
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
package/dist/factory/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bu as TraitEventListener, B as EntityField, H as EntityPersistence, bz as TraitReference } from '../trait-
|
|
1
|
+
import { bu as TraitEventListener, B as EntityField, H as EntityPersistence, bz as TraitReference } from '../trait-CvzQvW-e.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../expression-BVRFm0sV.js';
|
|
4
4
|
import '@almadar/patterns';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a3 as OrbitalSchema, X as OrbitalDefinition } from './schema-
|
|
2
|
-
export { A as AGENT_DOMAIN_CATEGORIES, a as ALLOWED_CUSTOM_COMPONENTS, b as AgentDomainCategory, c as AgentDomainCategorySchema, d as AllowedCustomComponent, C as ComputedEventContract, e as ComputedEventContractSchema, f as ComputedEventListener, g as ComputedEventListenerSchema, h as CustomPatternDefinition, i as CustomPatternDefinitionInput, j as CustomPatternDefinitionSchema, k as CustomPatternMap, l as CustomPatternMapInput, m as CustomPatternMapSchema, D as DesignPreferences, n as DesignPreferencesInput, o as DesignPreferencesSchema, p as DesignTokens, q as DesignTokensInput, r as DesignTokensSchema, s as DomainCategory, t as DomainCategorySchema, u as DomainContext, v as DomainContextInput, w as DomainContextSchema, x as DomainVocabulary, y as DomainVocabularySchema, E as EntityCall, z as EntityCallSchema, B as EntityRef, F as EntityRefSchema, G as EntityRefStringSchema, H as EntitySemanticRole, I as EntitySemanticRoleSchema, J as EventListener, K as EventListenerSchema, L as EventSemanticRole, M as EventSemanticRoleSchema, N as EventSource, O as EventSourceSchema, T as FullOrbitalUnit, P as GameSubCategory, Q as GameSubCategorySchema, R as NodeClassification, S as NodeClassificationSchema, T as Orbital, U as OrbitalConfig, V as OrbitalConfigInput, W as OrbitalConfigSchema, Y as OrbitalDefinitionSchema, Z as OrbitalInput, _ as OrbitalPage, $ as OrbitalPageInput, a0 as OrbitalPageSchema, a1 as OrbitalPageStrictInput, a2 as OrbitalPageStrictSchema, a5 as OrbitalSchemaInput, a6 as OrbitalSchemaSchema, a7 as OrbitalSchemaWithTraits, a8 as OrbitalUnit, a9 as OrbitalUnitSchema, a4 as OrbitalZodSchema, aa as Page, ab as PageRef, ac as PageRefObject, ad as PageRefObjectSchema, ae as PageRefSchema, af as PageRefStringSchema, ag as PageSchema, ah as PageTraitRef, ai as PageTraitRefSchema, aj as RelatedLink, ak as RelatedLinkSchema, al as StateSemanticRole, am as StateSemanticRoleSchema, an as SuggestedGuard, ao as SuggestedGuardSchema, ap as ThemeDefinition, aq as ThemeDefinitionSchema, ar as ThemeRef, as as ThemeRefSchema, at as ThemeRefStringSchema, au as ThemeTokens, av as ThemeTokensSchema, aw as ThemeVariant, ax as ThemeVariantSchema, ay as UXHints, az as UXHintsSchema, aA as UseDeclaration, aB as UseDeclarationSchema, aC as UserPersona, aD as UserPersonaInput, aE as UserPersonaSchema, aF as ViewType, aG as ViewTypeSchema, aH as isEntityCall, aI as isEntityReference, aJ as isEntityReferenceAny, aK as isImportedTraitRef, aL as isOrbitalDefinition, aM as isPageReference, aN as isPageReferenceObject, aO as isPageReferenceString, aP as isThemeReference, aQ as parseEntityRef, aR as parseImportedTraitRef, aS as parseOrbitalSchema, aT as parsePageRef, aU as safeParseOrbitalSchema } from './schema-
|
|
3
|
-
import { b7 as State } from './trait-
|
|
4
|
-
export { A as AgentEffect, a as AnimationDef, b as AnimationDefInput, c as AnimationDefSchema, d as AssetMap, e as AssetMapInput, f as AssetMapSchema, g as AssetMapping, h as AssetMappingInput, i as AssetMappingSchema, j as AtomicEffect, C as CallServiceConfig, k as CallServiceEffect, l as CheckpointLoadEffect, m as CheckpointSaveEffect, n as ConfigFieldDeclaration, o as ConfigFieldDeclarationSchema, D as DeclaredTraitConfig, p as DeclaredTraitConfigSchema, q as DerefEffect, r as DespawnEffect, s as DoEffect, E as ENTITY_ROLES, t as Effect, u as EffectInput, v as EffectSchema, w as EmitConfig, x as EmitEffect, y as Entity, z as EntityData, B as EntityField, F as EntityFieldInput, G as EntityFieldSchema, H as EntityPersistence, I as EntityPersistenceSchema, J as EntityRole, K as EntityRoleSchema, L as EntityRow, M as EntitySchema, N as EvaluateConfig, O as EvaluateEffect, P as Event, Q as EventInput, R as EventPayloadField, S as EventPayloadFieldSchema, T as EventSchema, U as EventScope, V as EventScopeSchema, W as FetchEffect, X as FetchOptions, Y as FetchResult, Z as Field, _ as FieldFormat, $ as FieldFormatSchema, a0 as FieldSchema, a1 as FieldType, a2 as FieldTypeSchema, a3 as FieldValue, a4 as ForwardConfig, a5 as ForwardEffect, a6 as GAME_TYPES, a7 as GameType, a8 as GameTypeSchema, a9 as Guard, aa as GuardInput, ab as GuardSchema, ac as ListenSource, ad as ListenSourceSchema, ae as LogEffect, af as McpServiceDef, ag as McpServiceDefSchema, ah as NavigateEffect, ai as NnConfig, aj as NnLayer, ak as NotifyEffect, al as OrbitalEntity, am as OrbitalEntityInput, an as OrbitalEntitySchema, ao as OrbitalTraitRef, ap as OrbitalTraitRefSchema, aq as OsEffect, ar as PayloadField, as as PayloadFieldSchema, at as PersistData, au as PersistEffect, av as PersistEmitConfig, aw as PresentationType, ax as RefEffect, ay as RelationConfig, az as RelationConfigSchema, aA as RenderItemLambda, aB as RenderUIConfig, aC as RenderUIEffect, aD as RenderUINode, aE as RequiredField, aF as RequiredFieldSchema, aG as ResolvedAsset, aH as ResolvedAssetInput, aI as ResolvedAssetSchema, aJ as ResolvedPatternProps, aK as RestAuthConfig, aL as RestAuthConfigSchema, aM as RestServiceDef, aN as RestServiceDefSchema, aO as SERVICE_TYPES, aP as SemanticAssetRef, aQ as SemanticAssetRefInput, aR as SemanticAssetRefSchema, aS as ServiceDefinition, aT as ServiceDefinitionSchema, aU as ServiceParams, aV as ServiceParamsValue, aW as ServiceRef, aX as ServiceRefObject, aY as ServiceRefObjectSchema, aZ as ServiceRefSchema, a_ as ServiceRefStringSchema, a$ as ServiceType, b0 as ServiceTypeSchema, b1 as SetEffect, b2 as SocketEvents, b3 as SocketEventsSchema, b4 as SocketServiceDef, b5 as SocketServiceDefSchema, b6 as SpawnEffect, b8 as StateInput, b9 as StateMachine, ba as StateMachineInput, bb as StateMachineSchema, bc as StateSchema, bd as SwapEffect, be as TrainConfig, bf as TrainEffect, bg as Trait, bh as TraitCategory, bi as TraitCategorySchema, bj as TraitConfig, bk as TraitConfigObject, bl as TraitConfigSchema, bm as TraitConfigValue, bn as TraitConfigValueSchema, bo as TraitDataEntity, bp as TraitDataEntitySchema, bq as TraitEntityField, br as TraitEntityFieldSchema, bs as TraitEventContract, bt as TraitEventContractSchema, bu as TraitEventListener, bv as TraitEventListenerSchema, bw as TraitInput, bx as TraitRef, by as TraitRefSchema, bz as TraitReference, bA as TraitReferenceInput, bB as TraitReferenceSchema, bC as TraitSchema, bD as TraitTick, bE as TraitTickSchema, bF as TraitUIBinding, bG as Transition, bH as TransitionInput, bI as TransitionSchema, bJ as TypedEffect, bK as UISlot, bL as UISlotSchema, bM as UI_SLOTS, bN as VISUAL_STYLES, bO as VisualStyle, bP as VisualStyleSchema, bQ as WatchEffect, bR as WatchOptions, bS as atomic, bT as callService, bU as createAssetKey, bV as deref, bW as deriveCollection, bX as despawn, bY as doEffects, bZ as emit, b_ as findService, b$ as getDefaultAnimationsForRole, c0 as getServiceNames, c1 as getTraitConfig, c2 as getTraitName, c3 as hasService, c4 as isCircuitEvent, c5 as isEffect, c6 as isInlineTrait, c7 as isMcpService, c8 as isRestService, c9 as isRuntimeEntity, ca as isSExprEffect, cb as isServiceReference, cc as isServiceReferenceObject, cd as isSingletonEntity, ce as isSocketService, cf as navigate, cg as normalizeTraitRef, ch as notify, ci as parseAssetKey, cj as parseServiceRef, ck as persist, cl as ref, cm as renderUI, cn as set, co as spawn, cp as swap, cq as validateAssetAnimations, cr as watch } from './trait-
|
|
1
|
+
import { a3 as OrbitalSchema, X as OrbitalDefinition } from './schema-TBowD2oF.js';
|
|
2
|
+
export { A as AGENT_DOMAIN_CATEGORIES, a as ALLOWED_CUSTOM_COMPONENTS, b as AgentDomainCategory, c as AgentDomainCategorySchema, d as AllowedCustomComponent, C as ComputedEventContract, e as ComputedEventContractSchema, f as ComputedEventListener, g as ComputedEventListenerSchema, h as CustomPatternDefinition, i as CustomPatternDefinitionInput, j as CustomPatternDefinitionSchema, k as CustomPatternMap, l as CustomPatternMapInput, m as CustomPatternMapSchema, D as DesignPreferences, n as DesignPreferencesInput, o as DesignPreferencesSchema, p as DesignTokens, q as DesignTokensInput, r as DesignTokensSchema, s as DomainCategory, t as DomainCategorySchema, u as DomainContext, v as DomainContextInput, w as DomainContextSchema, x as DomainVocabulary, y as DomainVocabularySchema, E as EntityCall, z as EntityCallSchema, B as EntityRef, F as EntityRefSchema, G as EntityRefStringSchema, H as EntitySemanticRole, I as EntitySemanticRoleSchema, J as EventListener, K as EventListenerSchema, L as EventSemanticRole, M as EventSemanticRoleSchema, N as EventSource, O as EventSourceSchema, T as FullOrbitalUnit, P as GameSubCategory, Q as GameSubCategorySchema, R as NodeClassification, S as NodeClassificationSchema, T as Orbital, U as OrbitalConfig, V as OrbitalConfigInput, W as OrbitalConfigSchema, Y as OrbitalDefinitionSchema, Z as OrbitalInput, _ as OrbitalPage, $ as OrbitalPageInput, a0 as OrbitalPageSchema, a1 as OrbitalPageStrictInput, a2 as OrbitalPageStrictSchema, a5 as OrbitalSchemaInput, a6 as OrbitalSchemaSchema, a7 as OrbitalSchemaWithTraits, a8 as OrbitalUnit, a9 as OrbitalUnitSchema, a4 as OrbitalZodSchema, aa as Page, ab as PageRef, ac as PageRefObject, ad as PageRefObjectSchema, ae as PageRefSchema, af as PageRefStringSchema, ag as PageSchema, ah as PageTraitRef, ai as PageTraitRefSchema, aj as RelatedLink, ak as RelatedLinkSchema, al as StateSemanticRole, am as StateSemanticRoleSchema, an as SuggestedGuard, ao as SuggestedGuardSchema, ap as ThemeDefinition, aq as ThemeDefinitionSchema, ar as ThemeRef, as as ThemeRefSchema, at as ThemeRefStringSchema, au as ThemeTokens, av as ThemeTokensSchema, aw as ThemeVariant, ax as ThemeVariantSchema, ay as UXHints, az as UXHintsSchema, aA as UseDeclaration, aB as UseDeclarationSchema, aC as UserPersona, aD as UserPersonaInput, aE as UserPersonaSchema, aF as ViewType, aG as ViewTypeSchema, aH as isEntityCall, aI as isEntityReference, aJ as isEntityReferenceAny, aK as isImportedTraitRef, aL as isOrbitalDefinition, aM as isPageReference, aN as isPageReferenceObject, aO as isPageReferenceString, aP as isThemeReference, aQ as parseEntityRef, aR as parseImportedTraitRef, aS as parseOrbitalSchema, aT as parsePageRef, aU as safeParseOrbitalSchema } from './schema-TBowD2oF.js';
|
|
3
|
+
import { b7 as State } from './trait-CvzQvW-e.js';
|
|
4
|
+
export { A as AgentEffect, a as AnimationDef, b as AnimationDefInput, c as AnimationDefSchema, d as AssetMap, e as AssetMapInput, f as AssetMapSchema, g as AssetMapping, h as AssetMappingInput, i as AssetMappingSchema, j as AtomicEffect, C as CallServiceConfig, k as CallServiceEffect, l as CheckpointLoadEffect, m as CheckpointSaveEffect, n as ConfigFieldDeclaration, o as ConfigFieldDeclarationSchema, D as DeclaredTraitConfig, p as DeclaredTraitConfigSchema, q as DerefEffect, r as DespawnEffect, s as DoEffect, E as ENTITY_ROLES, t as Effect, u as EffectInput, v as EffectSchema, w as EmitConfig, x as EmitEffect, y as Entity, z as EntityData, B as EntityField, F as EntityFieldInput, G as EntityFieldSchema, H as EntityPersistence, I as EntityPersistenceSchema, J as EntityRole, K as EntityRoleSchema, L as EntityRow, M as EntitySchema, N as EvaluateConfig, O as EvaluateEffect, P as Event, Q as EventInput, R as EventPayloadField, S as EventPayloadFieldSchema, T as EventSchema, U as EventScope, V as EventScopeSchema, W as FetchEffect, X as FetchOptions, Y as FetchResult, Z as Field, _ as FieldFormat, $ as FieldFormatSchema, a0 as FieldSchema, a1 as FieldType, a2 as FieldTypeSchema, a3 as FieldValue, a4 as ForwardConfig, a5 as ForwardEffect, a6 as GAME_TYPES, a7 as GameType, a8 as GameTypeSchema, a9 as Guard, aa as GuardInput, ab as GuardSchema, ac as ListenSource, ad as ListenSourceSchema, ae as LogEffect, af as McpServiceDef, ag as McpServiceDefSchema, ah as NavigateEffect, ai as NnConfig, aj as NnLayer, ak as NotifyEffect, al as OrbitalEntity, am as OrbitalEntityInput, an as OrbitalEntitySchema, ao as OrbitalTraitRef, ap as OrbitalTraitRefSchema, aq as OsEffect, ar as PayloadField, as as PayloadFieldSchema, at as PersistData, au as PersistEffect, av as PersistEmitConfig, aw as PresentationType, ax as RefEffect, ay as RelationConfig, az as RelationConfigSchema, aA as RenderItemLambda, aB as RenderUIConfig, aC as RenderUIEffect, aD as RenderUINode, aE as RequiredField, aF as RequiredFieldSchema, aG as ResolvedAsset, aH as ResolvedAssetInput, aI as ResolvedAssetSchema, aJ as ResolvedPatternProps, aK as RestAuthConfig, aL as RestAuthConfigSchema, aM as RestServiceDef, aN as RestServiceDefSchema, aO as SERVICE_TYPES, aP as SemanticAssetRef, aQ as SemanticAssetRefInput, aR as SemanticAssetRefSchema, aS as ServiceDefinition, aT as ServiceDefinitionSchema, aU as ServiceParams, aV as ServiceParamsValue, aW as ServiceRef, aX as ServiceRefObject, aY as ServiceRefObjectSchema, aZ as ServiceRefSchema, a_ as ServiceRefStringSchema, a$ as ServiceType, b0 as ServiceTypeSchema, b1 as SetEffect, b2 as SocketEvents, b3 as SocketEventsSchema, b4 as SocketServiceDef, b5 as SocketServiceDefSchema, b6 as SpawnEffect, b8 as StateInput, b9 as StateMachine, ba as StateMachineInput, bb as StateMachineSchema, bc as StateSchema, bd as SwapEffect, be as TrainConfig, bf as TrainEffect, bg as Trait, bh as TraitCategory, bi as TraitCategorySchema, bj as TraitConfig, bk as TraitConfigObject, bl as TraitConfigSchema, bm as TraitConfigValue, bn as TraitConfigValueSchema, bo as TraitDataEntity, bp as TraitDataEntitySchema, bq as TraitEntityField, br as TraitEntityFieldSchema, bs as TraitEventContract, bt as TraitEventContractSchema, bu as TraitEventListener, bv as TraitEventListenerSchema, bw as TraitInput, bx as TraitRef, by as TraitRefSchema, bz as TraitReference, bA as TraitReferenceInput, bB as TraitReferenceSchema, bC as TraitSchema, bD as TraitTick, bE as TraitTickSchema, bF as TraitUIBinding, bG as Transition, bH as TransitionInput, bI as TransitionSchema, bJ as TypedEffect, bK as UISlot, bL as UISlotSchema, bM as UI_SLOTS, bN as VISUAL_STYLES, bO as VisualStyle, bP as VisualStyleSchema, bQ as WatchEffect, bR as WatchOptions, bS as atomic, bT as callService, bU as createAssetKey, bV as deref, bW as deriveCollection, bX as despawn, bY as doEffects, bZ as emit, b_ as findService, b$ as getDefaultAnimationsForRole, c0 as getServiceNames, c1 as getTraitConfig, c2 as getTraitName, c3 as hasService, c4 as isCircuitEvent, c5 as isEffect, c6 as isInlineTrait, c7 as isMcpService, c8 as isRestService, c9 as isRuntimeEntity, ca as isSExprEffect, cb as isServiceReference, cc as isServiceReferenceObject, cd as isSingletonEntity, ce as isSocketService, cf as navigate, cg as normalizeTraitRef, ch as notify, ci as parseAssetKey, cj as parseServiceRef, ck as persist, cl as ref, cm as renderUI, cn as set, co as spawn, cp as swap, cq as validateAssetAnimations, cr as watch } from './trait-CvzQvW-e.js';
|
|
5
5
|
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';
|
|
6
6
|
import { ResolvedIR, ResolvedEntity, ResolvedPage, ResolvedTrait, ChangesetValue, SchemaChange, CategorizedRemovals, PageContentReduction, SemanticSchemaChange } from './types/index.js';
|
|
7
7
|
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';
|
|
8
8
|
export { CallSiteDiff, FactoryCallPlanMutation, FactoryCallPlanState, FactoryCallSite, FactoryCallSiteParams, FactoryConfigParam, FactoryEntitySignature, FactoryPageSignature, FactoryParamValue, FactorySignature, FactorySignatureCatalog, FactorySignatureEntityField, FactoryTraitSignature, JsonSchema, JsonSchemaType, JsonValue, OrbitalCallInput, OwnershipOverlayEntry, PresentationNavItem, PresentationOverlay, RuleOverlay, RuleOverlayEntry, SchemaFieldType, TraitOverlay, TraitOverlayEntry, TraitOverlayListener, TranslationBinding, TranslationResult, TranslationWarning, applyFactoryCallPlanMutation, diffFactoryCalls, translateOverlaysToParams } from './factory/index.js';
|
|
9
|
-
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-
|
|
9
|
+
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-DUv4yYRF.js';
|
|
10
10
|
export { PATTERN_TYPES, PatternConfig, PatternType, isValidPatternType } from '@almadar/patterns';
|
|
11
11
|
export { BFSNode, BFSPathNode, EdgeWalkTransition, GraphTransition, GuardPayload, ReplayStep, ReplayTransition, StateEdge, WalkStep, buildEdgeCoveringWalk, buildGuardPayloads, buildReplayPaths, buildStateGraph, collectReachableStates, extractPayloadFieldRef, walkStatePairs } from './state-machine/index.js';
|
|
12
12
|
import 'zod';
|
package/dist/index.js
CHANGED
|
@@ -57,58 +57,66 @@ var FIELD_TYPE_ALIASES = {
|
|
|
57
57
|
float: "number",
|
|
58
58
|
ts: "timestamp"
|
|
59
59
|
};
|
|
60
|
-
var EntityFieldSchema = z.lazy(
|
|
61
|
-
|
|
60
|
+
var EntityFieldSchema = z.lazy(() => {
|
|
61
|
+
const baseFieldShape = {
|
|
62
|
+
name: z.string().min(1, "Field name is required").optional(),
|
|
63
|
+
required: z.boolean().optional(),
|
|
64
|
+
default: z.unknown().optional(),
|
|
65
|
+
format: FieldFormatSchema.optional(),
|
|
66
|
+
min: z.number().optional(),
|
|
67
|
+
max: z.number().optional(),
|
|
68
|
+
properties: z.record(EntityFieldSchema).optional()
|
|
69
|
+
};
|
|
70
|
+
function scalarVariant(t) {
|
|
71
|
+
return z.object({ ...baseFieldShape, type: z.literal(t) });
|
|
72
|
+
}
|
|
73
|
+
return z.preprocess(
|
|
62
74
|
(input) => {
|
|
63
|
-
if (input
|
|
64
|
-
|
|
65
|
-
const canonical = FIELD_TYPE_ALIASES[raw];
|
|
66
|
-
if (canonical !== void 0) {
|
|
67
|
-
return { ...input, type: canonical };
|
|
68
|
-
}
|
|
75
|
+
if (input === null || typeof input !== "object" || !("type" in input) || typeof input.type !== "string") {
|
|
76
|
+
return input;
|
|
69
77
|
}
|
|
70
|
-
|
|
78
|
+
const obj = input;
|
|
79
|
+
const next = { ...obj };
|
|
80
|
+
const aliased = FIELD_TYPE_ALIASES[obj.type];
|
|
81
|
+
if (aliased !== void 0) next["type"] = aliased;
|
|
82
|
+
if (next["enum"] !== void 0 && next["values"] === void 0) {
|
|
83
|
+
next["values"] = next["enum"];
|
|
84
|
+
}
|
|
85
|
+
delete next["enum"];
|
|
86
|
+
return next;
|
|
71
87
|
},
|
|
72
|
-
z.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
(field) => {
|
|
105
|
-
if (field.type !== "array") return true;
|
|
106
|
-
return field.items !== void 0;
|
|
107
|
-
},
|
|
108
|
-
{ message: "Array field requires an `items` schema describing each element", path: ["items"] }
|
|
109
|
-
)
|
|
110
|
-
)
|
|
111
|
-
);
|
|
88
|
+
z.discriminatedUnion("type", [
|
|
89
|
+
scalarVariant("string"),
|
|
90
|
+
scalarVariant("number"),
|
|
91
|
+
scalarVariant("boolean"),
|
|
92
|
+
scalarVariant("date"),
|
|
93
|
+
scalarVariant("timestamp"),
|
|
94
|
+
scalarVariant("datetime"),
|
|
95
|
+
scalarVariant("object"),
|
|
96
|
+
scalarVariant("trait"),
|
|
97
|
+
scalarVariant("slot"),
|
|
98
|
+
scalarVariant("pattern"),
|
|
99
|
+
// Enum variant — REQUIRES non-empty values.
|
|
100
|
+
z.object({
|
|
101
|
+
...baseFieldShape,
|
|
102
|
+
type: z.literal("enum"),
|
|
103
|
+
values: z.array(z.string()).min(1, "Enum field requires a non-empty `values` array")
|
|
104
|
+
}),
|
|
105
|
+
// Relation variant — REQUIRES relation config.
|
|
106
|
+
z.object({
|
|
107
|
+
...baseFieldShape,
|
|
108
|
+
type: z.literal("relation"),
|
|
109
|
+
relation: RelationConfigSchema
|
|
110
|
+
}),
|
|
111
|
+
// Array variant — REQUIRES items schema.
|
|
112
|
+
z.object({
|
|
113
|
+
...baseFieldShape,
|
|
114
|
+
type: z.literal("array"),
|
|
115
|
+
items: EntityFieldSchema
|
|
116
|
+
})
|
|
117
|
+
])
|
|
118
|
+
);
|
|
119
|
+
});
|
|
112
120
|
var FieldSchema = EntityFieldSchema;
|
|
113
121
|
var ENTITY_ROLES = [
|
|
114
122
|
"player",
|
|
@@ -1489,9 +1497,9 @@ function schemaToIR(schema, useCache = true) {
|
|
|
1489
1497
|
description: field.description,
|
|
1490
1498
|
default: field.default,
|
|
1491
1499
|
required: field.required ?? false,
|
|
1492
|
-
values: field.values,
|
|
1493
|
-
enumValues: field.values,
|
|
1494
|
-
relation: field.relation
|
|
1500
|
+
values: field.type === "enum" ? field.values : void 0,
|
|
1501
|
+
enumValues: field.type === "enum" ? field.values : void 0,
|
|
1502
|
+
relation: field.type === "relation" ? field.relation : void 0
|
|
1495
1503
|
})),
|
|
1496
1504
|
runtime: entityDef.persistence === "runtime",
|
|
1497
1505
|
singleton: entityDef.persistence === "singleton",
|
|
@@ -2149,19 +2157,44 @@ function isBusinessField(field) {
|
|
|
2149
2157
|
return false;
|
|
2150
2158
|
}
|
|
2151
2159
|
function summarizeEntity(entity) {
|
|
2152
|
-
const fields = entity.fields.filter(isBusinessField).map(
|
|
2153
|
-
const summary = { name: f.name, type: f.type };
|
|
2154
|
-
if (f.required) summary.required = true;
|
|
2155
|
-
if (f.type === "enum" && f.values) summary.values = f.values;
|
|
2156
|
-
if (f.type === "relation" && f.relation) summary.relation = f.relation;
|
|
2157
|
-
return summary;
|
|
2158
|
-
});
|
|
2160
|
+
const fields = entity.fields.filter(isBusinessField).map(summarizeField);
|
|
2159
2161
|
return {
|
|
2160
2162
|
name: entity.name,
|
|
2161
2163
|
collection: entity.collection,
|
|
2162
2164
|
fields
|
|
2163
2165
|
};
|
|
2164
2166
|
}
|
|
2167
|
+
function summarizeField(f) {
|
|
2168
|
+
if (f.type === "enum") {
|
|
2169
|
+
return {
|
|
2170
|
+
...f.name !== void 0 ? { name: f.name } : {},
|
|
2171
|
+
type: "enum",
|
|
2172
|
+
values: f.values,
|
|
2173
|
+
...f.required ? { required: true } : {}
|
|
2174
|
+
};
|
|
2175
|
+
}
|
|
2176
|
+
if (f.type === "relation") {
|
|
2177
|
+
return {
|
|
2178
|
+
...f.name !== void 0 ? { name: f.name } : {},
|
|
2179
|
+
type: "relation",
|
|
2180
|
+
relation: f.relation,
|
|
2181
|
+
...f.required ? { required: true } : {}
|
|
2182
|
+
};
|
|
2183
|
+
}
|
|
2184
|
+
if (f.type === "array") {
|
|
2185
|
+
return {
|
|
2186
|
+
...f.name !== void 0 ? { name: f.name } : {},
|
|
2187
|
+
type: "array",
|
|
2188
|
+
items: f.items,
|
|
2189
|
+
...f.required ? { required: true } : {}
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
return {
|
|
2193
|
+
...f.name !== void 0 ? { name: f.name } : {},
|
|
2194
|
+
type: f.type,
|
|
2195
|
+
...f.required ? { required: true } : {}
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2165
2198
|
function summarizeTransitions(transitions) {
|
|
2166
2199
|
const seen = /* @__PURE__ */ new Set();
|
|
2167
2200
|
const result = [];
|