@coasys/ad4m 0.12.0-rc1-dev → 0.12.0-rc1-dev.2
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 +4 -4
- package/lib/index.cjs +5999 -6044
- package/lib/index.js +5977 -6038
- package/lib/src/Ad4mClient.d.ts +16 -9
- package/lib/src/Ad4mClient.js +25 -46
- package/lib/src/Ad4mClient.test.d.ts +1 -0
- package/lib/src/Ad4mClient.test.js +1204 -0
- package/lib/src/Literal.d.ts +2 -1
- package/lib/src/Literal.js +35 -38
- package/lib/src/Literal.test.d.ts +1 -0
- package/lib/src/Literal.test.js +41 -0
- package/lib/src/SmartLiteral.d.ts +2 -1
- package/lib/src/SmartLiteral.js +15 -30
- package/lib/src/agent/AgentClient.d.ts +4 -1
- package/lib/src/agent/AgentClient.js +99 -79
- package/lib/src/ai/AIClient.d.ts +2 -1
- package/lib/src/ai/AIClient.js +220 -224
- package/lib/src/expression/ExpressionClient.d.ts +1 -1
- package/lib/src/expression/ExpressionClient.js +86 -73
- 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 +157 -937
- package/lib/src/model/Ad4mModel.js +212 -2797
- package/lib/src/model/Ad4mModel.test.js +1002 -561
- package/lib/src/model/decorators.d.ts +94 -426
- package/lib/src/model/decorators.js +333 -741
- package/lib/src/model/mutation.d.ts +81 -0
- package/lib/src/model/mutation.js +317 -0
- package/lib/src/model/parentUtils.d.ts +32 -0
- package/lib/src/model/parentUtils.js +64 -0
- package/lib/src/model/prolog/generatePrologFacts.d.ts +36 -0
- package/lib/src/model/prolog/generatePrologFacts.js +139 -0
- package/lib/src/model/prolog/index.d.ts +1 -0
- package/lib/src/model/prolog/index.js +1 -0
- package/lib/src/model/query/ModelQueryBuilder.d.ts +82 -0
- package/lib/src/model/query/ModelQueryBuilder.js +115 -0
- package/lib/src/model/query/QueryBuilder.d.ts +101 -0
- package/lib/src/model/query/QueryBuilder.js +193 -0
- package/lib/src/model/query/SurrealQueryBuilder.d.ts +48 -0
- package/lib/src/model/query/SurrealQueryBuilder.js +371 -0
- package/lib/src/model/query/fetchInstance.d.ts +24 -0
- package/lib/src/model/query/fetchInstance.js +144 -0
- package/lib/src/model/query/hydration.d.ts +54 -0
- package/lib/src/model/query/hydration.js +214 -0
- package/lib/src/model/query/operations.d.ts +59 -0
- package/lib/src/model/query/operations.js +384 -0
- package/lib/src/model/query/snapshot.d.ts +59 -0
- package/lib/src/model/query/snapshot.js +106 -0
- package/lib/src/model/query/surrealCompiler.d.ts +42 -0
- package/lib/src/model/query/surrealCompiler.js +304 -0
- package/lib/src/model/schema/fromJSONSchema.d.ts +67 -0
- package/lib/src/model/schema/fromJSONSchema.js +264 -0
- package/lib/src/model/schema/metadata.d.ts +15 -0
- package/lib/src/model/schema/metadata.js +112 -0
- package/lib/src/model/subscription.d.ts +47 -0
- package/lib/src/model/subscription.js +231 -0
- package/lib/src/model/transaction.d.ts +27 -0
- package/lib/src/model/transaction.js +32 -0
- package/lib/src/model/types.d.ts +195 -0
- package/lib/src/model/types.js +8 -0
- package/lib/src/model/util.js +7 -7
- package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +5 -1
- package/lib/src/neighbourhood/NeighbourhoodClient.js +263 -181
- package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +2 -1
- package/lib/src/neighbourhood/NeighbourhoodProxy.js +13 -28
- package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +1 -5
- package/lib/src/perspectives/PerspectiveClient.d.ts +9 -9
- package/lib/src/perspectives/PerspectiveClient.js +316 -240
- package/lib/src/perspectives/PerspectiveProxy.d.ts +54 -92
- package/lib/src/perspectives/PerspectiveProxy.js +803 -444
- package/lib/src/runtime/RuntimeClient.d.ts +5 -1
- package/lib/src/runtime/RuntimeClient.js +412 -238
- package/lib/src/shacl/SHACLFlow.test.js +164 -105
- package/lib/src/shacl/SHACLShape.d.ts +17 -3
- package/lib/src/shacl/SHACLShape.js +127 -90
- package/lib/src/shacl/SHACLShape.test.js +244 -176
- package/lib/src/utils.d.ts +8 -0
- package/lib/src/utils.js +21 -7
- package/package.json +8 -13
- package/src/Ad4mClient.test.ts +1564 -1315
- package/src/Ad4mClient.ts +55 -54
- package/src/Literal.test.ts +45 -26
- package/src/Literal.ts +82 -66
- package/src/SmartLiteral.ts +74 -58
- package/src/agent/AgentClient.ts +144 -99
- package/src/ai/AIClient.ts +409 -359
- package/src/expression/ExpressionClient.ts +142 -96
- package/src/index.ts +1 -1
- package/src/language/LanguageClient.ts +137 -113
- package/src/model/Ad4mModel.test.ts +1128 -647
- package/src/model/Ad4mModel.ts +485 -3247
- package/src/model/IMPROVEMENTS.md +482 -0
- package/src/model/PREDICATE_COLLISION_FIX.md +651 -0
- package/src/model/README.md +317 -0
- package/src/model/SHACL_MUTATION_DECOUPLING.md +356 -0
- package/src/model/SUBSCRIPTION_STRATEGY.md +317 -0
- package/src/model/TC39_STAGE_3_DECORATORS.md +609 -0
- package/src/model/decorators.ts +689 -1046
- package/src/model/mutation.ts +461 -0
- package/src/model/parentUtils.ts +91 -0
- package/src/model/prolog/generatePrologFacts.ts +176 -0
- package/src/model/prolog/index.ts +1 -0
- package/src/model/query/ModelQueryBuilder.ts +173 -0
- package/src/model/query/fetchInstance.ts +181 -0
- package/src/model/query/hydration.ts +273 -0
- package/src/model/query/operations.ts +510 -0
- package/src/model/query/snapshot.ts +126 -0
- package/src/model/query/surrealCompiler.ts +376 -0
- package/src/model/schema/fromJSONSchema.ts +411 -0
- package/src/model/schema/metadata.ts +148 -0
- package/src/model/subscription.ts +307 -0
- package/src/model/transaction.ts +60 -0
- package/src/model/types.ts +207 -0
- package/src/model/util.ts +47 -48
- package/src/neighbourhood/NeighbourhoodClient.ts +393 -251
- package/src/neighbourhood/NeighbourhoodProxy.test.ts +3 -7
- package/src/neighbourhood/NeighbourhoodProxy.ts +58 -40
- package/src/perspectives/PerspectiveClient.ts +779 -540
- package/src/perspectives/PerspectiveProxy.ts +2860 -2053
- package/src/runtime/RuntimeClient.ts +775 -476
- package/src/shacl/SHACLFlow.test.ts +196 -129
- package/src/shacl/SHACLShape.test.ts +284 -190
- package/src/shacl/SHACLShape.ts +225 -172
- package/src/utils.ts +31 -17
- package/tsconfig.json +9 -10
- package/src/model/Subject.ts +0 -159
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import { ApolloClient, gql } from "@apollo/client/core"
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { ApolloClient, gql } from "@apollo/client/core";
|
|
2
|
+
import {
|
|
3
|
+
Perspective,
|
|
4
|
+
PerspectiveExpression,
|
|
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";
|
|
5
18
|
|
|
6
19
|
const PERSPECTIVE_EXPRESSION_FIELDS = `
|
|
7
20
|
author
|
|
@@ -15,7 +28,7 @@ data {
|
|
|
15
28
|
}
|
|
16
29
|
}
|
|
17
30
|
proof { valid, invalid, signature, key }
|
|
18
|
-
|
|
31
|
+
`;
|
|
19
32
|
|
|
20
33
|
const NOTIFICATION_DEFINITION_FIELDS = `
|
|
21
34
|
description
|
|
@@ -26,253 +39,364 @@ trigger
|
|
|
26
39
|
perspectiveIds
|
|
27
40
|
webhookUrl
|
|
28
41
|
webhookAuth
|
|
29
|
-
|
|
42
|
+
`;
|
|
30
43
|
|
|
31
44
|
const NOTIFICATION_FIELDS = `
|
|
32
45
|
id
|
|
33
46
|
granted
|
|
34
47
|
${NOTIFICATION_DEFINITION_FIELDS}
|
|
35
|
-
|
|
48
|
+
`;
|
|
36
49
|
|
|
37
50
|
const TRIGGERED_NOTIFICATION_FIELDS = `
|
|
38
51
|
notification { ${NOTIFICATION_FIELDS} }
|
|
39
52
|
perspectiveId
|
|
40
53
|
triggerMatch
|
|
41
|
-
|
|
54
|
+
`;
|
|
42
55
|
|
|
43
|
-
export type MessageCallback = (message: PerspectiveExpression) => null
|
|
44
|
-
export type ExceptionCallback = (info: ExceptionInfo) => null
|
|
45
|
-
export type NotificationTriggeredCallback = (
|
|
46
|
-
|
|
56
|
+
export type MessageCallback = (message: PerspectiveExpression) => null;
|
|
57
|
+
export type ExceptionCallback = (info: ExceptionInfo) => null;
|
|
58
|
+
export type NotificationTriggeredCallback = (
|
|
59
|
+
notification: TriggeredNotification,
|
|
60
|
+
) => null;
|
|
61
|
+
export type NotificationRequestedCallback = (
|
|
62
|
+
notification: Notification,
|
|
63
|
+
) => null;
|
|
47
64
|
|
|
48
65
|
export class RuntimeClient {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
66
|
+
private _apolloClient: ApolloClient<any>;
|
|
67
|
+
private _messageReceivedCallbacks: MessageCallback[];
|
|
68
|
+
private _exceptionOccurredCallbacks: ExceptionCallback[];
|
|
69
|
+
private _notificationTriggeredCallbacks: NotificationTriggeredCallback[];
|
|
70
|
+
private _notificationRequestedCallbacks: NotificationRequestedCallback[];
|
|
71
|
+
|
|
72
|
+
constructor(client: ApolloClient<any>, subscribe: boolean = true) {
|
|
73
|
+
this._apolloClient = client;
|
|
74
|
+
this._messageReceivedCallbacks = [];
|
|
75
|
+
this._exceptionOccurredCallbacks = [];
|
|
76
|
+
this._notificationTriggeredCallbacks = [];
|
|
77
|
+
|
|
78
|
+
if (subscribe) {
|
|
79
|
+
this.subscribeMessageReceived();
|
|
80
|
+
this.subscribeExceptionOccurred();
|
|
81
|
+
this.subscribeNotificationTriggered();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async info(): Promise<RuntimeInfo> {
|
|
86
|
+
const { runtimeInfo } = unwrapApolloResult(
|
|
87
|
+
await this._apolloClient.query({
|
|
88
|
+
query: gql`
|
|
89
|
+
query runtimeInfo {
|
|
90
|
+
runtimeInfo {
|
|
91
|
+
ad4mExecutorVersion
|
|
92
|
+
isInitialized
|
|
93
|
+
isUnlocked
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`,
|
|
97
|
+
}),
|
|
98
|
+
);
|
|
99
|
+
return runtimeInfo;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async quit(): Promise<Boolean> {
|
|
103
|
+
const result = unwrapApolloResult(
|
|
104
|
+
await this._apolloClient.mutate({
|
|
105
|
+
mutation: gql`
|
|
106
|
+
mutation runtimeQuit {
|
|
107
|
+
runtimeQuit
|
|
108
|
+
}
|
|
109
|
+
`,
|
|
110
|
+
}),
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
return result.runtimeQuit;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async openLink(url: string): Promise<Boolean> {
|
|
117
|
+
const { runtimeOpenLink } = unwrapApolloResult(
|
|
118
|
+
await this._apolloClient.mutate({
|
|
119
|
+
mutation: gql`
|
|
120
|
+
mutation runtimeOpenLink($url: String!) {
|
|
121
|
+
runtimeOpenLink(url: $url)
|
|
122
|
+
}
|
|
123
|
+
`,
|
|
124
|
+
variables: { url },
|
|
125
|
+
}),
|
|
126
|
+
);
|
|
127
|
+
return runtimeOpenLink;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async addTrustedAgents(agents: string[]): Promise<string[]> {
|
|
131
|
+
const { addTrustedAgents } = unwrapApolloResult(
|
|
132
|
+
await this._apolloClient.mutate({
|
|
133
|
+
mutation: gql`
|
|
134
|
+
mutation addTrustedAgents($agents: [String!]!) {
|
|
135
|
+
addTrustedAgents(agents: $agents)
|
|
136
|
+
}
|
|
137
|
+
`,
|
|
138
|
+
variables: { agents },
|
|
139
|
+
}),
|
|
140
|
+
);
|
|
141
|
+
return addTrustedAgents;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async deleteTrustedAgents(agents: string[]): Promise<string[]> {
|
|
145
|
+
const { deleteTrustedAgents } = unwrapApolloResult(
|
|
146
|
+
await this._apolloClient.mutate({
|
|
147
|
+
mutation: gql`
|
|
148
|
+
mutation deleteTrustedAgents($agents: [String!]!) {
|
|
149
|
+
deleteTrustedAgents(agents: $agents)
|
|
150
|
+
}
|
|
151
|
+
`,
|
|
152
|
+
variables: { agents },
|
|
153
|
+
}),
|
|
154
|
+
);
|
|
155
|
+
return deleteTrustedAgents;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async getTrustedAgents(): Promise<string[]> {
|
|
159
|
+
const { getTrustedAgents } = unwrapApolloResult(
|
|
160
|
+
await this._apolloClient.query({
|
|
161
|
+
query: gql`
|
|
162
|
+
query getTrustedAgents {
|
|
163
|
+
getTrustedAgents
|
|
164
|
+
}
|
|
165
|
+
`,
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
168
|
+
return getTrustedAgents;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async addKnownLinkLanguageTemplates(addresses: string[]): Promise<string[]> {
|
|
172
|
+
const { runtimeAddKnownLinkLanguageTemplates } = unwrapApolloResult(
|
|
173
|
+
await this._apolloClient.mutate({
|
|
174
|
+
mutation: gql`
|
|
175
|
+
mutation runtimeAddKnownLinkLanguageTemplates(
|
|
176
|
+
$addresses: [String!]!
|
|
177
|
+
) {
|
|
178
|
+
runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
|
|
179
|
+
}
|
|
180
|
+
`,
|
|
181
|
+
variables: { addresses },
|
|
182
|
+
}),
|
|
183
|
+
);
|
|
184
|
+
return runtimeAddKnownLinkLanguageTemplates;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async removeKnownLinkLanguageTemplates(
|
|
188
|
+
addresses: string[],
|
|
189
|
+
): Promise<string[]> {
|
|
190
|
+
const { runtimeRemoveKnownLinkLanguageTemplates } = unwrapApolloResult(
|
|
191
|
+
await this._apolloClient.mutate({
|
|
192
|
+
mutation: gql`
|
|
193
|
+
mutation runtimeRemoveKnownLinkLanguageTemplates(
|
|
194
|
+
$addresses: [String!]!
|
|
195
|
+
) {
|
|
196
|
+
runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
|
|
197
|
+
}
|
|
198
|
+
`,
|
|
199
|
+
variables: { addresses },
|
|
200
|
+
}),
|
|
201
|
+
);
|
|
202
|
+
return runtimeRemoveKnownLinkLanguageTemplates;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
async knownLinkLanguageTemplates(): Promise<string[]> {
|
|
206
|
+
const { runtimeKnownLinkLanguageTemplates } = unwrapApolloResult(
|
|
207
|
+
await this._apolloClient.query({
|
|
208
|
+
query: gql`
|
|
209
|
+
query runtimeKnownLinkLanguageTemplates {
|
|
210
|
+
runtimeKnownLinkLanguageTemplates
|
|
211
|
+
}
|
|
212
|
+
`,
|
|
213
|
+
}),
|
|
214
|
+
);
|
|
215
|
+
return runtimeKnownLinkLanguageTemplates;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
async addFriends(dids: string[]): Promise<string[]> {
|
|
219
|
+
const { runtimeAddFriends } = unwrapApolloResult(
|
|
220
|
+
await this._apolloClient.mutate({
|
|
221
|
+
mutation: gql`
|
|
222
|
+
mutation runtimeAddFriends($dids: [String!]!) {
|
|
223
|
+
runtimeAddFriends(dids: $dids)
|
|
224
|
+
}
|
|
225
|
+
`,
|
|
226
|
+
variables: { dids },
|
|
227
|
+
}),
|
|
228
|
+
);
|
|
229
|
+
return runtimeAddFriends;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
async removeFriends(dids: string[]): Promise<string[]> {
|
|
233
|
+
const { runtimeRemoveFriends } = unwrapApolloResult(
|
|
234
|
+
await this._apolloClient.mutate({
|
|
235
|
+
mutation: gql`
|
|
236
|
+
mutation runtimeRemoveFriends($dids: [String!]!) {
|
|
237
|
+
runtimeRemoveFriends(dids: $dids)
|
|
238
|
+
}
|
|
239
|
+
`,
|
|
240
|
+
variables: { dids },
|
|
241
|
+
}),
|
|
242
|
+
);
|
|
243
|
+
return runtimeRemoveFriends;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
async friends(): Promise<string[]> {
|
|
247
|
+
const { runtimeFriends } = unwrapApolloResult(
|
|
248
|
+
await this._apolloClient.query({
|
|
249
|
+
query: gql`
|
|
250
|
+
query runtimeFriends {
|
|
251
|
+
runtimeFriends
|
|
252
|
+
}
|
|
253
|
+
`,
|
|
254
|
+
}),
|
|
255
|
+
);
|
|
256
|
+
return runtimeFriends;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
async hcAgentInfos(): Promise<string> {
|
|
260
|
+
const { runtimeHcAgentInfos } = unwrapApolloResult(
|
|
261
|
+
await this._apolloClient.query({
|
|
262
|
+
query: gql`
|
|
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!) {
|
|
246
359
|
runtimeFriendStatus(did: $did) { ${PERSPECTIVE_EXPRESSION_FIELDS} }
|
|
247
360
|
}`,
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
361
|
+
variables: { did },
|
|
362
|
+
}),
|
|
363
|
+
);
|
|
364
|
+
return runtimeFriendStatus;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
async friendSendMessage(did: string, message: Perspective): Promise<boolean> {
|
|
368
|
+
const { runtimeFriendSendMessage } = unwrapApolloResult(
|
|
369
|
+
await this._apolloClient.mutate({
|
|
370
|
+
mutation: gql`
|
|
371
|
+
mutation runtimeFriendSendMessage(
|
|
372
|
+
$did: String!
|
|
373
|
+
$message: PerspectiveInput!
|
|
374
|
+
) {
|
|
375
|
+
runtimeFriendSendMessage(did: $did, message: $message)
|
|
376
|
+
}
|
|
377
|
+
`,
|
|
378
|
+
variables: { did, message },
|
|
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) {
|
|
266
388
|
runtimeMessageInbox(filter: $filter) { ${PERSPECTIVE_EXPRESSION_FIELDS} }
|
|
267
389
|
}`,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
390
|
+
variables: { filter },
|
|
391
|
+
}),
|
|
392
|
+
);
|
|
393
|
+
return runtimeMessageInbox;
|
|
394
|
+
}
|
|
272
395
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
396
|
+
async messageOutbox(filter?: string): Promise<SentMessage[]> {
|
|
397
|
+
const { runtimeMessageOutbox } = unwrapApolloResult(
|
|
398
|
+
await this._apolloClient.query({
|
|
399
|
+
query: gql`query runtimeMessageOutbox($filter: String) {
|
|
276
400
|
runtimeMessageOutbox(filter: $filter) {
|
|
277
401
|
recipient,
|
|
278
402
|
message {
|
|
@@ -280,251 +404,426 @@ export class RuntimeClient {
|
|
|
280
404
|
}
|
|
281
405
|
}
|
|
282
406
|
}`,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
407
|
+
variables: { filter },
|
|
408
|
+
}),
|
|
409
|
+
);
|
|
410
|
+
return runtimeMessageOutbox;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
async requestInstallNotification(notification: NotificationInput) {
|
|
414
|
+
const { runtimeRequestInstallNotification } = unwrapApolloResult(
|
|
415
|
+
await this._apolloClient.mutate({
|
|
416
|
+
mutation: gql`
|
|
417
|
+
mutation runtimeRequestInstallNotification(
|
|
418
|
+
$notification: NotificationInput!
|
|
419
|
+
) {
|
|
420
|
+
runtimeRequestInstallNotification(notification: $notification)
|
|
421
|
+
}
|
|
422
|
+
`,
|
|
423
|
+
variables: { notification },
|
|
424
|
+
}),
|
|
425
|
+
);
|
|
426
|
+
return runtimeRequestInstallNotification;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
async grantNotification(id: string): Promise<boolean> {
|
|
430
|
+
const { runtimeGrantNotification } = unwrapApolloResult(
|
|
431
|
+
await this._apolloClient.mutate({
|
|
432
|
+
mutation: gql`
|
|
433
|
+
mutation runtimeGrantNotification($id: String!) {
|
|
434
|
+
runtimeGrantNotification(id: $id)
|
|
435
|
+
}
|
|
436
|
+
`,
|
|
437
|
+
variables: { id },
|
|
438
|
+
}),
|
|
439
|
+
);
|
|
440
|
+
return runtimeGrantNotification;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
async exportDb(filePath: string): Promise<boolean> {
|
|
444
|
+
const { runtimeExportDb } = unwrapApolloResult(
|
|
445
|
+
await this._apolloClient.mutate({
|
|
446
|
+
mutation: gql`
|
|
447
|
+
mutation runtimeExportDb($filePath: String!) {
|
|
448
|
+
runtimeExportDb(filePath: $filePath)
|
|
449
|
+
}
|
|
450
|
+
`,
|
|
451
|
+
variables: { filePath },
|
|
452
|
+
}),
|
|
453
|
+
);
|
|
454
|
+
return runtimeExportDb;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
async importDb(filePath: string): Promise<ImportResult> {
|
|
458
|
+
const { runtimeImportDb } = unwrapApolloResult(
|
|
459
|
+
await this._apolloClient.mutate({
|
|
460
|
+
mutation: gql`
|
|
461
|
+
mutation runtimeImportDb($filePath: String!) {
|
|
462
|
+
runtimeImportDb(filePath: $filePath) {
|
|
463
|
+
perspectives {
|
|
464
|
+
total
|
|
465
|
+
imported
|
|
466
|
+
failed
|
|
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 {
|
|
343
553
|
runtimeNotifications { ${NOTIFICATION_FIELDS} }
|
|
344
554
|
}`,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
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
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
555
|
+
}),
|
|
556
|
+
);
|
|
557
|
+
return runtimeNotifications;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
async updateNotification(
|
|
561
|
+
id: string,
|
|
562
|
+
notification: NotificationInput,
|
|
563
|
+
): Promise<boolean> {
|
|
564
|
+
const { runtimeUpdateNotification } = unwrapApolloResult(
|
|
565
|
+
await this._apolloClient.mutate({
|
|
566
|
+
mutation: gql`
|
|
567
|
+
mutation runtimeUpdateNotification(
|
|
568
|
+
$id: String!
|
|
569
|
+
$notification: NotificationInput!
|
|
570
|
+
) {
|
|
571
|
+
runtimeUpdateNotification(id: $id, notification: $notification)
|
|
572
|
+
}
|
|
573
|
+
`,
|
|
574
|
+
variables: { id, notification },
|
|
575
|
+
}),
|
|
576
|
+
);
|
|
577
|
+
return runtimeUpdateNotification;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
async removeNotification(id: string): Promise<boolean> {
|
|
581
|
+
const { runtimeRemoveNotification } = unwrapApolloResult(
|
|
582
|
+
await this._apolloClient.mutate({
|
|
583
|
+
mutation: gql`
|
|
584
|
+
mutation runtimeRemoveNotification($id: String!) {
|
|
585
|
+
runtimeRemoveNotification(id: $id)
|
|
586
|
+
}
|
|
587
|
+
`,
|
|
588
|
+
variables: { id },
|
|
589
|
+
}),
|
|
590
|
+
);
|
|
591
|
+
return runtimeRemoveNotification;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
async exportPerspective(uuid: string, filePath: string): Promise<boolean> {
|
|
595
|
+
const { runtimeExportPerspective } = unwrapApolloResult(
|
|
596
|
+
await this._apolloClient.mutate({
|
|
597
|
+
mutation: gql`
|
|
598
|
+
mutation runtimeExportPerspective(
|
|
599
|
+
$perspectiveUuid: String!
|
|
600
|
+
$filePath: String!
|
|
601
|
+
) {
|
|
602
|
+
runtimeExportPerspective(
|
|
603
|
+
perspectiveUuid: $perspectiveUuid
|
|
604
|
+
filePath: $filePath
|
|
605
|
+
)
|
|
606
|
+
}
|
|
607
|
+
`,
|
|
608
|
+
variables: { perspectiveUuid: uuid, filePath },
|
|
609
|
+
}),
|
|
610
|
+
);
|
|
611
|
+
return runtimeExportPerspective;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
async importPerspective(filePath: string): Promise<boolean> {
|
|
615
|
+
const { runtimeImportPerspective } = unwrapApolloResult(
|
|
616
|
+
await this._apolloClient.mutate({
|
|
617
|
+
mutation: gql`
|
|
618
|
+
mutation runtimeImportPerspective($filePath: String!) {
|
|
619
|
+
runtimeImportPerspective(filePath: $filePath)
|
|
620
|
+
}
|
|
621
|
+
`,
|
|
622
|
+
variables: { filePath },
|
|
623
|
+
}),
|
|
624
|
+
);
|
|
625
|
+
return runtimeImportPerspective;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
async multiUserEnabled(): Promise<boolean> {
|
|
629
|
+
const { runtimeMultiUserEnabled } = unwrapApolloResult(
|
|
630
|
+
await this._apolloClient.query({
|
|
631
|
+
query: gql`
|
|
632
|
+
query runtimeMultiUserEnabled {
|
|
633
|
+
runtimeMultiUserEnabled
|
|
634
|
+
}
|
|
635
|
+
`,
|
|
636
|
+
}),
|
|
637
|
+
);
|
|
638
|
+
return runtimeMultiUserEnabled;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
async setMultiUserEnabled(enabled: boolean): Promise<boolean> {
|
|
642
|
+
const { runtimeSetMultiUserEnabled } = unwrapApolloResult(
|
|
643
|
+
await this._apolloClient.mutate({
|
|
644
|
+
mutation: gql`
|
|
645
|
+
mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
|
|
646
|
+
runtimeSetMultiUserEnabled(enabled: $enabled)
|
|
647
|
+
}
|
|
648
|
+
`,
|
|
649
|
+
variables: { enabled },
|
|
650
|
+
}),
|
|
651
|
+
);
|
|
652
|
+
return runtimeSetMultiUserEnabled;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
async listUsers(): Promise<UserStatistics[]> {
|
|
656
|
+
const { runtimeListUsers } = unwrapApolloResult(
|
|
657
|
+
await this._apolloClient.query({
|
|
658
|
+
query: gql`
|
|
659
|
+
query runtimeListUsers {
|
|
660
|
+
runtimeListUsers {
|
|
661
|
+
email
|
|
662
|
+
did
|
|
663
|
+
lastSeen
|
|
664
|
+
perspectiveCount
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
`,
|
|
668
|
+
}),
|
|
669
|
+
);
|
|
670
|
+
return runtimeListUsers;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
async emailTestModeEnable(): Promise<boolean> {
|
|
674
|
+
const { runtimeEmailTestModeEnable } = unwrapApolloResult(
|
|
675
|
+
await this._apolloClient.mutate({
|
|
676
|
+
mutation: gql`
|
|
677
|
+
mutation runtimeEmailTestModeEnable {
|
|
678
|
+
runtimeEmailTestModeEnable
|
|
679
|
+
}
|
|
680
|
+
`,
|
|
681
|
+
}),
|
|
682
|
+
);
|
|
683
|
+
return runtimeEmailTestModeEnable;
|
|
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 {
|
|
476
760
|
runtimeNotificationTriggered { ${TRIGGERED_NOTIFICATION_FIELDS} }
|
|
477
761
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
762
|
+
`,
|
|
763
|
+
})
|
|
764
|
+
.subscribe({
|
|
765
|
+
next: (result) => {
|
|
766
|
+
this._notificationTriggeredCallbacks.forEach((cb) => {
|
|
767
|
+
cb(result.data.runtimeNotificationTriggered);
|
|
768
|
+
});
|
|
769
|
+
},
|
|
770
|
+
error: (e) => {
|
|
771
|
+
if (!isSocketCloseError(e)) console.error(e);
|
|
772
|
+
},
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
addMessageCallback(cb: MessageCallback) {
|
|
777
|
+
this._messageReceivedCallbacks.push(cb);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
subscribeMessageReceived() {
|
|
781
|
+
this._apolloClient
|
|
782
|
+
.subscribe({
|
|
783
|
+
query: gql` subscription {
|
|
495
784
|
runtimeMessageReceived { ${PERSPECTIVE_EXPRESSION_FIELDS} }
|
|
496
785
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
786
|
+
`,
|
|
787
|
+
})
|
|
788
|
+
.subscribe({
|
|
789
|
+
next: (result) => {
|
|
790
|
+
this._messageReceivedCallbacks.forEach((cb) => {
|
|
791
|
+
cb(result.data.runtimeMessageReceived);
|
|
792
|
+
});
|
|
793
|
+
},
|
|
794
|
+
error: (e) => {
|
|
795
|
+
if (!isSocketCloseError(e)) console.error(e);
|
|
796
|
+
},
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
addExceptionCallback(cb: ExceptionCallback) {
|
|
801
|
+
this._exceptionOccurredCallbacks.push(cb);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
subscribeExceptionOccurred() {
|
|
805
|
+
this._apolloClient
|
|
806
|
+
.subscribe({
|
|
807
|
+
query: gql`
|
|
808
|
+
subscription {
|
|
809
|
+
exceptionOccurred {
|
|
810
|
+
title
|
|
811
|
+
message
|
|
812
|
+
type
|
|
813
|
+
addon
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
`,
|
|
817
|
+
})
|
|
818
|
+
.subscribe({
|
|
819
|
+
next: (result) => {
|
|
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
|
+
}
|