@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
package/src/apiClient.test.ts
CHANGED
|
@@ -1,227 +1,655 @@
|
|
|
1
|
-
import { ApiClient } from "./apiClient"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
type AnyMsg = Record<string,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
static
|
|
16
|
-
|
|
17
|
-
static
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { ApiClient, LONG_TIMEOUT_MS, RpcError } from "./apiClient"
|
|
2
|
+
import { AIClient } from "./ai/AIClient"
|
|
3
|
+
import { AgentClient } from "./agent/AgentClient"
|
|
4
|
+
import { LanguageClient } from "./language/LanguageClient"
|
|
5
|
+
import { NeighbourhoodClient } from "./neighbourhood/NeighbourhoodClient"
|
|
6
|
+
import { PerspectiveClient } from "./perspectives/PerspectiveClient"
|
|
7
|
+
import { PerspectiveHandle } from "./perspectives/PerspectiveHandle"
|
|
8
|
+
import { PerspectiveProxy } from "./perspectives/PerspectiveProxy"
|
|
9
|
+
import { RuntimeClient } from "./runtime/RuntimeClient"
|
|
10
|
+
|
|
11
|
+
type AnyMsg = Record<string, any>
|
|
12
|
+
|
|
13
|
+
/** A socket the tests drive by hand: open(), drop(), reply(). */
|
|
14
|
+
class TestSocket {
|
|
15
|
+
static instances: TestSocket[] = []
|
|
16
|
+
/** Open on the next microtask, like a reachable server. */
|
|
17
|
+
static autoOpen = false
|
|
18
|
+
/** Fire onclose some time after close(), like browsers and `ws`. */
|
|
19
|
+
static asyncClose = false
|
|
20
|
+
|
|
21
|
+
readyState = 0
|
|
22
|
+
sent: AnyMsg[] = []
|
|
23
|
+
onopen: (() => void) | null = null
|
|
22
24
|
onmessage: ((ev: { data: string }) => void) | null = null
|
|
23
25
|
onerror: ((ev: unknown) => void) | null = null
|
|
24
|
-
onclose: ((
|
|
25
|
-
|
|
26
|
-
static last: FakeWebSocket | null = null
|
|
26
|
+
onclose: (() => void) | null = null
|
|
27
27
|
|
|
28
28
|
constructor(public url: string) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
setTimeout(() => {
|
|
32
|
-
this.readyState = FakeWebSocket.OPEN
|
|
33
|
-
this.onopen?.()
|
|
34
|
-
}, 0)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
send(data: string) {
|
|
38
|
-
this.sent.push(data)
|
|
29
|
+
TestSocket.instances.push(this)
|
|
30
|
+
if (TestSocket.autoOpen) queueMicrotask(() => this.open())
|
|
39
31
|
}
|
|
40
|
-
|
|
32
|
+
send(data: string) { this.sent.push(JSON.parse(data)) }
|
|
41
33
|
close() {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.onmessage?.({ data: JSON.stringify(msg) })
|
|
34
|
+
if (TestSocket.asyncClose) {
|
|
35
|
+
this.readyState = 2
|
|
36
|
+
setTimeout(() => this.drop(), 5)
|
|
37
|
+
} else {
|
|
38
|
+
this.drop()
|
|
39
|
+
}
|
|
49
40
|
}
|
|
41
|
+
open() { this.readyState = 1; this.onopen?.() }
|
|
42
|
+
drop() { this.readyState = 3; this.onclose?.() }
|
|
43
|
+
reply(msg: AnyMsg) { this.onmessage?.({ data: JSON.stringify(msg) }) }
|
|
50
44
|
}
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
const url = 'http://localhost:1234'
|
|
47
|
+
const socket = (i: number) => TestSocket.instances[i]
|
|
48
|
+
const flush = () => new Promise((r) => setTimeout(r, 0))
|
|
49
|
+
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))
|
|
50
|
+
/** Starts a connection the way an event subscriber does. */
|
|
51
|
+
const open = () => { client.on('agent-updated', () => {}) }
|
|
52
|
+
|
|
53
|
+
let client: ApiClient
|
|
54
|
+
beforeEach(() => {
|
|
55
|
+
TestSocket.instances = []
|
|
56
|
+
TestSocket.autoOpen = true
|
|
57
|
+
TestSocket.asyncClose = false
|
|
58
|
+
client = new ApiClient(url, undefined, TestSocket as unknown as new (url: string) => WebSocket)
|
|
59
|
+
})
|
|
60
|
+
afterEach(() => client.closeAll())
|
|
61
|
+
|
|
62
|
+
/** Transport tests send arbitrary method names, outside the typed table. */
|
|
63
|
+
type UntypedCall = (type: string, params?: unknown, options?: object) => Promise<unknown>
|
|
64
|
+
|
|
65
|
+
/** A call whose rejection counts as handled until the test awaits it. */
|
|
66
|
+
function call<T = unknown>(type: string, params?: Record<string, unknown>, options?: object): Promise<T> {
|
|
67
|
+
const promise = (client.call as UntypedCall)(type, params ?? {}, options) as Promise<T>
|
|
68
|
+
promise.catch(() => {})
|
|
69
|
+
return promise
|
|
55
70
|
}
|
|
56
71
|
|
|
57
|
-
|
|
58
|
-
|
|
72
|
+
/** Reads how `promise` settled so far: 'pending', 'resolved' or the rejection. */
|
|
73
|
+
function outcomeOf(promise: Promise<unknown>): () => unknown {
|
|
74
|
+
let outcome: unknown = 'pending'
|
|
75
|
+
promise.then(() => { outcome = 'resolved' }, (e) => { outcome = e })
|
|
76
|
+
return () => outcome
|
|
59
77
|
}
|
|
60
78
|
|
|
61
|
-
describe('ApiClient
|
|
62
|
-
it('
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
)
|
|
79
|
+
describe('ApiClient calls', () => {
|
|
80
|
+
it('sends the call and resolves with the reply', async () => {
|
|
81
|
+
const promise = call('agent.get', { foo: 'bar' })
|
|
82
|
+
await flush()
|
|
83
|
+
const req = socket(0).sent[0]
|
|
84
|
+
expect(req).toMatchObject({ type: 'agent.get', params: { foo: 'bar' } })
|
|
85
|
+
socket(0).reply({ id: req.id, result: { did: 'd' } })
|
|
86
|
+
await expect(promise).resolves.toEqual({ did: 'd' })
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it('rejects with AbortError before opening a socket if the signal is already aborted', async () => {
|
|
68
90
|
const controller = new AbortController()
|
|
69
91
|
controller.abort()
|
|
92
|
+
await expect(call('agent.get', {}, { signal: controller.signal })).rejects.toMatchObject({ name: 'AbortError' })
|
|
93
|
+
expect(TestSocket.instances).toHaveLength(0)
|
|
94
|
+
})
|
|
70
95
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
expect(caught).toBeInstanceOf(DOMException)
|
|
78
|
-
expect((caught as DOMException).name).toBe('AbortError')
|
|
79
|
-
// No socket should have been opened — the fast-path bailed before _ready.
|
|
80
|
-
expect(FakeWebSocket.last).toBeNull()
|
|
96
|
+
it('sends request.cancel and rejects with AbortError when the signal fires in flight', async () => {
|
|
97
|
+
const controller = new AbortController()
|
|
98
|
+
const promise = call('perspective.querySparql', { uuid: 'u' }, { signal: controller.signal })
|
|
99
|
+
await flush()
|
|
100
|
+
const req = socket(0).sent[0]
|
|
81
101
|
|
|
82
|
-
|
|
102
|
+
controller.abort()
|
|
103
|
+
expect(socket(0).sent[1]).toMatchObject({ type: 'request.cancel', params: { targetId: req.id } })
|
|
104
|
+
await expect(promise).rejects.toMatchObject({ name: 'AbortError' })
|
|
83
105
|
})
|
|
84
106
|
|
|
85
|
-
it('
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
undefined,
|
|
89
|
-
FakeWebSocket as unknown as new (url: string) => WebSocket,
|
|
90
|
-
)
|
|
107
|
+
it('drops a late reply to an aborted call and the cancel ack', async () => {
|
|
108
|
+
const events: unknown[] = []
|
|
109
|
+
client.on('agent-updated', (e) => { events.push(e) })
|
|
91
110
|
const controller = new AbortController()
|
|
92
|
-
const promise =
|
|
93
|
-
|
|
94
|
-
// Wait for socket open + send.
|
|
95
|
-
await flushMicrotasks()
|
|
96
|
-
const ws = FakeWebSocket.last
|
|
97
|
-
expect(ws).not.toBeNull()
|
|
98
|
-
// First send should be the actual RPC request.
|
|
99
|
-
const sentReq = JSON.parse(ws!.sent[0]) as AnyMsg
|
|
100
|
-
expect(sentReq.type).toBe('perspective.querySparql')
|
|
101
|
-
const origId = sentReq.id as string
|
|
102
|
-
|
|
103
|
-
// Now abort.
|
|
111
|
+
const promise = call('perspective.querySparql', { uuid: 'u' }, { signal: controller.signal })
|
|
112
|
+
await flush()
|
|
104
113
|
controller.abort()
|
|
114
|
+
await expect(promise).rejects.toMatchObject({ name: 'AbortError' })
|
|
105
115
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
expect(
|
|
109
|
-
|
|
110
|
-
const params = cancelMsg!.params as { targetId: string }
|
|
111
|
-
expect(params.targetId).toBe(origId)
|
|
112
|
-
|
|
113
|
-
// The promise should now reject with AbortError.
|
|
114
|
-
let caught: unknown
|
|
115
|
-
try { await promise } catch (e) { caught = e }
|
|
116
|
-
expect(caught).toBeInstanceOf(DOMException)
|
|
117
|
-
expect((caught as DOMException).name).toBe('AbortError')
|
|
116
|
+
socket(0).reply({ id: socket(0).sent[0].id, result: '[]' })
|
|
117
|
+
socket(0).reply({ id: socket(0).sent[1].id, result: { cancelled: true } })
|
|
118
|
+
expect(events).toEqual([])
|
|
119
|
+
})
|
|
118
120
|
|
|
119
|
-
|
|
121
|
+
it('rejects with an RpcError carrying the code and message of an error reply', async () => {
|
|
122
|
+
const promise = call('perspective.get', { uuid: 'u' })
|
|
123
|
+
await flush()
|
|
124
|
+
socket(0).reply({ id: socket(0).sent[0].id, error: { code: 404, message: 'perspective not found' } })
|
|
125
|
+
const error = await promise.catch((e) => e)
|
|
126
|
+
expect(error).toBeInstanceOf(RpcError)
|
|
127
|
+
expect(error).toMatchObject({ status: 404, body: 'perspective not found' })
|
|
120
128
|
})
|
|
121
129
|
|
|
122
|
-
it('
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const events: AnyMsg[] = []
|
|
129
|
-
client.subscribe((m) => events.push(m as AnyMsg))
|
|
130
|
+
it('rejects with status 500 when an error reply has no code', async () => {
|
|
131
|
+
const promise = call('agent.get')
|
|
132
|
+
await flush()
|
|
133
|
+
socket(0).reply({ id: socket(0).sent[0].id, error: { message: 'boom' } })
|
|
134
|
+
await expect(promise).rejects.toMatchObject({ name: 'RpcError', status: 500, body: 'boom' })
|
|
135
|
+
})
|
|
130
136
|
|
|
137
|
+
it('sends no request.cancel when the signal fires after the call settled', async () => {
|
|
131
138
|
const controller = new AbortController()
|
|
132
|
-
const promise =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const sentReq = JSON.parse(ws.sent[0]) as AnyMsg
|
|
137
|
-
const origId = sentReq.id as string
|
|
139
|
+
const promise = call('agent.get', {}, { signal: controller.signal })
|
|
140
|
+
await flush()
|
|
141
|
+
socket(0).reply({ id: socket(0).sent[0].id, result: 1 })
|
|
142
|
+
await promise
|
|
138
143
|
|
|
139
144
|
controller.abort()
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
// Now the server (oblivious to cancellation) ships a late reply.
|
|
145
|
-
// It must NOT trigger a double-settle (no unhandled rejection from
|
|
146
|
-
// the test, no resolve thrown — the promise is already settled).
|
|
147
|
-
// Because we delete the entry from _pendingCalls on abort, the
|
|
148
|
-
// late reply with the same id will be routed to subscribers
|
|
149
|
-
// instead.
|
|
150
|
-
ws.serverPush({ id: origId, result: '[]' })
|
|
151
|
-
|
|
152
|
-
// Subscribers should have received the late reply (it's routed
|
|
153
|
-
// because the id is no longer in _pendingCalls).
|
|
154
|
-
const lateReply = events.find((e) => e.id === origId)
|
|
155
|
-
expect(lateReply).toBeDefined()
|
|
156
|
-
expect(lateReply!.result).toBe('[]')
|
|
145
|
+
expect(socket(0).sent).toHaveLength(1)
|
|
146
|
+
})
|
|
147
|
+
})
|
|
157
148
|
|
|
158
|
-
|
|
149
|
+
describe('ApiClient connect-phase failures', () => {
|
|
150
|
+
beforeEach(() => { TestSocket.autoOpen = false })
|
|
151
|
+
|
|
152
|
+
it('rejects with 503 before its timeout when every socket closes before the call goes out', async () => {
|
|
153
|
+
jest.useFakeTimers()
|
|
154
|
+
try {
|
|
155
|
+
const timeoutMs = 10_000
|
|
156
|
+
const outcome = outcomeOf(call('agent.get', {}, { timeoutMs }))
|
|
157
|
+
let dropped = 0
|
|
158
|
+
for (let elapsed = 0; elapsed < timeoutMs - 100 && outcome() === 'pending'; elapsed += 100) {
|
|
159
|
+
while (dropped < TestSocket.instances.length) socket(dropped++).drop()
|
|
160
|
+
await jest.advanceTimersByTimeAsync(100)
|
|
161
|
+
}
|
|
162
|
+
expect(outcome()).toMatchObject({ name: 'RpcError', status: 503 })
|
|
163
|
+
} finally {
|
|
164
|
+
jest.useRealTimers()
|
|
165
|
+
}
|
|
159
166
|
})
|
|
160
167
|
|
|
161
|
-
it('
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
await flushMicrotasks()
|
|
177
|
-
const ws = FakeWebSocket.last!
|
|
178
|
-
const sentReq = JSON.parse(ws.sent[0]) as AnyMsg
|
|
179
|
-
const origId = sentReq.id as string
|
|
180
|
-
|
|
181
|
-
// Resolve the call.
|
|
182
|
-
ws.serverPush({ id: origId, result: { did: 'did:test' } })
|
|
183
|
-
const result = await promise
|
|
184
|
-
expect((result as { did: string }).did).toBe('did:test')
|
|
185
|
-
|
|
186
|
-
// After resolution, firing the controller should not trigger any
|
|
187
|
-
// abort handler (the listener was removed in cleanup()). The
|
|
188
|
-
// simplest detection: confirm the abort doesn't cause a stray
|
|
189
|
-
// request.cancel message on the wire — i.e. no new send beyond
|
|
190
|
-
// the original.
|
|
191
|
-
const sendCountBefore = ws.sent.length
|
|
192
|
-
controller.abort()
|
|
193
|
-
// Give microtasks a chance.
|
|
194
|
-
await flushMicrotasks()
|
|
195
|
-
expect(ws.sent.length).toBe(sendCountBefore)
|
|
196
|
-
// Two listeners were registered in total: one in _readyOrAbort
|
|
197
|
-
// (connection phase) and one in call() (in-flight phase). Both
|
|
198
|
-
// were removed via cleanup — the "no extra send" check above
|
|
199
|
-
// confirms no stale handler remains.
|
|
200
|
-
expect(listenerCount).toBe(2)
|
|
168
|
+
it('sends a call made while the first connect is refused once a later socket opens', async () => {
|
|
169
|
+
// An executor that logs "API server starting" before it binds refuses the first connect.
|
|
170
|
+
jest.useFakeTimers()
|
|
171
|
+
try {
|
|
172
|
+
const promise = call<string>('agent.generate', { passphrase: 'p' }, { timeoutMs: 10_000 })
|
|
173
|
+
socket(0).drop()
|
|
174
|
+
await jest.advanceTimersByTimeAsync(500)
|
|
175
|
+
socket(1).open()
|
|
176
|
+
expect(socket(1).sent[0]).toMatchObject({ type: 'agent.generate' })
|
|
177
|
+
socket(1).reply({ id: socket(1).sent[0].id, result: 'ok' })
|
|
178
|
+
await expect(promise).resolves.toBe('ok')
|
|
179
|
+
} finally {
|
|
180
|
+
jest.useRealTimers()
|
|
181
|
+
}
|
|
182
|
+
})
|
|
201
183
|
|
|
202
|
-
|
|
184
|
+
it("a replaced socket's late onclose does not fail the call on its successor", async () => {
|
|
185
|
+
TestSocket.asyncClose = true
|
|
186
|
+
open()
|
|
187
|
+
socket(0).open()
|
|
188
|
+
client.closeAll() // socket 0's onclose arrives 5 ms later
|
|
189
|
+
const promise = call<string>('x')
|
|
190
|
+
await sleep(10)
|
|
191
|
+
socket(1).open()
|
|
192
|
+
socket(1).reply({ id: socket(1).sent[0].id, result: 'ok' })
|
|
193
|
+
await expect(promise).resolves.toBe('ok')
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
it('leaves no timers after closeAll', async () => {
|
|
197
|
+
jest.useFakeTimers()
|
|
198
|
+
try {
|
|
199
|
+
const promise = call('agent.status')
|
|
200
|
+
socket(0).open()
|
|
201
|
+
socket(0).reply({ id: socket(0).sent[0].id, result: 1 })
|
|
202
|
+
await promise
|
|
203
|
+
client.closeAll()
|
|
204
|
+
expect(jest.getTimerCount()).toBe(0)
|
|
205
|
+
} finally {
|
|
206
|
+
jest.useRealTimers()
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
it('rejects with 408 when the socket never opens within the timeout', async () => {
|
|
211
|
+
const started = Date.now()
|
|
212
|
+
await expect(call('agent.get', {}, { timeoutMs: 50 })).rejects.toMatchObject({ name: 'RpcError', status: 408 })
|
|
213
|
+
expect(Date.now() - started).toBeLessThan(1_000)
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
it('closes a socket stuck connecting when a call times out, so the next call dials again', async () => {
|
|
217
|
+
await expect(call('agent.get', {}, { timeoutMs: 20 })).rejects.toMatchObject({ status: 408 })
|
|
218
|
+
expect(socket(0).readyState).toBe(3)
|
|
219
|
+
|
|
220
|
+
const next = call<number>('agent.get')
|
|
221
|
+
expect(TestSocket.instances).toHaveLength(2)
|
|
222
|
+
socket(1).open()
|
|
223
|
+
socket(1).reply({ id: socket(1).sent[0].id, result: 1 })
|
|
224
|
+
await expect(next).resolves.toBe(1)
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
it('keeps a socket stuck connecting while another call still waits on it', async () => {
|
|
228
|
+
const first = call('agent.get', {}, { timeoutMs: 20 })
|
|
229
|
+
const second = call<number>('agent.get', {}, { timeoutMs: 1_000 })
|
|
230
|
+
await expect(first).rejects.toMatchObject({ status: 408 })
|
|
231
|
+
expect(socket(0).readyState).toBe(0)
|
|
232
|
+
socket(0).open()
|
|
233
|
+
socket(0).reply({ id: socket(0).sent[0].id, result: 1 })
|
|
234
|
+
await expect(second).resolves.toBe(1)
|
|
203
235
|
})
|
|
204
236
|
|
|
205
|
-
it('
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
)
|
|
211
|
-
const promise =
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
expect(sentReq.type).toBe('agent.get')
|
|
216
|
-
expect(sentReq.params).toEqual({ foo: 'bar' })
|
|
217
|
-
ws.serverPush({ id: sentReq.id, result: { did: 'd' } })
|
|
218
|
-
const result = await promise
|
|
219
|
-
expect((result as { did: string }).did).toBe('d')
|
|
237
|
+
it('redials for subscribers when a stuck connect is dropped', async () => {
|
|
238
|
+
open()
|
|
239
|
+
await expect(call('agent.get', {}, { timeoutMs: 20 })).rejects.toMatchObject({ status: 408 })
|
|
240
|
+
expect(socket(0).readyState).toBe(3)
|
|
241
|
+
expect(TestSocket.instances).toHaveLength(2)
|
|
242
|
+
socket(1).open()
|
|
243
|
+
const promise = call('agent.get')
|
|
244
|
+
socket(1).reply({ id: socket(1).sent.at(-1)!.id, result: 1 })
|
|
245
|
+
await expect(promise).resolves.toBe(1)
|
|
246
|
+
})
|
|
220
247
|
|
|
248
|
+
it('rejects callers waiting to connect when the client is closed', async () => {
|
|
249
|
+
const promise = call('agent.get', {}, { timeoutMs: 1_000 })
|
|
221
250
|
client.closeAll()
|
|
251
|
+
await expect(promise).rejects.toMatchObject({ name: 'RpcError', status: 503 })
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
it('keeps the socket for a call still connecting when the last subscriber leaves', async () => {
|
|
255
|
+
TestSocket.asyncClose = true
|
|
256
|
+
const unsubscribe = client.on('agent-updated', () => {})
|
|
257
|
+
const promise = call<number>('agent.get', {}, { timeoutMs: 1_000 })
|
|
258
|
+
unsubscribe()
|
|
259
|
+
socket(0).open()
|
|
260
|
+
socket(0).reply({ id: socket(0).sent[0].id, result: 1 })
|
|
261
|
+
await expect(promise).resolves.toBe(1)
|
|
222
262
|
})
|
|
263
|
+
})
|
|
223
264
|
|
|
265
|
+
describe('ApiClient retries idempotent reads once after a reconnect', () => {
|
|
224
266
|
beforeEach(() => {
|
|
225
|
-
|
|
267
|
+
TestSocket.autoOpen = false
|
|
268
|
+
jest.useFakeTimers()
|
|
269
|
+
})
|
|
270
|
+
afterEach(() => jest.useRealTimers())
|
|
271
|
+
|
|
272
|
+
/** Drop socket `i` and let the reconnect timer open the next one. */
|
|
273
|
+
function reconnect(i: number) {
|
|
274
|
+
socket(i).drop()
|
|
275
|
+
jest.advanceTimersByTime(500)
|
|
276
|
+
socket(i + 1).open()
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
it('resends a read that was in flight and resolves it', async () => {
|
|
280
|
+
const read = call('perspective.all')
|
|
281
|
+
socket(0).open()
|
|
282
|
+
reconnect(0)
|
|
283
|
+
|
|
284
|
+
const resent = socket(1).sent[0]
|
|
285
|
+
expect(resent).toEqual(socket(0).sent[0])
|
|
286
|
+
socket(1).reply({ id: resent.id, result: ['p'] })
|
|
287
|
+
await expect(read).resolves.toEqual(['p'])
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
it('rejects a write that was in flight with 503', async () => {
|
|
291
|
+
const write = call('perspective.addLink', { uuid: 'u' })
|
|
292
|
+
socket(0).open()
|
|
293
|
+
socket(0).drop()
|
|
294
|
+
await expect(write).rejects.toMatchObject({ name: 'RpcError', status: 503 })
|
|
295
|
+
expect(TestSocket.instances).toHaveLength(1)
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
it('rejects a read that drops again after its retry', async () => {
|
|
299
|
+
const read = call('agent.get')
|
|
300
|
+
socket(0).open()
|
|
301
|
+
reconnect(0)
|
|
302
|
+
socket(1).drop()
|
|
303
|
+
await expect(read).rejects.toMatchObject({ name: 'RpcError', status: 503 })
|
|
304
|
+
})
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
describe('ApiClient.onReconnect', () => {
|
|
308
|
+
beforeEach(() => { TestSocket.autoOpen = false })
|
|
309
|
+
|
|
310
|
+
/** Drop the open socket, if any, and open socket `i`. */
|
|
311
|
+
function connect(i: number) {
|
|
312
|
+
if (socket(i - 1)?.readyState === 1) socket(i - 1).drop()
|
|
313
|
+
open()
|
|
314
|
+
socket(i).open()
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
it('fires on a reconnect but not on the first connect', () => {
|
|
318
|
+
const reconnected = jest.fn()
|
|
319
|
+
client.onReconnect(reconnected)
|
|
320
|
+
connect(0)
|
|
321
|
+
expect(reconnected).not.toHaveBeenCalled()
|
|
322
|
+
connect(1)
|
|
323
|
+
expect(reconnected).toHaveBeenCalledTimes(1)
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
it('does not fire once unsubscribed', () => {
|
|
327
|
+
const reconnected = jest.fn()
|
|
328
|
+
const unsubscribe = client.onReconnect(reconnected)
|
|
329
|
+
connect(0)
|
|
330
|
+
unsubscribe()
|
|
331
|
+
connect(1)
|
|
332
|
+
expect(reconnected).not.toHaveBeenCalled()
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
it('does not fire on the first connect of a client reused after closeAll', () => {
|
|
336
|
+
const reconnected = jest.fn()
|
|
337
|
+
connect(0)
|
|
338
|
+
client.closeAll()
|
|
339
|
+
client.onReconnect(reconnected)
|
|
340
|
+
connect(1)
|
|
341
|
+
expect(reconnected).not.toHaveBeenCalled()
|
|
342
|
+
})
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
describe('long calls', () => {
|
|
346
|
+
beforeEach(() => jest.useFakeTimers())
|
|
347
|
+
afterEach(() => jest.useRealTimers())
|
|
348
|
+
|
|
349
|
+
const calls: [string, (o?: object) => Promise<unknown>][] = [
|
|
350
|
+
['ai.prompt', (o) => new AIClient(url, undefined, client).prompt('t', 'p', o)],
|
|
351
|
+
['ai.embed', (o) => new AIClient(url, undefined, client).embed('m', 'x', o)],
|
|
352
|
+
['ai.addModel', (o) => new AIClient(url, undefined, client).addModel({ name: 'm', modelType: 'LLM' } as any, o)],
|
|
353
|
+
['agent.generate', (o) => new AgentClient(url, undefined, client).generate('pw', o)],
|
|
354
|
+
['agent.unlock', (o) => new AgentClient(url, undefined, client).unlock('pw', true, o)],
|
|
355
|
+
['language.publish', (o) => new LanguageClient(url, undefined, client).publish('/p', { name: 'l' } as any, o)],
|
|
356
|
+
['language.applyTemplate', (o) => new LanguageClient(url, undefined, client).applyTemplateAndPublish('h', '{}', o)],
|
|
357
|
+
['neighbourhood.publish', (o) => new NeighbourhoodClient(url, undefined, client).publishFromPerspective('u', 'l', { links: [] } as any, o)],
|
|
358
|
+
['neighbourhood.join', (o) => new NeighbourhoodClient(url, undefined, client).joinFromUrl('n://x', o)],
|
|
359
|
+
['runtime.restartHolochain', (o) => new RuntimeClient(url, undefined, client).restartHolochain(o)],
|
|
360
|
+
['perspective.runInterpretation', (o) => new PerspectiveClient(url, undefined, client).runInterpretation('u', [], 'b', undefined, undefined, undefined, undefined, o)],
|
|
361
|
+
['perspective.runInterpretationWithHarness', (o) => new PerspectiveClient(url, undefined, client).runInterpretationWithHarness('u', [], 'b', 1, undefined, undefined, undefined, undefined, undefined, o)],
|
|
362
|
+
]
|
|
363
|
+
const proxy = () => new PerspectiveProxy(
|
|
364
|
+
new PerspectiveHandle('u', 'p'),
|
|
365
|
+
new PerspectiveClient(url, undefined, client),
|
|
366
|
+
)
|
|
367
|
+
const proxyCalls: typeof calls = [
|
|
368
|
+
['perspective.runInterpretation', (o) => proxy().runInterpretation([], 'b', undefined, o)],
|
|
369
|
+
['perspective.runInterpretationWithHarness', (o) => proxy().runInterpretationWithHarness([], 'b', 1, undefined, undefined, undefined, undefined, o)],
|
|
370
|
+
]
|
|
371
|
+
const lastSent = () => TestSocket.instances[TestSocket.instances.length - 1].sent.at(-1)!
|
|
372
|
+
|
|
373
|
+
describe.each([['client', calls], ['PerspectiveProxy', proxyCalls]])('%s', (_via, table) => {
|
|
374
|
+
it.each(table)('%s waits LONG_TIMEOUT_MS by default', async (type, run) => {
|
|
375
|
+
const outcome = outcomeOf(run())
|
|
376
|
+
await jest.advanceTimersByTimeAsync(1)
|
|
377
|
+
expect(lastSent().type).toBe(type)
|
|
378
|
+
|
|
379
|
+
await jest.advanceTimersByTimeAsync(31_000)
|
|
380
|
+
expect(outcome()).toBe('pending')
|
|
381
|
+
await jest.advanceTimersByTimeAsync(LONG_TIMEOUT_MS)
|
|
382
|
+
expect(outcome()).toMatchObject({ name: 'RpcError', status: 408 })
|
|
383
|
+
})
|
|
384
|
+
|
|
385
|
+
it.each(table)('%s takes timeoutMs', async (_type, run) => {
|
|
386
|
+
const timedOut = outcomeOf(run({ timeoutMs: 100 }))
|
|
387
|
+
await jest.advanceTimersByTimeAsync(100)
|
|
388
|
+
expect(timedOut()).toMatchObject({ status: 408 })
|
|
389
|
+
})
|
|
390
|
+
})
|
|
391
|
+
})
|
|
392
|
+
|
|
393
|
+
/** A `link-added` event exactly as the executor sends it. */
|
|
394
|
+
function linkAdded(perspectiveUuid: string, target = 'literal://x') {
|
|
395
|
+
return {
|
|
396
|
+
type: 'link-added',
|
|
397
|
+
perspectiveUuid,
|
|
398
|
+
owner: 'did:test:owner',
|
|
399
|
+
link: {
|
|
400
|
+
author: 'did:test:alice',
|
|
401
|
+
timestamp: '2026-01-01T00:00:00Z',
|
|
402
|
+
data: { source: 'ad4m://self', predicate: 'ad4m://has', target },
|
|
403
|
+
proof: { key: 'key', signature: 'sig', valid: true, invalid: false },
|
|
404
|
+
status: 'SHARED',
|
|
405
|
+
},
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/** An `agent-updated` event exactly as the executor sends it. */
|
|
410
|
+
const agentUpdated = { type: 'agent-updated', agent: { did: 'did:test:alice', directMessageLanguage: null, perspective: null } }
|
|
411
|
+
|
|
412
|
+
describe('ApiClient.on', () => {
|
|
413
|
+
it('delivers an event, as sent, to the handlers of its type only', async () => {
|
|
414
|
+
const added: unknown[] = []
|
|
415
|
+
const updated: unknown[] = []
|
|
416
|
+
client.on('link-added', (e) => { added.push(e) })
|
|
417
|
+
client.on('agent-updated', (e) => { updated.push(e) })
|
|
418
|
+
await flush()
|
|
419
|
+
|
|
420
|
+
socket(0).reply(linkAdded('p1'))
|
|
421
|
+
|
|
422
|
+
expect(added).toEqual([linkAdded('p1')])
|
|
423
|
+
expect(updated).toEqual([])
|
|
424
|
+
})
|
|
425
|
+
|
|
426
|
+
it('delivers a scoped event only to handlers of its perspective or of every perspective', async () => {
|
|
427
|
+
const p1: string[] = []
|
|
428
|
+
const p2: string[] = []
|
|
429
|
+
const all: string[] = []
|
|
430
|
+
client.on('link-added', (e) => { p1.push(e.link.data.target) }, { perspective: 'p1' })
|
|
431
|
+
client.on('link-added', (e) => { p2.push(e.link.data.target) }, { perspective: 'p2' })
|
|
432
|
+
client.on('link-added', (e) => { all.push(e.link.data.target) })
|
|
433
|
+
await flush()
|
|
434
|
+
|
|
435
|
+
socket(0).reply(linkAdded('p1', 'literal://a'))
|
|
436
|
+
socket(0).reply(linkAdded('p2', 'literal://b'))
|
|
437
|
+
|
|
438
|
+
expect(p1).toEqual(['literal://a'])
|
|
439
|
+
expect(p2).toEqual(['literal://b'])
|
|
440
|
+
expect(all).toEqual(['literal://a', 'literal://b'])
|
|
441
|
+
})
|
|
442
|
+
|
|
443
|
+
it('stops delivery once unsubscribed and keeps the other handlers', async () => {
|
|
444
|
+
const first = jest.fn()
|
|
445
|
+
const second = jest.fn()
|
|
446
|
+
const off = client.on('link-added', first)
|
|
447
|
+
client.on('link-added', second)
|
|
448
|
+
await flush()
|
|
449
|
+
|
|
450
|
+
off()
|
|
451
|
+
socket(0).reply(linkAdded('p1'))
|
|
452
|
+
|
|
453
|
+
expect(first).not.toHaveBeenCalled()
|
|
454
|
+
expect(second).toHaveBeenCalledTimes(1)
|
|
455
|
+
})
|
|
456
|
+
|
|
457
|
+
it('skips a handler removed during dispatch and delivers to one added during dispatch from the next event', async () => {
|
|
458
|
+
const received: string[] = []
|
|
459
|
+
let offSecond = () => {}
|
|
460
|
+
client.on('link-added', () => {
|
|
461
|
+
received.push('first')
|
|
462
|
+
offSecond()
|
|
463
|
+
client.on('link-added', () => { received.push('added') })
|
|
464
|
+
})
|
|
465
|
+
offSecond = client.on('link-added', () => { received.push('second') })
|
|
466
|
+
await flush()
|
|
467
|
+
|
|
468
|
+
socket(0).reply(linkAdded('p1'))
|
|
469
|
+
expect(received).toEqual(['first'])
|
|
470
|
+
|
|
471
|
+
socket(0).reply(linkAdded('p1'))
|
|
472
|
+
expect(received).toEqual(['first', 'first', 'added'])
|
|
473
|
+
})
|
|
474
|
+
|
|
475
|
+
it('removes a type from watchedEvents() with its last unsubscribe', () => {
|
|
476
|
+
const offAll = client.on('link-added', () => {})
|
|
477
|
+
const offP1 = client.on('link-added', () => {}, { perspective: 'p1' })
|
|
478
|
+
const offP2 = client.on('link-added', () => {}, { perspective: 'p2' })
|
|
479
|
+
client.on('agent-updated', () => {})
|
|
480
|
+
expect(client.watchedEvents()).toEqual({ 'agent-updated': null, 'link-added': null })
|
|
481
|
+
|
|
482
|
+
offAll()
|
|
483
|
+
expect(client.watchedEvents()).toEqual({ 'agent-updated': null, 'link-added': ['p1', 'p2'] })
|
|
484
|
+
offP1()
|
|
485
|
+
expect(client.watchedEvents()).toEqual({ 'agent-updated': null, 'link-added': ['p2'] })
|
|
486
|
+
offP2()
|
|
487
|
+
expect(client.watchedEvents()).toEqual({ 'agent-updated': null })
|
|
488
|
+
})
|
|
489
|
+
|
|
490
|
+
it('sends the executor the watched events on open', async () => {
|
|
491
|
+
TestSocket.autoOpen = false
|
|
492
|
+
client.on('link-added', () => {}, { perspective: 'p1' })
|
|
493
|
+
client.on('agent-updated', () => {})
|
|
494
|
+
await flush()
|
|
495
|
+
socket(0).open()
|
|
496
|
+
|
|
497
|
+
expect(socket(0).sent).toEqual([
|
|
498
|
+
expect.objectContaining({ type: 'events.watch', params: { 'agent-updated': null, 'link-added': ['p1'] } }),
|
|
499
|
+
])
|
|
500
|
+
})
|
|
501
|
+
|
|
502
|
+
it('clears the watch when the last handler goes while a call keeps the socket open', async () => {
|
|
503
|
+
TestSocket.autoOpen = false
|
|
504
|
+
const off = client.on('link-added', () => {})
|
|
505
|
+
await flush()
|
|
506
|
+
socket(0).open()
|
|
507
|
+
const pending = call('agent.get', {})
|
|
508
|
+
off()
|
|
509
|
+
await flush()
|
|
510
|
+
|
|
511
|
+
const watches = socket(0).sent.filter(m => m.type === 'events.watch').map(m => m.params)
|
|
512
|
+
expect(watches).toEqual([{ 'link-added': null }, {}])
|
|
513
|
+
expect(socket(0).readyState).toBe(1)
|
|
514
|
+
socket(0).reply({ id: socket(0).sent.find(m => m.type === 'agent.get')!.id, result: null })
|
|
515
|
+
await pending
|
|
516
|
+
})
|
|
517
|
+
|
|
518
|
+
it('ignores a second registration of the same handler for the same type and perspective', async () => {
|
|
519
|
+
const handler = jest.fn()
|
|
520
|
+
const off = client.on('link-added', handler, { perspective: 'p1' })
|
|
521
|
+
const offAgain = client.on('link-added', handler, { perspective: 'p1' })
|
|
522
|
+
await flush()
|
|
523
|
+
|
|
524
|
+
socket(0).reply(linkAdded('p1'))
|
|
525
|
+
expect(handler).toHaveBeenCalledTimes(1)
|
|
526
|
+
|
|
527
|
+
// Both returned functions release the one registration.
|
|
528
|
+
offAgain()
|
|
529
|
+
expect(client.watchedEvents()).toEqual({})
|
|
530
|
+
off()
|
|
531
|
+
socket(0).reply(linkAdded('p1'))
|
|
532
|
+
expect(handler).toHaveBeenCalledTimes(1)
|
|
533
|
+
})
|
|
534
|
+
|
|
535
|
+
it('treats one handler under two perspectives as two registrations', async () => {
|
|
536
|
+
const handler = jest.fn()
|
|
537
|
+
client.on('link-added', handler, { perspective: 'p1' })
|
|
538
|
+
const offP2 = client.on('link-added', handler, { perspective: 'p2' })
|
|
539
|
+
await flush()
|
|
540
|
+
|
|
541
|
+
offP2()
|
|
542
|
+
socket(0).reply(linkAdded('p1'))
|
|
543
|
+
socket(0).reply(linkAdded('p2'))
|
|
544
|
+
expect(handler).toHaveBeenCalledTimes(1)
|
|
545
|
+
expect(client.watchedEvents()).toEqual({ 'link-added': ['p1'] })
|
|
546
|
+
})
|
|
547
|
+
|
|
548
|
+
it('keeps delivering an event to later handlers when one handler throws', async () => {
|
|
549
|
+
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {})
|
|
550
|
+
const received: string[] = []
|
|
551
|
+
client.on('agent-updated', () => { received.push('first') })
|
|
552
|
+
client.on('agent-updated', () => { throw new Error('boom') })
|
|
553
|
+
client.on('agent-updated', () => { received.push('third') })
|
|
554
|
+
await flush()
|
|
555
|
+
|
|
556
|
+
socket(0).reply(agentUpdated)
|
|
557
|
+
|
|
558
|
+
expect(received).toEqual(['first', 'third'])
|
|
559
|
+
expect(errorSpy).toHaveBeenCalledWith("Error in 'agent-updated' handler:", expect.objectContaining({ message: 'boom' }))
|
|
560
|
+
errorSpy.mockRestore()
|
|
561
|
+
})
|
|
562
|
+
|
|
563
|
+
it('logs a rejection from an async handler instead of leaving it unhandled', async () => {
|
|
564
|
+
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {})
|
|
565
|
+
const unhandled = jest.fn()
|
|
566
|
+
process.on('unhandledRejection', unhandled)
|
|
567
|
+
const received: string[] = []
|
|
568
|
+
client.on('agent-updated', async () => { throw new Error('async boom') })
|
|
569
|
+
client.on('agent-updated', () => { received.push('second') })
|
|
570
|
+
await flush()
|
|
571
|
+
|
|
572
|
+
socket(0).reply(agentUpdated)
|
|
573
|
+
await flush()
|
|
574
|
+
|
|
575
|
+
expect(received).toEqual(['second'])
|
|
576
|
+
expect(errorSpy).toHaveBeenCalledWith("Error in 'agent-updated' handler:", expect.objectContaining({ message: 'async boom' }))
|
|
577
|
+
expect(unhandled).not.toHaveBeenCalled()
|
|
578
|
+
process.off('unhandledRejection', unhandled)
|
|
579
|
+
errorSpy.mockRestore()
|
|
580
|
+
})
|
|
581
|
+
|
|
582
|
+
it('opens no socket until the first handler, and closes it after the last unsubscribe', () => {
|
|
583
|
+
expect(TestSocket.instances).toHaveLength(0)
|
|
584
|
+
const off = client.on('agent-updated', () => {})
|
|
585
|
+
expect(TestSocket.instances).toHaveLength(1)
|
|
586
|
+
|
|
587
|
+
off()
|
|
588
|
+
expect(socket(0).readyState).toBe(3)
|
|
589
|
+
})
|
|
590
|
+
})
|
|
591
|
+
|
|
592
|
+
describe('PerspectiveProxy.on', () => {
|
|
593
|
+
const proxyFor = (uuid: string) => new PerspectiveProxy(
|
|
594
|
+
new PerspectiveHandle(uuid, uuid),
|
|
595
|
+
new PerspectiveClient(url, undefined, client),
|
|
596
|
+
)
|
|
597
|
+
|
|
598
|
+
it("delivers only the proxy's perspective's events", async () => {
|
|
599
|
+
const received: string[] = []
|
|
600
|
+
proxyFor('p1').on('link-added', ({ link }) => { received.push(link.data.target) })
|
|
601
|
+
await flush()
|
|
602
|
+
|
|
603
|
+
socket(0).reply(linkAdded('p2', 'literal://other'))
|
|
604
|
+
socket(0).reply(linkAdded('p1', 'literal://mine'))
|
|
605
|
+
|
|
606
|
+
expect(received).toEqual(['literal://mine'])
|
|
607
|
+
expect(client.watchedEvents()).toEqual({ 'link-added': ['p1'] })
|
|
608
|
+
})
|
|
609
|
+
|
|
610
|
+
it('releases every handler it registered on dispose() and leaves other proxies\' handlers', async () => {
|
|
611
|
+
const mine = jest.fn()
|
|
612
|
+
const other = jest.fn()
|
|
613
|
+
const proxy = proxyFor('p1')
|
|
614
|
+
const sibling = proxyFor('p1')
|
|
615
|
+
proxy.on('link-added', mine)
|
|
616
|
+
proxy.on('link-removed', mine)
|
|
617
|
+
proxy.on('sync-state-change', mine)
|
|
618
|
+
sibling.on('link-added', other)
|
|
619
|
+
await flush()
|
|
620
|
+
|
|
621
|
+
proxy.dispose()
|
|
622
|
+
expect(client.watchedEvents()).toEqual({ 'link-added': ['p1'] })
|
|
623
|
+
|
|
624
|
+
socket(0).reply(linkAdded('p1'))
|
|
625
|
+
expect(mine).not.toHaveBeenCalled()
|
|
626
|
+
expect(other).toHaveBeenCalledTimes(1)
|
|
627
|
+
})
|
|
628
|
+
|
|
629
|
+
it("a proxy's dispose() leaves another proxy's registration of the same function", async () => {
|
|
630
|
+
const shared = jest.fn()
|
|
631
|
+
const proxy = proxyFor('p1')
|
|
632
|
+
const sibling = proxyFor('p1')
|
|
633
|
+
proxy.on('link-added', shared)
|
|
634
|
+
sibling.on('link-added', shared)
|
|
635
|
+
await flush()
|
|
636
|
+
|
|
637
|
+
proxy.dispose()
|
|
638
|
+
socket(0).reply(linkAdded('p1'))
|
|
639
|
+
expect(shared).toHaveBeenCalledTimes(1)
|
|
640
|
+
})
|
|
641
|
+
|
|
642
|
+
it('does not release a handler twice when its function runs before dispose()', async () => {
|
|
643
|
+
const proxy = proxyFor('p1')
|
|
644
|
+
const handler = jest.fn()
|
|
645
|
+
const off = proxy.on('link-added', handler)
|
|
646
|
+
off()
|
|
647
|
+
// The client now holds a new registration of the same handler; dispose() must not drop it.
|
|
648
|
+
client.on('link-added', handler, { perspective: 'p1' })
|
|
649
|
+
proxy.dispose()
|
|
650
|
+
await flush()
|
|
651
|
+
|
|
652
|
+
socket(0).reply(linkAdded('p1'))
|
|
653
|
+
expect(handler).toHaveBeenCalledTimes(1)
|
|
226
654
|
})
|
|
227
655
|
})
|