@coasys/ad4m 0.12.1-dev → 0.13.0-postmessage-ws-proxy.3
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 +2 -25
- package/jest-setup.ts +1 -1
- package/lib/index.cjs +8677 -15318
- package/lib/index.js +14507 -21223
- package/lib/src/Ad4mClient.d.ts +9 -3
- package/lib/src/Ad4mClient.js +40 -13
- package/lib/src/Literal.js +6 -5
- package/lib/src/agent/Agent.js +26 -272
- package/lib/src/agent/AgentClient.d.ts +33 -21
- package/lib/src/agent/AgentClient.js +180 -374
- package/lib/src/agent/AgentStatus.js +2 -37
- package/lib/src/ai/AIClient.d.ts +12 -4
- package/lib/src/ai/AIClient.js +81 -285
- package/lib/src/ai/AITypes.d.ts +55 -0
- package/lib/src/ai/AITypes.js +18 -0
- package/lib/src/ai/Tasks.js +10 -133
- package/lib/src/apiClient.d.ts +53 -0
- package/lib/src/apiClient.js +234 -0
- package/lib/src/cache/PersistentCache.d.ts +40 -0
- package/lib/src/cache/PersistentCache.js +139 -0
- package/lib/src/expression/Expression.d.ts +1 -1
- package/lib/src/expression/Expression.js +13 -122
- package/lib/src/expression/ExpressionClient.d.ts +11 -3
- package/lib/src/expression/ExpressionClient.js +120 -75
- package/lib/src/expression/ExpressionRef.js +4 -27
- package/lib/src/generated/api/AIModelLoadingStatus.d.ts +7 -0
- package/lib/src/generated/api/AIModelLoadingStatus.js +2 -0
- package/lib/src/generated/api/AddLinkExpressionRequest.d.ts +6 -0
- package/lib/src/generated/api/AddLinkExpressionRequest.js +1 -0
- package/lib/src/generated/api/AddLinkRequest.d.ts +6 -0
- package/lib/src/generated/api/AddLinkRequest.js +1 -0
- package/lib/src/generated/api/AddLinksBulkRequest.d.ts +6 -0
- package/lib/src/generated/api/AddLinksBulkRequest.js +1 -0
- package/lib/src/generated/api/AddSdnaRequest.d.ts +6 -0
- package/lib/src/generated/api/AddSdnaRequest.js +2 -0
- package/lib/src/generated/api/ApplyTemplateRequest.d.ts +4 -0
- package/lib/src/generated/api/ApplyTemplateRequest.js +2 -0
- package/lib/src/generated/api/AuthInfoInput.d.ts +10 -0
- package/lib/src/generated/api/AuthInfoInput.js +1 -0
- package/lib/src/generated/api/CapabilityInput.d.ts +5 -0
- package/lib/src/generated/api/CapabilityInput.js +1 -0
- package/lib/src/generated/api/CommitBatchRequest.d.ts +3 -0
- package/lib/src/generated/api/CommitBatchRequest.js +2 -0
- package/lib/src/generated/api/ComputeLogEntry.d.ts +9 -0
- package/lib/src/generated/api/ComputeLogEntry.js +2 -0
- package/lib/src/generated/api/CreateExpressionRequest.d.ts +4 -0
- package/lib/src/generated/api/CreateExpressionRequest.js +2 -0
- package/lib/src/generated/api/CreatePerspectiveRequest.d.ts +3 -0
- package/lib/src/generated/api/CreatePerspectiveRequest.js +2 -0
- package/lib/src/generated/api/CreateSubjectRequest.d.ts +6 -0
- package/lib/src/generated/api/CreateSubjectRequest.js +2 -0
- package/lib/src/generated/api/EmbedRequest.d.ts +4 -0
- package/lib/src/generated/api/EmbedRequest.js +2 -0
- package/lib/src/generated/api/EntanglementProofInput.d.ts +6 -0
- package/lib/src/generated/api/EntanglementProofInput.js +2 -0
- package/lib/src/generated/api/ExecuteCommandsRequest.d.ts +4 -0
- package/lib/src/generated/api/ExecuteCommandsRequest.js +2 -0
- package/lib/src/generated/api/ExportRequest.d.ts +5 -0
- package/lib/src/generated/api/ExportRequest.js +2 -0
- package/lib/src/generated/api/ExpressionManyRequest.d.ts +3 -0
- package/lib/src/generated/api/ExpressionManyRequest.js +2 -0
- package/lib/src/generated/api/ExpressionProof.d.ts +4 -0
- package/lib/src/generated/api/ExpressionProof.js +2 -0
- package/lib/src/generated/api/ExpressionProofInput.d.ts +6 -0
- package/lib/src/generated/api/ExpressionProofInput.js +2 -0
- package/lib/src/generated/api/FriendSendMessageRequest.d.ts +3 -0
- package/lib/src/generated/api/FriendSendMessageRequest.js +2 -0
- package/lib/src/generated/api/FriendsListRequest.d.ts +3 -0
- package/lib/src/generated/api/FriendsListRequest.js +2 -0
- package/lib/src/generated/api/GenerateAgentRequest.d.ts +3 -0
- package/lib/src/generated/api/GenerateAgentRequest.js +2 -0
- package/lib/src/generated/api/GenerateJwtRequest.d.ts +4 -0
- package/lib/src/generated/api/GenerateJwtRequest.js +2 -0
- package/lib/src/generated/api/GetSubjectDataRequest.d.ts +4 -0
- package/lib/src/generated/api/GetSubjectDataRequest.js +2 -0
- package/lib/src/generated/api/ImportAgentRequest.d.ts +6 -0
- package/lib/src/generated/api/ImportAgentRequest.js +2 -0
- package/lib/src/generated/api/ImportRequest.d.ts +4 -0
- package/lib/src/generated/api/ImportRequest.js +2 -0
- package/lib/src/generated/api/JoinNeighbourhoodRequest.d.ts +3 -0
- package/lib/src/generated/api/JoinNeighbourhoodRequest.js +2 -0
- package/lib/src/generated/api/LanguageMetaInput.d.ts +6 -0
- package/lib/src/generated/api/LanguageMetaInput.js +2 -0
- package/lib/src/generated/api/Link.d.ts +5 -0
- package/lib/src/generated/api/Link.js +2 -0
- package/lib/src/generated/api/LinkExpression.d.ts +10 -0
- package/lib/src/generated/api/LinkExpression.js +1 -0
- package/lib/src/generated/api/LinkExpressionInput.d.ts +10 -0
- package/lib/src/generated/api/LinkExpressionInput.js +1 -0
- package/lib/src/generated/api/LinkInput.d.ts +5 -0
- package/lib/src/generated/api/LinkInput.js +2 -0
- package/lib/src/generated/api/LinkLanguageTemplatesRequest.d.ts +3 -0
- package/lib/src/generated/api/LinkLanguageTemplatesRequest.js +2 -0
- package/lib/src/generated/api/LinkMutations.d.ts +6 -0
- package/lib/src/generated/api/LinkMutations.js +1 -0
- package/lib/src/generated/api/LinkStatus.d.ts +1 -0
- package/lib/src/generated/api/LinkStatus.js +2 -0
- package/lib/src/generated/api/LockAgentRequest.d.ts +3 -0
- package/lib/src/generated/api/LockAgentRequest.js +2 -0
- package/lib/src/generated/api/ModelType.d.ts +1 -0
- package/lib/src/generated/api/ModelType.js +2 -0
- package/lib/src/generated/api/NotificationInput.d.ts +10 -0
- package/lib/src/generated/api/NotificationInput.js +2 -0
- package/lib/src/generated/api/OpenLinkRequest.d.ts +3 -0
- package/lib/src/generated/api/OpenLinkRequest.js +2 -0
- package/lib/src/generated/api/PermitCapabilityRequest.d.ts +3 -0
- package/lib/src/generated/api/PermitCapabilityRequest.js +2 -0
- package/lib/src/generated/api/PerspectiveInput.d.ts +4 -0
- package/lib/src/generated/api/PerspectiveInput.js +1 -0
- package/lib/src/generated/api/PromptRequest.d.ts +4 -0
- package/lib/src/generated/api/PromptRequest.js +2 -0
- package/lib/src/generated/api/PublishLanguageRequest.d.ts +5 -0
- package/lib/src/generated/api/PublishLanguageRequest.js +1 -0
- package/lib/src/generated/api/PublishNeighbourhoodRequest.d.ts +6 -0
- package/lib/src/generated/api/PublishNeighbourhoodRequest.js +1 -0
- package/lib/src/generated/api/QueryRequest.d.ts +7 -0
- package/lib/src/generated/api/QueryRequest.js +2 -0
- package/lib/src/generated/api/RemoveLinkRequest.d.ts +5 -0
- package/lib/src/generated/api/RemoveLinkRequest.js +1 -0
- package/lib/src/generated/api/RemoveLinksBulkRequest.d.ts +5 -0
- package/lib/src/generated/api/RemoveLinksBulkRequest.js +1 -0
- package/lib/src/generated/api/ResourceInput.d.ts +4 -0
- package/lib/src/generated/api/ResourceInput.js +2 -0
- package/lib/src/generated/api/SetDefaultModelRequest.d.ts +4 -0
- package/lib/src/generated/api/SetDefaultModelRequest.js +1 -0
- package/lib/src/generated/api/SetFreeHostingEnabledRequest.d.ts +3 -0
- package/lib/src/generated/api/SetFreeHostingEnabledRequest.js +2 -0
- package/lib/src/generated/api/SetMultiUserRequest.d.ts +3 -0
- package/lib/src/generated/api/SetMultiUserRequest.js +2 -0
- package/lib/src/generated/api/SetStatusRequest.d.ts +3 -0
- package/lib/src/generated/api/SetStatusRequest.js +2 -0
- package/lib/src/generated/api/SignMessageRequest.d.ts +3 -0
- package/lib/src/generated/api/SignMessageRequest.js +2 -0
- package/lib/src/generated/api/TrustedAgentsRequest.d.ts +3 -0
- package/lib/src/generated/api/TrustedAgentsRequest.js +2 -0
- package/lib/src/generated/api/UnlockAgentRequest.d.ts +4 -0
- package/lib/src/generated/api/UnlockAgentRequest.js +2 -0
- package/lib/src/generated/api/UpdateLinkRequest.d.ts +7 -0
- package/lib/src/generated/api/UpdateLinkRequest.js +1 -0
- package/lib/src/generated/api/UpdatePerspectiveRequest.d.ts +3 -0
- package/lib/src/generated/api/UpdatePerspectiveRequest.js +2 -0
- package/lib/src/generated/api/UserStatistics.d.ts +9 -0
- package/lib/src/generated/api/UserStatistics.js +2 -0
- package/lib/src/generated/api/VerificationRequestResult.d.ts +6 -0
- package/lib/src/generated/api/VerificationRequestResult.js +2 -0
- package/lib/src/generated/api/VerifySignatureRequest.d.ts +5 -0
- package/lib/src/generated/api/VerifySignatureRequest.js +2 -0
- package/lib/src/generated/api/WriteSettingsRequest.d.ts +3 -0
- package/lib/src/generated/api/WriteSettingsRequest.js +2 -0
- package/lib/src/generated/api/index.d.ts +42 -0
- package/lib/src/generated/api/index.js +7 -0
- package/lib/src/index.d.ts +8 -2
- package/lib/src/index.js +8 -2
- package/lib/src/jestSetup.d.ts +0 -1
- package/lib/src/jestSetup.js +1 -1
- package/lib/src/language/Icon.js +2 -21
- package/lib/src/language/Language.d.ts +26 -176
- package/lib/src/language/Language.js +32 -72
- package/lib/src/language/LanguageClient.d.ts +2 -2
- package/lib/src/language/LanguageClient.js +15 -105
- package/lib/src/language/LanguageHandle.js +2 -41
- package/lib/src/language/LanguageMeta.js +4 -75
- package/lib/src/language/LanguageRef.js +2 -25
- package/lib/src/links/Links.js +14 -111
- package/lib/src/model/Ad4mModel.d.ts +143 -63
- package/lib/src/model/Ad4mModel.js +583 -425
- package/lib/src/model/Ad4mModel.test.js +1434 -688
- package/lib/src/model/ModelQueryBuilder.d.ts +61 -45
- package/lib/src/model/ModelQueryBuilder.js +315 -157
- package/lib/src/model/Subject.js +6 -6
- package/lib/src/model/decorators.d.ts +36 -8
- package/lib/src/model/decorators.js +41 -14
- package/lib/src/model/hydration-batch.d.ts +34 -0
- package/lib/src/model/hydration-batch.js +147 -0
- package/lib/src/model/hydration-batching.test.d.ts +7 -0
- package/lib/src/model/hydration-batching.test.js +456 -0
- package/lib/src/model/hydration.d.ts +3 -92
- package/lib/src/model/hydration.js +3 -691
- package/lib/src/model/index.d.ts +3 -4
- package/lib/src/model/index.js +3 -4
- package/lib/src/model/json-schema.js +2 -2
- package/lib/src/model/model-manifest.d.ts +41 -0
- package/lib/src/model/model-manifest.js +11 -0
- package/lib/src/model/query-cache.d.ts +30 -0
- package/lib/src/model/query-cache.js +66 -0
- package/lib/src/model/query-cache.test.d.ts +1 -0
- package/lib/src/model/query-cache.test.js +43 -0
- package/lib/src/model/query-common.d.ts +1 -1
- package/lib/src/model/query-common.js +1 -1
- package/lib/src/model/query-sparql-batch.d.ts +17 -0
- package/lib/src/model/query-sparql-batch.js +260 -0
- package/lib/src/model/query-sparql.d.ts +51 -0
- package/lib/src/model/query-sparql.js +466 -0
- package/lib/src/model/query-sparql.test.d.ts +1 -0
- package/lib/src/model/query-sparql.test.js +312 -0
- package/lib/src/model/{surreal-utils.d.ts → query-utils.d.ts} +13 -9
- package/lib/src/model/query-utils.js +189 -0
- package/lib/src/model/relation-filtering.test.js +15 -15
- package/lib/src/model/sdna.js +1 -1
- package/lib/src/model/shacl-gen.js +154 -57
- package/lib/src/model/subscription-delta.test.d.ts +24 -0
- package/lib/src/model/subscription-delta.test.js +180 -0
- package/lib/src/model/subscription-pool.d.ts +39 -0
- package/lib/src/model/subscription-pool.js +165 -0
- package/lib/src/model/types.d.ts +195 -5
- package/lib/src/model/types.js +5 -2
- package/lib/src/neighbourhood/Neighbourhood.js +4 -32
- package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +3 -3
- package/lib/src/neighbourhood/NeighbourhoodClient.js +40 -203
- package/lib/src/perspectives/LinkQuery.js +2 -42
- package/lib/src/perspectives/Perspective.d.ts +1 -1
- package/lib/src/perspectives/Perspective.js +10 -52
- package/lib/src/perspectives/PerspectiveClient.d.ts +22 -32
- package/lib/src/perspectives/PerspectiveClient.js +188 -454
- package/lib/src/perspectives/PerspectiveClient.test.d.ts +1 -0
- package/lib/src/perspectives/PerspectiveClient.test.js +224 -0
- package/lib/src/perspectives/PerspectiveDiff.js +4 -31
- package/lib/src/perspectives/PerspectiveHandle.js +3 -43
- package/lib/src/perspectives/PerspectiveProxy.d.ts +157 -78
- package/lib/src/perspectives/PerspectiveProxy.js +475 -389
- package/lib/src/perspectives/PerspectiveResolver.d.ts +0 -1
- package/lib/src/perspectives/PerspectiveResolver.js +0 -11
- package/lib/src/perspectives/SparqlBindings.d.ts +47 -0
- package/lib/src/perspectives/SparqlBindings.js +65 -0
- package/lib/src/perspectives/WakerSubscriptionManager.d.ts +3 -3
- package/lib/src/perspectives/WakerSubscriptionManager.js +12 -12
- package/lib/src/runtime/RuntimeClient.d.ts +8 -6
- package/lib/src/runtime/RuntimeClient.js +97 -454
- package/lib/src/runtime/RuntimeResolver.d.ts +14 -0
- package/lib/src/runtime/RuntimeResolver.js +84 -0
- package/lib/src/runtime/RuntimeTypes.d.ts +101 -0
- package/lib/src/runtime/RuntimeTypes.js +45 -0
- package/lib/src/schema.gql +14 -1
- package/lib/src/shacl/SHACLFlow.d.ts +1 -1
- package/lib/src/shacl/SHACLFlow.js +9 -9
- package/lib/src/shacl/SHACLShape.d.ts +26 -1
- package/lib/src/shacl/SHACLShape.js +140 -38
- package/lib/src/shacl/SHACLShape.test.js +82 -0
- package/lib/src/typeDefs.js +3 -615
- package/lib/src/utils.d.ts +6 -6
- package/lib/src/utils.js +6 -6
- package/package.json +9 -24
- package/rollup.config.js +0 -7
- package/src/Ad4mClient.test.ts +1192 -1288
- package/src/Ad4mClient.ts +46 -15
- package/src/Literal.test.ts +10 -5
- package/src/Literal.ts +6 -5
- package/src/agent/Agent.ts +0 -99
- package/src/agent/AgentClient.ts +238 -467
- package/src/agent/AgentStatus.ts +0 -12
- package/src/ai/AIClient.ts +96 -296
- package/src/ai/AITypes.ts +66 -0
- package/src/ai/Tasks.ts +0 -52
- package/src/apiClient.ts +287 -0
- package/src/cache/PersistentCache.ts +145 -0
- package/src/cache/cache.test.ts +713 -0
- package/src/expression/Expression.ts +3 -43
- package/src/expression/ExpressionClient.ts +148 -77
- package/src/expression/ExpressionRef.ts +2 -8
- package/src/generated/api/AIModelLoadingStatus.ts +3 -0
- package/src/generated/api/AddLinkExpressionRequest.ts +4 -0
- package/src/generated/api/AddLinkRequest.ts +4 -0
- package/src/generated/api/AddLinksBulkRequest.ts +4 -0
- package/src/generated/api/AddSdnaRequest.ts +3 -0
- package/src/generated/api/ApplyTemplateRequest.ts +3 -0
- package/src/generated/api/AuthInfoInput.ts +4 -0
- package/src/generated/api/CapabilityInput.ts +4 -0
- package/src/generated/api/CommitBatchRequest.ts +3 -0
- package/src/generated/api/ComputeLogEntry.ts +3 -0
- package/src/generated/api/CreateExpressionRequest.ts +3 -0
- package/src/generated/api/CreatePerspectiveRequest.ts +3 -0
- package/src/generated/api/CreateSubjectRequest.ts +3 -0
- package/src/generated/api/EmbedRequest.ts +3 -0
- package/src/generated/api/EntanglementProofInput.ts +3 -0
- package/src/generated/api/ExecuteCommandsRequest.ts +3 -0
- package/src/generated/api/ExportRequest.ts +3 -0
- package/src/generated/api/ExpressionManyRequest.ts +3 -0
- package/src/generated/api/ExpressionProof.ts +3 -0
- package/src/generated/api/ExpressionProofInput.ts +3 -0
- package/src/generated/api/FriendSendMessageRequest.ts +3 -0
- package/src/generated/api/FriendsListRequest.ts +3 -0
- package/src/generated/api/GenerateAgentRequest.ts +3 -0
- package/src/generated/api/GenerateJwtRequest.ts +3 -0
- package/src/generated/api/GetSubjectDataRequest.ts +3 -0
- package/src/generated/api/ImportAgentRequest.ts +3 -0
- package/src/generated/api/ImportRequest.ts +3 -0
- package/src/generated/api/JoinNeighbourhoodRequest.ts +3 -0
- package/src/generated/api/LanguageMetaInput.ts +3 -0
- package/src/generated/api/Link.ts +3 -0
- package/src/generated/api/LinkExpression.ts +6 -0
- package/src/generated/api/LinkExpressionInput.ts +6 -0
- package/src/generated/api/LinkInput.ts +3 -0
- package/src/generated/api/LinkLanguageTemplatesRequest.ts +3 -0
- package/src/generated/api/LinkMutations.ts +5 -0
- package/src/generated/api/LinkStatus.ts +3 -0
- package/src/generated/api/LockAgentRequest.ts +3 -0
- package/src/generated/api/ModelType.ts +3 -0
- package/src/generated/api/NotificationInput.ts +3 -0
- package/src/generated/api/OpenLinkRequest.ts +3 -0
- package/src/generated/api/PermitCapabilityRequest.ts +3 -0
- package/src/generated/api/PerspectiveInput.ts +4 -0
- package/src/generated/api/PromptRequest.ts +3 -0
- package/src/generated/api/PublishLanguageRequest.ts +4 -0
- package/src/generated/api/PublishNeighbourhoodRequest.ts +4 -0
- package/src/generated/api/QueryRequest.ts +6 -0
- package/src/generated/api/RemoveLinkRequest.ts +4 -0
- package/src/generated/api/RemoveLinksBulkRequest.ts +4 -0
- package/src/generated/api/ResourceInput.ts +3 -0
- package/src/generated/api/SetDefaultModelRequest.ts +4 -0
- package/src/generated/api/SetFreeHostingEnabledRequest.ts +3 -0
- package/src/generated/api/SetMultiUserRequest.ts +3 -0
- package/src/generated/api/SetStatusRequest.ts +3 -0
- package/src/generated/api/SignMessageRequest.ts +3 -0
- package/src/generated/api/TrustedAgentsRequest.ts +3 -0
- package/src/generated/api/UnlockAgentRequest.ts +3 -0
- package/src/generated/api/UpdateLinkRequest.ts +5 -0
- package/src/generated/api/UpdatePerspectiveRequest.ts +3 -0
- package/src/generated/api/UserStatistics.ts +3 -0
- package/src/generated/api/VerificationRequestResult.ts +3 -0
- package/src/generated/api/VerifySignatureRequest.ts +3 -0
- package/src/generated/api/WriteSettingsRequest.ts +3 -0
- package/src/generated/api/index.ts +49 -0
- package/src/index.ts +8 -2
- package/src/jestSetup.ts +1 -1
- package/src/language/Icon.ts +0 -4
- package/src/language/Language.ts +51 -248
- package/src/language/LanguageClient.ts +21 -132
- package/src/language/LanguageHandle.ts +0 -14
- package/src/language/LanguageMeta.ts +0 -29
- package/src/language/LanguageRef.ts +0 -7
- package/src/links/Links.ts +0 -37
- package/src/model/Ad4mModel.test.ts +1664 -792
- package/src/model/Ad4mModel.ts +664 -499
- package/src/model/ModelQueryBuilder.ts +362 -183
- package/src/model/decorators.ts +71 -22
- package/src/model/hydration.ts +3 -772
- package/src/model/index.ts +3 -4
- package/src/model/json-schema.ts +2 -2
- package/src/model/query-cache.test.ts +54 -0
- package/src/model/query-cache.ts +79 -0
- package/src/model/query-common.ts +1 -1
- package/src/model/query-sparql.test.ts +376 -0
- package/src/model/query-sparql.ts +504 -0
- package/src/model/query-utils.ts +209 -0
- package/src/model/relation-filtering.test.ts +60 -53
- package/src/model/sdna.ts +1 -1
- package/src/model/shacl-gen.ts +163 -64
- package/src/model/shacl-roundtrip.test.ts +197 -0
- package/src/model/types-typed-query.test.ts +360 -0
- package/src/model/types.ts +256 -5
- package/src/neighbourhood/Neighbourhood.ts +0 -9
- package/src/neighbourhood/NeighbourhoodClient.ts +42 -207
- package/src/neighbourhood/NeighbourhoodProxy.test.ts +34 -36
- package/src/perspectives/LinkQuery.ts +0 -15
- package/src/perspectives/Perspective.ts +1 -12
- package/src/perspectives/PerspectiveClient.test.ts +262 -0
- package/src/perspectives/PerspectiveClient.ts +252 -468
- package/src/perspectives/PerspectiveDiff.ts +0 -8
- package/src/perspectives/PerspectiveHandle.ts +1 -12
- package/src/perspectives/PerspectiveProxy.test.ts +125 -0
- package/src/perspectives/PerspectiveProxy.ts +522 -434
- package/src/perspectives/SparqlBindings.ts +79 -0
- package/src/perspectives/WakerSubscriptionManager.ts +13 -13
- package/src/runtime/RuntimeClient.ts +118 -461
- package/src/runtime/RuntimeTypes.ts +144 -0
- package/src/shacl/SHACLFlow.ts +9 -9
- package/src/shacl/SHACLShape.test.ts +204 -0
- package/src/shacl/SHACLShape.ts +191 -39
- package/src/typeDefs.ts +3 -5
- package/src/utils.ts +6 -6
- package/tsconfig.json +3 -7
- package/lib/src/model/query-surreal.d.ts +0 -44
- package/lib/src/model/query-surreal.js +0 -249
- package/lib/src/model/surreal-utils.js +0 -128
- package/shims/reflect-metadata.ts +0 -0
- package/shims/type-graphql.ts +0 -75
- package/src/PubSub.ts +0 -17
- package/src/agent/AgentResolver.ts +0 -263
- package/src/ai/AIResolver.ts +0 -372
- package/src/buildSchema.ts +0 -43
- package/src/expression/ExpressionResolver.ts +0 -64
- package/src/language/LanguageContext.ts +0 -37
- package/src/language/LanguageResolver.ts +0 -98
- package/src/model/Subject.ts +0 -159
- package/src/model/prolog-facts.ts +0 -145
- package/src/model/query-prolog.ts +0 -148
- package/src/model/query-surreal.ts +0 -280
- package/src/model/surreal-utils.ts +0 -147
- package/src/neighbourhood/NeighbourhoodResolver.ts +0 -100
- package/src/perspectives/PerspectiveResolver.ts +0 -372
- package/src/runtime/RuntimeResolver.ts +0 -691
- package/src/unwrapApolloResult.ts +0 -16
- package/tsconfig-browser.json +0 -82
package/src/Ad4mClient.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ApolloClient } from '@apollo/client/core'
|
|
2
1
|
import { AgentClient } from './agent/AgentClient'
|
|
3
2
|
import { LanguageClient } from './language/LanguageClient'
|
|
4
3
|
import { NeighbourhoodClient } from './neighbourhood/NeighbourhoodClient'
|
|
@@ -6,9 +5,11 @@ import { PerspectiveClient } from './perspectives/PerspectiveClient'
|
|
|
6
5
|
import { RuntimeClient } from './runtime/RuntimeClient'
|
|
7
6
|
import { ExpressionClient } from './expression/ExpressionClient'
|
|
8
7
|
import { AIClient } from './ai/AIClient'
|
|
8
|
+
import { ApiClient } from './apiClient'
|
|
9
|
+
import { Ad4mModel } from './model/Ad4mModel'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
* Client for the Ad4m interface wrapping
|
|
12
|
+
* Client for the Ad4m interface wrapping WebSocket RPC calls
|
|
12
13
|
* for convenient use in user facing code.
|
|
13
14
|
*
|
|
14
15
|
* Aggregates the six sub-clients:
|
|
@@ -17,7 +18,9 @@ import { AIClient } from './ai/AIClient'
|
|
|
17
18
|
* for the respective functionality.
|
|
18
19
|
*/
|
|
19
20
|
export class Ad4mClient {
|
|
20
|
-
#
|
|
21
|
+
#baseUrl: string
|
|
22
|
+
#token?: string
|
|
23
|
+
#apiClient: ApiClient
|
|
21
24
|
#agentClient: AgentClient
|
|
22
25
|
#expressionClient: ExpressionClient
|
|
23
26
|
#languageClient: LanguageClient
|
|
@@ -26,20 +29,34 @@ export class Ad4mClient {
|
|
|
26
29
|
#runtimeClient: RuntimeClient
|
|
27
30
|
#aiClient: AIClient
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.#
|
|
36
|
-
this.#
|
|
37
|
-
this.#
|
|
32
|
+
constructor(
|
|
33
|
+
baseUrl: string,
|
|
34
|
+
token?: string,
|
|
35
|
+
subscribe: boolean = true,
|
|
36
|
+
options?: { webSocketImpl?: new (url: string) => WebSocket }
|
|
37
|
+
) {
|
|
38
|
+
this.#baseUrl = baseUrl
|
|
39
|
+
this.#token = token
|
|
40
|
+
this.#apiClient = new ApiClient(baseUrl, token, options?.webSocketImpl)
|
|
41
|
+
this.#agentClient = new AgentClient(baseUrl, token, subscribe, this.#apiClient)
|
|
42
|
+
this.#expressionClient = new ExpressionClient(baseUrl, token, this.#apiClient)
|
|
43
|
+
this.#languageClient = new LanguageClient(baseUrl, token, this.#apiClient)
|
|
44
|
+
this.#neighbourhoodClient = new NeighbourhoodClient(baseUrl, token, this.#apiClient)
|
|
45
|
+
this.#aiClient = new AIClient(baseUrl, token, subscribe, this.#apiClient)
|
|
46
|
+
this.#perspectiveClient = new PerspectiveClient(baseUrl, token, subscribe, this.#apiClient)
|
|
38
47
|
this.#perspectiveClient.setExpressionClient(this.#expressionClient)
|
|
39
48
|
this.#perspectiveClient.setNeighbourhoodClient(this.#neighbourhoodClient)
|
|
40
49
|
this.#perspectiveClient.setAIClient(this.#aiClient)
|
|
41
|
-
this.#runtimeClient = new RuntimeClient(
|
|
42
|
-
|
|
50
|
+
this.#runtimeClient = new RuntimeClient(baseUrl, token, subscribe, this.#apiClient)
|
|
51
|
+
|
|
52
|
+
// Register with AD4M DevTools if the bridge is installed (e.g. browser extension)
|
|
53
|
+
try {
|
|
54
|
+
const dt = (globalThis as any).__AD4M_DEVTOOLS__;
|
|
55
|
+
if (dt) {
|
|
56
|
+
dt._client = this;
|
|
57
|
+
dt._Ad4mModel = Ad4mModel;
|
|
58
|
+
}
|
|
59
|
+
} catch {}
|
|
43
60
|
}
|
|
44
61
|
|
|
45
62
|
get agent(): AgentClient {
|
|
@@ -69,4 +86,18 @@ export class Ad4mClient {
|
|
|
69
86
|
get ai(): AIClient {
|
|
70
87
|
return this.#aiClient
|
|
71
88
|
}
|
|
72
|
-
|
|
89
|
+
|
|
90
|
+
/** Start event subscriptions (agent-updated, agent-status-changed, apps-changed).
|
|
91
|
+
* Safe to call if subscriptions were deferred at construction (subscribe=false). */
|
|
92
|
+
startSubscriptions(): void {
|
|
93
|
+
this.#agentClient.subscribeAgentUpdated()
|
|
94
|
+
this.#agentClient.subscribeAgentStatusChanged()
|
|
95
|
+
this.#agentClient.subscribeAppsChanged()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Close all event connections and clear in-memory caches */
|
|
99
|
+
close(): void {
|
|
100
|
+
this.#agentClient.clearByDidCache()
|
|
101
|
+
this.#apiClient.closeAll()
|
|
102
|
+
}
|
|
103
|
+
}
|
package/src/Literal.test.ts
CHANGED
|
@@ -3,29 +3,34 @@ import { Literal } from './Literal'
|
|
|
3
3
|
describe("Literal", () => {
|
|
4
4
|
it("can handle strings", () => {
|
|
5
5
|
const testString = "test string"
|
|
6
|
-
const testUrl = "literal
|
|
6
|
+
const testUrl = "literal:string:test%20string"
|
|
7
7
|
expect(Literal.from(testString).toUrl()).toBe(testUrl)
|
|
8
8
|
expect(Literal.fromUrl(testUrl).get()).toBe(testString)
|
|
9
9
|
})
|
|
10
10
|
|
|
11
11
|
it("can handle numbers", () => {
|
|
12
12
|
const testNumber = 3.1415
|
|
13
|
-
const testUrl = "literal
|
|
13
|
+
const testUrl = "literal:number:3.1415"
|
|
14
14
|
expect(Literal.from(testNumber).toUrl()).toBe(testUrl)
|
|
15
15
|
expect(Literal.fromUrl(testUrl).get()).toBe(testNumber)
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
it("can handle objects", () => {
|
|
19
19
|
const testObject = {testNumber: "1337", testString: "test"}
|
|
20
|
-
const testUrl = "literal
|
|
20
|
+
const testUrl = "literal:json:%7B%22testNumber%22%3A%221337%22%2C%22testString%22%3A%22test%22%7D"
|
|
21
21
|
expect(Literal.from(testObject).toUrl()).toBe(testUrl)
|
|
22
22
|
expect(Literal.fromUrl(testUrl).get()).toStrictEqual(testObject)
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
it("can handle special characters", () => {
|
|
26
26
|
const testString = "message(X) :- triple('ad4m://self', _, X)."
|
|
27
|
-
const testUrl = "literal
|
|
27
|
+
const testUrl = "literal:string:message%28X%29%20%3A-%20triple%28%27ad4m%3A%2F%2Fself%27%2C%20_%2C%20X%29."
|
|
28
28
|
expect(Literal.from(testString).toUrl()).toBe(testUrl)
|
|
29
29
|
expect(Literal.fromUrl(testUrl).get()).toBe(testString)
|
|
30
30
|
})
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
it("rejects legacy literal:// URLs", () => {
|
|
33
|
+
expect(() => Literal.fromUrl("literal://string:hello")).toThrow("literal:// format is no longer supported")
|
|
34
|
+
expect(() => Literal.fromUrl("literal://number:42")).toThrow("literal:// format is no longer supported")
|
|
35
|
+
})
|
|
36
|
+
})
|
package/src/Literal.ts
CHANGED
|
@@ -11,8 +11,10 @@ export class Literal {
|
|
|
11
11
|
#url?: string
|
|
12
12
|
|
|
13
13
|
public static fromUrl(url: string) {
|
|
14
|
-
if(!url || !url.startsWith("literal
|
|
14
|
+
if(!url || !url.startsWith("literal:"))
|
|
15
15
|
throw new Error("Can't create Literal from non-literal URL")
|
|
16
|
+
if(url.startsWith("literal://"))
|
|
17
|
+
throw new Error("literal:// format is no longer supported. Use literal: instead.")
|
|
16
18
|
const l = new Literal()
|
|
17
19
|
l.#url = url
|
|
18
20
|
return l
|
|
@@ -46,7 +48,7 @@ export class Literal {
|
|
|
46
48
|
break;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
return `literal
|
|
51
|
+
return `literal:${encoded}`
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
get(): any {
|
|
@@ -56,11 +58,10 @@ export class Literal {
|
|
|
56
58
|
if(!this.#url)
|
|
57
59
|
throw new Error("Can't render empty Literal")
|
|
58
60
|
|
|
59
|
-
if(!this.#url.startsWith("literal
|
|
61
|
+
if(!this.#url.startsWith("literal:"))
|
|
60
62
|
throw new Error("Can't render Literal from non-literal URL")
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
const body = this.#url.substring(10)
|
|
64
|
+
const body = this.#url.substring(8)
|
|
64
65
|
|
|
65
66
|
|
|
66
67
|
if(body.startsWith("string:")) {
|
package/src/agent/Agent.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Field, ObjectType, InputType } from "type-graphql";
|
|
2
1
|
import { Perspective } from "../perspectives/Perspective";
|
|
3
2
|
import { ExpressionGeneric } from "../expression/Expression";
|
|
4
3
|
|
|
@@ -18,13 +17,11 @@ import { ExpressionGeneric } from "../expression/Expression";
|
|
|
18
17
|
* DIDs are resolved to Expressions that are objects of this class.
|
|
19
18
|
* Thus, this is how agents see (other) agents.
|
|
20
19
|
*/
|
|
21
|
-
@ObjectType()
|
|
22
20
|
export class Agent {
|
|
23
21
|
/** The DID of the Agent
|
|
24
22
|
* All epxressions authored by them are signed with the keys mentioned
|
|
25
23
|
* in the DID document behind this DID URI.
|
|
26
24
|
*/
|
|
27
|
-
@Field()
|
|
28
25
|
did: string;
|
|
29
26
|
|
|
30
27
|
/** The Perspective that holds the public-facing semantics/statements of the Agent
|
|
@@ -32,11 +29,9 @@ export class Agent {
|
|
|
32
29
|
* this agent wants to offer as public-facing semantics.
|
|
33
30
|
* This should be used for any kind of user profile information.
|
|
34
31
|
*/
|
|
35
|
-
@Field((type) => Perspective, { nullable: true })
|
|
36
32
|
perspective?: Perspective;
|
|
37
33
|
|
|
38
34
|
/** Address of the Language by which the Agent will receive DMs */
|
|
39
|
-
@Field({ nullable: true })
|
|
40
35
|
directMessageLanguage?: string;
|
|
41
36
|
|
|
42
37
|
constructor(did: string, perspective?: Perspective) {
|
|
@@ -48,28 +43,13 @@ export class Agent {
|
|
|
48
43
|
}
|
|
49
44
|
}
|
|
50
45
|
}
|
|
51
|
-
|
|
52
|
-
@ObjectType()
|
|
53
46
|
export class AgentExpression extends ExpressionGeneric(Agent) {}
|
|
54
|
-
|
|
55
|
-
@ObjectType()
|
|
56
47
|
export class EntanglementProof {
|
|
57
|
-
@Field()
|
|
58
48
|
did: string;
|
|
59
|
-
|
|
60
|
-
@Field()
|
|
61
49
|
didSigningKeyId: string;
|
|
62
|
-
|
|
63
|
-
@Field()
|
|
64
50
|
deviceKeyType: string;
|
|
65
|
-
|
|
66
|
-
@Field()
|
|
67
51
|
deviceKey: string;
|
|
68
|
-
|
|
69
|
-
@Field()
|
|
70
52
|
deviceKeySignedByDid: string;
|
|
71
|
-
|
|
72
|
-
@Field({ nullable: true })
|
|
73
53
|
didSignedByDeviceKey?: string;
|
|
74
54
|
|
|
75
55
|
constructor(
|
|
@@ -88,25 +68,12 @@ export class EntanglementProof {
|
|
|
88
68
|
this.didSignedByDeviceKey = didSignedByDeviceKey;
|
|
89
69
|
}
|
|
90
70
|
}
|
|
91
|
-
|
|
92
|
-
@InputType()
|
|
93
71
|
export class EntanglementProofInput {
|
|
94
|
-
@Field()
|
|
95
72
|
did: string;
|
|
96
|
-
|
|
97
|
-
@Field()
|
|
98
73
|
didSigningKeyId: string;
|
|
99
|
-
|
|
100
|
-
@Field()
|
|
101
74
|
deviceKeyType: string;
|
|
102
|
-
|
|
103
|
-
@Field()
|
|
104
75
|
deviceKey: string;
|
|
105
|
-
|
|
106
|
-
@Field()
|
|
107
76
|
deviceKeySignedByDid: string;
|
|
108
|
-
|
|
109
|
-
@Field()
|
|
110
77
|
didSignedByDeviceKey: string;
|
|
111
78
|
|
|
112
79
|
constructor(
|
|
@@ -125,13 +92,8 @@ export class EntanglementProofInput {
|
|
|
125
92
|
this.didSignedByDeviceKey = didSignedByDeviceKey;
|
|
126
93
|
}
|
|
127
94
|
}
|
|
128
|
-
|
|
129
|
-
@ObjectType()
|
|
130
95
|
export class AgentSignature {
|
|
131
|
-
@Field()
|
|
132
96
|
signature: string;
|
|
133
|
-
|
|
134
|
-
@Field()
|
|
135
97
|
publicKey: string;
|
|
136
98
|
|
|
137
99
|
constructor(signature: string, publicKey: string) {
|
|
@@ -139,13 +101,8 @@ export class AgentSignature {
|
|
|
139
101
|
this.publicKey = publicKey;
|
|
140
102
|
}
|
|
141
103
|
}
|
|
142
|
-
|
|
143
|
-
@ObjectType()
|
|
144
104
|
export class Resource {
|
|
145
|
-
@Field()
|
|
146
105
|
domain: string;
|
|
147
|
-
|
|
148
|
-
@Field((type) => [String])
|
|
149
106
|
pointers: string[];
|
|
150
107
|
|
|
151
108
|
constructor(domain: string, pointers: string[]) {
|
|
@@ -153,13 +110,8 @@ export class Resource {
|
|
|
153
110
|
this.pointers = pointers;
|
|
154
111
|
}
|
|
155
112
|
}
|
|
156
|
-
|
|
157
|
-
@ObjectType()
|
|
158
113
|
export class Capability {
|
|
159
|
-
@Field((type) => Resource)
|
|
160
114
|
with: Resource;
|
|
161
|
-
|
|
162
|
-
@Field((type) => [String])
|
|
163
115
|
can: string[];
|
|
164
116
|
|
|
165
117
|
constructor(withF: Resource, can: string[]) {
|
|
@@ -167,22 +119,11 @@ export class Capability {
|
|
|
167
119
|
this.can = can;
|
|
168
120
|
}
|
|
169
121
|
}
|
|
170
|
-
|
|
171
|
-
@ObjectType()
|
|
172
122
|
export class AuthInfo {
|
|
173
|
-
@Field()
|
|
174
123
|
appName: string;
|
|
175
|
-
|
|
176
|
-
@Field()
|
|
177
124
|
appDesc: string;
|
|
178
|
-
|
|
179
|
-
@Field()
|
|
180
125
|
appUrl: string;
|
|
181
|
-
|
|
182
|
-
@Field({nullable: true})
|
|
183
126
|
appIconPath?: string;
|
|
184
|
-
|
|
185
|
-
@Field((type) => [Capability])
|
|
186
127
|
capabilities: Capability[];
|
|
187
128
|
|
|
188
129
|
constructor(
|
|
@@ -199,19 +140,10 @@ export class AuthInfo {
|
|
|
199
140
|
this.capabilities = capabilities;
|
|
200
141
|
}
|
|
201
142
|
}
|
|
202
|
-
|
|
203
|
-
@ObjectType()
|
|
204
143
|
export class Apps {
|
|
205
|
-
@Field()
|
|
206
144
|
requestId: string;
|
|
207
|
-
|
|
208
|
-
@Field()
|
|
209
145
|
token: string;
|
|
210
|
-
|
|
211
|
-
@Field({ nullable: true })
|
|
212
146
|
revoked?: boolean;
|
|
213
|
-
|
|
214
|
-
@Field()
|
|
215
147
|
auth: AuthInfo;
|
|
216
148
|
|
|
217
149
|
constructor(
|
|
@@ -226,13 +158,8 @@ export class Apps {
|
|
|
226
158
|
this.revoked = revoked;
|
|
227
159
|
}
|
|
228
160
|
}
|
|
229
|
-
|
|
230
|
-
@InputType()
|
|
231
161
|
export class ResourceInput {
|
|
232
|
-
@Field()
|
|
233
162
|
domain: string;
|
|
234
|
-
|
|
235
|
-
@Field((type) => [String])
|
|
236
163
|
pointers: string[];
|
|
237
164
|
|
|
238
165
|
constructor(domain: string, pointers: string[]) {
|
|
@@ -240,13 +167,8 @@ export class ResourceInput {
|
|
|
240
167
|
this.pointers = pointers;
|
|
241
168
|
}
|
|
242
169
|
}
|
|
243
|
-
|
|
244
|
-
@InputType()
|
|
245
170
|
export class CapabilityInput {
|
|
246
|
-
@Field((type) => ResourceInput)
|
|
247
171
|
with: ResourceInput;
|
|
248
|
-
|
|
249
|
-
@Field((type) => [String])
|
|
250
172
|
can: string[];
|
|
251
173
|
|
|
252
174
|
constructor(withF: ResourceInput, can: string[]) {
|
|
@@ -254,25 +176,12 @@ export class CapabilityInput {
|
|
|
254
176
|
this.can = can;
|
|
255
177
|
}
|
|
256
178
|
}
|
|
257
|
-
|
|
258
|
-
@InputType()
|
|
259
179
|
export class AuthInfoInput {
|
|
260
|
-
@Field()
|
|
261
180
|
appName: string;
|
|
262
|
-
|
|
263
|
-
@Field()
|
|
264
181
|
appDesc: string;
|
|
265
|
-
|
|
266
|
-
@Field()
|
|
267
182
|
appDomain: string;
|
|
268
|
-
|
|
269
|
-
@Field({ nullable: true })
|
|
270
183
|
appUrl?: string;
|
|
271
|
-
|
|
272
|
-
@Field({ nullable: true })
|
|
273
184
|
appIconPath?: string;
|
|
274
|
-
|
|
275
|
-
@Field((type) => [CapabilityInput], { nullable: true })
|
|
276
185
|
capabilities?: CapabilityInput[];
|
|
277
186
|
|
|
278
187
|
constructor(
|
|
@@ -291,17 +200,9 @@ export class AuthInfoInput {
|
|
|
291
200
|
this.appIconPath = appIconPath;
|
|
292
201
|
}
|
|
293
202
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
@ObjectType()
|
|
297
203
|
export class UserCreationResult {
|
|
298
|
-
@Field()
|
|
299
204
|
did: string;
|
|
300
|
-
|
|
301
|
-
@Field()
|
|
302
205
|
success: boolean;
|
|
303
|
-
|
|
304
|
-
@Field({ nullable: true })
|
|
305
206
|
error?: string;
|
|
306
207
|
|
|
307
208
|
constructor(did: string, success: boolean, error?: string) {
|