@coasys/ad4m 0.8.0-fix → 0.8.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/README.md +229 -229
- package/jest.config.js +5 -5
- package/jsdoc.json +27 -27
- package/lib/index.cjs +4522 -4571
- package/lib/index.js +4522 -4571
- package/lib/shims/type-graphql.d.ts +32 -32
- package/lib/shims/type-graphql.js +70 -70
- package/lib/src/Ad4mClient.d.ts +26 -26
- package/lib/src/Ad4mClient.js +66 -66
- package/lib/src/Address.d.ts +1 -1
- package/lib/src/Address.js +1 -1
- package/lib/src/DID.d.ts +1 -1
- package/lib/src/DID.js +1 -1
- package/lib/src/Exception.d.ts +6 -6
- package/lib/src/Exception.js +7 -7
- package/lib/src/Literal.d.ts +7 -7
- package/lib/src/Literal.js +76 -76
- package/lib/src/PubSub.d.ts +14 -14
- package/lib/src/PubSub.js +14 -14
- package/lib/src/SmartLiteral.d.ts +12 -12
- package/lib/src/SmartLiteral.js +74 -74
- package/lib/src/agent/Agent.d.ts +104 -104
- package/lib/src/agent/Agent.js +337 -337
- package/lib/src/agent/AgentClient.d.ts +57 -57
- package/lib/src/agent/AgentClient.js +431 -431
- package/lib/src/agent/AgentResolver.d.ts +30 -30
- package/lib/src/agent/AgentResolver.js +325 -325
- package/lib/src/agent/AgentStatus.d.ts +8 -8
- package/lib/src/agent/AgentStatus.js +61 -61
- package/lib/src/buildSchema.d.ts +1 -1
- package/lib/src/buildSchema.js +36 -36
- package/lib/src/expression/Expression.d.ts +28 -28
- package/lib/src/expression/Expression.js +143 -143
- package/lib/src/expression/ExpressionClient.d.ts +13 -13
- package/lib/src/expression/ExpressionClient.js +102 -102
- package/lib/src/expression/ExpressionRef.d.ts +9 -9
- package/lib/src/expression/ExpressionRef.js +67 -67
- package/lib/src/expression/ExpressionResolver.d.ts +10 -10
- package/lib/src/expression/ExpressionResolver.js +106 -106
- package/lib/src/index.d.ts +30 -30
- package/lib/src/index.js +30 -30
- package/lib/src/jestSetup.d.ts +1 -1
- package/lib/src/jestSetup.js +1 -1
- package/lib/src/language/Icon.d.ts +4 -4
- package/lib/src/language/Icon.js +24 -24
- package/lib/src/language/Language.d.ts +195 -195
- package/lib/src/language/Language.js +79 -79
- package/lib/src/language/LanguageClient.d.ts +17 -17
- package/lib/src/language/LanguageClient.js +137 -137
- package/lib/src/language/LanguageContext.d.ts +37 -37
- package/lib/src/language/LanguageContext.js +2 -2
- package/lib/src/language/LanguageHandle.d.ts +9 -9
- package/lib/src/language/LanguageHandle.js +41 -41
- package/lib/src/language/LanguageMeta.d.ts +35 -35
- package/lib/src/language/LanguageMeta.js +89 -89
- package/lib/src/language/LanguageRef.d.ts +6 -6
- package/lib/src/language/LanguageRef.js +30 -30
- package/lib/src/language/LanguageResolver.d.ts +19 -19
- package/lib/src/language/LanguageResolver.js +143 -143
- package/lib/src/links/Links.d.ts +39 -39
- package/lib/src/links/Links.js +148 -148
- package/lib/src/links/Links.test.d.ts +1 -1
- package/lib/src/links/Links.test.js +33 -33
- package/lib/src/neighbourhood/Neighbourhood.d.ts +10 -10
- package/lib/src/neighbourhood/Neighbourhood.js +38 -38
- package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +25 -25
- package/lib/src/neighbourhood/NeighbourhoodClient.js +256 -256
- package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +19 -19
- package/lib/src/neighbourhood/NeighbourhoodProxy.js +54 -54
- package/lib/src/neighbourhood/NeighbourhoodResolver.d.ts +24 -24
- package/lib/src/neighbourhood/NeighbourhoodResolver.js +180 -180
- package/lib/src/perspectives/LinkQuery.d.ts +11 -11
- package/lib/src/perspectives/LinkQuery.js +80 -80
- package/lib/src/perspectives/Perspective.d.ts +38 -38
- package/lib/src/perspectives/Perspective.js +144 -144
- package/lib/src/perspectives/Perspective.test.d.ts +1 -1
- package/lib/src/perspectives/Perspective.test.js +20 -20
- package/lib/src/perspectives/PerspectiveClient.d.ts +55 -54
- package/lib/src/perspectives/PerspectiveClient.js +418 -410
- package/lib/src/perspectives/PerspectiveDiff.d.ts +9 -9
- package/lib/src/perspectives/PerspectiveDiff.js +33 -33
- package/lib/src/perspectives/PerspectiveHandle.d.ts +16 -16
- package/lib/src/perspectives/PerspectiveHandle.js +59 -59
- package/lib/src/perspectives/PerspectiveProxy.d.ts +178 -178
- package/lib/src/perspectives/PerspectiveProxy.js +501 -540
- package/lib/src/perspectives/PerspectiveResolver.d.ts +38 -37
- package/lib/src/perspectives/PerspectiveResolver.js +376 -362
- package/lib/src/runtime/RuntimeClient.d.ts +33 -33
- package/lib/src/runtime/RuntimeClient.js +263 -263
- package/lib/src/runtime/RuntimeResolver.d.ts +47 -47
- package/lib/src/runtime/RuntimeResolver.js +328 -328
- package/lib/src/schema.gql +1 -0
- package/lib/src/subject/SDNADecorators.d.ts +45 -45
- package/lib/src/subject/SDNADecorators.js +250 -250
- package/lib/src/subject/Subject.d.ts +7 -7
- package/lib/src/subject/Subject.js +160 -160
- package/lib/src/subject/SubjectEntity.d.ts +31 -31
- package/lib/src/subject/SubjectEntity.js +250 -250
- package/lib/src/subject/util.d.ts +12 -12
- package/lib/src/subject/util.js +73 -73
- package/lib/src/typeDefs.d.ts +1 -1
- package/lib/src/typeDefs.js +1 -0
- package/lib/src/unwrapApolloResult.d.ts +2 -2
- package/lib/src/unwrapApolloResult.js +14 -12
- package/lib/src/utils.d.ts +2 -2
- package/lib/src/utils.js +21 -21
- package/package.json +61 -61
- package/rollup.config.js +26 -26
- package/shims/type-graphql.ts +75 -75
- package/src/Ad4mClient.test.ts +1089 -1084
- package/src/Ad4mClient.ts +62 -62
- package/src/Address.ts +1 -1
- package/src/Exception.ts +6 -6
- package/src/Literal.test.ts +30 -30
- package/src/Literal.ts +80 -80
- package/src/PubSub.ts +13 -13
- package/src/SmartLiteral.ts +74 -74
- package/src/agent/Agent.ts +293 -293
- package/src/agent/AgentClient.ts +531 -531
- package/src/agent/AgentResolver.ts +263 -263
- package/src/agent/AgentStatus.ts +43 -43
- package/src/buildSchema.ts +41 -41
- package/src/expression/Expression.ts +99 -99
- package/src/expression/ExpressionClient.ts +98 -98
- package/src/expression/ExpressionRef.ts +62 -62
- package/src/expression/ExpressionResolver.ts +63 -63
- package/src/index.ts +30 -30
- package/src/language/Icon.ts +10 -10
- package/src/language/Language.ts +266 -266
- package/src/language/LanguageClient.ts +159 -159
- package/src/language/LanguageContext.ts +37 -37
- package/src/language/LanguageHandle.ts +23 -23
- package/src/language/LanguageMeta.ts +69 -69
- package/src/language/LanguageRef.ts +18 -18
- package/src/language/LanguageResolver.ts +98 -98
- package/src/links/Links.test.ts +39 -39
- package/src/links/Links.ts +107 -107
- package/src/neighbourhood/Neighbourhood.ts +22 -22
- package/src/neighbourhood/NeighbourhoodClient.ts +275 -275
- package/src/neighbourhood/NeighbourhoodProxy.ts +58 -58
- package/src/neighbourhood/NeighbourhoodResolver.ts +99 -99
- package/src/perspectives/LinkQuery.ts +65 -65
- package/src/perspectives/Perspective.test.ts +22 -22
- package/src/perspectives/Perspective.ts +118 -118
- package/src/perspectives/PerspectiveClient.ts +452 -443
- package/src/perspectives/PerspectiveDiff.ts +15 -15
- package/src/perspectives/PerspectiveHandle.ts +39 -39
- package/src/perspectives/PerspectiveProxy.ts +576 -610
- package/src/perspectives/PerspectiveResolver.ts +224 -219
- package/src/runtime/RuntimeClient.ts +282 -282
- package/src/runtime/RuntimeResolver.ts +192 -192
- package/src/subject/SDNADecorators.ts +333 -333
- package/src/subject/Subject.ts +152 -152
- package/src/subject/SubjectEntity.ts +291 -291
- package/src/subject/util.ts +84 -84
- package/src/typeDefs.ts +5 -5
- package/src/unwrapApolloResult.ts +15 -13
- package/src/utils.ts +25 -25
- package/tsconfig-browser.json +82 -82
- package/tsconfig.json +80 -80
- package/yarn-error.log +0 -22814
|
@@ -1,325 +1,325 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
-
};
|
|
13
|
-
import { Arg, Mutation, Query, Resolver, Subscription, PubSub, } from "type-graphql";
|
|
14
|
-
import { Perspective, PerspectiveInput } from "../perspectives/Perspective";
|
|
15
|
-
import { Agent, AgentSignature, Apps, AuthInfoInput, EntanglementProof, EntanglementProofInput, } from "./Agent";
|
|
16
|
-
import { AgentStatus } from "./AgentStatus";
|
|
17
|
-
import { AGENT_STATUS_CHANGED, AGENT_UPDATED, APPS_CHANGED } from "../PubSub";
|
|
18
|
-
export const TEST_AGENT_DID = "did:ad4m:test";
|
|
19
|
-
let AgentResolver = class AgentResolver {
|
|
20
|
-
agent() {
|
|
21
|
-
return new Agent(TEST_AGENT_DID);
|
|
22
|
-
}
|
|
23
|
-
agentStatus() {
|
|
24
|
-
return new AgentStatus({ did: TEST_AGENT_DID });
|
|
25
|
-
}
|
|
26
|
-
agentGenerate(passphrase, pubSub) {
|
|
27
|
-
const status = new AgentStatus({
|
|
28
|
-
did: TEST_AGENT_DID,
|
|
29
|
-
didDocument: "did document",
|
|
30
|
-
isInitialized: true,
|
|
31
|
-
isUnlocked: true,
|
|
32
|
-
});
|
|
33
|
-
pubSub.publish(AGENT_STATUS_CHANGED, { status });
|
|
34
|
-
return status;
|
|
35
|
-
}
|
|
36
|
-
agentImport(did, didDocument, keystore, passphrase) {
|
|
37
|
-
return new AgentStatus({
|
|
38
|
-
did,
|
|
39
|
-
didDocument,
|
|
40
|
-
isInitialized: true,
|
|
41
|
-
isUnlocked: true,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
agentLock(passphrase, pubSub) {
|
|
45
|
-
const status = new AgentStatus({
|
|
46
|
-
isInitialized: true,
|
|
47
|
-
did: TEST_AGENT_DID,
|
|
48
|
-
});
|
|
49
|
-
pubSub.publish(AGENT_STATUS_CHANGED, { status });
|
|
50
|
-
return status;
|
|
51
|
-
}
|
|
52
|
-
agentUnlock(passphrase, holochain, pubSub) {
|
|
53
|
-
const status = new AgentStatus({
|
|
54
|
-
isInitialized: true,
|
|
55
|
-
isUnlocked: true,
|
|
56
|
-
did: TEST_AGENT_DID,
|
|
57
|
-
});
|
|
58
|
-
pubSub.publish(AGENT_STATUS_CHANGED, { status });
|
|
59
|
-
return status;
|
|
60
|
-
}
|
|
61
|
-
agentByDID(did) {
|
|
62
|
-
return new Agent(did);
|
|
63
|
-
}
|
|
64
|
-
agentUpdatePublicPerspective(perspective, pubSub) {
|
|
65
|
-
const agent = new Agent(TEST_AGENT_DID, perspective);
|
|
66
|
-
agent.directMessageLanguage = "lang://test";
|
|
67
|
-
pubSub.publish(AGENT_UPDATED, { agent });
|
|
68
|
-
return agent;
|
|
69
|
-
}
|
|
70
|
-
agentUpdateDirectMessageLanguage(directMessageLanguage, pubSub) {
|
|
71
|
-
const agent = new Agent(TEST_AGENT_DID, new Perspective());
|
|
72
|
-
agent.directMessageLanguage = directMessageLanguage;
|
|
73
|
-
pubSub.publish(AGENT_UPDATED, { agent });
|
|
74
|
-
return agent;
|
|
75
|
-
}
|
|
76
|
-
agentUpdated() {
|
|
77
|
-
return new Agent(TEST_AGENT_DID);
|
|
78
|
-
}
|
|
79
|
-
agentStatusChanged() {
|
|
80
|
-
return new AgentStatus({ isInitialized: true, did: TEST_AGENT_DID });
|
|
81
|
-
}
|
|
82
|
-
agentAddEntanglementProofs(proofs) {
|
|
83
|
-
return [
|
|
84
|
-
new EntanglementProof("did:key:hash", "did-key-id", "ethereum", "ethAddr", "sig", "sig2"),
|
|
85
|
-
];
|
|
86
|
-
}
|
|
87
|
-
agentDeleteEntanglementProofs(proofs) {
|
|
88
|
-
return [
|
|
89
|
-
new EntanglementProof("did:key:hash", "did-key-id", "ethereum", "ethAddr", "sig", "sig2"),
|
|
90
|
-
];
|
|
91
|
-
}
|
|
92
|
-
agentGetEntanglementProofs() {
|
|
93
|
-
return [
|
|
94
|
-
new EntanglementProof("did:key:hash", "did-key-id", "ethereum", "ethAddr", "sig", "sig2"),
|
|
95
|
-
];
|
|
96
|
-
}
|
|
97
|
-
agentEntanglementProofPreFlight(deviceKey, deviceKeyType) {
|
|
98
|
-
return new EntanglementProof("did:key:hash", "did-key-id", deviceKeyType, deviceKey, "sig");
|
|
99
|
-
}
|
|
100
|
-
agentRequestCapability(authInfo) {
|
|
101
|
-
return "test-request-id";
|
|
102
|
-
}
|
|
103
|
-
agentPermitCapability(auth) {
|
|
104
|
-
return "123";
|
|
105
|
-
}
|
|
106
|
-
agentGenerateJwt(requestId, rand) {
|
|
107
|
-
return "test-jwt";
|
|
108
|
-
}
|
|
109
|
-
agentIsLocked() {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
agentGetApps() {
|
|
113
|
-
return [];
|
|
114
|
-
}
|
|
115
|
-
agentAppsChanged() {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
agentRemoveApp(requestId, pubSub) {
|
|
119
|
-
pubSub.publish(APPS_CHANGED, {});
|
|
120
|
-
return [];
|
|
121
|
-
}
|
|
122
|
-
agentRevokeToken(requestId) {
|
|
123
|
-
return [
|
|
124
|
-
{
|
|
125
|
-
revoked: true,
|
|
126
|
-
requestId: "test-request-id",
|
|
127
|
-
auth: {
|
|
128
|
-
appName: "test-app",
|
|
129
|
-
appDesc: "-",
|
|
130
|
-
appUrl: "-",
|
|
131
|
-
appIconPath: "_",
|
|
132
|
-
capabilities: [
|
|
133
|
-
{
|
|
134
|
-
with: {
|
|
135
|
-
domain: "*",
|
|
136
|
-
pointers: ["*"],
|
|
137
|
-
},
|
|
138
|
-
can: ["*"],
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
token: "test-token",
|
|
143
|
-
},
|
|
144
|
-
];
|
|
145
|
-
}
|
|
146
|
-
agentSignMessage(message) {
|
|
147
|
-
return new AgentSignature("test-message-signature", "test-public-key");
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
__decorate([
|
|
151
|
-
Query((returns) => Agent),
|
|
152
|
-
__metadata("design:type", Function),
|
|
153
|
-
__metadata("design:paramtypes", []),
|
|
154
|
-
__metadata("design:returntype", Agent)
|
|
155
|
-
], AgentResolver.prototype, "agent", null);
|
|
156
|
-
__decorate([
|
|
157
|
-
Query((returns) => AgentStatus),
|
|
158
|
-
__metadata("design:type", Function),
|
|
159
|
-
__metadata("design:paramtypes", []),
|
|
160
|
-
__metadata("design:returntype", AgentStatus)
|
|
161
|
-
], AgentResolver.prototype, "agentStatus", null);
|
|
162
|
-
__decorate([
|
|
163
|
-
Mutation((returns) => AgentStatus),
|
|
164
|
-
__param(0, Arg("passphrase")),
|
|
165
|
-
__param(1, PubSub()),
|
|
166
|
-
__metadata("design:type", Function),
|
|
167
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
168
|
-
__metadata("design:returntype", AgentStatus)
|
|
169
|
-
], AgentResolver.prototype, "agentGenerate", null);
|
|
170
|
-
__decorate([
|
|
171
|
-
Mutation((returns) => AgentStatus),
|
|
172
|
-
__param(0, Arg("did")),
|
|
173
|
-
__param(1, Arg("didDocument")),
|
|
174
|
-
__param(2, Arg("keystore")),
|
|
175
|
-
__param(3, Arg("passphrase")),
|
|
176
|
-
__metadata("design:type", Function),
|
|
177
|
-
__metadata("design:paramtypes", [String, String, String, String]),
|
|
178
|
-
__metadata("design:returntype", AgentStatus)
|
|
179
|
-
], AgentResolver.prototype, "agentImport", null);
|
|
180
|
-
__decorate([
|
|
181
|
-
Mutation((returns) => AgentStatus),
|
|
182
|
-
__param(0, Arg("passphrase")),
|
|
183
|
-
__param(1, PubSub()),
|
|
184
|
-
__metadata("design:type", Function),
|
|
185
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
186
|
-
__metadata("design:returntype", AgentStatus)
|
|
187
|
-
], AgentResolver.prototype, "agentLock", null);
|
|
188
|
-
__decorate([
|
|
189
|
-
Mutation((returns) => AgentStatus),
|
|
190
|
-
__param(0, Arg("passphrase")),
|
|
191
|
-
__param(1, Arg("holochain")),
|
|
192
|
-
__param(2, PubSub()),
|
|
193
|
-
__metadata("design:type", Function),
|
|
194
|
-
__metadata("design:paramtypes", [String, Boolean, Object]),
|
|
195
|
-
__metadata("design:returntype", AgentStatus)
|
|
196
|
-
], AgentResolver.prototype, "agentUnlock", null);
|
|
197
|
-
__decorate([
|
|
198
|
-
Query((returns) => Agent, { nullable: true }),
|
|
199
|
-
__param(0, Arg("did")),
|
|
200
|
-
__metadata("design:type", Function),
|
|
201
|
-
__metadata("design:paramtypes", [String]),
|
|
202
|
-
__metadata("design:returntype", Agent)
|
|
203
|
-
], AgentResolver.prototype, "agentByDID", null);
|
|
204
|
-
__decorate([
|
|
205
|
-
Mutation((returns) => Agent),
|
|
206
|
-
__param(0, Arg("perspective")),
|
|
207
|
-
__param(1, PubSub()),
|
|
208
|
-
__metadata("design:type", Function),
|
|
209
|
-
__metadata("design:paramtypes", [PerspectiveInput, Object]),
|
|
210
|
-
__metadata("design:returntype", Agent)
|
|
211
|
-
], AgentResolver.prototype, "agentUpdatePublicPerspective", null);
|
|
212
|
-
__decorate([
|
|
213
|
-
Mutation((returns) => Agent),
|
|
214
|
-
__param(0, Arg("directMessageLanguage")),
|
|
215
|
-
__param(1, PubSub()),
|
|
216
|
-
__metadata("design:type", Function),
|
|
217
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
218
|
-
__metadata("design:returntype", Agent)
|
|
219
|
-
], AgentResolver.prototype, "agentUpdateDirectMessageLanguage", null);
|
|
220
|
-
__decorate([
|
|
221
|
-
Subscription({ topics: AGENT_UPDATED, nullable: true }),
|
|
222
|
-
__metadata("design:type", Function),
|
|
223
|
-
__metadata("design:paramtypes", []),
|
|
224
|
-
__metadata("design:returntype", Agent)
|
|
225
|
-
], AgentResolver.prototype, "agentUpdated", null);
|
|
226
|
-
__decorate([
|
|
227
|
-
Subscription({ topics: AGENT_STATUS_CHANGED, nullable: true }),
|
|
228
|
-
__metadata("design:type", Function),
|
|
229
|
-
__metadata("design:paramtypes", []),
|
|
230
|
-
__metadata("design:returntype", AgentStatus)
|
|
231
|
-
], AgentResolver.prototype, "agentStatusChanged", null);
|
|
232
|
-
__decorate([
|
|
233
|
-
Mutation((returns) => [EntanglementProof]),
|
|
234
|
-
__param(0, Arg("proofs", (type) => [EntanglementProofInput])),
|
|
235
|
-
__metadata("design:type", Function),
|
|
236
|
-
__metadata("design:paramtypes", [Array]),
|
|
237
|
-
__metadata("design:returntype", Array)
|
|
238
|
-
], AgentResolver.prototype, "agentAddEntanglementProofs", null);
|
|
239
|
-
__decorate([
|
|
240
|
-
Mutation((returns) => [EntanglementProof]),
|
|
241
|
-
__param(0, Arg("proofs", (type) => [EntanglementProofInput])),
|
|
242
|
-
__metadata("design:type", Function),
|
|
243
|
-
__metadata("design:paramtypes", [Array]),
|
|
244
|
-
__metadata("design:returntype", Array)
|
|
245
|
-
], AgentResolver.prototype, "agentDeleteEntanglementProofs", null);
|
|
246
|
-
__decorate([
|
|
247
|
-
Query((returns) => [EntanglementProof]),
|
|
248
|
-
__metadata("design:type", Function),
|
|
249
|
-
__metadata("design:paramtypes", []),
|
|
250
|
-
__metadata("design:returntype", Array)
|
|
251
|
-
], AgentResolver.prototype, "agentGetEntanglementProofs", null);
|
|
252
|
-
__decorate([
|
|
253
|
-
Mutation((returns) => EntanglementProof),
|
|
254
|
-
__param(0, Arg("deviceKey")),
|
|
255
|
-
__param(1, Arg("deviceKeyType")),
|
|
256
|
-
__metadata("design:type", Function),
|
|
257
|
-
__metadata("design:paramtypes", [String, String]),
|
|
258
|
-
__metadata("design:returntype", EntanglementProof)
|
|
259
|
-
], AgentResolver.prototype, "agentEntanglementProofPreFlight", null);
|
|
260
|
-
__decorate([
|
|
261
|
-
Mutation((returns) => String),
|
|
262
|
-
__param(0, Arg("authInfo")),
|
|
263
|
-
__metadata("design:type", Function),
|
|
264
|
-
__metadata("design:paramtypes", [AuthInfoInput]),
|
|
265
|
-
__metadata("design:returntype", String)
|
|
266
|
-
], AgentResolver.prototype, "agentRequestCapability", null);
|
|
267
|
-
__decorate([
|
|
268
|
-
Mutation((returns) => String),
|
|
269
|
-
__param(0, Arg("auth")),
|
|
270
|
-
__metadata("design:type", Function),
|
|
271
|
-
__metadata("design:paramtypes", [String]),
|
|
272
|
-
__metadata("design:returntype", String)
|
|
273
|
-
], AgentResolver.prototype, "agentPermitCapability", null);
|
|
274
|
-
__decorate([
|
|
275
|
-
Mutation((returns) => String),
|
|
276
|
-
__param(0, Arg("requestId")),
|
|
277
|
-
__param(1, Arg("rand")),
|
|
278
|
-
__metadata("design:type", Function),
|
|
279
|
-
__metadata("design:paramtypes", [String, String]),
|
|
280
|
-
__metadata("design:returntype", String)
|
|
281
|
-
], AgentResolver.prototype, "agentGenerateJwt", null);
|
|
282
|
-
__decorate([
|
|
283
|
-
Query((returns) => Boolean),
|
|
284
|
-
__metadata("design:type", Function),
|
|
285
|
-
__metadata("design:paramtypes", []),
|
|
286
|
-
__metadata("design:returntype", Boolean)
|
|
287
|
-
], AgentResolver.prototype, "agentIsLocked", null);
|
|
288
|
-
__decorate([
|
|
289
|
-
Query((returns) => [Apps]),
|
|
290
|
-
__metadata("design:type", Function),
|
|
291
|
-
__metadata("design:paramtypes", []),
|
|
292
|
-
__metadata("design:returntype", Array)
|
|
293
|
-
], AgentResolver.prototype, "agentGetApps", null);
|
|
294
|
-
__decorate([
|
|
295
|
-
Subscription((returns) => [Apps], { topics: APPS_CHANGED, nullable: true }),
|
|
296
|
-
__metadata("design:type", Function),
|
|
297
|
-
__metadata("design:paramtypes", []),
|
|
298
|
-
__metadata("design:returntype", void 0)
|
|
299
|
-
], AgentResolver.prototype, "agentAppsChanged", null);
|
|
300
|
-
__decorate([
|
|
301
|
-
Mutation((returns) => [Apps]),
|
|
302
|
-
__param(0, Arg("requestId")),
|
|
303
|
-
__param(1, PubSub()),
|
|
304
|
-
__metadata("design:type", Function),
|
|
305
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
306
|
-
__metadata("design:returntype", Array)
|
|
307
|
-
], AgentResolver.prototype, "agentRemoveApp", null);
|
|
308
|
-
__decorate([
|
|
309
|
-
Mutation((returns) => [Apps]),
|
|
310
|
-
__param(0, Arg("requestId")),
|
|
311
|
-
__metadata("design:type", Function),
|
|
312
|
-
__metadata("design:paramtypes", [String]),
|
|
313
|
-
__metadata("design:returntype", Array)
|
|
314
|
-
], AgentResolver.prototype, "agentRevokeToken", null);
|
|
315
|
-
__decorate([
|
|
316
|
-
Mutation((returns) => AgentSignature),
|
|
317
|
-
__param(0, Arg("message")),
|
|
318
|
-
__metadata("design:type", Function),
|
|
319
|
-
__metadata("design:paramtypes", [String]),
|
|
320
|
-
__metadata("design:returntype", AgentSignature)
|
|
321
|
-
], AgentResolver.prototype, "agentSignMessage", null);
|
|
322
|
-
AgentResolver = __decorate([
|
|
323
|
-
Resolver()
|
|
324
|
-
], AgentResolver);
|
|
325
|
-
export default AgentResolver;
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { Arg, Mutation, Query, Resolver, Subscription, PubSub, } from "type-graphql";
|
|
14
|
+
import { Perspective, PerspectiveInput } from "../perspectives/Perspective";
|
|
15
|
+
import { Agent, AgentSignature, Apps, AuthInfoInput, EntanglementProof, EntanglementProofInput, } from "./Agent";
|
|
16
|
+
import { AgentStatus } from "./AgentStatus";
|
|
17
|
+
import { AGENT_STATUS_CHANGED, AGENT_UPDATED, APPS_CHANGED } from "../PubSub";
|
|
18
|
+
export const TEST_AGENT_DID = "did:ad4m:test";
|
|
19
|
+
let AgentResolver = class AgentResolver {
|
|
20
|
+
agent() {
|
|
21
|
+
return new Agent(TEST_AGENT_DID);
|
|
22
|
+
}
|
|
23
|
+
agentStatus() {
|
|
24
|
+
return new AgentStatus({ did: TEST_AGENT_DID });
|
|
25
|
+
}
|
|
26
|
+
agentGenerate(passphrase, pubSub) {
|
|
27
|
+
const status = new AgentStatus({
|
|
28
|
+
did: TEST_AGENT_DID,
|
|
29
|
+
didDocument: "did document",
|
|
30
|
+
isInitialized: true,
|
|
31
|
+
isUnlocked: true,
|
|
32
|
+
});
|
|
33
|
+
pubSub.publish(AGENT_STATUS_CHANGED, { status });
|
|
34
|
+
return status;
|
|
35
|
+
}
|
|
36
|
+
agentImport(did, didDocument, keystore, passphrase) {
|
|
37
|
+
return new AgentStatus({
|
|
38
|
+
did,
|
|
39
|
+
didDocument,
|
|
40
|
+
isInitialized: true,
|
|
41
|
+
isUnlocked: true,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
agentLock(passphrase, pubSub) {
|
|
45
|
+
const status = new AgentStatus({
|
|
46
|
+
isInitialized: true,
|
|
47
|
+
did: TEST_AGENT_DID,
|
|
48
|
+
});
|
|
49
|
+
pubSub.publish(AGENT_STATUS_CHANGED, { status });
|
|
50
|
+
return status;
|
|
51
|
+
}
|
|
52
|
+
agentUnlock(passphrase, holochain, pubSub) {
|
|
53
|
+
const status = new AgentStatus({
|
|
54
|
+
isInitialized: true,
|
|
55
|
+
isUnlocked: true,
|
|
56
|
+
did: TEST_AGENT_DID,
|
|
57
|
+
});
|
|
58
|
+
pubSub.publish(AGENT_STATUS_CHANGED, { status });
|
|
59
|
+
return status;
|
|
60
|
+
}
|
|
61
|
+
agentByDID(did) {
|
|
62
|
+
return new Agent(did);
|
|
63
|
+
}
|
|
64
|
+
agentUpdatePublicPerspective(perspective, pubSub) {
|
|
65
|
+
const agent = new Agent(TEST_AGENT_DID, perspective);
|
|
66
|
+
agent.directMessageLanguage = "lang://test";
|
|
67
|
+
pubSub.publish(AGENT_UPDATED, { agent });
|
|
68
|
+
return agent;
|
|
69
|
+
}
|
|
70
|
+
agentUpdateDirectMessageLanguage(directMessageLanguage, pubSub) {
|
|
71
|
+
const agent = new Agent(TEST_AGENT_DID, new Perspective());
|
|
72
|
+
agent.directMessageLanguage = directMessageLanguage;
|
|
73
|
+
pubSub.publish(AGENT_UPDATED, { agent });
|
|
74
|
+
return agent;
|
|
75
|
+
}
|
|
76
|
+
agentUpdated() {
|
|
77
|
+
return new Agent(TEST_AGENT_DID);
|
|
78
|
+
}
|
|
79
|
+
agentStatusChanged() {
|
|
80
|
+
return new AgentStatus({ isInitialized: true, did: TEST_AGENT_DID });
|
|
81
|
+
}
|
|
82
|
+
agentAddEntanglementProofs(proofs) {
|
|
83
|
+
return [
|
|
84
|
+
new EntanglementProof("did:key:hash", "did-key-id", "ethereum", "ethAddr", "sig", "sig2"),
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
agentDeleteEntanglementProofs(proofs) {
|
|
88
|
+
return [
|
|
89
|
+
new EntanglementProof("did:key:hash", "did-key-id", "ethereum", "ethAddr", "sig", "sig2"),
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
agentGetEntanglementProofs() {
|
|
93
|
+
return [
|
|
94
|
+
new EntanglementProof("did:key:hash", "did-key-id", "ethereum", "ethAddr", "sig", "sig2"),
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
agentEntanglementProofPreFlight(deviceKey, deviceKeyType) {
|
|
98
|
+
return new EntanglementProof("did:key:hash", "did-key-id", deviceKeyType, deviceKey, "sig");
|
|
99
|
+
}
|
|
100
|
+
agentRequestCapability(authInfo) {
|
|
101
|
+
return "test-request-id";
|
|
102
|
+
}
|
|
103
|
+
agentPermitCapability(auth) {
|
|
104
|
+
return "123";
|
|
105
|
+
}
|
|
106
|
+
agentGenerateJwt(requestId, rand) {
|
|
107
|
+
return "test-jwt";
|
|
108
|
+
}
|
|
109
|
+
agentIsLocked() {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
agentGetApps() {
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
agentAppsChanged() {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
agentRemoveApp(requestId, pubSub) {
|
|
119
|
+
pubSub.publish(APPS_CHANGED, {});
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
agentRevokeToken(requestId) {
|
|
123
|
+
return [
|
|
124
|
+
{
|
|
125
|
+
revoked: true,
|
|
126
|
+
requestId: "test-request-id",
|
|
127
|
+
auth: {
|
|
128
|
+
appName: "test-app",
|
|
129
|
+
appDesc: "-",
|
|
130
|
+
appUrl: "-",
|
|
131
|
+
appIconPath: "_",
|
|
132
|
+
capabilities: [
|
|
133
|
+
{
|
|
134
|
+
with: {
|
|
135
|
+
domain: "*",
|
|
136
|
+
pointers: ["*"],
|
|
137
|
+
},
|
|
138
|
+
can: ["*"],
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
token: "test-token",
|
|
143
|
+
},
|
|
144
|
+
];
|
|
145
|
+
}
|
|
146
|
+
agentSignMessage(message) {
|
|
147
|
+
return new AgentSignature("test-message-signature", "test-public-key");
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
__decorate([
|
|
151
|
+
Query((returns) => Agent),
|
|
152
|
+
__metadata("design:type", Function),
|
|
153
|
+
__metadata("design:paramtypes", []),
|
|
154
|
+
__metadata("design:returntype", Agent)
|
|
155
|
+
], AgentResolver.prototype, "agent", null);
|
|
156
|
+
__decorate([
|
|
157
|
+
Query((returns) => AgentStatus),
|
|
158
|
+
__metadata("design:type", Function),
|
|
159
|
+
__metadata("design:paramtypes", []),
|
|
160
|
+
__metadata("design:returntype", AgentStatus)
|
|
161
|
+
], AgentResolver.prototype, "agentStatus", null);
|
|
162
|
+
__decorate([
|
|
163
|
+
Mutation((returns) => AgentStatus),
|
|
164
|
+
__param(0, Arg("passphrase")),
|
|
165
|
+
__param(1, PubSub()),
|
|
166
|
+
__metadata("design:type", Function),
|
|
167
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
168
|
+
__metadata("design:returntype", AgentStatus)
|
|
169
|
+
], AgentResolver.prototype, "agentGenerate", null);
|
|
170
|
+
__decorate([
|
|
171
|
+
Mutation((returns) => AgentStatus),
|
|
172
|
+
__param(0, Arg("did")),
|
|
173
|
+
__param(1, Arg("didDocument")),
|
|
174
|
+
__param(2, Arg("keystore")),
|
|
175
|
+
__param(3, Arg("passphrase")),
|
|
176
|
+
__metadata("design:type", Function),
|
|
177
|
+
__metadata("design:paramtypes", [String, String, String, String]),
|
|
178
|
+
__metadata("design:returntype", AgentStatus)
|
|
179
|
+
], AgentResolver.prototype, "agentImport", null);
|
|
180
|
+
__decorate([
|
|
181
|
+
Mutation((returns) => AgentStatus),
|
|
182
|
+
__param(0, Arg("passphrase")),
|
|
183
|
+
__param(1, PubSub()),
|
|
184
|
+
__metadata("design:type", Function),
|
|
185
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
186
|
+
__metadata("design:returntype", AgentStatus)
|
|
187
|
+
], AgentResolver.prototype, "agentLock", null);
|
|
188
|
+
__decorate([
|
|
189
|
+
Mutation((returns) => AgentStatus),
|
|
190
|
+
__param(0, Arg("passphrase")),
|
|
191
|
+
__param(1, Arg("holochain")),
|
|
192
|
+
__param(2, PubSub()),
|
|
193
|
+
__metadata("design:type", Function),
|
|
194
|
+
__metadata("design:paramtypes", [String, Boolean, Object]),
|
|
195
|
+
__metadata("design:returntype", AgentStatus)
|
|
196
|
+
], AgentResolver.prototype, "agentUnlock", null);
|
|
197
|
+
__decorate([
|
|
198
|
+
Query((returns) => Agent, { nullable: true }),
|
|
199
|
+
__param(0, Arg("did")),
|
|
200
|
+
__metadata("design:type", Function),
|
|
201
|
+
__metadata("design:paramtypes", [String]),
|
|
202
|
+
__metadata("design:returntype", Agent)
|
|
203
|
+
], AgentResolver.prototype, "agentByDID", null);
|
|
204
|
+
__decorate([
|
|
205
|
+
Mutation((returns) => Agent),
|
|
206
|
+
__param(0, Arg("perspective")),
|
|
207
|
+
__param(1, PubSub()),
|
|
208
|
+
__metadata("design:type", Function),
|
|
209
|
+
__metadata("design:paramtypes", [PerspectiveInput, Object]),
|
|
210
|
+
__metadata("design:returntype", Agent)
|
|
211
|
+
], AgentResolver.prototype, "agentUpdatePublicPerspective", null);
|
|
212
|
+
__decorate([
|
|
213
|
+
Mutation((returns) => Agent),
|
|
214
|
+
__param(0, Arg("directMessageLanguage")),
|
|
215
|
+
__param(1, PubSub()),
|
|
216
|
+
__metadata("design:type", Function),
|
|
217
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
218
|
+
__metadata("design:returntype", Agent)
|
|
219
|
+
], AgentResolver.prototype, "agentUpdateDirectMessageLanguage", null);
|
|
220
|
+
__decorate([
|
|
221
|
+
Subscription({ topics: AGENT_UPDATED, nullable: true }),
|
|
222
|
+
__metadata("design:type", Function),
|
|
223
|
+
__metadata("design:paramtypes", []),
|
|
224
|
+
__metadata("design:returntype", Agent)
|
|
225
|
+
], AgentResolver.prototype, "agentUpdated", null);
|
|
226
|
+
__decorate([
|
|
227
|
+
Subscription({ topics: AGENT_STATUS_CHANGED, nullable: true }),
|
|
228
|
+
__metadata("design:type", Function),
|
|
229
|
+
__metadata("design:paramtypes", []),
|
|
230
|
+
__metadata("design:returntype", AgentStatus)
|
|
231
|
+
], AgentResolver.prototype, "agentStatusChanged", null);
|
|
232
|
+
__decorate([
|
|
233
|
+
Mutation((returns) => [EntanglementProof]),
|
|
234
|
+
__param(0, Arg("proofs", (type) => [EntanglementProofInput])),
|
|
235
|
+
__metadata("design:type", Function),
|
|
236
|
+
__metadata("design:paramtypes", [Array]),
|
|
237
|
+
__metadata("design:returntype", Array)
|
|
238
|
+
], AgentResolver.prototype, "agentAddEntanglementProofs", null);
|
|
239
|
+
__decorate([
|
|
240
|
+
Mutation((returns) => [EntanglementProof]),
|
|
241
|
+
__param(0, Arg("proofs", (type) => [EntanglementProofInput])),
|
|
242
|
+
__metadata("design:type", Function),
|
|
243
|
+
__metadata("design:paramtypes", [Array]),
|
|
244
|
+
__metadata("design:returntype", Array)
|
|
245
|
+
], AgentResolver.prototype, "agentDeleteEntanglementProofs", null);
|
|
246
|
+
__decorate([
|
|
247
|
+
Query((returns) => [EntanglementProof]),
|
|
248
|
+
__metadata("design:type", Function),
|
|
249
|
+
__metadata("design:paramtypes", []),
|
|
250
|
+
__metadata("design:returntype", Array)
|
|
251
|
+
], AgentResolver.prototype, "agentGetEntanglementProofs", null);
|
|
252
|
+
__decorate([
|
|
253
|
+
Mutation((returns) => EntanglementProof),
|
|
254
|
+
__param(0, Arg("deviceKey")),
|
|
255
|
+
__param(1, Arg("deviceKeyType")),
|
|
256
|
+
__metadata("design:type", Function),
|
|
257
|
+
__metadata("design:paramtypes", [String, String]),
|
|
258
|
+
__metadata("design:returntype", EntanglementProof)
|
|
259
|
+
], AgentResolver.prototype, "agentEntanglementProofPreFlight", null);
|
|
260
|
+
__decorate([
|
|
261
|
+
Mutation((returns) => String),
|
|
262
|
+
__param(0, Arg("authInfo")),
|
|
263
|
+
__metadata("design:type", Function),
|
|
264
|
+
__metadata("design:paramtypes", [AuthInfoInput]),
|
|
265
|
+
__metadata("design:returntype", String)
|
|
266
|
+
], AgentResolver.prototype, "agentRequestCapability", null);
|
|
267
|
+
__decorate([
|
|
268
|
+
Mutation((returns) => String),
|
|
269
|
+
__param(0, Arg("auth")),
|
|
270
|
+
__metadata("design:type", Function),
|
|
271
|
+
__metadata("design:paramtypes", [String]),
|
|
272
|
+
__metadata("design:returntype", String)
|
|
273
|
+
], AgentResolver.prototype, "agentPermitCapability", null);
|
|
274
|
+
__decorate([
|
|
275
|
+
Mutation((returns) => String),
|
|
276
|
+
__param(0, Arg("requestId")),
|
|
277
|
+
__param(1, Arg("rand")),
|
|
278
|
+
__metadata("design:type", Function),
|
|
279
|
+
__metadata("design:paramtypes", [String, String]),
|
|
280
|
+
__metadata("design:returntype", String)
|
|
281
|
+
], AgentResolver.prototype, "agentGenerateJwt", null);
|
|
282
|
+
__decorate([
|
|
283
|
+
Query((returns) => Boolean),
|
|
284
|
+
__metadata("design:type", Function),
|
|
285
|
+
__metadata("design:paramtypes", []),
|
|
286
|
+
__metadata("design:returntype", Boolean)
|
|
287
|
+
], AgentResolver.prototype, "agentIsLocked", null);
|
|
288
|
+
__decorate([
|
|
289
|
+
Query((returns) => [Apps]),
|
|
290
|
+
__metadata("design:type", Function),
|
|
291
|
+
__metadata("design:paramtypes", []),
|
|
292
|
+
__metadata("design:returntype", Array)
|
|
293
|
+
], AgentResolver.prototype, "agentGetApps", null);
|
|
294
|
+
__decorate([
|
|
295
|
+
Subscription((returns) => [Apps], { topics: APPS_CHANGED, nullable: true }),
|
|
296
|
+
__metadata("design:type", Function),
|
|
297
|
+
__metadata("design:paramtypes", []),
|
|
298
|
+
__metadata("design:returntype", void 0)
|
|
299
|
+
], AgentResolver.prototype, "agentAppsChanged", null);
|
|
300
|
+
__decorate([
|
|
301
|
+
Mutation((returns) => [Apps]),
|
|
302
|
+
__param(0, Arg("requestId")),
|
|
303
|
+
__param(1, PubSub()),
|
|
304
|
+
__metadata("design:type", Function),
|
|
305
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
306
|
+
__metadata("design:returntype", Array)
|
|
307
|
+
], AgentResolver.prototype, "agentRemoveApp", null);
|
|
308
|
+
__decorate([
|
|
309
|
+
Mutation((returns) => [Apps]),
|
|
310
|
+
__param(0, Arg("requestId")),
|
|
311
|
+
__metadata("design:type", Function),
|
|
312
|
+
__metadata("design:paramtypes", [String]),
|
|
313
|
+
__metadata("design:returntype", Array)
|
|
314
|
+
], AgentResolver.prototype, "agentRevokeToken", null);
|
|
315
|
+
__decorate([
|
|
316
|
+
Mutation((returns) => AgentSignature),
|
|
317
|
+
__param(0, Arg("message")),
|
|
318
|
+
__metadata("design:type", Function),
|
|
319
|
+
__metadata("design:paramtypes", [String]),
|
|
320
|
+
__metadata("design:returntype", AgentSignature)
|
|
321
|
+
], AgentResolver.prototype, "agentSignMessage", null);
|
|
322
|
+
AgentResolver = __decorate([
|
|
323
|
+
Resolver()
|
|
324
|
+
], AgentResolver);
|
|
325
|
+
export default AgentResolver;
|