@coasys/ad4m 0.12.0-rc1-dev.2 → 0.12.0-rc1-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jest.config.js +10 -3
- package/lib/index.cjs +6872 -5886
- package/lib/index.js +6868 -5874
- package/lib/src/Ad4mClient.d.ts +9 -16
- package/lib/src/Ad4mClient.js +46 -25
- package/lib/src/Literal.d.ts +1 -2
- package/lib/src/Literal.js +38 -35
- package/lib/src/SmartLiteral.d.ts +1 -2
- package/lib/src/SmartLiteral.js +30 -15
- package/lib/src/agent/AgentClient.d.ts +1 -4
- package/lib/src/agent/AgentClient.js +79 -99
- package/lib/src/ai/AIClient.d.ts +1 -2
- package/lib/src/ai/AIClient.js +224 -220
- package/lib/src/expression/ExpressionClient.d.ts +1 -1
- package/lib/src/expression/ExpressionClient.js +73 -86
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/language/LanguageClient.d.ts +1 -1
- package/lib/src/language/LanguageClient.js +52 -52
- package/lib/src/model/Ad4mModel.d.ts +1351 -144
- package/lib/src/model/Ad4mModel.js +3737 -228
- package/lib/src/model/Ad4mModel.test.js +522 -979
- package/lib/src/model/Subject.d.ts +3 -3
- package/lib/src/model/Subject.js +25 -25
- package/lib/src/model/decorators.d.ts +444 -100
- package/lib/src/model/decorators.js +686 -321
- package/lib/src/model/util.d.ts +6 -6
- package/lib/src/model/util.js +24 -24
- package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +1 -5
- package/lib/src/neighbourhood/NeighbourhoodClient.js +179 -242
- package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +1 -2
- package/lib/src/neighbourhood/NeighbourhoodProxy.js +28 -13
- package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +5 -1
- package/lib/src/perspectives/PerspectiveClient.d.ts +9 -9
- package/lib/src/perspectives/PerspectiveClient.js +240 -316
- package/lib/src/perspectives/PerspectiveProxy.d.ts +99 -61
- package/lib/src/perspectives/PerspectiveProxy.js +485 -832
- package/lib/src/runtime/RuntimeClient.d.ts +1 -5
- package/lib/src/runtime/RuntimeClient.js +238 -412
- package/lib/src/shacl/SHACLFlow.test.js +105 -164
- package/lib/src/shacl/SHACLShape.d.ts +12 -17
- package/lib/src/shacl/SHACLShape.js +115 -128
- package/lib/src/shacl/SHACLShape.test.js +176 -244
- package/lib/src/shims/reflect-metadata.d.ts +0 -0
- package/lib/src/shims/type-graphql.d.ts +32 -0
- package/lib/src/src/Ad4mClient.d.ts +28 -0
- package/lib/src/src/Address.d.ts +1 -0
- package/lib/src/src/DID.d.ts +1 -0
- package/lib/src/src/Exception.d.ts +7 -0
- package/lib/src/src/Literal.d.ts +7 -0
- package/lib/src/src/PubSub.d.ts +17 -0
- package/lib/src/src/SmartLiteral.d.ts +12 -0
- package/lib/src/src/agent/Agent.d.ts +110 -0
- package/lib/src/src/agent/AgentClient.d.ts +62 -0
- package/lib/src/src/agent/AgentResolver.d.ts +30 -0
- package/lib/src/src/agent/AgentStatus.d.ts +8 -0
- package/lib/src/src/ai/AIClient.d.ts +32 -0
- package/lib/src/src/ai/AIResolver.d.ts +75 -0
- package/lib/src/src/ai/Tasks.d.ts +37 -0
- package/lib/src/src/buildSchema.d.ts +1 -0
- package/lib/src/src/expression/Expression.d.ts +28 -0
- package/lib/src/src/expression/ExpressionClient.d.ts +13 -0
- package/lib/src/src/expression/ExpressionRef.d.ts +9 -0
- package/lib/src/src/expression/ExpressionResolver.d.ts +10 -0
- package/lib/src/src/index.d.ts +35 -0
- package/lib/src/src/jestSetup.d.ts +1 -0
- package/lib/src/src/language/Icon.d.ts +4 -0
- package/lib/src/src/language/Language.d.ts +206 -0
- package/lib/src/src/language/LanguageClient.d.ts +17 -0
- package/lib/src/src/language/LanguageContext.d.ts +37 -0
- package/lib/src/src/language/LanguageHandle.d.ts +9 -0
- package/lib/src/src/language/LanguageMeta.d.ts +35 -0
- package/lib/src/src/language/LanguageRef.d.ts +6 -0
- package/lib/src/src/language/LanguageResolver.d.ts +19 -0
- package/lib/src/src/links/Links.d.ts +39 -0
- package/lib/src/src/links/Links.test.d.ts +1 -0
- package/lib/src/src/model/Ad4mModel.d.ts +1438 -0
- package/lib/src/src/model/Ad4mModel.test.d.ts +1 -0
- package/lib/src/src/model/Subject.d.ts +25 -0
- package/lib/src/src/model/decorators.d.ts +545 -0
- package/lib/src/src/model/util.d.ts +12 -0
- package/lib/src/src/neighbourhood/Neighbourhood.d.ts +10 -0
- package/lib/src/src/neighbourhood/NeighbourhoodClient.d.ts +25 -0
- package/lib/src/src/neighbourhood/NeighbourhoodProxy.d.ts +19 -0
- package/lib/src/src/neighbourhood/NeighbourhoodProxy.test.d.ts +1 -0
- package/lib/src/src/neighbourhood/NeighbourhoodResolver.d.ts +24 -0
- package/lib/src/src/perspectives/LinkQuery.d.ts +11 -0
- package/lib/src/src/perspectives/Perspective.d.ts +38 -0
- package/lib/src/src/perspectives/Perspective.test.d.ts +1 -0
- package/lib/src/src/perspectives/PerspectiveClient.d.ts +97 -0
- package/lib/src/src/perspectives/PerspectiveDiff.d.ts +9 -0
- package/lib/src/src/perspectives/PerspectiveHandle.d.ts +18 -0
- package/lib/src/src/perspectives/PerspectiveProxy.d.ts +865 -0
- package/lib/src/src/perspectives/PerspectiveResolver.d.ts +57 -0
- package/lib/src/src/runtime/RuntimeClient.d.ts +56 -0
- package/lib/src/src/runtime/RuntimeResolver.d.ts +132 -0
- package/lib/src/src/shacl/SHACLFlow.d.ts +171 -0
- package/lib/src/src/shacl/SHACLFlow.test.d.ts +1 -0
- package/lib/src/src/shacl/SHACLShape.d.ts +117 -0
- package/lib/src/src/shacl/SHACLShape.test.d.ts +1 -0
- package/lib/src/src/typeDefs.d.ts +1 -0
- package/lib/src/src/unwrapApolloResult.d.ts +2 -0
- package/lib/src/src/utils.d.ts +25 -0
- package/lib/src/utils.d.ts +0 -8
- package/lib/src/utils.js +7 -21
- package/package.json +15 -14
- package/src/Ad4mClient.test.ts +1315 -1564
- package/src/Ad4mClient.ts +54 -55
- package/src/Literal.test.ts +26 -45
- package/src/Literal.ts +66 -82
- package/src/SmartLiteral.ts +58 -74
- package/src/agent/AgentClient.ts +99 -144
- package/src/ai/AIClient.ts +359 -409
- package/src/expression/ExpressionClient.ts +96 -142
- package/src/index.ts +1 -1
- package/src/language/LanguageClient.ts +113 -137
- package/src/model/Ad4mModel.test.ts +616 -1114
- package/src/model/Ad4mModel.ts +4361 -451
- package/src/model/Subject.ts +159 -0
- package/src/model/decorators.ts +1168 -667
- package/src/model/util.ts +54 -53
- package/src/neighbourhood/NeighbourhoodClient.ts +266 -392
- package/src/neighbourhood/NeighbourhoodProxy.test.ts +7 -3
- package/src/neighbourhood/NeighbourhoodProxy.ts +40 -58
- package/src/perspectives/PerspectiveClient.ts +540 -779
- package/src/perspectives/PerspectiveProxy.ts +2067 -2860
- package/src/runtime/RuntimeClient.ts +476 -775
- package/src/shacl/SHACLFlow.test.ts +129 -196
- package/src/shacl/SHACLShape.test.ts +190 -284
- package/src/shacl/SHACLShape.ts +200 -224
- package/src/utils.ts +17 -31
- package/tsconfig.json +10 -9
- package/src/model/IMPROVEMENTS.md +0 -482
- package/src/model/PREDICATE_COLLISION_FIX.md +0 -651
- package/src/model/README.md +0 -317
- package/src/model/SHACL_MUTATION_DECOUPLING.md +0 -356
- package/src/model/SUBSCRIPTION_STRATEGY.md +0 -317
- package/src/model/TC39_STAGE_3_DECORATORS.md +0 -609
- package/src/model/mutation.ts +0 -461
- package/src/model/parentUtils.ts +0 -91
- package/src/model/prolog/generatePrologFacts.ts +0 -176
- package/src/model/prolog/index.ts +0 -1
- package/src/model/query/ModelQueryBuilder.ts +0 -173
- package/src/model/query/fetchInstance.ts +0 -181
- package/src/model/query/hydration.ts +0 -273
- package/src/model/query/operations.ts +0 -510
- package/src/model/query/snapshot.ts +0 -126
- package/src/model/query/surrealCompiler.ts +0 -376
- package/src/model/schema/fromJSONSchema.ts +0 -411
- package/src/model/schema/metadata.ts +0 -148
- package/src/model/subscription.ts +0 -307
- package/src/model/transaction.ts +0 -60
- package/src/model/types.ts +0 -207
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _PerspectiveClient_apolloClient, _PerspectiveClient_perspectiveAddedCallbacks, _PerspectiveClient_perspectiveUpdatedCallbacks, _PerspectiveClient_perspectiveRemovedCallbacks, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, _PerspectiveClient_expressionClient, _PerspectiveClient_neighbourhoodClient, _PerspectiveClient_aiClient;
|
|
1
13
|
import { gql } from "@apollo/client/core";
|
|
2
14
|
import { NeighbourhoodProxy } from "../neighbourhood/NeighbourhoodProxy";
|
|
3
15
|
import unwrapApolloResult from "../unwrapApolloResult";
|
|
4
|
-
import { PerspectiveProxy } from
|
|
5
|
-
import { isSocketCloseError } from "../utils";
|
|
16
|
+
import { PerspectiveProxy } from './PerspectiveProxy';
|
|
6
17
|
const LINK_EXPRESSION_FIELDS = `
|
|
7
18
|
author
|
|
8
19
|
timestamp
|
|
@@ -34,11 +45,19 @@ neighbourhood {
|
|
|
34
45
|
`;
|
|
35
46
|
export class PerspectiveClient {
|
|
36
47
|
constructor(client, subscribe = true) {
|
|
37
|
-
this
|
|
38
|
-
this
|
|
39
|
-
this
|
|
40
|
-
this
|
|
41
|
-
this
|
|
48
|
+
_PerspectiveClient_apolloClient.set(this, void 0);
|
|
49
|
+
_PerspectiveClient_perspectiveAddedCallbacks.set(this, void 0);
|
|
50
|
+
_PerspectiveClient_perspectiveUpdatedCallbacks.set(this, void 0);
|
|
51
|
+
_PerspectiveClient_perspectiveRemovedCallbacks.set(this, void 0);
|
|
52
|
+
_PerspectiveClient_perspectiveSyncStateChangeCallbacks.set(this, void 0);
|
|
53
|
+
_PerspectiveClient_expressionClient.set(this, void 0);
|
|
54
|
+
_PerspectiveClient_neighbourhoodClient.set(this, void 0);
|
|
55
|
+
_PerspectiveClient_aiClient.set(this, void 0);
|
|
56
|
+
__classPrivateFieldSet(this, _PerspectiveClient_apolloClient, client, "f");
|
|
57
|
+
__classPrivateFieldSet(this, _PerspectiveClient_perspectiveAddedCallbacks, [], "f");
|
|
58
|
+
__classPrivateFieldSet(this, _PerspectiveClient_perspectiveUpdatedCallbacks, [], "f");
|
|
59
|
+
__classPrivateFieldSet(this, _PerspectiveClient_perspectiveRemovedCallbacks, [], "f");
|
|
60
|
+
__classPrivateFieldSet(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, [], "f");
|
|
42
61
|
if (subscribe) {
|
|
43
62
|
this.subscribePerspectiveAdded();
|
|
44
63
|
this.subscribePerspectiveUpdated();
|
|
@@ -46,81 +65,77 @@ export class PerspectiveClient {
|
|
|
46
65
|
}
|
|
47
66
|
}
|
|
48
67
|
setExpressionClient(client) {
|
|
49
|
-
this
|
|
68
|
+
__classPrivateFieldSet(this, _PerspectiveClient_expressionClient, client, "f");
|
|
50
69
|
}
|
|
51
70
|
setNeighbourhoodClient(client) {
|
|
52
|
-
this
|
|
71
|
+
__classPrivateFieldSet(this, _PerspectiveClient_neighbourhoodClient, client, "f");
|
|
53
72
|
}
|
|
54
73
|
setAIClient(client) {
|
|
55
|
-
this
|
|
74
|
+
__classPrivateFieldSet(this, _PerspectiveClient_aiClient, client, "f");
|
|
56
75
|
}
|
|
57
76
|
get aiClient() {
|
|
58
|
-
return this
|
|
77
|
+
return __classPrivateFieldGet(this, _PerspectiveClient_aiClient, "f");
|
|
59
78
|
}
|
|
60
79
|
async all() {
|
|
61
|
-
const { perspectives } = unwrapApolloResult(await this.
|
|
80
|
+
const { perspectives } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").query({
|
|
62
81
|
query: gql `query perspectives {
|
|
63
82
|
perspectives {
|
|
64
83
|
${PERSPECTIVE_HANDLE_FIELDS}
|
|
65
84
|
}
|
|
66
|
-
}
|
|
85
|
+
}`
|
|
67
86
|
}));
|
|
68
|
-
return perspectives.map(
|
|
87
|
+
return perspectives.map(handle => new PerspectiveProxy(handle, this));
|
|
69
88
|
}
|
|
70
89
|
async byUUID(uuid) {
|
|
71
|
-
const { perspective } = unwrapApolloResult(await this.
|
|
90
|
+
const { perspective } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").query({
|
|
72
91
|
query: gql `query perspective($uuid: String!) {
|
|
73
92
|
perspective(uuid: $uuid) {
|
|
74
93
|
${PERSPECTIVE_HANDLE_FIELDS}
|
|
75
94
|
}
|
|
76
95
|
}`,
|
|
77
|
-
variables: { uuid }
|
|
96
|
+
variables: { uuid }
|
|
78
97
|
}));
|
|
79
98
|
if (!perspective)
|
|
80
99
|
return null;
|
|
81
100
|
return new PerspectiveProxy(perspective, this);
|
|
82
101
|
}
|
|
83
102
|
async snapshotByUUID(uuid) {
|
|
84
|
-
const { perspectiveSnapshot } = unwrapApolloResult(await this.
|
|
103
|
+
const { perspectiveSnapshot } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").query({
|
|
85
104
|
query: gql `query perspectiveSnapshot($uuid: String!) {
|
|
86
105
|
perspectiveSnapshot(uuid: $uuid) {
|
|
87
106
|
links { ${LINK_EXPRESSION_FIELDS} }
|
|
88
107
|
}
|
|
89
108
|
}`,
|
|
90
|
-
variables: { uuid }
|
|
109
|
+
variables: { uuid }
|
|
91
110
|
}));
|
|
92
111
|
return perspectiveSnapshot;
|
|
93
112
|
}
|
|
94
113
|
async publishSnapshotByUUID(uuid) {
|
|
95
|
-
const { perspectivePublishSnapshot } = unwrapApolloResult(await this.
|
|
96
|
-
mutation: gql `
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
`,
|
|
101
|
-
variables: { uuid },
|
|
114
|
+
const { perspectivePublishSnapshot } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
115
|
+
mutation: gql `mutation perspectivePublishSnapshot($uuid: String!) {
|
|
116
|
+
perspectivePublishSnapshot(uuid: $uuid)
|
|
117
|
+
}`,
|
|
118
|
+
variables: { uuid }
|
|
102
119
|
}));
|
|
103
120
|
return perspectivePublishSnapshot;
|
|
104
121
|
}
|
|
105
122
|
async queryLinks(uuid, query) {
|
|
106
|
-
const { perspectiveQueryLinks } = unwrapApolloResult(await this.
|
|
123
|
+
const { perspectiveQueryLinks } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").query({
|
|
107
124
|
query: gql `query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
|
|
108
125
|
perspectiveQueryLinks(query: $query, uuid: $uuid) {
|
|
109
126
|
${LINK_EXPRESSION_FIELDS}
|
|
110
127
|
}
|
|
111
128
|
}`,
|
|
112
|
-
variables: { uuid, query }
|
|
129
|
+
variables: { uuid, query }
|
|
113
130
|
}));
|
|
114
131
|
return perspectiveQueryLinks;
|
|
115
132
|
}
|
|
116
133
|
async queryProlog(uuid, query) {
|
|
117
|
-
const { perspectiveQueryProlog } = unwrapApolloResult(await this.
|
|
118
|
-
query: gql `
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
`,
|
|
123
|
-
variables: { uuid, query },
|
|
134
|
+
const { perspectiveQueryProlog } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").query({
|
|
135
|
+
query: gql `query perspectiveQueryProlog($uuid: String!, $query: String!) {
|
|
136
|
+
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
137
|
+
}`,
|
|
138
|
+
variables: { uuid, query }
|
|
124
139
|
}));
|
|
125
140
|
return JSON.parse(perspectiveQueryProlog);
|
|
126
141
|
}
|
|
@@ -134,27 +149,23 @@ export class PerspectiveClient {
|
|
|
134
149
|
* as generated from Rust method "perspective_query_surreal_db"
|
|
135
150
|
*/
|
|
136
151
|
async querySurrealDB(uuid, query) {
|
|
137
|
-
const { perspectiveQuerySurrealDb } = unwrapApolloResult(await this.
|
|
138
|
-
query: gql `
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
`,
|
|
143
|
-
variables: { uuid, query },
|
|
152
|
+
const { perspectiveQuerySurrealDb } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").query({
|
|
153
|
+
query: gql `query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
|
|
154
|
+
perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
|
|
155
|
+
}`,
|
|
156
|
+
variables: { uuid, query }
|
|
144
157
|
}));
|
|
145
158
|
return JSON.parse(perspectiveQuerySurrealDb);
|
|
146
159
|
}
|
|
147
160
|
async subscribeQuery(uuid, query) {
|
|
148
|
-
const { perspectiveSubscribeQuery } = unwrapApolloResult(await this.
|
|
149
|
-
mutation: gql `
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
`,
|
|
157
|
-
variables: { uuid, query },
|
|
161
|
+
const { perspectiveSubscribeQuery } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
162
|
+
mutation: gql `mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
|
|
163
|
+
perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
|
|
164
|
+
subscriptionId
|
|
165
|
+
result
|
|
166
|
+
}
|
|
167
|
+
}`,
|
|
168
|
+
variables: { uuid, query }
|
|
158
169
|
}));
|
|
159
170
|
const { subscriptionId, result } = perspectiveSubscribeQuery;
|
|
160
171
|
let finalResult = result;
|
|
@@ -167,23 +178,64 @@ export class PerspectiveClient {
|
|
|
167
178
|
finalResult = JSON.parse(finalResult);
|
|
168
179
|
}
|
|
169
180
|
catch (e) {
|
|
170
|
-
console.error(
|
|
181
|
+
console.error('Error parsing perspectiveSubscribeQuery result:', e);
|
|
171
182
|
}
|
|
172
183
|
return { subscriptionId, result: finalResult, isInit };
|
|
173
184
|
}
|
|
185
|
+
async perspectiveSubscribeSurrealQuery(uuid, query) {
|
|
186
|
+
const { perspectiveSubscribeSurrealQuery } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
187
|
+
mutation: gql `mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
|
|
188
|
+
perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
|
|
189
|
+
subscriptionId
|
|
190
|
+
result
|
|
191
|
+
}
|
|
192
|
+
}`,
|
|
193
|
+
variables: { uuid, query }
|
|
194
|
+
}));
|
|
195
|
+
const { subscriptionId, result } = perspectiveSubscribeSurrealQuery;
|
|
196
|
+
let finalResult = result;
|
|
197
|
+
let isInit = false;
|
|
198
|
+
if (finalResult.startsWith("#init#")) {
|
|
199
|
+
finalResult = finalResult.substring(6);
|
|
200
|
+
isInit = true;
|
|
201
|
+
}
|
|
202
|
+
try {
|
|
203
|
+
finalResult = JSON.parse(finalResult);
|
|
204
|
+
}
|
|
205
|
+
catch (e) {
|
|
206
|
+
console.error('Error parsing perspectiveSubscribeSurrealQuery result:', e);
|
|
207
|
+
}
|
|
208
|
+
return { subscriptionId, result: finalResult, isInit };
|
|
209
|
+
}
|
|
210
|
+
async perspectiveKeepAliveSurrealQuery(uuid, subscriptionId) {
|
|
211
|
+
const { perspectiveKeepAliveSurrealQuery } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
212
|
+
mutation: gql `mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
|
|
213
|
+
perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
214
|
+
}`,
|
|
215
|
+
variables: { uuid, subscriptionId }
|
|
216
|
+
}));
|
|
217
|
+
return perspectiveKeepAliveSurrealQuery;
|
|
218
|
+
}
|
|
219
|
+
async perspectiveDisposeSurrealQuerySubscription(uuid, subscriptionId) {
|
|
220
|
+
const { perspectiveDisposeSurrealQuerySubscription } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
221
|
+
mutation: gql `mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
222
|
+
perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
223
|
+
}`,
|
|
224
|
+
variables: { uuid, subscriptionId }
|
|
225
|
+
}));
|
|
226
|
+
return perspectiveDisposeSurrealQuerySubscription;
|
|
227
|
+
}
|
|
174
228
|
subscribeToQueryUpdates(subscriptionId, onData) {
|
|
175
|
-
const subscription = this.
|
|
176
|
-
.subscribe({
|
|
229
|
+
const subscription = __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").subscribe({
|
|
177
230
|
query: gql `
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
231
|
+
subscription perspectiveQuerySubscription($subscriptionId: String!) {
|
|
232
|
+
perspectiveQuerySubscription(subscriptionId: $subscriptionId)
|
|
233
|
+
}
|
|
234
|
+
`,
|
|
182
235
|
variables: {
|
|
183
|
-
subscriptionId
|
|
184
|
-
}
|
|
185
|
-
})
|
|
186
|
-
.subscribe({
|
|
236
|
+
subscriptionId
|
|
237
|
+
}
|
|
238
|
+
}).subscribe({
|
|
187
239
|
next: (result) => {
|
|
188
240
|
if (result.data && result.data.perspectiveQuerySubscription) {
|
|
189
241
|
let finalResult = result.data.perspectiveQuerySubscription;
|
|
@@ -194,124 +246,103 @@ export class PerspectiveClient {
|
|
|
194
246
|
}
|
|
195
247
|
try {
|
|
196
248
|
finalResult = JSON.parse(finalResult);
|
|
197
|
-
if (isInit && typeof finalResult ===
|
|
249
|
+
if (isInit && typeof finalResult === 'object') {
|
|
198
250
|
finalResult.isInit = true;
|
|
199
251
|
}
|
|
200
252
|
}
|
|
201
253
|
catch (e) {
|
|
202
|
-
console.error(
|
|
254
|
+
console.error('Error parsing perspectiveQuerySubscription:', e);
|
|
203
255
|
}
|
|
204
256
|
onData(finalResult);
|
|
205
257
|
}
|
|
206
258
|
},
|
|
207
|
-
error: (e) =>
|
|
208
|
-
if (!isSocketCloseError(e))
|
|
209
|
-
console.error("Error in query subscription:", e);
|
|
210
|
-
},
|
|
259
|
+
error: (e) => console.error('Error in query subscription:', e)
|
|
211
260
|
});
|
|
212
261
|
return () => subscription.unsubscribe();
|
|
213
262
|
}
|
|
214
263
|
async keepAliveQuery(uuid, subscriptionId) {
|
|
215
|
-
const { perspectiveKeepAliveQuery } = unwrapApolloResult(await this.
|
|
216
|
-
mutation: gql `
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
) {
|
|
221
|
-
perspectiveKeepAliveQuery(
|
|
222
|
-
uuid: $uuid
|
|
223
|
-
subscriptionId: $subscriptionId
|
|
224
|
-
)
|
|
225
|
-
}
|
|
226
|
-
`,
|
|
227
|
-
variables: { uuid, subscriptionId },
|
|
264
|
+
const { perspectiveKeepAliveQuery } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
265
|
+
mutation: gql `mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
|
|
266
|
+
perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
267
|
+
}`,
|
|
268
|
+
variables: { uuid, subscriptionId }
|
|
228
269
|
}));
|
|
229
270
|
return perspectiveKeepAliveQuery;
|
|
230
271
|
}
|
|
231
272
|
async disposeQuerySubscription(uuid, subscriptionId) {
|
|
232
|
-
const { perspectiveDisposeQuerySubscription } = unwrapApolloResult(await this.
|
|
233
|
-
mutation: gql `
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
) {
|
|
238
|
-
perspectiveDisposeQuerySubscription(
|
|
239
|
-
uuid: $uuid
|
|
240
|
-
subscriptionId: $subscriptionId
|
|
241
|
-
)
|
|
242
|
-
}
|
|
243
|
-
`,
|
|
244
|
-
variables: { uuid, subscriptionId },
|
|
273
|
+
const { perspectiveDisposeQuerySubscription } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
274
|
+
mutation: gql `mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
275
|
+
perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
276
|
+
}`,
|
|
277
|
+
variables: { uuid, subscriptionId }
|
|
245
278
|
}));
|
|
246
279
|
return perspectiveDisposeQuerySubscription;
|
|
247
280
|
}
|
|
248
281
|
async add(name) {
|
|
249
|
-
const { perspectiveAdd } = unwrapApolloResult(await this.
|
|
282
|
+
const { perspectiveAdd } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
250
283
|
mutation: gql `mutation perspectiveAdd($name: String!) {
|
|
251
284
|
perspectiveAdd(name: $name) {
|
|
252
285
|
${PERSPECTIVE_HANDLE_FIELDS}
|
|
253
286
|
}
|
|
254
287
|
}`,
|
|
255
|
-
variables: { name }
|
|
288
|
+
variables: { name }
|
|
256
289
|
}));
|
|
257
290
|
return new PerspectiveProxy(perspectiveAdd, this);
|
|
258
291
|
}
|
|
259
292
|
async update(uuid, name) {
|
|
260
|
-
const { perspectiveUpdate } = unwrapApolloResult(await this.
|
|
293
|
+
const { perspectiveUpdate } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
261
294
|
mutation: gql `mutation perspectiveUpdate($uuid: String!, $name: String!) {
|
|
262
295
|
perspectiveUpdate(uuid: $uuid, name: $name) {
|
|
263
296
|
${PERSPECTIVE_HANDLE_FIELDS}
|
|
264
297
|
}
|
|
265
298
|
}`,
|
|
266
|
-
variables: { uuid, name }
|
|
299
|
+
variables: { uuid, name }
|
|
267
300
|
}));
|
|
268
301
|
return new PerspectiveProxy(perspectiveUpdate, this);
|
|
269
302
|
}
|
|
270
303
|
async remove(uuid) {
|
|
271
|
-
return unwrapApolloResult(await this.
|
|
272
|
-
mutation: gql `
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
`,
|
|
277
|
-
variables: { uuid },
|
|
304
|
+
return unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
305
|
+
mutation: gql `mutation perspectiveRemove($uuid: String!) {
|
|
306
|
+
perspectiveRemove(uuid: $uuid)
|
|
307
|
+
}`,
|
|
308
|
+
variables: { uuid }
|
|
278
309
|
}));
|
|
279
310
|
}
|
|
280
|
-
async addLink(uuid, link, status =
|
|
281
|
-
const { perspectiveAddLink } = unwrapApolloResult(await this.
|
|
311
|
+
async addLink(uuid, link, status = 'shared', batchId) {
|
|
312
|
+
const { perspectiveAddLink } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
282
313
|
mutation: gql `mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
|
|
283
314
|
perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
284
315
|
${LINK_EXPRESSION_FIELDS}
|
|
285
316
|
}
|
|
286
317
|
}`,
|
|
287
|
-
variables: { uuid, link, status, batchId }
|
|
318
|
+
variables: { uuid, link, status, batchId }
|
|
288
319
|
}));
|
|
289
320
|
return perspectiveAddLink;
|
|
290
321
|
}
|
|
291
|
-
async addLinks(uuid, links, status =
|
|
292
|
-
const { perspectiveAddLinks } = unwrapApolloResult(await this.
|
|
322
|
+
async addLinks(uuid, links, status = 'shared', batchId) {
|
|
323
|
+
const { perspectiveAddLinks } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
293
324
|
mutation: gql `mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
|
|
294
325
|
perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
|
|
295
326
|
${LINK_EXPRESSION_FIELDS}
|
|
296
327
|
}
|
|
297
328
|
}`,
|
|
298
|
-
variables: { uuid, links, status, batchId }
|
|
329
|
+
variables: { uuid, links, status, batchId }
|
|
299
330
|
}));
|
|
300
331
|
return perspectiveAddLinks;
|
|
301
332
|
}
|
|
302
333
|
async removeLinks(uuid, links, batchId) {
|
|
303
|
-
const { perspectiveRemoveLinks } = unwrapApolloResult(await this.
|
|
334
|
+
const { perspectiveRemoveLinks } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
304
335
|
mutation: gql `mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
|
|
305
336
|
perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
|
|
306
337
|
${LINK_EXPRESSION_FIELDS}
|
|
307
338
|
}
|
|
308
339
|
}`,
|
|
309
|
-
variables: { uuid, links, batchId }
|
|
340
|
+
variables: { uuid, links, batchId }
|
|
310
341
|
}));
|
|
311
342
|
return perspectiveRemoveLinks;
|
|
312
343
|
}
|
|
313
344
|
async linkMutations(uuid, mutations, status) {
|
|
314
|
-
const { perspectiveLinkMutations } = unwrapApolloResult(await this.
|
|
345
|
+
const { perspectiveLinkMutations } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
315
346
|
mutation: gql `mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
|
|
316
347
|
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
|
|
317
348
|
additions {
|
|
@@ -322,29 +353,29 @@ export class PerspectiveClient {
|
|
|
322
353
|
}
|
|
323
354
|
}
|
|
324
355
|
}`,
|
|
325
|
-
variables: { uuid, mutations, status }
|
|
356
|
+
variables: { uuid, mutations, status }
|
|
326
357
|
}));
|
|
327
358
|
return perspectiveLinkMutations;
|
|
328
359
|
}
|
|
329
|
-
async addLinkExpression(uuid, link, status =
|
|
330
|
-
const { perspectiveAddLinkExpression } = unwrapApolloResult(await this.
|
|
360
|
+
async addLinkExpression(uuid, link, status = 'shared', batchId) {
|
|
361
|
+
const { perspectiveAddLinkExpression } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
331
362
|
mutation: gql `mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
|
|
332
363
|
perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
333
364
|
${LINK_EXPRESSION_FIELDS}
|
|
334
365
|
}
|
|
335
366
|
}`,
|
|
336
|
-
variables: { uuid, link, status, batchId }
|
|
367
|
+
variables: { uuid, link, status, batchId }
|
|
337
368
|
}));
|
|
338
369
|
return perspectiveAddLinkExpression;
|
|
339
370
|
}
|
|
340
371
|
async updateLink(uuid, oldLink, newLink, batchId) {
|
|
341
|
-
const { perspectiveUpdateLink } = unwrapApolloResult(await this.
|
|
372
|
+
const { perspectiveUpdateLink } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
342
373
|
mutation: gql `mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
|
|
343
374
|
perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
|
|
344
375
|
${LINK_EXPRESSION_FIELDS}
|
|
345
376
|
}
|
|
346
377
|
}`,
|
|
347
|
-
variables: { uuid, oldLink, newLink, batchId }
|
|
378
|
+
variables: { uuid, oldLink, newLink, batchId }
|
|
348
379
|
}));
|
|
349
380
|
return perspectiveUpdateLink;
|
|
350
381
|
}
|
|
@@ -353,17 +384,11 @@ export class PerspectiveClient {
|
|
|
353
384
|
delete link.data.__typename;
|
|
354
385
|
delete link.proof.__typename;
|
|
355
386
|
delete link.status;
|
|
356
|
-
const { perspectiveRemoveLink } = unwrapApolloResult(await this.
|
|
357
|
-
mutation: gql `
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
$batchId: String
|
|
362
|
-
) {
|
|
363
|
-
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
364
|
-
}
|
|
365
|
-
`,
|
|
366
|
-
variables: { uuid, link, batchId },
|
|
387
|
+
const { perspectiveRemoveLink } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
388
|
+
mutation: gql `mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
|
|
389
|
+
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
390
|
+
}`,
|
|
391
|
+
variables: { uuid, link, batchId }
|
|
367
392
|
}));
|
|
368
393
|
return perspectiveRemoveLink;
|
|
369
394
|
}
|
|
@@ -378,251 +403,155 @@ export class PerspectiveClient {
|
|
|
378
403
|
* @param shaclJson - SHACL JSON string from SHACLShape.toJSON() (recommended)
|
|
379
404
|
*/
|
|
380
405
|
async addSdna(uuid, name, sdnaCode, sdnaType, shaclJson) {
|
|
381
|
-
return unwrapApolloResult(await this.
|
|
382
|
-
mutation: gql `
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
$sdnaCode: String
|
|
387
|
-
$sdnaType: String!
|
|
388
|
-
$shaclJson: String
|
|
389
|
-
) {
|
|
390
|
-
perspectiveAddSdna(
|
|
391
|
-
uuid: $uuid
|
|
392
|
-
name: $name
|
|
393
|
-
sdnaCode: $sdnaCode
|
|
394
|
-
sdnaType: $sdnaType
|
|
395
|
-
shaclJson: $shaclJson
|
|
396
|
-
)
|
|
397
|
-
}
|
|
398
|
-
`,
|
|
399
|
-
variables: {
|
|
400
|
-
uuid,
|
|
401
|
-
name,
|
|
402
|
-
sdnaCode: sdnaCode || "",
|
|
403
|
-
sdnaType,
|
|
404
|
-
shaclJson,
|
|
405
|
-
},
|
|
406
|
+
return unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
407
|
+
mutation: gql `mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
|
|
408
|
+
perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
|
|
409
|
+
}`,
|
|
410
|
+
variables: { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson }
|
|
406
411
|
})).perspectiveAddSdna;
|
|
407
412
|
}
|
|
408
413
|
async executeCommands(uuid, commands, expression, parameters, batchId) {
|
|
409
|
-
return unwrapApolloResult(await this.
|
|
410
|
-
mutation: gql `
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
$expression: String!
|
|
415
|
-
$parameters: String
|
|
416
|
-
$batchId: String
|
|
417
|
-
) {
|
|
418
|
-
perspectiveExecuteCommands(
|
|
419
|
-
uuid: $uuid
|
|
420
|
-
commands: $commands
|
|
421
|
-
expression: $expression
|
|
422
|
-
parameters: $parameters
|
|
423
|
-
batchId: $batchId
|
|
424
|
-
)
|
|
425
|
-
}
|
|
426
|
-
`,
|
|
427
|
-
variables: { uuid, commands, expression, parameters, batchId },
|
|
414
|
+
return unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
415
|
+
mutation: gql `mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
|
|
416
|
+
perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
|
|
417
|
+
}`,
|
|
418
|
+
variables: { uuid, commands, expression, parameters, batchId }
|
|
428
419
|
})).perspectiveExecuteCommands;
|
|
429
420
|
}
|
|
430
421
|
async createSubject(uuid, subjectClass, expressionAddress, initialValues, batchId) {
|
|
431
|
-
return unwrapApolloResult(await this.
|
|
432
|
-
mutation: gql `
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
$expressionAddress: String!
|
|
437
|
-
$initialValues: String
|
|
438
|
-
$batchId: String
|
|
439
|
-
) {
|
|
440
|
-
perspectiveCreateSubject(
|
|
441
|
-
uuid: $uuid
|
|
442
|
-
subjectClass: $subjectClass
|
|
443
|
-
expressionAddress: $expressionAddress
|
|
444
|
-
initialValues: $initialValues
|
|
445
|
-
batchId: $batchId
|
|
446
|
-
)
|
|
447
|
-
}
|
|
448
|
-
`,
|
|
449
|
-
variables: {
|
|
450
|
-
uuid,
|
|
451
|
-
subjectClass,
|
|
452
|
-
expressionAddress,
|
|
453
|
-
initialValues,
|
|
454
|
-
batchId,
|
|
455
|
-
},
|
|
422
|
+
return unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
423
|
+
mutation: gql `mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
|
|
424
|
+
perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
|
|
425
|
+
}`,
|
|
426
|
+
variables: { uuid, subjectClass, expressionAddress, initialValues, batchId }
|
|
456
427
|
})).perspectiveCreateSubject;
|
|
457
428
|
}
|
|
458
429
|
async getSubjectData(uuid, subjectClass, expressionAddress) {
|
|
459
|
-
return unwrapApolloResult(await this.
|
|
460
|
-
mutation: gql `
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
$expressionAddress: String!
|
|
465
|
-
) {
|
|
466
|
-
perspectiveGetSubjectData(
|
|
467
|
-
uuid: $uuid
|
|
468
|
-
subjectClass: $subjectClass
|
|
469
|
-
expressionAddress: $expressionAddress
|
|
470
|
-
)
|
|
471
|
-
}
|
|
472
|
-
`,
|
|
473
|
-
variables: { uuid, subjectClass, expressionAddress },
|
|
430
|
+
return unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
431
|
+
mutation: gql `mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
|
|
432
|
+
perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
|
|
433
|
+
}`,
|
|
434
|
+
variables: { uuid, subjectClass, expressionAddress }
|
|
474
435
|
})).perspectiveGetSubjectData;
|
|
475
436
|
}
|
|
476
437
|
// ExpressionClient functions, needed for Subjects:
|
|
477
438
|
async getExpression(expressionURI) {
|
|
478
|
-
return await this.
|
|
439
|
+
return await __classPrivateFieldGet(this, _PerspectiveClient_expressionClient, "f").get(expressionURI);
|
|
479
440
|
}
|
|
480
441
|
async createExpression(content, languageAddress) {
|
|
481
|
-
return await this.
|
|
442
|
+
return await __classPrivateFieldGet(this, _PerspectiveClient_expressionClient, "f").create(content, languageAddress);
|
|
482
443
|
}
|
|
483
444
|
// Subscriptions:
|
|
484
445
|
addPerspectiveAddedListener(cb) {
|
|
485
|
-
this.
|
|
446
|
+
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").push(cb);
|
|
486
447
|
}
|
|
487
448
|
subscribePerspectiveAdded() {
|
|
488
|
-
this.
|
|
489
|
-
.subscribe({
|
|
449
|
+
__classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").subscribe({
|
|
490
450
|
query: gql ` subscription {
|
|
491
451
|
perspectiveAdded { ${PERSPECTIVE_HANDLE_FIELDS} }
|
|
492
452
|
}
|
|
493
|
-
|
|
494
|
-
})
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
this._perspectiveAddedCallbacks.forEach((cb) => {
|
|
453
|
+
`
|
|
454
|
+
}).subscribe({
|
|
455
|
+
next: result => {
|
|
456
|
+
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").forEach(cb => {
|
|
498
457
|
cb(result.data.perspectiveAdded);
|
|
499
458
|
});
|
|
500
459
|
},
|
|
501
|
-
error: (e) =>
|
|
502
|
-
if (!isSocketCloseError(e))
|
|
503
|
-
console.error(e);
|
|
504
|
-
},
|
|
460
|
+
error: (e) => console.error(e)
|
|
505
461
|
});
|
|
506
462
|
}
|
|
507
463
|
addPerspectiveUpdatedListener(cb) {
|
|
508
|
-
this.
|
|
464
|
+
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").push(cb);
|
|
509
465
|
}
|
|
510
466
|
subscribePerspectiveUpdated() {
|
|
511
|
-
this.
|
|
512
|
-
.subscribe({
|
|
467
|
+
__classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").subscribe({
|
|
513
468
|
query: gql ` subscription {
|
|
514
469
|
perspectiveUpdated { ${PERSPECTIVE_HANDLE_FIELDS} }
|
|
515
470
|
}
|
|
516
|
-
|
|
517
|
-
})
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
this._perspectiveUpdatedCallbacks.forEach((cb) => {
|
|
471
|
+
`
|
|
472
|
+
}).subscribe({
|
|
473
|
+
next: result => {
|
|
474
|
+
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").forEach(cb => {
|
|
521
475
|
cb(result.data.perspectiveUpdated);
|
|
522
476
|
});
|
|
523
477
|
},
|
|
524
|
-
error: (e) =>
|
|
525
|
-
if (!isSocketCloseError(e))
|
|
526
|
-
console.error(e);
|
|
527
|
-
},
|
|
478
|
+
error: (e) => console.error(e)
|
|
528
479
|
});
|
|
529
480
|
}
|
|
530
481
|
addPerspectiveSyncedListener(cb) {
|
|
531
|
-
this.
|
|
482
|
+
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, "f").push(cb);
|
|
532
483
|
}
|
|
533
484
|
async addPerspectiveSyncStateChangeListener(uuid, cb) {
|
|
534
|
-
this.
|
|
535
|
-
.subscribe({
|
|
485
|
+
__classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").subscribe({
|
|
536
486
|
query: gql ` subscription {
|
|
537
487
|
perspectiveSyncStateChange(uuid: "${uuid}")
|
|
538
488
|
}
|
|
539
|
-
|
|
540
|
-
})
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
cb.forEach((c) => {
|
|
489
|
+
`
|
|
490
|
+
}).subscribe({
|
|
491
|
+
next: result => {
|
|
492
|
+
cb.forEach(c => {
|
|
544
493
|
c(result.data.perspectiveSyncStateChange);
|
|
545
494
|
});
|
|
546
495
|
},
|
|
547
|
-
error: (e) =>
|
|
548
|
-
if (!isSocketCloseError(e))
|
|
549
|
-
console.error(e);
|
|
550
|
-
},
|
|
496
|
+
error: (e) => console.error(e)
|
|
551
497
|
});
|
|
552
|
-
await new Promise(
|
|
498
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
553
499
|
}
|
|
554
500
|
addPerspectiveRemovedListener(cb) {
|
|
555
|
-
this.
|
|
501
|
+
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").push(cb);
|
|
556
502
|
}
|
|
557
503
|
subscribePerspectiveRemoved() {
|
|
558
|
-
this.
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
.subscribe({
|
|
567
|
-
next: (result) => {
|
|
568
|
-
this._perspectiveRemovedCallbacks.forEach((cb) => {
|
|
504
|
+
__classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").subscribe({
|
|
505
|
+
query: gql ` subscription {
|
|
506
|
+
perspectiveRemoved
|
|
507
|
+
}
|
|
508
|
+
`
|
|
509
|
+
}).subscribe({
|
|
510
|
+
next: result => {
|
|
511
|
+
__classPrivateFieldGet(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").forEach(cb => {
|
|
569
512
|
cb(result.data.perspectiveRemoved);
|
|
570
513
|
});
|
|
571
514
|
},
|
|
572
|
-
error: (e) =>
|
|
573
|
-
if (!isSocketCloseError(e))
|
|
574
|
-
console.error(e);
|
|
575
|
-
},
|
|
515
|
+
error: (e) => console.error(e)
|
|
576
516
|
});
|
|
577
517
|
}
|
|
578
518
|
async addPerspectiveLinkAddedListener(uuid, cb) {
|
|
579
|
-
this.
|
|
580
|
-
.subscribe({
|
|
519
|
+
__classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").subscribe({
|
|
581
520
|
query: gql ` subscription {
|
|
582
521
|
perspectiveLinkAdded(uuid: "${uuid}") { ${LINK_EXPRESSION_FIELDS} }
|
|
583
522
|
}
|
|
584
|
-
|
|
585
|
-
})
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
cb.forEach((c) => {
|
|
523
|
+
`
|
|
524
|
+
}).subscribe({
|
|
525
|
+
next: result => {
|
|
526
|
+
cb.forEach(c => {
|
|
589
527
|
c(result.data.perspectiveLinkAdded);
|
|
590
528
|
});
|
|
591
529
|
},
|
|
592
|
-
error: (e) =>
|
|
593
|
-
if (!isSocketCloseError(e))
|
|
594
|
-
console.error(e);
|
|
595
|
-
},
|
|
530
|
+
error: (e) => console.error(e)
|
|
596
531
|
});
|
|
597
|
-
await new Promise(
|
|
532
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
598
533
|
}
|
|
599
534
|
async addPerspectiveLinkRemovedListener(uuid, cb) {
|
|
600
|
-
this.
|
|
601
|
-
.subscribe({
|
|
535
|
+
__classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").subscribe({
|
|
602
536
|
query: gql ` subscription {
|
|
603
537
|
perspectiveLinkRemoved(uuid: "${uuid}") { ${LINK_EXPRESSION_FIELDS} }
|
|
604
538
|
}
|
|
605
|
-
|
|
606
|
-
})
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
cb.forEach((c) => {
|
|
539
|
+
`
|
|
540
|
+
}).subscribe({
|
|
541
|
+
next: result => {
|
|
542
|
+
cb.forEach(c => {
|
|
610
543
|
if (!result.data.perspectiveLinkRemoved.status) {
|
|
611
544
|
delete result.data.perspectiveLinkRemoved.status;
|
|
612
545
|
}
|
|
613
546
|
c(result.data.perspectiveLinkRemoved);
|
|
614
547
|
});
|
|
615
548
|
},
|
|
616
|
-
error: (e) =>
|
|
617
|
-
if (!isSocketCloseError(e))
|
|
618
|
-
console.error(e);
|
|
619
|
-
},
|
|
549
|
+
error: (e) => console.error(e)
|
|
620
550
|
});
|
|
621
|
-
await new Promise(
|
|
551
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
622
552
|
}
|
|
623
553
|
async addPerspectiveLinkUpdatedListener(uuid, cb) {
|
|
624
|
-
this.
|
|
625
|
-
.subscribe({
|
|
554
|
+
__classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").subscribe({
|
|
626
555
|
query: gql ` subscription {
|
|
627
556
|
perspectiveLinkUpdated(uuid: "${uuid}") {
|
|
628
557
|
oldLink {
|
|
@@ -633,11 +562,10 @@ export class PerspectiveClient {
|
|
|
633
562
|
}
|
|
634
563
|
}
|
|
635
564
|
}
|
|
636
|
-
|
|
637
|
-
})
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
cb.forEach((c) => {
|
|
565
|
+
`
|
|
566
|
+
}).subscribe({
|
|
567
|
+
next: result => {
|
|
568
|
+
cb.forEach(c => {
|
|
641
569
|
if (!result.data.perspectiveLinkUpdated.newLink.status) {
|
|
642
570
|
delete result.data.perspectiveLinkUpdated.newLink.status;
|
|
643
571
|
}
|
|
@@ -647,29 +575,24 @@ export class PerspectiveClient {
|
|
|
647
575
|
c(result.data.perspectiveLinkUpdated);
|
|
648
576
|
});
|
|
649
577
|
},
|
|
650
|
-
error: (e) =>
|
|
651
|
-
if (!isSocketCloseError(e))
|
|
652
|
-
console.error(e);
|
|
653
|
-
},
|
|
578
|
+
error: (e) => console.error(e)
|
|
654
579
|
});
|
|
655
|
-
await new Promise(
|
|
580
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
656
581
|
}
|
|
657
582
|
getNeighbourhoodProxy(uuid) {
|
|
658
|
-
return new NeighbourhoodProxy(this
|
|
583
|
+
return new NeighbourhoodProxy(__classPrivateFieldGet(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
|
|
659
584
|
}
|
|
660
585
|
async createBatch(uuid) {
|
|
661
|
-
const { perspectiveCreateBatch } = unwrapApolloResult(await this.
|
|
662
|
-
mutation: gql `
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
`,
|
|
667
|
-
variables: { uuid },
|
|
586
|
+
const { perspectiveCreateBatch } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
587
|
+
mutation: gql `mutation perspectiveCreateBatch($uuid: String!) {
|
|
588
|
+
perspectiveCreateBatch(uuid: $uuid)
|
|
589
|
+
}`,
|
|
590
|
+
variables: { uuid }
|
|
668
591
|
}));
|
|
669
592
|
return perspectiveCreateBatch;
|
|
670
593
|
}
|
|
671
594
|
async commitBatch(uuid, batchId) {
|
|
672
|
-
const { perspectiveCommitBatch } = unwrapApolloResult(await this.
|
|
595
|
+
const { perspectiveCommitBatch } = unwrapApolloResult(await __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").mutate({
|
|
673
596
|
mutation: gql `mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
|
|
674
597
|
perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
|
|
675
598
|
additions {
|
|
@@ -680,8 +603,9 @@ export class PerspectiveClient {
|
|
|
680
603
|
}
|
|
681
604
|
}
|
|
682
605
|
}`,
|
|
683
|
-
variables: { uuid, batchId }
|
|
606
|
+
variables: { uuid, batchId }
|
|
684
607
|
}));
|
|
685
608
|
return perspectiveCommitBatch;
|
|
686
609
|
}
|
|
687
610
|
}
|
|
611
|
+
_PerspectiveClient_apolloClient = 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();
|