@almadar/core 10.129.0 → 11.0.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/behavior-package.d.ts +49 -11
- package/dist/behavior-package.js +1 -1
- package/dist/{orbital-CkFdDS9f.d.ts → builders-BdgbY7Th.d.ts} +5828 -6917
- package/dist/builders.d.ts +6 -6
- package/dist/builders.js +7 -6
- package/dist/{bus-CcbB__oo.d.ts → bus-C0hFDNFR.d.ts} +262 -354
- package/dist/chunk-347APWFM.js +286 -0
- package/dist/chunk-347APWFM.js.map +1 -0
- package/dist/chunk-5WQ3U7NJ.js +2363 -0
- package/dist/chunk-5WQ3U7NJ.js.map +1 -0
- package/dist/chunk-5YTPYMPZ.js +99 -0
- package/dist/chunk-5YTPYMPZ.js.map +1 -0
- package/dist/chunk-66Q5VX2F.js +3810 -0
- package/dist/chunk-66Q5VX2F.js.map +1 -0
- package/dist/chunk-7GHJU5WI.js +39 -0
- package/dist/chunk-7GHJU5WI.js.map +1 -0
- package/dist/chunk-B4MNHGBP.js +8 -0
- package/dist/chunk-B4MNHGBP.js.map +1 -0
- package/dist/chunk-E4T2MQAV.js +24 -0
- package/dist/chunk-E4T2MQAV.js.map +1 -0
- package/dist/chunk-ENOCKYGA.js +412 -0
- package/dist/chunk-ENOCKYGA.js.map +1 -0
- package/dist/chunk-FGT5OS2Y.js +918 -0
- package/dist/chunk-FGT5OS2Y.js.map +1 -0
- package/dist/chunk-GF7KCLNR.js +3284 -0
- package/dist/chunk-GF7KCLNR.js.map +1 -0
- package/dist/chunk-PNGFWLHD.js +1567 -0
- package/dist/chunk-PNGFWLHD.js.map +1 -0
- package/dist/{chunk-X4SC7FGF.js → chunk-RGACZEYC.js} +99 -96
- package/dist/chunk-RGACZEYC.js.map +1 -0
- package/dist/{chunk-RYPVOI6H.js → chunk-SNZYN7UA.js} +2541 -433
- package/dist/{chunk-RYPVOI6H.js.map → chunk-SNZYN7UA.js.map} +1 -1
- package/dist/{chunk-KDMV222Q.js → chunk-TDNQT3M3.js} +304 -373
- package/dist/chunk-TDNQT3M3.js.map +1 -0
- package/dist/chunk-VG7BRFUD.js +152 -0
- package/dist/chunk-VG7BRFUD.js.map +1 -0
- package/dist/chunk-Z7BI7DE7.js +1293 -0
- package/dist/chunk-Z7BI7DE7.js.map +1 -0
- package/dist/{domain-Dz3jP-UM.d.ts → domain-Cpmja5ak.d.ts} +55 -55
- package/dist/{effect-CiEVLsZz.d.ts → effect-DZaXwSAz.d.ts} +283 -453
- package/dist/{effect-result-Bebwu9yT.d.ts → effect-result-1HpXgeBc.d.ts} +656 -851
- package/dist/{expression-D0Fs0riG.d.ts → expression-DirYKz-f.d.ts} +5 -13
- package/dist/factory/index.d.ts +7 -144
- package/dist/factory/index.js +8 -8
- package/dist/factory-runtime/index.d.ts +7 -6
- package/dist/factory-runtime/index.js +527 -8
- package/dist/factory-runtime/index.js.map +1 -1
- package/dist/fixtures.d.ts +9 -11
- package/dist/fixtures.js +12 -8
- package/dist/fixtures.js.map +1 -1
- package/dist/i18n/index.d.ts +15 -19
- package/dist/i18n/index.js +2 -1
- package/dist/{index-BC-Jycqj.d.ts → index-D7SxwNdv.d.ts} +34 -734
- package/dist/index.d.ts +92 -247
- package/dist/index.js +322 -986
- package/dist/index.js.map +1 -1
- package/dist/kernel-wire.d.ts +3 -3
- package/dist/kernel-wire.js +3 -79
- package/dist/kernel-wire.js.map +1 -1
- package/dist/language/constructs.json +22 -2
- package/dist/language/program-types.json +203 -22
- package/dist/language/protocols.json +46 -0
- package/dist/language/ui-vocabulary.json +1697 -0
- package/dist/language/validation-codes.json +1222 -1212
- package/dist/language/vocabulary.json +44 -8
- package/dist/language-data.d.ts +7 -4
- package/dist/language-data.js +20 -14
- package/dist/language-data.js.map +1 -1
- package/dist/patterns/component-mapping.json +11 -1
- package/dist/patterns/definitions.d.ts +2 -2
- package/dist/patterns/definitions.js +1 -1
- package/dist/patterns/event-contracts.json +1 -15
- package/dist/patterns/game-font-families.json +13 -0
- package/dist/patterns/index.d.ts +24 -120
- package/dist/patterns/index.js +3 -3
- package/dist/patterns/pattern-tile-geometry.json +1065 -0
- package/dist/patterns/patterns-registry.json +2539 -431
- package/dist/patterns/registry.json +2539 -431
- package/dist/trait-sRjIivFq.d.ts +3519 -0
- package/dist/types/index.d.ts +9 -10
- package/dist/types/index.js +11 -5
- package/dist/{types-DGwrltUF.d.ts → types-C6_yPMpn.d.ts} +3 -3
- package/fixtures/events-wire/client-effects-by-trait/response.json +0 -18
- package/fixtures/events-wire/client-effects-provenance/response.json +0 -18
- package/fixtures/events-wire/effect-results-every-kind/response.json +2 -27
- package/fixtures/events-wire/navigate-1/response.json +8 -5
- package/fixtures/events-wire/navigate-2/response.json +11 -8
- package/fixtures/events-wire/navigate-3/response.json +14 -11
- package/fixtures/events-wire/navigate-back/response.json +7 -4
- package/fixtures/events-wire/render-ui-3/response.json +12 -9
- package/fixtures/events-wire/render-ui-clear/response.json +0 -7
- package/fixtures/events-wire/sse-stream/response.json +0 -20
- package/fixtures/events-wire/sse-stream/stream.json +0 -20
- package/fixtures/events-wire/stateless-traits/response.json +14 -5
- package/fixtures/kernel-wire/golden/basic-entity.json +1687 -0
- package/fixtures/kernel-wire/golden/entity-rerender.json +743 -0
- package/fixtures/kernel-wire/golden/rollback.json +793 -0
- package/fixtures/kernel-wire/golden/tick-counter.json +1538 -0
- package/fixtures/kernel-wire/golden/two-orbital-chore.json +847 -0
- package/fixtures/kernel-wire/golden/two-orbital-task.json +457 -0
- package/fixtures/kernel-wire/played-step.json +136 -0
- package/fixtures/kernel-wire/scripts/basic-entity.json +28 -0
- package/fixtures/kernel-wire/scripts/entity-rerender.json +13 -0
- package/fixtures/kernel-wire/scripts/rollback.json +53 -0
- package/fixtures/kernel-wire/scripts/tick-counter.json +26 -0
- package/fixtures/kernel-wire/scripts/two-orbital-chore.json +9 -0
- package/fixtures/kernel-wire/scripts/two-orbital-task.json +9 -0
- package/package.json +28 -19
- package/dist/builders-DmZE5By0.d.ts +0 -2663
- package/dist/chunk-45I2O4SJ.js +0 -4646
- package/dist/chunk-45I2O4SJ.js.map +0 -1
- package/dist/chunk-6LR43Z5E.js +0 -3061
- package/dist/chunk-6LR43Z5E.js.map +0 -1
- package/dist/chunk-GIUA3NUJ.js +0 -809
- package/dist/chunk-GIUA3NUJ.js.map +0 -1
- package/dist/chunk-GTY53NS5.js +0 -1908
- package/dist/chunk-GTY53NS5.js.map +0 -1
- package/dist/chunk-JOHDVS6J.js +0 -1614
- package/dist/chunk-JOHDVS6J.js.map +0 -1
- package/dist/chunk-KDMV222Q.js.map +0 -1
- package/dist/chunk-QRHJUS3D.js +0 -23
- package/dist/chunk-QRHJUS3D.js.map +0 -1
- package/dist/chunk-QUOTJULD.js +0 -4009
- package/dist/chunk-QUOTJULD.js.map +0 -1
- package/dist/chunk-V5VNGRVU.js +0 -66
- package/dist/chunk-V5VNGRVU.js.map +0 -1
- package/dist/chunk-X4SC7FGF.js.map +0 -1
- package/dist/entityAccess-BPSz1i2n.d.ts +0 -80
- package/dist/mock/index.d.ts +0 -153
- package/dist/mock/index.js +0 -190
- package/dist/mock/index.js.map +0 -1
- package/dist/schema-T5RT5s6H.d.ts +0 -282
- package/dist/state-machine/index.d.ts +0 -359
- package/dist/state-machine/index.js +0 -3
- package/dist/state-machine/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import { orbitalInlineEntities } from './chunk-V5VNGRVU.js';
|
|
2
|
-
export { entityAccessPolicies, entityAccessTable, entityOwnerOrbital, orbitalInlineEntities } from './chunk-V5VNGRVU.js';
|
|
3
1
|
export { MIN_TEXT_CONTRAST, THEME_PRESETS, builtInThemeKeys, contrastRatio, themeKeys, themeOverrideIssues } from './chunk-7NDAXM2Z.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { ENTITY_FIELD_SCHEMA, answerToMutations, answersToMutations, applyFactoryCallPlanMutation,
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export {
|
|
2
|
+
import { toWireValue, kernelEvaluator } from './chunk-5WQ3U7NJ.js';
|
|
3
|
+
export { I18N_SECTIONS, KernelEvalError, KernelEvaluatorNotInstalledError, LOLO_FIRST_TOKEN_KEYWORDS, ORB_NOTATION_KEYS, RTL_LOCALES, aliasMap, applyListenMapping, checkI18nCoverage, createKernelEvaluator, englishTables, eventPayloadOf, getVocabulary, hasKernelEvaluator, installKernelEvaluator, installedLanguages, kernelEvaluator, languageOfLoloFirstToken, languageOfOrbTopLevelKeys, lazyKernelExports, lexLolo, localeAlternates, localeDirection, localeOfPath, localizeLoloSource, localizeMap, localizeOrbValue, parseI18nTables, parseOperatorTables, parseVocabularyPack, pathLocale, registerVocabulary, reportIdenticalToEnglish, toWireValue, vocabularyOperators } from './chunk-5WQ3U7NJ.js';
|
|
4
|
+
export { ENTITY_FIELD_SCHEMA, answerToMutations, answersToMutations, applyFactoryCallPlanMutation, assertNoUnsatisfiableEnum, deriveInputType, factoryCallPlanOrbitalName, generateQuestions, humanizeKey, rehydrateKnobDefs, signatureToParamsSchema } from './chunk-TDNQT3M3.js';
|
|
5
|
+
export { orbitalTouchesOwnRecord } from './chunk-E4T2MQAV.js';
|
|
6
|
+
import { DIAGRAM_TONE_COLOR_KEYS } from './chunk-GF7KCLNR.js';
|
|
7
|
+
export { A11Y_ATTRIBUTES, ACCESSIBLE_NAME_ATTRIBUTES, ACTION_OVERFLOW_TESTID, ACTION_TESTID_PREFIX, ANONYMOUS_USER, ARIA_CURRENT, ARIA_LIVE, ARIA_PRESSED, ARIA_ROLES, AriaRoleSchema, BINDING_CONTEXT_RULES, BINDING_DOCS, BINDING_ROOTS, BindingSchema, CALL_KINDS, ClientManifestSchema, ClientThemeSchema, DIAGRAM_STROKE_WEIGHTS, DIAGRAM_TEXT_CASES, DIAGRAM_TEXT_SIZES, DIAGRAM_TONES, DIAGRAM_TONE_COLOR_KEYS, DiagramStrokeWeightSchema, DiagramTextCaseSchema, DiagramTextSizeSchema, DiagramToneSchema, DispatchVisits, EMPTY_STATE_MARKER, EVAL_TIERS, EvalSpecSchema, FORM_PATTERN, FULL_WRITE_CAPABILITIES, GESTURE_EVENT_PROPS, KNOWN_VALIDATION_ERROR_CODES, LOADING_STATE_MARKER, LOG_SEVERITIES, MachineRowSchema, NATIVE_ID_PREFIX, NATIVE_ID_SEPARATOR, PATTERN_PROP_TYPE_ERROR_TESTID, PatternTypeSchema, PayloadSlotSchema, PlayedStepSchema, ProgramInspectionSchema, ProgramSourceAnchorSchema, ProgramSourceLocationSchema, QueryCapabilitiesSchema, QueryDeclinedError, RENDER_BINDING_MARKER, ROW_SET_MARKER, RawUserClaimsSchema, RowCommitSchema, RowIdPageSchema, RowPredicateSchema, RowQueryPageSchema, RowQuerySchema, RowSetRefSchema, RowWriteBatchSchema, RowWriteOpSchema, RowWriteOutcomeSchema, SEMANTIC_CHANGE_KINDS, SURFACE_MODES, ServerBatchSummarySchema, ServerEffectResultSchema, TAB_INDEX_VALUES, TEXT_DIRECTIONS, TRAIT_MOUNT_ERROR_TESTID, TabHostFailure, TraitFieldRefSchema, VERIFICATION_DOM_ATTRS, ViewerSchema, WriteCapabilitiesSchema, WriteDeclinedError, actionTestId, actionTestIdMatches, containsEntityBinding, containsPayloadBinding, createLazyService, createTypedEventBus, dispatchVisitKey, evalPatternMatches, findPersonaInRoster, gestureActionTestId, gestureOfActionTestId, getBindingExamples, guardHolds, isAriaRole, isCallRecord, isKnownValidationErrorCode, isPlanSnapshot, isRenderBindingMarker, isRowSetMarker, isSessionHistoryEntry, isStructuredLogEntry, isTraitFieldRef, nativeFieldId, nativeIds, nativePatternId, nativeRowId, nativeSlotId, normalizeUserContext, orbitalIndexOfValidationPath, parseClientManifest, parseEvalSpec, parseFetchOrder, personaFromIdentityRow, resolvePersonaSpec, rowMatchesPredicate, rowSetMarker, runRowWrite, splitNativeIds, toBindingRoot, validateBindingInContext, widenTier } from './chunk-GF7KCLNR.js';
|
|
8
|
+
export { BusEventSourceSchema, ClientEffectTupleSchema, ClientHostAskTupleSchema, ClientNavigateBackTupleSchema, ClientNavigateTupleSchema, ClientRenderUITupleSchema, DeliveryRecordSchema, DispatchLogSchema, EmittedEventSchema, EventStreamItemSchema, HostAskCompletionSchema, LIFECYCLE_EVENTS, LiveBroadcastItemSchema, MountSeedSchema, OrbitalRegisterResponseSchema, ServerTopologySchema, UNMOUNT_EVENT, normalizeEventKey, tickEventKey } from './chunk-5YTPYMPZ.js';
|
|
9
|
+
import './chunk-Z7BI7DE7.js';
|
|
10
|
+
export { ORBITAL_VALUE_IMPORT_ALIAS, orbitalImportFromValue, parseProgram } from './chunk-ENOCKYGA.js';
|
|
11
|
+
import { PayloadFieldSchema, InboundVerificationSchema, isCallSiteConfigDeclaration, isPageReference, isRoutePage, isInlineTrait, protocolName } from './chunk-PNGFWLHD.js';
|
|
12
|
+
export { AwaitRenderSchema, BehaviorDescriptionSchema, BehaviorRefSchema, BehaviorValueSchema, CONFIG_REF_EVENT_PATTERN, CatalogEntrySchema, CatalogScopeSchema, ComputedEventContractSchema, ComputedEventListenerSchema, ConfigFieldDeclarationSchema, ConfigProvenanceRecordSchema, DeclaredTraitConfigSchema, DeploymentSchema, DescribeTargetSchema, DispatchModeSchema, EntityCallSchema, EntityFieldContractSchema, EntityRefSchema, EntityRefStringSchema, EventListenerSchema, EventPayloadFieldSchema, EventSchema, EventScopeSchema, EventSourceSchema, ExpectDeclarationSchema, ExpectationDiagnosticSchema, GuardSchema, HOST_SIGN_IN_ROUTE, KnobFieldSchema, LazyPageSchema, LazyTraitSchema, ListenSourceSchema, McpServiceDefSchema, OrbitalDefinitionSchema, OrbitalDescriptionSchema, OrbitalOverridesSchema, OrbitalPageSchema, OrbitalPageStrictSchema, OrbitalRefObjectSchema, OrbitalRefStringSchema, OrbitalSchemaSchema, OrbitalTraitRefSchema, OrbitalUnitSchema, OrbitalValueSchema, OrbitalValueSiblingSchema, OrbitalValueUseSchema, OrbitalSchema as OrbitalZodSchema, OrganismExpectationsSchema, OsGrantsSchema, PageAccessSchema, PageIndexingSchema, PageMetaSchema, PageModifiersSchema, PageRefObjectSchema, PageRefSchema, PageRefStringSchema, PageSchema, PageTraitRefSchema, PayloadFieldSchema, PayloadTypeWhenSchema, ProtocolSideSchema, ProtocolSpecSchema, REFERENCE_CONFIG_TYPES, ROUTE_PROTOCOL, RequiredFieldSchema, RestAuthConfigSchema, RestServiceDefSchema, SECRET_CONFIG_TYPES, SERVICE_TYPES, SKELETON_VARIANTS, SchemaMetadataSchema, ServiceDefinitionSchema, ServiceRefObjectSchema, ServiceRefSchema, ServiceRefStringSchema, ServiceTypeSchema, SiteMetaSchema, SkeletonNodeSchema, SkeletonShapeSchema, SkeletonSpecSchema, SkeletonVariantSchema, SocketEventsSchema, SocketServiceDefSchema, StateMachineSchema, StateSchema, TickIntervalSchema, TraitConfigSchema, TraitConfigValueSchema, TraitDataEntitySchema, TraitDescriptionSchema, TraitDispatchModeSchema, TraitEntityFieldSchema, TraitEventContractSchema, TraitEventListenerSchema, TraitEventsSchema, TraitKnobSchema, TraitMachineSchema, TraitOverridesSchema, TraitRefSchema, TraitReferenceSchema, TraitSchema, TraitSourceSchema, TraitTickSchema, TraitUIBindingSchema, TraitValueSchema, TransitionSchema, UseDeclarationSchema, ViewTypeSchema, applyBehaviorOverrides, applyOrbitalOverrides, applyTraitOverrides, behaviorRef, configRefEventKnob, credentialStatusConnected, credentialStorageKey, expectedEntityName, findService, formatBehaviorValueLiteral, formatOrbitalValueLiteral, formatTraitValueLiteral, getServiceNames, getTraitConfig, getTraitName, hasService, inlineTraitRefs, isBehaviorRefValue, isCallSiteConfigDeclaration, isCircuitEvent, isConfigFieldSchema, isConfigRedeclaration, isEntityCall, isEntityReference, isEntityReferenceAny, isHostSignInRoute, isImportedTraitRef, isInlineTrait, isMcpService, isOrbitalDefinition, isOrbitalValue, isPageReference, isPageReferenceObject, isPageReferenceString, isReferenceConfigType, isRestService, isRoutePage, isSecretConfigType, isServiceReference, isServiceReferenceObject, isSocketService, isTraitValue, joinEventAddress, maskSecretConfigValues, mergeCallSiteConfigOverrides, normalizeCallSiteConfigToValues, normalizeTraitRef, overrideDeclaredKnobs, parseBehaviorValueLiteral, parseEntityRef, parseImportedTraitRef, parseOrbitalRef, parseOrbitalSchema, parseOrbitalValueLiteral, parsePageRef, parseServiceRef, parseTraitValueLiteral, payloadTypeContainer, protocolName, resolveConfigRefEventName, resolveCredentialStatusIdentity, resolvePageMeta, safeParseOrbitalSchema, splitEventAddress, unionOsGrants, unwrapTraitRef } from './chunk-PNGFWLHD.js';
|
|
11
13
|
export { AGENT_DOMAIN_CATEGORIES, ALLOWED_CUSTOM_COMPONENTS, AgentDomainCategorySchema, COLOR_TOKEN_KEYS, ColorSliceSchema, ColorTokensSchema, CustomPatternDefinitionSchema, CustomPatternMapSchema, DIAGRAM_TOKEN_KEYS, DensitySliceSchema, DensityTokensSchema, DesignPreferencesSchema, DesignTokensSchema, DiagramFillStyleSchema, DiagramLabelCaseSchema, DiagramLabelFontSchema, DiagramLineCapSchema, DiagramLineJoinSchema, DiagramMarkerSchema, DiagramTokensSchema, DomainCategorySchema, DomainContextSchema, DomainVocabularySchema, ENTER_ANIMATIONS, ENTER_DELAY_STEPS, ElevationSliceSchema, ElevationTokensSchema, EnterAnimationSchema, EntitySemanticRoleSchema, EventSemanticRoleSchema, GameSubCategorySchema, GeometrySliceSchema, GeometryTokensSchema, ILLUSTRATION_TOKEN_KEYS, IconFamilySchema, IconographySliceSchema, IconographyTokensSchema, IllustrationSliceSchema, IllustrationStyleSchema, IllustrationTokensSchema, MotionDurationKeySchema, MotionDurationPaletteSchema, MotionEasingKeySchema, MotionEasingPaletteSchema, MotionEntryTokensSchema, MotionIntentMapSchema, MotionIntentSchema, MotionShapeTokensSchema, MotionSliceSchema, MotionTokensSchema, NodeClassificationSchema, RelatedLinkSchema, SCENE_TOKEN_KEYS, SceneTokensSchema, SkinSpecSchema, SpacingScaleSchema, StateSemanticRoleSchema, SuggestedGuardSchema, SurfaceSliceSchema, SurfaceTokensSchema, ThemeDefinitionSchema, ThemeRefSchema, ThemeRefStringSchema, ThemeTokensSchema, ThemeVariantSchema, TypeIntentMapSchema, TypeIntentSchema, TypeScaleEntrySchema, TypeScaleSchema, TypeScaleTokensSchema, TypeSizeKeySchema, TypeSliceSchema, TypeSlotSchema, TypeWeightSchema, UXHintsSchema, UserPersonaSchema, isThemeReference, isThemeRegistryKey, isWellFormedFontStack, themeDataKey } from './chunk-M4S2B5VJ.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
export { ANIMATION_NAMES, ASSET_ASPECTS, ASSET_DIMENSIONS, AnimationDefSchema, AnimationNameSchema, AssetAspectSchema, AssetCatalogEntrySchema, AssetCatalogSchema, AssetDimensionSchema, AssetSchema, AudioManifestSchema, CAMERA_MODES, CameraModeSchema, CameraSchema, DEFAULT_UNIT_ANIMATION_ROWS, EFFECT_OPERATORS, EFFECT_OPERATOR_FAMILIES, ENTITY_ROLES, EffectSchema, EntityFieldSchema, EntityPersistenceSchema, EntityRoleSchema, EntityRowSchema, EntitySchema, FIELD_TYPES, FX_KINDS, FieldProjectionSchema, FieldSchema, FieldTagSchema, FieldTypeSchema, FieldValueSchema, FileValueSchema, FxKindSchema, MANIFEST_ASSET_LICENSES, MANIFEST_CANVAS_AFFINITIES, MANIFEST_ENTRY_KINDS, MANIFEST_SOURCE_CATALOGS, ManifestAssetLicenseSchema, ManifestCanvasAffinitySchema, ManifestEntryKindSchema, ManifestEntrySchema, ManifestFrameSpecSchema, ManifestSourceCatalogSchema, OrbitalEntitySchema, PatternConfigSchema, PatternObjectSchema, RENDERED_SLOTS, RelationConfigSchema, ResolvedPatternPropsSchema, SEMANTIC_STRING_PATTERNS, SEMANTIC_STRING_TYPES, SERVER_REPORTED_EFFECTS, SHEET_PROJECTIONS, SPRITE_DIRECTIONS, SPRITE_SHEET_LAYOUT, ScenePosSchema, SemanticAssetRefSchema, SheetProjectionSchema, SoundEntrySchema, SpriteDirectionSchema, SpriteSheetAtlasSchema, SubTextureSchema, TYPE_POSITION_ONLY, TextureAtlasSchema, TilesheetSchema, TypeVariableSchema, UISlotSchema, UI_SLOTS, VISUAL_STYLES, VisualStyleSchema, callService, createAssetKey, defaultUnitAtlas, despawn, doEffects, emit, getDefaultAnimationsForRole, instancesForLocale, isClientResident, isEffect, isEmailValue, isFieldValue, isFileValue, isPersistBatchOperation, isPhoneValue, isRuntimeEntity, isSExprEffect, isSemanticStringType, isSemanticStringValue, isTypeVariable, isTypeVariableField, isUrlValue, isUuidValue, manifestToAssetCatalog, matchAssetQuery, navigate, navigateBack, parseAssetKey, parseAssetQuery, persist, persistenceModeAllowsOverrides, renderUI, set, spawn, storesRowsInBrowser, validateAssetAnimations } from './chunk-FGT5OS2Y.js';
|
|
15
|
+
import { EventPayloadSchema } from './chunk-347APWFM.js';
|
|
16
|
+
export { CORE_BINDINGS, EventPayloadSchema, EventPayloadValueSchema, ExpressionSchema, QUASIQUOTE_HEAD, QUOTE_HEAD, SExprAtomSchema, SExprDataSchema, SExprSchema, UNQUOTE_HEAD, collectBindings, decodeQuoteBody, decodeQuotedValue, encodeQuoteBody, formatSExpr, getArgs, getOperator, instantiateQuasiquote, isBinding, isEventPayloadValue, isSExpr, isSExprAtom, isSExprCall, isStaticallyFalse, isValidBinding, parseBinding, quasiquoteExpr, quasiquoteOf, quoteBodyOf, quoteExpr, sexpr, toProgramData, walkSExpr } from './chunk-347APWFM.js';
|
|
17
|
+
export { EntityIdSchema, EventIdSchema, IdentityLedgerSchema, LedgerEntrySchema, LedgerKindSchema, OrbitalIdSchema, PageIdSchema, PaletteEntryIdSchema, ServiceIdSchema, ThemeIdSchema, TraitIdSchema, asEntityId, asEventId, asOrbitalId, asPageId, asPaletteEntryId, asServiceId, asThemeId, asTraitId, idKindOf, idPrefix, isEntityId, isEventId, isOrbitalId, isPageId, isPaletteEntryId, isServiceId, isThemeId, isTraitId, ledgerCurName, ledgerRename, ledgerResolveName, mintId, mintUlid } from './chunk-VG7BRFUD.js';
|
|
18
|
+
import './chunk-B4MNHGBP.js';
|
|
19
|
+
import { renderUiEntriesOf } from './chunk-66Q5VX2F.js';
|
|
20
|
+
export { COMPONENT_MAPPING, EVENT_CONTRACTS, PATTERN_TYPES, PROP_KINDS, SELF_OVERLAY_PATTERN_TYPES, SERVICES_REGISTRY, collectRenderUiPatternTypes, component_mapping_default as componentMapping, event_contracts_default as eventContracts, eventKeyPropsOf, eventListPropsOf, generatePatternDescription, getAllPatternTypes, getComponentForPattern, getOrbAllowedPatterns, getOrbAllowedPatternsCompact, getOrbAllowedPatternsFiltered, getOrbAllowedPatternsSlim, getPatternActionsRef, getPatternFieldsContract, getPatternMetadata, getPatternMinUsableWidths, getPatternPropsCompact, getPatternRuntimeDefinition, getPatternsGroupedByCategory, isBrowserOnlyService, isContentBodyPattern, isContentBodyPatternType, isDrawHostPattern, isDrawablePattern, isEntityAwarePattern, isMainSlotRenderUi, isValidPatternType, isValueInputPattern, renderUiEntriesOf, renderUiPatternTypesOf, services_registry_default as servicesRegistry } from './chunk-66Q5VX2F.js';
|
|
21
|
+
import { toPayloadValue } from './chunk-7GHJU5WI.js';
|
|
22
|
+
export { JsonValueSchema, isJsonArray, isJsonObject, isJsonPrimitive, toPayloadValue } from './chunk-7GHJU5WI.js';
|
|
23
|
+
export { PATTERN_REGISTRY, getPatternDefinition, patternsRegistry, registry } from './chunk-SNZYN7UA.js';
|
|
18
24
|
import { md5 } from '@noble/hashes/legacy.js';
|
|
19
25
|
import { z } from 'zod';
|
|
20
26
|
|
|
@@ -121,9 +127,9 @@ function findByFingerprint(node, path, fp) {
|
|
|
121
127
|
}
|
|
122
128
|
return null;
|
|
123
129
|
}
|
|
124
|
-
function asInlineTrait(
|
|
125
|
-
if (typeof
|
|
126
|
-
return
|
|
130
|
+
function asInlineTrait(ref) {
|
|
131
|
+
if (typeof ref === "object" && ref !== null && "stateMachine" in ref) {
|
|
132
|
+
return ref;
|
|
127
133
|
}
|
|
128
134
|
return null;
|
|
129
135
|
}
|
|
@@ -143,8 +149,8 @@ function renderRootOf(trait, address) {
|
|
|
143
149
|
return fallback;
|
|
144
150
|
}
|
|
145
151
|
function findRenderUiRoot(orbital, address) {
|
|
146
|
-
for (const
|
|
147
|
-
const trait = asInlineTrait(
|
|
152
|
+
for (const ref of orbital.traits) {
|
|
153
|
+
const trait = asInlineTrait(ref);
|
|
148
154
|
if (trait && trait.name === address.trait) return renderRootOf(trait, address);
|
|
149
155
|
}
|
|
150
156
|
return null;
|
|
@@ -233,218 +239,7 @@ function selectTraceActivities(activities, audience) {
|
|
|
233
239
|
});
|
|
234
240
|
}
|
|
235
241
|
function traceActivityPayload(activity) {
|
|
236
|
-
return EventPayloadSchema.parse({ activity:
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// src/xml.ts
|
|
240
|
-
var XmlSyntaxError = class extends Error {
|
|
241
|
-
constructor(message) {
|
|
242
|
-
super(message);
|
|
243
|
-
this.name = "XmlSyntaxError";
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
var XML_SPACE = /[ \t\n\r]/;
|
|
247
|
-
var NAME = /^[\p{Alphabetic}_][\p{Alphabetic}\p{Nd}\p{Nl}_.-]*$/u;
|
|
248
|
-
var PREDEFINED = { lt: "<", gt: ">", amp: "&", quot: '"', apos: "'" };
|
|
249
|
-
function bad(message) {
|
|
250
|
-
return new XmlSyntaxError(`xml/parse: ${message}`);
|
|
251
|
-
}
|
|
252
|
-
function isBlank(text) {
|
|
253
|
-
for (const c of text) if (!XML_SPACE.test(c)) return false;
|
|
254
|
-
return true;
|
|
255
|
-
}
|
|
256
|
-
function collapse(text) {
|
|
257
|
-
return text.split(/[ \t\n\r]+/).filter((part) => part !== "").join(" ");
|
|
258
|
-
}
|
|
259
|
-
function localName(qualified) {
|
|
260
|
-
const local = qualified.slice(qualified.lastIndexOf(":") + 1);
|
|
261
|
-
if (!NAME.test(local)) throw bad(`invalid name \`${qualified}\``);
|
|
262
|
-
return local;
|
|
263
|
-
}
|
|
264
|
-
function decodeEntities(raw) {
|
|
265
|
-
let out = "";
|
|
266
|
-
let i = 0;
|
|
267
|
-
while (i < raw.length) {
|
|
268
|
-
const amp = raw.indexOf("&", i);
|
|
269
|
-
if (amp === -1) return out + raw.slice(i);
|
|
270
|
-
out += raw.slice(i, amp);
|
|
271
|
-
const semi = raw.indexOf(";", amp);
|
|
272
|
-
if (semi === -1) throw bad("unterminated entity");
|
|
273
|
-
const name = raw.slice(amp + 1, semi);
|
|
274
|
-
if (Object.prototype.hasOwnProperty.call(PREDEFINED, name)) {
|
|
275
|
-
out += PREDEFINED[name];
|
|
276
|
-
} else if (/^#x[0-9A-Fa-f]+$/.test(name) || /^#[0-9]+$/.test(name)) {
|
|
277
|
-
const code = name[1] === "x" ? parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
|
|
278
|
-
if (code === 0 || code > 1114111 || code >= 55296 && code <= 57343) throw bad(`invalid character reference \`&${name};\``);
|
|
279
|
-
out += String.fromCodePoint(code);
|
|
280
|
-
} else {
|
|
281
|
-
throw bad(`unknown entity \`&${name};\``);
|
|
282
|
-
}
|
|
283
|
-
i = semi + 1;
|
|
284
|
-
}
|
|
285
|
-
return out;
|
|
286
|
-
}
|
|
287
|
-
function skipDoctype(text, from) {
|
|
288
|
-
let depth = 0;
|
|
289
|
-
let quote = "";
|
|
290
|
-
for (let i = from; i < text.length; i++) {
|
|
291
|
-
const c = text[i];
|
|
292
|
-
if (quote !== "") {
|
|
293
|
-
if (c === quote) quote = "";
|
|
294
|
-
} else if (c === '"' || c === "'") {
|
|
295
|
-
quote = c;
|
|
296
|
-
} else if (c === "[") {
|
|
297
|
-
depth++;
|
|
298
|
-
} else if (c === "]") {
|
|
299
|
-
depth--;
|
|
300
|
-
} else if (c === ">" && depth <= 0) {
|
|
301
|
-
return i + 1;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
throw bad("unterminated doctype");
|
|
305
|
-
}
|
|
306
|
-
function readStartTag(text, from) {
|
|
307
|
-
let i = from + 1;
|
|
308
|
-
const nameStart = i;
|
|
309
|
-
while (i < text.length && !XML_SPACE.test(text[i]) && text[i] !== "/" && text[i] !== ">") i++;
|
|
310
|
-
const qualified = text.slice(nameStart, i);
|
|
311
|
-
localName(qualified);
|
|
312
|
-
const node = { attrs: /* @__PURE__ */ new Map(), children: [], own: "", full: "" };
|
|
313
|
-
const seen = /* @__PURE__ */ new Set();
|
|
314
|
-
for (; ; ) {
|
|
315
|
-
while (i < text.length && XML_SPACE.test(text[i])) i++;
|
|
316
|
-
if (i >= text.length) throw bad("unterminated tag");
|
|
317
|
-
if (text[i] === ">") return { qualified, node, empty: false, end: i + 1 };
|
|
318
|
-
if (text[i] === "/") {
|
|
319
|
-
if (text[i + 1] !== ">") throw bad("malformed tag");
|
|
320
|
-
return { qualified, node, empty: true, end: i + 2 };
|
|
321
|
-
}
|
|
322
|
-
const keyStart = i;
|
|
323
|
-
while (i < text.length && !XML_SPACE.test(text[i]) && text[i] !== "=" && text[i] !== ">" && text[i] !== "/") i++;
|
|
324
|
-
const key = text.slice(keyStart, i);
|
|
325
|
-
while (i < text.length && XML_SPACE.test(text[i])) i++;
|
|
326
|
-
if (text[i] !== "=") throw bad(`attribute \`${key}\` has no value`);
|
|
327
|
-
i++;
|
|
328
|
-
while (i < text.length && XML_SPACE.test(text[i])) i++;
|
|
329
|
-
const quote = text[i];
|
|
330
|
-
if (quote !== '"' && quote !== "'") throw bad(`attribute \`${key}\` value is not quoted`);
|
|
331
|
-
const close = text.indexOf(quote, i + 1);
|
|
332
|
-
if (close === -1) throw bad("unterminated attribute value");
|
|
333
|
-
const value = decodeEntities(text.slice(i + 1, close));
|
|
334
|
-
i = close + 1;
|
|
335
|
-
if (seen.has(key)) throw bad(`duplicate attribute \`${key}\``);
|
|
336
|
-
seen.add(key);
|
|
337
|
-
if (key === "xmlns" || key.startsWith("xmlns:")) continue;
|
|
338
|
-
node.attrs.set(localName(key), value);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
function parseTree(text) {
|
|
342
|
-
const stack = [];
|
|
343
|
-
let root = null;
|
|
344
|
-
const close = (node, name) => {
|
|
345
|
-
const parent = stack[stack.length - 1];
|
|
346
|
-
if (parent === void 0) {
|
|
347
|
-
root = node;
|
|
348
|
-
} else {
|
|
349
|
-
parent.node.full += node.full;
|
|
350
|
-
parent.node.children.push([name, node]);
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
const addText = (piece) => {
|
|
354
|
-
const top = stack[stack.length - 1];
|
|
355
|
-
if (top !== void 0) {
|
|
356
|
-
top.node.own += piece;
|
|
357
|
-
top.node.full += piece;
|
|
358
|
-
} else if (!isBlank(piece)) {
|
|
359
|
-
throw bad(root === null ? "text before the root element" : "text after the root element");
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
let i = 0;
|
|
363
|
-
while (i < text.length) {
|
|
364
|
-
if (text[i] !== "<") {
|
|
365
|
-
const next = text.indexOf("<", i);
|
|
366
|
-
const end = next === -1 ? text.length : next;
|
|
367
|
-
addText(decodeEntities(text.slice(i, end)));
|
|
368
|
-
i = end;
|
|
369
|
-
} else if (text.startsWith("<!--", i)) {
|
|
370
|
-
const end = text.indexOf("-->", i + 4);
|
|
371
|
-
if (end === -1) throw bad("unterminated comment");
|
|
372
|
-
i = end + 3;
|
|
373
|
-
} else if (text.startsWith("<![CDATA[", i)) {
|
|
374
|
-
const end = text.indexOf("]]>", i + 9);
|
|
375
|
-
if (end === -1) throw bad("unterminated CDATA");
|
|
376
|
-
if (stack.length === 0) throw bad("CDATA outside the root element");
|
|
377
|
-
addText(text.slice(i + 9, end));
|
|
378
|
-
i = end + 3;
|
|
379
|
-
} else if (text.startsWith("<?", i)) {
|
|
380
|
-
const end = text.indexOf("?>", i + 2);
|
|
381
|
-
if (end === -1) throw bad("unterminated processing instruction");
|
|
382
|
-
i = end + 2;
|
|
383
|
-
} else if (text.startsWith("<!", i)) {
|
|
384
|
-
i = skipDoctype(text, i + 2);
|
|
385
|
-
} else if (text.startsWith("</", i)) {
|
|
386
|
-
const end = text.indexOf(">", i);
|
|
387
|
-
if (end === -1) throw bad("unterminated closing tag");
|
|
388
|
-
const top = stack.pop();
|
|
389
|
-
if (top === void 0) throw bad("unexpected closing tag");
|
|
390
|
-
if (text.slice(i + 2, end).trim() !== top.qualified) throw bad(`mismatched closing tag for \`${top.qualified}\``);
|
|
391
|
-
close(top.node, localName(top.qualified));
|
|
392
|
-
i = end + 1;
|
|
393
|
-
} else {
|
|
394
|
-
if (root !== null && stack.length === 0) throw bad("more than one root element");
|
|
395
|
-
const tag = readStartTag(text, i);
|
|
396
|
-
if (tag.empty) close(tag.node, localName(tag.qualified));
|
|
397
|
-
else stack.push({ qualified: tag.qualified, node: tag.node });
|
|
398
|
-
i = tag.end;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
if (stack.length > 0) throw bad("unclosed element");
|
|
402
|
-
if (root === null) throw bad("no root element");
|
|
403
|
-
return root;
|
|
404
|
-
}
|
|
405
|
-
function toValue(node) {
|
|
406
|
-
const text = collapse(node.full);
|
|
407
|
-
const ownHasText = !isBlank(node.own);
|
|
408
|
-
if (node.attrs.size === 0 && (node.children.length === 0 || ownHasText)) return text;
|
|
409
|
-
const entries = [];
|
|
410
|
-
for (const [key, value] of node.attrs) entries.push([`@${key}`, value]);
|
|
411
|
-
const groups = /* @__PURE__ */ new Map();
|
|
412
|
-
for (const [name, child] of node.children) {
|
|
413
|
-
const group = groups.get(name);
|
|
414
|
-
if (group === void 0) groups.set(name, [toValue(child)]);
|
|
415
|
-
else group.push(toValue(child));
|
|
416
|
-
}
|
|
417
|
-
for (const [name, group] of groups) entries.push([name, group.length === 1 ? group[0] : group]);
|
|
418
|
-
if ((node.children.length === 0 || ownHasText) && text !== "") entries.push(["#text", text]);
|
|
419
|
-
return Object.fromEntries(entries);
|
|
420
|
-
}
|
|
421
|
-
function applyListPaths(value, paths) {
|
|
422
|
-
if (Array.isArray(value)) return value.map((item) => applyListPaths(item, paths));
|
|
423
|
-
if (typeof value === "string") return value;
|
|
424
|
-
const heads = /* @__PURE__ */ new Set();
|
|
425
|
-
for (const path of paths) if (path.length > 0) heads.add(path[0]);
|
|
426
|
-
const next = { ...value };
|
|
427
|
-
for (const head of heads) {
|
|
428
|
-
if (!Object.prototype.hasOwnProperty.call(next, head)) continue;
|
|
429
|
-
let child = next[head];
|
|
430
|
-
if (paths.some((path) => path.length === 1 && path[0] === head) && !Array.isArray(child)) child = [child];
|
|
431
|
-
const rest = paths.filter((path) => path.length > 1 && path[0] === head).map((path) => path.slice(1));
|
|
432
|
-
next[head] = rest.length > 0 ? applyListPaths(child, rest) : child;
|
|
433
|
-
}
|
|
434
|
-
return next;
|
|
435
|
-
}
|
|
436
|
-
function parseXml(text, listPaths = []) {
|
|
437
|
-
const value = toValue(parseTree(text));
|
|
438
|
-
return listPaths.length === 0 ? value : applyListPaths(value, listPaths);
|
|
439
|
-
}
|
|
440
|
-
function xmlValid(text) {
|
|
441
|
-
try {
|
|
442
|
-
parseTree(text);
|
|
443
|
-
return true;
|
|
444
|
-
} catch (error) {
|
|
445
|
-
if (error instanceof XmlSyntaxError) return false;
|
|
446
|
-
throw error;
|
|
447
|
-
}
|
|
242
|
+
return EventPayloadSchema.parse({ activity: toPayloadValue(activity) });
|
|
448
243
|
}
|
|
449
244
|
var CodecError = class extends Error {
|
|
450
245
|
constructor(reason) {
|
|
@@ -694,249 +489,254 @@ function hashMd5(base64Bytes, encoding) {
|
|
|
694
489
|
return encodeDigest(md5Bytes(base64DecodeBytes(base64Bytes)), encoding);
|
|
695
490
|
}
|
|
696
491
|
|
|
697
|
-
// src/
|
|
698
|
-
var
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
719
|
-
};
|
|
720
|
-
for (const orbital of schema.orbitals) {
|
|
721
|
-
if (orbital.entity && typeof orbital.entity !== "string") {
|
|
722
|
-
const entityDef = orbital.entity;
|
|
723
|
-
const entity = {
|
|
724
|
-
name: entityDef.name,
|
|
725
|
-
description: entityDef.description,
|
|
726
|
-
icon: entityDef.icon,
|
|
727
|
-
collection: entityDef.collection || entityDef.name.toLowerCase() + "s",
|
|
728
|
-
fields: (entityDef.fields || []).filter(
|
|
729
|
-
(field) => typeof field.name === "string" && field.name.length > 0
|
|
730
|
-
).map((field) => ({
|
|
731
|
-
name: field.name,
|
|
732
|
-
type: field.type,
|
|
733
|
-
tsType: inferTsType2(field.type),
|
|
734
|
-
description: field.description,
|
|
735
|
-
default: field.default,
|
|
736
|
-
required: field.required ?? false,
|
|
737
|
-
// lolo string unions lower to `type:'string'` + a `values` sidecar
|
|
738
|
-
// (FieldType::Enum is never emitted) — read values off any variant
|
|
739
|
-
// that carries them, not just `enum`. EXCLUDES `type:'union'`
|
|
740
|
-
// deliberately: its `values` carries tagged-union variant NAMES or a
|
|
741
|
-
// by-name recursive back-reference (`type MenuItem = { subMenu :
|
|
742
|
-
// [MenuItem] }`), never legal literal values — treating either as
|
|
743
|
-
// an enum vocabulary would let a downstream option-list render the
|
|
744
|
-
// variant/alias NAME as if it were a selectable value (mirrors the
|
|
745
|
-
// Rust-side skip in `orbital-core/src/type_compat.rs`).
|
|
746
|
-
values: field.type !== "union" && "values" in field && field.values?.length ? field.values : void 0,
|
|
747
|
-
enumValues: field.type !== "union" && "values" in field && field.values?.length ? field.values : void 0,
|
|
748
|
-
relation: field.type === "relation" ? field.relation : void 0,
|
|
749
|
-
intrinsic: field.intrinsic,
|
|
750
|
-
items: "items" in field ? field.items : void 0,
|
|
751
|
-
properties: field.properties
|
|
752
|
-
})),
|
|
753
|
-
runtime: entityDef.persistence === "runtime",
|
|
754
|
-
shared: entityDef.shared,
|
|
755
|
-
hasInstances: (entityDef.instances?.length ?? 0) > 0,
|
|
756
|
-
instances: entityDef.instances,
|
|
757
|
-
defaults: entityDef.defaults,
|
|
758
|
-
usedByTraits: [],
|
|
759
|
-
usedByPages: []
|
|
760
|
-
};
|
|
761
|
-
ir.entities.set(entity.name, entity);
|
|
492
|
+
// src/embedded-trait-config.ts
|
|
493
|
+
var TRAIT_BINDING_PREFIX = "@trait.";
|
|
494
|
+
var CONFIG_FORWARD_RE = /^@config\.([A-Za-z_][A-Za-z0-9_]*)$/;
|
|
495
|
+
var CALLSITE_PAYLOAD_PREFIX = "@callsitePayload.";
|
|
496
|
+
function valueContainsPrefixedString(value, prefix) {
|
|
497
|
+
if (value === null || value === void 0) return false;
|
|
498
|
+
if (typeof value === "string") return value.startsWith(prefix);
|
|
499
|
+
if (Array.isArray(value)) return value.some((item) => valueContainsPrefixedString(item, prefix));
|
|
500
|
+
if (typeof value === "object") {
|
|
501
|
+
return Object.values(value).some((v) => valueContainsPrefixedString(v, prefix));
|
|
502
|
+
}
|
|
503
|
+
return false;
|
|
504
|
+
}
|
|
505
|
+
function collectTraitRefsFromValue(value, into) {
|
|
506
|
+
if (value === null || value === void 0) return;
|
|
507
|
+
if (typeof value === "string") {
|
|
508
|
+
if (value.startsWith(TRAIT_BINDING_PREFIX)) {
|
|
509
|
+
const rest = value.slice(TRAIT_BINDING_PREFIX.length);
|
|
510
|
+
const dot = rest.indexOf(".");
|
|
511
|
+
const traitName = dot === -1 ? rest : rest.slice(0, dot);
|
|
512
|
+
if (traitName.length > 0) into.add(traitName);
|
|
762
513
|
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
// trait carries them — the emit-source stamp needs `id`/`eventId`
|
|
773
|
-
// for id-scoped `listens` matching (`buildSourceMatcher` compares
|
|
774
|
-
// ids ONLY, so a name-only stamp never matches a `traitId`-carrying
|
|
775
|
-
// listen). Absent on id-free schemas, which keep the legacy
|
|
776
|
-
// name-only stamp exactly as before.
|
|
777
|
-
...trait.id !== void 0 ? { id: trait.id } : {},
|
|
778
|
-
...trait.emits !== void 0 ? { emits: trait.emits.map((e) => ({ event: e.event, eventId: e.eventId })) } : {},
|
|
779
|
-
states: (trait.stateMachine?.states || []).map((s) => ({
|
|
780
|
-
name: s.name,
|
|
781
|
-
isInitial: s.isInitial ?? false,
|
|
782
|
-
isFinal: s.isFinal ?? s.isTerminal ?? false
|
|
783
|
-
})),
|
|
784
|
-
events: (trait.stateMachine?.events || []).map((e) => ({
|
|
785
|
-
key: e.key,
|
|
786
|
-
name: e.name,
|
|
787
|
-
payload: e.payloadSchema
|
|
788
|
-
})),
|
|
789
|
-
transitions: (trait.stateMachine?.transitions || []).map((t) => ({
|
|
790
|
-
from: t.from,
|
|
791
|
-
to: t.to,
|
|
792
|
-
event: t.event,
|
|
793
|
-
guard: t.guard,
|
|
794
|
-
effects: t.effects || []
|
|
795
|
-
})),
|
|
796
|
-
guards: [],
|
|
797
|
-
ticks: (trait.ticks || []).map((tk) => ({
|
|
798
|
-
name: tk.name,
|
|
799
|
-
interval: tk.interval,
|
|
800
|
-
guard: tk.guard,
|
|
801
|
-
effects: tk.effects,
|
|
802
|
-
priority: tk.priority ?? 0,
|
|
803
|
-
appliesTo: tk.appliesTo ?? [],
|
|
804
|
-
whileVisible: tk.whileVisible === true
|
|
805
|
-
})),
|
|
806
|
-
listens: (trait.listens || []).map((l) => ({
|
|
807
|
-
event: l.event,
|
|
808
|
-
triggers: l.triggers,
|
|
809
|
-
guard: l.guard,
|
|
810
|
-
payloadMapping: l.payloadMapping,
|
|
811
|
-
source: l.source
|
|
812
|
-
})),
|
|
813
|
-
dataEntities: [],
|
|
814
|
-
linkedEntity: trait.linkedEntity,
|
|
815
|
-
config: trait.config
|
|
816
|
-
};
|
|
817
|
-
ir.traits.set(trait.name, resolvedTrait);
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
if (Array.isArray(value)) {
|
|
517
|
+
for (const item of value) collectTraitRefsFromValue(item, into);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
if (typeof value === "object") {
|
|
521
|
+
for (const v of Object.values(value)) {
|
|
522
|
+
collectTraitRefsFromValue(v, into);
|
|
818
523
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
traits: (page.traits || []).map((traitRef) => {
|
|
829
|
-
const resolvedTrait = resolveTraitRef(traitRef, ir.traits, orbital.traits || []);
|
|
830
|
-
const orbitalTrait = (orbital.traits || []).find(
|
|
831
|
-
(t) => typeof t === "object" && t !== null && ("name" in t && t.name === traitRef.ref || "ref" in t && t.ref === traitRef.ref)
|
|
832
|
-
);
|
|
833
|
-
const orbitalTraitWrapped = orbitalTrait;
|
|
834
|
-
const wrapperLinked = orbitalTraitWrapped?.linkedEntity ?? orbitalTraitWrapped?._resolved?.linkedEntity;
|
|
835
|
-
const resolvedLinked = resolvedTrait?.linkedEntity;
|
|
836
|
-
return {
|
|
837
|
-
ref: traitRef.ref,
|
|
838
|
-
trait: resolvedTrait,
|
|
839
|
-
linkedEntity: traitRef.linkedEntity ?? wrapperLinked ?? resolvedLinked ?? (orbital.entity ? typeof orbital.entity === "string" ? orbital.entity.replace(".entity", "") : orbital.entity.name : void 0),
|
|
840
|
-
config: traitRef.config
|
|
841
|
-
};
|
|
842
|
-
}),
|
|
843
|
-
entityBindings: [],
|
|
844
|
-
navigation: [],
|
|
845
|
-
singletonEntities: []
|
|
846
|
-
};
|
|
847
|
-
ir.pages.set(page.name, resolvedPage);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
var CONFIG_BINDING_PREFIX = "@config.";
|
|
527
|
+
function collectConfigKeysFromValue(value, into) {
|
|
528
|
+
if (value === null || value === void 0) return;
|
|
529
|
+
if (typeof value === "string") {
|
|
530
|
+
if (value.startsWith(CONFIG_BINDING_PREFIX)) {
|
|
531
|
+
const key = value.slice(CONFIG_BINDING_PREFIX.length).split(".")[0];
|
|
532
|
+
if (key.length > 0) into.add(key);
|
|
848
533
|
}
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
if (Array.isArray(value)) {
|
|
537
|
+
for (const item of value) collectConfigKeysFromValue(item, into);
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (typeof value === "object") {
|
|
541
|
+
for (const v of Object.values(value)) collectConfigKeysFromValue(v, into);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function traitsEmbeddedByEffects(trait, effects) {
|
|
545
|
+
const refs = /* @__PURE__ */ new Set();
|
|
546
|
+
const configKeys = /* @__PURE__ */ new Set();
|
|
547
|
+
collectTraitRefsFromValue(effects, refs);
|
|
548
|
+
collectConfigKeysFromValue(effects, configKeys);
|
|
549
|
+
const config = trait.config;
|
|
550
|
+
if (config) for (const key of configKeys) collectTraitRefsFromValue(config[key] ?? null, refs);
|
|
551
|
+
refs.delete(trait.name);
|
|
552
|
+
return refs;
|
|
553
|
+
}
|
|
554
|
+
function traitsEmbeddedByEvent(trait, eventKey) {
|
|
555
|
+
const transitions = trait.stateMachine?.transitions ?? [];
|
|
556
|
+
const out = /* @__PURE__ */ new Set();
|
|
557
|
+
for (const transition of transitions) {
|
|
558
|
+
if (transition.event !== eventKey) continue;
|
|
559
|
+
for (const child of traitsEmbeddedByEffects(trait, transition.effects ?? null)) out.add(child);
|
|
560
|
+
}
|
|
561
|
+
return out;
|
|
562
|
+
}
|
|
563
|
+
function targetTraitOf(traitRef) {
|
|
564
|
+
if (!traitRef || typeof traitRef !== "object") return void 0;
|
|
565
|
+
const resolved = traitRef._resolved;
|
|
566
|
+
return resolved && typeof resolved === "object" ? resolved : traitRef;
|
|
567
|
+
}
|
|
568
|
+
function collectTraitEmbedAdjacency(orbital) {
|
|
569
|
+
const out = /* @__PURE__ */ new Map();
|
|
570
|
+
const traits = orbital.traits;
|
|
571
|
+
if (!Array.isArray(traits)) return out;
|
|
572
|
+
for (const traitRef of traits) {
|
|
573
|
+
const target = targetTraitOf(traitRef);
|
|
574
|
+
if (!target) continue;
|
|
575
|
+
const referrerName = target.name;
|
|
576
|
+
if (typeof referrerName !== "string" || referrerName.length === 0) continue;
|
|
577
|
+
const refs = /* @__PURE__ */ new Set();
|
|
578
|
+
if (target.config) collectTraitRefsFromValue(target.config, refs);
|
|
579
|
+
const stateMachine = target.stateMachine;
|
|
580
|
+
if (stateMachine) collectTraitRefsFromValue(stateMachine, refs);
|
|
581
|
+
refs.delete(referrerName);
|
|
582
|
+
if (refs.size > 0) out.set(referrerName, refs);
|
|
583
|
+
}
|
|
584
|
+
return out;
|
|
585
|
+
}
|
|
586
|
+
function collectTraitConfigRefAdjacency(orbital) {
|
|
587
|
+
const out = /* @__PURE__ */ new Map();
|
|
588
|
+
const traits = orbital.traits;
|
|
589
|
+
if (!Array.isArray(traits)) return out;
|
|
590
|
+
for (const traitRef of traits) {
|
|
591
|
+
const target = targetTraitOf(traitRef);
|
|
592
|
+
if (!target) continue;
|
|
593
|
+
const referrerName = target.name;
|
|
594
|
+
if (typeof referrerName !== "string" || referrerName.length === 0) continue;
|
|
595
|
+
if (!target.config) continue;
|
|
596
|
+
const refs = /* @__PURE__ */ new Set();
|
|
597
|
+
collectTraitRefsFromValue(target.config, refs);
|
|
598
|
+
refs.delete(referrerName);
|
|
599
|
+
if (refs.size > 0) out.set(referrerName, refs);
|
|
849
600
|
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
const
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
601
|
+
return out;
|
|
602
|
+
}
|
|
603
|
+
function traitDeclaresConfigForward(trait) {
|
|
604
|
+
const config = trait?.config;
|
|
605
|
+
if (!config) return false;
|
|
606
|
+
let found = false;
|
|
607
|
+
const walk = (value) => {
|
|
608
|
+
if (found || value === null || value === void 0) return;
|
|
609
|
+
if (typeof value === "string") {
|
|
610
|
+
const knob = CONFIG_FORWARD_RE.exec(value)?.[1];
|
|
611
|
+
if (knob !== void 0 && !(knob in config)) found = true;
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
if (Array.isArray(value)) {
|
|
615
|
+
for (const item of value) walk(item);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
if (typeof value === "object") {
|
|
619
|
+
for (const v of Object.values(value)) walk(v);
|
|
620
|
+
}
|
|
869
621
|
};
|
|
870
|
-
|
|
871
|
-
const
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
const inner = schemaType.slice(4, -1);
|
|
876
|
-
const comma = inner.indexOf(",");
|
|
877
|
-
if (comma !== -1) {
|
|
878
|
-
const key = inferTsType2(inner.slice(0, comma).trim());
|
|
879
|
-
const value = inferTsType2(inner.slice(comma + 1).trim());
|
|
880
|
-
return `Record<${key}, ${value}>`;
|
|
622
|
+
for (const field of Object.values(config)) {
|
|
623
|
+
const value = field?.default;
|
|
624
|
+
if (typeof value === "string") {
|
|
625
|
+
if (CONFIG_FORWARD_RE.test(value)) return true;
|
|
626
|
+
continue;
|
|
881
627
|
}
|
|
628
|
+
walk(value);
|
|
629
|
+
if (found) return true;
|
|
630
|
+
}
|
|
631
|
+
return false;
|
|
632
|
+
}
|
|
633
|
+
function configReferencesCallsitePayload(config) {
|
|
634
|
+
return config !== void 0 && valueContainsPrefixedString(config, CALLSITE_PAYLOAD_PREFIX);
|
|
635
|
+
}
|
|
636
|
+
function traitReferencesCallsitePayload(trait) {
|
|
637
|
+
if (!trait) return false;
|
|
638
|
+
if (trait.config && valueContainsPrefixedString(trait.config, CALLSITE_PAYLOAD_PREFIX)) {
|
|
639
|
+
return true;
|
|
882
640
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
const refName = typeof traitRef === "string" ? traitRef : traitRef.ref || "";
|
|
887
|
-
if (traitsMap.has(refName)) {
|
|
888
|
-
return traitsMap.get(refName);
|
|
889
|
-
}
|
|
890
|
-
const schemaTrait = schemaTraits.find((t) => t.name === refName);
|
|
891
|
-
if (schemaTrait) {
|
|
892
|
-
return {
|
|
893
|
-
name: refName,
|
|
894
|
-
source: "inline",
|
|
895
|
-
states: [],
|
|
896
|
-
events: [],
|
|
897
|
-
transitions: [],
|
|
898
|
-
guards: [],
|
|
899
|
-
ticks: [],
|
|
900
|
-
listens: [],
|
|
901
|
-
dataEntities: []
|
|
902
|
-
};
|
|
641
|
+
const stateMachine = trait.stateMachine;
|
|
642
|
+
if (stateMachine && valueContainsPrefixedString(stateMachine, CALLSITE_PAYLOAD_PREFIX)) {
|
|
643
|
+
return true;
|
|
903
644
|
}
|
|
904
|
-
return
|
|
905
|
-
name: refName,
|
|
906
|
-
source: "schema",
|
|
907
|
-
states: [],
|
|
908
|
-
events: [],
|
|
909
|
-
transitions: [],
|
|
910
|
-
guards: [],
|
|
911
|
-
ticks: [],
|
|
912
|
-
listens: [],
|
|
913
|
-
dataEntities: []
|
|
914
|
-
};
|
|
645
|
+
return false;
|
|
915
646
|
}
|
|
916
|
-
function
|
|
917
|
-
|
|
918
|
-
|
|
647
|
+
function collectCallsiteCaptureChildren(orbital) {
|
|
648
|
+
const adjacency = collectTraitEmbedAdjacency(orbital);
|
|
649
|
+
const traitsByName = /* @__PURE__ */ new Map();
|
|
650
|
+
const traits = orbital.traits;
|
|
651
|
+
if (Array.isArray(traits)) {
|
|
652
|
+
for (const traitRef of traits) {
|
|
653
|
+
const target = targetTraitOf(traitRef);
|
|
654
|
+
if (target?.name) traitsByName.set(target.name, target);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
const reachesCapture = /* @__PURE__ */ new Map();
|
|
658
|
+
function traitReachesCapture(name, seen) {
|
|
659
|
+
const cached = reachesCapture.get(name);
|
|
660
|
+
if (cached !== void 0) return cached;
|
|
661
|
+
if (seen.has(name)) return false;
|
|
662
|
+
seen.add(name);
|
|
663
|
+
const trait = traitsByName.get(name);
|
|
664
|
+
if (trait && traitReferencesCallsitePayload(trait)) {
|
|
665
|
+
reachesCapture.set(name, true);
|
|
666
|
+
return true;
|
|
667
|
+
}
|
|
668
|
+
const children = adjacency.get(name);
|
|
669
|
+
if (children) {
|
|
670
|
+
for (const child of children) {
|
|
671
|
+
if (traitReachesCapture(child, seen)) {
|
|
672
|
+
reachesCapture.set(name, true);
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
reachesCapture.set(name, false);
|
|
678
|
+
return false;
|
|
919
679
|
}
|
|
920
|
-
|
|
680
|
+
const out = /* @__PURE__ */ new Map();
|
|
681
|
+
for (const [referrer, children] of adjacency) {
|
|
682
|
+
const keep = /* @__PURE__ */ new Set();
|
|
683
|
+
for (const child of children) {
|
|
684
|
+
if (traitReachesCapture(child, /* @__PURE__ */ new Set())) keep.add(child);
|
|
685
|
+
}
|
|
686
|
+
if (keep.size > 0) out.set(referrer, keep);
|
|
687
|
+
}
|
|
688
|
+
return out;
|
|
921
689
|
}
|
|
922
|
-
function
|
|
923
|
-
|
|
690
|
+
function configForwardTokens(entry) {
|
|
691
|
+
const tokens = [];
|
|
692
|
+
const walk = (value) => {
|
|
693
|
+
if (typeof value === "string") {
|
|
694
|
+
if (value.startsWith("@config.")) tokens.push(value);
|
|
695
|
+
} else if (Array.isArray(value)) {
|
|
696
|
+
for (const item of value) walk(item);
|
|
697
|
+
} else if (value !== null && typeof value === "object") {
|
|
698
|
+
for (const item of Object.values(value)) walk(item);
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
walk(entry.default);
|
|
702
|
+
if (entry.forwardedFrom !== void 0) tokens.push(entry.forwardedFrom);
|
|
703
|
+
tokens.push(...entry.nestedForwardedFrom ?? []);
|
|
704
|
+
return tokens;
|
|
705
|
+
}
|
|
706
|
+
function collectForwardedConfigKeys(traits) {
|
|
707
|
+
const forwarded = /* @__PURE__ */ new Set();
|
|
708
|
+
for (const traitRef of traits) {
|
|
709
|
+
const config = typeof traitRef === "string" ? void 0 : traitRef.config;
|
|
710
|
+
if (!config) continue;
|
|
711
|
+
for (const entry of Object.values(config)) {
|
|
712
|
+
if (!isCallSiteConfigDeclaration(entry)) continue;
|
|
713
|
+
for (const token of configForwardTokens(entry)) {
|
|
714
|
+
const knob = CONFIG_FORWARD_RE.exec(token)?.[1];
|
|
715
|
+
if (knob) forwarded.add(knob);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
return forwarded;
|
|
924
720
|
}
|
|
925
|
-
function
|
|
926
|
-
|
|
721
|
+
function collectOrbitalForwardedConfigKeys(orbital) {
|
|
722
|
+
const forwarded = new Set(collectForwardedConfigKeys(orbital.traits ?? []));
|
|
723
|
+
for (const use of orbital.uses ?? []) {
|
|
724
|
+
for (const entry of Object.values(use.config ?? {})) {
|
|
725
|
+
for (const token of configForwardTokens(entry)) {
|
|
726
|
+
const knob = CONFIG_FORWARD_RE.exec(token)?.[1];
|
|
727
|
+
if (knob) forwarded.add(knob);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return forwarded;
|
|
927
732
|
}
|
|
928
|
-
function
|
|
929
|
-
|
|
733
|
+
function filterConfigToForwardedKeys(config, forwarded) {
|
|
734
|
+
const kept = Object.entries(config).filter(([key]) => forwarded.has(key));
|
|
735
|
+
return kept.length > 0 ? Object.fromEntries(kept) : void 0;
|
|
930
736
|
}
|
|
931
|
-
function
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
...page.indexing !== void 0 ? { indexing: page.indexing } : {},
|
|
935
|
-
...page.sourcePage !== void 0 ? { sourcePage: page.sourcePage } : {},
|
|
936
|
-
...page.translationOf !== void 0 ? { translationOf: page.translationOf } : {},
|
|
937
|
-
...page.title !== void 0 ? { title: page.title } : {},
|
|
938
|
-
...page.description !== void 0 ? { description: page.description } : {}
|
|
939
|
-
};
|
|
737
|
+
function orbitalFileOf(schema, orbital) {
|
|
738
|
+
const config = schema.config !== void 0 ? filterConfigToForwardedKeys(schema.config, collectOrbitalForwardedConfigKeys(orbital)) : void 0;
|
|
739
|
+
return { name: orbital.name, version: schema.version ?? "1.0.0", orbitals: [orbital], ...config !== void 0 ? { config } : {} };
|
|
940
740
|
}
|
|
941
741
|
|
|
942
742
|
// src/lib/get-nested-value.ts
|
|
@@ -1067,117 +867,6 @@ function dependencyGraphOf(schema, deps) {
|
|
|
1067
867
|
return { orbitals, behaviors };
|
|
1068
868
|
}
|
|
1069
869
|
|
|
1070
|
-
// src/kernel-evaluator.ts
|
|
1071
|
-
var KernelEvalError = class extends Error {
|
|
1072
|
-
constructor(message) {
|
|
1073
|
-
super(message);
|
|
1074
|
-
this.name = "KernelEvalError";
|
|
1075
|
-
}
|
|
1076
|
-
};
|
|
1077
|
-
var KernelEvaluatorNotInstalledError = class extends Error {
|
|
1078
|
-
constructor() {
|
|
1079
|
-
super("the kernel evaluator is not installed: load @almadar/kernel and call installKernelEvaluator before evaluating");
|
|
1080
|
-
this.name = "KernelEvaluatorNotInstalledError";
|
|
1081
|
-
}
|
|
1082
|
-
};
|
|
1083
|
-
var optionalJson = (expr) => expr === void 0 ? "" : JSON.stringify(expr);
|
|
1084
|
-
function createKernelEvaluator(kernel) {
|
|
1085
|
-
const evaluateMany = (context, expressions) => {
|
|
1086
|
-
if (expressions.length === 0) return [];
|
|
1087
|
-
return JSON.parse(kernel.evaluateMany(JSON.stringify(context), JSON.stringify(expressions)));
|
|
1088
|
-
};
|
|
1089
|
-
const evaluateGuards = (context, guards) => {
|
|
1090
|
-
if (guards.length === 0) return [];
|
|
1091
|
-
return JSON.parse(kernel.evaluateGuards(JSON.stringify(context), JSON.stringify(guards)));
|
|
1092
|
-
};
|
|
1093
|
-
return {
|
|
1094
|
-
evaluateMany,
|
|
1095
|
-
resolveValues(context, values) {
|
|
1096
|
-
if (values.length === 0) return [];
|
|
1097
|
-
return JSON.parse(kernel.resolveValues(JSON.stringify(context), JSON.stringify(values)));
|
|
1098
|
-
},
|
|
1099
|
-
evaluate(context, expression) {
|
|
1100
|
-
const outcome = evaluateMany(context, [expression])[0];
|
|
1101
|
-
if (outcome.kind === "error") throw new KernelEvalError(outcome.message);
|
|
1102
|
-
return outcome.value;
|
|
1103
|
-
},
|
|
1104
|
-
evaluateGuards,
|
|
1105
|
-
evaluateGuard(context, guard) {
|
|
1106
|
-
return evaluateGuards(context, [guard])[0];
|
|
1107
|
-
},
|
|
1108
|
-
evaluateTraced(context, expression) {
|
|
1109
|
-
return JSON.parse(kernel.evaluateTraced(JSON.stringify(context), JSON.stringify(expression)));
|
|
1110
|
-
},
|
|
1111
|
-
traceEffects(context, effects) {
|
|
1112
|
-
return JSON.parse(kernel.traceEffects(JSON.stringify(context), JSON.stringify(effects)));
|
|
1113
|
-
},
|
|
1114
|
-
mapListenPayload(mapping, payload) {
|
|
1115
|
-
return JSON.parse(kernel.mapListenPayload(JSON.stringify(mapping), JSON.stringify(payload)));
|
|
1116
|
-
},
|
|
1117
|
-
scopeRows(bindings, rows, policy, filter, entityType) {
|
|
1118
|
-
if (policy === void 0 && filter === void 0) return [...rows];
|
|
1119
|
-
return JSON.parse(
|
|
1120
|
-
kernel.scopeRows(JSON.stringify(bindings), JSON.stringify(rows), optionalJson(policy), optionalJson(filter), entityType)
|
|
1121
|
-
);
|
|
1122
|
-
},
|
|
1123
|
-
checkMutation(operation, bindings, row, policy, entityType) {
|
|
1124
|
-
return JSON.parse(
|
|
1125
|
-
kernel.checkMutationAccess(operation, JSON.stringify(bindings), JSON.stringify(row), optionalJson(policy), entityType)
|
|
1126
|
-
);
|
|
1127
|
-
},
|
|
1128
|
-
resolveRowBinding(term, bindings) {
|
|
1129
|
-
return JSON.parse(kernel.resolveRowBinding(term, JSON.stringify(bindings)));
|
|
1130
|
-
}
|
|
1131
|
-
};
|
|
1132
|
-
}
|
|
1133
|
-
var installed;
|
|
1134
|
-
function installKernelEvaluator(kernel) {
|
|
1135
|
-
installed = createKernelEvaluator(kernel);
|
|
1136
|
-
return installed;
|
|
1137
|
-
}
|
|
1138
|
-
function hasKernelEvaluator() {
|
|
1139
|
-
return installed !== void 0;
|
|
1140
|
-
}
|
|
1141
|
-
function kernelEvaluator() {
|
|
1142
|
-
if (installed === void 0) throw new KernelEvaluatorNotInstalledError();
|
|
1143
|
-
return installed;
|
|
1144
|
-
}
|
|
1145
|
-
function eventPayloadOf(value) {
|
|
1146
|
-
return value !== void 0 && value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
1147
|
-
}
|
|
1148
|
-
function toWireValue(value) {
|
|
1149
|
-
if (value === void 0 || value === null) return null;
|
|
1150
|
-
if (value instanceof Date) return value.toISOString();
|
|
1151
|
-
if (Array.isArray(value)) return value.map(toWireValue);
|
|
1152
|
-
if (typeof value === "object") {
|
|
1153
|
-
const out = {};
|
|
1154
|
-
for (const [key, item] of Object.entries(value)) {
|
|
1155
|
-
if (item !== void 0) out[key] = toWireValue(item);
|
|
1156
|
-
}
|
|
1157
|
-
return out;
|
|
1158
|
-
}
|
|
1159
|
-
return value;
|
|
1160
|
-
}
|
|
1161
|
-
function applyListenMapping(payloadMapping, payload) {
|
|
1162
|
-
if (!payloadMapping || !payload) return payload;
|
|
1163
|
-
return kernelEvaluator().mapListenPayload(payloadMapping, payload);
|
|
1164
|
-
}
|
|
1165
|
-
function lazyKernelExports(load) {
|
|
1166
|
-
let loaded;
|
|
1167
|
-
const kernel = () => loaded ?? (loaded = load());
|
|
1168
|
-
return {
|
|
1169
|
-
evaluateMany: (context, expressions) => kernel().evaluateMany(context, expressions),
|
|
1170
|
-
resolveValues: (context, values) => kernel().resolveValues(context, values),
|
|
1171
|
-
evaluateGuards: (context, guards) => kernel().evaluateGuards(context, guards),
|
|
1172
|
-
evaluateTraced: (context, expression) => kernel().evaluateTraced(context, expression),
|
|
1173
|
-
traceEffects: (context, effects) => kernel().traceEffects(context, effects),
|
|
1174
|
-
mapListenPayload: (mapping, payload) => kernel().mapListenPayload(mapping, payload),
|
|
1175
|
-
scopeRows: (bindings, rows, policy, filter, entityType) => kernel().scopeRows(bindings, rows, policy, filter, entityType),
|
|
1176
|
-
checkMutationAccess: (operation, bindings, row, policy, entityType) => kernel().checkMutationAccess(operation, bindings, row, policy, entityType),
|
|
1177
|
-
resolveRowBinding: (term, bindings) => kernel().resolveRowBinding(term, bindings)
|
|
1178
|
-
};
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
870
|
// src/kernel-row-access.ts
|
|
1182
871
|
function accessContext(bindings) {
|
|
1183
872
|
return {
|
|
@@ -1720,423 +1409,60 @@ function generateChangesetId(seed, count) {
|
|
|
1720
1409
|
return `chg_${(hash >>> 0).toString(16)}_${count}`;
|
|
1721
1410
|
}
|
|
1722
1411
|
|
|
1723
|
-
// src/
|
|
1724
|
-
|
|
1725
|
-
var STEP_PATTERN = /^step\d+$/i;
|
|
1726
|
-
function classifyWorkflow(states) {
|
|
1727
|
-
const names = states.map((s) => s.name.toLowerCase());
|
|
1728
|
-
const crudMatch = names.filter((n) => CRUD_STATES.has(n)).length;
|
|
1729
|
-
if (crudMatch >= 3) return "crud";
|
|
1730
|
-
const stepCount = names.filter((n) => STEP_PATTERN.test(n)).length;
|
|
1731
|
-
if (stepCount >= 2) return "wizard";
|
|
1732
|
-
const hasTerminal = states.some((s) => s.isTerminal || s.isFinal);
|
|
1733
|
-
const hasComplete = names.some(
|
|
1734
|
-
(n) => n === "complete" || n === "completed" || n === "done" || n === "finished"
|
|
1735
|
-
);
|
|
1736
|
-
if ((hasTerminal || hasComplete) && states.length >= 4 && crudMatch <= 1) {
|
|
1737
|
-
return "wizard";
|
|
1738
|
-
}
|
|
1739
|
-
return "custom";
|
|
1740
|
-
}
|
|
1741
|
-
function isPrimaryKey(field) {
|
|
1742
|
-
return field.primaryKey === true;
|
|
1743
|
-
}
|
|
1744
|
-
function isBusinessField(field) {
|
|
1745
|
-
if (isPrimaryKey(field)) return false;
|
|
1746
|
-
if (field.type === "enum" || field.type === "relation") return true;
|
|
1747
|
-
if (field.required) return true;
|
|
1748
|
-
return false;
|
|
1749
|
-
}
|
|
1750
|
-
function summarizeEntity(entity) {
|
|
1751
|
-
const fields = entity.fields.filter(isBusinessField).map(summarizeField);
|
|
1752
|
-
return {
|
|
1753
|
-
name: entity.name,
|
|
1754
|
-
collection: entity.collection,
|
|
1755
|
-
fields
|
|
1756
|
-
};
|
|
1757
|
-
}
|
|
1758
|
-
function summarizeField(f) {
|
|
1759
|
-
if (f.type === "enum") {
|
|
1760
|
-
return {
|
|
1761
|
-
...f.name !== void 0 ? { name: f.name } : {},
|
|
1762
|
-
type: "enum",
|
|
1763
|
-
values: f.values,
|
|
1764
|
-
...f.required ? { required: true } : {}
|
|
1765
|
-
};
|
|
1766
|
-
}
|
|
1767
|
-
if (f.type === "union") {
|
|
1768
|
-
return {
|
|
1769
|
-
...f.name !== void 0 ? { name: f.name } : {},
|
|
1770
|
-
type: "union",
|
|
1771
|
-
values: f.values,
|
|
1772
|
-
...f.required ? { required: true } : {}
|
|
1773
|
-
};
|
|
1774
|
-
}
|
|
1775
|
-
if (f.type === "relation") {
|
|
1776
|
-
return {
|
|
1777
|
-
...f.name !== void 0 ? { name: f.name } : {},
|
|
1778
|
-
type: "relation",
|
|
1779
|
-
relation: f.relation,
|
|
1780
|
-
...f.required ? { required: true } : {}
|
|
1781
|
-
};
|
|
1782
|
-
}
|
|
1783
|
-
if (f.type === "array") {
|
|
1784
|
-
return {
|
|
1785
|
-
...f.name !== void 0 ? { name: f.name } : {},
|
|
1786
|
-
type: "array",
|
|
1787
|
-
items: f.items,
|
|
1788
|
-
...f.required ? { required: true } : {}
|
|
1789
|
-
};
|
|
1790
|
-
}
|
|
1791
|
-
if (f.type === "tuple") {
|
|
1792
|
-
return {
|
|
1793
|
-
...f.name !== void 0 ? { name: f.name } : {},
|
|
1794
|
-
type: "tuple",
|
|
1795
|
-
properties: f.properties,
|
|
1796
|
-
...f.required ? { required: true } : {}
|
|
1797
|
-
};
|
|
1798
|
-
}
|
|
1799
|
-
if (f.type === "object") {
|
|
1800
|
-
return {
|
|
1801
|
-
...f.name !== void 0 ? { name: f.name } : {},
|
|
1802
|
-
type: "object",
|
|
1803
|
-
...f.required ? { required: true } : {}
|
|
1804
|
-
};
|
|
1805
|
-
}
|
|
1806
|
-
if (f.type === "field") {
|
|
1807
|
-
return {
|
|
1808
|
-
...f.name !== void 0 ? { name: f.name } : {},
|
|
1809
|
-
type: "field",
|
|
1810
|
-
...f.record !== void 0 ? { record: f.record } : {},
|
|
1811
|
-
...f.items !== void 0 ? { items: summarizeField(f.items) } : {},
|
|
1812
|
-
...f.required ? { required: true } : {}
|
|
1813
|
-
};
|
|
1814
|
-
}
|
|
1815
|
-
if (isTypeVariableField(f)) {
|
|
1816
|
-
return {
|
|
1817
|
-
...f.name !== void 0 ? { name: f.name } : {},
|
|
1818
|
-
type: f.type,
|
|
1819
|
-
...f.required ? { required: true } : {}
|
|
1820
|
-
};
|
|
1821
|
-
}
|
|
1822
|
-
return {
|
|
1823
|
-
...f.name !== void 0 ? { name: f.name } : {},
|
|
1824
|
-
type: f.type,
|
|
1825
|
-
...f.required ? { required: true } : {}
|
|
1826
|
-
};
|
|
1827
|
-
}
|
|
1828
|
-
function summarizeTransitions(transitions) {
|
|
1829
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1830
|
-
const result = [];
|
|
1831
|
-
for (const t of transitions) {
|
|
1832
|
-
const key = `${t.from}::${t.to}::${t.event}`;
|
|
1833
|
-
if (!seen.has(key)) {
|
|
1834
|
-
seen.add(key);
|
|
1835
|
-
result.push({ from: t.from, to: t.to, event: t.event });
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
return result;
|
|
1839
|
-
}
|
|
1840
|
-
function summarizeEvents(events) {
|
|
1841
|
-
return events.map((e) => ({ key: e.key, name: e.key }));
|
|
1842
|
-
}
|
|
1843
|
-
function summarizeTrait(trait) {
|
|
1844
|
-
const states = trait.stateMachine?.states ?? [];
|
|
1845
|
-
const events = trait.stateMachine?.events ?? [];
|
|
1846
|
-
const transitions = trait.stateMachine?.transitions ?? [];
|
|
1847
|
-
const result = { name: trait.name };
|
|
1848
|
-
if (trait.linkedEntity) result.linkedEntity = trait.linkedEntity;
|
|
1849
|
-
if (trait.stateMachine) {
|
|
1850
|
-
result.stateMachine = {
|
|
1851
|
-
states: states.map((s) => {
|
|
1852
|
-
const st = { name: s.name };
|
|
1853
|
-
if (s.isInitial) st.isInitial = true;
|
|
1854
|
-
if (s.isTerminal) st.isTerminal = true;
|
|
1855
|
-
if (s.isFinal) st.isFinal = true;
|
|
1856
|
-
return st;
|
|
1857
|
-
}),
|
|
1858
|
-
events: summarizeEvents(events),
|
|
1859
|
-
transitions: summarizeTransitions(transitions)
|
|
1860
|
-
};
|
|
1861
|
-
}
|
|
1862
|
-
if (trait.emits && trait.emits.length > 0) {
|
|
1863
|
-
result.emits = trait.emits.map((e) => ({
|
|
1864
|
-
event: e.event,
|
|
1865
|
-
...e.scope ? { scope: e.scope } : {}
|
|
1866
|
-
}));
|
|
1867
|
-
}
|
|
1868
|
-
if (trait.listens && trait.listens.length > 0) {
|
|
1869
|
-
result.listens = trait.listens.map((l) => ({
|
|
1870
|
-
event: l.event,
|
|
1871
|
-
triggers: l.triggers,
|
|
1872
|
-
...l.scope ? { scope: l.scope } : {}
|
|
1873
|
-
}));
|
|
1874
|
-
}
|
|
1875
|
-
return result;
|
|
1876
|
-
}
|
|
1877
|
-
function summarizePage(page) {
|
|
1878
|
-
const result = { name: page.name, path: page.path };
|
|
1879
|
-
if (page.protocol !== void 0) result.protocol = page.protocol;
|
|
1880
|
-
if (page.address !== void 0) result.address = page.address;
|
|
1881
|
-
if (page.traits && page.traits.length > 0) {
|
|
1882
|
-
result.traits = page.traits.map((t) => ({ ref: t.ref }));
|
|
1883
|
-
}
|
|
1884
|
-
return result;
|
|
1885
|
-
}
|
|
1886
|
-
function summarizeOrbital(orbital) {
|
|
1887
|
-
let entity;
|
|
1888
|
-
if (isEntityReference(orbital.entity)) {
|
|
1889
|
-
entity = { name: orbital.entity, fields: [] };
|
|
1890
|
-
} else if (isEntityCall(orbital.entity)) {
|
|
1891
|
-
const call = orbital.entity;
|
|
1892
|
-
const name = call.name ?? parseEntityRef(call.extends)?.alias ?? call.extends;
|
|
1893
|
-
entity = {
|
|
1894
|
-
name,
|
|
1895
|
-
fields: call.fields ?? [],
|
|
1896
|
-
...call.persistence ? { persistence: call.persistence } : {},
|
|
1897
|
-
...call.collection ? { collection: call.collection } : {}
|
|
1898
|
-
};
|
|
1899
|
-
} else {
|
|
1900
|
-
entity = summarizeEntity(orbital.entity);
|
|
1901
|
-
}
|
|
1902
|
-
const traits = orbital.traits.map((traitRef) => {
|
|
1903
|
-
if (isInlineTrait(traitRef)) {
|
|
1904
|
-
return summarizeTrait(traitRef);
|
|
1905
|
-
}
|
|
1906
|
-
return traitRef;
|
|
1907
|
-
});
|
|
1908
|
-
const pages = orbital.pages.filter((p) => typeof p === "object" && "name" in p && !("ref" in p)).map(summarizePage);
|
|
1909
|
-
return { name: orbital.name, entity, traits, pages };
|
|
1910
|
-
}
|
|
1911
|
-
function summarizeSchema(schema) {
|
|
1912
|
-
return {
|
|
1913
|
-
name: schema.name,
|
|
1914
|
-
description: schema.description,
|
|
1915
|
-
version: schema.version,
|
|
1916
|
-
orbitals: schema.orbitals.map(summarizeOrbital)
|
|
1917
|
-
};
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
// src/access/externalInputs.ts
|
|
1921
|
-
function externalInputsOf(schema) {
|
|
1922
|
-
const out = [];
|
|
1923
|
-
for (const orbital of schema.orbitals ?? []) {
|
|
1924
|
-
for (const traitRef of orbital.traits ?? []) {
|
|
1925
|
-
if (!isInlineTrait(traitRef)) continue;
|
|
1926
|
-
for (const ev of traitRef.stateMachine?.events ?? []) {
|
|
1927
|
-
if (ev.input !== true) continue;
|
|
1928
|
-
out.push({
|
|
1929
|
-
orbital: orbital.name,
|
|
1930
|
-
trait: traitRef.name,
|
|
1931
|
-
event: ev.key,
|
|
1932
|
-
payloadSchema: ev.payloadSchema ?? [],
|
|
1933
|
-
...ev.description !== void 0 ? { description: ev.description } : {},
|
|
1934
|
-
...ev.synonyms !== void 0 ? { synonyms: ev.synonyms } : {},
|
|
1935
|
-
...ev.tier !== void 0 ? { tier: ev.tier } : {}
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1940
|
-
return out;
|
|
1941
|
-
}
|
|
1942
|
-
function readableEntitiesOf(schema) {
|
|
1943
|
-
const out = [];
|
|
1944
|
-
for (const orbital of schema.orbitals ?? []) {
|
|
1945
|
-
for (const entity of orbitalInlineEntities(orbital)) {
|
|
1946
|
-
if (entity.persistence === "runtime" || out.includes(entity.name)) continue;
|
|
1947
|
-
out.push(entity.name);
|
|
1948
|
-
}
|
|
1949
|
-
}
|
|
1950
|
-
return out;
|
|
1951
|
-
}
|
|
1952
|
-
function findExternalInput(schema, orbital, trait, event) {
|
|
1953
|
-
return externalInputsOf(schema).find((i) => i.orbital === orbital && i.trait === trait && i.event === event);
|
|
1954
|
-
}
|
|
1955
|
-
function findInputByAddress(inputs, address, caller) {
|
|
1956
|
-
const { event, source } = splitEventAddress(address);
|
|
1957
|
-
if (source?.kind === "any") return void 0;
|
|
1958
|
-
const orbital = source?.kind === "orbital" ? source.orbital : caller.orbital;
|
|
1959
|
-
const trait = source === void 0 ? caller.trait : source.trait;
|
|
1960
|
-
return inputs.find((i) => i.orbital === orbital && i.trait === trait && i.event === event);
|
|
1961
|
-
}
|
|
1962
|
-
function payloadSchemaToJsonSchema(fields) {
|
|
1963
|
-
const properties = {};
|
|
1964
|
-
const required = [];
|
|
1965
|
-
for (const field of fields) {
|
|
1966
|
-
if (field.properties !== void 0 && field.properties.length === 0 && field.type !== "union") continue;
|
|
1967
|
-
properties[field.name] = payloadFieldToJsonSchema(field);
|
|
1968
|
-
if (field.required === true) required.push(field.name);
|
|
1969
|
-
}
|
|
1970
|
-
return {
|
|
1971
|
-
type: "object",
|
|
1972
|
-
...fields.length > 0 ? { additionalProperties: false } : {},
|
|
1973
|
-
properties,
|
|
1974
|
-
...required.length > 0 ? { required } : {}
|
|
1975
|
-
};
|
|
1976
|
-
}
|
|
1977
|
-
function elementOf(type) {
|
|
1978
|
-
const isArray = type.startsWith("[") && type.endsWith("]");
|
|
1979
|
-
return { isArray, element: isArray ? type.slice(1, -1) : type };
|
|
1980
|
-
}
|
|
1981
|
-
function payloadFieldToJsonSchema(field) {
|
|
1982
|
-
const { isArray, element } = elementOf(field.type);
|
|
1983
|
-
const base = field.properties !== void 0 ? payloadSchemaToJsonSchema(field.properties) : (() => {
|
|
1984
|
-
const t = mapEntityFieldType(element);
|
|
1985
|
-
return t === null ? {} : { type: t };
|
|
1986
|
-
})();
|
|
1987
|
-
const shape = field.values !== void 0 ? { ...base, enum: [...field.values] } : base;
|
|
1988
|
-
return isArray ? { type: "array", items: shape } : shape;
|
|
1989
|
-
}
|
|
1990
|
-
function isPayloadObject(value) {
|
|
1991
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date);
|
|
1992
|
-
}
|
|
1993
|
-
function payloadIssues(fields, value) {
|
|
1994
|
-
return objectIssues(fields, value, "");
|
|
1995
|
-
}
|
|
1996
|
-
function objectIssues(fields, value, at) {
|
|
1997
|
-
if (!isPayloadObject(value)) {
|
|
1998
|
-
return [{ path: at === "" ? "." : at, reason: "wrong-type", expected: "object" }];
|
|
1999
|
-
}
|
|
2000
|
-
const join = (key) => at === "" ? key : `${at}.${key}`;
|
|
2001
|
-
const issues = [];
|
|
2002
|
-
for (const field of fields) {
|
|
2003
|
-
const v = value[field.name];
|
|
2004
|
-
if (v === void 0 || v === null) {
|
|
2005
|
-
if (field.required === true) issues.push({ path: join(field.name), reason: "missing" });
|
|
2006
|
-
continue;
|
|
2007
|
-
}
|
|
2008
|
-
issues.push(...fieldIssues(field, v, join(field.name)));
|
|
2009
|
-
}
|
|
2010
|
-
const declared = new Set(fields.map((f) => f.name));
|
|
2011
|
-
const allowed = fields.length > 0 ? fields.map((f) => f.name).join(" | ") : "(no keys)";
|
|
2012
|
-
for (const key of Object.keys(value)) {
|
|
2013
|
-
if (!declared.has(key)) issues.push({ path: join(key), reason: "unknown", expected: allowed });
|
|
2014
|
-
}
|
|
2015
|
-
return issues;
|
|
2016
|
-
}
|
|
2017
|
-
function fieldIssues(field, value, at) {
|
|
2018
|
-
const { isArray, element } = elementOf(field.type);
|
|
2019
|
-
if (isArray || field.type === "array") {
|
|
2020
|
-
if (!Array.isArray(value)) return [{ path: at, reason: "wrong-type", expected: field.type }];
|
|
2021
|
-
return value.flatMap((item, i) => elementIssues(field, element, item, `${at}[${i}]`));
|
|
2022
|
-
}
|
|
2023
|
-
return elementIssues(field, element, value, at);
|
|
2024
|
-
}
|
|
2025
|
-
function elementIssues(field, element, value, at) {
|
|
2026
|
-
if (field.properties !== void 0 && field.type !== "union") return objectIssues(field.properties, value, at);
|
|
2027
|
-
if (field.type === "union" && field.properties !== void 0) {
|
|
2028
|
-
const variants = field.properties;
|
|
2029
|
-
return variants.some((v) => elementIssues(v, elementOf(v.type).element, value, at).length === 0) ? [] : [{ path: at, reason: "wrong-type", expected: variants.map((v) => v.type).join(" | ") }];
|
|
2030
|
-
}
|
|
2031
|
-
const json = element === "object" ? "object" : mapEntityFieldType(element);
|
|
2032
|
-
const matches = json === null || json === "object" && isPayloadObject(value) || json === "array" && Array.isArray(value) || json === "string" && (typeof value === "string" || value instanceof Date) || json === "number" && typeof value === "number" || json === "integer" && typeof value === "number" && Number.isInteger(value) || json === "boolean" && typeof value === "boolean";
|
|
2033
|
-
if (!matches) return [{ path: at, reason: "wrong-type", expected: element }];
|
|
2034
|
-
if (field.values !== void 0 && (typeof value !== "string" || !field.values.includes(value))) {
|
|
2035
|
-
return [{ path: at, reason: "not-one-of", expected: field.values.join(" | ") }];
|
|
2036
|
-
}
|
|
2037
|
-
return [];
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
// src/access/inbound.ts
|
|
2041
|
-
function answerHeaders(value) {
|
|
2042
|
-
if (value === void 0 || value === null) return void 0;
|
|
2043
|
-
if (typeof value !== "object" || Array.isArray(value)) return false;
|
|
2044
|
-
const out = {};
|
|
2045
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
2046
|
-
if (typeof entry !== "string") return false;
|
|
2047
|
-
out[key] = entry;
|
|
2048
|
-
}
|
|
2049
|
-
return out;
|
|
2050
|
-
}
|
|
2051
|
-
function inboundRoutesOf(schema) {
|
|
1412
|
+
// src/access/entityAccess.ts
|
|
1413
|
+
function orbitalInlineEntities(orbital) {
|
|
2052
1414
|
const out = [];
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
if (ev.inbound === void 0) continue;
|
|
2058
|
-
out.push({
|
|
2059
|
-
name: ev.inbound.name,
|
|
2060
|
-
orbital: orbital.name,
|
|
2061
|
-
trait: traitRef.name,
|
|
2062
|
-
event: ev.key,
|
|
2063
|
-
answer: ev.inbound.answers,
|
|
2064
|
-
...ev.inbound.verifies !== void 0 ? { verifies: ev.inbound.verifies } : {}
|
|
2065
|
-
});
|
|
2066
|
-
}
|
|
1415
|
+
const refs = [orbital.entity, ...orbital.auxiliaryEntities ?? []];
|
|
1416
|
+
for (const ref of refs) {
|
|
1417
|
+
if (typeof ref === "object" && ref !== null && "fields" in ref) {
|
|
1418
|
+
out.push(ref);
|
|
2067
1419
|
}
|
|
2068
1420
|
}
|
|
2069
1421
|
return out;
|
|
2070
1422
|
}
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
const prev = headers[key];
|
|
2115
|
-
headers[key] = typeof prev === "string" ? `${prev}, ${value}` : value;
|
|
2116
|
-
}
|
|
2117
|
-
const payload = { headers, body: parsedBody(delivery.rawBody), rawBody: delivery.rawBody };
|
|
2118
|
-
if (route.verifies !== void 0) {
|
|
2119
|
-
const seen = headers[route.verifies.header];
|
|
2120
|
-
payload.verified = credential === void 0 || credential === null || credential === "" ? false : constantTimeEquals(typeof seen === "string" ? seen : "", credential);
|
|
2121
|
-
}
|
|
2122
|
-
return payload;
|
|
2123
|
-
}
|
|
2124
|
-
function inboundAnswerOf(route, emitted, failure) {
|
|
2125
|
-
const answer = emitted.find((e) => e.event === route.answer);
|
|
2126
|
-
if (answer === void 0) return dispatchFailed(failure ?? "inbound-unanswered");
|
|
2127
|
-
const payload = answer.payload ?? {};
|
|
2128
|
-
const { status, body, stderr } = payload;
|
|
2129
|
-
const headers = answerHeaders(payload.headers);
|
|
2130
|
-
if (typeof status === "number" && Number.isInteger(status) && status >= 100 && status <= 599 && typeof body === "string" && (stderr === void 0 || typeof stderr === "string") && headers !== false) {
|
|
2131
|
-
return {
|
|
2132
|
-
status,
|
|
2133
|
-
body,
|
|
2134
|
-
...stderr === void 0 ? {} : { stderr },
|
|
2135
|
-
...headers === void 0 ? {} : { headers }
|
|
2136
|
-
};
|
|
2137
|
-
}
|
|
2138
|
-
return dispatchFailed("inbound-answer-invalid");
|
|
2139
|
-
}
|
|
1423
|
+
var ExternalInputSchema = z.object({
|
|
1424
|
+
orbital: z.string(),
|
|
1425
|
+
trait: z.string(),
|
|
1426
|
+
event: z.string(),
|
|
1427
|
+
payloadSchema: z.array(PayloadFieldSchema),
|
|
1428
|
+
description: z.string().optional(),
|
|
1429
|
+
synonyms: z.string().optional(),
|
|
1430
|
+
tier: z.string().optional()
|
|
1431
|
+
});
|
|
1432
|
+
var InboundRouteSchema = z.object({
|
|
1433
|
+
name: z.string(),
|
|
1434
|
+
orbital: z.string(),
|
|
1435
|
+
trait: z.string(),
|
|
1436
|
+
event: z.string(),
|
|
1437
|
+
answer: z.string(),
|
|
1438
|
+
verifies: InboundVerificationSchema.optional()
|
|
1439
|
+
});
|
|
1440
|
+
var InboundAnswerSchema = z.object({
|
|
1441
|
+
status: z.number(),
|
|
1442
|
+
body: z.string(),
|
|
1443
|
+
stderr: z.string().optional(),
|
|
1444
|
+
/** Response headers the answer declares; a terminal host reads `orb-run`. */
|
|
1445
|
+
headers: z.record(z.string(), z.string()).optional()
|
|
1446
|
+
});
|
|
1447
|
+
var InboundFoundSchema = z.union([z.object({ route: InboundRouteSchema }), z.object({ answer: InboundAnswerSchema })]);
|
|
1448
|
+
var InboundOnlySchema = z.object({ trait: z.string(), message: z.string() }).nullable();
|
|
1449
|
+
var NameListSchema = z.array(z.string());
|
|
1450
|
+
var OptionalNameSchema = z.string().nullable();
|
|
1451
|
+
var PayloadIssueSchema = z.object({
|
|
1452
|
+
path: z.string(),
|
|
1453
|
+
reason: z.enum(["missing", "unknown", "wrong-type", "not-one-of"]),
|
|
1454
|
+
expected: z.string().optional()
|
|
1455
|
+
});
|
|
1456
|
+
var PayloadJsonSchemaSchema = z.lazy(
|
|
1457
|
+
() => z.strictObject({
|
|
1458
|
+
type: z.enum(["string", "number", "integer", "boolean", "array", "object"]).optional(),
|
|
1459
|
+
properties: z.record(z.string(), PayloadJsonSchemaSchema).optional(),
|
|
1460
|
+
required: z.array(z.string()).optional(),
|
|
1461
|
+
additionalProperties: z.boolean().optional(),
|
|
1462
|
+
items: PayloadJsonSchemaSchema.optional(),
|
|
1463
|
+
enum: z.array(z.string()).optional()
|
|
1464
|
+
})
|
|
1465
|
+
);
|
|
2140
1466
|
|
|
2141
1467
|
// src/route-match.ts
|
|
2142
1468
|
function matchPath(pattern, path) {
|
|
@@ -2203,6 +1529,15 @@ function defaultPage(schema) {
|
|
|
2203
1529
|
}
|
|
2204
1530
|
return first;
|
|
2205
1531
|
}
|
|
1532
|
+
function notFoundPage(schema) {
|
|
1533
|
+
for (const orbital of schema.orbitals) {
|
|
1534
|
+
for (const page of orbital.pages ?? []) {
|
|
1535
|
+
if (isPageReference(page) || !isRoutePage(page)) continue;
|
|
1536
|
+
if (page.isNotFound === true) return { page, orbitalName: orbital.name };
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
return null;
|
|
1540
|
+
}
|
|
2206
1541
|
function pathMatchesPattern(path, pattern) {
|
|
2207
1542
|
return matchPath(pattern, path) !== null;
|
|
2208
1543
|
}
|
|
@@ -2212,7 +1547,8 @@ function mergeEntityFrame(current, orderedWrites) {
|
|
|
2212
1547
|
if (orderedWrites.length === 0) return current;
|
|
2213
1548
|
const next = { ...current };
|
|
2214
1549
|
for (const write of orderedWrites) {
|
|
2215
|
-
next[write.field]
|
|
1550
|
+
if (write.value === void 0) delete next[write.field];
|
|
1551
|
+
else next[write.field] = write.value;
|
|
2216
1552
|
}
|
|
2217
1553
|
return next;
|
|
2218
1554
|
}
|
|
@@ -2247,6 +1583,6 @@ function findEntityAmongOrbitals(entities, name) {
|
|
|
2247
1583
|
return void 0;
|
|
2248
1584
|
}
|
|
2249
1585
|
|
|
2250
|
-
export { CodecError, DependencyGraphSchema, INDISTINCT_DELTA_E,
|
|
1586
|
+
export { CodecError, DependencyGraphSchema, ExternalInputSchema, INDISTINCT_DELTA_E, InboundAnswerSchema, InboundFoundSchema, InboundOnlySchema, InboundRouteSchema, NameListSchema, OptionalNameSchema, PayloadIssueSchema, PayloadJsonSchemaSchema, TRACE_ACTIVITY_TYPES, accessContext, accessDeniedMessage, applyRenderOverlay, applyRowAccess, base64DecodeBytes, base64EncodeBytes, categorizeRemovals, checkMutationAccess, ciede2000, collectCallsiteCaptureChildren, collectForwardedConfigKeys, collectOrbitalForwardedConfigKeys, collectTraitConfigRefAdjacency, collectTraitEmbedAdjacency, colorDifference, comparePathSpecificity, configForwardTokens, configReferencesCallsitePayload, decodeBase64, decodeUriComponent, defaultPage, dependencyGraphOf, detectPageContentReduction, diffOrbitalSchemas, diffSchemaSemantics, diffSchemas, encodeBase64, encodeDigest, encodeUriComponent, filterConfigToForwardedKeys, findEntityAmongOrbitals, fingerprintNode, getNestedValue, getRemovals, hasSignificantPageReduction, hashMd5, hashSha256, hexToLab, hmacSha256, hmacSha256Bytes, importsOf, insertChildAtPath, isDestructiveChange, matchPath, matchPathAmong, md5Bytes, mergeEntityFrame, navigatePatternPath, notFoundPage, omitFrameFields, orbitalFileOf, orbitalInlineEntities, pathMatchesPattern, removeChildAtPath, renderRootOf, replaceChildAtPath, requiresConfirmation, resolveEntityView, rowAccess, selectTraceActivities, setPropAtPath, sha256Bytes, splitPatternChildPath, themeModes, toneColor, traceActivityPayload, traitDeclaresConfigForward, traitReferencesCallsitePayload, traitsEmbeddedByEffects, traitsEmbeddedByEvent, utf8Bytes };
|
|
2251
1587
|
//# sourceMappingURL=index.js.map
|
|
2252
1588
|
//# sourceMappingURL=index.js.map
|