@coasys/ad4m 0.12.0-rc1-dev.2 → 0.12.0-rc1-dev.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.
Files changed (153) hide show
  1. package/jest.config.js +10 -3
  2. package/lib/index.cjs +6893 -5884
  3. package/lib/index.js +6889 -5872
  4. package/lib/src/Ad4mClient.d.ts +9 -16
  5. package/lib/src/Ad4mClient.js +46 -25
  6. package/lib/src/Literal.d.ts +1 -2
  7. package/lib/src/Literal.js +38 -35
  8. package/lib/src/SmartLiteral.d.ts +1 -2
  9. package/lib/src/SmartLiteral.js +30 -15
  10. package/lib/src/agent/AgentClient.d.ts +1 -4
  11. package/lib/src/agent/AgentClient.js +79 -99
  12. package/lib/src/ai/AIClient.d.ts +1 -2
  13. package/lib/src/ai/AIClient.js +224 -220
  14. package/lib/src/expression/ExpressionClient.d.ts +1 -1
  15. package/lib/src/expression/ExpressionClient.js +73 -86
  16. package/lib/src/index.d.ts +1 -1
  17. package/lib/src/index.js +1 -1
  18. package/lib/src/language/LanguageClient.d.ts +1 -1
  19. package/lib/src/language/LanguageClient.js +52 -52
  20. package/lib/src/model/Ad4mModel.d.ts +1351 -144
  21. package/lib/src/model/Ad4mModel.js +3760 -228
  22. package/lib/src/model/Ad4mModel.test.js +522 -979
  23. package/lib/src/model/Subject.d.ts +3 -3
  24. package/lib/src/model/Subject.js +25 -25
  25. package/lib/src/model/decorators.d.ts +444 -100
  26. package/lib/src/model/decorators.js +686 -321
  27. package/lib/src/model/util.d.ts +6 -6
  28. package/lib/src/model/util.js +24 -24
  29. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +1 -5
  30. package/lib/src/neighbourhood/NeighbourhoodClient.js +179 -242
  31. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +1 -2
  32. package/lib/src/neighbourhood/NeighbourhoodProxy.js +28 -13
  33. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +5 -1
  34. package/lib/src/perspectives/PerspectiveClient.d.ts +9 -9
  35. package/lib/src/perspectives/PerspectiveClient.js +240 -316
  36. package/lib/src/perspectives/PerspectiveProxy.d.ts +99 -61
  37. package/lib/src/perspectives/PerspectiveProxy.js +485 -832
  38. package/lib/src/runtime/RuntimeClient.d.ts +1 -5
  39. package/lib/src/runtime/RuntimeClient.js +238 -412
  40. package/lib/src/shacl/SHACLFlow.test.js +105 -164
  41. package/lib/src/shacl/SHACLShape.d.ts +12 -17
  42. package/lib/src/shacl/SHACLShape.js +115 -128
  43. package/lib/src/shacl/SHACLShape.test.js +176 -244
  44. package/lib/src/shims/reflect-metadata.d.ts +0 -0
  45. package/lib/src/shims/type-graphql.d.ts +32 -0
  46. package/lib/src/src/Ad4mClient.d.ts +28 -0
  47. package/lib/src/src/Address.d.ts +1 -0
  48. package/lib/src/src/DID.d.ts +1 -0
  49. package/lib/src/src/Exception.d.ts +7 -0
  50. package/lib/src/src/Literal.d.ts +7 -0
  51. package/lib/src/src/PubSub.d.ts +17 -0
  52. package/lib/src/src/SmartLiteral.d.ts +12 -0
  53. package/lib/src/src/agent/Agent.d.ts +110 -0
  54. package/lib/src/src/agent/AgentClient.d.ts +62 -0
  55. package/lib/src/src/agent/AgentResolver.d.ts +30 -0
  56. package/lib/src/src/agent/AgentStatus.d.ts +8 -0
  57. package/lib/src/src/ai/AIClient.d.ts +32 -0
  58. package/lib/src/src/ai/AIResolver.d.ts +75 -0
  59. package/lib/src/src/ai/Tasks.d.ts +37 -0
  60. package/lib/src/src/buildSchema.d.ts +1 -0
  61. package/lib/src/src/expression/Expression.d.ts +28 -0
  62. package/lib/src/src/expression/ExpressionClient.d.ts +13 -0
  63. package/lib/src/src/expression/ExpressionRef.d.ts +9 -0
  64. package/lib/src/src/expression/ExpressionResolver.d.ts +10 -0
  65. package/lib/src/src/index.d.ts +35 -0
  66. package/lib/src/src/jestSetup.d.ts +1 -0
  67. package/lib/src/src/language/Icon.d.ts +4 -0
  68. package/lib/src/src/language/Language.d.ts +206 -0
  69. package/lib/src/src/language/LanguageClient.d.ts +17 -0
  70. package/lib/src/src/language/LanguageContext.d.ts +37 -0
  71. package/lib/src/src/language/LanguageHandle.d.ts +9 -0
  72. package/lib/src/src/language/LanguageMeta.d.ts +35 -0
  73. package/lib/src/src/language/LanguageRef.d.ts +6 -0
  74. package/lib/src/src/language/LanguageResolver.d.ts +19 -0
  75. package/lib/src/src/links/Links.d.ts +39 -0
  76. package/lib/src/src/links/Links.test.d.ts +1 -0
  77. package/lib/src/src/model/Ad4mModel.d.ts +1438 -0
  78. package/lib/src/src/model/Ad4mModel.test.d.ts +1 -0
  79. package/lib/src/src/model/Subject.d.ts +25 -0
  80. package/lib/src/src/model/decorators.d.ts +545 -0
  81. package/lib/src/src/model/util.d.ts +12 -0
  82. package/lib/src/src/neighbourhood/Neighbourhood.d.ts +10 -0
  83. package/lib/src/src/neighbourhood/NeighbourhoodClient.d.ts +25 -0
  84. package/lib/src/src/neighbourhood/NeighbourhoodProxy.d.ts +19 -0
  85. package/lib/src/src/neighbourhood/NeighbourhoodProxy.test.d.ts +1 -0
  86. package/lib/src/src/neighbourhood/NeighbourhoodResolver.d.ts +24 -0
  87. package/lib/src/src/perspectives/LinkQuery.d.ts +11 -0
  88. package/lib/src/src/perspectives/Perspective.d.ts +38 -0
  89. package/lib/src/src/perspectives/Perspective.test.d.ts +1 -0
  90. package/lib/src/src/perspectives/PerspectiveClient.d.ts +97 -0
  91. package/lib/src/src/perspectives/PerspectiveDiff.d.ts +9 -0
  92. package/lib/src/src/perspectives/PerspectiveHandle.d.ts +18 -0
  93. package/lib/src/src/perspectives/PerspectiveProxy.d.ts +865 -0
  94. package/lib/src/src/perspectives/PerspectiveResolver.d.ts +57 -0
  95. package/lib/src/src/runtime/RuntimeClient.d.ts +56 -0
  96. package/lib/src/src/runtime/RuntimeResolver.d.ts +132 -0
  97. package/lib/src/src/shacl/SHACLFlow.d.ts +171 -0
  98. package/lib/src/src/shacl/SHACLFlow.test.d.ts +1 -0
  99. package/lib/src/src/shacl/SHACLShape.d.ts +117 -0
  100. package/lib/src/src/shacl/SHACLShape.test.d.ts +1 -0
  101. package/lib/src/src/typeDefs.d.ts +1 -0
  102. package/lib/src/src/unwrapApolloResult.d.ts +2 -0
  103. package/lib/src/src/utils.d.ts +25 -0
  104. package/lib/src/utils.d.ts +0 -8
  105. package/lib/src/utils.js +7 -21
  106. package/package.json +15 -14
  107. package/src/Ad4mClient.test.ts +1315 -1564
  108. package/src/Ad4mClient.ts +54 -55
  109. package/src/Literal.test.ts +26 -45
  110. package/src/Literal.ts +66 -82
  111. package/src/SmartLiteral.ts +58 -74
  112. package/src/agent/AgentClient.ts +99 -144
  113. package/src/ai/AIClient.ts +359 -409
  114. package/src/expression/ExpressionClient.ts +96 -142
  115. package/src/index.ts +1 -1
  116. package/src/language/LanguageClient.ts +113 -137
  117. package/src/model/Ad4mModel.test.ts +616 -1114
  118. package/src/model/Ad4mModel.ts +4386 -451
  119. package/src/model/Subject.ts +159 -0
  120. package/src/model/decorators.ts +1168 -667
  121. package/src/model/util.ts +54 -53
  122. package/src/neighbourhood/NeighbourhoodClient.ts +266 -392
  123. package/src/neighbourhood/NeighbourhoodProxy.test.ts +7 -3
  124. package/src/neighbourhood/NeighbourhoodProxy.ts +40 -58
  125. package/src/perspectives/PerspectiveClient.ts +540 -779
  126. package/src/perspectives/PerspectiveProxy.ts +2067 -2860
  127. package/src/runtime/RuntimeClient.ts +476 -775
  128. package/src/shacl/SHACLFlow.test.ts +129 -196
  129. package/src/shacl/SHACLShape.test.ts +190 -284
  130. package/src/shacl/SHACLShape.ts +200 -224
  131. package/src/utils.ts +17 -31
  132. package/tsconfig.json +10 -9
  133. package/src/model/IMPROVEMENTS.md +0 -482
  134. package/src/model/PREDICATE_COLLISION_FIX.md +0 -651
  135. package/src/model/README.md +0 -317
  136. package/src/model/SHACL_MUTATION_DECOUPLING.md +0 -356
  137. package/src/model/SUBSCRIPTION_STRATEGY.md +0 -317
  138. package/src/model/TC39_STAGE_3_DECORATORS.md +0 -609
  139. package/src/model/mutation.ts +0 -461
  140. package/src/model/parentUtils.ts +0 -91
  141. package/src/model/prolog/generatePrologFacts.ts +0 -176
  142. package/src/model/prolog/index.ts +0 -1
  143. package/src/model/query/ModelQueryBuilder.ts +0 -173
  144. package/src/model/query/fetchInstance.ts +0 -181
  145. package/src/model/query/hydration.ts +0 -273
  146. package/src/model/query/operations.ts +0 -510
  147. package/src/model/query/snapshot.ts +0 -126
  148. package/src/model/query/surrealCompiler.ts +0 -376
  149. package/src/model/schema/fromJSONSchema.ts +0 -411
  150. package/src/model/schema/metadata.ts +0 -148
  151. package/src/model/subscription.ts +0 -307
  152. package/src/model/transaction.ts +0 -60
  153. 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 "./PerspectiveProxy";
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._apolloClient = client;
38
- this._perspectiveAddedCallbacks = [];
39
- this._perspectiveUpdatedCallbacks = [];
40
- this._perspectiveRemovedCallbacks = [];
41
- this._perspectiveSyncStateChangeCallbacks = [];
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._expressionClient = client;
68
+ __classPrivateFieldSet(this, _PerspectiveClient_expressionClient, client, "f");
50
69
  }
51
70
  setNeighbourhoodClient(client) {
52
- this._neighbourhoodClient = client;
71
+ __classPrivateFieldSet(this, _PerspectiveClient_neighbourhoodClient, client, "f");
53
72
  }
54
73
  setAIClient(client) {
55
- this._aiClient = client;
74
+ __classPrivateFieldSet(this, _PerspectiveClient_aiClient, client, "f");
56
75
  }
57
76
  get aiClient() {
58
- return this._aiClient;
77
+ return __classPrivateFieldGet(this, _PerspectiveClient_aiClient, "f");
59
78
  }
60
79
  async all() {
61
- const { perspectives } = unwrapApolloResult(await this._apolloClient.query({
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((handle) => new PerspectiveProxy(handle, this));
87
+ return perspectives.map(handle => new PerspectiveProxy(handle, this));
69
88
  }
70
89
  async byUUID(uuid) {
71
- const { perspective } = unwrapApolloResult(await this._apolloClient.query({
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._apolloClient.query({
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._apolloClient.mutate({
96
- mutation: gql `
97
- mutation perspectivePublishSnapshot($uuid: String!) {
98
- perspectivePublishSnapshot(uuid: $uuid)
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._apolloClient.query({
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._apolloClient.query({
118
- query: gql `
119
- query perspectiveQueryProlog($uuid: String!, $query: String!) {
120
- perspectiveQueryProlog(uuid: $uuid, query: $query)
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._apolloClient.query({
138
- query: gql `
139
- query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
140
- perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
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._apolloClient.mutate({
149
- mutation: gql `
150
- mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
151
- perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
152
- subscriptionId
153
- result
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("Error parsing perspectiveSubscribeQuery result:", e);
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._apolloClient
176
- .subscribe({
229
+ const subscription = __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").subscribe({
177
230
  query: gql `
178
- subscription perspectiveQuerySubscription($subscriptionId: String!) {
179
- perspectiveQuerySubscription(subscriptionId: $subscriptionId)
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 === "object") {
249
+ if (isInit && typeof finalResult === 'object') {
198
250
  finalResult.isInit = true;
199
251
  }
200
252
  }
201
253
  catch (e) {
202
- console.error("Error parsing perspectiveQuerySubscription:", e);
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._apolloClient.mutate({
216
- mutation: gql `
217
- mutation perspectiveKeepAliveQuery(
218
- $uuid: String!
219
- $subscriptionId: String!
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._apolloClient.mutate({
233
- mutation: gql `
234
- mutation perspectiveDisposeQuerySubscription(
235
- $uuid: String!
236
- $subscriptionId: String!
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._apolloClient.mutate({
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._apolloClient.mutate({
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._apolloClient.mutate({
272
- mutation: gql `
273
- mutation perspectiveRemove($uuid: String!) {
274
- perspectiveRemove(uuid: $uuid)
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 = "shared", batchId) {
281
- const { perspectiveAddLink } = unwrapApolloResult(await this._apolloClient.mutate({
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 = "shared", batchId) {
292
- const { perspectiveAddLinks } = unwrapApolloResult(await this._apolloClient.mutate({
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._apolloClient.mutate({
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._apolloClient.mutate({
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 = "shared", batchId) {
330
- const { perspectiveAddLinkExpression } = unwrapApolloResult(await this._apolloClient.mutate({
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._apolloClient.mutate({
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._apolloClient.mutate({
357
- mutation: gql `
358
- mutation perspectiveRemoveLink(
359
- $link: LinkExpressionInput!
360
- $uuid: String!
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._apolloClient.mutate({
382
- mutation: gql `
383
- mutation perspectiveAddSdna(
384
- $uuid: String!
385
- $name: String!
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._apolloClient.mutate({
410
- mutation: gql `
411
- mutation perspectiveExecuteCommands(
412
- $uuid: String!
413
- $commands: String!
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._apolloClient.mutate({
432
- mutation: gql `
433
- mutation perspectiveCreateSubject(
434
- $uuid: String!
435
- $subjectClass: String!
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._apolloClient.mutate({
460
- mutation: gql `
461
- mutation perspectiveGetSubjectData(
462
- $uuid: String!
463
- $subjectClass: String!
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._expressionClient.get(expressionURI);
439
+ return await __classPrivateFieldGet(this, _PerspectiveClient_expressionClient, "f").get(expressionURI);
479
440
  }
480
441
  async createExpression(content, languageAddress) {
481
- return await this._expressionClient.create(content, languageAddress);
442
+ return await __classPrivateFieldGet(this, _PerspectiveClient_expressionClient, "f").create(content, languageAddress);
482
443
  }
483
444
  // Subscriptions:
484
445
  addPerspectiveAddedListener(cb) {
485
- this._perspectiveAddedCallbacks.push(cb);
446
+ __classPrivateFieldGet(this, _PerspectiveClient_perspectiveAddedCallbacks, "f").push(cb);
486
447
  }
487
448
  subscribePerspectiveAdded() {
488
- this._apolloClient
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
- .subscribe({
496
- next: (result) => {
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._perspectiveUpdatedCallbacks.push(cb);
464
+ __classPrivateFieldGet(this, _PerspectiveClient_perspectiveUpdatedCallbacks, "f").push(cb);
509
465
  }
510
466
  subscribePerspectiveUpdated() {
511
- this._apolloClient
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
- .subscribe({
519
- next: (result) => {
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._perspectiveSyncStateChangeCallbacks.push(cb);
482
+ __classPrivateFieldGet(this, _PerspectiveClient_perspectiveSyncStateChangeCallbacks, "f").push(cb);
532
483
  }
533
484
  async addPerspectiveSyncStateChangeListener(uuid, cb) {
534
- this._apolloClient
535
- .subscribe({
485
+ __classPrivateFieldGet(this, _PerspectiveClient_apolloClient, "f").subscribe({
536
486
  query: gql ` subscription {
537
487
  perspectiveSyncStateChange(uuid: "${uuid}")
538
488
  }
539
- `,
540
- })
541
- .subscribe({
542
- next: (result) => {
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((resolve) => setTimeout(resolve, 500));
498
+ await new Promise(resolve => setTimeout(resolve, 500));
553
499
  }
554
500
  addPerspectiveRemovedListener(cb) {
555
- this._perspectiveRemovedCallbacks.push(cb);
501
+ __classPrivateFieldGet(this, _PerspectiveClient_perspectiveRemovedCallbacks, "f").push(cb);
556
502
  }
557
503
  subscribePerspectiveRemoved() {
558
- this._apolloClient
559
- .subscribe({
560
- query: gql `
561
- subscription {
562
- perspectiveRemoved
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._apolloClient
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
- .subscribe({
587
- next: (result) => {
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((resolve) => setTimeout(resolve, 500));
532
+ await new Promise(resolve => setTimeout(resolve, 500));
598
533
  }
599
534
  async addPerspectiveLinkRemovedListener(uuid, cb) {
600
- this._apolloClient
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
- .subscribe({
608
- next: (result) => {
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((resolve) => setTimeout(resolve, 500));
551
+ await new Promise(resolve => setTimeout(resolve, 500));
622
552
  }
623
553
  async addPerspectiveLinkUpdatedListener(uuid, cb) {
624
- this._apolloClient
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
- .subscribe({
639
- next: (result) => {
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((resolve) => setTimeout(resolve, 500));
580
+ await new Promise(resolve => setTimeout(resolve, 500));
656
581
  }
657
582
  getNeighbourhoodProxy(uuid) {
658
- return new NeighbourhoodProxy(this._neighbourhoodClient, uuid);
583
+ return new NeighbourhoodProxy(__classPrivateFieldGet(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
659
584
  }
660
585
  async createBatch(uuid) {
661
- const { perspectiveCreateBatch } = unwrapApolloResult(await this._apolloClient.mutate({
662
- mutation: gql `
663
- mutation perspectiveCreateBatch($uuid: String!) {
664
- perspectiveCreateBatch(uuid: $uuid)
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._apolloClient.mutate({
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();