@coasys/ad4m 0.13.0-test-2 → 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 +2805 -10556
- package/lib/index.js +2513 -10322
- 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 -2
- package/lib/src/index.js +6 -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 -214
- 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 +81 -38
- package/lib/src/model/Ad4mModel.js +651 -408
- package/lib/src/model/Ad4mModel.test.js +488 -750
- package/lib/src/model/ModelQueryBuilder.d.ts +28 -21
- package/lib/src/model/ModelQueryBuilder.js +160 -195
- package/lib/src/model/decorators.d.ts +22 -0
- package/lib/src/model/decorators.js +7 -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 +8 -60
- package/lib/src/model/hydration.js +41 -541
- 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 +36 -22
- package/lib/src/model/query-sparql.js +188 -53
- 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/query-utils.js +4 -0
- package/lib/src/model/shacl-gen.js +4 -0
- 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.js +48 -2
- package/lib/src/model/types.d.ts +58 -1
- 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 -15
- package/lib/src/perspectives/PerspectiveClient.js +168 -400
- 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 +95 -71
- package/lib/src/perspectives/PerspectiveProxy.js +288 -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 +1182 -1288
- 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 -2
- package/src/jestSetup.ts +1 -1
- package/src/language/Icon.ts +0 -4
- package/src/language/Language.ts +50 -292
- 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 +827 -808
- package/src/model/Ad4mModel.ts +676 -457
- package/src/model/ModelQueryBuilder.ts +199 -217
- package/src/model/decorators.ts +29 -0
- package/src/model/hydration.ts +17 -572
- package/src/model/index.ts +0 -4
- package/src/model/query-sparql.test.ts +360 -0
- package/src/model/query-sparql.ts +203 -56
- package/src/model/query-utils.ts +4 -0
- package/src/model/shacl-gen.ts +5 -0
- package/src/model/types.ts +62 -1
- 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 +227 -412
- 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 +325 -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/lib/src/model/query-surreal.d.ts +0 -44
- package/lib/src/model/query-surreal.js +0 -249
- package/lib/src/model/surreal-utils.d.ts +0 -42
- 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/hydration-batch.ts +0 -205
- 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-pool.ts +0 -163
- 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
- package/tsconfig-browser.json +0 -82
|
@@ -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,11 +43,17 @@ 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
|
-
|
|
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");
|
|
57
50
|
__classPrivateFieldSet(this, _PerspectiveClient_perspectiveAddedCallbacks, [], "f");
|
|
58
51
|
__classPrivateFieldSet(this, _PerspectiveClient_perspectiveUpdatedCallbacks, [], "f");
|
|
59
52
|
__classPrivateFieldSet(this, _PerspectiveClient_perspectiveRemovedCallbacks, [], "f");
|
|
60
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");
|
|
61
57
|
if (subscribe) {
|
|
62
58
|
this.subscribePerspectiveAdded();
|
|
63
59
|
this.subscribePerspectiveUpdated();
|
|
@@ -77,310 +73,148 @@ export class PerspectiveClient {
|
|
|
77
73
|
return __classPrivateFieldGet(this, _PerspectiveClient_aiClient, "f");
|
|
78
74
|
}
|
|
79
75
|
async all() {
|
|
80
|
-
const
|
|
81
|
-
query: gql `query perspectives {
|
|
82
|
-
perspectives {
|
|
83
|
-
${PERSPECTIVE_HANDLE_FIELDS}
|
|
84
|
-
}
|
|
85
|
-
}`
|
|
86
|
-
}));
|
|
76
|
+
const perspectives = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.all');
|
|
87
77
|
return perspectives.map(handle => new PerspectiveProxy(handle, this));
|
|
88
78
|
}
|
|
89
79
|
async byUUID(uuid) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
+
}
|
|
101
91
|
}
|
|
102
92
|
async snapshotByUUID(uuid) {
|
|
103
|
-
|
|
104
|
-
query: gql `query perspectiveSnapshot($uuid: String!) {
|
|
105
|
-
perspectiveSnapshot(uuid: $uuid) {
|
|
106
|
-
links { ${LINK_EXPRESSION_FIELDS} }
|
|
107
|
-
}
|
|
108
|
-
}`,
|
|
109
|
-
variables: { uuid }
|
|
110
|
-
}));
|
|
111
|
-
return perspectiveSnapshot;
|
|
93
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.snapshot', { uuid });
|
|
112
94
|
}
|
|
113
95
|
async publishSnapshotByUUID(uuid) {
|
|
114
|
-
|
|
115
|
-
mutation: gql `mutation perspectivePublishSnapshot($uuid: String!) {
|
|
116
|
-
perspectivePublishSnapshot(uuid: $uuid)
|
|
117
|
-
}`,
|
|
118
|
-
variables: { uuid }
|
|
119
|
-
}));
|
|
120
|
-
return perspectivePublishSnapshot;
|
|
96
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.publishSnapshot', { uuid });
|
|
121
97
|
}
|
|
122
98
|
async queryLinks(uuid, query) {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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);
|
|
132
113
|
}
|
|
133
114
|
async queryProlog(uuid, query) {
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
137
|
-
}`,
|
|
138
|
-
variables: { uuid, query }
|
|
139
|
-
}));
|
|
140
|
-
return JSON.parse(perspectiveQueryProlog);
|
|
115
|
+
const result = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.queryProlog', { uuid, query });
|
|
116
|
+
return JSON.parse(result);
|
|
141
117
|
}
|
|
142
118
|
async querySparql(uuid, query) {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
perspectiveQuerySparql(uuid: $uuid, query: $query)
|
|
146
|
-
}`,
|
|
147
|
-
variables: { uuid, query }
|
|
148
|
-
}));
|
|
149
|
-
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);
|
|
150
121
|
}
|
|
151
122
|
async subscribeQuery(uuid, query) {
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
let finalResult = result;
|
|
163
|
-
let isInit = false;
|
|
164
|
-
if (finalResult.startsWith("#init#")) {
|
|
165
|
-
finalResult = finalResult.substring(6);
|
|
166
|
-
isInit = true;
|
|
167
|
-
}
|
|
168
|
-
try {
|
|
169
|
-
finalResult = JSON.parse(finalResult);
|
|
170
|
-
}
|
|
171
|
-
catch (e) {
|
|
172
|
-
console.error('Error parsing perspectiveSubscribeQuery result:', e);
|
|
173
|
-
}
|
|
174
|
-
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 });
|
|
175
133
|
}
|
|
176
134
|
subscribeToQueryUpdates(subscriptionId, onData) {
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}).subscribe({
|
|
187
|
-
next: (result) => {
|
|
188
|
-
if (result.data && result.data.perspectiveQuerySubscription) {
|
|
189
|
-
let finalResult = result.data.perspectiveQuerySubscription;
|
|
190
|
-
let isInit = false;
|
|
191
|
-
if (finalResult.startsWith("#init#")) {
|
|
192
|
-
finalResult = finalResult.substring(6);
|
|
193
|
-
isInit = true;
|
|
194
|
-
}
|
|
195
|
-
try {
|
|
196
|
-
finalResult = JSON.parse(finalResult);
|
|
197
|
-
if (isInit && typeof finalResult === 'object') {
|
|
198
|
-
finalResult.isInit = true;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
catch (e) {
|
|
202
|
-
console.error('Error parsing perspectiveQuerySubscription:', e);
|
|
203
|
-
}
|
|
204
|
-
onData(finalResult);
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
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);
|
|
208
144
|
});
|
|
209
|
-
|
|
145
|
+
__classPrivateFieldGet(this, _PerspectiveClient_querySubscriptionUnsubscribers, "f").set(subscriptionId, unsub);
|
|
146
|
+
return unsub;
|
|
210
147
|
}
|
|
211
148
|
async keepAliveQuery(uuid, subscriptionId) {
|
|
212
|
-
|
|
213
|
-
mutation: gql `mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
|
|
214
|
-
perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
215
|
-
}`,
|
|
216
|
-
variables: { uuid, subscriptionId }
|
|
217
|
-
}));
|
|
218
|
-
return perspectiveKeepAliveQuery;
|
|
149
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.keepAliveQuery', { uuid, subscriptionId });
|
|
219
150
|
}
|
|
220
151
|
async disposeQuerySubscription(uuid, subscriptionId) {
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
})
|
|
227
|
-
|
|
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
|
+
};
|
|
228
169
|
}
|
|
229
170
|
async add(name) {
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
perspectiveAdd(name: $name) {
|
|
233
|
-
${PERSPECTIVE_HANDLE_FIELDS}
|
|
234
|
-
}
|
|
235
|
-
}`,
|
|
236
|
-
variables: { name }
|
|
237
|
-
}));
|
|
238
|
-
return new PerspectiveProxy(perspectiveAdd, this);
|
|
171
|
+
const handle = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.create', { name });
|
|
172
|
+
return new PerspectiveProxy(handle, this);
|
|
239
173
|
}
|
|
240
174
|
async update(uuid, name) {
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
perspectiveUpdate(uuid: $uuid, name: $name) {
|
|
244
|
-
${PERSPECTIVE_HANDLE_FIELDS}
|
|
245
|
-
}
|
|
246
|
-
}`,
|
|
247
|
-
variables: { uuid, name }
|
|
248
|
-
}));
|
|
249
|
-
return new PerspectiveProxy(perspectiveUpdate, this);
|
|
175
|
+
const handle = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.update', { uuid, name });
|
|
176
|
+
return new PerspectiveProxy(handle, this);
|
|
250
177
|
}
|
|
251
178
|
async remove(uuid) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
perspectiveRemove(uuid: $uuid)
|
|
255
|
-
}`,
|
|
256
|
-
variables: { uuid }
|
|
257
|
-
}));
|
|
179
|
+
const result = await __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.remove', { uuid });
|
|
180
|
+
return { perspectiveRemove: result };
|
|
258
181
|
}
|
|
259
182
|
async addLink(uuid, link, status = 'shared', batchId) {
|
|
260
|
-
|
|
261
|
-
mutation: gql `mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
|
|
262
|
-
perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
263
|
-
${LINK_EXPRESSION_FIELDS}
|
|
264
|
-
}
|
|
265
|
-
}`,
|
|
266
|
-
variables: { uuid, link, status, batchId }
|
|
267
|
-
}));
|
|
268
|
-
return perspectiveAddLink;
|
|
183
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.addLink', { uuid, link, status, batchId });
|
|
269
184
|
}
|
|
270
185
|
async addLinks(uuid, links, status = 'shared', batchId) {
|
|
271
|
-
|
|
272
|
-
mutation: gql `mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
|
|
273
|
-
perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
|
|
274
|
-
${LINK_EXPRESSION_FIELDS}
|
|
275
|
-
}
|
|
276
|
-
}`,
|
|
277
|
-
variables: { uuid, links, status, batchId }
|
|
278
|
-
}));
|
|
279
|
-
return perspectiveAddLinks;
|
|
186
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status, batchId });
|
|
280
187
|
}
|
|
281
188
|
async removeLinks(uuid, links, batchId) {
|
|
282
|
-
|
|
283
|
-
mutation: gql `mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
|
|
284
|
-
perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
|
|
285
|
-
${LINK_EXPRESSION_FIELDS}
|
|
286
|
-
}
|
|
287
|
-
}`,
|
|
288
|
-
variables: { uuid, links, batchId }
|
|
289
|
-
}));
|
|
290
|
-
return perspectiveRemoveLinks;
|
|
189
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLinks', { uuid, links, batchId });
|
|
291
190
|
}
|
|
292
191
|
async linkMutations(uuid, mutations, status) {
|
|
293
|
-
|
|
294
|
-
mutation: gql `mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
|
|
295
|
-
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
|
|
296
|
-
additions {
|
|
297
|
-
${LINK_EXPRESSION_FIELDS}
|
|
298
|
-
}
|
|
299
|
-
removals {
|
|
300
|
-
${LINK_EXPRESSION_FIELDS}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}`,
|
|
304
|
-
variables: { uuid, mutations, status }
|
|
305
|
-
}));
|
|
306
|
-
return perspectiveLinkMutations;
|
|
192
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.linkMutations', { uuid, mutations, status });
|
|
307
193
|
}
|
|
308
194
|
async addLinkExpression(uuid, link, status = 'shared', batchId) {
|
|
309
|
-
|
|
310
|
-
mutation: gql `mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
|
|
311
|
-
perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
312
|
-
${LINK_EXPRESSION_FIELDS}
|
|
313
|
-
}
|
|
314
|
-
}`,
|
|
315
|
-
variables: { uuid, link, status, batchId }
|
|
316
|
-
}));
|
|
317
|
-
return perspectiveAddLinkExpression;
|
|
195
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinkExpression', { uuid, link, status, batchId });
|
|
318
196
|
}
|
|
319
197
|
async updateLink(uuid, oldLink, newLink, batchId) {
|
|
320
|
-
|
|
321
|
-
mutation: gql `mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
|
|
322
|
-
perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
|
|
323
|
-
${LINK_EXPRESSION_FIELDS}
|
|
324
|
-
}
|
|
325
|
-
}`,
|
|
326
|
-
variables: { uuid, oldLink, newLink, batchId }
|
|
327
|
-
}));
|
|
328
|
-
return perspectiveUpdateLink;
|
|
198
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.updateLink', { uuid, oldLink, newLink, batchId });
|
|
329
199
|
}
|
|
330
200
|
async removeLink(uuid, link, batchId) {
|
|
331
201
|
delete link.__typename;
|
|
332
202
|
delete link.data.__typename;
|
|
333
203
|
delete link.proof.__typename;
|
|
334
204
|
delete link.status;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
338
|
-
}`,
|
|
339
|
-
variables: { uuid, link, batchId }
|
|
340
|
-
}));
|
|
341
|
-
return perspectiveRemoveLink;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Adds Social DNA code to a perspective.
|
|
345
|
-
*
|
|
346
|
-
* Preferred usage: pass shaclJson (from SHACLShape.toJSON()) as the primary schema definition.
|
|
347
|
-
* The sdnaCode parameter is kept for backward compatibility but SHACL is the source of truth
|
|
348
|
-
* for all SDNA operations. Prolog engines remain available for complex queries.
|
|
349
|
-
*
|
|
350
|
-
* @param sdnaCode - Legacy Prolog code (pass empty string when using shaclJson)
|
|
351
|
-
* @param shaclJson - SHACL JSON string from SHACLShape.toJSON() (recommended)
|
|
352
|
-
*/
|
|
205
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLink', { uuid, link, batchId });
|
|
206
|
+
}
|
|
353
207
|
async addSdna(uuid, name, sdnaCode, sdnaType, shaclJson) {
|
|
354
|
-
return
|
|
355
|
-
mutation: gql `mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
|
|
356
|
-
perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
|
|
357
|
-
}`,
|
|
358
|
-
variables: { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson }
|
|
359
|
-
})).perspectiveAddSdna;
|
|
208
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson });
|
|
360
209
|
}
|
|
361
210
|
async executeCommands(uuid, commands, expression, parameters, batchId) {
|
|
362
|
-
return
|
|
363
|
-
mutation: gql `mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
|
|
364
|
-
perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
|
|
365
|
-
}`,
|
|
366
|
-
variables: { uuid, commands, expression, parameters, batchId }
|
|
367
|
-
})).perspectiveExecuteCommands;
|
|
211
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.executeCommands', { uuid, commands, expression, parameters, batchId });
|
|
368
212
|
}
|
|
369
213
|
async createSubject(uuid, subjectClass, expressionAddress, initialValues, batchId) {
|
|
370
|
-
return
|
|
371
|
-
mutation: gql `mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
|
|
372
|
-
perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
|
|
373
|
-
}`,
|
|
374
|
-
variables: { uuid, subjectClass, expressionAddress, initialValues, batchId }
|
|
375
|
-
})).perspectiveCreateSubject;
|
|
214
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.createSubject', { uuid, subjectClass, expressionAddress, initialValues, batchId });
|
|
376
215
|
}
|
|
377
216
|
async getSubjectData(uuid, subjectClass, expressionAddress) {
|
|
378
|
-
return
|
|
379
|
-
mutation: gql `mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
|
|
380
|
-
perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
|
|
381
|
-
}`,
|
|
382
|
-
variables: { uuid, subjectClass, expressionAddress }
|
|
383
|
-
})).perspectiveGetSubjectData;
|
|
217
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.getSubjectData', { uuid, subjectClass, expressionAddress });
|
|
384
218
|
}
|
|
385
219
|
// ExpressionClient functions, needed for Subjects:
|
|
386
220
|
async getExpression(expressionURI) {
|
|
@@ -394,166 +228,100 @@ export class PerspectiveClient {
|
|
|
394
228
|
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").push(cb);
|
|
395
229
|
}
|
|
396
230
|
subscribePerspectiveAdded() {
|
|
397
|
-
__classPrivateFieldGet(this,
|
|
398
|
-
|
|
399
|
-
|
|
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));
|
|
400
234
|
}
|
|
401
|
-
`
|
|
402
|
-
}).subscribe({
|
|
403
|
-
next: result => {
|
|
404
|
-
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").forEach(cb => {
|
|
405
|
-
cb(result.data.perspectiveAdded);
|
|
406
|
-
});
|
|
407
|
-
},
|
|
408
|
-
error: (e) => console.error(e)
|
|
409
235
|
});
|
|
236
|
+
__classPrivateFieldGet(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
410
237
|
}
|
|
411
238
|
addPerspectiveUpdatedListener(cb) {
|
|
412
239
|
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").push(cb);
|
|
413
240
|
}
|
|
414
241
|
subscribePerspectiveUpdated() {
|
|
415
|
-
__classPrivateFieldGet(this,
|
|
416
|
-
|
|
417
|
-
|
|
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));
|
|
418
245
|
}
|
|
419
|
-
`
|
|
420
|
-
}).subscribe({
|
|
421
|
-
next: result => {
|
|
422
|
-
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").forEach(cb => {
|
|
423
|
-
cb(result.data.perspectiveUpdated);
|
|
424
|
-
});
|
|
425
|
-
},
|
|
426
|
-
error: (e) => console.error(e)
|
|
427
246
|
});
|
|
247
|
+
__classPrivateFieldGet(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
428
248
|
}
|
|
429
249
|
addPerspectiveSyncedListener(cb) {
|
|
430
250
|
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, "f").push(cb);
|
|
431
251
|
}
|
|
432
252
|
async addPerspectiveSyncStateChangeListener(uuid, cb) {
|
|
433
|
-
__classPrivateFieldGet(this,
|
|
434
|
-
|
|
435
|
-
|
|
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));
|
|
436
256
|
}
|
|
437
|
-
`
|
|
438
|
-
}).subscribe({
|
|
439
|
-
next: result => {
|
|
440
|
-
cb.forEach(c => {
|
|
441
|
-
c(result.data.perspectiveSyncStateChange);
|
|
442
|
-
});
|
|
443
|
-
},
|
|
444
|
-
error: (e) => console.error(e)
|
|
445
257
|
});
|
|
258
|
+
__classPrivateFieldGet(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
446
259
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
447
260
|
}
|
|
448
261
|
addPerspectiveRemovedListener(cb) {
|
|
449
262
|
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").push(cb);
|
|
450
263
|
}
|
|
451
264
|
subscribePerspectiveRemoved() {
|
|
452
|
-
__classPrivateFieldGet(this,
|
|
453
|
-
|
|
454
|
-
|
|
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));
|
|
455
268
|
}
|
|
456
|
-
`
|
|
457
|
-
}).subscribe({
|
|
458
|
-
next: result => {
|
|
459
|
-
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").forEach(cb => {
|
|
460
|
-
cb(result.data.perspectiveRemoved);
|
|
461
|
-
});
|
|
462
|
-
},
|
|
463
|
-
error: (e) => console.error(e)
|
|
464
269
|
});
|
|
270
|
+
__classPrivateFieldGet(this, _PerspectiveClient_unsubscribers, "f").push(unsub);
|
|
465
271
|
}
|
|
466
272
|
async addPerspectiveLinkAddedListener(uuid, cb) {
|
|
467
|
-
__classPrivateFieldGet(this,
|
|
468
|
-
|
|
469
|
-
|
|
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));
|
|
470
276
|
}
|
|
471
|
-
`
|
|
472
|
-
}).subscribe({
|
|
473
|
-
next: result => {
|
|
474
|
-
cb.forEach(c => {
|
|
475
|
-
c(result.data.perspectiveLinkAdded);
|
|
476
|
-
});
|
|
477
|
-
},
|
|
478
|
-
error: (e) => console.error(e)
|
|
479
277
|
});
|
|
480
|
-
|
|
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();
|
|
481
282
|
}
|
|
482
283
|
async addPerspectiveLinkRemovedListener(uuid, cb) {
|
|
483
|
-
__classPrivateFieldGet(this,
|
|
484
|
-
|
|
485
|
-
|
|
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));
|
|
486
291
|
}
|
|
487
|
-
`
|
|
488
|
-
}).subscribe({
|
|
489
|
-
next: result => {
|
|
490
|
-
cb.forEach(c => {
|
|
491
|
-
if (!result.data.perspectiveLinkRemoved.status) {
|
|
492
|
-
delete result.data.perspectiveLinkRemoved.status;
|
|
493
|
-
}
|
|
494
|
-
c(result.data.perspectiveLinkRemoved);
|
|
495
|
-
});
|
|
496
|
-
},
|
|
497
|
-
error: (e) => console.error(e)
|
|
498
292
|
});
|
|
499
|
-
|
|
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();
|
|
500
297
|
}
|
|
501
298
|
async addPerspectiveLinkUpdatedListener(uuid, cb) {
|
|
502
|
-
__classPrivateFieldGet(this,
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
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;
|
|
511
308
|
}
|
|
309
|
+
cb.forEach(c => c(data));
|
|
512
310
|
}
|
|
513
|
-
`
|
|
514
|
-
}).subscribe({
|
|
515
|
-
next: result => {
|
|
516
|
-
cb.forEach(c => {
|
|
517
|
-
if (!result.data.perspectiveLinkUpdated.newLink.status) {
|
|
518
|
-
delete result.data.perspectiveLinkUpdated.newLink.status;
|
|
519
|
-
}
|
|
520
|
-
if (!result.data.perspectiveLinkUpdated.oldLink.status) {
|
|
521
|
-
delete result.data.perspectiveLinkUpdated.oldLink.status;
|
|
522
|
-
}
|
|
523
|
-
c(result.data.perspectiveLinkUpdated);
|
|
524
|
-
});
|
|
525
|
-
},
|
|
526
|
-
error: (e) => console.error(e)
|
|
527
311
|
});
|
|
528
|
-
|
|
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();
|
|
529
316
|
}
|
|
530
317
|
getNeighbourhoodProxy(uuid) {
|
|
531
318
|
return new NeighbourhoodProxy(__classPrivateFieldGet(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
|
|
532
319
|
}
|
|
533
320
|
async createBatch(uuid) {
|
|
534
|
-
|
|
535
|
-
mutation: gql `mutation perspectiveCreateBatch($uuid: String!) {
|
|
536
|
-
perspectiveCreateBatch(uuid: $uuid)
|
|
537
|
-
}`,
|
|
538
|
-
variables: { uuid }
|
|
539
|
-
}));
|
|
540
|
-
return perspectiveCreateBatch;
|
|
321
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.createBatch', { uuid });
|
|
541
322
|
}
|
|
542
323
|
async commitBatch(uuid, batchId) {
|
|
543
|
-
|
|
544
|
-
mutation: gql `mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
|
|
545
|
-
perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
|
|
546
|
-
additions {
|
|
547
|
-
${LINK_EXPRESSION_FIELDS}
|
|
548
|
-
}
|
|
549
|
-
removals {
|
|
550
|
-
${LINK_EXPRESSION_FIELDS}
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
}`,
|
|
554
|
-
variables: { uuid, batchId }
|
|
555
|
-
}));
|
|
556
|
-
return perspectiveCommitBatch;
|
|
324
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_apiClient, "f").call('perspective.commitBatch', { uuid, batchId });
|
|
557
325
|
}
|
|
558
326
|
}
|
|
559
|
-
|
|
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();
|