@coasys/ad4m 0.13.0-test-3 → 0.13.0-test-4
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 +2406 -11070
- package/lib/index.js +2209 -10925
- package/lib/src/Ad4mClient.d.ts +7 -3
- package/lib/src/Ad4mClient.js +29 -13
- package/lib/src/agent/Agent.js +26 -272
- package/lib/src/agent/AgentClient.d.ts +10 -21
- package/lib/src/agent/AgentClient.js +75 -427
- 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 +52 -0
- package/lib/src/apiClient.js +231 -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 +3 -3
- package/lib/src/expression/ExpressionClient.js +13 -76
- package/lib/src/expression/ExpressionRef.js +2 -25
- 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 +6 -1
- package/lib/src/index.js +6 -1
- 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 +1 -1
- package/lib/src/language/Language.js +10 -76
- 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 +57 -38
- package/lib/src/model/Ad4mModel.js +594 -460
- package/lib/src/model/Ad4mModel.test.js +371 -815
- package/lib/src/model/ModelQueryBuilder.d.ts +9 -21
- package/lib/src/model/ModelQueryBuilder.js +138 -217
- package/lib/src/model/decorators.d.ts +22 -0
- package/lib/src/model/decorators.js +7 -0
- package/lib/src/model/hydration.d.ts +7 -60
- package/lib/src/model/hydration.js +7 -716
- package/lib/src/model/index.d.ts +0 -4
- package/lib/src/model/index.js +0 -4
- package/lib/src/model/model-manifest.d.ts +41 -0
- package/lib/src/model/model-manifest.js +11 -0
- package/lib/src/model/query-sparql.d.ts +4 -67
- package/lib/src/model/query-sparql.js +26 -322
- package/lib/src/model/query-sparql.test.js +35 -218
- package/lib/src/model/shacl-gen.js +4 -0
- package/lib/src/model/types.d.ts +47 -38
- package/lib/src/model/types.js +4 -1
- 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 +12 -17
- package/lib/src/perspectives/PerspectiveClient.js +169 -429
- package/lib/src/perspectives/PerspectiveClient.test.js +55 -0
- package/lib/src/perspectives/PerspectiveDiff.js +4 -31
- package/lib/src/perspectives/PerspectiveHandle.js +3 -43
- package/lib/src/perspectives/PerspectiveProxy.d.ts +92 -71
- package/lib/src/perspectives/PerspectiveProxy.js +273 -310
- package/lib/src/runtime/RuntimeClient.d.ts +6 -6
- package/lib/src/runtime/RuntimeClient.js +93 -467
- package/lib/src/runtime/RuntimeTypes.d.ts +101 -0
- package/lib/src/runtime/RuntimeTypes.js +45 -0
- package/lib/src/shacl/SHACLShape.d.ts +7 -0
- package/lib/src/shacl/SHACLShape.js +19 -0
- package/lib/src/shacl/SHACLShape.test.js +82 -0
- package/lib/src/typeDefs.js +3 -628
- package/package.json +9 -24
- package/rollup.config.js +0 -7
- package/src/Ad4mClient.test.ts +1179 -1340
- package/src/Ad4mClient.ts +30 -15
- package/src/agent/Agent.ts +0 -99
- package/src/agent/AgentClient.ts +112 -526
- 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 +283 -0
- package/src/expression/Expression.ts +3 -43
- package/src/expression/ExpressionClient.ts +14 -77
- package/src/expression/ExpressionRef.ts +0 -6
- 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 +6 -1
- package/src/jestSetup.ts +1 -1
- package/src/language/Icon.ts +0 -4
- package/src/language/Language.ts +2 -23
- 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 +708 -876
- package/src/model/Ad4mModel.ts +613 -508
- package/src/model/ModelQueryBuilder.ts +178 -244
- package/src/model/decorators.ts +29 -0
- package/src/model/hydration.ts +9 -766
- package/src/model/index.ts +0 -4
- package/src/model/query-sparql.test.ts +34 -242
- package/src/model/query-sparql.ts +27 -337
- package/src/model/shacl-gen.ts +5 -0
- package/src/model/types.ts +51 -39
- 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 +206 -148
- package/src/perspectives/PerspectiveClient.ts +228 -442
- package/src/perspectives/PerspectiveDiff.ts +0 -8
- package/src/perspectives/PerspectiveHandle.ts +1 -12
- package/src/perspectives/PerspectiveProxy.test.ts +41 -0
- package/src/perspectives/PerspectiveProxy.ts +307 -348
- package/src/runtime/RuntimeClient.ts +112 -474
- package/src/runtime/RuntimeTypes.ts +144 -0
- package/src/shacl/SHACLShape.test.ts +94 -0
- package/src/shacl/SHACLShape.ts +27 -0
- package/src/typeDefs.ts +3 -5
- package/tsconfig.json +3 -7
- 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/LanguageResolver.ts +0 -98
- package/src/model/Subject.ts +0 -159
- package/src/model/hydration-batch.ts +0 -205
- package/src/model/hydration-batching.test.ts +0 -563
- package/src/model/prolog-facts.ts +0 -145
- package/src/model/query-prolog.ts +0 -148
- package/src/model/query-sparql-batch.ts +0 -301
- package/src/model/subscription-delta.test.ts +0 -207
- package/src/model/subscription-pool.ts +0 -211
- package/src/neighbourhood/NeighbourhoodResolver.ts +0 -100
- package/src/perspectives/PerspectiveResolver.ts +0 -364
- package/src/runtime/RuntimeResolver.ts +0 -749
- package/src/unwrapApolloResult.ts +0 -16
|
@@ -9,43 +9,33 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
import {
|
|
12
|
+
var _PerspectiveClient_apiClient, _PerspectiveClient_perspectiveAddedCallbacks, _PerspectiveClient_perspectiveUpdatedCallbacks, _PerspectiveClient_perspectiveRemovedCallbacks, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, _PerspectiveClient_expressionClient, _PerspectiveClient_neighbourhoodClient, _PerspectiveClient_aiClient, _PerspectiveClient_unsubscribers, _PerspectiveClient_linkUnsubscribers, _PerspectiveClient_querySubscriptionUnsubscribers;
|
|
13
|
+
import { ApiClient, RpcError } from "../apiClient";
|
|
14
14
|
import { NeighbourhoodProxy } from "../neighbourhood/NeighbourhoodProxy";
|
|
15
|
-
import unwrapApolloResult from "../unwrapApolloResult";
|
|
16
15
|
import { PerspectiveProxy } from './PerspectiveProxy';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
sharedUrl
|
|
28
|
-
state
|
|
29
|
-
owners
|
|
30
|
-
neighbourhood {
|
|
31
|
-
data {
|
|
32
|
-
linkLanguage
|
|
33
|
-
meta {
|
|
34
|
-
links
|
|
35
|
-
{
|
|
36
|
-
author
|
|
37
|
-
timestamp
|
|
38
|
-
data { source, predicate, target }
|
|
39
|
-
proof { valid, invalid, signature, key }
|
|
40
|
-
}
|
|
16
|
+
function normalizeQueryResult(raw, errorContext) {
|
|
17
|
+
let finalResult = raw;
|
|
18
|
+
let isInit = false;
|
|
19
|
+
if (typeof finalResult === 'string' && finalResult.startsWith('#init#')) {
|
|
20
|
+
finalResult = finalResult.substring(6);
|
|
21
|
+
isInit = true;
|
|
22
|
+
}
|
|
23
|
+
if (typeof finalResult === 'string') {
|
|
24
|
+
try {
|
|
25
|
+
finalResult = JSON.parse(finalResult);
|
|
41
26
|
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
console.error(errorContext, e);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (isInit && typeof finalResult === 'object' && finalResult !== null) {
|
|
32
|
+
finalResult.isInit = true;
|
|
42
33
|
}
|
|
43
|
-
|
|
34
|
+
return { result: finalResult, isInit };
|
|
44
35
|
}
|
|
45
|
-
`;
|
|
46
36
|
export class PerspectiveClient {
|
|
47
|
-
constructor(
|
|
48
|
-
|
|
37
|
+
constructor(baseUrl, token, subscribe = true, sharedApiClient) {
|
|
38
|
+
_PerspectiveClient_apiClient.set(this, void 0);
|
|
49
39
|
_PerspectiveClient_perspectiveAddedCallbacks.set(this, void 0);
|
|
50
40
|
_PerspectiveClient_perspectiveUpdatedCallbacks.set(this, void 0);
|
|
51
41
|
_PerspectiveClient_perspectiveRemovedCallbacks.set(this, void 0);
|
|
@@ -53,29 +43,23 @@ export class PerspectiveClient {
|
|
|
53
43
|
_PerspectiveClient_expressionClient.set(this, void 0);
|
|
54
44
|
_PerspectiveClient_neighbourhoodClient.set(this, void 0);
|
|
55
45
|
_PerspectiveClient_aiClient.set(this, void 0);
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
_PerspectiveClient_unsubscribers.set(this, void 0);
|
|
47
|
+
_PerspectiveClient_linkUnsubscribers.set(this, void 0);
|
|
48
|
+
_PerspectiveClient_querySubscriptionUnsubscribers.set(this, void 0);
|
|
49
|
+
__classPrivateFieldSet(this, _PerspectiveClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
|
|
58
50
|
__classPrivateFieldSet(this, _PerspectiveClient_perspectiveAddedCallbacks, [], "f");
|
|
59
51
|
__classPrivateFieldSet(this, _PerspectiveClient_perspectiveUpdatedCallbacks, [], "f");
|
|
60
52
|
__classPrivateFieldSet(this, _PerspectiveClient_perspectiveRemovedCallbacks, [], "f");
|
|
61
53
|
__classPrivateFieldSet(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, [], "f");
|
|
54
|
+
__classPrivateFieldSet(this, _PerspectiveClient_unsubscribers, [], "f");
|
|
55
|
+
__classPrivateFieldSet(this, _PerspectiveClient_linkUnsubscribers, new Map(), "f");
|
|
56
|
+
__classPrivateFieldSet(this, _PerspectiveClient_querySubscriptionUnsubscribers, new Map(), "f");
|
|
62
57
|
if (subscribe) {
|
|
63
58
|
this.subscribePerspectiveAdded();
|
|
64
59
|
this.subscribePerspectiveUpdated();
|
|
65
60
|
this.subscribePerspectiveRemoved();
|
|
66
61
|
}
|
|
67
62
|
}
|
|
68
|
-
/** Get or create a proxy for a UUID. If the proxy exists in cache, update its handle and return it. */
|
|
69
|
-
getOrCreateProxy(handle) {
|
|
70
|
-
const existing = __classPrivateFieldGet(this, _PerspectiveClient_proxyCache, "f").get(handle.uuid);
|
|
71
|
-
if (existing) {
|
|
72
|
-
existing.updateHandle(handle);
|
|
73
|
-
return existing;
|
|
74
|
-
}
|
|
75
|
-
const proxy = new PerspectiveProxy(handle, this);
|
|
76
|
-
__classPrivateFieldGet(this, _PerspectiveClient_proxyCache, "f").set(handle.uuid, proxy);
|
|
77
|
-
return proxy;
|
|
78
|
-
}
|
|
79
63
|
setExpressionClient(client) {
|
|
80
64
|
__classPrivateFieldSet(this, _PerspectiveClient_expressionClient, client, "f");
|
|
81
65
|
}
|
|
@@ -89,316 +73,148 @@ export class PerspectiveClient {
|
|
|
89
73
|
return __classPrivateFieldGet(this, _PerspectiveClient_aiClient, "f");
|
|
90
74
|
}
|
|
91
75
|
async all() {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
perspectives {
|
|
95
|
-
${PERSPECTIVE_HANDLE_FIELDS}
|
|
96
|
-
}
|
|
97
|
-
}`
|
|
98
|
-
}));
|
|
99
|
-
return perspectives.map(handle => this.getOrCreateProxy(handle));
|
|
76
|
+
const perspectives = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.all');
|
|
77
|
+
return perspectives.map(handle => new PerspectiveProxy(handle, this));
|
|
100
78
|
}
|
|
101
79
|
async byUUID(uuid) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
if (!perspective)
|
|
114
|
-
return null;
|
|
115
|
-
return this.getOrCreateProxy(perspective);
|
|
80
|
+
try {
|
|
81
|
+
const perspective = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.get', { uuid });
|
|
82
|
+
if (!perspective)
|
|
83
|
+
return null;
|
|
84
|
+
return new PerspectiveProxy(perspective, this);
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
if (e instanceof RpcError && e.status === 404)
|
|
88
|
+
return null;
|
|
89
|
+
throw e;
|
|
90
|
+
}
|
|
116
91
|
}
|
|
117
92
|
async snapshotByUUID(uuid) {
|
|
118
|
-
|
|
119
|
-
query: gql `query perspectiveSnapshot($uuid: String!) {
|
|
120
|
-
perspectiveSnapshot(uuid: $uuid) {
|
|
121
|
-
links { ${LINK_EXPRESSION_FIELDS} }
|
|
122
|
-
}
|
|
123
|
-
}`,
|
|
124
|
-
variables: { uuid }
|
|
125
|
-
}));
|
|
126
|
-
return perspectiveSnapshot;
|
|
93
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.snapshot', { uuid });
|
|
127
94
|
}
|
|
128
95
|
async publishSnapshotByUUID(uuid) {
|
|
129
|
-
|
|
130
|
-
mutation: gql `mutation perspectivePublishSnapshot($uuid: String!) {
|
|
131
|
-
perspectivePublishSnapshot(uuid: $uuid)
|
|
132
|
-
}`,
|
|
133
|
-
variables: { uuid }
|
|
134
|
-
}));
|
|
135
|
-
return perspectivePublishSnapshot;
|
|
96
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.publishSnapshot', { uuid });
|
|
136
97
|
}
|
|
137
98
|
async queryLinks(uuid, query) {
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
99
|
+
const params = { uuid };
|
|
100
|
+
if (query.source)
|
|
101
|
+
params.source = query.source;
|
|
102
|
+
if (query.predicate)
|
|
103
|
+
params.predicate = query.predicate;
|
|
104
|
+
if (query.target)
|
|
105
|
+
params.target = query.target;
|
|
106
|
+
if (query.fromDate)
|
|
107
|
+
params.fromDate = query.fromDate instanceof Date ? query.fromDate.toISOString() : String(query.fromDate);
|
|
108
|
+
if (query.untilDate)
|
|
109
|
+
params.untilDate = query.untilDate instanceof Date ? query.untilDate.toISOString() : String(query.untilDate);
|
|
110
|
+
if (query.limit !== undefined)
|
|
111
|
+
params.limit = query.limit;
|
|
112
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.queryLinks', params);
|
|
147
113
|
}
|
|
148
114
|
async queryProlog(uuid, query) {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
152
|
-
}`,
|
|
153
|
-
variables: { uuid, query }
|
|
154
|
-
}));
|
|
155
|
-
return JSON.parse(perspectiveQueryProlog);
|
|
115
|
+
const result = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.queryProlog', { uuid, query });
|
|
116
|
+
return JSON.parse(result);
|
|
156
117
|
}
|
|
157
118
|
async querySparql(uuid, query) {
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
perspectiveQuerySparql(uuid: $uuid, query: $query)
|
|
161
|
-
}`,
|
|
162
|
-
variables: { uuid, query }
|
|
163
|
-
}));
|
|
164
|
-
return JSON.parse(perspectiveQuerySparql);
|
|
119
|
+
const result = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.querySparql', { uuid, engine: 'sparql', query });
|
|
120
|
+
return JSON.parse(result);
|
|
165
121
|
}
|
|
166
122
|
async subscribeQuery(uuid, query) {
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
let finalResult = result;
|
|
178
|
-
let isInit = false;
|
|
179
|
-
if (finalResult.startsWith("#init#")) {
|
|
180
|
-
finalResult = finalResult.substring(6);
|
|
181
|
-
isInit = true;
|
|
182
|
-
}
|
|
183
|
-
try {
|
|
184
|
-
finalResult = JSON.parse(finalResult);
|
|
185
|
-
}
|
|
186
|
-
catch (e) {
|
|
187
|
-
console.error('Error parsing perspectiveSubscribeQuery result:', e);
|
|
188
|
-
}
|
|
189
|
-
return { subscriptionId, result: finalResult, isInit };
|
|
123
|
+
const response = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.subscribeQuery', { uuid, query });
|
|
124
|
+
const { subscriptionId, result } = response;
|
|
125
|
+
const normalized = normalizeQueryResult(result, 'Error parsing subscribeQuery result:');
|
|
126
|
+
return { subscriptionId, result: normalized.result, isInit: normalized.isInit };
|
|
127
|
+
}
|
|
128
|
+
async perspectiveKeepAliveQuery(uuid, subscriptionId) {
|
|
129
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.keepAliveQuery', { uuid, subscriptionId });
|
|
130
|
+
}
|
|
131
|
+
async perspectiveDisposeQuerySubscription(uuid, subscriptionId) {
|
|
132
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.disposeQuery', { uuid, subscriptionId });
|
|
190
133
|
}
|
|
191
134
|
subscribeToQueryUpdates(subscriptionId, onData) {
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}).subscribe({
|
|
202
|
-
next: (result) => {
|
|
203
|
-
if (result.data && result.data.perspectiveQuerySubscription) {
|
|
204
|
-
let finalResult = result.data.perspectiveQuerySubscription;
|
|
205
|
-
let isInit = false;
|
|
206
|
-
if (finalResult.startsWith("#init#")) {
|
|
207
|
-
finalResult = finalResult.substring(6);
|
|
208
|
-
isInit = true;
|
|
209
|
-
}
|
|
210
|
-
try {
|
|
211
|
-
finalResult = JSON.parse(finalResult);
|
|
212
|
-
if (isInit && typeof finalResult === 'object') {
|
|
213
|
-
finalResult.isInit = true;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
catch (e) {
|
|
217
|
-
console.error('Error parsing perspectiveQuerySubscription:', e);
|
|
218
|
-
}
|
|
219
|
-
onData(finalResult);
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
error: (e) => console.error('Error in query subscription:', e)
|
|
135
|
+
const unsub = __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
136
|
+
const event = data;
|
|
137
|
+
if (event.type !== 'query-subscription-update')
|
|
138
|
+
return;
|
|
139
|
+
const eventSubscriptionId = event.subscriptionId || event.subscription_id;
|
|
140
|
+
if (eventSubscriptionId !== subscriptionId)
|
|
141
|
+
return;
|
|
142
|
+
const normalized = normalizeQueryResult(event.result, 'Error parsing query subscription:');
|
|
143
|
+
onData(normalized.result);
|
|
223
144
|
});
|
|
224
|
-
|
|
145
|
+
__classPrivateFieldGet(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").set(subscriptionId, unsub);
|
|
146
|
+
return unsub;
|
|
225
147
|
}
|
|
226
148
|
async keepAliveQuery(uuid, subscriptionId) {
|
|
227
|
-
|
|
228
|
-
mutation: gql `mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
|
|
229
|
-
perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
230
|
-
}`,
|
|
231
|
-
variables: { uuid, subscriptionId }
|
|
232
|
-
}));
|
|
233
|
-
return perspectiveKeepAliveQuery;
|
|
149
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.keepAliveQuery', { uuid, subscriptionId });
|
|
234
150
|
}
|
|
235
151
|
async disposeQuerySubscription(uuid, subscriptionId) {
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
})
|
|
242
|
-
|
|
152
|
+
const unsub = __classPrivateFieldGet(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").get(subscriptionId);
|
|
153
|
+
if (unsub) {
|
|
154
|
+
unsub();
|
|
155
|
+
__classPrivateFieldGet(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").delete(subscriptionId);
|
|
156
|
+
}
|
|
157
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.disposeQuery', { uuid, subscriptionId });
|
|
158
|
+
}
|
|
159
|
+
async modelQuery(uuid, className, queryJson, shapeJson) {
|
|
160
|
+
const resultJson = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.modelQuery', { uuid, class_name: className, query_json: queryJson, shape_json: shapeJson });
|
|
161
|
+
return JSON.parse(resultJson);
|
|
162
|
+
}
|
|
163
|
+
async modelSubscribe(uuid, className, queryJson, shapeJson) {
|
|
164
|
+
const response = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.modelSubscribe', { uuid, class_name: className, query_json: queryJson, shape_json: shapeJson });
|
|
165
|
+
return {
|
|
166
|
+
subscriptionId: response.subscription_id,
|
|
167
|
+
result: JSON.parse(response.result)
|
|
168
|
+
};
|
|
243
169
|
}
|
|
244
170
|
async add(name) {
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
perspectiveAdd(name: $name) {
|
|
248
|
-
${PERSPECTIVE_HANDLE_FIELDS}
|
|
249
|
-
}
|
|
250
|
-
}`,
|
|
251
|
-
variables: { name }
|
|
252
|
-
}));
|
|
253
|
-
return this.getOrCreateProxy(perspectiveAdd);
|
|
171
|
+
const handle = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.create', { name });
|
|
172
|
+
return new PerspectiveProxy(handle, this);
|
|
254
173
|
}
|
|
255
174
|
async update(uuid, name) {
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
perspectiveUpdate(uuid: $uuid, name: $name) {
|
|
259
|
-
${PERSPECTIVE_HANDLE_FIELDS}
|
|
260
|
-
}
|
|
261
|
-
}`,
|
|
262
|
-
variables: { uuid, name }
|
|
263
|
-
}));
|
|
264
|
-
// Evict stale proxy — getOrCreateProxy will create a fresh one with updated handle
|
|
265
|
-
__classPrivateFieldGet(this, _PerspectiveClient_proxyCache, "f").delete(uuid);
|
|
266
|
-
return this.getOrCreateProxy(perspectiveUpdate);
|
|
175
|
+
const handle = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.update', { uuid, name });
|
|
176
|
+
return new PerspectiveProxy(handle, this);
|
|
267
177
|
}
|
|
268
178
|
async remove(uuid) {
|
|
269
|
-
__classPrivateFieldGet(this,
|
|
270
|
-
return
|
|
271
|
-
mutation: gql `mutation perspectiveRemove($uuid: String!) {
|
|
272
|
-
perspectiveRemove(uuid: $uuid)
|
|
273
|
-
}`,
|
|
274
|
-
variables: { uuid }
|
|
275
|
-
}));
|
|
179
|
+
const result = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.remove', { uuid });
|
|
180
|
+
return { perspectiveRemove: result };
|
|
276
181
|
}
|
|
277
182
|
async addLink(uuid, link, status = 'shared', batchId) {
|
|
278
|
-
|
|
279
|
-
mutation: gql `mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
|
|
280
|
-
perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
281
|
-
${LINK_EXPRESSION_FIELDS}
|
|
282
|
-
}
|
|
283
|
-
}`,
|
|
284
|
-
variables: { uuid, link, status, batchId }
|
|
285
|
-
}));
|
|
286
|
-
return perspectiveAddLink;
|
|
183
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.addLink', { uuid, link, status, batchId });
|
|
287
184
|
}
|
|
288
185
|
async addLinks(uuid, links, status = 'shared', batchId) {
|
|
289
|
-
|
|
290
|
-
mutation: gql `mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
|
|
291
|
-
perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
|
|
292
|
-
${LINK_EXPRESSION_FIELDS}
|
|
293
|
-
}
|
|
294
|
-
}`,
|
|
295
|
-
variables: { uuid, links, status, batchId }
|
|
296
|
-
}));
|
|
297
|
-
return perspectiveAddLinks;
|
|
186
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status, batchId });
|
|
298
187
|
}
|
|
299
188
|
async removeLinks(uuid, links, batchId) {
|
|
300
|
-
|
|
301
|
-
mutation: gql `mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
|
|
302
|
-
perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
|
|
303
|
-
${LINK_EXPRESSION_FIELDS}
|
|
304
|
-
}
|
|
305
|
-
}`,
|
|
306
|
-
variables: { uuid, links, batchId }
|
|
307
|
-
}));
|
|
308
|
-
return perspectiveRemoveLinks;
|
|
189
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLinks', { uuid, links, batchId });
|
|
309
190
|
}
|
|
310
191
|
async linkMutations(uuid, mutations, status) {
|
|
311
|
-
|
|
312
|
-
mutation: gql `mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
|
|
313
|
-
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
|
|
314
|
-
additions {
|
|
315
|
-
${LINK_EXPRESSION_FIELDS}
|
|
316
|
-
}
|
|
317
|
-
removals {
|
|
318
|
-
${LINK_EXPRESSION_FIELDS}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}`,
|
|
322
|
-
variables: { uuid, mutations, status }
|
|
323
|
-
}));
|
|
324
|
-
return perspectiveLinkMutations;
|
|
192
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.linkMutations', { uuid, mutations, status });
|
|
325
193
|
}
|
|
326
194
|
async addLinkExpression(uuid, link, status = 'shared', batchId) {
|
|
327
|
-
|
|
328
|
-
mutation: gql `mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
|
|
329
|
-
perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
330
|
-
${LINK_EXPRESSION_FIELDS}
|
|
331
|
-
}
|
|
332
|
-
}`,
|
|
333
|
-
variables: { uuid, link, status, batchId }
|
|
334
|
-
}));
|
|
335
|
-
return perspectiveAddLinkExpression;
|
|
195
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinkExpression', { uuid, link, status, batchId });
|
|
336
196
|
}
|
|
337
197
|
async updateLink(uuid, oldLink, newLink, batchId) {
|
|
338
|
-
|
|
339
|
-
mutation: gql `mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
|
|
340
|
-
perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
|
|
341
|
-
${LINK_EXPRESSION_FIELDS}
|
|
342
|
-
}
|
|
343
|
-
}`,
|
|
344
|
-
variables: { uuid, oldLink, newLink, batchId }
|
|
345
|
-
}));
|
|
346
|
-
return perspectiveUpdateLink;
|
|
198
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.updateLink', { uuid, oldLink, newLink, batchId });
|
|
347
199
|
}
|
|
348
200
|
async removeLink(uuid, link, batchId) {
|
|
349
201
|
delete link.__typename;
|
|
350
202
|
delete link.data.__typename;
|
|
351
203
|
delete link.proof.__typename;
|
|
352
204
|
delete link.status;
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
356
|
-
}`,
|
|
357
|
-
variables: { uuid, link, batchId }
|
|
358
|
-
}));
|
|
359
|
-
return perspectiveRemoveLink;
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Adds Social DNA code to a perspective.
|
|
363
|
-
*
|
|
364
|
-
* Preferred usage: pass shaclJson (from SHACLShape.toJSON()) as the primary schema definition.
|
|
365
|
-
* The sdnaCode parameter is kept for backward compatibility but SHACL is the source of truth
|
|
366
|
-
* for all SDNA operations. Prolog engines remain available for complex queries.
|
|
367
|
-
*
|
|
368
|
-
* @param sdnaCode - Legacy Prolog code (pass empty string when using shaclJson)
|
|
369
|
-
* @param shaclJson - SHACL JSON string from SHACLShape.toJSON() (recommended)
|
|
370
|
-
*/
|
|
205
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLink', { uuid, link, batchId });
|
|
206
|
+
}
|
|
371
207
|
async addSdna(uuid, name, sdnaCode, sdnaType, shaclJson) {
|
|
372
|
-
return
|
|
373
|
-
mutation: gql `mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
|
|
374
|
-
perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
|
|
375
|
-
}`,
|
|
376
|
-
variables: { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson }
|
|
377
|
-
})).perspectiveAddSdna;
|
|
208
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson });
|
|
378
209
|
}
|
|
379
210
|
async executeCommands(uuid, commands, expression, parameters, batchId) {
|
|
380
|
-
return
|
|
381
|
-
mutation: gql `mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
|
|
382
|
-
perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
|
|
383
|
-
}`,
|
|
384
|
-
variables: { uuid, commands, expression, parameters, batchId }
|
|
385
|
-
})).perspectiveExecuteCommands;
|
|
211
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.executeCommands', { uuid, commands, expression, parameters, batchId });
|
|
386
212
|
}
|
|
387
213
|
async createSubject(uuid, subjectClass, expressionAddress, initialValues, batchId) {
|
|
388
|
-
return
|
|
389
|
-
mutation: gql `mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
|
|
390
|
-
perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
|
|
391
|
-
}`,
|
|
392
|
-
variables: { uuid, subjectClass, expressionAddress, initialValues, batchId }
|
|
393
|
-
})).perspectiveCreateSubject;
|
|
214
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.createSubject', { uuid, subjectClass, expressionAddress, initialValues, batchId });
|
|
394
215
|
}
|
|
395
216
|
async getSubjectData(uuid, subjectClass, expressionAddress) {
|
|
396
|
-
return
|
|
397
|
-
mutation: gql `mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
|
|
398
|
-
perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
|
|
399
|
-
}`,
|
|
400
|
-
variables: { uuid, subjectClass, expressionAddress }
|
|
401
|
-
})).perspectiveGetSubjectData;
|
|
217
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.getSubjectData', { uuid, subjectClass, expressionAddress });
|
|
402
218
|
}
|
|
403
219
|
// ExpressionClient functions, needed for Subjects:
|
|
404
220
|
async getExpression(expressionURI) {
|
|
@@ -412,176 +228,100 @@ export class PerspectiveClient {
|
|
|
412
228
|
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").push(cb);
|
|
413
229
|
}
|
|
414
230
|
subscribePerspectiveAdded() {
|
|
415
|
-
__classPrivateFieldGet(this,
|
|
416
|
-
|
|
417
|
-
|
|
231
|
+
const unsub = __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
232
|
+
if (data.type === 'perspective-added') {
|
|
233
|
+
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").forEach(cb => cb(data.perspective));
|
|
418
234
|
}
|
|
419
|
-
`
|
|
420
|
-
}).subscribe({
|
|
421
|
-
next: result => {
|
|
422
|
-
const handle = result.data.perspectiveAdded;
|
|
423
|
-
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").forEach(cb => {
|
|
424
|
-
cb(handle);
|
|
425
|
-
});
|
|
426
|
-
// Populate cache so subsequent byUUID() calls get a hit
|
|
427
|
-
this.getOrCreateProxy(handle);
|
|
428
|
-
},
|
|
429
|
-
error: (e) => console.error(e)
|
|
430
235
|
});
|
|
236
|
+
__classPrivateFieldGet(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
431
237
|
}
|
|
432
238
|
addPerspectiveUpdatedListener(cb) {
|
|
433
239
|
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").push(cb);
|
|
434
240
|
}
|
|
435
241
|
subscribePerspectiveUpdated() {
|
|
436
|
-
__classPrivateFieldGet(this,
|
|
437
|
-
|
|
438
|
-
|
|
242
|
+
const unsub = __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
243
|
+
if (data.type === 'perspective-updated') {
|
|
244
|
+
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").forEach(cb => cb(data.perspective));
|
|
439
245
|
}
|
|
440
|
-
`
|
|
441
|
-
}).subscribe({
|
|
442
|
-
next: result => {
|
|
443
|
-
const handle = result.data.perspectiveUpdated;
|
|
444
|
-
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").forEach(cb => {
|
|
445
|
-
cb(handle);
|
|
446
|
-
});
|
|
447
|
-
// Evict stale proxy and create fresh one with updated handle
|
|
448
|
-
__classPrivateFieldGet(this, _PerspectiveClient_proxyCache, "f").delete(handle.uuid);
|
|
449
|
-
this.getOrCreateProxy(handle);
|
|
450
|
-
},
|
|
451
|
-
error: (e) => console.error(e)
|
|
452
246
|
});
|
|
247
|
+
__classPrivateFieldGet(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
453
248
|
}
|
|
454
249
|
addPerspectiveSyncedListener(cb) {
|
|
455
250
|
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, "f").push(cb);
|
|
456
251
|
}
|
|
457
252
|
async addPerspectiveSyncStateChangeListener(uuid, cb) {
|
|
458
|
-
__classPrivateFieldGet(this,
|
|
459
|
-
|
|
460
|
-
|
|
253
|
+
const unsub = __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
254
|
+
if (data.type === 'sync-state-change' && data.uuid === uuid) {
|
|
255
|
+
cb.forEach(c => c(data.state));
|
|
461
256
|
}
|
|
462
|
-
`
|
|
463
|
-
}).subscribe({
|
|
464
|
-
next: result => {
|
|
465
|
-
cb.forEach(c => {
|
|
466
|
-
c(result.data.perspectiveSyncStateChange);
|
|
467
|
-
});
|
|
468
|
-
},
|
|
469
|
-
error: (e) => console.error(e)
|
|
470
257
|
});
|
|
258
|
+
__classPrivateFieldGet(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
471
259
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
472
260
|
}
|
|
473
261
|
addPerspectiveRemovedListener(cb) {
|
|
474
262
|
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").push(cb);
|
|
475
263
|
}
|
|
476
264
|
subscribePerspectiveRemoved() {
|
|
477
|
-
__classPrivateFieldGet(this,
|
|
478
|
-
|
|
479
|
-
|
|
265
|
+
const unsub = __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
266
|
+
if (data.type === 'perspective-removed') {
|
|
267
|
+
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").forEach(cb => cb(data.uuid));
|
|
480
268
|
}
|
|
481
|
-
`
|
|
482
|
-
}).subscribe({
|
|
483
|
-
next: result => {
|
|
484
|
-
const uuid = result.data.perspectiveRemoved;
|
|
485
|
-
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").forEach(cb => {
|
|
486
|
-
cb(uuid);
|
|
487
|
-
});
|
|
488
|
-
// Evict from cache
|
|
489
|
-
__classPrivateFieldGet(this, _PerspectiveClient_proxyCache, "f").delete(uuid);
|
|
490
|
-
},
|
|
491
|
-
error: (e) => console.error(e)
|
|
492
269
|
});
|
|
270
|
+
__classPrivateFieldGet(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
493
271
|
}
|
|
494
272
|
async addPerspectiveLinkAddedListener(uuid, cb) {
|
|
495
|
-
__classPrivateFieldGet(this,
|
|
496
|
-
|
|
497
|
-
|
|
273
|
+
const unsub = __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
274
|
+
if (data.type === 'link-added' && data.perspectiveUuid === uuid) {
|
|
275
|
+
cb.forEach(c => c(data.link));
|
|
498
276
|
}
|
|
499
|
-
`
|
|
500
|
-
}).subscribe({
|
|
501
|
-
next: result => {
|
|
502
|
-
cb.forEach(c => {
|
|
503
|
-
c(result.data.perspectiveLinkAdded);
|
|
504
|
-
});
|
|
505
|
-
},
|
|
506
|
-
error: (e) => console.error(e)
|
|
507
277
|
});
|
|
508
|
-
|
|
278
|
+
let existing = __classPrivateFieldGet(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
|
|
279
|
+
existing.push(unsub);
|
|
280
|
+
__classPrivateFieldGet(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
|
|
281
|
+
await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
|
|
509
282
|
}
|
|
510
283
|
async addPerspectiveLinkRemovedListener(uuid, cb) {
|
|
511
|
-
__classPrivateFieldGet(this,
|
|
512
|
-
|
|
513
|
-
|
|
284
|
+
const unsub = __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
285
|
+
if (data.type === 'link-removed' && data.perspectiveUuid === uuid) {
|
|
286
|
+
const link = data.link;
|
|
287
|
+
if (!link.status) {
|
|
288
|
+
delete link.status;
|
|
289
|
+
}
|
|
290
|
+
cb.forEach(c => c(link));
|
|
514
291
|
}
|
|
515
|
-
`
|
|
516
|
-
}).subscribe({
|
|
517
|
-
next: result => {
|
|
518
|
-
cb.forEach(c => {
|
|
519
|
-
if (!result.data.perspectiveLinkRemoved.status) {
|
|
520
|
-
delete result.data.perspectiveLinkRemoved.status;
|
|
521
|
-
}
|
|
522
|
-
c(result.data.perspectiveLinkRemoved);
|
|
523
|
-
});
|
|
524
|
-
},
|
|
525
|
-
error: (e) => console.error(e)
|
|
526
292
|
});
|
|
527
|
-
|
|
293
|
+
let existing = __classPrivateFieldGet(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
|
|
294
|
+
existing.push(unsub);
|
|
295
|
+
__classPrivateFieldGet(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
|
|
296
|
+
await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
|
|
528
297
|
}
|
|
529
298
|
async addPerspectiveLinkUpdatedListener(uuid, cb) {
|
|
530
|
-
__classPrivateFieldGet(this,
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
299
|
+
const unsub = __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
300
|
+
if (data.type === 'link-updated' && data.perspectiveUuid === uuid) {
|
|
301
|
+
const newLink = data.newLink;
|
|
302
|
+
const oldLink = data.oldLink;
|
|
303
|
+
if (!newLink.status) {
|
|
304
|
+
delete newLink.status;
|
|
305
|
+
}
|
|
306
|
+
if (!oldLink.status) {
|
|
307
|
+
delete oldLink.status;
|
|
539
308
|
}
|
|
309
|
+
cb.forEach(c => c(data));
|
|
540
310
|
}
|
|
541
|
-
`
|
|
542
|
-
}).subscribe({
|
|
543
|
-
next: result => {
|
|
544
|
-
cb.forEach(c => {
|
|
545
|
-
if (!result.data.perspectiveLinkUpdated.newLink.status) {
|
|
546
|
-
delete result.data.perspectiveLinkUpdated.newLink.status;
|
|
547
|
-
}
|
|
548
|
-
if (!result.data.perspectiveLinkUpdated.oldLink.status) {
|
|
549
|
-
delete result.data.perspectiveLinkUpdated.oldLink.status;
|
|
550
|
-
}
|
|
551
|
-
c(result.data.perspectiveLinkUpdated);
|
|
552
|
-
});
|
|
553
|
-
},
|
|
554
|
-
error: (e) => console.error(e)
|
|
555
311
|
});
|
|
556
|
-
|
|
312
|
+
let existing = __classPrivateFieldGet(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
|
|
313
|
+
existing.push(unsub);
|
|
314
|
+
__classPrivateFieldGet(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
|
|
315
|
+
await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
|
|
557
316
|
}
|
|
558
317
|
getNeighbourhoodProxy(uuid) {
|
|
559
318
|
return new NeighbourhoodProxy(__classPrivateFieldGet(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
|
|
560
319
|
}
|
|
561
320
|
async createBatch(uuid) {
|
|
562
|
-
|
|
563
|
-
mutation: gql `mutation perspectiveCreateBatch($uuid: String!) {
|
|
564
|
-
perspectiveCreateBatch(uuid: $uuid)
|
|
565
|
-
}`,
|
|
566
|
-
variables: { uuid }
|
|
567
|
-
}));
|
|
568
|
-
return perspectiveCreateBatch;
|
|
321
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.createBatch', { uuid });
|
|
569
322
|
}
|
|
570
323
|
async commitBatch(uuid, batchId) {
|
|
571
|
-
|
|
572
|
-
mutation: gql `mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
|
|
573
|
-
perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
|
|
574
|
-
additions {
|
|
575
|
-
${LINK_EXPRESSION_FIELDS}
|
|
576
|
-
}
|
|
577
|
-
removals {
|
|
578
|
-
${LINK_EXPRESSION_FIELDS}
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
}`,
|
|
582
|
-
variables: { uuid, batchId }
|
|
583
|
-
}));
|
|
584
|
-
return perspectiveCommitBatch;
|
|
324
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.commitBatch', { uuid, batchId });
|
|
585
325
|
}
|
|
586
326
|
}
|
|
587
|
-
|
|
327
|
+
_PerspectiveClient_apiClient = new WeakMap(), _PerspectiveClient_perspectiveAddedCallbacks = new WeakMap(), _PerspectiveClient_perspectiveUpdatedCallbacks = new WeakMap(), _PerspectiveClient_perspectiveRemovedCallbacks = new WeakMap(), _PerspectiveClient_perspectiveSyncStateChangeCallbacks = new WeakMap(), _PerspectiveClient_expressionClient = new WeakMap(), _PerspectiveClient_neighbourhoodClient = new WeakMap(), _PerspectiveClient_aiClient = new WeakMap(), _PerspectiveClient_unsubscribers = new WeakMap(), _PerspectiveClient_linkUnsubscribers = new WeakMap(), _PerspectiveClient_querySubscriptionUnsubscribers = new WeakMap();
|