@coasys/ad4m 0.10.0 → 0.10.1-dev-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 +3785 -843
- package/lib/index.js +3777 -839
- package/lib/src/Ad4mClient.js +2 -1
- package/lib/src/Literal.js +4 -1
- package/lib/src/ai/AIClient.d.ts +8 -2
- package/lib/src/ai/AIClient.js +25 -14
- package/lib/src/ai/AIResolver.d.ts +25 -6
- package/lib/src/ai/AIResolver.js +102 -18
- package/lib/src/index.d.ts +4 -3
- package/lib/src/index.js +4 -3
- package/lib/src/model/Ad4mModel.d.ts +730 -0
- package/lib/src/model/Ad4mModel.js +1399 -0
- package/lib/src/{subject → model}/Subject.d.ts +2 -2
- package/lib/src/{subject → model}/Subject.js +18 -18
- package/lib/src/model/decorators.d.ts +502 -0
- package/lib/src/model/decorators.js +683 -0
- package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +2 -2
- package/lib/src/neighbourhood/NeighbourhoodClient.js +13 -10
- package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +2 -2
- package/lib/src/neighbourhood/NeighbourhoodProxy.js +4 -4
- package/lib/src/neighbourhood/NeighbourhoodProxy.test.d.ts +1 -0
- package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +73 -0
- package/lib/src/neighbourhood/NeighbourhoodResolver.d.ts +2 -2
- package/lib/src/neighbourhood/NeighbourhoodResolver.js +6 -4
- package/lib/src/perspectives/PerspectiveClient.d.ts +23 -11
- package/lib/src/perspectives/PerspectiveClient.js +147 -51
- package/lib/src/perspectives/PerspectiveProxy.d.ts +494 -54
- package/lib/src/perspectives/PerspectiveProxy.js +684 -67
- package/lib/src/perspectives/PerspectiveResolver.d.ts +24 -9
- package/lib/src/perspectives/PerspectiveResolver.js +151 -46
- package/lib/src/runtime/RuntimeClient.d.ts +8 -2
- package/lib/src/runtime/RuntimeClient.js +64 -0
- package/lib/src/runtime/RuntimeResolver.d.ts +27 -1
- package/lib/src/runtime/RuntimeResolver.js +138 -0
- package/lib/src/schema.gql +55 -16
- package/lib/src/typeDefs.js +55 -16
- package/package.json +4 -3
- package/src/Ad4mClient.test.ts +51 -19
- package/src/Ad4mClient.ts +3 -1
- package/src/Literal.ts +4 -1
- package/src/ai/AIClient.ts +35 -14
- package/src/ai/AIResolver.ts +78 -16
- package/src/index.ts +4 -3
- package/src/model/Ad4mModel.ts +1651 -0
- package/src/{subject → model}/Subject.ts +16 -16
- package/src/{subject/SDNADecorators.ts → model/decorators.ts} +384 -50
- package/src/neighbourhood/NeighbourhoodClient.ts +13 -10
- package/src/neighbourhood/NeighbourhoodProxy.test.ts +100 -0
- package/src/neighbourhood/NeighbourhoodProxy.ts +4 -4
- package/src/neighbourhood/NeighbourhoodResolver.ts +2 -2
- package/src/perspectives/PerspectiveClient.ts +156 -51
- package/src/perspectives/PerspectiveProxy.ts +766 -82
- package/src/perspectives/PerspectiveResolver.ts +134 -23
- package/src/runtime/RuntimeClient.ts +71 -2
- package/src/runtime/RuntimeResolver.ts +91 -1
- package/lib/src/subject/SDNADecorators.d.ts +0 -188
- package/lib/src/subject/SDNADecorators.js +0 -360
- package/lib/src/subject/SubjectEntity.d.ts +0 -102
- package/lib/src/subject/SubjectEntity.js +0 -267
- package/src/subject/SubjectEntity.ts +0 -315
- package/yarn-error.log +0 -90
- /package/lib/src/{subject → model}/util.d.ts +0 -0
- /package/lib/src/{subject → model}/util.js +0 -0
- /package/src/{subject → model}/util.ts +0 -0
|
@@ -4,6 +4,11 @@ import { Perspective } from "./Perspective";
|
|
|
4
4
|
import { LinkStatus } from "./PerspectiveProxy";
|
|
5
5
|
import { PerspectiveHandle, PerspectiveState } from "./PerspectiveHandle";
|
|
6
6
|
export declare const testLink: LinkExpression;
|
|
7
|
+
export declare const PERSPECTIVE_QUERY_SUBSCRIPTION = "PERSPECTIVE_QUERY_SUBSCRIPTION";
|
|
8
|
+
export declare class QuerySubscription {
|
|
9
|
+
subscriptionId: string;
|
|
10
|
+
result: string;
|
|
11
|
+
}
|
|
7
12
|
/**
|
|
8
13
|
* Resolver classes are used here to define the GraphQL schema
|
|
9
14
|
* (through the type-graphql annotations)
|
|
@@ -16,20 +21,23 @@ export default class PerspectiveResolver {
|
|
|
16
21
|
perspectiveSnapshot(uuid: string): Perspective | null;
|
|
17
22
|
perspectivePublishSnapshot(uuid: string): String | null;
|
|
18
23
|
perspectiveQueryLinks(uuid: string, query: LinkQuery): LinkExpression[];
|
|
19
|
-
perspectiveQueryProlog(uuid: string, query:
|
|
24
|
+
perspectiveQueryProlog(uuid: string, query: string): Promise<string>;
|
|
25
|
+
perspectiveSubscribeQuery(uuid: string, query: string): Promise<QuerySubscription>;
|
|
20
26
|
perspectiveAdd(name: string, pubSub: any): PerspectiveHandle;
|
|
21
27
|
perspectiveUpdate(uuid: string, name: string, pubSub: any): PerspectiveHandle;
|
|
22
28
|
perspectiveRemove(uuid: string, pubSub: any): boolean;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
perspectiveCreateBatch(uuid: string): Promise<string>;
|
|
30
|
+
perspectiveCommitBatch(uuid: string, batchId: string): Promise<LinkExpressionMutations>;
|
|
31
|
+
perspectiveAddLink(uuid: string, link: LinkInput, status: LinkStatus, batchId: string, pubSub: any): LinkExpression;
|
|
32
|
+
perspectiveAddLinks(uuid: string, links: LinkInput[], status: LinkStatus, batchId: string, pubSub: any): LinkExpression[];
|
|
33
|
+
perspectiveRemoveLink(uuid: string, link: LinkExpressionInput, batchId: string, pubSub: any): Boolean;
|
|
34
|
+
perspectiveRemoveLinks(uuid: string, links: LinkExpressionInput[], batchId: string, pubSub: any): LinkExpression[];
|
|
26
35
|
perspectiveLinkMutations(uuid: string, mutations: LinkMutations, status: LinkStatus, pubSub: any): LinkExpressionMutations;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
perspectiveRemoveLink(uuid: string, link: LinkExpressionInput, pubSub: any): Boolean;
|
|
36
|
+
perspectiveUpdateLink(uuid: string, oldLink: LinkExpressionInput, newLink: LinkInput, batchId: string, pubSub: any): LinkExpression;
|
|
37
|
+
perspectiveAddLinkExpression(uuid: string, link: LinkExpressionInput, status: LinkStatus, batchId: string, pubSub: any): LinkExpression;
|
|
30
38
|
perspectiveAddSdna(uuid: string, name: string, sdnaCode: string, sdnaType: string, pubSub: any): Boolean;
|
|
31
|
-
perspectiveExecuteCommands(uuid: string, commands: string, expression: string, parameters: string): Boolean;
|
|
32
|
-
perspectiveCreateSubject(uuid: string, SubjectClass: string, expressionAddress: string): Boolean;
|
|
39
|
+
perspectiveExecuteCommands(uuid: string, commands: string, expression: string, parameters: string, batchId?: string): Boolean;
|
|
40
|
+
perspectiveCreateSubject(uuid: string, SubjectClass: string, expressionAddress: string, initialValues?: string, batchId?: string): Boolean;
|
|
33
41
|
perspectiveGetSubjectData(uuid: string, SubjectClass: string, expressionAddress: string): String;
|
|
34
42
|
perspectiveAdded(): PerspectiveHandle;
|
|
35
43
|
perspectiveUpdated(): PerspectiveHandle;
|
|
@@ -38,4 +46,11 @@ export default class PerspectiveResolver {
|
|
|
38
46
|
perspectiveLinkRemoved(uuid: string): LinkExpression;
|
|
39
47
|
perspectiveLinkUpdated(uuid: string): LinkExpressionUpdated;
|
|
40
48
|
perspectiveSyncStateChange(uuid: string): PerspectiveState;
|
|
49
|
+
perspectiveKeepAliveQuery(uuid: string, subscriptionId: string): boolean;
|
|
50
|
+
perspectiveQuerySubscription(subscriptionId: string, payload: {
|
|
51
|
+
subscriptionId: string;
|
|
52
|
+
uuid: string;
|
|
53
|
+
result: string;
|
|
54
|
+
}): string;
|
|
55
|
+
perspectiveDisposeQuerySubscription(uuid: string, subscriptionId: string): Promise<boolean>;
|
|
41
56
|
}
|
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
|
-
import { Arg, Mutation, PubSub, Query, Resolver, Subscription } from "type-graphql";
|
|
13
|
+
import { Arg, Mutation, PubSub, Query, Resolver, Root, Subscription, ObjectType, Field } from "type-graphql";
|
|
14
14
|
import { LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkExpressionUpdated, LinkInput, LinkMutations } from "../links/Links";
|
|
15
15
|
import { Neighbourhood, NeighbourhoodExpression } from "../neighbourhood/Neighbourhood";
|
|
16
16
|
import { LinkQuery } from "./LinkQuery";
|
|
@@ -29,6 +29,21 @@ testLink.proof = {
|
|
|
29
29
|
key: '',
|
|
30
30
|
valid: true
|
|
31
31
|
};
|
|
32
|
+
export const PERSPECTIVE_QUERY_SUBSCRIPTION = "PERSPECTIVE_QUERY_SUBSCRIPTION";
|
|
33
|
+
let QuerySubscription = class QuerySubscription {
|
|
34
|
+
};
|
|
35
|
+
__decorate([
|
|
36
|
+
Field(),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], QuerySubscription.prototype, "subscriptionId", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
Field(),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], QuerySubscription.prototype, "result", void 0);
|
|
43
|
+
QuerySubscription = __decorate([
|
|
44
|
+
ObjectType()
|
|
45
|
+
], QuerySubscription);
|
|
46
|
+
export { QuerySubscription };
|
|
32
47
|
/**
|
|
33
48
|
* Resolver classes are used here to define the GraphQL schema
|
|
34
49
|
* (through the type-graphql annotations)
|
|
@@ -69,9 +84,16 @@ let PerspectiveResolver = class PerspectiveResolver {
|
|
|
69
84
|
perspectiveQueryLinks(uuid, query) {
|
|
70
85
|
return [testLink];
|
|
71
86
|
}
|
|
72
|
-
perspectiveQueryProlog(uuid, query) {
|
|
87
|
+
async perspectiveQueryProlog(uuid, query) {
|
|
73
88
|
return `[{"X": 1}]`;
|
|
74
89
|
}
|
|
90
|
+
async perspectiveSubscribeQuery(uuid, query) {
|
|
91
|
+
const result = `[{"X": 1}]`;
|
|
92
|
+
return {
|
|
93
|
+
subscriptionId: "test-subscription-id",
|
|
94
|
+
result: result
|
|
95
|
+
};
|
|
96
|
+
}
|
|
75
97
|
perspectiveAdd(name, pubSub) {
|
|
76
98
|
const perspective = new PerspectiveHandle('00006', name);
|
|
77
99
|
pubSub.publish(PERSPECTIVE_ADDED_TOPIC, { perspective });
|
|
@@ -87,7 +109,14 @@ let PerspectiveResolver = class PerspectiveResolver {
|
|
|
87
109
|
pubSub.publish(PERSPECTIVE_REMOVED_TOPIC, { perspective });
|
|
88
110
|
return true;
|
|
89
111
|
}
|
|
90
|
-
|
|
112
|
+
async perspectiveCreateBatch(uuid) {
|
|
113
|
+
const perspective = new PerspectiveHandle(uuid);
|
|
114
|
+
return uuid + '-batch-' + Date.now();
|
|
115
|
+
}
|
|
116
|
+
async perspectiveCommitBatch(uuid, batchId) {
|
|
117
|
+
return new LinkExpressionMutations([], []);
|
|
118
|
+
}
|
|
119
|
+
perspectiveAddLink(uuid, link, status, batchId, pubSub) {
|
|
91
120
|
const l = new LinkExpression();
|
|
92
121
|
l.author = 'did:ad4m:test';
|
|
93
122
|
l.timestamp = Date.now();
|
|
@@ -98,22 +127,33 @@ let PerspectiveResolver = class PerspectiveResolver {
|
|
|
98
127
|
pubSub.publish(PERSPECTIVE_SYNC_STATE_CHANGE, PerspectiveState.LinkLanguageInstalledButNotSynced);
|
|
99
128
|
return l;
|
|
100
129
|
}
|
|
101
|
-
perspectiveAddLinks(uuid, links, status, pubSub) {
|
|
130
|
+
perspectiveAddLinks(uuid, links, status, batchId, pubSub) {
|
|
102
131
|
const l = new LinkExpression();
|
|
103
132
|
l.author = 'did:ad4m:test';
|
|
104
133
|
l.timestamp = Date.now();
|
|
105
134
|
l.proof = testLink.proof;
|
|
106
135
|
l.data = links[0];
|
|
136
|
+
l.status = status;
|
|
107
137
|
const l2 = new LinkExpression();
|
|
108
138
|
l2.author = 'did:ad4m:test';
|
|
109
139
|
l2.timestamp = Date.now();
|
|
110
140
|
l2.proof = testLink.proof;
|
|
111
141
|
l2.data = links[0];
|
|
142
|
+
l2.status = status;
|
|
112
143
|
pubSub.publish(LINK_ADDED_TOPIC, { link: l });
|
|
113
144
|
pubSub.publish(LINK_ADDED_TOPIC, { link: l2 });
|
|
114
145
|
return [l, l2];
|
|
115
146
|
}
|
|
116
|
-
|
|
147
|
+
perspectiveRemoveLink(uuid, link, batchId, pubSub) {
|
|
148
|
+
const l = new LinkExpression();
|
|
149
|
+
l.author = 'did:ad4m:test';
|
|
150
|
+
l.timestamp = Date.now();
|
|
151
|
+
l.proof = testLink.proof;
|
|
152
|
+
l.data = link.data;
|
|
153
|
+
pubSub.publish(LINK_REMOVED_TOPIC, { link: l });
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
perspectiveRemoveLinks(uuid, links, batchId, pubSub) {
|
|
117
157
|
const l = new LinkExpression();
|
|
118
158
|
l.author = 'did:ad4m:test';
|
|
119
159
|
l.timestamp = Date.now();
|
|
@@ -129,35 +169,31 @@ let PerspectiveResolver = class PerspectiveResolver {
|
|
|
129
169
|
return [l, l2];
|
|
130
170
|
}
|
|
131
171
|
perspectiveLinkMutations(uuid, mutations, status, pubSub) {
|
|
132
|
-
const perspectiveAddLinks = this.perspectiveAddLinks(uuid, mutations.additions, status, pubSub);
|
|
133
|
-
const perspectiveRemoveLinks = this.perspectiveRemoveLinks(uuid, mutations.removals, pubSub);
|
|
172
|
+
const perspectiveAddLinks = this.perspectiveAddLinks(uuid, mutations.additions, status, null, pubSub);
|
|
173
|
+
const perspectiveRemoveLinks = this.perspectiveRemoveLinks(uuid, mutations.removals, null, pubSub);
|
|
134
174
|
return new LinkExpressionMutations(perspectiveAddLinks, perspectiveRemoveLinks);
|
|
135
175
|
}
|
|
136
|
-
|
|
137
|
-
pubSub.publish(LINK_ADDED_TOPIC, { link });
|
|
138
|
-
link.status = status;
|
|
139
|
-
return link;
|
|
140
|
-
}
|
|
141
|
-
perspectiveUpdateLink(uuid, oldlink, newlink, pubSub) {
|
|
176
|
+
perspectiveUpdateLink(uuid, oldLink, newLink, batchId, pubSub) {
|
|
142
177
|
const l = new LinkExpression();
|
|
143
178
|
l.author = 'did:ad4m:test';
|
|
144
179
|
l.timestamp = Date.now();
|
|
145
180
|
l.proof = testLink.proof;
|
|
146
|
-
l.data =
|
|
181
|
+
l.data = newLink;
|
|
147
182
|
pubSub.publish(LINK_REMOVED_TOPIC, { link: l });
|
|
148
183
|
return l;
|
|
149
184
|
}
|
|
150
|
-
|
|
151
|
-
pubSub.publish(
|
|
152
|
-
|
|
185
|
+
perspectiveAddLinkExpression(uuid, link, status, batchId, pubSub) {
|
|
186
|
+
pubSub.publish(LINK_ADDED_TOPIC, { link });
|
|
187
|
+
link.status = status;
|
|
188
|
+
return link;
|
|
153
189
|
}
|
|
154
190
|
perspectiveAddSdna(uuid, name, sdnaCode, sdnaType, pubSub) {
|
|
155
191
|
return true;
|
|
156
192
|
}
|
|
157
|
-
perspectiveExecuteCommands(uuid, commands, expression, parameters) {
|
|
193
|
+
perspectiveExecuteCommands(uuid, commands, expression, parameters, batchId) {
|
|
158
194
|
return true;
|
|
159
195
|
}
|
|
160
|
-
perspectiveCreateSubject(uuid, SubjectClass, expressionAddress) {
|
|
196
|
+
perspectiveCreateSubject(uuid, SubjectClass, expressionAddress, initialValues, batchId) {
|
|
161
197
|
return true;
|
|
162
198
|
}
|
|
163
199
|
perspectiveGetSubjectData(uuid, SubjectClass, expressionAddress) {
|
|
@@ -185,6 +221,15 @@ let PerspectiveResolver = class PerspectiveResolver {
|
|
|
185
221
|
perspectiveSyncStateChange(uuid) {
|
|
186
222
|
return PerspectiveState.Synced;
|
|
187
223
|
}
|
|
224
|
+
perspectiveKeepAliveQuery(uuid, subscriptionId) {
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
perspectiveQuerySubscription(subscriptionId, payload) {
|
|
228
|
+
return payload.result;
|
|
229
|
+
}
|
|
230
|
+
async perspectiveDisposeQuerySubscription(uuid, subscriptionId) {
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
188
233
|
};
|
|
189
234
|
__decorate([
|
|
190
235
|
Query(returns => [PerspectiveHandle]),
|
|
@@ -227,8 +272,16 @@ __decorate([
|
|
|
227
272
|
__param(1, Arg('query')),
|
|
228
273
|
__metadata("design:type", Function),
|
|
229
274
|
__metadata("design:paramtypes", [String, String]),
|
|
230
|
-
__metadata("design:returntype",
|
|
275
|
+
__metadata("design:returntype", Promise)
|
|
231
276
|
], PerspectiveResolver.prototype, "perspectiveQueryProlog", null);
|
|
277
|
+
__decorate([
|
|
278
|
+
Mutation(returns => QuerySubscription),
|
|
279
|
+
__param(0, Arg('uuid')),
|
|
280
|
+
__param(1, Arg('query')),
|
|
281
|
+
__metadata("design:type", Function),
|
|
282
|
+
__metadata("design:paramtypes", [String, String]),
|
|
283
|
+
__metadata("design:returntype", Promise)
|
|
284
|
+
], PerspectiveResolver.prototype, "perspectiveSubscribeQuery", null);
|
|
232
285
|
__decorate([
|
|
233
286
|
Mutation(returns => PerspectiveHandle),
|
|
234
287
|
__param(0, Arg('name')),
|
|
@@ -254,33 +307,61 @@ __decorate([
|
|
|
254
307
|
__metadata("design:paramtypes", [String, Object]),
|
|
255
308
|
__metadata("design:returntype", Boolean)
|
|
256
309
|
], PerspectiveResolver.prototype, "perspectiveRemove", null);
|
|
310
|
+
__decorate([
|
|
311
|
+
Mutation(returns => String),
|
|
312
|
+
__param(0, Arg('uuid')),
|
|
313
|
+
__metadata("design:type", Function),
|
|
314
|
+
__metadata("design:paramtypes", [String]),
|
|
315
|
+
__metadata("design:returntype", Promise)
|
|
316
|
+
], PerspectiveResolver.prototype, "perspectiveCreateBatch", null);
|
|
317
|
+
__decorate([
|
|
318
|
+
Mutation(returns => LinkExpressionMutations),
|
|
319
|
+
__param(0, Arg('uuid')),
|
|
320
|
+
__param(1, Arg('batchId')),
|
|
321
|
+
__metadata("design:type", Function),
|
|
322
|
+
__metadata("design:paramtypes", [String, String]),
|
|
323
|
+
__metadata("design:returntype", Promise)
|
|
324
|
+
], PerspectiveResolver.prototype, "perspectiveCommitBatch", null);
|
|
257
325
|
__decorate([
|
|
258
326
|
Mutation(returns => LinkExpression),
|
|
259
327
|
__param(0, Arg('uuid')),
|
|
260
328
|
__param(1, Arg('link')),
|
|
261
329
|
__param(2, Arg('status', { nullable: true, defaultValue: 'shared' })),
|
|
262
|
-
__param(3,
|
|
330
|
+
__param(3, Arg('batchId', { nullable: true })),
|
|
331
|
+
__param(4, PubSub()),
|
|
263
332
|
__metadata("design:type", Function),
|
|
264
|
-
__metadata("design:paramtypes", [String, LinkInput, String, Object]),
|
|
333
|
+
__metadata("design:paramtypes", [String, LinkInput, String, String, Object]),
|
|
265
334
|
__metadata("design:returntype", LinkExpression)
|
|
266
335
|
], PerspectiveResolver.prototype, "perspectiveAddLink", null);
|
|
267
336
|
__decorate([
|
|
268
337
|
Mutation(returns => [LinkExpression]),
|
|
269
338
|
__param(0, Arg('uuid')),
|
|
270
339
|
__param(1, Arg('links', type => [LinkInput])),
|
|
271
|
-
__param(2, Arg('status', { nullable: true })),
|
|
272
|
-
__param(3,
|
|
340
|
+
__param(2, Arg('status', { nullable: true, defaultValue: 'shared' })),
|
|
341
|
+
__param(3, Arg('batchId', { nullable: true })),
|
|
342
|
+
__param(4, PubSub()),
|
|
273
343
|
__metadata("design:type", Function),
|
|
274
|
-
__metadata("design:paramtypes", [String, Array, String, Object]),
|
|
344
|
+
__metadata("design:paramtypes", [String, Array, String, String, Object]),
|
|
275
345
|
__metadata("design:returntype", Array)
|
|
276
346
|
], PerspectiveResolver.prototype, "perspectiveAddLinks", null);
|
|
347
|
+
__decorate([
|
|
348
|
+
Mutation(returns => Boolean),
|
|
349
|
+
__param(0, Arg('uuid')),
|
|
350
|
+
__param(1, Arg('link')),
|
|
351
|
+
__param(2, Arg('batchId', { nullable: true })),
|
|
352
|
+
__param(3, PubSub()),
|
|
353
|
+
__metadata("design:type", Function),
|
|
354
|
+
__metadata("design:paramtypes", [String, LinkExpressionInput, String, Object]),
|
|
355
|
+
__metadata("design:returntype", Boolean)
|
|
356
|
+
], PerspectiveResolver.prototype, "perspectiveRemoveLink", null);
|
|
277
357
|
__decorate([
|
|
278
358
|
Mutation(returns => [LinkExpression]),
|
|
279
359
|
__param(0, Arg('uuid')),
|
|
280
360
|
__param(1, Arg('links', type => [LinkExpressionInput])),
|
|
281
|
-
__param(2,
|
|
361
|
+
__param(2, Arg('batchId', { nullable: true })),
|
|
362
|
+
__param(3, PubSub()),
|
|
282
363
|
__metadata("design:type", Function),
|
|
283
|
-
__metadata("design:paramtypes", [String, Array, Object]),
|
|
364
|
+
__metadata("design:paramtypes", [String, Array, String, Object]),
|
|
284
365
|
__metadata("design:returntype", Array)
|
|
285
366
|
], PerspectiveResolver.prototype, "perspectiveRemoveLinks", null);
|
|
286
367
|
__decorate([
|
|
@@ -293,35 +374,29 @@ __decorate([
|
|
|
293
374
|
__metadata("design:paramtypes", [String, LinkMutations, String, Object]),
|
|
294
375
|
__metadata("design:returntype", LinkExpressionMutations)
|
|
295
376
|
], PerspectiveResolver.prototype, "perspectiveLinkMutations", null);
|
|
296
|
-
__decorate([
|
|
297
|
-
Mutation(returns => LinkExpression),
|
|
298
|
-
__param(0, Arg('uuid')),
|
|
299
|
-
__param(1, Arg('link')),
|
|
300
|
-
__param(2, Arg('status', { nullable: true })),
|
|
301
|
-
__param(3, PubSub()),
|
|
302
|
-
__metadata("design:type", Function),
|
|
303
|
-
__metadata("design:paramtypes", [String, LinkExpressionInput, String, Object]),
|
|
304
|
-
__metadata("design:returntype", LinkExpression)
|
|
305
|
-
], PerspectiveResolver.prototype, "perspectiveAddLinkExpression", null);
|
|
306
377
|
__decorate([
|
|
307
378
|
Mutation(returns => LinkExpression),
|
|
308
379
|
__param(0, Arg('uuid')),
|
|
309
380
|
__param(1, Arg('oldLink')),
|
|
310
381
|
__param(2, Arg('newLink')),
|
|
311
|
-
__param(3,
|
|
382
|
+
__param(3, Arg('batchId', { nullable: true })),
|
|
383
|
+
__param(4, PubSub()),
|
|
312
384
|
__metadata("design:type", Function),
|
|
313
|
-
__metadata("design:paramtypes", [String, LinkExpressionInput,
|
|
385
|
+
__metadata("design:paramtypes", [String, LinkExpressionInput,
|
|
386
|
+
LinkInput, String, Object]),
|
|
314
387
|
__metadata("design:returntype", LinkExpression)
|
|
315
388
|
], PerspectiveResolver.prototype, "perspectiveUpdateLink", null);
|
|
316
389
|
__decorate([
|
|
317
|
-
Mutation(returns =>
|
|
390
|
+
Mutation(returns => LinkExpression),
|
|
318
391
|
__param(0, Arg('uuid')),
|
|
319
392
|
__param(1, Arg('link')),
|
|
320
|
-
__param(2,
|
|
393
|
+
__param(2, Arg('status', { nullable: true, defaultValue: 'shared' })),
|
|
394
|
+
__param(3, Arg('batchId', { nullable: true })),
|
|
395
|
+
__param(4, PubSub()),
|
|
321
396
|
__metadata("design:type", Function),
|
|
322
|
-
__metadata("design:paramtypes", [String, LinkExpressionInput, Object]),
|
|
323
|
-
__metadata("design:returntype",
|
|
324
|
-
], PerspectiveResolver.prototype, "
|
|
397
|
+
__metadata("design:paramtypes", [String, LinkExpressionInput, String, String, Object]),
|
|
398
|
+
__metadata("design:returntype", LinkExpression)
|
|
399
|
+
], PerspectiveResolver.prototype, "perspectiveAddLinkExpression", null);
|
|
325
400
|
__decorate([
|
|
326
401
|
Mutation(returns => Boolean),
|
|
327
402
|
__param(0, Arg('uuid')),
|
|
@@ -339,8 +414,9 @@ __decorate([
|
|
|
339
414
|
__param(1, Arg('commands')),
|
|
340
415
|
__param(2, Arg('expression')),
|
|
341
416
|
__param(3, Arg('parameters', type => String, { nullable: true })),
|
|
417
|
+
__param(4, Arg('batchId', { nullable: true })),
|
|
342
418
|
__metadata("design:type", Function),
|
|
343
|
-
__metadata("design:paramtypes", [String, String, String, String]),
|
|
419
|
+
__metadata("design:paramtypes", [String, String, String, String, String]),
|
|
344
420
|
__metadata("design:returntype", Boolean)
|
|
345
421
|
], PerspectiveResolver.prototype, "perspectiveExecuteCommands", null);
|
|
346
422
|
__decorate([
|
|
@@ -348,8 +424,10 @@ __decorate([
|
|
|
348
424
|
__param(0, Arg('uuid')),
|
|
349
425
|
__param(1, Arg('subjectClass')),
|
|
350
426
|
__param(2, Arg('expressionAddress')),
|
|
427
|
+
__param(3, Arg('initialValues', { nullable: true })),
|
|
428
|
+
__param(4, Arg('batchId', { nullable: true })),
|
|
351
429
|
__metadata("design:type", Function),
|
|
352
|
-
__metadata("design:paramtypes", [String, String, String]),
|
|
430
|
+
__metadata("design:paramtypes", [String, String, String, String, String]),
|
|
353
431
|
__metadata("design:returntype", Boolean)
|
|
354
432
|
], PerspectiveResolver.prototype, "perspectiveCreateSubject", null);
|
|
355
433
|
__decorate([
|
|
@@ -407,6 +485,33 @@ __decorate([
|
|
|
407
485
|
__metadata("design:paramtypes", [String]),
|
|
408
486
|
__metadata("design:returntype", String)
|
|
409
487
|
], PerspectiveResolver.prototype, "perspectiveSyncStateChange", null);
|
|
488
|
+
__decorate([
|
|
489
|
+
Mutation(returns => Boolean),
|
|
490
|
+
__param(0, Arg('uuid')),
|
|
491
|
+
__param(1, Arg('subscriptionId')),
|
|
492
|
+
__metadata("design:type", Function),
|
|
493
|
+
__metadata("design:paramtypes", [String, String]),
|
|
494
|
+
__metadata("design:returntype", Boolean)
|
|
495
|
+
], PerspectiveResolver.prototype, "perspectiveKeepAliveQuery", null);
|
|
496
|
+
__decorate([
|
|
497
|
+
Subscription({
|
|
498
|
+
topics: PERSPECTIVE_QUERY_SUBSCRIPTION,
|
|
499
|
+
filter: ({ payload, args }) => payload.subscriptionId === args.subscriptionId
|
|
500
|
+
}),
|
|
501
|
+
__param(0, Arg('subscriptionId')),
|
|
502
|
+
__param(1, Root()),
|
|
503
|
+
__metadata("design:type", Function),
|
|
504
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
505
|
+
__metadata("design:returntype", String)
|
|
506
|
+
], PerspectiveResolver.prototype, "perspectiveQuerySubscription", null);
|
|
507
|
+
__decorate([
|
|
508
|
+
Mutation(returns => Boolean),
|
|
509
|
+
__param(0, Arg('uuid')),
|
|
510
|
+
__param(1, Arg('subscriptionId')),
|
|
511
|
+
__metadata("design:type", Function),
|
|
512
|
+
__metadata("design:paramtypes", [String, String]),
|
|
513
|
+
__metadata("design:returntype", Promise)
|
|
514
|
+
], PerspectiveResolver.prototype, "perspectiveDisposeQuerySubscription", null);
|
|
410
515
|
PerspectiveResolver = __decorate([
|
|
411
516
|
Resolver()
|
|
412
517
|
], PerspectiveResolver);
|
|
@@ -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;
|
|
@@ -20,7 +20,9 @@ export declare class RuntimeClient {
|
|
|
20
20
|
addFriends(dids: string[]): Promise<string[]>;
|
|
21
21
|
removeFriends(dids: string[]): Promise<string[]>;
|
|
22
22
|
friends(): Promise<string[]>;
|
|
23
|
-
hcAgentInfos(): Promise<
|
|
23
|
+
hcAgentInfos(): Promise<string>;
|
|
24
|
+
getNetworkMetrics(): Promise<string>;
|
|
25
|
+
restartHolochain(): Promise<boolean>;
|
|
24
26
|
hcAddAgentInfos(agentInfos: String): Promise<void>;
|
|
25
27
|
verifyStringSignedByDid(did: string, didSigningKeyId: string, data: string, signedData: string): Promise<boolean>;
|
|
26
28
|
setStatus(perspective: Perspective): Promise<boolean>;
|
|
@@ -30,9 +32,13 @@ export declare class RuntimeClient {
|
|
|
30
32
|
messageOutbox(filter?: string): Promise<SentMessage[]>;
|
|
31
33
|
requestInstallNotification(notification: NotificationInput): Promise<any>;
|
|
32
34
|
grantNotification(id: string): Promise<boolean>;
|
|
35
|
+
exportDb(filePath: string): Promise<boolean>;
|
|
36
|
+
importDb(filePath: string): Promise<ImportResult>;
|
|
33
37
|
notifications(): Promise<Notification[]>;
|
|
34
38
|
updateNotification(id: string, notification: NotificationInput): Promise<boolean>;
|
|
35
39
|
removeNotification(id: string): Promise<boolean>;
|
|
40
|
+
exportPerspective(uuid: string, filePath: string): Promise<boolean>;
|
|
41
|
+
importPerspective(filePath: string): Promise<boolean>;
|
|
36
42
|
addNotificationTriggeredCallback(cb: NotificationTriggeredCallback): void;
|
|
37
43
|
subscribeNotificationTriggered(): void;
|
|
38
44
|
addMessageCallback(cb: MessageCallback): void;
|
|
@@ -175,6 +175,22 @@ export class RuntimeClient {
|
|
|
175
175
|
}));
|
|
176
176
|
return runtimeHcAgentInfos;
|
|
177
177
|
}
|
|
178
|
+
async getNetworkMetrics() {
|
|
179
|
+
const { runtimeGetNetworkMetrics } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
180
|
+
query: gql `query runtimeGetNetworkMetrics {
|
|
181
|
+
runtimeGetNetworkMetrics
|
|
182
|
+
}`,
|
|
183
|
+
}));
|
|
184
|
+
return runtimeGetNetworkMetrics;
|
|
185
|
+
}
|
|
186
|
+
async restartHolochain() {
|
|
187
|
+
const { runtimeRestartHolochain } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
188
|
+
mutation: gql `mutation runtimeRestartHolochain {
|
|
189
|
+
runtimeRestartHolochain
|
|
190
|
+
}`,
|
|
191
|
+
}));
|
|
192
|
+
return runtimeRestartHolochain;
|
|
193
|
+
}
|
|
178
194
|
async hcAddAgentInfos(agentInfos) {
|
|
179
195
|
const { runtimeHcAddAgentInfos } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
180
196
|
mutation: gql `mutation runtimeHcAddAgentInfos($agentInfos: String!) {
|
|
@@ -261,6 +277,36 @@ export class RuntimeClient {
|
|
|
261
277
|
}));
|
|
262
278
|
return runtimeGrantNotification;
|
|
263
279
|
}
|
|
280
|
+
async exportDb(filePath) {
|
|
281
|
+
const { runtimeExportDb } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
282
|
+
mutation: gql `mutation runtimeExportDb($filePath: String!) {
|
|
283
|
+
runtimeExportDb(filePath: $filePath)
|
|
284
|
+
}`,
|
|
285
|
+
variables: { filePath }
|
|
286
|
+
}));
|
|
287
|
+
return runtimeExportDb;
|
|
288
|
+
}
|
|
289
|
+
async importDb(filePath) {
|
|
290
|
+
const { runtimeImportDb } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
291
|
+
mutation: gql `mutation runtimeImportDb($filePath: String!) {
|
|
292
|
+
runtimeImportDb(filePath: $filePath) {
|
|
293
|
+
perspectives { total imported failed omitted errors }
|
|
294
|
+
links { total imported failed omitted errors }
|
|
295
|
+
expressions { total imported failed omitted errors }
|
|
296
|
+
perspectiveDiffs { total imported failed omitted errors }
|
|
297
|
+
notifications { total imported failed omitted errors }
|
|
298
|
+
models { total imported failed omitted errors }
|
|
299
|
+
defaultModels { total imported failed omitted errors }
|
|
300
|
+
tasks { total imported failed omitted errors }
|
|
301
|
+
friends { total imported failed omitted errors }
|
|
302
|
+
trustedAgents { total imported failed omitted errors }
|
|
303
|
+
knownLinkLanguages { total imported failed omitted errors }
|
|
304
|
+
}
|
|
305
|
+
}`,
|
|
306
|
+
variables: { filePath }
|
|
307
|
+
}));
|
|
308
|
+
return runtimeImportDb;
|
|
309
|
+
}
|
|
264
310
|
async notifications() {
|
|
265
311
|
const { runtimeNotifications } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").query({
|
|
266
312
|
query: gql `query runtimeNotifications {
|
|
@@ -287,6 +333,24 @@ export class RuntimeClient {
|
|
|
287
333
|
}));
|
|
288
334
|
return runtimeRemoveNotification;
|
|
289
335
|
}
|
|
336
|
+
async exportPerspective(uuid, filePath) {
|
|
337
|
+
const { runtimeExportPerspective } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
338
|
+
mutation: gql `mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
|
|
339
|
+
runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
|
|
340
|
+
}`,
|
|
341
|
+
variables: { perspectiveUuid: uuid, filePath }
|
|
342
|
+
}));
|
|
343
|
+
return runtimeExportPerspective;
|
|
344
|
+
}
|
|
345
|
+
async importPerspective(filePath) {
|
|
346
|
+
const { runtimeImportPerspective } = unwrapApolloResult(await __classPrivateFieldGet(this, _RuntimeClient_apolloClient, "f").mutate({
|
|
347
|
+
mutation: gql `mutation runtimeImportPerspective($filePath: String!) {
|
|
348
|
+
runtimeImportPerspective(filePath: $filePath)
|
|
349
|
+
}`,
|
|
350
|
+
variables: { filePath }
|
|
351
|
+
}));
|
|
352
|
+
return runtimeImportPerspective;
|
|
353
|
+
}
|
|
290
354
|
addNotificationTriggeredCallback(cb) {
|
|
291
355
|
__classPrivateFieldGet(this, _RuntimeClient_notificationTriggeredCallbacks, "f").push(cb);
|
|
292
356
|
}
|
|
@@ -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)
|
|
@@ -61,7 +81,9 @@ export default class RuntimeResolver {
|
|
|
61
81
|
runtimeFriends(): string[];
|
|
62
82
|
runtimeAddFriends(dids: string[]): string[];
|
|
63
83
|
runtimeRemoveFriends(dids: string[]): string[];
|
|
64
|
-
runtimeHcAgentInfos():
|
|
84
|
+
runtimeHcAgentInfos(): string;
|
|
85
|
+
runtimeGetNetworkMetrics(): string;
|
|
86
|
+
runtimeRestartHolochain(): boolean;
|
|
65
87
|
runtimeHcAddAgentInfos(agentInfos: any): boolean;
|
|
66
88
|
runtimeVerifyStringSignedByDid(did: string, didSigningKeyId: string, data: string, signedData: string): boolean;
|
|
67
89
|
runtimeSetStatus(status: Perspective): boolean;
|
|
@@ -77,4 +99,8 @@ export default class RuntimeResolver {
|
|
|
77
99
|
runtimeRemoveNotification(id: string): boolean;
|
|
78
100
|
runtimeGrantNotification(id: string): boolean;
|
|
79
101
|
runtimeNotificationTriggered(): TriggeredNotification;
|
|
102
|
+
runtimeExportDb(filePath: string): boolean;
|
|
103
|
+
runtimeImportDb(filePath: string): boolean;
|
|
104
|
+
runtimeExportPerspective(perspectiveUuid: string, filePath: string): boolean;
|
|
105
|
+
runtimeImportPerspective(filePath: string): boolean;
|
|
80
106
|
}
|