@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,20 +1,7 @@
|
|
|
1
|
-
import { ApolloClient, gql } from "@apollo/client/core"
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "../perspectives/Perspective";
|
|
6
|
-
import unwrapApolloResult from "../unwrapApolloResult";
|
|
7
|
-
import { isSocketCloseError } from "../utils";
|
|
8
|
-
import {
|
|
9
|
-
RuntimeInfo,
|
|
10
|
-
ExceptionInfo,
|
|
11
|
-
SentMessage,
|
|
12
|
-
NotificationInput,
|
|
13
|
-
Notification,
|
|
14
|
-
TriggeredNotification,
|
|
15
|
-
ImportResult,
|
|
16
|
-
UserStatistics,
|
|
17
|
-
} from "./RuntimeResolver";
|
|
1
|
+
import { ApolloClient, gql } from "@apollo/client/core"
|
|
2
|
+
import { Perspective, PerspectiveExpression } from "../perspectives/Perspective"
|
|
3
|
+
import unwrapApolloResult from "../unwrapApolloResult"
|
|
4
|
+
import { RuntimeInfo, ExceptionInfo, SentMessage, NotificationInput, Notification, TriggeredNotification, ImportResult, UserStatistics } from "./RuntimeResolver"
|
|
18
5
|
|
|
19
6
|
const PERSPECTIVE_EXPRESSION_FIELDS = `
|
|
20
7
|
author
|
|
@@ -28,7 +15,7 @@ data {
|
|
|
28
15
|
}
|
|
29
16
|
}
|
|
30
17
|
proof { valid, invalid, signature, key }
|
|
31
|
-
|
|
18
|
+
`
|
|
32
19
|
|
|
33
20
|
const NOTIFICATION_DEFINITION_FIELDS = `
|
|
34
21
|
description
|
|
@@ -39,364 +26,253 @@ trigger
|
|
|
39
26
|
perspectiveIds
|
|
40
27
|
webhookUrl
|
|
41
28
|
webhookAuth
|
|
42
|
-
|
|
29
|
+
`
|
|
43
30
|
|
|
44
31
|
const NOTIFICATION_FIELDS = `
|
|
45
32
|
id
|
|
46
33
|
granted
|
|
47
34
|
${NOTIFICATION_DEFINITION_FIELDS}
|
|
48
|
-
|
|
35
|
+
`
|
|
49
36
|
|
|
50
37
|
const TRIGGERED_NOTIFICATION_FIELDS = `
|
|
51
38
|
notification { ${NOTIFICATION_FIELDS} }
|
|
52
39
|
perspectiveId
|
|
53
40
|
triggerMatch
|
|
54
|
-
|
|
41
|
+
`
|
|
55
42
|
|
|
56
|
-
export type MessageCallback = (message: PerspectiveExpression) => null
|
|
57
|
-
export type ExceptionCallback = (info: ExceptionInfo) => null
|
|
58
|
-
export type NotificationTriggeredCallback = (
|
|
59
|
-
|
|
60
|
-
) => null;
|
|
61
|
-
export type NotificationRequestedCallback = (
|
|
62
|
-
notification: Notification,
|
|
63
|
-
) => null;
|
|
43
|
+
export type MessageCallback = (message: PerspectiveExpression) => null
|
|
44
|
+
export type ExceptionCallback = (info: ExceptionInfo) => null
|
|
45
|
+
export type NotificationTriggeredCallback = (notification: TriggeredNotification) => null
|
|
46
|
+
export type NotificationRequestedCallback = (notification: Notification) => null
|
|
64
47
|
|
|
65
48
|
export class RuntimeClient {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
$
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
query runtimeHcAgentInfos {
|
|
264
|
-
runtimeHcAgentInfos
|
|
265
|
-
}
|
|
266
|
-
`,
|
|
267
|
-
}),
|
|
268
|
-
);
|
|
269
|
-
return runtimeHcAgentInfos;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
async getNetworkMetrics(): Promise<string> {
|
|
273
|
-
const { runtimeGetNetworkMetrics } = unwrapApolloResult(
|
|
274
|
-
await this._apolloClient.query({
|
|
275
|
-
query: gql`
|
|
276
|
-
query runtimeGetNetworkMetrics {
|
|
277
|
-
runtimeGetNetworkMetrics
|
|
278
|
-
}
|
|
279
|
-
`,
|
|
280
|
-
}),
|
|
281
|
-
);
|
|
282
|
-
return runtimeGetNetworkMetrics;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
async restartHolochain(): Promise<boolean> {
|
|
286
|
-
const { runtimeRestartHolochain } = unwrapApolloResult(
|
|
287
|
-
await this._apolloClient.mutate({
|
|
288
|
-
mutation: gql`
|
|
289
|
-
mutation runtimeRestartHolochain {
|
|
290
|
-
runtimeRestartHolochain
|
|
291
|
-
}
|
|
292
|
-
`,
|
|
293
|
-
}),
|
|
294
|
-
);
|
|
295
|
-
return runtimeRestartHolochain;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
async hcAddAgentInfos(agentInfos: String): Promise<void> {
|
|
299
|
-
const { runtimeHcAddAgentInfos } = unwrapApolloResult(
|
|
300
|
-
await this._apolloClient.mutate({
|
|
301
|
-
mutation: gql`
|
|
302
|
-
mutation runtimeHcAddAgentInfos($agentInfos: String!) {
|
|
303
|
-
runtimeHcAddAgentInfos(agentInfos: $agentInfos)
|
|
304
|
-
}
|
|
305
|
-
`,
|
|
306
|
-
variables: { agentInfos },
|
|
307
|
-
}),
|
|
308
|
-
);
|
|
309
|
-
return runtimeHcAddAgentInfos;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
async verifyStringSignedByDid(
|
|
313
|
-
did: string,
|
|
314
|
-
didSigningKeyId: string,
|
|
315
|
-
data: string,
|
|
316
|
-
signedData: string,
|
|
317
|
-
): Promise<boolean> {
|
|
318
|
-
const { runtimeVerifyStringSignedByDid } = unwrapApolloResult(
|
|
319
|
-
await this._apolloClient.mutate({
|
|
320
|
-
mutation: gql`
|
|
321
|
-
query runtimeVerifyStringSignedByDid(
|
|
322
|
-
$did: String!
|
|
323
|
-
$didSigningKeyId: String!
|
|
324
|
-
$data: String!
|
|
325
|
-
$signedData: String!
|
|
326
|
-
) {
|
|
327
|
-
runtimeVerifyStringSignedByDid(
|
|
328
|
-
did: $did
|
|
329
|
-
didSigningKeyId: $didSigningKeyId
|
|
330
|
-
data: $data
|
|
331
|
-
signedData: $signedData
|
|
332
|
-
)
|
|
333
|
-
}
|
|
334
|
-
`,
|
|
335
|
-
variables: { did, didSigningKeyId, data, signedData },
|
|
336
|
-
}),
|
|
337
|
-
);
|
|
338
|
-
return runtimeVerifyStringSignedByDid;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
async setStatus(perspective: Perspective): Promise<boolean> {
|
|
342
|
-
const { runtimeSetStatus } = unwrapApolloResult(
|
|
343
|
-
await this._apolloClient.mutate({
|
|
344
|
-
mutation: gql`
|
|
345
|
-
mutation runtimeSetStatus($status: PerspectiveInput!) {
|
|
346
|
-
runtimeSetStatus(status: $status)
|
|
347
|
-
}
|
|
348
|
-
`,
|
|
349
|
-
variables: { status: perspective },
|
|
350
|
-
}),
|
|
351
|
-
);
|
|
352
|
-
return runtimeSetStatus;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
async friendStatus(did: string): Promise<PerspectiveExpression> {
|
|
356
|
-
const { runtimeFriendStatus } = unwrapApolloResult(
|
|
357
|
-
await this._apolloClient.query({
|
|
358
|
-
query: gql`query runtimeFriendStatus($did: String!) {
|
|
49
|
+
#apolloClient: ApolloClient<any>
|
|
50
|
+
#messageReceivedCallbacks: MessageCallback[]
|
|
51
|
+
#exceptionOccurredCallbacks: ExceptionCallback[]
|
|
52
|
+
#notificationTriggeredCallbacks: NotificationTriggeredCallback[]
|
|
53
|
+
#notificationRequestedCallbacks: NotificationRequestedCallback[]
|
|
54
|
+
|
|
55
|
+
constructor(client: ApolloClient<any>, subscribe: boolean = true) {
|
|
56
|
+
this.#apolloClient = client
|
|
57
|
+
this.#messageReceivedCallbacks = []
|
|
58
|
+
this.#exceptionOccurredCallbacks = []
|
|
59
|
+
this.#notificationTriggeredCallbacks = []
|
|
60
|
+
|
|
61
|
+
if(subscribe) {
|
|
62
|
+
this.subscribeMessageReceived()
|
|
63
|
+
this.subscribeExceptionOccurred()
|
|
64
|
+
this.subscribeNotificationTriggered()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async info(): Promise<RuntimeInfo> {
|
|
69
|
+
const { runtimeInfo } = unwrapApolloResult(await this.#apolloClient.query({
|
|
70
|
+
query: gql`query runtimeInfo {
|
|
71
|
+
runtimeInfo {
|
|
72
|
+
ad4mExecutorVersion,
|
|
73
|
+
isInitialized,
|
|
74
|
+
isUnlocked
|
|
75
|
+
}
|
|
76
|
+
}`,
|
|
77
|
+
}));
|
|
78
|
+
return runtimeInfo
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async quit(): Promise<Boolean> {
|
|
82
|
+
const result = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
83
|
+
mutation: gql`mutation runtimeQuit { runtimeQuit }`
|
|
84
|
+
}))
|
|
85
|
+
|
|
86
|
+
return result.runtimeQuit
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async openLink(url: string): Promise<Boolean> {
|
|
90
|
+
const { runtimeOpenLink } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
91
|
+
mutation: gql`mutation runtimeOpenLink($url: String!) {
|
|
92
|
+
runtimeOpenLink(url: $url)
|
|
93
|
+
}`,
|
|
94
|
+
variables: { url }
|
|
95
|
+
}))
|
|
96
|
+
return runtimeOpenLink
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async addTrustedAgents(agents: string[]): Promise<string[]> {
|
|
100
|
+
const { addTrustedAgents } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
101
|
+
mutation: gql`mutation addTrustedAgents($agents: [String!]!) {
|
|
102
|
+
addTrustedAgents(agents: $agents)
|
|
103
|
+
}`,
|
|
104
|
+
variables: { agents }
|
|
105
|
+
}))
|
|
106
|
+
return addTrustedAgents
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async deleteTrustedAgents(agents: string[]): Promise<string[]> {
|
|
110
|
+
const { deleteTrustedAgents } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
111
|
+
mutation: gql`mutation deleteTrustedAgents($agents: [String!]!) {
|
|
112
|
+
deleteTrustedAgents(agents: $agents)
|
|
113
|
+
}`,
|
|
114
|
+
variables: { agents }
|
|
115
|
+
}))
|
|
116
|
+
return deleteTrustedAgents
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async getTrustedAgents(): Promise<string[]> {
|
|
120
|
+
const { getTrustedAgents } = unwrapApolloResult(await this.#apolloClient.query({
|
|
121
|
+
query: gql`query getTrustedAgents {
|
|
122
|
+
getTrustedAgents
|
|
123
|
+
}`,
|
|
124
|
+
}))
|
|
125
|
+
return getTrustedAgents
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async addKnownLinkLanguageTemplates(addresses: string[]): Promise<string[]> {
|
|
129
|
+
const { runtimeAddKnownLinkLanguageTemplates } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
130
|
+
mutation: gql`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
131
|
+
runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
|
|
132
|
+
}`,
|
|
133
|
+
variables: { addresses }
|
|
134
|
+
}))
|
|
135
|
+
return runtimeAddKnownLinkLanguageTemplates
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async removeKnownLinkLanguageTemplates(addresses: string[]): Promise<string[]> {
|
|
139
|
+
const { runtimeRemoveKnownLinkLanguageTemplates } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
140
|
+
mutation: gql`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
141
|
+
runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
|
|
142
|
+
}`,
|
|
143
|
+
variables: { addresses }
|
|
144
|
+
}))
|
|
145
|
+
return runtimeRemoveKnownLinkLanguageTemplates
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async knownLinkLanguageTemplates(): Promise<string[]> {
|
|
149
|
+
const { runtimeKnownLinkLanguageTemplates } = unwrapApolloResult(await this.#apolloClient.query({
|
|
150
|
+
query: gql`query runtimeKnownLinkLanguageTemplates {
|
|
151
|
+
runtimeKnownLinkLanguageTemplates
|
|
152
|
+
}`,
|
|
153
|
+
}))
|
|
154
|
+
return runtimeKnownLinkLanguageTemplates
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async addFriends(dids: string[]): Promise<string[]> {
|
|
158
|
+
const { runtimeAddFriends } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
159
|
+
mutation: gql`mutation runtimeAddFriends($dids: [String!]!) {
|
|
160
|
+
runtimeAddFriends(dids: $dids)
|
|
161
|
+
}`,
|
|
162
|
+
variables: { dids }
|
|
163
|
+
}))
|
|
164
|
+
return runtimeAddFriends
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async removeFriends(dids: string[]): Promise<string[]> {
|
|
168
|
+
const { runtimeRemoveFriends } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
169
|
+
mutation: gql`mutation runtimeRemoveFriends($dids: [String!]!) {
|
|
170
|
+
runtimeRemoveFriends(dids: $dids)
|
|
171
|
+
}`,
|
|
172
|
+
variables: { dids }
|
|
173
|
+
}))
|
|
174
|
+
return runtimeRemoveFriends
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async friends(): Promise<string[]> {
|
|
178
|
+
const { runtimeFriends } = unwrapApolloResult(await this.#apolloClient.query({
|
|
179
|
+
query: gql`query runtimeFriends {
|
|
180
|
+
runtimeFriends
|
|
181
|
+
}`,
|
|
182
|
+
}))
|
|
183
|
+
return runtimeFriends
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async hcAgentInfos(): Promise<string> {
|
|
187
|
+
const { runtimeHcAgentInfos } = unwrapApolloResult(await this.#apolloClient.query({
|
|
188
|
+
query: gql`query runtimeHcAgentInfos {
|
|
189
|
+
runtimeHcAgentInfos
|
|
190
|
+
}`,
|
|
191
|
+
}))
|
|
192
|
+
return runtimeHcAgentInfos
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async getNetworkMetrics(): Promise<string> {
|
|
196
|
+
const { runtimeGetNetworkMetrics } = unwrapApolloResult(await this.#apolloClient.query({
|
|
197
|
+
query: gql`query runtimeGetNetworkMetrics {
|
|
198
|
+
runtimeGetNetworkMetrics
|
|
199
|
+
}`,
|
|
200
|
+
}))
|
|
201
|
+
return runtimeGetNetworkMetrics
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async restartHolochain(): Promise<boolean> {
|
|
205
|
+
const { runtimeRestartHolochain } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
206
|
+
mutation: gql`mutation runtimeRestartHolochain {
|
|
207
|
+
runtimeRestartHolochain
|
|
208
|
+
}`,
|
|
209
|
+
}))
|
|
210
|
+
return runtimeRestartHolochain
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async hcAddAgentInfos(agentInfos: String): Promise<void> {
|
|
214
|
+
const { runtimeHcAddAgentInfos } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
215
|
+
mutation: gql`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
|
|
216
|
+
runtimeHcAddAgentInfos(agentInfos: $agentInfos)
|
|
217
|
+
}`,
|
|
218
|
+
variables: { agentInfos }
|
|
219
|
+
}))
|
|
220
|
+
return runtimeHcAddAgentInfos
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async verifyStringSignedByDid(did: string, didSigningKeyId: string, data: string, signedData: string): Promise<boolean> {
|
|
224
|
+
const { runtimeVerifyStringSignedByDid } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
225
|
+
mutation: gql`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
|
|
226
|
+
runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
|
|
227
|
+
}`,
|
|
228
|
+
variables: { did, didSigningKeyId, data, signedData }
|
|
229
|
+
}))
|
|
230
|
+
return runtimeVerifyStringSignedByDid
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
async setStatus(perspective: Perspective): Promise<boolean> {
|
|
234
|
+
const { runtimeSetStatus } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
235
|
+
mutation: gql`mutation runtimeSetStatus($status: PerspectiveInput!) {
|
|
236
|
+
runtimeSetStatus(status: $status)
|
|
237
|
+
}`,
|
|
238
|
+
variables: { status: perspective }
|
|
239
|
+
}))
|
|
240
|
+
return runtimeSetStatus
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async friendStatus(did: string): Promise<PerspectiveExpression> {
|
|
244
|
+
const { runtimeFriendStatus } = unwrapApolloResult(await this.#apolloClient.query({
|
|
245
|
+
query: gql`query runtimeFriendStatus($did: String!) {
|
|
359
246
|
runtimeFriendStatus(did: $did) { ${PERSPECTIVE_EXPRESSION_FIELDS} }
|
|
360
247
|
}`,
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}),
|
|
380
|
-
);
|
|
381
|
-
return runtimeFriendSendMessage;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
async messageInbox(filter?: string): Promise<PerspectiveExpression[]> {
|
|
385
|
-
const { runtimeMessageInbox } = unwrapApolloResult(
|
|
386
|
-
await this._apolloClient.query({
|
|
387
|
-
query: gql`query runtimeMessageInbox($filter: String) {
|
|
248
|
+
variables: { did }
|
|
249
|
+
}))
|
|
250
|
+
return runtimeFriendStatus
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
async friendSendMessage(did: string, message: Perspective): Promise<boolean> {
|
|
254
|
+
const { runtimeFriendSendMessage } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
255
|
+
mutation: gql`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
|
|
256
|
+
runtimeFriendSendMessage(did: $did, message: $message)
|
|
257
|
+
}`,
|
|
258
|
+
variables: { did, message }
|
|
259
|
+
}))
|
|
260
|
+
return runtimeFriendSendMessage
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async messageInbox(filter?: string): Promise<PerspectiveExpression[]> {
|
|
264
|
+
const { runtimeMessageInbox } = unwrapApolloResult(await this.#apolloClient.query({
|
|
265
|
+
query: gql`query runtimeMessageInbox($filter: String) {
|
|
388
266
|
runtimeMessageInbox(filter: $filter) { ${PERSPECTIVE_EXPRESSION_FIELDS} }
|
|
389
267
|
}`,
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
268
|
+
variables: { filter }
|
|
269
|
+
}))
|
|
270
|
+
return runtimeMessageInbox
|
|
271
|
+
}
|
|
395
272
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
query: gql`query runtimeMessageOutbox($filter: String) {
|
|
273
|
+
async messageOutbox(filter?: string): Promise<SentMessage[]> {
|
|
274
|
+
const { runtimeMessageOutbox } = unwrapApolloResult(await this.#apolloClient.query({
|
|
275
|
+
query: gql`query runtimeMessageOutbox($filter: String) {
|
|
400
276
|
runtimeMessageOutbox(filter: $filter) {
|
|
401
277
|
recipient,
|
|
402
278
|
message {
|
|
@@ -404,426 +280,251 @@ export class RuntimeClient {
|
|
|
404
280
|
}
|
|
405
281
|
}
|
|
406
282
|
}`,
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
omitted
|
|
468
|
-
errors
|
|
469
|
-
}
|
|
470
|
-
links {
|
|
471
|
-
total
|
|
472
|
-
imported
|
|
473
|
-
failed
|
|
474
|
-
omitted
|
|
475
|
-
errors
|
|
476
|
-
}
|
|
477
|
-
expressions {
|
|
478
|
-
total
|
|
479
|
-
imported
|
|
480
|
-
failed
|
|
481
|
-
omitted
|
|
482
|
-
errors
|
|
483
|
-
}
|
|
484
|
-
perspectiveDiffs {
|
|
485
|
-
total
|
|
486
|
-
imported
|
|
487
|
-
failed
|
|
488
|
-
omitted
|
|
489
|
-
errors
|
|
490
|
-
}
|
|
491
|
-
notifications {
|
|
492
|
-
total
|
|
493
|
-
imported
|
|
494
|
-
failed
|
|
495
|
-
omitted
|
|
496
|
-
errors
|
|
497
|
-
}
|
|
498
|
-
models {
|
|
499
|
-
total
|
|
500
|
-
imported
|
|
501
|
-
failed
|
|
502
|
-
omitted
|
|
503
|
-
errors
|
|
504
|
-
}
|
|
505
|
-
defaultModels {
|
|
506
|
-
total
|
|
507
|
-
imported
|
|
508
|
-
failed
|
|
509
|
-
omitted
|
|
510
|
-
errors
|
|
511
|
-
}
|
|
512
|
-
tasks {
|
|
513
|
-
total
|
|
514
|
-
imported
|
|
515
|
-
failed
|
|
516
|
-
omitted
|
|
517
|
-
errors
|
|
518
|
-
}
|
|
519
|
-
friends {
|
|
520
|
-
total
|
|
521
|
-
imported
|
|
522
|
-
failed
|
|
523
|
-
omitted
|
|
524
|
-
errors
|
|
525
|
-
}
|
|
526
|
-
trustedAgents {
|
|
527
|
-
total
|
|
528
|
-
imported
|
|
529
|
-
failed
|
|
530
|
-
omitted
|
|
531
|
-
errors
|
|
532
|
-
}
|
|
533
|
-
knownLinkLanguages {
|
|
534
|
-
total
|
|
535
|
-
imported
|
|
536
|
-
failed
|
|
537
|
-
omitted
|
|
538
|
-
errors
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
`,
|
|
543
|
-
variables: { filePath },
|
|
544
|
-
}),
|
|
545
|
-
);
|
|
546
|
-
return runtimeImportDb;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
async notifications(): Promise<Notification[]> {
|
|
550
|
-
const { runtimeNotifications } = unwrapApolloResult(
|
|
551
|
-
await this._apolloClient.query({
|
|
552
|
-
query: gql`query runtimeNotifications {
|
|
283
|
+
variables: { filter }
|
|
284
|
+
}))
|
|
285
|
+
return runtimeMessageOutbox
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
async requestInstallNotification(notification: NotificationInput) {
|
|
289
|
+
const { runtimeRequestInstallNotification } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
290
|
+
mutation: gql`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
|
|
291
|
+
runtimeRequestInstallNotification(notification: $notification)
|
|
292
|
+
}`,
|
|
293
|
+
variables: { notification }
|
|
294
|
+
}))
|
|
295
|
+
return runtimeRequestInstallNotification
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
async grantNotification(id: string): Promise<boolean> {
|
|
299
|
+
const { runtimeGrantNotification } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
300
|
+
mutation: gql`mutation runtimeGrantNotification($id: String!) {
|
|
301
|
+
runtimeGrantNotification(id: $id)
|
|
302
|
+
}`,
|
|
303
|
+
variables: { id }
|
|
304
|
+
}))
|
|
305
|
+
return runtimeGrantNotification
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
async exportDb(filePath: string): Promise<boolean> {
|
|
309
|
+
const { runtimeExportDb } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
310
|
+
mutation: gql`mutation runtimeExportDb($filePath: String!) {
|
|
311
|
+
runtimeExportDb(filePath: $filePath)
|
|
312
|
+
}`,
|
|
313
|
+
variables: { filePath }
|
|
314
|
+
}))
|
|
315
|
+
return runtimeExportDb
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
async importDb(filePath: string): Promise<ImportResult> {
|
|
319
|
+
const { runtimeImportDb } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
320
|
+
mutation: gql`mutation runtimeImportDb($filePath: String!) {
|
|
321
|
+
runtimeImportDb(filePath: $filePath) {
|
|
322
|
+
perspectives { total imported failed omitted errors }
|
|
323
|
+
links { total imported failed omitted errors }
|
|
324
|
+
expressions { total imported failed omitted errors }
|
|
325
|
+
perspectiveDiffs { total imported failed omitted errors }
|
|
326
|
+
notifications { total imported failed omitted errors }
|
|
327
|
+
models { total imported failed omitted errors }
|
|
328
|
+
defaultModels { total imported failed omitted errors }
|
|
329
|
+
tasks { total imported failed omitted errors }
|
|
330
|
+
friends { total imported failed omitted errors }
|
|
331
|
+
trustedAgents { total imported failed omitted errors }
|
|
332
|
+
knownLinkLanguages { total imported failed omitted errors }
|
|
333
|
+
}
|
|
334
|
+
}`,
|
|
335
|
+
variables: { filePath }
|
|
336
|
+
}))
|
|
337
|
+
return runtimeImportDb
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
async notifications(): Promise<Notification[]> {
|
|
341
|
+
const { runtimeNotifications } = unwrapApolloResult(await this.#apolloClient.query({
|
|
342
|
+
query: gql`query runtimeNotifications {
|
|
553
343
|
runtimeNotifications { ${NOTIFICATION_FIELDS} }
|
|
554
344
|
}`,
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
)
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
async emailTestModeDisable(): Promise<boolean> {
|
|
687
|
-
const { runtimeEmailTestModeDisable } = unwrapApolloResult(
|
|
688
|
-
await this._apolloClient.mutate({
|
|
689
|
-
mutation: gql`
|
|
690
|
-
mutation runtimeEmailTestModeDisable {
|
|
691
|
-
runtimeEmailTestModeDisable
|
|
692
|
-
}
|
|
693
|
-
`,
|
|
694
|
-
}),
|
|
695
|
-
);
|
|
696
|
-
return runtimeEmailTestModeDisable;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
async emailTestGetCode(email: string): Promise<string | null> {
|
|
700
|
-
const { runtimeEmailTestGetCode } = unwrapApolloResult(
|
|
701
|
-
await this._apolloClient.mutate({
|
|
702
|
-
mutation: gql`
|
|
703
|
-
mutation runtimeEmailTestGetCode($email: String!) {
|
|
704
|
-
runtimeEmailTestGetCode(email: $email)
|
|
705
|
-
}
|
|
706
|
-
`,
|
|
707
|
-
variables: { email },
|
|
708
|
-
}),
|
|
709
|
-
);
|
|
710
|
-
return runtimeEmailTestGetCode;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
async emailTestClearCodes(): Promise<boolean> {
|
|
714
|
-
const { runtimeEmailTestClearCodes } = unwrapApolloResult(
|
|
715
|
-
await this._apolloClient.mutate({
|
|
716
|
-
mutation: gql`
|
|
717
|
-
mutation runtimeEmailTestClearCodes {
|
|
718
|
-
runtimeEmailTestClearCodes
|
|
719
|
-
}
|
|
720
|
-
`,
|
|
721
|
-
}),
|
|
722
|
-
);
|
|
723
|
-
return runtimeEmailTestClearCodes;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
async emailTestSetExpiry(
|
|
727
|
-
email: string,
|
|
728
|
-
verificationType: string,
|
|
729
|
-
expiresAt: number,
|
|
730
|
-
): Promise<boolean> {
|
|
731
|
-
const { runtimeEmailTestSetExpiry } = unwrapApolloResult(
|
|
732
|
-
await this._apolloClient.mutate({
|
|
733
|
-
mutation: gql`
|
|
734
|
-
mutation runtimeEmailTestSetExpiry(
|
|
735
|
-
$email: String!
|
|
736
|
-
$verificationType: String!
|
|
737
|
-
$expiresAt: Int!
|
|
738
|
-
) {
|
|
739
|
-
runtimeEmailTestSetExpiry(
|
|
740
|
-
email: $email
|
|
741
|
-
verificationType: $verificationType
|
|
742
|
-
expiresAt: $expiresAt
|
|
743
|
-
)
|
|
744
|
-
}
|
|
745
|
-
`,
|
|
746
|
-
variables: { email, verificationType, expiresAt },
|
|
747
|
-
}),
|
|
748
|
-
);
|
|
749
|
-
return runtimeEmailTestSetExpiry;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
addNotificationTriggeredCallback(cb: NotificationTriggeredCallback) {
|
|
753
|
-
this._notificationTriggeredCallbacks.push(cb);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
subscribeNotificationTriggered() {
|
|
757
|
-
this._apolloClient
|
|
758
|
-
.subscribe({
|
|
759
|
-
query: gql` subscription {
|
|
345
|
+
}))
|
|
346
|
+
return runtimeNotifications
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
async updateNotification(id: string, notification: NotificationInput): Promise<boolean> {
|
|
350
|
+
const { runtimeUpdateNotification } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
351
|
+
mutation: gql`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
|
|
352
|
+
runtimeUpdateNotification(id: $id, notification: $notification)
|
|
353
|
+
}`,
|
|
354
|
+
variables: { id, notification }
|
|
355
|
+
}))
|
|
356
|
+
return runtimeUpdateNotification
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
async removeNotification(id: string): Promise<boolean> {
|
|
360
|
+
const { runtimeRemoveNotification } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
361
|
+
mutation: gql`mutation runtimeRemoveNotification($id: String!) {
|
|
362
|
+
runtimeRemoveNotification(id: $id)
|
|
363
|
+
}`,
|
|
364
|
+
variables: { id }
|
|
365
|
+
}))
|
|
366
|
+
return runtimeRemoveNotification
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
async exportPerspective(uuid: string, filePath: string): Promise<boolean> {
|
|
370
|
+
const { runtimeExportPerspective } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
371
|
+
mutation: gql`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
|
|
372
|
+
runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
|
|
373
|
+
}`,
|
|
374
|
+
variables: { perspectiveUuid: uuid, filePath }
|
|
375
|
+
}))
|
|
376
|
+
return runtimeExportPerspective
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
async importPerspective(filePath: string): Promise<boolean> {
|
|
380
|
+
const { runtimeImportPerspective } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
381
|
+
mutation: gql`mutation runtimeImportPerspective($filePath: String!) {
|
|
382
|
+
runtimeImportPerspective(filePath: $filePath)
|
|
383
|
+
}`,
|
|
384
|
+
variables: { filePath }
|
|
385
|
+
}))
|
|
386
|
+
return runtimeImportPerspective
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
async multiUserEnabled(): Promise<boolean> {
|
|
390
|
+
const { runtimeMultiUserEnabled } = unwrapApolloResult(await this.#apolloClient.query({
|
|
391
|
+
query: gql`query runtimeMultiUserEnabled {
|
|
392
|
+
runtimeMultiUserEnabled
|
|
393
|
+
}`,
|
|
394
|
+
}))
|
|
395
|
+
return runtimeMultiUserEnabled
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
async setMultiUserEnabled(enabled: boolean): Promise<boolean> {
|
|
399
|
+
const { runtimeSetMultiUserEnabled } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
400
|
+
mutation: gql`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
|
|
401
|
+
runtimeSetMultiUserEnabled(enabled: $enabled)
|
|
402
|
+
}`,
|
|
403
|
+
variables: { enabled }
|
|
404
|
+
}))
|
|
405
|
+
return runtimeSetMultiUserEnabled
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
async listUsers(): Promise<UserStatistics[]> {
|
|
409
|
+
const { runtimeListUsers } = unwrapApolloResult(await this.#apolloClient.query({
|
|
410
|
+
query: gql`query runtimeListUsers {
|
|
411
|
+
runtimeListUsers {
|
|
412
|
+
email
|
|
413
|
+
did
|
|
414
|
+
lastSeen
|
|
415
|
+
perspectiveCount
|
|
416
|
+
}
|
|
417
|
+
}`
|
|
418
|
+
}))
|
|
419
|
+
return runtimeListUsers
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
async emailTestModeEnable(): Promise<boolean> {
|
|
423
|
+
const { runtimeEmailTestModeEnable } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
424
|
+
mutation: gql`mutation runtimeEmailTestModeEnable {
|
|
425
|
+
runtimeEmailTestModeEnable
|
|
426
|
+
}`
|
|
427
|
+
}))
|
|
428
|
+
return runtimeEmailTestModeEnable
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
async emailTestModeDisable(): Promise<boolean> {
|
|
432
|
+
const { runtimeEmailTestModeDisable } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
433
|
+
mutation: gql`mutation runtimeEmailTestModeDisable {
|
|
434
|
+
runtimeEmailTestModeDisable
|
|
435
|
+
}`
|
|
436
|
+
}))
|
|
437
|
+
return runtimeEmailTestModeDisable
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
async emailTestGetCode(email: string): Promise<string | null> {
|
|
441
|
+
const { runtimeEmailTestGetCode } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
442
|
+
mutation: gql`mutation runtimeEmailTestGetCode($email: String!) {
|
|
443
|
+
runtimeEmailTestGetCode(email: $email)
|
|
444
|
+
}`,
|
|
445
|
+
variables: { email }
|
|
446
|
+
}))
|
|
447
|
+
return runtimeEmailTestGetCode
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
async emailTestClearCodes(): Promise<boolean> {
|
|
451
|
+
const { runtimeEmailTestClearCodes } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
452
|
+
mutation: gql`mutation runtimeEmailTestClearCodes {
|
|
453
|
+
runtimeEmailTestClearCodes
|
|
454
|
+
}`
|
|
455
|
+
}))
|
|
456
|
+
return runtimeEmailTestClearCodes
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
async emailTestSetExpiry(email: string, verificationType: string, expiresAt: number): Promise<boolean> {
|
|
460
|
+
const { runtimeEmailTestSetExpiry } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
461
|
+
mutation: gql`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
|
|
462
|
+
runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
|
|
463
|
+
}`,
|
|
464
|
+
variables: { email, verificationType, expiresAt }
|
|
465
|
+
}))
|
|
466
|
+
return runtimeEmailTestSetExpiry
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
addNotificationTriggeredCallback(cb: NotificationTriggeredCallback) {
|
|
470
|
+
this.#notificationTriggeredCallbacks.push(cb)
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
subscribeNotificationTriggered() {
|
|
474
|
+
this.#apolloClient.subscribe({
|
|
475
|
+
query: gql` subscription {
|
|
760
476
|
runtimeNotificationTriggered { ${TRIGGERED_NOTIFICATION_FIELDS} }
|
|
761
477
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
subscribeMessageReceived() {
|
|
781
|
-
this._apolloClient
|
|
782
|
-
.subscribe({
|
|
783
|
-
query: gql` subscription {
|
|
478
|
+
`}).subscribe({
|
|
479
|
+
next: result => {
|
|
480
|
+
this.#notificationTriggeredCallbacks.forEach(cb => {
|
|
481
|
+
cb(result.data.runtimeNotificationTriggered)
|
|
482
|
+
})
|
|
483
|
+
},
|
|
484
|
+
error: (e) => console.error(e)
|
|
485
|
+
})
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
addMessageCallback(cb: MessageCallback) {
|
|
489
|
+
this.#messageReceivedCallbacks.push(cb)
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
subscribeMessageReceived() {
|
|
493
|
+
this.#apolloClient.subscribe({
|
|
494
|
+
query: gql` subscription {
|
|
784
495
|
runtimeMessageReceived { ${PERSPECTIVE_EXPRESSION_FIELDS} }
|
|
785
496
|
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
this._exceptionOccurredCallbacks.forEach((cb) => {
|
|
821
|
-
cb(result.data.exceptionOccurred);
|
|
822
|
-
});
|
|
823
|
-
},
|
|
824
|
-
error: (e) => {
|
|
825
|
-
if (!isSocketCloseError(e)) console.error(e);
|
|
826
|
-
},
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
}
|
|
497
|
+
`}).subscribe({
|
|
498
|
+
next: result => {
|
|
499
|
+
this.#messageReceivedCallbacks.forEach(cb => {
|
|
500
|
+
cb(result.data.runtimeMessageReceived)
|
|
501
|
+
})
|
|
502
|
+
},
|
|
503
|
+
error: (e) => console.error(e)
|
|
504
|
+
})
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
addExceptionCallback(cb: ExceptionCallback) {
|
|
508
|
+
this.#exceptionOccurredCallbacks.push(cb)
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
subscribeExceptionOccurred() {
|
|
512
|
+
this.#apolloClient.subscribe({
|
|
513
|
+
query: gql` subscription {
|
|
514
|
+
exceptionOccurred {
|
|
515
|
+
title
|
|
516
|
+
message
|
|
517
|
+
type
|
|
518
|
+
addon
|
|
519
|
+
}
|
|
520
|
+
}`
|
|
521
|
+
}).subscribe({
|
|
522
|
+
next: result => {
|
|
523
|
+
this.#exceptionOccurredCallbacks.forEach(cb => {
|
|
524
|
+
cb(result.data.exceptionOccurred)
|
|
525
|
+
})
|
|
526
|
+
},
|
|
527
|
+
error: (e) => console.error(e)
|
|
528
|
+
})
|
|
529
|
+
}
|
|
530
|
+
}
|