@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.
Files changed (161) hide show
  1. package/README.md +229 -229
  2. package/jest.config.js +5 -5
  3. package/jsdoc.json +27 -27
  4. package/lib/index.cjs +4522 -4571
  5. package/lib/index.js +4522 -4571
  6. package/lib/shims/type-graphql.d.ts +32 -32
  7. package/lib/shims/type-graphql.js +70 -70
  8. package/lib/src/Ad4mClient.d.ts +26 -26
  9. package/lib/src/Ad4mClient.js +66 -66
  10. package/lib/src/Address.d.ts +1 -1
  11. package/lib/src/Address.js +1 -1
  12. package/lib/src/DID.d.ts +1 -1
  13. package/lib/src/DID.js +1 -1
  14. package/lib/src/Exception.d.ts +6 -6
  15. package/lib/src/Exception.js +7 -7
  16. package/lib/src/Literal.d.ts +7 -7
  17. package/lib/src/Literal.js +76 -76
  18. package/lib/src/PubSub.d.ts +14 -14
  19. package/lib/src/PubSub.js +14 -14
  20. package/lib/src/SmartLiteral.d.ts +12 -12
  21. package/lib/src/SmartLiteral.js +74 -74
  22. package/lib/src/agent/Agent.d.ts +104 -104
  23. package/lib/src/agent/Agent.js +337 -337
  24. package/lib/src/agent/AgentClient.d.ts +57 -57
  25. package/lib/src/agent/AgentClient.js +431 -431
  26. package/lib/src/agent/AgentResolver.d.ts +30 -30
  27. package/lib/src/agent/AgentResolver.js +325 -325
  28. package/lib/src/agent/AgentStatus.d.ts +8 -8
  29. package/lib/src/agent/AgentStatus.js +61 -61
  30. package/lib/src/buildSchema.d.ts +1 -1
  31. package/lib/src/buildSchema.js +36 -36
  32. package/lib/src/expression/Expression.d.ts +28 -28
  33. package/lib/src/expression/Expression.js +143 -143
  34. package/lib/src/expression/ExpressionClient.d.ts +13 -13
  35. package/lib/src/expression/ExpressionClient.js +102 -102
  36. package/lib/src/expression/ExpressionRef.d.ts +9 -9
  37. package/lib/src/expression/ExpressionRef.js +67 -67
  38. package/lib/src/expression/ExpressionResolver.d.ts +10 -10
  39. package/lib/src/expression/ExpressionResolver.js +106 -106
  40. package/lib/src/index.d.ts +30 -30
  41. package/lib/src/index.js +30 -30
  42. package/lib/src/jestSetup.d.ts +1 -1
  43. package/lib/src/jestSetup.js +1 -1
  44. package/lib/src/language/Icon.d.ts +4 -4
  45. package/lib/src/language/Icon.js +24 -24
  46. package/lib/src/language/Language.d.ts +195 -195
  47. package/lib/src/language/Language.js +79 -79
  48. package/lib/src/language/LanguageClient.d.ts +17 -17
  49. package/lib/src/language/LanguageClient.js +137 -137
  50. package/lib/src/language/LanguageContext.d.ts +37 -37
  51. package/lib/src/language/LanguageContext.js +2 -2
  52. package/lib/src/language/LanguageHandle.d.ts +9 -9
  53. package/lib/src/language/LanguageHandle.js +41 -41
  54. package/lib/src/language/LanguageMeta.d.ts +35 -35
  55. package/lib/src/language/LanguageMeta.js +89 -89
  56. package/lib/src/language/LanguageRef.d.ts +6 -6
  57. package/lib/src/language/LanguageRef.js +30 -30
  58. package/lib/src/language/LanguageResolver.d.ts +19 -19
  59. package/lib/src/language/LanguageResolver.js +143 -143
  60. package/lib/src/links/Links.d.ts +39 -39
  61. package/lib/src/links/Links.js +148 -148
  62. package/lib/src/links/Links.test.d.ts +1 -1
  63. package/lib/src/links/Links.test.js +33 -33
  64. package/lib/src/neighbourhood/Neighbourhood.d.ts +10 -10
  65. package/lib/src/neighbourhood/Neighbourhood.js +38 -38
  66. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +25 -25
  67. package/lib/src/neighbourhood/NeighbourhoodClient.js +256 -256
  68. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +19 -19
  69. package/lib/src/neighbourhood/NeighbourhoodProxy.js +54 -54
  70. package/lib/src/neighbourhood/NeighbourhoodResolver.d.ts +24 -24
  71. package/lib/src/neighbourhood/NeighbourhoodResolver.js +180 -180
  72. package/lib/src/perspectives/LinkQuery.d.ts +11 -11
  73. package/lib/src/perspectives/LinkQuery.js +80 -80
  74. package/lib/src/perspectives/Perspective.d.ts +38 -38
  75. package/lib/src/perspectives/Perspective.js +144 -144
  76. package/lib/src/perspectives/Perspective.test.d.ts +1 -1
  77. package/lib/src/perspectives/Perspective.test.js +20 -20
  78. package/lib/src/perspectives/PerspectiveClient.d.ts +55 -54
  79. package/lib/src/perspectives/PerspectiveClient.js +418 -410
  80. package/lib/src/perspectives/PerspectiveDiff.d.ts +9 -9
  81. package/lib/src/perspectives/PerspectiveDiff.js +33 -33
  82. package/lib/src/perspectives/PerspectiveHandle.d.ts +16 -16
  83. package/lib/src/perspectives/PerspectiveHandle.js +59 -59
  84. package/lib/src/perspectives/PerspectiveProxy.d.ts +178 -178
  85. package/lib/src/perspectives/PerspectiveProxy.js +501 -540
  86. package/lib/src/perspectives/PerspectiveResolver.d.ts +38 -37
  87. package/lib/src/perspectives/PerspectiveResolver.js +376 -362
  88. package/lib/src/runtime/RuntimeClient.d.ts +33 -33
  89. package/lib/src/runtime/RuntimeClient.js +263 -263
  90. package/lib/src/runtime/RuntimeResolver.d.ts +47 -47
  91. package/lib/src/runtime/RuntimeResolver.js +328 -328
  92. package/lib/src/schema.gql +1 -0
  93. package/lib/src/subject/SDNADecorators.d.ts +45 -45
  94. package/lib/src/subject/SDNADecorators.js +250 -250
  95. package/lib/src/subject/Subject.d.ts +7 -7
  96. package/lib/src/subject/Subject.js +160 -160
  97. package/lib/src/subject/SubjectEntity.d.ts +31 -31
  98. package/lib/src/subject/SubjectEntity.js +250 -250
  99. package/lib/src/subject/util.d.ts +12 -12
  100. package/lib/src/subject/util.js +73 -73
  101. package/lib/src/typeDefs.d.ts +1 -1
  102. package/lib/src/typeDefs.js +1 -0
  103. package/lib/src/unwrapApolloResult.d.ts +2 -2
  104. package/lib/src/unwrapApolloResult.js +14 -12
  105. package/lib/src/utils.d.ts +2 -2
  106. package/lib/src/utils.js +21 -21
  107. package/package.json +61 -61
  108. package/rollup.config.js +26 -26
  109. package/shims/type-graphql.ts +75 -75
  110. package/src/Ad4mClient.test.ts +1089 -1084
  111. package/src/Ad4mClient.ts +62 -62
  112. package/src/Address.ts +1 -1
  113. package/src/Exception.ts +6 -6
  114. package/src/Literal.test.ts +30 -30
  115. package/src/Literal.ts +80 -80
  116. package/src/PubSub.ts +13 -13
  117. package/src/SmartLiteral.ts +74 -74
  118. package/src/agent/Agent.ts +293 -293
  119. package/src/agent/AgentClient.ts +531 -531
  120. package/src/agent/AgentResolver.ts +263 -263
  121. package/src/agent/AgentStatus.ts +43 -43
  122. package/src/buildSchema.ts +41 -41
  123. package/src/expression/Expression.ts +99 -99
  124. package/src/expression/ExpressionClient.ts +98 -98
  125. package/src/expression/ExpressionRef.ts +62 -62
  126. package/src/expression/ExpressionResolver.ts +63 -63
  127. package/src/index.ts +30 -30
  128. package/src/language/Icon.ts +10 -10
  129. package/src/language/Language.ts +266 -266
  130. package/src/language/LanguageClient.ts +159 -159
  131. package/src/language/LanguageContext.ts +37 -37
  132. package/src/language/LanguageHandle.ts +23 -23
  133. package/src/language/LanguageMeta.ts +69 -69
  134. package/src/language/LanguageRef.ts +18 -18
  135. package/src/language/LanguageResolver.ts +98 -98
  136. package/src/links/Links.test.ts +39 -39
  137. package/src/links/Links.ts +107 -107
  138. package/src/neighbourhood/Neighbourhood.ts +22 -22
  139. package/src/neighbourhood/NeighbourhoodClient.ts +275 -275
  140. package/src/neighbourhood/NeighbourhoodProxy.ts +58 -58
  141. package/src/neighbourhood/NeighbourhoodResolver.ts +99 -99
  142. package/src/perspectives/LinkQuery.ts +65 -65
  143. package/src/perspectives/Perspective.test.ts +22 -22
  144. package/src/perspectives/Perspective.ts +118 -118
  145. package/src/perspectives/PerspectiveClient.ts +452 -443
  146. package/src/perspectives/PerspectiveDiff.ts +15 -15
  147. package/src/perspectives/PerspectiveHandle.ts +39 -39
  148. package/src/perspectives/PerspectiveProxy.ts +576 -610
  149. package/src/perspectives/PerspectiveResolver.ts +224 -219
  150. package/src/runtime/RuntimeClient.ts +282 -282
  151. package/src/runtime/RuntimeResolver.ts +192 -192
  152. package/src/subject/SDNADecorators.ts +333 -333
  153. package/src/subject/Subject.ts +152 -152
  154. package/src/subject/SubjectEntity.ts +291 -291
  155. package/src/subject/util.ts +84 -84
  156. package/src/typeDefs.ts +5 -5
  157. package/src/unwrapApolloResult.ts +15 -13
  158. package/src/utils.ts +25 -25
  159. package/tsconfig-browser.json +82 -82
  160. package/tsconfig.json +80 -80
  161. package/yarn-error.log +0 -22814
@@ -1,293 +1,293 @@
1
- import { Field, ObjectType, InputType } from "type-graphql";
2
- import { Perspective } from "../perspectives/Perspective";
3
- import { ExpressionGeneric } from "../expression/Expression";
4
-
5
- /** AD4M's representation of an Agent
6
- *
7
- * AD4M Agents are build around DIDs, which are used to identify and authenticate the Agent.
8
- * Conceptually, an Agent is regarded as something that can speak and that can listen.
9
- *
10
- * Agents speak by creating Expressions in AD4M Languages which are signed by the Agent's DID key,
11
- * And they also speak (broadcast) by putting semantic statements into their public "Agent Perspective".
12
- * They listen (can receive messages) through their "direct message Language".
13
- *
14
- * These three aspects are represented by the three fields of this class.
15
- *
16
- * This class is used as format for the Expressions in the Agent language.
17
- * Since AD4M treats DID URIs as addresses for the Agent Language,
18
- * DIDs are resolved to Expressions that are objects of this class.
19
- * Thus, this is how agents see (other) agents.
20
- */
21
- @ObjectType()
22
- export class Agent {
23
- /** The DID of the Agent
24
- * All epxressions authored by them are signed with the keys mentioned
25
- * in the DID document behind this DID URI.
26
- */
27
- @Field()
28
- did: string;
29
-
30
- /** The Perspective that holds the public-facing semantics/statements of the Agent
31
- * Holds and shares a Perspective that links all information
32
- * this agent wants to offer as public-facing semantics.
33
- * This should be used for any kind of user profile information.
34
- */
35
- @Field((type) => Perspective, { nullable: true })
36
- perspective?: Perspective;
37
-
38
- /** Address of the Language by which the Agent will receive DMs */
39
- @Field({ nullable: true })
40
- directMessageLanguage?: string;
41
-
42
- constructor(did: string, perspective?: Perspective) {
43
- this.did = did;
44
- if (perspective) {
45
- this.perspective = perspective;
46
- } else {
47
- this.perspective = new Perspective();
48
- }
49
- }
50
- }
51
-
52
- @ObjectType()
53
- export class AgentExpression extends ExpressionGeneric(Agent) {}
54
-
55
- @ObjectType()
56
- export class EntanglementProof {
57
- @Field()
58
- did: string;
59
-
60
- @Field()
61
- didSigningKeyId: string;
62
-
63
- @Field()
64
- deviceKeyType: string;
65
-
66
- @Field()
67
- deviceKey: string;
68
-
69
- @Field()
70
- deviceKeySignedByDid: string;
71
-
72
- @Field({ nullable: true })
73
- didSignedByDeviceKey?: string;
74
-
75
- constructor(
76
- did: string,
77
- didSigningKeyId: string,
78
- deviceKeyType: string,
79
- deviceKey: string,
80
- deviceKeySignedByDid: string,
81
- didSignedByDeviceKey?: string
82
- ) {
83
- this.did = did;
84
- this.didSigningKeyId = didSigningKeyId;
85
- this.deviceKeyType = deviceKeyType;
86
- this.deviceKey = deviceKey;
87
- this.deviceKeySignedByDid = deviceKeySignedByDid;
88
- this.didSignedByDeviceKey = didSignedByDeviceKey;
89
- }
90
- }
91
-
92
- @InputType()
93
- export class EntanglementProofInput {
94
- @Field()
95
- did: string;
96
-
97
- @Field()
98
- didSigningKeyId: string;
99
-
100
- @Field()
101
- deviceKeyType: string;
102
-
103
- @Field()
104
- deviceKey: string;
105
-
106
- @Field()
107
- deviceKeySignedByDid: string;
108
-
109
- @Field()
110
- didSignedByDeviceKey: string;
111
-
112
- constructor(
113
- did: string,
114
- didSigningKeyId: string,
115
- deviceKeyType: string,
116
- deviceKey: string,
117
- deviceKeySignedByDid: string,
118
- didSignedByDeviceKey: string
119
- ) {
120
- this.did = did;
121
- this.didSigningKeyId = didSigningKeyId;
122
- this.deviceKeyType = deviceKeyType;
123
- this.deviceKey = deviceKey;
124
- this.deviceKeySignedByDid = deviceKeySignedByDid;
125
- this.didSignedByDeviceKey = didSignedByDeviceKey;
126
- }
127
- }
128
-
129
- @ObjectType()
130
- export class AgentSignature {
131
- @Field()
132
- signature: string;
133
-
134
- @Field()
135
- publicKey: string;
136
-
137
- constructor(signature: string, publicKey: string) {
138
- this.signature = signature;
139
- this.publicKey = publicKey;
140
- }
141
- }
142
-
143
- @ObjectType()
144
- export class Resource {
145
- @Field()
146
- domain: string;
147
-
148
- @Field((type) => [String])
149
- pointers: string[];
150
-
151
- constructor(domain: string, pointers: string[]) {
152
- this.domain = domain;
153
- this.pointers = pointers;
154
- }
155
- }
156
-
157
- @ObjectType()
158
- export class Capability {
159
- @Field((type) => Resource)
160
- with: Resource;
161
-
162
- @Field((type) => [String])
163
- can: string[];
164
-
165
- constructor(withF: Resource, can: string[]) {
166
- this.with = withF;
167
- this.can = can;
168
- }
169
- }
170
-
171
- @ObjectType()
172
- export class AuthInfo {
173
- @Field()
174
- appName: string;
175
-
176
- @Field()
177
- appDesc: string;
178
-
179
- @Field()
180
- appUrl: string;
181
-
182
- @Field({nullable: true})
183
- appIconPath?: string;
184
-
185
- @Field((type) => [Capability])
186
- capabilities: Capability[];
187
-
188
- constructor(
189
- appName: string,
190
- appDesc: string,
191
- appUrl: string,
192
- capabilities: Capability[],
193
- appIconPath?: string
194
- ) {
195
- this.appName = appName;
196
- this.appDesc = appDesc;
197
- this.appIconPath = appIconPath;
198
- this.appUrl = appUrl;
199
- this.capabilities = capabilities;
200
- }
201
- }
202
-
203
- @ObjectType()
204
- export class Apps {
205
- @Field()
206
- requestId: string;
207
-
208
- @Field()
209
- token: string;
210
-
211
- @Field({ nullable: true })
212
- revoked?: boolean;
213
-
214
- @Field()
215
- auth: AuthInfo;
216
-
217
- constructor(
218
- requestId: string,
219
- auth: AuthInfo,
220
- token: string,
221
- revoked?: boolean
222
- ) {
223
- this.requestId = requestId;
224
- this.auth = auth;
225
- this.token = token;
226
- this.revoked = revoked;
227
- }
228
- }
229
-
230
- @InputType()
231
- export class ResourceInput {
232
- @Field()
233
- domain: string;
234
-
235
- @Field((type) => [String])
236
- pointers: string[];
237
-
238
- constructor(domain: string, pointers: string[]) {
239
- this.domain = domain;
240
- this.pointers = pointers;
241
- }
242
- }
243
-
244
- @InputType()
245
- export class CapabilityInput {
246
- @Field((type) => ResourceInput)
247
- with: ResourceInput;
248
-
249
- @Field((type) => [String])
250
- can: string[];
251
-
252
- constructor(withF: ResourceInput, can: string[]) {
253
- this.with = withF;
254
- this.can = can;
255
- }
256
- }
257
-
258
- @InputType()
259
- export class AuthInfoInput {
260
- @Field()
261
- appName: string;
262
-
263
- @Field()
264
- appDesc: string;
265
-
266
- @Field()
267
- appDomain: string;
268
-
269
- @Field({ nullable: true })
270
- appUrl?: string;
271
-
272
- @Field({ nullable: true })
273
- appIconPath?: string;
274
-
275
- @Field((type) => [CapabilityInput], { nullable: true })
276
- capabilities?: CapabilityInput[];
277
-
278
- constructor(
279
- appName: string,
280
- appDesc: string,
281
- appDomain: string,
282
- appUrl?: string,
283
- appIconPath?: string,
284
- capabilities?: CapabilityInput[]
285
- ) {
286
- this.appName = appName;
287
- this.appDesc = appDesc;
288
- this.appUrl = appUrl;
289
- this.appDomain = appDomain;
290
- this.capabilities = capabilities;
291
- this.appIconPath = appIconPath;
292
- }
293
- }
1
+ import { Field, ObjectType, InputType } from "type-graphql";
2
+ import { Perspective } from "../perspectives/Perspective";
3
+ import { ExpressionGeneric } from "../expression/Expression";
4
+
5
+ /** AD4M's representation of an Agent
6
+ *
7
+ * AD4M Agents are build around DIDs, which are used to identify and authenticate the Agent.
8
+ * Conceptually, an Agent is regarded as something that can speak and that can listen.
9
+ *
10
+ * Agents speak by creating Expressions in AD4M Languages which are signed by the Agent's DID key,
11
+ * And they also speak (broadcast) by putting semantic statements into their public "Agent Perspective".
12
+ * They listen (can receive messages) through their "direct message Language".
13
+ *
14
+ * These three aspects are represented by the three fields of this class.
15
+ *
16
+ * This class is used as format for the Expressions in the Agent language.
17
+ * Since AD4M treats DID URIs as addresses for the Agent Language,
18
+ * DIDs are resolved to Expressions that are objects of this class.
19
+ * Thus, this is how agents see (other) agents.
20
+ */
21
+ @ObjectType()
22
+ export class Agent {
23
+ /** The DID of the Agent
24
+ * All epxressions authored by them are signed with the keys mentioned
25
+ * in the DID document behind this DID URI.
26
+ */
27
+ @Field()
28
+ did: string;
29
+
30
+ /** The Perspective that holds the public-facing semantics/statements of the Agent
31
+ * Holds and shares a Perspective that links all information
32
+ * this agent wants to offer as public-facing semantics.
33
+ * This should be used for any kind of user profile information.
34
+ */
35
+ @Field((type) => Perspective, { nullable: true })
36
+ perspective?: Perspective;
37
+
38
+ /** Address of the Language by which the Agent will receive DMs */
39
+ @Field({ nullable: true })
40
+ directMessageLanguage?: string;
41
+
42
+ constructor(did: string, perspective?: Perspective) {
43
+ this.did = did;
44
+ if (perspective) {
45
+ this.perspective = perspective;
46
+ } else {
47
+ this.perspective = new Perspective();
48
+ }
49
+ }
50
+ }
51
+
52
+ @ObjectType()
53
+ export class AgentExpression extends ExpressionGeneric(Agent) {}
54
+
55
+ @ObjectType()
56
+ export class EntanglementProof {
57
+ @Field()
58
+ did: string;
59
+
60
+ @Field()
61
+ didSigningKeyId: string;
62
+
63
+ @Field()
64
+ deviceKeyType: string;
65
+
66
+ @Field()
67
+ deviceKey: string;
68
+
69
+ @Field()
70
+ deviceKeySignedByDid: string;
71
+
72
+ @Field({ nullable: true })
73
+ didSignedByDeviceKey?: string;
74
+
75
+ constructor(
76
+ did: string,
77
+ didSigningKeyId: string,
78
+ deviceKeyType: string,
79
+ deviceKey: string,
80
+ deviceKeySignedByDid: string,
81
+ didSignedByDeviceKey?: string
82
+ ) {
83
+ this.did = did;
84
+ this.didSigningKeyId = didSigningKeyId;
85
+ this.deviceKeyType = deviceKeyType;
86
+ this.deviceKey = deviceKey;
87
+ this.deviceKeySignedByDid = deviceKeySignedByDid;
88
+ this.didSignedByDeviceKey = didSignedByDeviceKey;
89
+ }
90
+ }
91
+
92
+ @InputType()
93
+ export class EntanglementProofInput {
94
+ @Field()
95
+ did: string;
96
+
97
+ @Field()
98
+ didSigningKeyId: string;
99
+
100
+ @Field()
101
+ deviceKeyType: string;
102
+
103
+ @Field()
104
+ deviceKey: string;
105
+
106
+ @Field()
107
+ deviceKeySignedByDid: string;
108
+
109
+ @Field()
110
+ didSignedByDeviceKey: string;
111
+
112
+ constructor(
113
+ did: string,
114
+ didSigningKeyId: string,
115
+ deviceKeyType: string,
116
+ deviceKey: string,
117
+ deviceKeySignedByDid: string,
118
+ didSignedByDeviceKey: string
119
+ ) {
120
+ this.did = did;
121
+ this.didSigningKeyId = didSigningKeyId;
122
+ this.deviceKeyType = deviceKeyType;
123
+ this.deviceKey = deviceKey;
124
+ this.deviceKeySignedByDid = deviceKeySignedByDid;
125
+ this.didSignedByDeviceKey = didSignedByDeviceKey;
126
+ }
127
+ }
128
+
129
+ @ObjectType()
130
+ export class AgentSignature {
131
+ @Field()
132
+ signature: string;
133
+
134
+ @Field()
135
+ publicKey: string;
136
+
137
+ constructor(signature: string, publicKey: string) {
138
+ this.signature = signature;
139
+ this.publicKey = publicKey;
140
+ }
141
+ }
142
+
143
+ @ObjectType()
144
+ export class Resource {
145
+ @Field()
146
+ domain: string;
147
+
148
+ @Field((type) => [String])
149
+ pointers: string[];
150
+
151
+ constructor(domain: string, pointers: string[]) {
152
+ this.domain = domain;
153
+ this.pointers = pointers;
154
+ }
155
+ }
156
+
157
+ @ObjectType()
158
+ export class Capability {
159
+ @Field((type) => Resource)
160
+ with: Resource;
161
+
162
+ @Field((type) => [String])
163
+ can: string[];
164
+
165
+ constructor(withF: Resource, can: string[]) {
166
+ this.with = withF;
167
+ this.can = can;
168
+ }
169
+ }
170
+
171
+ @ObjectType()
172
+ export class AuthInfo {
173
+ @Field()
174
+ appName: string;
175
+
176
+ @Field()
177
+ appDesc: string;
178
+
179
+ @Field()
180
+ appUrl: string;
181
+
182
+ @Field({nullable: true})
183
+ appIconPath?: string;
184
+
185
+ @Field((type) => [Capability])
186
+ capabilities: Capability[];
187
+
188
+ constructor(
189
+ appName: string,
190
+ appDesc: string,
191
+ appUrl: string,
192
+ capabilities: Capability[],
193
+ appIconPath?: string
194
+ ) {
195
+ this.appName = appName;
196
+ this.appDesc = appDesc;
197
+ this.appIconPath = appIconPath;
198
+ this.appUrl = appUrl;
199
+ this.capabilities = capabilities;
200
+ }
201
+ }
202
+
203
+ @ObjectType()
204
+ export class Apps {
205
+ @Field()
206
+ requestId: string;
207
+
208
+ @Field()
209
+ token: string;
210
+
211
+ @Field({ nullable: true })
212
+ revoked?: boolean;
213
+
214
+ @Field()
215
+ auth: AuthInfo;
216
+
217
+ constructor(
218
+ requestId: string,
219
+ auth: AuthInfo,
220
+ token: string,
221
+ revoked?: boolean
222
+ ) {
223
+ this.requestId = requestId;
224
+ this.auth = auth;
225
+ this.token = token;
226
+ this.revoked = revoked;
227
+ }
228
+ }
229
+
230
+ @InputType()
231
+ export class ResourceInput {
232
+ @Field()
233
+ domain: string;
234
+
235
+ @Field((type) => [String])
236
+ pointers: string[];
237
+
238
+ constructor(domain: string, pointers: string[]) {
239
+ this.domain = domain;
240
+ this.pointers = pointers;
241
+ }
242
+ }
243
+
244
+ @InputType()
245
+ export class CapabilityInput {
246
+ @Field((type) => ResourceInput)
247
+ with: ResourceInput;
248
+
249
+ @Field((type) => [String])
250
+ can: string[];
251
+
252
+ constructor(withF: ResourceInput, can: string[]) {
253
+ this.with = withF;
254
+ this.can = can;
255
+ }
256
+ }
257
+
258
+ @InputType()
259
+ export class AuthInfoInput {
260
+ @Field()
261
+ appName: string;
262
+
263
+ @Field()
264
+ appDesc: string;
265
+
266
+ @Field()
267
+ appDomain: string;
268
+
269
+ @Field({ nullable: true })
270
+ appUrl?: string;
271
+
272
+ @Field({ nullable: true })
273
+ appIconPath?: string;
274
+
275
+ @Field((type) => [CapabilityInput], { nullable: true })
276
+ capabilities?: CapabilityInput[];
277
+
278
+ constructor(
279
+ appName: string,
280
+ appDesc: string,
281
+ appDomain: string,
282
+ appUrl?: string,
283
+ appIconPath?: string,
284
+ capabilities?: CapabilityInput[]
285
+ ) {
286
+ this.appName = appName;
287
+ this.appDesc = appDesc;
288
+ this.appUrl = appUrl;
289
+ this.appDomain = appDomain;
290
+ this.capabilities = capabilities;
291
+ this.appIconPath = appIconPath;
292
+ }
293
+ }