@coasys/ad4m 0.13.0-test-flows-1 → 0.13.1-staging.2
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/README.md +1 -0
- package/lib/index.cjs +9613 -7069
- package/lib/index.js +7367 -4840
- package/lib/src/Ad4mClient.d.ts +12 -4
- package/lib/src/Ad4mClient.js +15 -11
- package/lib/src/Literal.js +3 -3
- package/lib/src/agent/Agent.d.ts +4 -1
- package/lib/src/agent/Agent.js +6 -0
- package/lib/src/agent/AgentClient.d.ts +9 -23
- package/lib/src/agent/AgentClient.js +68 -148
- package/lib/src/ai/AIClient.d.ts +10 -6
- package/lib/src/ai/AIClient.js +29 -27
- package/lib/src/apiClient.d.ts +54 -42
- package/lib/src/apiClient.js +279 -252
- package/lib/src/expression/Expression.d.ts +13 -4
- package/lib/src/expression/Expression.js +0 -1
- package/lib/src/expression/ExpressionClient.js +1 -1
- package/lib/src/generated/api/AIPromptExamples.d.ts +4 -0
- package/lib/src/generated/api/AIPromptExamples.js +2 -0
- package/lib/src/generated/api/AIPromptExamplesInput.d.ts +4 -0
- package/lib/src/generated/api/AIPromptExamplesInput.js +2 -0
- package/lib/src/generated/api/AITask.d.ts +11 -0
- package/lib/src/generated/api/AITaskInput.d.ts +8 -0
- package/lib/src/generated/api/AddAgentInfosRequest.d.ts +3 -0
- package/lib/src/generated/api/AddAgentInfosRequest.js +2 -0
- package/lib/src/generated/api/AddLinkExpressionRequest.d.ts +2 -2
- package/lib/src/generated/api/AddLinkRequest.d.ts +2 -2
- package/lib/src/generated/api/AddLinksBulkRequest.d.ts +2 -2
- package/lib/src/generated/api/AddSdnaRequest.d.ts +2 -2
- package/lib/src/generated/api/Agent.d.ts +6 -0
- package/lib/src/generated/api/AgentAddEntanglementProofsParams.d.ts +9 -0
- package/lib/src/generated/api/AgentByDidParams.d.ts +3 -0
- package/lib/src/generated/api/AgentByDidParams.js +2 -0
- package/lib/src/generated/api/AgentRemoveAppParams.d.ts +3 -0
- package/lib/src/generated/api/AgentRemoveAppParams.js +2 -0
- package/lib/src/generated/api/AgentRevokeTokenParams.d.ts +3 -0
- package/lib/src/generated/api/AgentRevokeTokenParams.js +2 -0
- package/lib/src/generated/api/AgentSignature.d.ts +4 -0
- package/lib/src/generated/api/AgentSignature.js +2 -0
- package/lib/src/generated/api/AgentStatus.d.ts +8 -0
- package/lib/src/generated/api/AgentStatusChangedEvent.d.ts +7 -0
- package/lib/src/generated/api/AgentUpdatedEvent.d.ts +7 -0
- package/lib/src/generated/api/AgentsByDidsRequest.d.ts +3 -0
- package/lib/src/generated/api/AgentsByDidsRequest.js +2 -0
- package/lib/src/generated/api/AiAddModelParams.d.ts +4 -0
- package/lib/src/generated/api/AiAddTaskParams.d.ts +4 -0
- package/lib/src/generated/api/AiDiscoverModelsParams.d.ts +8 -0
- package/lib/src/generated/api/AiDiscoverModelsParams.js +2 -0
- package/lib/src/generated/api/AiGetDefaultModelParams.d.ts +4 -0
- package/lib/src/generated/api/AiIdParams.d.ts +3 -0
- package/lib/src/generated/api/AiIdParams.js +2 -0
- package/lib/src/generated/api/AiModelLoadingStatusParams.d.ts +7 -0
- package/lib/src/generated/api/AiModelLoadingStatusParams.js +2 -0
- package/lib/src/generated/api/AiSetDefaultModelParams.d.ts +5 -0
- package/lib/src/generated/api/AiSetDefaultModelParams.js +1 -0
- package/lib/src/generated/api/AiTranscriptionCloseParams.d.ts +3 -0
- package/lib/src/generated/api/AiTranscriptionCloseParams.js +2 -0
- package/lib/src/generated/api/AiTranscriptionOpenParams.d.ts +5 -0
- package/lib/src/generated/api/AiTranscriptionOpenParams.js +1 -0
- package/lib/src/generated/api/AiUpdateModelParams.d.ts +5 -0
- package/lib/src/generated/api/AiUpdateModelParams.js +1 -0
- package/lib/src/generated/api/AiUpdateTaskParams.d.ts +4 -0
- package/lib/src/generated/api/AiUpdateTaskParams.js +1 -0
- package/lib/src/generated/api/Apps.d.ts +7 -0
- package/lib/src/generated/api/Apps.js +1 -0
- package/lib/src/generated/api/AuthInfo.d.ts +10 -0
- package/lib/src/generated/api/AuthInfo.js +1 -0
- package/lib/src/generated/api/AuthInfoInput.d.ts +4 -4
- package/lib/src/generated/api/AutoProcessorEvent.d.ts +89 -0
- package/lib/src/generated/api/AutoProcessorEvent.js +1 -0
- package/lib/src/generated/api/AutoProcessorNeighbourhoodState.d.ts +32 -0
- package/lib/src/generated/api/AutoProcessorNeighbourhoodState.js +1 -0
- package/lib/src/generated/api/AutoProcessorStep.d.ts +7 -0
- package/lib/src/generated/api/AutoProcessorStep.js +2 -0
- package/lib/src/generated/api/BroadcastRequest.d.ts +5 -0
- package/lib/src/generated/api/BroadcastRequest.js +2 -0
- package/lib/src/generated/api/CallSessionInfo.d.ts +23 -0
- package/lib/src/generated/api/CallSessionInfo.js +2 -0
- package/lib/src/generated/api/Capability.d.ts +5 -0
- package/lib/src/generated/api/Capability.js +1 -0
- package/lib/src/generated/api/CreateSubjectRequest.d.ts +2 -2
- package/lib/src/generated/api/CreateUserRequest.d.ts +4 -0
- package/lib/src/generated/api/CreateUserRequest.js +2 -0
- package/lib/src/generated/api/DateTime.d.ts +1 -0
- package/lib/src/generated/api/DateTime.js +2 -0
- package/lib/src/generated/api/DecoratedExpressionProof.d.ts +6 -0
- package/lib/src/generated/api/DecoratedExpressionProof.js +2 -0
- package/lib/src/generated/api/DecoratedLinkExpression.d.ts +10 -0
- package/lib/src/generated/api/DecoratedLinkExpression.js +1 -0
- package/lib/src/generated/api/DecoratedNeighbourhoodExpression.d.ts +8 -0
- package/lib/src/generated/api/DecoratedNeighbourhoodExpression.js +1 -0
- package/lib/src/generated/api/DecoratedPerspective.d.ts +4 -0
- package/lib/src/generated/api/DecoratedPerspective.js +1 -0
- package/lib/src/generated/api/DiscardBatchRequest.d.ts +3 -0
- package/lib/src/generated/api/DiscardBatchRequest.js +2 -0
- package/lib/src/generated/api/DisposeQueryRequest.d.ts +3 -0
- package/lib/src/generated/api/DisposeQueryRequest.js +2 -0
- package/lib/src/generated/api/EntanglementProof.d.ts +8 -0
- package/lib/src/generated/api/EntanglementProof.js +2 -0
- package/lib/src/generated/api/EntanglementProofInput.d.ts +1 -1
- package/lib/src/generated/api/EntanglementProofPreflightRequest.d.ts +4 -0
- package/lib/src/generated/api/EntanglementProofPreflightRequest.js +2 -0
- package/lib/src/generated/api/EntanglementProofsWrapper.d.ts +7 -0
- package/lib/src/generated/api/EntanglementProofsWrapper.js +1 -0
- package/lib/src/generated/api/Events.d.ts +56 -0
- package/lib/src/generated/api/Events.js +18 -0
- package/lib/src/generated/api/ExceptionInfo.d.ts +7 -0
- package/lib/src/generated/api/ExceptionInfo.js +1 -0
- package/lib/src/generated/api/ExceptionOccurredEvent.d.ts +7 -0
- package/lib/src/generated/api/ExceptionOccurredEvent.js +1 -0
- package/lib/src/generated/api/ExceptionType.d.ts +1 -0
- package/lib/src/generated/api/ExceptionType.js +2 -0
- package/lib/src/generated/api/ExecuteCommandsRequest.d.ts +4 -2
- package/lib/src/generated/api/ExportRequest.d.ts +1 -1
- package/lib/src/generated/api/ExpressionInteractRequest.d.ts +5 -0
- package/lib/src/generated/api/ExpressionInteractRequest.js +1 -0
- package/lib/src/generated/api/ExpressionProofInput.d.ts +4 -4
- package/lib/src/generated/api/ExpressionRendered.d.ts +11 -0
- package/lib/src/generated/api/ExpressionRendered.js +1 -0
- package/lib/src/generated/api/ExpressionUrlRequest.d.ts +3 -0
- package/lib/src/generated/api/ExpressionUrlRequest.js +2 -0
- package/lib/src/generated/api/FireOutcome.d.ts +14 -0
- package/lib/src/generated/api/FireOutcome.js +2 -0
- package/lib/src/generated/api/FlowStateChangedEvent.d.ts +38 -0
- package/lib/src/generated/api/FlowStateChangedEvent.js +2 -0
- package/lib/src/generated/api/FlowStateEntry.d.ts +18 -0
- package/lib/src/generated/api/FlowStateEntry.js +2 -0
- package/lib/src/generated/api/FriendSendMessageRequest.d.ts +1 -1
- package/lib/src/generated/api/HostRate.d.ts +7 -0
- package/lib/src/generated/api/HostRate.js +2 -0
- package/lib/src/generated/api/HostingInfoResult.d.ts +13 -0
- package/lib/src/generated/api/HostingInfoResult.js +1 -0
- package/lib/src/generated/api/HostingInfoUser.d.ts +9 -0
- package/lib/src/generated/api/HostingInfoUser.js +2 -0
- package/lib/src/generated/api/HostingRequestPaymentResult.d.ts +4 -0
- package/lib/src/generated/api/HostingRequestPaymentResult.js +2 -0
- package/lib/src/generated/api/HostingUserInfo.d.ts +6 -0
- package/lib/src/generated/api/HostingUserInfo.js +2 -0
- package/lib/src/generated/api/HostingVersionInfo.d.ts +7 -0
- package/lib/src/generated/api/HostingVersionInfo.js +2 -0
- package/lib/src/generated/api/HostingWalletResult.d.ts +8 -0
- package/lib/src/generated/api/HostingWalletResult.js +1 -0
- package/lib/src/generated/api/IceServer.d.ts +18 -0
- package/lib/src/generated/api/IceServer.js +2 -0
- package/lib/src/generated/api/Icon.d.ts +3 -0
- package/lib/src/generated/api/Icon.js +2 -0
- package/lib/src/generated/api/ImportResult.d.ts +15 -0
- package/lib/src/generated/api/ImportResult.js +1 -0
- package/lib/src/generated/api/ImportStats.d.ts +7 -0
- package/lib/src/generated/api/ImportStats.js +2 -0
- package/lib/src/generated/api/InteractionCall.d.ts +4 -0
- package/lib/src/generated/api/InteractionCall.js +2 -0
- package/lib/src/generated/api/InteractionCallWrapper.d.ts +6 -0
- package/lib/src/generated/api/InteractionCallWrapper.js +2 -0
- package/lib/src/generated/api/InteractionMeta.d.ts +6 -0
- package/lib/src/generated/api/InteractionMeta.js +1 -0
- package/lib/src/generated/api/InteractionParameter.d.ts +4 -0
- package/lib/src/generated/api/InteractionParameter.js +2 -0
- package/lib/src/generated/api/LanguageAddressParams.d.ts +3 -0
- package/lib/src/generated/api/LanguageAddressParams.js +2 -0
- package/lib/src/generated/api/LanguageHandle.d.ts +9 -0
- package/lib/src/generated/api/LanguageHandle.js +1 -0
- package/lib/src/generated/api/LanguageListParams.d.ts +3 -0
- package/lib/src/generated/api/LanguageListParams.js +2 -0
- package/lib/src/generated/api/LanguageMeta.d.ts +11 -0
- package/lib/src/generated/api/LanguageMeta.js +2 -0
- package/lib/src/generated/api/LanguageMetaInput.d.ts +2 -2
- package/lib/src/generated/api/LanguageRef.d.ts +4 -0
- package/lib/src/generated/api/LanguageRef.js +2 -0
- package/lib/src/generated/api/LanguageSettingsWrapper.d.ts +6 -0
- package/lib/src/generated/api/LanguageSettingsWrapper.js +2 -0
- package/lib/src/generated/api/LanguageWriteSettingsParams.d.ts +4 -0
- package/lib/src/generated/api/LanguageWriteSettingsParams.js +2 -0
- package/lib/src/generated/api/LinkExpressionInput.d.ts +1 -1
- package/lib/src/generated/api/LinkInput.d.ts +1 -1
- package/lib/src/generated/api/LinkMutationRequest.d.ts +12 -0
- package/lib/src/generated/api/LinkMutationRequest.js +1 -0
- package/lib/src/generated/api/LinkMutationsRequest.d.ts +5 -0
- package/lib/src/generated/api/LinkMutationsRequest.js +1 -0
- package/lib/src/generated/api/LinkStatus.d.ts +1 -1
- package/lib/src/generated/api/LinkUpdateInput.d.ts +5 -0
- package/lib/src/generated/api/LinkUpdateInput.js +1 -0
- package/lib/src/generated/api/LocalModel.d.ts +7 -0
- package/lib/src/generated/api/LocalModel.js +1 -0
- package/lib/src/generated/api/LocalModelInput.d.ts +7 -0
- package/lib/src/generated/api/LocalModelInput.js +1 -0
- package/lib/src/generated/api/MessageReceivedEvent.d.ts +7 -0
- package/lib/src/generated/api/MessageReceivedEvent.js +1 -0
- package/lib/src/generated/api/Model.d.ts +10 -0
- package/lib/src/generated/api/Model.js +1 -0
- package/lib/src/generated/api/ModelApi.d.ts +17 -0
- package/lib/src/generated/api/ModelApi.js +1 -0
- package/lib/src/generated/api/ModelApiInput.d.ts +11 -0
- package/lib/src/generated/api/ModelApiInput.js +2 -0
- package/lib/src/generated/api/ModelApiType.d.ts +1 -0
- package/lib/src/generated/api/ModelApiType.js +2 -0
- package/lib/src/generated/api/ModelInput.d.ts +9 -0
- package/lib/src/generated/api/ModelInput.js +1 -0
- package/lib/src/generated/api/ModelType.d.ts +1 -1
- package/lib/src/generated/api/Neighbourhood.d.ts +5 -0
- package/lib/src/generated/api/Neighbourhood.js +1 -0
- package/lib/src/generated/api/NeighbourhoodBroadcastParams.d.ts +7 -0
- package/lib/src/generated/api/NeighbourhoodBroadcastParams.js +1 -0
- package/lib/src/generated/api/NeighbourhoodOnlineStatusParams.d.ts +6 -0
- package/lib/src/generated/api/NeighbourhoodOnlineStatusParams.js +1 -0
- package/lib/src/generated/api/NeighbourhoodPerspectivePayload.d.ts +7 -0
- package/lib/src/generated/api/NeighbourhoodPerspectivePayload.js +1 -0
- package/lib/src/generated/api/NeighbourhoodPhase.d.ts +6 -0
- package/lib/src/generated/api/NeighbourhoodPhase.js +2 -0
- package/lib/src/generated/api/NeighbourhoodSignalFilter.d.ts +8 -0
- package/lib/src/generated/api/NeighbourhoodSignalFilter.js +1 -0
- package/lib/src/generated/api/NeighbourhoodSignalParams.d.ts +7 -0
- package/lib/src/generated/api/NeighbourhoodSignalParams.js +1 -0
- package/lib/src/generated/api/NeighbourhoodSignedPerspective.d.ts +8 -0
- package/lib/src/generated/api/NeighbourhoodSignedPerspective.js +1 -0
- package/lib/src/generated/api/NeighbourhoodUuidParams.d.ts +3 -0
- package/lib/src/generated/api/NeighbourhoodUuidParams.js +2 -0
- package/lib/src/generated/api/Notification.d.ts +16 -0
- package/lib/src/generated/api/Notification.js +2 -0
- package/lib/src/generated/api/NotificationGrantRequest.d.ts +6 -0
- package/lib/src/generated/api/NotificationGrantRequest.js +2 -0
- package/lib/src/generated/api/NotificationInput.d.ts +1 -1
- package/lib/src/generated/api/NotificationTriggeredEvent.d.ts +9 -0
- package/lib/src/generated/api/NotificationTriggeredEvent.js +1 -0
- package/lib/src/generated/api/OnlineAgent.d.ts +9 -0
- package/lib/src/generated/api/OnlineAgent.js +1 -0
- package/lib/src/generated/api/OutputRef.d.ts +12 -0
- package/lib/src/generated/api/OutputRef.js +2 -0
- package/lib/src/generated/api/OverlayView.d.ts +24 -0
- package/lib/src/generated/api/OverlayView.js +1 -0
- package/lib/src/generated/api/Perspective.d.ts +4 -0
- package/lib/src/generated/api/Perspective.js +1 -0
- package/lib/src/generated/api/PerspectiveAddAutoProcessorParams.d.ts +26 -0
- package/lib/src/generated/api/PerspectiveAddAutoProcessorParams.js +2 -0
- package/lib/src/generated/api/PerspectiveAddLinkExpressionParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveAddLinkExpressionParams.js +1 -0
- package/lib/src/generated/api/PerspectiveAddLinkParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveAddLinkParams.js +1 -0
- package/lib/src/generated/api/PerspectiveAddLinksParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveAddLinksParams.js +1 -0
- package/lib/src/generated/api/PerspectiveAddSdnaParams.d.ts +14 -0
- package/lib/src/generated/api/PerspectiveAddSdnaParams.js +1 -0
- package/lib/src/generated/api/PerspectiveAddSdnaResult.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveAddSdnaResult.js +2 -0
- package/lib/src/generated/api/PerspectiveCommitBatchParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveCommitBatchParams.js +2 -0
- package/lib/src/generated/api/PerspectiveCreateSubjectParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveCreateSubjectParams.js +2 -0
- package/lib/src/generated/api/PerspectiveDiscardBatchParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveDiscardBatchParams.js +2 -0
- package/lib/src/generated/api/PerspectiveEvaluateGettersParams.d.ts +9 -0
- package/lib/src/generated/api/PerspectiveEvaluateGettersParams.js +2 -0
- package/lib/src/generated/api/PerspectiveExecuteCommandsParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveExecuteCommandsParams.js +2 -0
- package/lib/src/generated/api/PerspectiveExpression.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveExpression.js +1 -0
- package/lib/src/generated/api/PerspectiveFlowFiredParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveFlowFiredParams.js +2 -0
- package/lib/src/generated/api/PerspectiveFlowProposalParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveFlowProposalParams.js +2 -0
- package/lib/src/generated/api/PerspectiveFlowReceiptVerdict.d.ts +12 -0
- package/lib/src/generated/api/PerspectiveFlowReceiptVerdict.js +1 -0
- package/lib/src/generated/api/PerspectiveFlowStatesParams.d.ts +11 -0
- package/lib/src/generated/api/PerspectiveFlowStatesParams.js +2 -0
- package/lib/src/generated/api/PerspectiveFlowValidOutputsParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveFlowValidOutputsParams.js +2 -0
- package/lib/src/generated/api/PerspectiveGetAllShaclParams.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveGetAllShaclParams.js +2 -0
- package/lib/src/generated/api/PerspectiveGetSubjectDataParams.d.ts +5 -0
- package/lib/src/generated/api/PerspectiveGetSubjectDataParams.js +2 -0
- package/lib/src/generated/api/PerspectiveHandle.d.ts +10 -0
- package/lib/src/generated/api/PerspectiveHandle.js +1 -0
- package/lib/src/generated/api/PerspectiveLinkDiff.d.ts +9 -0
- package/lib/src/generated/api/PerspectiveLinkDiff.js +1 -0
- package/lib/src/generated/api/PerspectiveLinkMutationsParams.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveLinkMutationsParams.js +1 -0
- package/lib/src/generated/api/PerspectiveLinkUpdatedWithOwner.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveLinkUpdatedWithOwner.js +1 -0
- package/lib/src/generated/api/PerspectiveLinkWithOwner.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveLinkWithOwner.js +1 -0
- package/lib/src/generated/api/PerspectiveMintFlowReceiptParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveMintFlowReceiptParams.js +2 -0
- package/lib/src/generated/api/PerspectiveMintFlowReceiptResult.d.ts +9 -0
- package/lib/src/generated/api/PerspectiveMintFlowReceiptResult.js +1 -0
- package/lib/src/generated/api/PerspectiveModelQueryParams.d.ts +13 -0
- package/lib/src/generated/api/PerspectiveModelQueryParams.js +2 -0
- package/lib/src/generated/api/PerspectiveNamedShacl.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveNamedShacl.js +1 -0
- package/lib/src/generated/api/PerspectiveProposeFlowTransitionParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveProposeFlowTransitionParams.js +1 -0
- package/lib/src/generated/api/PerspectiveQueryLinksParams.d.ts +15 -0
- package/lib/src/generated/api/PerspectiveQueryLinksParams.js +2 -0
- package/lib/src/generated/api/PerspectiveQueryParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveQueryParams.js +2 -0
- package/lib/src/generated/api/PerspectiveReceiptOutcome.d.ts +1 -0
- package/lib/src/generated/api/PerspectiveReceiptOutcome.js +2 -0
- package/lib/src/generated/api/PerspectiveRejectFlowProposalResult.d.ts +3 -0
- package/lib/src/generated/api/PerspectiveRejectFlowProposalResult.js +2 -0
- package/lib/src/generated/api/PerspectiveRemoveAutoProcessorParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveRemoveAutoProcessorParams.js +2 -0
- package/lib/src/generated/api/PerspectiveRemoveLinkParams.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveRemoveLinkParams.js +1 -0
- package/lib/src/generated/api/PerspectiveRemoveLinksParams.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveRemoveLinksParams.js +1 -0
- package/lib/src/generated/api/PerspectiveRemoveSubjectParams.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveRemoveSubjectParams.js +2 -0
- package/lib/src/generated/api/PerspectiveRemovedWithOwner.d.ts +5 -0
- package/lib/src/generated/api/PerspectiveRemovedWithOwner.js +2 -0
- package/lib/src/generated/api/PerspectiveResolveInterpretationParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveResolveInterpretationParams.js +2 -0
- package/lib/src/generated/api/PerspectiveResynced.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveResynced.js +2 -0
- package/lib/src/generated/api/PerspectiveShacl.d.ts +5 -0
- package/lib/src/generated/api/PerspectiveShacl.js +1 -0
- package/lib/src/generated/api/PerspectiveShaclNameParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveShaclNameParams.js +2 -0
- package/lib/src/generated/api/PerspectiveSparqlParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveSparqlParams.js +2 -0
- package/lib/src/generated/api/PerspectiveState.d.ts +1 -0
- package/lib/src/generated/api/PerspectiveState.js +2 -0
- package/lib/src/generated/api/PerspectiveStateFilter.d.ts +7 -0
- package/lib/src/generated/api/PerspectiveStateFilter.js +1 -0
- package/lib/src/generated/api/PerspectiveSubjectClassesOfParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveSubjectClassesOfParams.js +2 -0
- package/lib/src/generated/api/PerspectiveSubscribed.d.ts +10 -0
- package/lib/src/generated/api/PerspectiveSubscribed.js +2 -0
- package/lib/src/generated/api/PerspectiveSubscriptionParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveSubscriptionParams.js +2 -0
- package/lib/src/generated/api/PerspectiveUnsignedInput.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveUnsignedInput.js +1 -0
- package/lib/src/generated/api/PerspectiveUpdateLinkParams.d.ts +8 -0
- package/lib/src/generated/api/PerspectiveUpdateLinkParams.js +1 -0
- package/lib/src/generated/api/PerspectiveUpdateParams.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveUpdateParams.js +2 -0
- package/lib/src/generated/api/PerspectiveUpdateSubjectParams.d.ts +10 -0
- package/lib/src/generated/api/PerspectiveUpdateSubjectParams.js +2 -0
- package/lib/src/generated/api/PerspectiveUuidParams.d.ts +3 -0
- package/lib/src/generated/api/PerspectiveUuidParams.js +2 -0
- package/lib/src/generated/api/PerspectiveVerifyFlowReceiptParams.d.ts +9 -0
- package/lib/src/generated/api/PerspectiveVerifyFlowReceiptParams.js +1 -0
- package/lib/src/generated/api/PerspectiveWithOwner.d.ts +6 -0
- package/lib/src/generated/api/PerspectiveWithOwner.js +1 -0
- package/lib/src/generated/api/ProposeOutcome.d.ts +45 -0
- package/lib/src/generated/api/ProposeOutcome.js +1 -0
- package/lib/src/generated/api/PublicPerspectiveInput.d.ts +4 -0
- package/lib/src/generated/api/PublicPerspectiveInput.js +1 -0
- package/lib/src/generated/api/PublishNeighbourhoodRequest.d.ts +2 -2
- package/lib/src/generated/api/QuerySubscriptionUpdate.d.ts +19 -0
- package/lib/src/generated/api/QuerySubscriptionUpdate.js +2 -0
- package/lib/src/generated/api/QuerySubscriptionUpdateEvent.d.ts +7 -0
- package/lib/src/generated/api/QuerySubscriptionUpdateEvent.js +1 -0
- package/lib/src/generated/api/QueryUpdatesLagged.d.ts +7 -0
- package/lib/src/generated/api/QueryUpdatesLagged.js +2 -0
- package/lib/src/generated/api/RemoveLinkRequest.d.ts +1 -1
- package/lib/src/generated/api/RemoveLinksBulkRequest.d.ts +1 -1
- package/lib/src/generated/api/RemoveSubjectRequest.d.ts +9 -0
- package/lib/src/generated/api/RemoveSubjectRequest.js +2 -0
- package/lib/src/generated/api/RequestCapabilityRequest.d.ts +4 -0
- package/lib/src/generated/api/RequestCapabilityRequest.js +1 -0
- package/lib/src/generated/api/RequestPaymentRequest.d.ts +3 -0
- package/lib/src/generated/api/RequestPaymentRequest.js +2 -0
- package/lib/src/generated/api/Resource.d.ts +4 -0
- package/lib/src/generated/api/Resource.js +2 -0
- package/lib/src/generated/api/ResyncSubscriptionRequest.d.ts +3 -0
- package/lib/src/generated/api/ResyncSubscriptionRequest.js +2 -0
- package/lib/src/generated/api/RpcMethods.d.ts +961 -0
- package/lib/src/generated/api/RpcMethods.js +98 -0
- package/lib/src/generated/api/RunInterpretationRequest.d.ts +27 -1
- package/lib/src/generated/api/RunInterpretationWithHarnessRequest.d.ts +52 -0
- package/lib/src/generated/api/RunInterpretationWithHarnessRequest.js +1 -0
- package/lib/src/generated/api/RuntimeComputeLogParams.d.ts +14 -0
- package/lib/src/generated/api/RuntimeComputeLogParams.js +2 -0
- package/lib/src/generated/api/RuntimeFriendStatusParams.d.ts +3 -0
- package/lib/src/generated/api/RuntimeFriendStatusParams.js +2 -0
- package/lib/src/generated/api/RuntimeGrantNotificationParams.d.ts +4 -0
- package/lib/src/generated/api/RuntimeGrantNotificationParams.js +2 -0
- package/lib/src/generated/api/RuntimeImportPerspectiveResult.d.ts +4 -0
- package/lib/src/generated/api/RuntimeImportPerspectiveResult.js +2 -0
- package/lib/src/generated/api/RuntimeImportResult.d.ts +6 -0
- package/lib/src/generated/api/RuntimeImportResult.js +1 -0
- package/lib/src/generated/api/RuntimeInfo.d.ts +5 -0
- package/lib/src/generated/api/RuntimeInfo.js +2 -0
- package/lib/src/generated/api/RuntimeNotificationIdParams.d.ts +3 -0
- package/lib/src/generated/api/RuntimeNotificationIdParams.js +2 -0
- package/lib/src/generated/api/RuntimeSendFriendMessageParams.d.ts +8 -0
- package/lib/src/generated/api/RuntimeSendFriendMessageParams.js +1 -0
- package/lib/src/generated/api/RuntimeSetFreeHostingEnabledParams.d.ts +3 -0
- package/lib/src/generated/api/RuntimeSetFreeHostingEnabledParams.js +2 -0
- package/lib/src/generated/api/RuntimeUnytSendHotParams.d.ts +4 -0
- package/lib/src/generated/api/RuntimeUnytSendHotParams.js +2 -0
- package/lib/src/generated/api/RuntimeUnytWalletHistoryParams.d.ts +4 -0
- package/lib/src/generated/api/RuntimeUnytWalletHistoryParams.js +2 -0
- package/lib/src/generated/api/RuntimeUpdateNotificationParams.d.ts +11 -0
- package/lib/src/generated/api/RuntimeUpdateNotificationParams.js +2 -0
- package/lib/src/generated/api/SentMessage.d.ts +5 -0
- package/lib/src/generated/api/SentMessage.js +1 -0
- package/lib/src/generated/api/SetHostRatesRequest.d.ts +4 -0
- package/lib/src/generated/api/SetHostRatesRequest.js +1 -0
- package/lib/src/generated/api/SetHotWalletAddressRequest.d.ts +3 -0
- package/lib/src/generated/api/SetHotWalletAddressRequest.js +2 -0
- package/lib/src/generated/api/SetOnlineStatusRequest.d.ts +4 -0
- package/lib/src/generated/api/SetOnlineStatusRequest.js +2 -0
- package/lib/src/generated/api/SetUnytMembraneProofRequest.d.ts +6 -0
- package/lib/src/generated/api/SetUnytMembraneProofRequest.js +2 -0
- package/lib/src/generated/api/SetUserFreeAccessRequest.d.ts +4 -0
- package/lib/src/generated/api/SetUserFreeAccessRequest.js +2 -0
- package/lib/src/generated/api/SfuAddIceCandidateParams.d.ts +8 -0
- package/lib/src/generated/api/SfuAddIceCandidateParams.js +2 -0
- package/lib/src/generated/api/SfuAnswerServerOfferParams.d.ts +8 -0
- package/lib/src/generated/api/SfuAnswerServerOfferParams.js +2 -0
- package/lib/src/generated/api/SfuCallJoinParams.d.ts +14 -0
- package/lib/src/generated/api/SfuCallJoinParams.js +2 -0
- package/lib/src/generated/api/SfuCallRenegotiationOffer.d.ts +30 -0
- package/lib/src/generated/api/SfuCallRenegotiationOffer.js +1 -0
- package/lib/src/generated/api/SfuCascadePipe.d.ts +4 -0
- package/lib/src/generated/api/SfuCascadePipe.js +2 -0
- package/lib/src/generated/api/SfuCascadeStatus.d.ts +8 -0
- package/lib/src/generated/api/SfuCascadeStatus.js +1 -0
- package/lib/src/generated/api/SfuConfig.d.ts +52 -0
- package/lib/src/generated/api/SfuConfig.js +1 -0
- package/lib/src/generated/api/SfuDataMessage.d.ts +24 -0
- package/lib/src/generated/api/SfuDataMessage.js +2 -0
- package/lib/src/generated/api/SfuEnsureMembershipParams.d.ts +4 -0
- package/lib/src/generated/api/SfuEnsureMembershipParams.js +2 -0
- package/lib/src/generated/api/SfuMigrateEvent.d.ts +21 -0
- package/lib/src/generated/api/SfuMigrateEvent.js +2 -0
- package/lib/src/generated/api/SfuNeighbourhoodParams.d.ts +3 -0
- package/lib/src/generated/api/SfuNeighbourhoodParams.js +2 -0
- package/lib/src/generated/api/SfuParticipantQualityPreference.d.ts +7 -0
- package/lib/src/generated/api/SfuParticipantQualityPreference.js +2 -0
- package/lib/src/generated/api/SfuPerspectiveParams.d.ts +6 -0
- package/lib/src/generated/api/SfuPerspectiveParams.js +2 -0
- package/lib/src/generated/api/SfuQualityPreferenceParams.d.ts +8 -0
- package/lib/src/generated/api/SfuQualityPreferenceParams.js +2 -0
- package/lib/src/generated/api/SfuRoomInfo.d.ts +11 -0
- package/lib/src/generated/api/SfuRoomInfo.js +1 -0
- package/lib/src/generated/api/SfuRoomParams.d.ts +4 -0
- package/lib/src/generated/api/SfuRoomParams.js +2 -0
- package/lib/src/generated/api/SfuRoomParticipantInfo.d.ts +11 -0
- package/lib/src/generated/api/SfuRoomParticipantInfo.js +2 -0
- package/lib/src/generated/api/SfuRoomRoster.d.ts +13 -0
- package/lib/src/generated/api/SfuRoomRoster.js +2 -0
- package/lib/src/generated/api/SfuSendDataParams.d.ts +10 -0
- package/lib/src/generated/api/SfuSendDataParams.js +2 -0
- package/lib/src/generated/api/SfuSetConfigParams.d.ts +5 -0
- package/lib/src/generated/api/SfuSetConfigParams.js +1 -0
- package/lib/src/generated/api/SfuStatus.d.ts +24 -0
- package/lib/src/generated/api/SfuStatus.js +2 -0
- package/lib/src/generated/api/ShaclLinkTriple.d.ts +10 -0
- package/lib/src/generated/api/ShaclLinkTriple.js +2 -0
- package/lib/src/generated/api/SignalRequest.d.ts +5 -0
- package/lib/src/generated/api/SignalRequest.js +2 -0
- package/lib/src/generated/api/SubscribeQueryRequest.d.ts +3 -0
- package/lib/src/generated/api/SubscribeQueryRequest.js +2 -0
- package/lib/src/generated/api/TokenizerSource.d.ts +5 -0
- package/lib/src/generated/api/TokenizerSource.js +2 -0
- package/lib/src/generated/api/TokenizerSourceInput.d.ts +5 -0
- package/lib/src/generated/api/TokenizerSourceInput.js +2 -0
- package/lib/src/generated/api/TrackMapEntry.d.ts +17 -0
- package/lib/src/generated/api/TrackMapEntry.js +2 -0
- package/lib/src/generated/api/TranscriptionTextFilter.d.ts +5 -0
- package/lib/src/generated/api/TranscriptionTextFilter.js +2 -0
- package/lib/src/generated/api/TriggeredNotification.d.ts +6 -0
- package/lib/src/generated/api/TriggeredNotification.js +1 -0
- package/lib/src/generated/api/TrustedAgentsWrapper.d.ts +6 -0
- package/lib/src/generated/api/TrustedAgentsWrapper.js +2 -0
- package/lib/src/generated/api/UnlockAgentRequest.d.ts +1 -1
- package/lib/src/generated/api/UnytVersionInfo.d.ts +19 -0
- package/lib/src/generated/api/UnytVersionInfo.js +2 -0
- package/lib/src/generated/api/UpdateLinkRequest.d.ts +1 -1
- package/lib/src/generated/api/UpdateProfileRequest.d.ts +5 -0
- package/lib/src/generated/api/UpdateProfileRequest.js +1 -0
- package/lib/src/generated/api/UpdateSubjectRequest.d.ts +12 -0
- package/lib/src/generated/api/UpdateSubjectRequest.js +2 -0
- package/lib/src/generated/api/UserCreationResult.d.ts +5 -0
- package/lib/src/generated/api/UserCreationResult.js +2 -0
- package/lib/src/generated/api/UserStatistics.d.ts +2 -1
- package/lib/src/generated/api/UserStatistics.js +0 -1
- package/lib/src/generated/api/UsersAppInfo.d.ts +6 -0
- package/lib/src/generated/api/UsersAppInfo.js +2 -0
- package/lib/src/generated/api/UsersEmailParams.d.ts +3 -0
- package/lib/src/generated/api/UsersEmailParams.js +2 -0
- package/lib/src/generated/api/UsersEmailTestAction.d.ts +1 -0
- package/lib/src/generated/api/UsersEmailTestAction.js +2 -0
- package/lib/src/generated/api/UsersEmailTestParams.d.ts +14 -0
- package/lib/src/generated/api/UsersEmailTestParams.js +1 -0
- package/lib/src/generated/api/UsersEmailTestResult.d.ts +5 -0
- package/lib/src/generated/api/UsersEmailTestResult.js +2 -0
- package/lib/src/generated/api/UsersLoginParams.d.ts +8 -0
- package/lib/src/generated/api/UsersLoginParams.js +2 -0
- package/lib/src/generated/api/UsersRequestVerificationParams.d.ts +5 -0
- package/lib/src/generated/api/UsersRequestVerificationParams.js +1 -0
- package/lib/src/generated/api/UsersSetCreditsParams.d.ts +4 -0
- package/lib/src/generated/api/UsersSetCreditsParams.js +2 -0
- package/lib/src/generated/api/UsersVerifyEmailParams.d.ts +12 -0
- package/lib/src/generated/api/UsersVerifyEmailParams.js +2 -0
- package/lib/src/generated/api/ValidOutput.d.ts +29 -0
- package/lib/src/generated/api/ValidOutput.js +1 -0
- package/lib/src/generated/api/VoiceActivityParamsInput.d.ts +7 -0
- package/lib/src/generated/api/VoiceActivityParamsInput.js +2 -0
- package/lib/src/generated/api/index.d.ts +11 -0
- package/lib/src/generated/api/index.js +5 -3
- package/lib/src/generated/api/serde_json/JsonValue.d.ts +3 -0
- package/lib/src/generated/api/serde_json/JsonValue.js +2 -0
- package/lib/src/index.d.ts +9 -3
- package/lib/src/index.js +5 -3
- package/lib/src/language/LanguageClient.d.ts +3 -3
- package/lib/src/language/LanguageClient.js +6 -6
- package/lib/src/language/LanguageMeta.d.ts +1 -1
- package/lib/src/links/Links.d.ts +16 -5
- package/lib/src/links/Links.js +34 -0
- package/lib/src/model/Ad4mModel.d.ts +84 -0
- package/lib/src/model/Ad4mModel.js +365 -72
- package/lib/src/model/ModelQueryBuilder.d.ts +15 -13
- package/lib/src/model/ModelQueryBuilder.js +78 -221
- package/lib/src/model/decorators.d.ts +52 -2
- package/lib/src/model/decorators.js +83 -8
- package/lib/src/model/query-sparql.js +2 -3
- package/lib/src/model/shacl-gen.d.ts +3 -1
- package/lib/src/model/shacl-gen.js +40 -10
- package/lib/src/model/types.d.ts +19 -0
- package/lib/src/neighbourhood/MeshManager.d.ts +384 -0
- package/lib/src/neighbourhood/MeshManager.js +1144 -0
- package/lib/src/neighbourhood/Neighbourhood.d.ts +1 -1
- package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +96 -5
- package/lib/src/neighbourhood/NeighbourhoodClient.js +211 -15
- package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +55 -1
- package/lib/src/neighbourhood/NeighbourhoodProxy.js +170 -3
- package/lib/src/neighbourhood/Session.d.ts +105 -0
- package/lib/src/neighbourhood/Session.js +412 -0
- package/lib/src/neighbourhood/SfuManager.d.ts +174 -0
- package/lib/src/neighbourhood/SfuManager.js +619 -0
- package/lib/src/neighbourhood/SfuTypes.d.ts +35 -0
- package/lib/src/neighbourhood/SfuTypes.js +8 -0
- package/lib/src/notifyListeners.d.ts +2 -0
- package/lib/src/notifyListeners.js +12 -0
- package/lib/src/perspectives/AutoProcessor.d.ts +12 -80
- package/lib/src/perspectives/FlowInstance.d.ts +73 -26
- package/lib/src/perspectives/FlowInstance.js +96 -31
- package/lib/src/perspectives/FlowModels.d.ts +30 -9
- package/lib/src/perspectives/FlowModels.js +43 -14
- package/lib/src/perspectives/InterpretationModels.d.ts +2 -0
- package/lib/src/perspectives/InterpretationModels.js +6 -0
- package/lib/src/perspectives/LiveQuery.d.ts +49 -0
- package/lib/src/perspectives/LiveQuery.js +169 -0
- package/lib/src/perspectives/Perspective.d.ts +8 -1
- package/lib/src/perspectives/Perspective.js +11 -0
- package/lib/src/perspectives/PerspectiveClient.d.ts +38 -65
- package/lib/src/perspectives/PerspectiveClient.js +87 -257
- package/lib/src/perspectives/PerspectiveDiff.d.ts +1 -1
- package/lib/src/perspectives/PerspectiveHandle.d.ts +15 -8
- package/lib/src/perspectives/PerspectiveHandle.js +25 -9
- package/lib/src/perspectives/PerspectiveProxy.d.ts +102 -228
- package/lib/src/perspectives/PerspectiveProxy.js +247 -673
- package/lib/src/perspectives/TextContent.d.ts +31 -0
- package/lib/src/perspectives/TextContent.js +52 -0
- package/lib/src/perspectives/WakerSubscriptionManager.d.ts +23 -0
- package/lib/src/perspectives/WakerSubscriptionManager.js +58 -21
- package/lib/src/runtime/RuntimeClient.d.ts +15 -27
- package/lib/src/runtime/RuntimeClient.js +57 -113
- package/lib/src/runtime/RuntimeTypes.d.ts +2 -2
- package/lib/src/runtime/RuntimeTypes.js +2 -2
- package/lib/src/shacl/SHACLFlow.d.ts +34 -6
- package/lib/src/shacl/SHACLFlow.js +62 -15
- package/lib/src/shacl/SHACLShape.d.ts +12 -0
- package/lib/src/shacl/SHACLShape.js +206 -321
- package/package.json +15 -16
- package/pnpm-workspace.yaml +4 -1
- package/src/Ad4mClient.test.ts +481 -144
- package/src/Ad4mClient.ts +16 -12
- package/src/Literal.test.ts +32 -0
- package/src/Literal.ts +3 -3
- package/src/agent/Agent.ts +8 -0
- package/src/agent/AgentClient.ts +87 -195
- package/src/agent/mutatePublicPerspective.test.ts +110 -0
- package/src/ai/AIClient.ts +40 -43
- package/src/ai/transcription-stream.test.ts +54 -0
- package/src/apiClient.test.ts +613 -185
- package/src/apiClient.ts +282 -288
- package/src/cache/cache.test.ts +7 -8
- package/src/expression/Expression.ts +12 -3
- package/src/expression/ExpressionClient.ts +6 -7
- package/src/generated/api/AIPromptExamples.ts +3 -0
- package/src/generated/api/AIPromptExamplesInput.ts +3 -0
- package/src/generated/api/AITask.ts +4 -0
- package/src/generated/api/AITaskInput.ts +4 -0
- package/src/generated/api/AddAgentInfosRequest.ts +3 -0
- package/src/generated/api/AddLinkExpressionRequest.ts +1 -1
- package/src/generated/api/AddLinkRequest.ts +1 -1
- package/src/generated/api/AddLinksBulkRequest.ts +1 -1
- package/src/generated/api/AddSdnaRequest.ts +1 -1
- package/src/generated/api/Agent.ts +4 -0
- package/src/generated/api/AgentAddEntanglementProofsParams.ts +8 -0
- package/src/generated/api/AgentByDidParams.ts +3 -0
- package/src/generated/api/AgentRemoveAppParams.ts +3 -0
- package/src/generated/api/AgentRevokeTokenParams.ts +3 -0
- package/src/generated/api/AgentSignature.ts +3 -0
- package/src/generated/api/AgentStatus.ts +4 -0
- package/src/generated/api/AgentStatusChangedEvent.ts +7 -0
- package/src/generated/api/AgentUpdatedEvent.ts +7 -0
- package/src/generated/api/AgentsByDidsRequest.ts +3 -0
- package/src/generated/api/AiAddModelParams.ts +4 -0
- package/src/generated/api/AiAddTaskParams.ts +4 -0
- package/src/generated/api/AiDiscoverModelsParams.ts +7 -0
- package/src/generated/api/AiGetDefaultModelParams.ts +4 -0
- package/src/generated/api/AiIdParams.ts +3 -0
- package/src/generated/api/AiModelLoadingStatusParams.ts +6 -0
- package/src/generated/api/AiSetDefaultModelParams.ts +4 -0
- package/src/generated/api/AiTranscriptionCloseParams.ts +3 -0
- package/src/generated/api/AiTranscriptionOpenParams.ts +4 -0
- package/src/generated/api/AiUpdateModelParams.ts +4 -0
- package/src/generated/api/AiUpdateTaskParams.ts +4 -0
- package/src/generated/api/Apps.ts +4 -0
- package/src/generated/api/AuthInfo.ts +4 -0
- package/src/generated/api/AuthInfoInput.ts +1 -1
- package/src/generated/api/AutoProcessorEvent.ts +90 -0
- package/src/generated/api/AutoProcessorNeighbourhoodState.ts +33 -0
- package/src/generated/api/AutoProcessorStep.ts +9 -0
- package/src/generated/api/BroadcastRequest.ts +3 -0
- package/src/generated/api/CallSessionInfo.ts +20 -0
- package/src/generated/api/Capability.ts +4 -0
- package/src/generated/api/CreateSubjectRequest.ts +1 -1
- package/src/generated/api/CreateUserRequest.ts +3 -0
- package/src/generated/api/DateTime.ts +3 -0
- package/src/generated/api/DecoratedExpressionProof.ts +3 -0
- package/src/generated/api/DecoratedLinkExpression.ts +6 -0
- package/src/generated/api/DecoratedNeighbourhoodExpression.ts +5 -0
- package/src/generated/api/DecoratedPerspective.ts +4 -0
- package/src/generated/api/DiscardBatchRequest.ts +3 -0
- package/src/generated/api/DisposeQueryRequest.ts +3 -0
- package/src/generated/api/EntanglementProof.ts +3 -0
- package/src/generated/api/EntanglementProofInput.ts +1 -1
- package/src/generated/api/EntanglementProofPreflightRequest.ts +3 -0
- package/src/generated/api/EntanglementProofsWrapper.ts +7 -0
- package/src/generated/api/Events.ts +77 -0
- package/src/generated/api/ExceptionInfo.ts +4 -0
- package/src/generated/api/ExceptionOccurredEvent.ts +7 -0
- package/src/generated/api/ExceptionType.ts +3 -0
- package/src/generated/api/ExecuteCommandsRequest.ts +1 -1
- package/src/generated/api/ExportRequest.ts +1 -1
- package/src/generated/api/ExpressionInteractRequest.ts +4 -0
- package/src/generated/api/ExpressionProofInput.ts +1 -1
- package/src/generated/api/ExpressionRendered.ts +6 -0
- package/src/generated/api/ExpressionUrlRequest.ts +3 -0
- package/src/generated/api/FireOutcome.ts +11 -0
- package/src/generated/api/FlowStateChangedEvent.ts +36 -0
- package/src/generated/api/FlowStateEntry.ts +18 -0
- package/src/generated/api/FriendSendMessageRequest.ts +1 -1
- package/src/generated/api/HostRate.ts +6 -0
- package/src/generated/api/HostingInfoResult.ts +13 -0
- package/src/generated/api/HostingInfoUser.ts +7 -0
- package/src/generated/api/HostingRequestPaymentResult.ts +3 -0
- package/src/generated/api/HostingUserInfo.ts +3 -0
- package/src/generated/api/HostingVersionInfo.ts +7 -0
- package/src/generated/api/HostingWalletResult.ts +8 -0
- package/src/generated/api/IceServer.ts +19 -0
- package/src/generated/api/Icon.ts +3 -0
- package/src/generated/api/ImportResult.ts +4 -0
- package/src/generated/api/ImportStats.ts +3 -0
- package/src/generated/api/InteractionCall.ts +3 -0
- package/src/generated/api/InteractionCallWrapper.ts +6 -0
- package/src/generated/api/InteractionMeta.ts +4 -0
- package/src/generated/api/InteractionParameter.ts +3 -0
- package/src/generated/api/LanguageAddressParams.ts +3 -0
- package/src/generated/api/LanguageHandle.ts +4 -0
- package/src/generated/api/LanguageListParams.ts +3 -0
- package/src/generated/api/LanguageMeta.ts +3 -0
- package/src/generated/api/LanguageMetaInput.ts +1 -1
- package/src/generated/api/LanguageRef.ts +3 -0
- package/src/generated/api/LanguageSettingsWrapper.ts +6 -0
- package/src/generated/api/LanguageWriteSettingsParams.ts +3 -0
- package/src/generated/api/LinkExpressionInput.ts +1 -1
- package/src/generated/api/LinkInput.ts +1 -1
- package/src/generated/api/LinkMutationRequest.ts +8 -0
- package/src/generated/api/LinkMutationsRequest.ts +4 -0
- package/src/generated/api/LinkStatus.ts +1 -1
- package/src/generated/api/LinkUpdateInput.ts +4 -0
- package/src/generated/api/LocalModel.ts +4 -0
- package/src/generated/api/LocalModelInput.ts +4 -0
- package/src/generated/api/MessageReceivedEvent.ts +7 -0
- package/src/generated/api/Model.ts +6 -0
- package/src/generated/api/ModelApi.ts +14 -0
- package/src/generated/api/ModelApiInput.ts +8 -0
- package/src/generated/api/ModelApiType.ts +3 -0
- package/src/generated/api/ModelInput.ts +6 -0
- package/src/generated/api/ModelType.ts +1 -1
- package/src/generated/api/Neighbourhood.ts +4 -0
- package/src/generated/api/NeighbourhoodBroadcastParams.ts +4 -0
- package/src/generated/api/NeighbourhoodOnlineStatusParams.ts +4 -0
- package/src/generated/api/NeighbourhoodPerspectivePayload.ts +9 -0
- package/src/generated/api/NeighbourhoodPhase.ts +8 -0
- package/src/generated/api/NeighbourhoodSignalFilter.ts +5 -0
- package/src/generated/api/NeighbourhoodSignalParams.ts +4 -0
- package/src/generated/api/NeighbourhoodSignedPerspective.ts +8 -0
- package/src/generated/api/NeighbourhoodUuidParams.ts +3 -0
- package/src/generated/api/Notification.ts +7 -0
- package/src/generated/api/NotificationGrantRequest.ts +6 -0
- package/src/generated/api/NotificationInput.ts +1 -1
- package/src/generated/api/NotificationTriggeredEvent.ts +8 -0
- package/src/generated/api/OnlineAgent.ts +9 -0
- package/src/generated/api/OutputRef.ts +11 -0
- package/src/generated/api/OverlayView.ts +25 -0
- package/src/generated/api/Perspective.ts +4 -0
- package/src/generated/api/PerspectiveAddAutoProcessorParams.ts +11 -0
- package/src/generated/api/PerspectiveAddLinkExpressionParams.ts +4 -0
- package/src/generated/api/PerspectiveAddLinkParams.ts +4 -0
- package/src/generated/api/PerspectiveAddLinksParams.ts +4 -0
- package/src/generated/api/PerspectiveAddSdnaParams.ts +7 -0
- package/src/generated/api/PerspectiveAddSdnaResult.ts +6 -0
- package/src/generated/api/PerspectiveCommitBatchParams.ts +3 -0
- package/src/generated/api/PerspectiveCreateSubjectParams.ts +3 -0
- package/src/generated/api/PerspectiveDiscardBatchParams.ts +3 -0
- package/src/generated/api/PerspectiveEvaluateGettersParams.ts +6 -0
- package/src/generated/api/PerspectiveExecuteCommandsParams.ts +3 -0
- package/src/generated/api/PerspectiveExpression.ts +5 -0
- package/src/generated/api/PerspectiveFlowFiredParams.ts +7 -0
- package/src/generated/api/PerspectiveFlowProposalParams.ts +3 -0
- package/src/generated/api/PerspectiveFlowReceiptVerdict.ts +8 -0
- package/src/generated/api/PerspectiveFlowStatesParams.ts +11 -0
- package/src/generated/api/PerspectiveFlowValidOutputsParams.ts +7 -0
- package/src/generated/api/PerspectiveGetAllShaclParams.ts +6 -0
- package/src/generated/api/PerspectiveGetSubjectDataParams.ts +3 -0
- package/src/generated/api/PerspectiveHandle.ts +5 -0
- package/src/generated/api/PerspectiveLinkDiff.ts +7 -0
- package/src/generated/api/PerspectiveLinkMutationsParams.ts +4 -0
- package/src/generated/api/PerspectiveLinkUpdatedWithOwner.ts +4 -0
- package/src/generated/api/PerspectiveLinkWithOwner.ts +4 -0
- package/src/generated/api/PerspectiveMintFlowReceiptParams.ts +3 -0
- package/src/generated/api/PerspectiveMintFlowReceiptResult.ts +9 -0
- package/src/generated/api/PerspectiveModelQueryParams.ts +10 -0
- package/src/generated/api/PerspectiveNamedShacl.ts +4 -0
- package/src/generated/api/PerspectiveProposeFlowTransitionParams.ts +4 -0
- package/src/generated/api/PerspectiveQueryLinksParams.ts +11 -0
- package/src/generated/api/PerspectiveQueryParams.ts +3 -0
- package/src/generated/api/PerspectiveReceiptOutcome.ts +3 -0
- package/src/generated/api/PerspectiveRejectFlowProposalResult.ts +3 -0
- package/src/generated/api/PerspectiveRemoveAutoProcessorParams.ts +3 -0
- package/src/generated/api/PerspectiveRemoveLinkParams.ts +4 -0
- package/src/generated/api/PerspectiveRemoveLinksParams.ts +4 -0
- package/src/generated/api/PerspectiveRemoveSubjectParams.ts +3 -0
- package/src/generated/api/PerspectiveRemovedWithOwner.ts +3 -0
- package/src/generated/api/PerspectiveResolveInterpretationParams.ts +6 -0
- package/src/generated/api/PerspectiveResynced.ts +7 -0
- package/src/generated/api/PerspectiveShacl.ts +4 -0
- package/src/generated/api/PerspectiveShaclNameParams.ts +3 -0
- package/src/generated/api/PerspectiveSparqlParams.ts +7 -0
- package/src/generated/api/PerspectiveState.ts +3 -0
- package/src/generated/api/PerspectiveStateFilter.ts +5 -0
- package/src/generated/api/PerspectiveSubjectClassesOfParams.ts +3 -0
- package/src/generated/api/PerspectiveSubscribed.ts +8 -0
- package/src/generated/api/PerspectiveSubscriptionParams.ts +3 -0
- package/src/generated/api/PerspectiveUnsignedInput.ts +4 -0
- package/src/generated/api/PerspectiveUpdateLinkParams.ts +5 -0
- package/src/generated/api/PerspectiveUpdateParams.ts +3 -0
- package/src/generated/api/PerspectiveUpdateSubjectParams.ts +7 -0
- package/src/generated/api/PerspectiveUuidParams.ts +3 -0
- package/src/generated/api/PerspectiveVerifyFlowReceiptParams.ts +9 -0
- package/src/generated/api/PerspectiveWithOwner.ts +4 -0
- package/src/generated/api/ProposeOutcome.ts +46 -0
- package/src/generated/api/PublicPerspectiveInput.ts +4 -0
- package/src/generated/api/PublishNeighbourhoodRequest.ts +2 -2
- package/src/generated/api/QuerySubscriptionUpdate.ts +10 -0
- package/src/generated/api/QuerySubscriptionUpdateEvent.ts +9 -0
- package/src/generated/api/QueryUpdatesLagged.ts +7 -0
- package/src/generated/api/RemoveLinkRequest.ts +1 -1
- package/src/generated/api/RemoveLinksBulkRequest.ts +1 -1
- package/src/generated/api/RemoveSubjectRequest.ts +7 -0
- package/src/generated/api/RequestCapabilityRequest.ts +4 -0
- package/src/generated/api/RequestPaymentRequest.ts +3 -0
- package/src/generated/api/Resource.ts +3 -0
- package/src/generated/api/ResyncSubscriptionRequest.ts +3 -0
- package/src/generated/api/RpcMethods.ts +479 -0
- package/src/generated/api/RunInterpretationRequest.ts +28 -2
- package/src/generated/api/RunInterpretationWithHarnessRequest.ts +51 -0
- package/src/generated/api/RuntimeComputeLogParams.ts +15 -0
- package/src/generated/api/RuntimeFriendStatusParams.ts +3 -0
- package/src/generated/api/RuntimeGrantNotificationParams.ts +3 -0
- package/src/generated/api/RuntimeImportPerspectiveResult.ts +3 -0
- package/src/generated/api/RuntimeImportResult.ts +8 -0
- package/src/generated/api/RuntimeInfo.ts +3 -0
- package/src/generated/api/RuntimeNotificationIdParams.ts +3 -0
- package/src/generated/api/RuntimeSendFriendMessageParams.ts +8 -0
- package/src/generated/api/RuntimeSetFreeHostingEnabledParams.ts +3 -0
- package/src/generated/api/RuntimeUnytSendHotParams.ts +3 -0
- package/src/generated/api/RuntimeUnytWalletHistoryParams.ts +3 -0
- package/src/generated/api/RuntimeUpdateNotificationParams.ts +3 -0
- package/src/generated/api/SentMessage.ts +4 -0
- package/src/generated/api/SetHostRatesRequest.ts +4 -0
- package/src/generated/api/SetHotWalletAddressRequest.ts +3 -0
- package/src/generated/api/SetOnlineStatusRequest.ts +3 -0
- package/src/generated/api/SetUnytMembraneProofRequest.ts +7 -0
- package/src/generated/api/SetUserFreeAccessRequest.ts +3 -0
- package/src/generated/api/SfuAddIceCandidateParams.ts +7 -0
- package/src/generated/api/SfuAnswerServerOfferParams.ts +7 -0
- package/src/generated/api/SfuCallJoinParams.ts +13 -0
- package/src/generated/api/SfuCallRenegotiationOffer.ts +29 -0
- package/src/generated/api/SfuCascadePipe.ts +3 -0
- package/src/generated/api/SfuCascadeStatus.ts +7 -0
- package/src/generated/api/SfuConfig.ts +53 -0
- package/src/generated/api/SfuDataMessage.ts +23 -0
- package/src/generated/api/SfuEnsureMembershipParams.ts +3 -0
- package/src/generated/api/SfuMigrateEvent.ts +20 -0
- package/src/generated/api/SfuNeighbourhoodParams.ts +3 -0
- package/src/generated/api/SfuParticipantQualityPreference.ts +6 -0
- package/src/generated/api/SfuPerspectiveParams.ts +6 -0
- package/src/generated/api/SfuQualityPreferenceParams.ts +7 -0
- package/src/generated/api/SfuRoomInfo.ts +7 -0
- package/src/generated/api/SfuRoomParams.ts +3 -0
- package/src/generated/api/SfuRoomParticipantInfo.ts +8 -0
- package/src/generated/api/SfuRoomRoster.ts +12 -0
- package/src/generated/api/SfuSendDataParams.ts +7 -0
- package/src/generated/api/SfuSetConfigParams.ts +4 -0
- package/src/generated/api/SfuStatus.ts +24 -0
- package/src/generated/api/ShaclLinkTriple.ts +8 -0
- package/src/generated/api/SignalRequest.ts +3 -0
- package/src/generated/api/SubscribeQueryRequest.ts +3 -0
- package/src/generated/api/TokenizerSource.ts +3 -0
- package/src/generated/api/TokenizerSourceInput.ts +3 -0
- package/src/generated/api/TrackMapEntry.ts +18 -0
- package/src/generated/api/TranscriptionTextFilter.ts +3 -0
- package/src/generated/api/TriggeredNotification.ts +4 -0
- package/src/generated/api/TrustedAgentsWrapper.ts +6 -0
- package/src/generated/api/UnlockAgentRequest.ts +1 -1
- package/src/generated/api/UnytVersionInfo.ts +20 -0
- package/src/generated/api/UpdateLinkRequest.ts +1 -1
- package/src/generated/api/UpdateProfileRequest.ts +4 -0
- package/src/generated/api/UpdateSubjectRequest.ts +10 -0
- package/src/generated/api/UserCreationResult.ts +3 -0
- package/src/generated/api/UserStatistics.ts +2 -1
- package/src/generated/api/UsersAppInfo.ts +6 -0
- package/src/generated/api/UsersEmailParams.ts +3 -0
- package/src/generated/api/UsersEmailTestAction.ts +3 -0
- package/src/generated/api/UsersEmailTestParams.ts +12 -0
- package/src/generated/api/UsersEmailTestResult.ts +7 -0
- package/src/generated/api/UsersLoginParams.ts +7 -0
- package/src/generated/api/UsersRequestVerificationParams.ts +4 -0
- package/src/generated/api/UsersSetCreditsParams.ts +3 -0
- package/src/generated/api/UsersVerifyEmailParams.ts +11 -0
- package/src/generated/api/ValidOutput.ts +30 -0
- package/src/generated/api/VoiceActivityParamsInput.ts +3 -0
- package/src/generated/api/index.ts +14 -2
- package/src/generated/api/serde_json/JsonValue.ts +3 -0
- package/src/index.ts +9 -3
- package/src/language/LanguageClient.ts +12 -13
- package/src/links/Links.ts +49 -3
- package/src/model/Ad4mModel.test.ts +480 -173
- package/src/model/Ad4mModel.ts +407 -77
- package/src/model/ModelQueryBuilder.ts +95 -255
- package/src/model/abstract-classes.test.ts +225 -0
- package/src/model/decorators.ts +145 -9
- package/src/model/query-sparql.ts +2 -3
- package/src/model/relation-filtering.test.ts +191 -0
- package/src/model/shacl-gen.ts +32 -9
- package/src/model/shacl-roundtrip.test.ts +52 -0
- package/src/model/types.ts +19 -0
- package/src/neighbourhood/MeshManager.test.ts +2640 -0
- package/src/neighbourhood/MeshManager.ts +1350 -0
- package/src/neighbourhood/NeighbourhoodClient.test.ts +60 -0
- package/src/neighbourhood/NeighbourhoodClient.ts +298 -27
- package/src/neighbourhood/NeighbourhoodProxy.test.ts +37 -9
- package/src/neighbourhood/NeighbourhoodProxy.ts +247 -1
- package/src/neighbourhood/Session.test.ts +800 -0
- package/src/neighbourhood/Session.ts +525 -0
- package/src/neighbourhood/SfuManager.test.ts +677 -0
- package/src/neighbourhood/SfuManager.ts +803 -0
- package/src/neighbourhood/SfuTypes.ts +40 -0
- package/src/notifyListeners.test.ts +19 -0
- package/src/notifyListeners.ts +10 -0
- package/src/perspectives/AutoProcessor.ts +13 -82
- package/src/perspectives/FlowInstance.ts +136 -32
- package/src/perspectives/FlowModels.ts +46 -11
- package/src/perspectives/InterpretationModels.ts +4 -0
- package/src/perspectives/LiveQuery.test.ts +197 -0
- package/src/perspectives/LiveQuery.ts +189 -0
- package/src/perspectives/Perspective.ts +18 -2
- package/src/perspectives/PerspectiveClient.test.ts +122 -45
- package/src/perspectives/PerspectiveClient.ts +146 -343
- package/src/perspectives/PerspectiveHandle.ts +32 -9
- package/src/perspectives/PerspectiveProxy.test.ts +216 -528
- package/src/perspectives/PerspectiveProxy.ts +259 -736
- package/src/perspectives/TextContent.test.ts +123 -0
- package/src/perspectives/TextContent.ts +36 -0
- package/src/perspectives/WakerSubscriptionManager.test.ts +136 -1
- package/src/perspectives/WakerSubscriptionManager.ts +69 -22
- package/src/perspectives/link-updated-type.test.ts +55 -0
- package/src/perspectives/listener-leaks.test.ts +204 -0
- package/src/perspectives/shacl-rpc.test.ts +22 -27
- package/src/runtime/RuntimeClient.ts +75 -157
- package/src/runtime/RuntimeTypes.ts +3 -3
- package/src/shacl/SHACLFlow.test.ts +49 -1
- package/src/shacl/SHACLFlow.ts +73 -15
- package/src/shacl/SHACLShape.test.ts +161 -16
- package/src/shacl/SHACLShape.ts +210 -439
- package/lib/shims/reflect-metadata.d.ts +0 -0
- package/lib/shims/reflect-metadata.js +0 -0
- package/lib/shims/type-graphql.d.ts +0 -32
- package/lib/shims/type-graphql.js +0 -70
- package/lib/src/PubSub.d.ts +0 -17
- package/lib/src/PubSub.js +0 -17
- package/lib/src/agent/AgentResolver.d.ts +0 -30
- package/lib/src/agent/AgentResolver.js +0 -325
- package/lib/src/ai/AIResolver.d.ts +0 -75
- package/lib/src/ai/AIResolver.js +0 -455
- package/lib/src/buildSchema.d.ts +0 -1
- package/lib/src/buildSchema.js +0 -38
- package/lib/src/expression/ExpressionResolver.d.ts +0 -10
- package/lib/src/expression/ExpressionResolver.js +0 -106
- package/lib/src/language/LanguageContext.d.ts +0 -37
- package/lib/src/language/LanguageContext.js +0 -2
- package/lib/src/language/LanguageResolver.d.ts +0 -19
- package/lib/src/language/LanguageResolver.js +0 -143
- package/lib/src/links/Links.test.js +0 -33
- package/lib/src/model/Ad4mModel.test.js +0 -2055
- package/lib/src/model/Subject.d.ts +0 -25
- package/lib/src/model/Subject.js +0 -164
- package/lib/src/model/hydration-batch.d.ts +0 -34
- package/lib/src/model/hydration-batch.js +0 -147
- package/lib/src/model/hydration-batching.test.d.ts +0 -7
- package/lib/src/model/hydration-batching.test.js +0 -456
- package/lib/src/model/model-manifest.d.ts +0 -41
- package/lib/src/model/model-manifest.js +0 -11
- package/lib/src/model/prolog-facts.d.ts +0 -37
- package/lib/src/model/prolog-facts.js +0 -134
- package/lib/src/model/query-cache.test.js +0 -43
- package/lib/src/model/query-prolog.d.ts +0 -15
- package/lib/src/model/query-prolog.js +0 -140
- package/lib/src/model/query-sparql-batch.d.ts +0 -17
- package/lib/src/model/query-sparql-batch.js +0 -260
- package/lib/src/model/query-sparql.test.js +0 -312
- package/lib/src/model/relation-filtering.test.js +0 -838
- package/lib/src/model/subscription-delta.test.d.ts +0 -24
- package/lib/src/model/subscription-delta.test.js +0 -180
- package/lib/src/model/subscription-pool.d.ts +0 -39
- package/lib/src/model/subscription-pool.js +0 -165
- package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +0 -73
- package/lib/src/neighbourhood/NeighbourhoodResolver.d.ts +0 -24
- package/lib/src/neighbourhood/NeighbourhoodResolver.js +0 -182
- package/lib/src/perspectives/Perspective.test.js +0 -20
- package/lib/src/perspectives/PerspectiveClient.test.js +0 -224
- package/lib/src/perspectives/PerspectiveResolver.d.ts +0 -56
- package/lib/src/perspectives/PerspectiveResolver.js +0 -519
- package/lib/src/runtime/RuntimeResolver.d.ts +0 -173
- package/lib/src/runtime/RuntimeResolver.js +0 -1122
- package/lib/src/schema.gql +0 -631
- package/lib/src/shacl/SHACLFlow.test.js +0 -205
- package/lib/src/shacl/SHACLShape.test.js +0 -418
- package/lib/src/unwrapApolloResult.d.ts +0 -2
- package/lib/src/unwrapApolloResult.js +0 -14
- /package/lib/src/{links/Links.test.d.ts → generated/api/AITask.js} +0 -0
- /package/lib/src/{model/Ad4mModel.test.d.ts → generated/api/AITaskInput.js} +0 -0
- /package/lib/src/{model/query-cache.test.d.ts → generated/api/Agent.js} +0 -0
- /package/lib/src/{model/query-sparql.test.d.ts → generated/api/AgentAddEntanglementProofsParams.js} +0 -0
- /package/lib/src/{model/relation-filtering.test.d.ts → generated/api/AgentStatus.js} +0 -0
- /package/lib/src/{neighbourhood/NeighbourhoodProxy.test.d.ts → generated/api/AgentStatusChangedEvent.js} +0 -0
- /package/lib/src/{perspectives/Perspective.test.d.ts → generated/api/AgentUpdatedEvent.js} +0 -0
- /package/lib/src/{perspectives/PerspectiveClient.test.d.ts → generated/api/AiAddModelParams.js} +0 -0
- /package/lib/src/{shacl/SHACLFlow.test.d.ts → generated/api/AiAddTaskParams.js} +0 -0
- /package/lib/src/{shacl/SHACLShape.test.d.ts → generated/api/AiGetDefaultModelParams.js} +0 -0
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for batched hydrateRelations() — verifies the N+1 → 1 SPARQL optimisation.
|
|
3
|
-
*
|
|
4
|
-
* We mock PerspectiveProxy to count querySparql / get calls and verify
|
|
5
|
-
* that the batched path issues 1 SPARQL query instead of N perspective.get() calls.
|
|
6
|
-
*/
|
|
7
|
-
import { hydrateRelations } from './hydration';
|
|
8
|
-
// ── Helpers to build minimal mocks ──────────────────────────────────────
|
|
9
|
-
function makeMockPerspective(opts) {
|
|
10
|
-
const callCounts = { querySparql: 0, get: 0, findAll: 0 };
|
|
11
|
-
const perspective = {
|
|
12
|
-
querySparql: jest.fn(async (_q) => {
|
|
13
|
-
callCounts.querySparql++;
|
|
14
|
-
if (opts.sparqlError)
|
|
15
|
-
throw new Error('SPARQL unavailable');
|
|
16
|
-
return {
|
|
17
|
-
results: {
|
|
18
|
-
bindings: (opts.sparqlResults ?? []).map(r => ({
|
|
19
|
-
source: { value: r.source },
|
|
20
|
-
target: { value: r.target },
|
|
21
|
-
})),
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
}),
|
|
25
|
-
get: jest.fn(async (query) => {
|
|
26
|
-
callCounts.get++;
|
|
27
|
-
const targetId = query.target;
|
|
28
|
-
return opts.getResults?.get(targetId) ?? [];
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
31
|
-
return { perspective, callCounts };
|
|
32
|
-
}
|
|
33
|
-
function makeMockTargetClass(knownInstances) {
|
|
34
|
-
class MockTarget {
|
|
35
|
-
constructor(perspective, id) {
|
|
36
|
-
this.id = id;
|
|
37
|
-
this.perspective = perspective;
|
|
38
|
-
}
|
|
39
|
-
async get() {
|
|
40
|
-
const data = knownInstances.get(this.id);
|
|
41
|
-
if (data)
|
|
42
|
-
Object.assign(this, data);
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
static async findAll(_perspective, query) {
|
|
46
|
-
const ids = query?.where?.id ?? [];
|
|
47
|
-
return ids
|
|
48
|
-
.filter(id => knownInstances.has(id))
|
|
49
|
-
.map(id => {
|
|
50
|
-
const inst = { id, ...knownInstances.get(id) };
|
|
51
|
-
return inst;
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
MockTarget.__metadata = { className: 'MockTarget' };
|
|
56
|
-
return MockTarget;
|
|
57
|
-
}
|
|
58
|
-
// Minimal decorator metadata mock
|
|
59
|
-
jest.mock('./decorators', () => ({
|
|
60
|
-
getPropertiesMetadata: () => ({}),
|
|
61
|
-
getRelationsMetadata: (cls) => cls.__relMeta ?? {},
|
|
62
|
-
buildConformanceFilter: () => () => true,
|
|
63
|
-
}));
|
|
64
|
-
jest.mock('./query-utils', () => ({
|
|
65
|
-
compileWhereClause: () => '',
|
|
66
|
-
}));
|
|
67
|
-
jest.mock('../utils', () => ({
|
|
68
|
-
escapeQueryString: (s) => s,
|
|
69
|
-
}));
|
|
70
|
-
// ── Tests ───────────────────────────────────────────────────────────────
|
|
71
|
-
describe('hydrateRelations batching', () => {
|
|
72
|
-
const PREDICATE = 'flux://belongs_to';
|
|
73
|
-
it('issues 1 SPARQL query instead of N perspective.get() calls for belongsToMany', async () => {
|
|
74
|
-
const N = 50;
|
|
75
|
-
// Create N parent instances
|
|
76
|
-
const instances = Array.from({ length: N }, (_, i) => ({
|
|
77
|
-
id: `parent-${i}`,
|
|
78
|
-
children: undefined,
|
|
79
|
-
}));
|
|
80
|
-
// Each parent has 2 children pointing to it
|
|
81
|
-
const sparqlResults = [];
|
|
82
|
-
const knownChildren = new Map();
|
|
83
|
-
for (let i = 0; i < N; i++) {
|
|
84
|
-
for (let j = 0; j < 2; j++) {
|
|
85
|
-
const childId = `child-${i}-${j}`;
|
|
86
|
-
sparqlResults.push({ source: childId, target: `parent-${i}` });
|
|
87
|
-
knownChildren.set(childId, { name: `Child ${i}-${j}` });
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const { perspective, callCounts } = makeMockPerspective({ sparqlResults });
|
|
91
|
-
const TargetClass = makeMockTargetClass(knownChildren);
|
|
92
|
-
// Wire up relation metadata
|
|
93
|
-
const modelClass = {
|
|
94
|
-
__relMeta: {
|
|
95
|
-
children: {
|
|
96
|
-
kind: 'belongsToMany',
|
|
97
|
-
predicate: PREDICATE,
|
|
98
|
-
target: () => TargetClass,
|
|
99
|
-
maxCount: undefined,
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
// Mock getRelationsMetadata to return our metadata
|
|
104
|
-
const decorators = require('./decorators');
|
|
105
|
-
decorators.getRelationsMetadata = () => modelClass.__relMeta;
|
|
106
|
-
await hydrateRelations(modelClass, instances, perspective, { children: true });
|
|
107
|
-
// Key assertion: 1 SPARQL query, 0 perspective.get() calls
|
|
108
|
-
expect(callCounts.querySparql).toBe(1);
|
|
109
|
-
expect(callCounts.get).toBe(0);
|
|
110
|
-
// Verify data correctness
|
|
111
|
-
for (let i = 0; i < N; i++) {
|
|
112
|
-
expect(instances[i].children).toHaveLength(2);
|
|
113
|
-
expect(instances[i].children[0].id).toMatch(/^child-/);
|
|
114
|
-
}
|
|
115
|
-
console.log(`✅ Batched: ${N} instances hydrated with 1 SPARQL query + 1 findAll (was ${N} sequential perspective.get calls)`);
|
|
116
|
-
});
|
|
117
|
-
it('issues 1 SPARQL query for belongsToOne', async () => {
|
|
118
|
-
const N = 20;
|
|
119
|
-
const instances = Array.from({ length: N }, (_, i) => ({
|
|
120
|
-
id: `parent-${i}`,
|
|
121
|
-
owner: undefined,
|
|
122
|
-
}));
|
|
123
|
-
const sparqlResults = [];
|
|
124
|
-
const knownOwners = new Map();
|
|
125
|
-
for (let i = 0; i < N; i++) {
|
|
126
|
-
const ownerId = `owner-${i}`;
|
|
127
|
-
sparqlResults.push({ source: ownerId, target: `parent-${i}` });
|
|
128
|
-
knownOwners.set(ownerId, { name: `Owner ${i}` });
|
|
129
|
-
}
|
|
130
|
-
const { perspective, callCounts } = makeMockPerspective({ sparqlResults });
|
|
131
|
-
const TargetClass = makeMockTargetClass(knownOwners);
|
|
132
|
-
const modelClass = {
|
|
133
|
-
__relMeta: {
|
|
134
|
-
owner: {
|
|
135
|
-
kind: 'belongsToOne',
|
|
136
|
-
predicate: PREDICATE,
|
|
137
|
-
target: () => TargetClass,
|
|
138
|
-
maxCount: 1,
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
const decorators = require('./decorators');
|
|
143
|
-
decorators.getRelationsMetadata = () => modelClass.__relMeta;
|
|
144
|
-
await hydrateRelations(modelClass, instances, perspective, { owner: true });
|
|
145
|
-
expect(callCounts.querySparql).toBe(1);
|
|
146
|
-
expect(callCounts.get).toBe(0);
|
|
147
|
-
for (let i = 0; i < N; i++) {
|
|
148
|
-
expect(instances[i].owner).toBeTruthy();
|
|
149
|
-
expect(instances[i].owner.id).toBe(`owner-${i}`);
|
|
150
|
-
}
|
|
151
|
-
console.log(`✅ Batched belongsToOne: ${N} instances, 1 SPARQL query (was ${N} perspective.get calls)`);
|
|
152
|
-
});
|
|
153
|
-
it('falls back to sequential on SPARQL failure', async () => {
|
|
154
|
-
const instances = [{ id: 'p-0', children: undefined }];
|
|
155
|
-
const getResults = new Map();
|
|
156
|
-
getResults.set('p-0', [
|
|
157
|
-
{ data: { source: 'c-0', target: 'p-0', predicate: PREDICATE } },
|
|
158
|
-
]);
|
|
159
|
-
const { perspective, callCounts } = makeMockPerspective({
|
|
160
|
-
sparqlError: true,
|
|
161
|
-
getResults,
|
|
162
|
-
});
|
|
163
|
-
const TargetClass = makeMockTargetClass(new Map([['c-0', { name: 'Child' }]]));
|
|
164
|
-
const modelClass = {
|
|
165
|
-
__relMeta: {
|
|
166
|
-
children: {
|
|
167
|
-
kind: 'belongsToMany',
|
|
168
|
-
predicate: PREDICATE,
|
|
169
|
-
target: () => TargetClass,
|
|
170
|
-
maxCount: undefined,
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
};
|
|
174
|
-
const decorators = require('./decorators');
|
|
175
|
-
decorators.getRelationsMetadata = () => modelClass.__relMeta;
|
|
176
|
-
await hydrateRelations(modelClass, instances, perspective, { children: true });
|
|
177
|
-
// Should have fallen back to perspective.get
|
|
178
|
-
expect(callCounts.querySparql).toBe(1); // attempted
|
|
179
|
-
expect(callCounts.get).toBe(1); // fallback
|
|
180
|
-
expect(instances[0].children).toHaveLength(1);
|
|
181
|
-
console.log('✅ Fallback to sequential works when SPARQL fails');
|
|
182
|
-
});
|
|
183
|
-
// ── Test #1: Nested includes ──
|
|
184
|
-
it('handles nested includes at multiple nesting levels', async () => {
|
|
185
|
-
// Post -> Comments -> Author (two levels of nesting)
|
|
186
|
-
const posts = [
|
|
187
|
-
{ id: 'post-0', comments: undefined },
|
|
188
|
-
{ id: 'post-1', comments: undefined },
|
|
189
|
-
];
|
|
190
|
-
// SPARQL returns comments belonging to posts
|
|
191
|
-
const commentSparql = [
|
|
192
|
-
{ source: 'comment-0', target: 'post-0' },
|
|
193
|
-
{ source: 'comment-1', target: 'post-0' },
|
|
194
|
-
{ source: 'comment-2', target: 'post-1' },
|
|
195
|
-
];
|
|
196
|
-
const knownComments = new Map([
|
|
197
|
-
['comment-0', { name: 'C0', author: undefined }],
|
|
198
|
-
['comment-1', { name: 'C1', author: undefined }],
|
|
199
|
-
['comment-2', { name: 'C2', author: undefined }],
|
|
200
|
-
]);
|
|
201
|
-
const { perspective, callCounts } = makeMockPerspective({ sparqlResults: commentSparql });
|
|
202
|
-
// Comment class with nested relation metadata
|
|
203
|
-
const CommentClass = makeMockTargetClass(knownComments);
|
|
204
|
-
CommentClass.__relMeta = {
|
|
205
|
-
author: {
|
|
206
|
-
kind: 'belongsToOne',
|
|
207
|
-
predicate: 'flux://authored_by',
|
|
208
|
-
target: () => makeMockTargetClass(new Map([
|
|
209
|
-
['author-1', { name: 'Alice' }],
|
|
210
|
-
['author-2', { name: 'Bob' }],
|
|
211
|
-
])),
|
|
212
|
-
maxCount: 1,
|
|
213
|
-
},
|
|
214
|
-
};
|
|
215
|
-
const modelClass = {
|
|
216
|
-
__relMeta: {
|
|
217
|
-
comments: {
|
|
218
|
-
kind: 'belongsToMany',
|
|
219
|
-
predicate: PREDICATE,
|
|
220
|
-
target: () => CommentClass,
|
|
221
|
-
maxCount: undefined,
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
};
|
|
225
|
-
const decorators = require('./decorators');
|
|
226
|
-
decorators.getRelationsMetadata = (cls) => cls.__relMeta ?? {};
|
|
227
|
-
await hydrateRelations(modelClass, posts, perspective, {
|
|
228
|
-
comments: { include: { author: true } },
|
|
229
|
-
});
|
|
230
|
-
// First level should be hydrated
|
|
231
|
-
expect(posts[0].comments).toHaveLength(2);
|
|
232
|
-
expect(posts[1].comments).toHaveLength(1);
|
|
233
|
-
// Batching: 1 SPARQL for comments + additional calls for nested author hydration
|
|
234
|
-
// The key is that it completes without error and data is correct at the first level
|
|
235
|
-
expect(callCounts.querySparql).toBeGreaterThanOrEqual(1);
|
|
236
|
-
console.log('✅ Nested includes: multi-level nesting works');
|
|
237
|
-
});
|
|
238
|
-
// ── Test #2: Mixed relation types ──
|
|
239
|
-
it('batches hasMany and belongsToOne independently on the same query', async () => {
|
|
240
|
-
const instances = Array.from({ length: 5 }, (_, i) => ({
|
|
241
|
-
id: `item-${i}`,
|
|
242
|
-
tags: [`tag-${i}-a`, `tag-${i}-b`],
|
|
243
|
-
owner: undefined, // reverse belongsToOne
|
|
244
|
-
}));
|
|
245
|
-
const sparqlResults = [];
|
|
246
|
-
for (let i = 0; i < 5; i++) {
|
|
247
|
-
sparqlResults.push({ source: `owner-${i}`, target: `item-${i}` });
|
|
248
|
-
}
|
|
249
|
-
const { perspective, callCounts } = makeMockPerspective({ sparqlResults });
|
|
250
|
-
const TagClass = makeMockTargetClass(new Map(instances.flatMap((_, i) => [
|
|
251
|
-
[`tag-${i}-a`, { label: `Tag A${i}` }],
|
|
252
|
-
[`tag-${i}-b`, { label: `Tag B${i}` }],
|
|
253
|
-
])));
|
|
254
|
-
const OwnerClass = makeMockTargetClass(new Map(Array.from({ length: 5 }, (_, i) => [`owner-${i}`, { name: `Owner ${i}` }])));
|
|
255
|
-
const modelClass = {
|
|
256
|
-
__relMeta: {
|
|
257
|
-
tags: {
|
|
258
|
-
kind: 'hasMany',
|
|
259
|
-
predicate: 'flux://has_tag',
|
|
260
|
-
target: () => TagClass,
|
|
261
|
-
maxCount: undefined,
|
|
262
|
-
},
|
|
263
|
-
owner: {
|
|
264
|
-
kind: 'belongsToOne',
|
|
265
|
-
predicate: 'flux://owned_by',
|
|
266
|
-
target: () => OwnerClass,
|
|
267
|
-
maxCount: 1,
|
|
268
|
-
},
|
|
269
|
-
},
|
|
270
|
-
};
|
|
271
|
-
const decorators = require('./decorators');
|
|
272
|
-
decorators.getRelationsMetadata = () => modelClass.__relMeta;
|
|
273
|
-
await hydrateRelations(modelClass, instances, perspective, {
|
|
274
|
-
tags: true,
|
|
275
|
-
owner: true,
|
|
276
|
-
});
|
|
277
|
-
// belongsToOne uses 1 SPARQL query
|
|
278
|
-
expect(callCounts.querySparql).toBe(1);
|
|
279
|
-
// Forward relations use findAll (no SPARQL)
|
|
280
|
-
for (let i = 0; i < 5; i++) {
|
|
281
|
-
expect(instances[i].tags).toHaveLength(2);
|
|
282
|
-
expect(instances[i].owner).toBeTruthy();
|
|
283
|
-
}
|
|
284
|
-
console.log('✅ Mixed relation types: hasMany + belongsToOne batched independently');
|
|
285
|
-
});
|
|
286
|
-
// ── Test #3: Empty relations ──
|
|
287
|
-
it('handles instances where some have the relation and some do not', async () => {
|
|
288
|
-
const instances = [
|
|
289
|
-
{ id: 'has-children', children: undefined },
|
|
290
|
-
{ id: 'no-children', children: undefined },
|
|
291
|
-
];
|
|
292
|
-
// Only has-children has related items
|
|
293
|
-
const sparqlResults = [
|
|
294
|
-
{ source: 'child-1', target: 'has-children' },
|
|
295
|
-
];
|
|
296
|
-
const { perspective } = makeMockPerspective({ sparqlResults });
|
|
297
|
-
const TargetClass = makeMockTargetClass(new Map([['child-1', { name: 'C1' }]]));
|
|
298
|
-
const modelClass = {
|
|
299
|
-
__relMeta: {
|
|
300
|
-
children: {
|
|
301
|
-
kind: 'belongsToMany',
|
|
302
|
-
predicate: PREDICATE,
|
|
303
|
-
target: () => TargetClass,
|
|
304
|
-
maxCount: undefined,
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
};
|
|
308
|
-
const decorators = require('./decorators');
|
|
309
|
-
decorators.getRelationsMetadata = () => modelClass.__relMeta;
|
|
310
|
-
await hydrateRelations(modelClass, instances, perspective, { children: true });
|
|
311
|
-
expect(instances[0].children).toHaveLength(1);
|
|
312
|
-
expect(instances[1].children).toEqual([]);
|
|
313
|
-
console.log('✅ Empty relations: no crashes, correct null/empty handling');
|
|
314
|
-
});
|
|
315
|
-
// ── Test #4: Duplicate relation targets ──
|
|
316
|
-
it('deduplicates when multiple instances point to the same related entity', async () => {
|
|
317
|
-
const instances = [
|
|
318
|
-
{ id: 'a', owner: undefined },
|
|
319
|
-
{ id: 'b', owner: undefined },
|
|
320
|
-
{ id: 'c', owner: undefined },
|
|
321
|
-
];
|
|
322
|
-
// All three instances share the same owner
|
|
323
|
-
const sparqlResults = [
|
|
324
|
-
{ source: 'shared-owner', target: 'a' },
|
|
325
|
-
{ source: 'shared-owner', target: 'b' },
|
|
326
|
-
{ source: 'shared-owner', target: 'c' },
|
|
327
|
-
];
|
|
328
|
-
const knownOwners = new Map([['shared-owner', { name: 'Shared' }]]);
|
|
329
|
-
const { perspective } = makeMockPerspective({ sparqlResults });
|
|
330
|
-
const TargetClass = makeMockTargetClass(knownOwners);
|
|
331
|
-
// Track findAll calls to verify deduplication
|
|
332
|
-
const originalFindAll = TargetClass.findAll;
|
|
333
|
-
let findAllIds = [];
|
|
334
|
-
TargetClass.findAll = async (p, q) => {
|
|
335
|
-
findAllIds = q?.where?.id ?? [];
|
|
336
|
-
return originalFindAll(p, q);
|
|
337
|
-
};
|
|
338
|
-
const modelClass = {
|
|
339
|
-
__relMeta: {
|
|
340
|
-
owner: {
|
|
341
|
-
kind: 'belongsToOne',
|
|
342
|
-
predicate: PREDICATE,
|
|
343
|
-
target: () => TargetClass,
|
|
344
|
-
maxCount: 1,
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
};
|
|
348
|
-
const decorators = require('./decorators');
|
|
349
|
-
decorators.getRelationsMetadata = () => modelClass.__relMeta;
|
|
350
|
-
await hydrateRelations(modelClass, instances, perspective, { owner: true });
|
|
351
|
-
// Should only request the shared owner once
|
|
352
|
-
expect(findAllIds).toHaveLength(1);
|
|
353
|
-
expect(findAllIds[0]).toBe('shared-owner');
|
|
354
|
-
// All instances should have the same owner
|
|
355
|
-
for (const inst of instances) {
|
|
356
|
-
expect(inst.owner).toBeTruthy();
|
|
357
|
-
expect(inst.owner.id).toBe('shared-owner');
|
|
358
|
-
}
|
|
359
|
-
console.log('✅ Duplicate targets: deduplication works (1 fetch for shared entity)');
|
|
360
|
-
});
|
|
361
|
-
// ── Test #5: Large batch (100+ instances) ──
|
|
362
|
-
it('handles 150 instances without breaking SPARQL VALUES/FILTER clause', async () => {
|
|
363
|
-
const N = 150;
|
|
364
|
-
const instances = Array.from({ length: N }, (_, i) => ({
|
|
365
|
-
id: `inst-${i}`,
|
|
366
|
-
child: undefined,
|
|
367
|
-
}));
|
|
368
|
-
const sparqlResults = Array.from({ length: N }, (_, i) => ({
|
|
369
|
-
source: `related-${i}`,
|
|
370
|
-
target: `inst-${i}`,
|
|
371
|
-
}));
|
|
372
|
-
const knownRelated = new Map(Array.from({ length: N }, (_, i) => [`related-${i}`, { value: i }]));
|
|
373
|
-
const { perspective, callCounts } = makeMockPerspective({ sparqlResults });
|
|
374
|
-
const TargetClass = makeMockTargetClass(knownRelated);
|
|
375
|
-
const modelClass = {
|
|
376
|
-
__relMeta: {
|
|
377
|
-
child: {
|
|
378
|
-
kind: 'belongsToOne',
|
|
379
|
-
predicate: PREDICATE,
|
|
380
|
-
target: () => TargetClass,
|
|
381
|
-
maxCount: 1,
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
};
|
|
385
|
-
const decorators = require('./decorators');
|
|
386
|
-
decorators.getRelationsMetadata = () => modelClass.__relMeta;
|
|
387
|
-
await hydrateRelations(modelClass, instances, perspective, { child: true });
|
|
388
|
-
expect(callCounts.querySparql).toBe(1);
|
|
389
|
-
const hydrated = instances.filter(i => i.child != null);
|
|
390
|
-
expect(hydrated.length).toBe(N);
|
|
391
|
-
console.log(`✅ Large batch: ${N} instances hydrated with 1 SPARQL query`);
|
|
392
|
-
});
|
|
393
|
-
// ── Test #6: Relation with where filter ──
|
|
394
|
-
it('applies where filter on batched relation fetch', async () => {
|
|
395
|
-
const instances = [{ id: 'post-0', comments: undefined }];
|
|
396
|
-
const sparqlResults = [
|
|
397
|
-
{ source: 'c-pub', target: 'post-0' },
|
|
398
|
-
{ source: 'c-draft', target: 'post-0' },
|
|
399
|
-
];
|
|
400
|
-
// Only c-pub matches the where filter
|
|
401
|
-
const knownComments = new Map([
|
|
402
|
-
['c-pub', { status: 'published', text: 'Public' }],
|
|
403
|
-
// c-draft won't be returned by findAll with where filter
|
|
404
|
-
]);
|
|
405
|
-
const { perspective } = makeMockPerspective({ sparqlResults });
|
|
406
|
-
const TargetClass = makeMockTargetClass(knownComments);
|
|
407
|
-
const modelClass = {
|
|
408
|
-
__relMeta: {
|
|
409
|
-
comments: {
|
|
410
|
-
kind: 'belongsToMany',
|
|
411
|
-
predicate: PREDICATE,
|
|
412
|
-
target: () => TargetClass,
|
|
413
|
-
maxCount: undefined,
|
|
414
|
-
},
|
|
415
|
-
},
|
|
416
|
-
};
|
|
417
|
-
const decorators = require('./decorators');
|
|
418
|
-
decorators.getRelationsMetadata = () => modelClass.__relMeta;
|
|
419
|
-
await hydrateRelations(modelClass, instances, perspective, {
|
|
420
|
-
comments: { where: { status: 'published' } },
|
|
421
|
-
});
|
|
422
|
-
// Only c-pub should be in the result (c-draft not in knownComments so findAll filters it)
|
|
423
|
-
expect(instances[0].comments).toHaveLength(1);
|
|
424
|
-
expect(instances[0].comments[0].id).toBe('c-pub');
|
|
425
|
-
console.log('✅ Where filter: applied correctly on batched fetch');
|
|
426
|
-
});
|
|
427
|
-
// ── Test #7: Circular relations ──
|
|
428
|
-
it('does not infinite loop with circular relations (A->B, B->A)', async () => {
|
|
429
|
-
// We only test one level of include, ensuring no infinite recursion
|
|
430
|
-
const instances = [{ id: 'A', partner: undefined }];
|
|
431
|
-
const sparqlResults = [{ source: 'B', target: 'A' }];
|
|
432
|
-
const knownPartners = new Map([['B', { name: 'B' }]]);
|
|
433
|
-
const { perspective } = makeMockPerspective({ sparqlResults });
|
|
434
|
-
const TargetClass = makeMockTargetClass(knownPartners);
|
|
435
|
-
const modelClass = {
|
|
436
|
-
__relMeta: {
|
|
437
|
-
partner: {
|
|
438
|
-
kind: 'belongsToOne',
|
|
439
|
-
predicate: 'flux://partner',
|
|
440
|
-
target: () => TargetClass,
|
|
441
|
-
maxCount: 1,
|
|
442
|
-
},
|
|
443
|
-
},
|
|
444
|
-
};
|
|
445
|
-
const decorators = require('./decorators');
|
|
446
|
-
decorators.getRelationsMetadata = () => modelClass.__relMeta;
|
|
447
|
-
// This should complete without hanging — no nested include means no recursion
|
|
448
|
-
const result = await Promise.race([
|
|
449
|
-
hydrateRelations(modelClass, instances, perspective, { partner: true }),
|
|
450
|
-
new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout — infinite loop?')), 2000)),
|
|
451
|
-
]);
|
|
452
|
-
expect(instances[0].partner).toBeTruthy();
|
|
453
|
-
expect(instances[0].partner.id).toBe('B');
|
|
454
|
-
console.log('✅ Circular relations: no infinite loop');
|
|
455
|
-
});
|
|
456
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types for the perspective model manifest — a human-readable, AI-friendly summary
|
|
3
|
-
* of all Ad4mModel-compatible classes defined in a perspective's SHACL shapes.
|
|
4
|
-
*
|
|
5
|
-
* Used by `PerspectiveProxy.getModelManifest()` and consumed by WE's AI context
|
|
6
|
-
* injection (`formatManifestForPrompt`) to describe external perspective models
|
|
7
|
-
* to the schema-generation AI.
|
|
8
|
-
*
|
|
9
|
-
* @module
|
|
10
|
-
*/
|
|
11
|
-
/** Normalised description of a single property on a model class. */
|
|
12
|
-
export interface ModelManifestProperty {
|
|
13
|
-
/** Property name as declared in the SHACL shape (e.g. "name", "body", "participants"). */
|
|
14
|
-
name: string;
|
|
15
|
-
/** The exact RDF predicate URI (e.g. "flux://has_name"). */
|
|
16
|
-
predicate: string;
|
|
17
|
-
/** Normalised scalar type; inferred from xsd:/sh: datatype + nodeKind. */
|
|
18
|
-
type: 'string' | 'number' | 'boolean' | 'uri';
|
|
19
|
-
/** `true` when maxCount is absent or > 1 (i.e. returned as an array). */
|
|
20
|
-
isCollection: boolean;
|
|
21
|
-
/** `true` when minCount >= 1. */
|
|
22
|
-
required: boolean;
|
|
23
|
-
writable: boolean;
|
|
24
|
-
/** AD4M language used to resolve the value (e.g. "literal"). */
|
|
25
|
-
resolveLanguage?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Local name of the related model class when this is a typed relation property.
|
|
28
|
-
* Derived from `SHACLPropertyShape.class` by stripping the URI prefix.
|
|
29
|
-
* E.g. `flux://Message` → `"Message"`.
|
|
30
|
-
*/
|
|
31
|
-
relatedModel?: string;
|
|
32
|
-
}
|
|
33
|
-
/** Normalised description of a single model class stored in a perspective. */
|
|
34
|
-
export interface ModelManifestEntry {
|
|
35
|
-
/** Class name — usable directly as the `model` field in a `$query` token. */
|
|
36
|
-
name: string;
|
|
37
|
-
/** The SHACL `targetClass` URI (e.g. "flux://Channel"). */
|
|
38
|
-
targetClass: string;
|
|
39
|
-
/** All data properties (flag/hasValue properties are excluded). */
|
|
40
|
-
properties: ModelManifestProperty[];
|
|
41
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types for the perspective model manifest — a human-readable, AI-friendly summary
|
|
3
|
-
* of all Ad4mModel-compatible classes defined in a perspective's SHACL shapes.
|
|
4
|
-
*
|
|
5
|
-
* Used by `PerspectiveProxy.getModelManifest()` and consumed by WE's AI context
|
|
6
|
-
* injection (`formatManifestForPrompt`) to describe external perspective models
|
|
7
|
-
* to the schema-generation AI.
|
|
8
|
-
*
|
|
9
|
-
* @module
|
|
10
|
-
*/
|
|
11
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standalone Prolog fact generator for Ad4mModel classes.
|
|
3
|
-
*
|
|
4
|
-
* Converts decorator metadata into Prolog clauses that can be prepended to
|
|
5
|
-
* `perspective.infer()` calls, enabling custom Prolog rules to reference
|
|
6
|
-
* model instances and their fields.
|
|
7
|
-
*/
|
|
8
|
-
import type { Ad4mModel } from "./Ad4mModel";
|
|
9
|
-
/**
|
|
10
|
-
* Generate Prolog predicate facts from a model class's decorator metadata.
|
|
11
|
-
*
|
|
12
|
-
* Given a model class decorated with `@Model` (and its `@Flag`, `@Property`,
|
|
13
|
-
* `@HasMany`, `@BelongsToMany` decorators), this function emits a string of
|
|
14
|
-
* Prolog clauses that can be prepended to any `perspective.infer()` call.
|
|
15
|
-
*
|
|
16
|
-
* The generated predicates are:
|
|
17
|
-
* - **Instance recognizer** — `modelName(X)` — matches instances of the model
|
|
18
|
-
* - **Property getters** — `modelName_propName(X, Value)` — one per property
|
|
19
|
-
* - **Relation getters** — `modelName_relName(X, Values)` — one per relation
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* import { generatePrologFacts } from '@coasys/ad4m';
|
|
24
|
-
*
|
|
25
|
-
* const facts = generatePrologFacts(Poll);
|
|
26
|
-
* const result = await perspective.infer(\`
|
|
27
|
-
* \${facts}
|
|
28
|
-
* recent_popular_poll(X) :-
|
|
29
|
-
* poll(X),
|
|
30
|
-
* poll_vote_count(X, N), N > 10.
|
|
31
|
-
* \`);
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @param ModelClass - A class decorated with `@Model` that extends `Ad4mModel`
|
|
35
|
-
* @returns A multi-line Prolog string ready for use with `perspective.infer()`
|
|
36
|
-
*/
|
|
37
|
-
export declare function generatePrologFacts(ModelClass: typeof Ad4mModel): string;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standalone Prolog fact generator for Ad4mModel classes.
|
|
3
|
-
*
|
|
4
|
-
* Converts decorator metadata into Prolog clauses that can be prepended to
|
|
5
|
-
* `perspective.infer()` calls, enabling custom Prolog rules to reference
|
|
6
|
-
* model instances and their fields.
|
|
7
|
-
*/
|
|
8
|
-
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
9
|
-
/**
|
|
10
|
-
* Convert a camelCase or PascalCase identifier to snake_case.
|
|
11
|
-
* Examples: "TestPost" -> "test_post", "createdAt" -> "created_at"
|
|
12
|
-
*/
|
|
13
|
-
function toSnakeCase(str) {
|
|
14
|
-
return str
|
|
15
|
-
.replace(/([A-Z])/g, "_$1")
|
|
16
|
-
.toLowerCase()
|
|
17
|
-
.replace(/^_/, "");
|
|
18
|
-
}
|
|
19
|
-
function buildInstanceClause(predicateName, metadata) {
|
|
20
|
-
const props = metadata.properties;
|
|
21
|
-
// Collect flags first — these are the strongest recognizers
|
|
22
|
-
const flags = Object.values(props).filter((p) => p.flag && p.predicate && p.initial);
|
|
23
|
-
if (flags.length > 0) {
|
|
24
|
-
const conditions = flags
|
|
25
|
-
.map((p) => `triple(X, '${p.predicate}', '${p.initial}')`)
|
|
26
|
-
.join(",\n ");
|
|
27
|
-
return `${predicateName}(X) :-\n ${conditions}.`;
|
|
28
|
-
}
|
|
29
|
-
// Fallback: required non-flag properties
|
|
30
|
-
const required = Object.values(props).filter((p) => p.required && p.predicate && !p.flag);
|
|
31
|
-
if (required.length > 0) {
|
|
32
|
-
const conditions = required
|
|
33
|
-
.map((p) => `triple(X, '${p.predicate}', _)`)
|
|
34
|
-
.join(",\n ");
|
|
35
|
-
return `${predicateName}(X) :-\n ${conditions}.`;
|
|
36
|
-
}
|
|
37
|
-
// Open-world structural fallback: match nodes that have at least one of the
|
|
38
|
-
// model's declared property predicates. Uses disjunction (;) so any single
|
|
39
|
-
// predicate is enough.
|
|
40
|
-
const allPredicates = Object.values(props)
|
|
41
|
-
.filter((p) => p.predicate)
|
|
42
|
-
.map((p) => p.predicate);
|
|
43
|
-
if (metadata.relations) {
|
|
44
|
-
for (const rel of Object.values(metadata.relations)) {
|
|
45
|
-
if (rel.predicate)
|
|
46
|
-
allPredicates.push(rel.predicate);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (allPredicates.length > 0) {
|
|
50
|
-
const disjunction = allPredicates
|
|
51
|
-
.map((pred) => `triple(X, '${pred}', _)`)
|
|
52
|
-
.join(" ;\n ");
|
|
53
|
-
return `${predicateName}(X) :-\n (${disjunction}).`;
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
function buildPropertyClause(modelPredicateName, prop) {
|
|
58
|
-
if (prop.flag)
|
|
59
|
-
return null;
|
|
60
|
-
if (!prop.predicate)
|
|
61
|
-
return null;
|
|
62
|
-
const clauseName = `${modelPredicateName}_${toSnakeCase(prop.name)}`;
|
|
63
|
-
return `${clauseName}(X, Value) :- triple(X, '${prop.predicate}', Value).`;
|
|
64
|
-
}
|
|
65
|
-
function buildRelationClause(modelPredicateName, relation) {
|
|
66
|
-
if (!relation.predicate)
|
|
67
|
-
return null;
|
|
68
|
-
const clauseName = `${modelPredicateName}_${toSnakeCase(relation.name)}`;
|
|
69
|
-
if (relation.direction === "reverse") {
|
|
70
|
-
return `${clauseName}(X, Values) :- findall(V, triple(V, '${relation.predicate}', X), Values).`;
|
|
71
|
-
}
|
|
72
|
-
return `${clauseName}(X, Values) :- findall(V, triple(X, '${relation.predicate}', V), Values).`;
|
|
73
|
-
}
|
|
74
|
-
// ── Public API ───────────────────────────────────────────────────────────────
|
|
75
|
-
/**
|
|
76
|
-
* Generate Prolog predicate facts from a model class's decorator metadata.
|
|
77
|
-
*
|
|
78
|
-
* Given a model class decorated with `@Model` (and its `@Flag`, `@Property`,
|
|
79
|
-
* `@HasMany`, `@BelongsToMany` decorators), this function emits a string of
|
|
80
|
-
* Prolog clauses that can be prepended to any `perspective.infer()` call.
|
|
81
|
-
*
|
|
82
|
-
* The generated predicates are:
|
|
83
|
-
* - **Instance recognizer** — `modelName(X)` — matches instances of the model
|
|
84
|
-
* - **Property getters** — `modelName_propName(X, Value)` — one per property
|
|
85
|
-
* - **Relation getters** — `modelName_relName(X, Values)` — one per relation
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```typescript
|
|
89
|
-
* import { generatePrologFacts } from '@coasys/ad4m';
|
|
90
|
-
*
|
|
91
|
-
* const facts = generatePrologFacts(Poll);
|
|
92
|
-
* const result = await perspective.infer(\`
|
|
93
|
-
* \${facts}
|
|
94
|
-
* recent_popular_poll(X) :-
|
|
95
|
-
* poll(X),
|
|
96
|
-
* poll_vote_count(X, N), N > 10.
|
|
97
|
-
* \`);
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* @param ModelClass - A class decorated with `@Model` that extends `Ad4mModel`
|
|
101
|
-
* @returns A multi-line Prolog string ready for use with `perspective.infer()`
|
|
102
|
-
*/
|
|
103
|
-
export function generatePrologFacts(ModelClass) {
|
|
104
|
-
const metadata = ModelClass.getModelMetadata();
|
|
105
|
-
const predicateName = toSnakeCase(metadata.className);
|
|
106
|
-
const lines = [];
|
|
107
|
-
lines.push(`% ${metadata.className} — generated Prolog facts`);
|
|
108
|
-
// Instance recognizer
|
|
109
|
-
const instanceClause = buildInstanceClause(predicateName, metadata);
|
|
110
|
-
if (instanceClause) {
|
|
111
|
-
lines.push("");
|
|
112
|
-
lines.push(`% Instance recognizer`);
|
|
113
|
-
lines.push(instanceClause);
|
|
114
|
-
}
|
|
115
|
-
// Property getters
|
|
116
|
-
const propClauses = Object.values(metadata.properties)
|
|
117
|
-
.map((p) => buildPropertyClause(predicateName, p))
|
|
118
|
-
.filter((c) => c !== null);
|
|
119
|
-
if (propClauses.length > 0) {
|
|
120
|
-
lines.push("");
|
|
121
|
-
lines.push(`% Field getters`);
|
|
122
|
-
lines.push(...propClauses);
|
|
123
|
-
}
|
|
124
|
-
// Relation getters
|
|
125
|
-
const relClauses = Object.values(metadata.relations)
|
|
126
|
-
.map((c) => buildRelationClause(predicateName, c))
|
|
127
|
-
.filter((c) => c !== null);
|
|
128
|
-
if (relClauses.length > 0) {
|
|
129
|
-
lines.push("");
|
|
130
|
-
lines.push(`% Relation getters`);
|
|
131
|
-
lines.push(...relClauses);
|
|
132
|
-
}
|
|
133
|
-
return lines.join("\n");
|
|
134
|
-
}
|