@coasys/ad4m 0.10.1-rc9-dev → 0.10.1-release-candidate-1
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/lib/index.cjs +1113 -429
- package/lib/index.js +1114 -430
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -0
- package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +2 -2
- package/lib/src/neighbourhood/NeighbourhoodClient.js +12 -8
- package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +2 -2
- package/lib/src/neighbourhood/NeighbourhoodProxy.js +4 -4
- package/lib/src/neighbourhood/NeighbourhoodResolver.d.ts +2 -2
- package/lib/src/neighbourhood/NeighbourhoodResolver.js +6 -4
- package/lib/src/runtime/RuntimeClient.d.ts +5 -1
- package/lib/src/runtime/RuntimeClient.js +48 -0
- package/lib/src/runtime/RuntimeResolver.d.ts +24 -0
- package/lib/src/runtime/RuntimeResolver.js +117 -0
- package/lib/src/schema.gql +6 -2
- package/lib/src/typeDefs.js +6 -2
- package/package.json +2 -1
- package/src/index.ts +1 -0
- package/src/neighbourhood/NeighbourhoodClient.ts +12 -8
- package/src/neighbourhood/NeighbourhoodProxy.ts +4 -4
- package/src/neighbourhood/NeighbourhoodResolver.ts +2 -2
- package/src/runtime/RuntimeClient.ts +52 -1
- package/src/runtime/RuntimeResolver.ts +77 -0
- package/yarn-error.log +0 -90
package/lib/src/index.d.ts
CHANGED
package/lib/src/index.js
CHANGED
|
@@ -16,8 +16,8 @@ export declare class NeighbourhoodClient {
|
|
|
16
16
|
setOnlineStatusU(perspectiveUUID: string, status: PerspectiveUnsignedInput): Promise<boolean>;
|
|
17
17
|
sendSignal(perspectiveUUID: string, remoteAgentDid: string, payload: Perspective): Promise<boolean>;
|
|
18
18
|
sendSignalU(perspectiveUUID: string, remoteAgentDid: string, payload: PerspectiveUnsignedInput): Promise<boolean>;
|
|
19
|
-
sendBroadcast(perspectiveUUID: string, payload: Perspective): Promise<boolean>;
|
|
20
|
-
sendBroadcastU(perspectiveUUID: string, payload: PerspectiveUnsignedInput): Promise<boolean>;
|
|
19
|
+
sendBroadcast(perspectiveUUID: string, payload: Perspective, loopback?: boolean): Promise<boolean>;
|
|
20
|
+
sendBroadcastU(perspectiveUUID: string, payload: PerspectiveUnsignedInput, loopback?: boolean): Promise<boolean>;
|
|
21
21
|
dispatchSignal(perspectiveUUID: string, signal: any): void;
|
|
22
22
|
subscribeToSignals(perspectiveUUID: string): Promise<void>;
|
|
23
23
|
addSignalHandler(perspectiveUUID: string, handler: TelepresenceSignalCallback): Promise<void>;
|
|
@@ -170,33 +170,37 @@ export class NeighbourhoodClient {
|
|
|
170
170
|
}));
|
|
171
171
|
return neighbourhoodSendSignalU;
|
|
172
172
|
}
|
|
173
|
-
async sendBroadcast(perspectiveUUID, payload) {
|
|
173
|
+
async sendBroadcast(perspectiveUUID, payload, loopback = false) {
|
|
174
174
|
const { neighbourhoodSendBroadcast } = unwrapApolloResult(await __classPrivateFieldGet(this, _NeighbourhoodClient_apolloClient, "f").mutate({
|
|
175
175
|
mutation: gql `mutation neighbourhoodSendBroadcast(
|
|
176
176
|
$perspectiveUUID: String!,
|
|
177
|
-
$payload: PerspectiveInput
|
|
177
|
+
$payload: PerspectiveInput!,
|
|
178
|
+
$loopback: Boolean
|
|
178
179
|
) {
|
|
179
180
|
neighbourhoodSendBroadcast(
|
|
180
181
|
perspectiveUUID: $perspectiveUUID,
|
|
181
|
-
payload: $payload
|
|
182
|
+
payload: $payload,
|
|
183
|
+
loopback: $loopback
|
|
182
184
|
)
|
|
183
185
|
}`,
|
|
184
|
-
variables: { perspectiveUUID, payload }
|
|
186
|
+
variables: { perspectiveUUID, payload, loopback }
|
|
185
187
|
}));
|
|
186
188
|
return neighbourhoodSendBroadcast;
|
|
187
189
|
}
|
|
188
|
-
async sendBroadcastU(perspectiveUUID, payload) {
|
|
190
|
+
async sendBroadcastU(perspectiveUUID, payload, loopback = false) {
|
|
189
191
|
const { neighbourhoodSendBroadcastU } = unwrapApolloResult(await __classPrivateFieldGet(this, _NeighbourhoodClient_apolloClient, "f").mutate({
|
|
190
192
|
mutation: gql `mutation neighbourhoodSendBroadcastU(
|
|
191
193
|
$perspectiveUUID: String!,
|
|
192
|
-
$payload: PerspectiveUnsignedInput
|
|
194
|
+
$payload: PerspectiveUnsignedInput!,
|
|
195
|
+
$loopback: Boolean
|
|
193
196
|
) {
|
|
194
197
|
neighbourhoodSendBroadcastU(
|
|
195
198
|
perspectiveUUID: $perspectiveUUID,
|
|
196
|
-
payload: $payload
|
|
199
|
+
payload: $payload,
|
|
200
|
+
loopback: $loopback
|
|
197
201
|
)
|
|
198
202
|
}`,
|
|
199
|
-
variables: { perspectiveUUID, payload }
|
|
203
|
+
variables: { perspectiveUUID, payload, loopback }
|
|
200
204
|
}));
|
|
201
205
|
return neighbourhoodSendBroadcastU;
|
|
202
206
|
}
|
|
@@ -12,8 +12,8 @@ export declare class NeighbourhoodProxy {
|
|
|
12
12
|
setOnlineStatusU(status: PerspectiveUnsignedInput): Promise<boolean>;
|
|
13
13
|
sendSignal(remoteAgentDid: string, payload: Perspective): Promise<boolean>;
|
|
14
14
|
sendSignalU(remoteAgentDid: string, payload: PerspectiveUnsignedInput): Promise<boolean>;
|
|
15
|
-
sendBroadcast(payload: Perspective): Promise<boolean>;
|
|
16
|
-
sendBroadcastU(payload: PerspectiveUnsignedInput): Promise<boolean>;
|
|
15
|
+
sendBroadcast(payload: Perspective, loopback?: boolean): Promise<boolean>;
|
|
16
|
+
sendBroadcastU(payload: PerspectiveUnsignedInput, loopback?: boolean): Promise<boolean>;
|
|
17
17
|
addSignalHandler(handler: (payload: PerspectiveExpression) => void): Promise<void>;
|
|
18
18
|
removeSignalHandler(handler: (payload: PerspectiveExpression) => void): void;
|
|
19
19
|
}
|
|
@@ -38,11 +38,11 @@ export class NeighbourhoodProxy {
|
|
|
38
38
|
async sendSignalU(remoteAgentDid, payload) {
|
|
39
39
|
return await __classPrivateFieldGet(this, _NeighbourhoodProxy_client, "f").sendSignalU(__classPrivateFieldGet(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
|
|
40
40
|
}
|
|
41
|
-
async sendBroadcast(payload) {
|
|
42
|
-
return await __classPrivateFieldGet(this, _NeighbourhoodProxy_client, "f").sendBroadcast(__classPrivateFieldGet(this, _NeighbourhoodProxy_pID, "f"), payload);
|
|
41
|
+
async sendBroadcast(payload, loopback = false) {
|
|
42
|
+
return await __classPrivateFieldGet(this, _NeighbourhoodProxy_client, "f").sendBroadcast(__classPrivateFieldGet(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
|
|
43
43
|
}
|
|
44
|
-
async sendBroadcastU(payload) {
|
|
45
|
-
return await __classPrivateFieldGet(this, _NeighbourhoodProxy_client, "f").sendBroadcastU(__classPrivateFieldGet(this, _NeighbourhoodProxy_pID, "f"), payload);
|
|
44
|
+
async sendBroadcastU(payload, loopback = false) {
|
|
45
|
+
return await __classPrivateFieldGet(this, _NeighbourhoodProxy_client, "f").sendBroadcastU(__classPrivateFieldGet(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
|
|
46
46
|
}
|
|
47
47
|
async addSignalHandler(handler) {
|
|
48
48
|
await __classPrivateFieldGet(this, _NeighbourhoodProxy_client, "f").addSignalHandler(__classPrivateFieldGet(this, _NeighbourhoodProxy_pID, "f"), handler);
|
|
@@ -18,7 +18,7 @@ export default class NeighbourhoodResolver {
|
|
|
18
18
|
neighbourhoodSetOnlineStatusU(perspectiveUUID: string, status: PerspectiveUnsignedInput): boolean;
|
|
19
19
|
neighbourhoodSendSignal(perspectiveUUID: string, recipient: DID, signal: PerspectiveInput): boolean;
|
|
20
20
|
neighbourhoodSendSignalU(perspectiveUUID: string, recipient: DID, signal: PerspectiveUnsignedInput): boolean;
|
|
21
|
-
neighbourhoodSendBroadcast(perspectiveUUID: string, signal: PerspectiveInput): boolean;
|
|
22
|
-
neighbourhoodSendBroadcastU(perspectiveUUID: string, signal: PerspectiveUnsignedInput): boolean;
|
|
21
|
+
neighbourhoodSendBroadcast(perspectiveUUID: string, signal: PerspectiveInput, loopback?: boolean): boolean;
|
|
22
|
+
neighbourhoodSendBroadcastU(perspectiveUUID: string, signal: PerspectiveUnsignedInput, loopback?: boolean): boolean;
|
|
23
23
|
neighbourhoodSignal(pID: string): PerspectiveExpression;
|
|
24
24
|
}
|
|
@@ -69,10 +69,10 @@ let NeighbourhoodResolver = class NeighbourhoodResolver {
|
|
|
69
69
|
neighbourhoodSendSignalU(perspectiveUUID, recipient, signal) {
|
|
70
70
|
return true;
|
|
71
71
|
}
|
|
72
|
-
neighbourhoodSendBroadcast(perspectiveUUID, signal) {
|
|
72
|
+
neighbourhoodSendBroadcast(perspectiveUUID, signal, loopback) {
|
|
73
73
|
return true;
|
|
74
74
|
}
|
|
75
|
-
neighbourhoodSendBroadcastU(perspectiveUUID, signal) {
|
|
75
|
+
neighbourhoodSendBroadcastU(perspectiveUUID, signal, loopback) {
|
|
76
76
|
return true;
|
|
77
77
|
}
|
|
78
78
|
neighbourhoodSignal(pID) {
|
|
@@ -155,16 +155,18 @@ __decorate([
|
|
|
155
155
|
Mutation(),
|
|
156
156
|
__param(0, Arg('perspectiveUUID')),
|
|
157
157
|
__param(1, Arg('payload')),
|
|
158
|
+
__param(2, Arg('loopback', { nullable: true })),
|
|
158
159
|
__metadata("design:type", Function),
|
|
159
|
-
__metadata("design:paramtypes", [String, PerspectiveInput]),
|
|
160
|
+
__metadata("design:paramtypes", [String, PerspectiveInput, Boolean]),
|
|
160
161
|
__metadata("design:returntype", Boolean)
|
|
161
162
|
], NeighbourhoodResolver.prototype, "neighbourhoodSendBroadcast", null);
|
|
162
163
|
__decorate([
|
|
163
164
|
Mutation(),
|
|
164
165
|
__param(0, Arg('perspectiveUUID')),
|
|
165
166
|
__param(1, Arg('payload')),
|
|
167
|
+
__param(2, Arg('loopback', { nullable: true })),
|
|
166
168
|
__metadata("design:type", Function),
|
|
167
|
-
__metadata("design:paramtypes", [String, PerspectiveUnsignedInput]),
|
|
169
|
+
__metadata("design:paramtypes", [String, PerspectiveUnsignedInput, Boolean]),
|
|
168
170
|
__metadata("design:returntype", Boolean)
|
|
169
171
|
], NeighbourhoodResolver.prototype, "neighbourhoodSendBroadcastU", null);
|
|
170
172
|
__decorate([
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApolloClient } from "@apollo/client/core";
|
|
2
2
|
import { Perspective, PerspectiveExpression } from "../perspectives/Perspective";
|
|
3
|
-
import { RuntimeInfo, ExceptionInfo, SentMessage, NotificationInput, Notification, TriggeredNotification } from "./RuntimeResolver";
|
|
3
|
+
import { RuntimeInfo, ExceptionInfo, SentMessage, NotificationInput, Notification, TriggeredNotification, ImportResult } from "./RuntimeResolver";
|
|
4
4
|
export type MessageCallback = (message: PerspectiveExpression) => null;
|
|
5
5
|
export type ExceptionCallback = (info: ExceptionInfo) => null;
|
|
6
6
|
export type NotificationTriggeredCallback = (notification: TriggeredNotification) => null;
|
|
@@ -30,9 +30,13 @@ export declare class RuntimeClient {
|
|
|
30
30
|
messageOutbox(filter?: string): Promise<SentMessage[]>;
|
|
31
31
|
requestInstallNotification(notification: NotificationInput): Promise<any>;
|
|
32
32
|
grantNotification(id: string): Promise<boolean>;
|
|
33
|
+
exportDb(filePath: string): Promise<boolean>;
|
|
34
|
+
importDb(filePath: string): Promise<ImportResult>;
|
|
33
35
|
notifications(): Promise<Notification[]>;
|
|
34
36
|
updateNotification(id: string, notification: NotificationInput): Promise<boolean>;
|
|
35
37
|
removeNotification(id: string): Promise<boolean>;
|
|
38
|
+
exportPerspective(uuid: string, filePath: string): Promise<boolean>;
|
|
39
|
+
importPerspective(filePath: string): Promise<boolean>;
|
|
36
40
|
addNotificationTriggeredCallback(cb: NotificationTriggeredCallback): void;
|
|
37
41
|
subscribeNotificationTriggered(): void;
|
|
38
42
|
addMessageCallback(cb: MessageCallback): void;
|
|
@@ -261,6 +261,36 @@ export class RuntimeClient {
|
|
|
261
261
|
}));
|
|
262
262
|
return runtimeGrantNotification;
|
|
263
263
|
}
|
|
264
|
+
async exportDb(filePath) {
|
|
265
|
+
const { runtimeExportDb } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
266
|
+
mutation: gql `mutation runtimeExportDb($filePath: String!) {
|
|
267
|
+
runtimeExportDb(filePath: $filePath)
|
|
268
|
+
}`,
|
|
269
|
+
variables: { filePath }
|
|
270
|
+
}));
|
|
271
|
+
return runtimeExportDb;
|
|
272
|
+
}
|
|
273
|
+
async importDb(filePath) {
|
|
274
|
+
const { runtimeImportDb } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
275
|
+
mutation: gql `mutation runtimeImportDb($filePath: String!) {
|
|
276
|
+
runtimeImportDb(filePath: $filePath) {
|
|
277
|
+
perspectives { total imported failed omitted errors }
|
|
278
|
+
links { total imported failed omitted errors }
|
|
279
|
+
expressions { total imported failed omitted errors }
|
|
280
|
+
perspectiveDiffs { total imported failed omitted errors }
|
|
281
|
+
notifications { total imported failed omitted errors }
|
|
282
|
+
models { total imported failed omitted errors }
|
|
283
|
+
defaultModels { total imported failed omitted errors }
|
|
284
|
+
tasks { total imported failed omitted errors }
|
|
285
|
+
friends { total imported failed omitted errors }
|
|
286
|
+
trustedAgents { total imported failed omitted errors }
|
|
287
|
+
knownLinkLanguages { total imported failed omitted errors }
|
|
288
|
+
}
|
|
289
|
+
}`,
|
|
290
|
+
variables: { filePath }
|
|
291
|
+
}));
|
|
292
|
+
return runtimeImportDb;
|
|
293
|
+
}
|
|
264
294
|
async notifications() {
|
|
265
295
|
const { runtimeNotifications } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
266
296
|
query: gql `query runtimeNotifications {
|
|
@@ -287,6 +317,24 @@ export class RuntimeClient {
|
|
|
287
317
|
}));
|
|
288
318
|
return runtimeRemoveNotification;
|
|
289
319
|
}
|
|
320
|
+
async exportPerspective(uuid, filePath) {
|
|
321
|
+
const { runtimeExportPerspective } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
322
|
+
mutation: gql `mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
|
|
323
|
+
runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
|
|
324
|
+
}`,
|
|
325
|
+
variables: { perspectiveUuid: uuid, filePath }
|
|
326
|
+
}));
|
|
327
|
+
return runtimeExportPerspective;
|
|
328
|
+
}
|
|
329
|
+
async importPerspective(filePath) {
|
|
330
|
+
const { runtimeImportPerspective } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
331
|
+
mutation: gql `mutation runtimeImportPerspective($filePath: String!) {
|
|
332
|
+
runtimeImportPerspective(filePath: $filePath)
|
|
333
|
+
}`,
|
|
334
|
+
variables: { filePath }
|
|
335
|
+
}));
|
|
336
|
+
return runtimeImportPerspective;
|
|
337
|
+
}
|
|
290
338
|
addNotificationTriggeredCallback(cb) {
|
|
291
339
|
__classPrivateFieldGet(this, _RuntimeClient_notificationTriggeredCallbacks, "f").push(cb);
|
|
292
340
|
}
|
|
@@ -42,6 +42,26 @@ export declare class TriggeredNotification {
|
|
|
42
42
|
perspectiveId: string;
|
|
43
43
|
triggerMatch: string;
|
|
44
44
|
}
|
|
45
|
+
export declare class ImportStats {
|
|
46
|
+
total: number;
|
|
47
|
+
imported: number;
|
|
48
|
+
failed: number;
|
|
49
|
+
omitted: number;
|
|
50
|
+
errors: string[];
|
|
51
|
+
}
|
|
52
|
+
export declare class ImportResult {
|
|
53
|
+
perspectives: ImportStats;
|
|
54
|
+
links: ImportStats;
|
|
55
|
+
expressions: ImportStats;
|
|
56
|
+
perspectiveDiffs: ImportStats;
|
|
57
|
+
notifications: ImportStats;
|
|
58
|
+
models: ImportStats;
|
|
59
|
+
defaultModels: ImportStats;
|
|
60
|
+
tasks: ImportStats;
|
|
61
|
+
friends: ImportStats;
|
|
62
|
+
trustedAgents: ImportStats;
|
|
63
|
+
knownLinkLanguages: ImportStats;
|
|
64
|
+
}
|
|
45
65
|
/**
|
|
46
66
|
* Resolver classes are used here to define the GraphQL schema
|
|
47
67
|
* (through the type-graphql annotations)
|
|
@@ -77,4 +97,8 @@ export default class RuntimeResolver {
|
|
|
77
97
|
runtimeRemoveNotification(id: string): boolean;
|
|
78
98
|
runtimeGrantNotification(id: string): boolean;
|
|
79
99
|
runtimeNotificationTriggered(): TriggeredNotification;
|
|
100
|
+
runtimeExportDb(filePath: string): boolean;
|
|
101
|
+
runtimeImportDb(filePath: string): boolean;
|
|
102
|
+
runtimeExportPerspective(perspectiveUuid: string, filePath: string): boolean;
|
|
103
|
+
runtimeImportPerspective(filePath: string): boolean;
|
|
80
104
|
}
|
|
@@ -194,6 +194,82 @@ TriggeredNotification = __decorate([
|
|
|
194
194
|
ObjectType()
|
|
195
195
|
], TriggeredNotification);
|
|
196
196
|
export { TriggeredNotification };
|
|
197
|
+
let ImportStats = class ImportStats {
|
|
198
|
+
};
|
|
199
|
+
__decorate([
|
|
200
|
+
Field(),
|
|
201
|
+
__metadata("design:type", Number)
|
|
202
|
+
], ImportStats.prototype, "total", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
Field(),
|
|
205
|
+
__metadata("design:type", Number)
|
|
206
|
+
], ImportStats.prototype, "imported", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
Field(),
|
|
209
|
+
__metadata("design:type", Number)
|
|
210
|
+
], ImportStats.prototype, "failed", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
Field(),
|
|
213
|
+
__metadata("design:type", Number)
|
|
214
|
+
], ImportStats.prototype, "omitted", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
Field(type => [String]),
|
|
217
|
+
__metadata("design:type", Array)
|
|
218
|
+
], ImportStats.prototype, "errors", void 0);
|
|
219
|
+
ImportStats = __decorate([
|
|
220
|
+
ObjectType()
|
|
221
|
+
], ImportStats);
|
|
222
|
+
export { ImportStats };
|
|
223
|
+
let ImportResult = class ImportResult {
|
|
224
|
+
};
|
|
225
|
+
__decorate([
|
|
226
|
+
Field(),
|
|
227
|
+
__metadata("design:type", ImportStats)
|
|
228
|
+
], ImportResult.prototype, "perspectives", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
Field(),
|
|
231
|
+
__metadata("design:type", ImportStats)
|
|
232
|
+
], ImportResult.prototype, "links", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
Field(),
|
|
235
|
+
__metadata("design:type", ImportStats)
|
|
236
|
+
], ImportResult.prototype, "expressions", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
Field(),
|
|
239
|
+
__metadata("design:type", ImportStats)
|
|
240
|
+
], ImportResult.prototype, "perspectiveDiffs", void 0);
|
|
241
|
+
__decorate([
|
|
242
|
+
Field(),
|
|
243
|
+
__metadata("design:type", ImportStats)
|
|
244
|
+
], ImportResult.prototype, "notifications", void 0);
|
|
245
|
+
__decorate([
|
|
246
|
+
Field(),
|
|
247
|
+
__metadata("design:type", ImportStats)
|
|
248
|
+
], ImportResult.prototype, "models", void 0);
|
|
249
|
+
__decorate([
|
|
250
|
+
Field(),
|
|
251
|
+
__metadata("design:type", ImportStats)
|
|
252
|
+
], ImportResult.prototype, "defaultModels", void 0);
|
|
253
|
+
__decorate([
|
|
254
|
+
Field(),
|
|
255
|
+
__metadata("design:type", ImportStats)
|
|
256
|
+
], ImportResult.prototype, "tasks", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
Field(),
|
|
259
|
+
__metadata("design:type", ImportStats)
|
|
260
|
+
], ImportResult.prototype, "friends", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
Field(),
|
|
263
|
+
__metadata("design:type", ImportStats)
|
|
264
|
+
], ImportResult.prototype, "trustedAgents", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
Field(),
|
|
267
|
+
__metadata("design:type", ImportStats)
|
|
268
|
+
], ImportResult.prototype, "knownLinkLanguages", void 0);
|
|
269
|
+
ImportResult = __decorate([
|
|
270
|
+
ObjectType()
|
|
271
|
+
], ImportResult);
|
|
272
|
+
export { ImportResult };
|
|
197
273
|
/**
|
|
198
274
|
* Resolver classes are used here to define the GraphQL schema
|
|
199
275
|
* (through the type-graphql annotations)
|
|
@@ -322,6 +398,18 @@ let RuntimeResolver = class RuntimeResolver {
|
|
|
322
398
|
}
|
|
323
399
|
};
|
|
324
400
|
}
|
|
401
|
+
runtimeExportDb(filePath) {
|
|
402
|
+
return true;
|
|
403
|
+
}
|
|
404
|
+
runtimeImportDb(filePath) {
|
|
405
|
+
return true;
|
|
406
|
+
}
|
|
407
|
+
runtimeExportPerspective(perspectiveUuid, filePath) {
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
runtimeImportPerspective(filePath) {
|
|
411
|
+
return true;
|
|
412
|
+
}
|
|
325
413
|
};
|
|
326
414
|
__decorate([
|
|
327
415
|
Mutation(returns => Boolean),
|
|
@@ -514,6 +602,35 @@ __decorate([
|
|
|
514
602
|
__metadata("design:paramtypes", []),
|
|
515
603
|
__metadata("design:returntype", TriggeredNotification)
|
|
516
604
|
], RuntimeResolver.prototype, "runtimeNotificationTriggered", null);
|
|
605
|
+
__decorate([
|
|
606
|
+
Mutation(),
|
|
607
|
+
__param(0, Arg("filePath", type => String)),
|
|
608
|
+
__metadata("design:type", Function),
|
|
609
|
+
__metadata("design:paramtypes", [String]),
|
|
610
|
+
__metadata("design:returntype", Boolean)
|
|
611
|
+
], RuntimeResolver.prototype, "runtimeExportDb", null);
|
|
612
|
+
__decorate([
|
|
613
|
+
Mutation(),
|
|
614
|
+
__param(0, Arg("filePath", type => String)),
|
|
615
|
+
__metadata("design:type", Function),
|
|
616
|
+
__metadata("design:paramtypes", [String]),
|
|
617
|
+
__metadata("design:returntype", Boolean)
|
|
618
|
+
], RuntimeResolver.prototype, "runtimeImportDb", null);
|
|
619
|
+
__decorate([
|
|
620
|
+
Mutation(),
|
|
621
|
+
__param(0, Arg("perspectiveUuid", type => String)),
|
|
622
|
+
__param(1, Arg("filePath", type => String)),
|
|
623
|
+
__metadata("design:type", Function),
|
|
624
|
+
__metadata("design:paramtypes", [String, String]),
|
|
625
|
+
__metadata("design:returntype", Boolean)
|
|
626
|
+
], RuntimeResolver.prototype, "runtimeExportPerspective", null);
|
|
627
|
+
__decorate([
|
|
628
|
+
Mutation(),
|
|
629
|
+
__param(0, Arg("filePath", type => String)),
|
|
630
|
+
__metadata("design:type", Function),
|
|
631
|
+
__metadata("design:paramtypes", [String]),
|
|
632
|
+
__metadata("design:returntype", Boolean)
|
|
633
|
+
], RuntimeResolver.prototype, "runtimeImportPerspective", null);
|
|
517
634
|
RuntimeResolver = __decorate([
|
|
518
635
|
Resolver()
|
|
519
636
|
], RuntimeResolver);
|
package/lib/src/schema.gql
CHANGED
|
@@ -330,8 +330,8 @@ type Mutation {
|
|
|
330
330
|
languageWriteSettings(languageAddress: String!, settings: String!): Boolean!
|
|
331
331
|
neighbourhoodJoinFromUrl(url: String!): PerspectiveHandle!
|
|
332
332
|
neighbourhoodPublishFromPerspective(linkLanguage: String!, meta: PerspectiveInput!, perspectiveUUID: String!): String!
|
|
333
|
-
neighbourhoodSendBroadcast(payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
|
|
334
|
-
neighbourhoodSendBroadcastU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
|
|
333
|
+
neighbourhoodSendBroadcast(loopback: Boolean, payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
|
|
334
|
+
neighbourhoodSendBroadcastU(loopback: Boolean, payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
|
|
335
335
|
neighbourhoodSendSignal(payload: PerspectiveInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
|
|
336
336
|
neighbourhoodSendSignalU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
|
|
337
337
|
neighbourhoodSetOnlineStatus(perspectiveUUID: String!, status: PerspectiveInput!): Boolean!
|
|
@@ -353,9 +353,13 @@ type Mutation {
|
|
|
353
353
|
perspectiveUpdateLink(newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
|
|
354
354
|
runtimeAddFriends(dids: [String!]!): [String!]!
|
|
355
355
|
runtimeAddKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
|
|
356
|
+
runtimeExportDb(filePath: String!): Boolean!
|
|
357
|
+
runtimeExportPerspective(filePath: String!, perspectiveUuid: String!): Boolean!
|
|
356
358
|
runtimeFriendSendMessage(did: String!, message: PerspectiveInput!): Boolean!
|
|
357
359
|
runtimeGrantNotification(id: String!): Boolean!
|
|
358
360
|
runtimeHcAddAgentInfos(agentInfos: String!): Boolean!
|
|
361
|
+
runtimeImportDb(filePath: String!): Boolean!
|
|
362
|
+
runtimeImportPerspective(filePath: String!): Boolean!
|
|
359
363
|
runtimeOpenLink(url: String!): Boolean!
|
|
360
364
|
runtimeQuit: Boolean!
|
|
361
365
|
runtimeRemoveFriends(dids: [String!]!): [String!]!
|
package/lib/src/typeDefs.js
CHANGED
|
@@ -326,8 +326,8 @@ type Mutation {
|
|
|
326
326
|
languageWriteSettings(languageAddress: String!, settings: String!): Boolean!
|
|
327
327
|
neighbourhoodJoinFromUrl(url: String!): PerspectiveHandle!
|
|
328
328
|
neighbourhoodPublishFromPerspective(linkLanguage: String!, meta: PerspectiveInput!, perspectiveUUID: String!): String!
|
|
329
|
-
neighbourhoodSendBroadcast(payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
|
|
330
|
-
neighbourhoodSendBroadcastU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
|
|
329
|
+
neighbourhoodSendBroadcast(loopback: Boolean, payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
|
|
330
|
+
neighbourhoodSendBroadcastU(loopback: Boolean, payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
|
|
331
331
|
neighbourhoodSendSignal(payload: PerspectiveInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
|
|
332
332
|
neighbourhoodSendSignalU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
|
|
333
333
|
neighbourhoodSetOnlineStatus(perspectiveUUID: String!, status: PerspectiveInput!): Boolean!
|
|
@@ -349,9 +349,13 @@ type Mutation {
|
|
|
349
349
|
perspectiveUpdateLink(newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
|
|
350
350
|
runtimeAddFriends(dids: [String!]!): [String!]!
|
|
351
351
|
runtimeAddKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
|
|
352
|
+
runtimeExportDb(filePath: String!): Boolean!
|
|
353
|
+
runtimeExportPerspective(filePath: String!, perspectiveUuid: String!): Boolean!
|
|
352
354
|
runtimeFriendSendMessage(did: String!, message: PerspectiveInput!): Boolean!
|
|
353
355
|
runtimeGrantNotification(id: String!): Boolean!
|
|
354
356
|
runtimeHcAddAgentInfos(agentInfos: String!): Boolean!
|
|
357
|
+
runtimeImportDb(filePath: String!): Boolean!
|
|
358
|
+
runtimeImportPerspective(filePath: String!): Boolean!
|
|
355
359
|
runtimeOpenLink(url: String!): Boolean!
|
|
356
360
|
runtimeQuit: Boolean!
|
|
357
361
|
runtimeRemoveFriends(dids: [String!]!): [String!]!
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"types": "lib/src/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
|
+
"private": false,
|
|
8
9
|
"scripts": {
|
|
9
10
|
"build": "patch-package && tsc && pnpm run buildSchema && pnpm run bundle",
|
|
10
11
|
"buildSchema": "node --es-module-specifier-resolution=node lib/src/buildSchema.js",
|
|
@@ -68,5 +69,5 @@
|
|
|
68
69
|
"graphql@15.7.2": "patches/graphql@15.7.2.patch"
|
|
69
70
|
}
|
|
70
71
|
},
|
|
71
|
-
"version": "0.10.1-
|
|
72
|
+
"version": "0.10.1-release-candidate-1"
|
|
72
73
|
}
|
package/src/index.ts
CHANGED
|
@@ -184,35 +184,39 @@ export class NeighbourhoodClient {
|
|
|
184
184
|
return neighbourhoodSendSignalU
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
async sendBroadcast(perspectiveUUID: string, payload: Perspective): Promise<boolean> {
|
|
187
|
+
async sendBroadcast(perspectiveUUID: string, payload: Perspective, loopback: boolean = false): Promise<boolean> {
|
|
188
188
|
const { neighbourhoodSendBroadcast } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
189
189
|
mutation: gql`mutation neighbourhoodSendBroadcast(
|
|
190
190
|
$perspectiveUUID: String!,
|
|
191
|
-
$payload: PerspectiveInput
|
|
191
|
+
$payload: PerspectiveInput!,
|
|
192
|
+
$loopback: Boolean
|
|
192
193
|
) {
|
|
193
194
|
neighbourhoodSendBroadcast(
|
|
194
195
|
perspectiveUUID: $perspectiveUUID,
|
|
195
|
-
payload: $payload
|
|
196
|
+
payload: $payload,
|
|
197
|
+
loopback: $loopback
|
|
196
198
|
)
|
|
197
199
|
}`,
|
|
198
|
-
variables: { perspectiveUUID, payload }
|
|
200
|
+
variables: { perspectiveUUID, payload, loopback }
|
|
199
201
|
}))
|
|
200
202
|
|
|
201
203
|
return neighbourhoodSendBroadcast
|
|
202
204
|
}
|
|
203
205
|
|
|
204
|
-
async sendBroadcastU(perspectiveUUID: string, payload: PerspectiveUnsignedInput): Promise<boolean> {
|
|
206
|
+
async sendBroadcastU(perspectiveUUID: string, payload: PerspectiveUnsignedInput, loopback: boolean = false): Promise<boolean> {
|
|
205
207
|
const { neighbourhoodSendBroadcastU } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
206
208
|
mutation: gql`mutation neighbourhoodSendBroadcastU(
|
|
207
209
|
$perspectiveUUID: String!,
|
|
208
|
-
$payload: PerspectiveUnsignedInput
|
|
210
|
+
$payload: PerspectiveUnsignedInput!,
|
|
211
|
+
$loopback: Boolean
|
|
209
212
|
) {
|
|
210
213
|
neighbourhoodSendBroadcastU(
|
|
211
214
|
perspectiveUUID: $perspectiveUUID,
|
|
212
|
-
payload: $payload
|
|
215
|
+
payload: $payload,
|
|
216
|
+
loopback: $loopback
|
|
213
217
|
)
|
|
214
218
|
}`,
|
|
215
|
-
variables: { perspectiveUUID, payload }
|
|
219
|
+
variables: { perspectiveUUID, payload, loopback }
|
|
216
220
|
}))
|
|
217
221
|
|
|
218
222
|
return neighbourhoodSendBroadcastU
|
|
@@ -40,12 +40,12 @@ export class NeighbourhoodProxy {
|
|
|
40
40
|
return await this.#client.sendSignalU(this.#pID, remoteAgentDid, payload)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
async sendBroadcast(payload: Perspective): Promise<boolean> {
|
|
44
|
-
return await this.#client.sendBroadcast(this.#pID, payload)
|
|
43
|
+
async sendBroadcast(payload: Perspective, loopback: boolean = false): Promise<boolean> {
|
|
44
|
+
return await this.#client.sendBroadcast(this.#pID, payload, loopback)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
async sendBroadcastU(payload: PerspectiveUnsignedInput): Promise<boolean> {
|
|
48
|
-
return await this.#client.sendBroadcastU(this.#pID, payload)
|
|
47
|
+
async sendBroadcastU(payload: PerspectiveUnsignedInput, loopback: boolean = false): Promise<boolean> {
|
|
48
|
+
return await this.#client.sendBroadcastU(this.#pID, payload, loopback)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
async addSignalHandler(handler: (payload: PerspectiveExpression) => void): Promise<void> {
|
|
@@ -84,12 +84,12 @@ export default class NeighbourhoodResolver {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
@Mutation()
|
|
87
|
-
neighbourhoodSendBroadcast(@Arg('perspectiveUUID') perspectiveUUID: string, @Arg('payload') signal: PerspectiveInput): boolean {
|
|
87
|
+
neighbourhoodSendBroadcast(@Arg('perspectiveUUID') perspectiveUUID: string, @Arg('payload') signal: PerspectiveInput, @Arg('loopback', { nullable: true }) loopback?: boolean): boolean {
|
|
88
88
|
return true
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
@Mutation()
|
|
92
|
-
neighbourhoodSendBroadcastU(@Arg('perspectiveUUID') perspectiveUUID: string, @Arg('payload') signal: PerspectiveUnsignedInput): boolean {
|
|
92
|
+
neighbourhoodSendBroadcastU(@Arg('perspectiveUUID') perspectiveUUID: string, @Arg('payload') signal: PerspectiveUnsignedInput, @Arg('loopback', { nullable: true }) loopback?: boolean): boolean {
|
|
93
93
|
return true
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApolloClient, gql } from "@apollo/client/core"
|
|
2
2
|
import { Perspective, PerspectiveExpression } from "../perspectives/Perspective"
|
|
3
3
|
import unwrapApolloResult from "../unwrapApolloResult"
|
|
4
|
-
import { RuntimeInfo, ExceptionInfo, SentMessage, NotificationInput, Notification, TriggeredNotification } from "./RuntimeResolver"
|
|
4
|
+
import { RuntimeInfo, ExceptionInfo, SentMessage, NotificationInput, Notification, TriggeredNotification, ImportResult } from "./RuntimeResolver"
|
|
5
5
|
|
|
6
6
|
const PERSPECTIVE_EXPRESSION_FIELDS = `
|
|
7
7
|
author
|
|
@@ -287,6 +287,38 @@ export class RuntimeClient {
|
|
|
287
287
|
return runtimeGrantNotification
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
async exportDb(filePath: string): Promise<boolean> {
|
|
291
|
+
const { runtimeExportDb } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
292
|
+
mutation: gql`mutation runtimeExportDb($filePath: String!) {
|
|
293
|
+
runtimeExportDb(filePath: $filePath)
|
|
294
|
+
}`,
|
|
295
|
+
variables: { filePath }
|
|
296
|
+
}))
|
|
297
|
+
return runtimeExportDb
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
async importDb(filePath: string): Promise<ImportResult> {
|
|
301
|
+
const { runtimeImportDb } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
302
|
+
mutation: gql`mutation runtimeImportDb($filePath: String!) {
|
|
303
|
+
runtimeImportDb(filePath: $filePath) {
|
|
304
|
+
perspectives { total imported failed omitted errors }
|
|
305
|
+
links { total imported failed omitted errors }
|
|
306
|
+
expressions { total imported failed omitted errors }
|
|
307
|
+
perspectiveDiffs { total imported failed omitted errors }
|
|
308
|
+
notifications { total imported failed omitted errors }
|
|
309
|
+
models { total imported failed omitted errors }
|
|
310
|
+
defaultModels { total imported failed omitted errors }
|
|
311
|
+
tasks { total imported failed omitted errors }
|
|
312
|
+
friends { total imported failed omitted errors }
|
|
313
|
+
trustedAgents { total imported failed omitted errors }
|
|
314
|
+
knownLinkLanguages { total imported failed omitted errors }
|
|
315
|
+
}
|
|
316
|
+
}`,
|
|
317
|
+
variables: { filePath }
|
|
318
|
+
}))
|
|
319
|
+
return runtimeImportDb
|
|
320
|
+
}
|
|
321
|
+
|
|
290
322
|
async notifications(): Promise<Notification[]> {
|
|
291
323
|
const { runtimeNotifications } = unwrapApolloResult(await this.#apolloClient.query({
|
|
292
324
|
query: gql`query runtimeNotifications {
|
|
@@ -316,6 +348,25 @@ export class RuntimeClient {
|
|
|
316
348
|
return runtimeRemoveNotification
|
|
317
349
|
}
|
|
318
350
|
|
|
351
|
+
async exportPerspective(uuid: string, filePath: string): Promise<boolean> {
|
|
352
|
+
const { runtimeExportPerspective } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
353
|
+
mutation: gql`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
|
|
354
|
+
runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
|
|
355
|
+
}`,
|
|
356
|
+
variables: { perspectiveUuid: uuid, filePath }
|
|
357
|
+
}))
|
|
358
|
+
return runtimeExportPerspective
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
async importPerspective(filePath: string): Promise<boolean> {
|
|
362
|
+
const { runtimeImportPerspective } = unwrapApolloResult(await this.#apolloClient.mutate({
|
|
363
|
+
mutation: gql`mutation runtimeImportPerspective($filePath: String!) {
|
|
364
|
+
runtimeImportPerspective(filePath: $filePath)
|
|
365
|
+
}`,
|
|
366
|
+
variables: { filePath }
|
|
367
|
+
}))
|
|
368
|
+
return runtimeImportPerspective
|
|
369
|
+
}
|
|
319
370
|
|
|
320
371
|
addNotificationTriggeredCallback(cb: NotificationTriggeredCallback) {
|
|
321
372
|
this.#notificationTriggeredCallbacks.push(cb)
|