@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
package/lib/src/agent/Agent.js
CHANGED
|
@@ -1,337 +1,337 @@
|
|
|
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
|
-
import { Field, ObjectType, InputType } from "type-graphql";
|
|
11
|
-
import { Perspective } from "../perspectives/Perspective";
|
|
12
|
-
import { ExpressionGeneric } from "../expression/Expression";
|
|
13
|
-
/** AD4M's representation of an Agent
|
|
14
|
-
*
|
|
15
|
-
* AD4M Agents are build around DIDs, which are used to identify and authenticate the Agent.
|
|
16
|
-
* Conceptually, an Agent is regarded as something that can speak and that can listen.
|
|
17
|
-
*
|
|
18
|
-
* Agents speak by creating Expressions in AD4M Languages which are signed by the Agent's DID key,
|
|
19
|
-
* And they also speak (broadcast) by putting semantic statements into their public "Agent Perspective".
|
|
20
|
-
* They listen (can receive messages) through their "direct message Language".
|
|
21
|
-
*
|
|
22
|
-
* These three aspects are represented by the three fields of this class.
|
|
23
|
-
*
|
|
24
|
-
* This class is used as format for the Expressions in the Agent language.
|
|
25
|
-
* Since AD4M treats DID URIs as addresses for the Agent Language,
|
|
26
|
-
* DIDs are resolved to Expressions that are objects of this class.
|
|
27
|
-
* Thus, this is how agents see (other) agents.
|
|
28
|
-
*/
|
|
29
|
-
let Agent = class Agent {
|
|
30
|
-
constructor(did, perspective) {
|
|
31
|
-
this.did = did;
|
|
32
|
-
if (perspective) {
|
|
33
|
-
this.perspective = perspective;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.perspective = new Perspective();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
__decorate([
|
|
41
|
-
Field(),
|
|
42
|
-
__metadata("design:type", String)
|
|
43
|
-
], Agent.prototype, "did", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
Field((type) => Perspective, { nullable: true }),
|
|
46
|
-
__metadata("design:type", Perspective)
|
|
47
|
-
], Agent.prototype, "perspective", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
Field({ nullable: true }),
|
|
50
|
-
__metadata("design:type", String)
|
|
51
|
-
], Agent.prototype, "directMessageLanguage", void 0);
|
|
52
|
-
Agent = __decorate([
|
|
53
|
-
ObjectType(),
|
|
54
|
-
__metadata("design:paramtypes", [String, Perspective])
|
|
55
|
-
], Agent);
|
|
56
|
-
export { Agent };
|
|
57
|
-
let AgentExpression = class AgentExpression extends ExpressionGeneric(Agent) {
|
|
58
|
-
};
|
|
59
|
-
AgentExpression = __decorate([
|
|
60
|
-
ObjectType()
|
|
61
|
-
], AgentExpression);
|
|
62
|
-
export { AgentExpression };
|
|
63
|
-
let EntanglementProof = class EntanglementProof {
|
|
64
|
-
constructor(did, didSigningKeyId, deviceKeyType, deviceKey, deviceKeySignedByDid, didSignedByDeviceKey) {
|
|
65
|
-
this.did = did;
|
|
66
|
-
this.didSigningKeyId = didSigningKeyId;
|
|
67
|
-
this.deviceKeyType = deviceKeyType;
|
|
68
|
-
this.deviceKey = deviceKey;
|
|
69
|
-
this.deviceKeySignedByDid = deviceKeySignedByDid;
|
|
70
|
-
this.didSignedByDeviceKey = didSignedByDeviceKey;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
__decorate([
|
|
74
|
-
Field(),
|
|
75
|
-
__metadata("design:type", String)
|
|
76
|
-
], EntanglementProof.prototype, "did", void 0);
|
|
77
|
-
__decorate([
|
|
78
|
-
Field(),
|
|
79
|
-
__metadata("design:type", String)
|
|
80
|
-
], EntanglementProof.prototype, "didSigningKeyId", void 0);
|
|
81
|
-
__decorate([
|
|
82
|
-
Field(),
|
|
83
|
-
__metadata("design:type", String)
|
|
84
|
-
], EntanglementProof.prototype, "deviceKeyType", void 0);
|
|
85
|
-
__decorate([
|
|
86
|
-
Field(),
|
|
87
|
-
__metadata("design:type", String)
|
|
88
|
-
], EntanglementProof.prototype, "deviceKey", void 0);
|
|
89
|
-
__decorate([
|
|
90
|
-
Field(),
|
|
91
|
-
__metadata("design:type", String)
|
|
92
|
-
], EntanglementProof.prototype, "deviceKeySignedByDid", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
Field({ nullable: true }),
|
|
95
|
-
__metadata("design:type", String)
|
|
96
|
-
], EntanglementProof.prototype, "didSignedByDeviceKey", void 0);
|
|
97
|
-
EntanglementProof = __decorate([
|
|
98
|
-
ObjectType(),
|
|
99
|
-
__metadata("design:paramtypes", [String, String, String, String, String, String])
|
|
100
|
-
], EntanglementProof);
|
|
101
|
-
export { EntanglementProof };
|
|
102
|
-
let EntanglementProofInput = class EntanglementProofInput {
|
|
103
|
-
constructor(did, didSigningKeyId, deviceKeyType, deviceKey, deviceKeySignedByDid, didSignedByDeviceKey) {
|
|
104
|
-
this.did = did;
|
|
105
|
-
this.didSigningKeyId = didSigningKeyId;
|
|
106
|
-
this.deviceKeyType = deviceKeyType;
|
|
107
|
-
this.deviceKey = deviceKey;
|
|
108
|
-
this.deviceKeySignedByDid = deviceKeySignedByDid;
|
|
109
|
-
this.didSignedByDeviceKey = didSignedByDeviceKey;
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
__decorate([
|
|
113
|
-
Field(),
|
|
114
|
-
__metadata("design:type", String)
|
|
115
|
-
], EntanglementProofInput.prototype, "did", void 0);
|
|
116
|
-
__decorate([
|
|
117
|
-
Field(),
|
|
118
|
-
__metadata("design:type", String)
|
|
119
|
-
], EntanglementProofInput.prototype, "didSigningKeyId", void 0);
|
|
120
|
-
__decorate([
|
|
121
|
-
Field(),
|
|
122
|
-
__metadata("design:type", String)
|
|
123
|
-
], EntanglementProofInput.prototype, "deviceKeyType", void 0);
|
|
124
|
-
__decorate([
|
|
125
|
-
Field(),
|
|
126
|
-
__metadata("design:type", String)
|
|
127
|
-
], EntanglementProofInput.prototype, "deviceKey", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
Field(),
|
|
130
|
-
__metadata("design:type", String)
|
|
131
|
-
], EntanglementProofInput.prototype, "deviceKeySignedByDid", void 0);
|
|
132
|
-
__decorate([
|
|
133
|
-
Field(),
|
|
134
|
-
__metadata("design:type", String)
|
|
135
|
-
], EntanglementProofInput.prototype, "didSignedByDeviceKey", void 0);
|
|
136
|
-
EntanglementProofInput = __decorate([
|
|
137
|
-
InputType(),
|
|
138
|
-
__metadata("design:paramtypes", [String, String, String, String, String, String])
|
|
139
|
-
], EntanglementProofInput);
|
|
140
|
-
export { EntanglementProofInput };
|
|
141
|
-
let AgentSignature = class AgentSignature {
|
|
142
|
-
constructor(signature, publicKey) {
|
|
143
|
-
this.signature = signature;
|
|
144
|
-
this.publicKey = publicKey;
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
__decorate([
|
|
148
|
-
Field(),
|
|
149
|
-
__metadata("design:type", String)
|
|
150
|
-
], AgentSignature.prototype, "signature", void 0);
|
|
151
|
-
__decorate([
|
|
152
|
-
Field(),
|
|
153
|
-
__metadata("design:type", String)
|
|
154
|
-
], AgentSignature.prototype, "publicKey", void 0);
|
|
155
|
-
AgentSignature = __decorate([
|
|
156
|
-
ObjectType(),
|
|
157
|
-
__metadata("design:paramtypes", [String, String])
|
|
158
|
-
], AgentSignature);
|
|
159
|
-
export { AgentSignature };
|
|
160
|
-
let Resource = class Resource {
|
|
161
|
-
constructor(domain, pointers) {
|
|
162
|
-
this.domain = domain;
|
|
163
|
-
this.pointers = pointers;
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
__decorate([
|
|
167
|
-
Field(),
|
|
168
|
-
__metadata("design:type", String)
|
|
169
|
-
], Resource.prototype, "domain", void 0);
|
|
170
|
-
__decorate([
|
|
171
|
-
Field((type) => [String]),
|
|
172
|
-
__metadata("design:type", Array)
|
|
173
|
-
], Resource.prototype, "pointers", void 0);
|
|
174
|
-
Resource = __decorate([
|
|
175
|
-
ObjectType(),
|
|
176
|
-
__metadata("design:paramtypes", [String, Array])
|
|
177
|
-
], Resource);
|
|
178
|
-
export { Resource };
|
|
179
|
-
let Capability = class Capability {
|
|
180
|
-
constructor(withF, can) {
|
|
181
|
-
this.with = withF;
|
|
182
|
-
this.can = can;
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
__decorate([
|
|
186
|
-
Field((type) => Resource),
|
|
187
|
-
__metadata("design:type", Resource)
|
|
188
|
-
], Capability.prototype, "with", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
Field((type) => [String]),
|
|
191
|
-
__metadata("design:type", Array)
|
|
192
|
-
], Capability.prototype, "can", void 0);
|
|
193
|
-
Capability = __decorate([
|
|
194
|
-
ObjectType(),
|
|
195
|
-
__metadata("design:paramtypes", [Resource, Array])
|
|
196
|
-
], Capability);
|
|
197
|
-
export { Capability };
|
|
198
|
-
let AuthInfo = class AuthInfo {
|
|
199
|
-
constructor(appName, appDesc, appUrl, capabilities, appIconPath) {
|
|
200
|
-
this.appName = appName;
|
|
201
|
-
this.appDesc = appDesc;
|
|
202
|
-
this.appIconPath = appIconPath;
|
|
203
|
-
this.appUrl = appUrl;
|
|
204
|
-
this.capabilities = capabilities;
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
__decorate([
|
|
208
|
-
Field(),
|
|
209
|
-
__metadata("design:type", String)
|
|
210
|
-
], AuthInfo.prototype, "appName", void 0);
|
|
211
|
-
__decorate([
|
|
212
|
-
Field(),
|
|
213
|
-
__metadata("design:type", String)
|
|
214
|
-
], AuthInfo.prototype, "appDesc", void 0);
|
|
215
|
-
__decorate([
|
|
216
|
-
Field(),
|
|
217
|
-
__metadata("design:type", String)
|
|
218
|
-
], AuthInfo.prototype, "appUrl", void 0);
|
|
219
|
-
__decorate([
|
|
220
|
-
Field({ nullable: true }),
|
|
221
|
-
__metadata("design:type", String)
|
|
222
|
-
], AuthInfo.prototype, "appIconPath", void 0);
|
|
223
|
-
__decorate([
|
|
224
|
-
Field((type) => [Capability]),
|
|
225
|
-
__metadata("design:type", Array)
|
|
226
|
-
], AuthInfo.prototype, "capabilities", void 0);
|
|
227
|
-
AuthInfo = __decorate([
|
|
228
|
-
ObjectType(),
|
|
229
|
-
__metadata("design:paramtypes", [String, String, String, Array, String])
|
|
230
|
-
], AuthInfo);
|
|
231
|
-
export { AuthInfo };
|
|
232
|
-
let Apps = class Apps {
|
|
233
|
-
constructor(requestId, auth, token, revoked) {
|
|
234
|
-
this.requestId = requestId;
|
|
235
|
-
this.auth = auth;
|
|
236
|
-
this.token = token;
|
|
237
|
-
this.revoked = revoked;
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
__decorate([
|
|
241
|
-
Field(),
|
|
242
|
-
__metadata("design:type", String)
|
|
243
|
-
], Apps.prototype, "requestId", void 0);
|
|
244
|
-
__decorate([
|
|
245
|
-
Field(),
|
|
246
|
-
__metadata("design:type", String)
|
|
247
|
-
], Apps.prototype, "token", void 0);
|
|
248
|
-
__decorate([
|
|
249
|
-
Field({ nullable: true }),
|
|
250
|
-
__metadata("design:type", Boolean)
|
|
251
|
-
], Apps.prototype, "revoked", void 0);
|
|
252
|
-
__decorate([
|
|
253
|
-
Field(),
|
|
254
|
-
__metadata("design:type", AuthInfo)
|
|
255
|
-
], Apps.prototype, "auth", void 0);
|
|
256
|
-
Apps = __decorate([
|
|
257
|
-
ObjectType(),
|
|
258
|
-
__metadata("design:paramtypes", [String, AuthInfo, String, Boolean])
|
|
259
|
-
], Apps);
|
|
260
|
-
export { Apps };
|
|
261
|
-
let ResourceInput = class ResourceInput {
|
|
262
|
-
constructor(domain, pointers) {
|
|
263
|
-
this.domain = domain;
|
|
264
|
-
this.pointers = pointers;
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
__decorate([
|
|
268
|
-
Field(),
|
|
269
|
-
__metadata("design:type", String)
|
|
270
|
-
], ResourceInput.prototype, "domain", void 0);
|
|
271
|
-
__decorate([
|
|
272
|
-
Field((type) => [String]),
|
|
273
|
-
__metadata("design:type", Array)
|
|
274
|
-
], ResourceInput.prototype, "pointers", void 0);
|
|
275
|
-
ResourceInput = __decorate([
|
|
276
|
-
InputType(),
|
|
277
|
-
__metadata("design:paramtypes", [String, Array])
|
|
278
|
-
], ResourceInput);
|
|
279
|
-
export { ResourceInput };
|
|
280
|
-
let CapabilityInput = class CapabilityInput {
|
|
281
|
-
constructor(withF, can) {
|
|
282
|
-
this.with = withF;
|
|
283
|
-
this.can = can;
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
__decorate([
|
|
287
|
-
Field((type) => ResourceInput),
|
|
288
|
-
__metadata("design:type", ResourceInput)
|
|
289
|
-
], CapabilityInput.prototype, "with", void 0);
|
|
290
|
-
__decorate([
|
|
291
|
-
Field((type) => [String]),
|
|
292
|
-
__metadata("design:type", Array)
|
|
293
|
-
], CapabilityInput.prototype, "can", void 0);
|
|
294
|
-
CapabilityInput = __decorate([
|
|
295
|
-
InputType(),
|
|
296
|
-
__metadata("design:paramtypes", [ResourceInput, Array])
|
|
297
|
-
], CapabilityInput);
|
|
298
|
-
export { CapabilityInput };
|
|
299
|
-
let AuthInfoInput = class AuthInfoInput {
|
|
300
|
-
constructor(appName, appDesc, appDomain, appUrl, appIconPath, capabilities) {
|
|
301
|
-
this.appName = appName;
|
|
302
|
-
this.appDesc = appDesc;
|
|
303
|
-
this.appUrl = appUrl;
|
|
304
|
-
this.appDomain = appDomain;
|
|
305
|
-
this.capabilities = capabilities;
|
|
306
|
-
this.appIconPath = appIconPath;
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
__decorate([
|
|
310
|
-
Field(),
|
|
311
|
-
__metadata("design:type", String)
|
|
312
|
-
], AuthInfoInput.prototype, "appName", void 0);
|
|
313
|
-
__decorate([
|
|
314
|
-
Field(),
|
|
315
|
-
__metadata("design:type", String)
|
|
316
|
-
], AuthInfoInput.prototype, "appDesc", void 0);
|
|
317
|
-
__decorate([
|
|
318
|
-
Field(),
|
|
319
|
-
__metadata("design:type", String)
|
|
320
|
-
], AuthInfoInput.prototype, "appDomain", void 0);
|
|
321
|
-
__decorate([
|
|
322
|
-
Field({ nullable: true }),
|
|
323
|
-
__metadata("design:type", String)
|
|
324
|
-
], AuthInfoInput.prototype, "appUrl", void 0);
|
|
325
|
-
__decorate([
|
|
326
|
-
Field({ nullable: true }),
|
|
327
|
-
__metadata("design:type", String)
|
|
328
|
-
], AuthInfoInput.prototype, "appIconPath", void 0);
|
|
329
|
-
__decorate([
|
|
330
|
-
Field((type) => [CapabilityInput], { nullable: true }),
|
|
331
|
-
__metadata("design:type", Array)
|
|
332
|
-
], AuthInfoInput.prototype, "capabilities", void 0);
|
|
333
|
-
AuthInfoInput = __decorate([
|
|
334
|
-
InputType(),
|
|
335
|
-
__metadata("design:paramtypes", [String, String, String, String, String, Array])
|
|
336
|
-
], AuthInfoInput);
|
|
337
|
-
export { AuthInfoInput };
|
|
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
|
+
import { Field, ObjectType, InputType } from "type-graphql";
|
|
11
|
+
import { Perspective } from "../perspectives/Perspective";
|
|
12
|
+
import { ExpressionGeneric } from "../expression/Expression";
|
|
13
|
+
/** AD4M's representation of an Agent
|
|
14
|
+
*
|
|
15
|
+
* AD4M Agents are build around DIDs, which are used to identify and authenticate the Agent.
|
|
16
|
+
* Conceptually, an Agent is regarded as something that can speak and that can listen.
|
|
17
|
+
*
|
|
18
|
+
* Agents speak by creating Expressions in AD4M Languages which are signed by the Agent's DID key,
|
|
19
|
+
* And they also speak (broadcast) by putting semantic statements into their public "Agent Perspective".
|
|
20
|
+
* They listen (can receive messages) through their "direct message Language".
|
|
21
|
+
*
|
|
22
|
+
* These three aspects are represented by the three fields of this class.
|
|
23
|
+
*
|
|
24
|
+
* This class is used as format for the Expressions in the Agent language.
|
|
25
|
+
* Since AD4M treats DID URIs as addresses for the Agent Language,
|
|
26
|
+
* DIDs are resolved to Expressions that are objects of this class.
|
|
27
|
+
* Thus, this is how agents see (other) agents.
|
|
28
|
+
*/
|
|
29
|
+
let Agent = class Agent {
|
|
30
|
+
constructor(did, perspective) {
|
|
31
|
+
this.did = did;
|
|
32
|
+
if (perspective) {
|
|
33
|
+
this.perspective = perspective;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.perspective = new Perspective();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
__decorate([
|
|
41
|
+
Field(),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], Agent.prototype, "did", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
Field((type) => Perspective, { nullable: true }),
|
|
46
|
+
__metadata("design:type", Perspective)
|
|
47
|
+
], Agent.prototype, "perspective", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
Field({ nullable: true }),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], Agent.prototype, "directMessageLanguage", void 0);
|
|
52
|
+
Agent = __decorate([
|
|
53
|
+
ObjectType(),
|
|
54
|
+
__metadata("design:paramtypes", [String, Perspective])
|
|
55
|
+
], Agent);
|
|
56
|
+
export { Agent };
|
|
57
|
+
let AgentExpression = class AgentExpression extends ExpressionGeneric(Agent) {
|
|
58
|
+
};
|
|
59
|
+
AgentExpression = __decorate([
|
|
60
|
+
ObjectType()
|
|
61
|
+
], AgentExpression);
|
|
62
|
+
export { AgentExpression };
|
|
63
|
+
let EntanglementProof = class EntanglementProof {
|
|
64
|
+
constructor(did, didSigningKeyId, deviceKeyType, deviceKey, deviceKeySignedByDid, didSignedByDeviceKey) {
|
|
65
|
+
this.did = did;
|
|
66
|
+
this.didSigningKeyId = didSigningKeyId;
|
|
67
|
+
this.deviceKeyType = deviceKeyType;
|
|
68
|
+
this.deviceKey = deviceKey;
|
|
69
|
+
this.deviceKeySignedByDid = deviceKeySignedByDid;
|
|
70
|
+
this.didSignedByDeviceKey = didSignedByDeviceKey;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
__decorate([
|
|
74
|
+
Field(),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], EntanglementProof.prototype, "did", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
Field(),
|
|
79
|
+
__metadata("design:type", String)
|
|
80
|
+
], EntanglementProof.prototype, "didSigningKeyId", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
Field(),
|
|
83
|
+
__metadata("design:type", String)
|
|
84
|
+
], EntanglementProof.prototype, "deviceKeyType", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
Field(),
|
|
87
|
+
__metadata("design:type", String)
|
|
88
|
+
], EntanglementProof.prototype, "deviceKey", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
Field(),
|
|
91
|
+
__metadata("design:type", String)
|
|
92
|
+
], EntanglementProof.prototype, "deviceKeySignedByDid", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
Field({ nullable: true }),
|
|
95
|
+
__metadata("design:type", String)
|
|
96
|
+
], EntanglementProof.prototype, "didSignedByDeviceKey", void 0);
|
|
97
|
+
EntanglementProof = __decorate([
|
|
98
|
+
ObjectType(),
|
|
99
|
+
__metadata("design:paramtypes", [String, String, String, String, String, String])
|
|
100
|
+
], EntanglementProof);
|
|
101
|
+
export { EntanglementProof };
|
|
102
|
+
let EntanglementProofInput = class EntanglementProofInput {
|
|
103
|
+
constructor(did, didSigningKeyId, deviceKeyType, deviceKey, deviceKeySignedByDid, didSignedByDeviceKey) {
|
|
104
|
+
this.did = did;
|
|
105
|
+
this.didSigningKeyId = didSigningKeyId;
|
|
106
|
+
this.deviceKeyType = deviceKeyType;
|
|
107
|
+
this.deviceKey = deviceKey;
|
|
108
|
+
this.deviceKeySignedByDid = deviceKeySignedByDid;
|
|
109
|
+
this.didSignedByDeviceKey = didSignedByDeviceKey;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
__decorate([
|
|
113
|
+
Field(),
|
|
114
|
+
__metadata("design:type", String)
|
|
115
|
+
], EntanglementProofInput.prototype, "did", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
Field(),
|
|
118
|
+
__metadata("design:type", String)
|
|
119
|
+
], EntanglementProofInput.prototype, "didSigningKeyId", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
Field(),
|
|
122
|
+
__metadata("design:type", String)
|
|
123
|
+
], EntanglementProofInput.prototype, "deviceKeyType", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
Field(),
|
|
126
|
+
__metadata("design:type", String)
|
|
127
|
+
], EntanglementProofInput.prototype, "deviceKey", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
Field(),
|
|
130
|
+
__metadata("design:type", String)
|
|
131
|
+
], EntanglementProofInput.prototype, "deviceKeySignedByDid", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
Field(),
|
|
134
|
+
__metadata("design:type", String)
|
|
135
|
+
], EntanglementProofInput.prototype, "didSignedByDeviceKey", void 0);
|
|
136
|
+
EntanglementProofInput = __decorate([
|
|
137
|
+
InputType(),
|
|
138
|
+
__metadata("design:paramtypes", [String, String, String, String, String, String])
|
|
139
|
+
], EntanglementProofInput);
|
|
140
|
+
export { EntanglementProofInput };
|
|
141
|
+
let AgentSignature = class AgentSignature {
|
|
142
|
+
constructor(signature, publicKey) {
|
|
143
|
+
this.signature = signature;
|
|
144
|
+
this.publicKey = publicKey;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
__decorate([
|
|
148
|
+
Field(),
|
|
149
|
+
__metadata("design:type", String)
|
|
150
|
+
], AgentSignature.prototype, "signature", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
Field(),
|
|
153
|
+
__metadata("design:type", String)
|
|
154
|
+
], AgentSignature.prototype, "publicKey", void 0);
|
|
155
|
+
AgentSignature = __decorate([
|
|
156
|
+
ObjectType(),
|
|
157
|
+
__metadata("design:paramtypes", [String, String])
|
|
158
|
+
], AgentSignature);
|
|
159
|
+
export { AgentSignature };
|
|
160
|
+
let Resource = class Resource {
|
|
161
|
+
constructor(domain, pointers) {
|
|
162
|
+
this.domain = domain;
|
|
163
|
+
this.pointers = pointers;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
__decorate([
|
|
167
|
+
Field(),
|
|
168
|
+
__metadata("design:type", String)
|
|
169
|
+
], Resource.prototype, "domain", void 0);
|
|
170
|
+
__decorate([
|
|
171
|
+
Field((type) => [String]),
|
|
172
|
+
__metadata("design:type", Array)
|
|
173
|
+
], Resource.prototype, "pointers", void 0);
|
|
174
|
+
Resource = __decorate([
|
|
175
|
+
ObjectType(),
|
|
176
|
+
__metadata("design:paramtypes", [String, Array])
|
|
177
|
+
], Resource);
|
|
178
|
+
export { Resource };
|
|
179
|
+
let Capability = class Capability {
|
|
180
|
+
constructor(withF, can) {
|
|
181
|
+
this.with = withF;
|
|
182
|
+
this.can = can;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
__decorate([
|
|
186
|
+
Field((type) => Resource),
|
|
187
|
+
__metadata("design:type", Resource)
|
|
188
|
+
], Capability.prototype, "with", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
Field((type) => [String]),
|
|
191
|
+
__metadata("design:type", Array)
|
|
192
|
+
], Capability.prototype, "can", void 0);
|
|
193
|
+
Capability = __decorate([
|
|
194
|
+
ObjectType(),
|
|
195
|
+
__metadata("design:paramtypes", [Resource, Array])
|
|
196
|
+
], Capability);
|
|
197
|
+
export { Capability };
|
|
198
|
+
let AuthInfo = class AuthInfo {
|
|
199
|
+
constructor(appName, appDesc, appUrl, capabilities, appIconPath) {
|
|
200
|
+
this.appName = appName;
|
|
201
|
+
this.appDesc = appDesc;
|
|
202
|
+
this.appIconPath = appIconPath;
|
|
203
|
+
this.appUrl = appUrl;
|
|
204
|
+
this.capabilities = capabilities;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
__decorate([
|
|
208
|
+
Field(),
|
|
209
|
+
__metadata("design:type", String)
|
|
210
|
+
], AuthInfo.prototype, "appName", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
Field(),
|
|
213
|
+
__metadata("design:type", String)
|
|
214
|
+
], AuthInfo.prototype, "appDesc", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
Field(),
|
|
217
|
+
__metadata("design:type", String)
|
|
218
|
+
], AuthInfo.prototype, "appUrl", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
Field({ nullable: true }),
|
|
221
|
+
__metadata("design:type", String)
|
|
222
|
+
], AuthInfo.prototype, "appIconPath", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
Field((type) => [Capability]),
|
|
225
|
+
__metadata("design:type", Array)
|
|
226
|
+
], AuthInfo.prototype, "capabilities", void 0);
|
|
227
|
+
AuthInfo = __decorate([
|
|
228
|
+
ObjectType(),
|
|
229
|
+
__metadata("design:paramtypes", [String, String, String, Array, String])
|
|
230
|
+
], AuthInfo);
|
|
231
|
+
export { AuthInfo };
|
|
232
|
+
let Apps = class Apps {
|
|
233
|
+
constructor(requestId, auth, token, revoked) {
|
|
234
|
+
this.requestId = requestId;
|
|
235
|
+
this.auth = auth;
|
|
236
|
+
this.token = token;
|
|
237
|
+
this.revoked = revoked;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
__decorate([
|
|
241
|
+
Field(),
|
|
242
|
+
__metadata("design:type", String)
|
|
243
|
+
], Apps.prototype, "requestId", void 0);
|
|
244
|
+
__decorate([
|
|
245
|
+
Field(),
|
|
246
|
+
__metadata("design:type", String)
|
|
247
|
+
], Apps.prototype, "token", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
Field({ nullable: true }),
|
|
250
|
+
__metadata("design:type", Boolean)
|
|
251
|
+
], Apps.prototype, "revoked", void 0);
|
|
252
|
+
__decorate([
|
|
253
|
+
Field(),
|
|
254
|
+
__metadata("design:type", AuthInfo)
|
|
255
|
+
], Apps.prototype, "auth", void 0);
|
|
256
|
+
Apps = __decorate([
|
|
257
|
+
ObjectType(),
|
|
258
|
+
__metadata("design:paramtypes", [String, AuthInfo, String, Boolean])
|
|
259
|
+
], Apps);
|
|
260
|
+
export { Apps };
|
|
261
|
+
let ResourceInput = class ResourceInput {
|
|
262
|
+
constructor(domain, pointers) {
|
|
263
|
+
this.domain = domain;
|
|
264
|
+
this.pointers = pointers;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
__decorate([
|
|
268
|
+
Field(),
|
|
269
|
+
__metadata("design:type", String)
|
|
270
|
+
], ResourceInput.prototype, "domain", void 0);
|
|
271
|
+
__decorate([
|
|
272
|
+
Field((type) => [String]),
|
|
273
|
+
__metadata("design:type", Array)
|
|
274
|
+
], ResourceInput.prototype, "pointers", void 0);
|
|
275
|
+
ResourceInput = __decorate([
|
|
276
|
+
InputType(),
|
|
277
|
+
__metadata("design:paramtypes", [String, Array])
|
|
278
|
+
], ResourceInput);
|
|
279
|
+
export { ResourceInput };
|
|
280
|
+
let CapabilityInput = class CapabilityInput {
|
|
281
|
+
constructor(withF, can) {
|
|
282
|
+
this.with = withF;
|
|
283
|
+
this.can = can;
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
__decorate([
|
|
287
|
+
Field((type) => ResourceInput),
|
|
288
|
+
__metadata("design:type", ResourceInput)
|
|
289
|
+
], CapabilityInput.prototype, "with", void 0);
|
|
290
|
+
__decorate([
|
|
291
|
+
Field((type) => [String]),
|
|
292
|
+
__metadata("design:type", Array)
|
|
293
|
+
], CapabilityInput.prototype, "can", void 0);
|
|
294
|
+
CapabilityInput = __decorate([
|
|
295
|
+
InputType(),
|
|
296
|
+
__metadata("design:paramtypes", [ResourceInput, Array])
|
|
297
|
+
], CapabilityInput);
|
|
298
|
+
export { CapabilityInput };
|
|
299
|
+
let AuthInfoInput = class AuthInfoInput {
|
|
300
|
+
constructor(appName, appDesc, appDomain, appUrl, appIconPath, capabilities) {
|
|
301
|
+
this.appName = appName;
|
|
302
|
+
this.appDesc = appDesc;
|
|
303
|
+
this.appUrl = appUrl;
|
|
304
|
+
this.appDomain = appDomain;
|
|
305
|
+
this.capabilities = capabilities;
|
|
306
|
+
this.appIconPath = appIconPath;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
__decorate([
|
|
310
|
+
Field(),
|
|
311
|
+
__metadata("design:type", String)
|
|
312
|
+
], AuthInfoInput.prototype, "appName", void 0);
|
|
313
|
+
__decorate([
|
|
314
|
+
Field(),
|
|
315
|
+
__metadata("design:type", String)
|
|
316
|
+
], AuthInfoInput.prototype, "appDesc", void 0);
|
|
317
|
+
__decorate([
|
|
318
|
+
Field(),
|
|
319
|
+
__metadata("design:type", String)
|
|
320
|
+
], AuthInfoInput.prototype, "appDomain", void 0);
|
|
321
|
+
__decorate([
|
|
322
|
+
Field({ nullable: true }),
|
|
323
|
+
__metadata("design:type", String)
|
|
324
|
+
], AuthInfoInput.prototype, "appUrl", void 0);
|
|
325
|
+
__decorate([
|
|
326
|
+
Field({ nullable: true }),
|
|
327
|
+
__metadata("design:type", String)
|
|
328
|
+
], AuthInfoInput.prototype, "appIconPath", void 0);
|
|
329
|
+
__decorate([
|
|
330
|
+
Field((type) => [CapabilityInput], { nullable: true }),
|
|
331
|
+
__metadata("design:type", Array)
|
|
332
|
+
], AuthInfoInput.prototype, "capabilities", void 0);
|
|
333
|
+
AuthInfoInput = __decorate([
|
|
334
|
+
InputType(),
|
|
335
|
+
__metadata("design:paramtypes", [String, String, String, String, String, Array])
|
|
336
|
+
], AuthInfoInput);
|
|
337
|
+
export { AuthInfoInput };
|