@coasys/ad4m 0.8.0-fix

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 (167) hide show
  1. package/README.md +229 -0
  2. package/jest-setup.ts +1 -0
  3. package/jest.config.js +6 -0
  4. package/jsdoc.json +28 -0
  5. package/lib/index.cjs +8165 -0
  6. package/lib/index.js +8130 -0
  7. package/lib/shims/reflect-metadata.d.ts +0 -0
  8. package/lib/shims/reflect-metadata.js +0 -0
  9. package/lib/shims/type-graphql.d.ts +32 -0
  10. package/lib/shims/type-graphql.js +70 -0
  11. package/lib/src/Ad4mClient.d.ts +26 -0
  12. package/lib/src/Ad4mClient.js +66 -0
  13. package/lib/src/Address.d.ts +1 -0
  14. package/lib/src/Address.js +1 -0
  15. package/lib/src/DID.d.ts +1 -0
  16. package/lib/src/DID.js +1 -0
  17. package/lib/src/Exception.d.ts +6 -0
  18. package/lib/src/Exception.js +7 -0
  19. package/lib/src/Literal.d.ts +7 -0
  20. package/lib/src/Literal.js +76 -0
  21. package/lib/src/PubSub.d.ts +14 -0
  22. package/lib/src/PubSub.js +14 -0
  23. package/lib/src/SmartLiteral.d.ts +12 -0
  24. package/lib/src/SmartLiteral.js +74 -0
  25. package/lib/src/agent/Agent.d.ts +104 -0
  26. package/lib/src/agent/Agent.js +337 -0
  27. package/lib/src/agent/AgentClient.d.ts +57 -0
  28. package/lib/src/agent/AgentClient.js +431 -0
  29. package/lib/src/agent/AgentResolver.d.ts +30 -0
  30. package/lib/src/agent/AgentResolver.js +325 -0
  31. package/lib/src/agent/AgentStatus.d.ts +8 -0
  32. package/lib/src/agent/AgentStatus.js +61 -0
  33. package/lib/src/buildSchema.d.ts +1 -0
  34. package/lib/src/buildSchema.js +36 -0
  35. package/lib/src/expression/Expression.d.ts +28 -0
  36. package/lib/src/expression/Expression.js +143 -0
  37. package/lib/src/expression/ExpressionClient.d.ts +13 -0
  38. package/lib/src/expression/ExpressionClient.js +102 -0
  39. package/lib/src/expression/ExpressionRef.d.ts +9 -0
  40. package/lib/src/expression/ExpressionRef.js +67 -0
  41. package/lib/src/expression/ExpressionResolver.d.ts +10 -0
  42. package/lib/src/expression/ExpressionResolver.js +106 -0
  43. package/lib/src/index.d.ts +30 -0
  44. package/lib/src/index.js +30 -0
  45. package/lib/src/jestSetup.d.ts +1 -0
  46. package/lib/src/jestSetup.js +1 -0
  47. package/lib/src/language/Icon.d.ts +4 -0
  48. package/lib/src/language/Icon.js +24 -0
  49. package/lib/src/language/Language.d.ts +195 -0
  50. package/lib/src/language/Language.js +79 -0
  51. package/lib/src/language/LanguageClient.d.ts +17 -0
  52. package/lib/src/language/LanguageClient.js +137 -0
  53. package/lib/src/language/LanguageContext.d.ts +37 -0
  54. package/lib/src/language/LanguageContext.js +2 -0
  55. package/lib/src/language/LanguageHandle.d.ts +9 -0
  56. package/lib/src/language/LanguageHandle.js +41 -0
  57. package/lib/src/language/LanguageMeta.d.ts +35 -0
  58. package/lib/src/language/LanguageMeta.js +89 -0
  59. package/lib/src/language/LanguageRef.d.ts +6 -0
  60. package/lib/src/language/LanguageRef.js +30 -0
  61. package/lib/src/language/LanguageResolver.d.ts +19 -0
  62. package/lib/src/language/LanguageResolver.js +143 -0
  63. package/lib/src/links/Links.d.ts +39 -0
  64. package/lib/src/links/Links.js +148 -0
  65. package/lib/src/links/Links.test.d.ts +1 -0
  66. package/lib/src/links/Links.test.js +33 -0
  67. package/lib/src/neighbourhood/Neighbourhood.d.ts +10 -0
  68. package/lib/src/neighbourhood/Neighbourhood.js +38 -0
  69. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +25 -0
  70. package/lib/src/neighbourhood/NeighbourhoodClient.js +256 -0
  71. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +19 -0
  72. package/lib/src/neighbourhood/NeighbourhoodProxy.js +54 -0
  73. package/lib/src/neighbourhood/NeighbourhoodResolver.d.ts +24 -0
  74. package/lib/src/neighbourhood/NeighbourhoodResolver.js +180 -0
  75. package/lib/src/perspectives/LinkQuery.d.ts +11 -0
  76. package/lib/src/perspectives/LinkQuery.js +80 -0
  77. package/lib/src/perspectives/Perspective.d.ts +38 -0
  78. package/lib/src/perspectives/Perspective.js +144 -0
  79. package/lib/src/perspectives/Perspective.test.d.ts +1 -0
  80. package/lib/src/perspectives/Perspective.test.js +20 -0
  81. package/lib/src/perspectives/PerspectiveClient.d.ts +54 -0
  82. package/lib/src/perspectives/PerspectiveClient.js +410 -0
  83. package/lib/src/perspectives/PerspectiveDiff.d.ts +9 -0
  84. package/lib/src/perspectives/PerspectiveDiff.js +33 -0
  85. package/lib/src/perspectives/PerspectiveHandle.d.ts +16 -0
  86. package/lib/src/perspectives/PerspectiveHandle.js +59 -0
  87. package/lib/src/perspectives/PerspectiveProxy.d.ts +178 -0
  88. package/lib/src/perspectives/PerspectiveProxy.js +540 -0
  89. package/lib/src/perspectives/PerspectiveResolver.d.ts +37 -0
  90. package/lib/src/perspectives/PerspectiveResolver.js +362 -0
  91. package/lib/src/runtime/RuntimeClient.d.ts +33 -0
  92. package/lib/src/runtime/RuntimeClient.js +263 -0
  93. package/lib/src/runtime/RuntimeResolver.d.ts +47 -0
  94. package/lib/src/runtime/RuntimeResolver.js +328 -0
  95. package/lib/src/schema.gql +382 -0
  96. package/lib/src/subject/SDNADecorators.d.ts +45 -0
  97. package/lib/src/subject/SDNADecorators.js +250 -0
  98. package/lib/src/subject/Subject.d.ts +7 -0
  99. package/lib/src/subject/Subject.js +160 -0
  100. package/lib/src/subject/SubjectEntity.d.ts +31 -0
  101. package/lib/src/subject/SubjectEntity.js +250 -0
  102. package/lib/src/subject/util.d.ts +12 -0
  103. package/lib/src/subject/util.js +73 -0
  104. package/lib/src/typeDefs.d.ts +1 -0
  105. package/lib/src/typeDefs.js +379 -0
  106. package/lib/src/unwrapApolloResult.d.ts +2 -0
  107. package/lib/src/unwrapApolloResult.js +12 -0
  108. package/lib/src/utils.d.ts +2 -0
  109. package/lib/src/utils.js +21 -0
  110. package/package.json +61 -0
  111. package/rollup.config.js +27 -0
  112. package/shims/reflect-metadata.ts +0 -0
  113. package/shims/type-graphql.ts +75 -0
  114. package/src/Ad4mClient.test.ts +1085 -0
  115. package/src/Ad4mClient.ts +63 -0
  116. package/src/Address.ts +1 -0
  117. package/src/DID.ts +1 -0
  118. package/src/Exception.ts +6 -0
  119. package/src/Literal.test.ts +31 -0
  120. package/src/Literal.ts +81 -0
  121. package/src/PubSub.ts +14 -0
  122. package/src/SmartLiteral.ts +75 -0
  123. package/src/agent/Agent.ts +293 -0
  124. package/src/agent/AgentClient.ts +531 -0
  125. package/src/agent/AgentResolver.ts +263 -0
  126. package/src/agent/AgentStatus.ts +44 -0
  127. package/src/buildSchema.ts +41 -0
  128. package/src/expression/Expression.ts +99 -0
  129. package/src/expression/ExpressionClient.ts +99 -0
  130. package/src/expression/ExpressionRef.ts +63 -0
  131. package/src/expression/ExpressionResolver.ts +64 -0
  132. package/src/index.ts +30 -0
  133. package/src/jestSetup.ts +1 -0
  134. package/src/language/Icon.ts +11 -0
  135. package/src/language/Language.ts +266 -0
  136. package/src/language/LanguageClient.ts +160 -0
  137. package/src/language/LanguageContext.ts +37 -0
  138. package/src/language/LanguageHandle.ts +23 -0
  139. package/src/language/LanguageMeta.ts +70 -0
  140. package/src/language/LanguageRef.ts +18 -0
  141. package/src/language/LanguageResolver.ts +98 -0
  142. package/src/links/Links.test.ts +40 -0
  143. package/src/links/Links.ts +107 -0
  144. package/src/neighbourhood/Neighbourhood.ts +22 -0
  145. package/src/neighbourhood/NeighbourhoodClient.ts +276 -0
  146. package/src/neighbourhood/NeighbourhoodProxy.ts +58 -0
  147. package/src/neighbourhood/NeighbourhoodResolver.ts +100 -0
  148. package/src/perspectives/LinkQuery.ts +66 -0
  149. package/src/perspectives/Perspective.test.ts +23 -0
  150. package/src/perspectives/Perspective.ts +118 -0
  151. package/src/perspectives/PerspectiveClient.ts +444 -0
  152. package/src/perspectives/PerspectiveDiff.ts +15 -0
  153. package/src/perspectives/PerspectiveHandle.ts +39 -0
  154. package/src/perspectives/PerspectiveProxy.ts +611 -0
  155. package/src/perspectives/PerspectiveResolver.ts +220 -0
  156. package/src/runtime/RuntimeClient.ts +283 -0
  157. package/src/runtime/RuntimeResolver.ts +193 -0
  158. package/src/subject/SDNADecorators.ts +334 -0
  159. package/src/subject/Subject.ts +153 -0
  160. package/src/subject/SubjectEntity.ts +292 -0
  161. package/src/subject/util.ts +85 -0
  162. package/src/typeDefs.ts +6 -0
  163. package/src/unwrapApolloResult.ts +14 -0
  164. package/src/utils.ts +25 -0
  165. package/tsconfig-browser.json +82 -0
  166. package/tsconfig.json +80 -0
  167. package/yarn-error.log +22814 -0
@@ -0,0 +1,379 @@
1
+
2
+ export const typeDefsString = `
3
+ type Agent {
4
+ did: String!
5
+ directMessageLanguage: String
6
+ perspective: Perspective
7
+ }
8
+
9
+ type AgentSignature {
10
+ publicKey: String!
11
+ signature: String!
12
+ }
13
+
14
+ type AgentStatus {
15
+ did: String
16
+ didDocument: String
17
+ error: String
18
+ isInitialized: Boolean!
19
+ isUnlocked: Boolean!
20
+ }
21
+
22
+ type Apps {
23
+ auth: AuthInfo!
24
+ requestId: String!
25
+ revoked: Boolean
26
+ token: String!
27
+ }
28
+
29
+ type AuthInfo {
30
+ appDesc: String!
31
+ appIconPath: String
32
+ appName: String!
33
+ appUrl: String!
34
+ capabilities: [Capability!]!
35
+ }
36
+
37
+ input AuthInfoInput {
38
+ appDesc: String!
39
+ appDomain: String!
40
+ appIconPath: String
41
+ appName: String!
42
+ appUrl: String
43
+ capabilities: [CapabilityInput!]
44
+ }
45
+
46
+ type Capability {
47
+ can: [String!]!
48
+ with: Resource!
49
+ }
50
+
51
+ input CapabilityInput {
52
+ can: [String!]!
53
+ with: ResourceInput!
54
+ }
55
+
56
+ scalar DateTime
57
+
58
+ type EntanglementProof {
59
+ deviceKey: String!
60
+ deviceKeySignedByDid: String!
61
+ deviceKeyType: String!
62
+ did: String!
63
+ didSignedByDeviceKey: String
64
+ didSigningKeyId: String!
65
+ }
66
+
67
+ input EntanglementProofInput {
68
+ deviceKey: String!
69
+ deviceKeySignedByDid: String!
70
+ deviceKeyType: String!
71
+ did: String!
72
+ didSignedByDeviceKey: String!
73
+ didSigningKeyId: String!
74
+ }
75
+
76
+ type ExceptionInfo {
77
+ addon: String
78
+ message: String!
79
+ title: String!
80
+ type: Float!
81
+ }
82
+
83
+ type ExpressionProof {
84
+ invalid: Boolean
85
+ key: String
86
+ signature: String
87
+ valid: Boolean
88
+ }
89
+
90
+ input ExpressionProofInput {
91
+ invalid: Boolean
92
+ key: String
93
+ signature: String
94
+ valid: Boolean
95
+ }
96
+
97
+ type ExpressionRendered {
98
+ author: String!
99
+ data: String!
100
+ icon: Icon!
101
+ language: LanguageRef!
102
+ proof: ExpressionProof!
103
+ timestamp: String!
104
+ }
105
+
106
+ type Icon {
107
+ code: String!
108
+ }
109
+
110
+ input InteractionCall {
111
+ name: String!
112
+ parametersStringified: String!
113
+ }
114
+
115
+ type InteractionMeta {
116
+ label: String!
117
+ name: String!
118
+ parameters: [InteractionParameter!]!
119
+ }
120
+
121
+ type InteractionParameter {
122
+ name: String!
123
+ type: String!
124
+ }
125
+
126
+ type LanguageHandle {
127
+ address: String!
128
+ constructorIcon: Icon
129
+ icon: Icon
130
+ name: String!
131
+ settings: String
132
+ settingsIcon: Icon
133
+ }
134
+
135
+ type LanguageMeta {
136
+ address: String!
137
+ author: String!
138
+ description: String
139
+ name: String!
140
+ possibleTemplateParams: [String!]
141
+ sourceCodeLink: String
142
+ templateAppliedParams: String
143
+ templateSourceLanguageAddress: String
144
+ templated: Boolean
145
+ }
146
+
147
+ input LanguageMetaInput {
148
+ description: String = ""
149
+ name: String!
150
+ possibleTemplateParams: [String!]
151
+ sourceCodeLink: String
152
+ }
153
+
154
+ type LanguageRef {
155
+ address: String!
156
+ name: String!
157
+ }
158
+
159
+ type Link {
160
+ predicate: String
161
+ source: String!
162
+ target: String!
163
+ }
164
+
165
+ type LinkExpression {
166
+ author: String!
167
+ data: Link!
168
+ proof: ExpressionProof!
169
+ status: String
170
+ timestamp: String!
171
+ }
172
+
173
+ input LinkExpressionInput {
174
+ author: String!
175
+ data: LinkInput!
176
+ proof: ExpressionProofInput!
177
+ status: String = "shared"
178
+ timestamp: String!
179
+ }
180
+
181
+ type LinkExpressionMutations {
182
+ additions: [LinkExpression!]!
183
+ removals: [LinkExpression!]!
184
+ }
185
+
186
+ type LinkExpressionUpdated {
187
+ newLink: LinkExpression!
188
+ oldLink: LinkExpression!
189
+ }
190
+
191
+ input LinkInput {
192
+ predicate: String
193
+ source: String!
194
+ target: String!
195
+ }
196
+
197
+ input LinkMutations {
198
+ additions: [LinkInput!]!
199
+ removals: [LinkExpressionInput!]!
200
+ }
201
+
202
+ input LinkQuery {
203
+ fromDate: DateTime
204
+ limit: Float
205
+ predicate: String
206
+ source: String
207
+ target: String
208
+ untilDate: DateTime
209
+ }
210
+
211
+ type Mutation {
212
+ addTrustedAgents(agents: [String!]!): [String!]!
213
+ agentAddEntanglementProofs(proofs: [EntanglementProofInput!]!): [EntanglementProof!]!
214
+ agentDeleteEntanglementProofs(proofs: [EntanglementProofInput!]!): [EntanglementProof!]!
215
+ agentEntanglementProofPreFlight(deviceKey: String!, deviceKeyType: String!): EntanglementProof!
216
+ agentGenerate(passphrase: String!): AgentStatus!
217
+ agentGenerateJwt(rand: String!, requestId: String!): String!
218
+ agentImport(did: String!, didDocument: String!, keystore: String!, passphrase: String!): AgentStatus!
219
+ agentLock(passphrase: String!): AgentStatus!
220
+ agentPermitCapability(auth: String!): String!
221
+ agentRemoveApp(requestId: String!): [Apps!]!
222
+ agentRequestCapability(authInfo: AuthInfoInput!): String!
223
+ agentRevokeToken(requestId: String!): [Apps!]!
224
+ agentSignMessage(message: String!): AgentSignature!
225
+ agentUnlock(holochain: Boolean!, passphrase: String!): AgentStatus!
226
+ agentUpdateDirectMessageLanguage(directMessageLanguage: String!): Agent!
227
+ agentUpdatePublicPerspective(perspective: PerspectiveInput!): Agent!
228
+ deleteTrustedAgents(agents: [String!]!): [String!]!
229
+ expressionCreate(content: String!, languageAddress: String!): String!
230
+ expressionInteract(interactionCall: InteractionCall!, url: String!): String
231
+ languageApplyTemplateAndPublish(sourceLanguageHash: String!, templateData: String!): LanguageRef!
232
+ languagePublish(languageMeta: LanguageMetaInput!, languagePath: String!): LanguageMeta!
233
+ languageRemove(address: String!): Boolean!
234
+ languageWriteSettings(languageAddress: String!, settings: String!): Boolean!
235
+ neighbourhoodJoinFromUrl(url: String!): PerspectiveHandle!
236
+ neighbourhoodPublishFromPerspective(linkLanguage: String!, meta: PerspectiveInput!, perspectiveUUID: String!): String!
237
+ neighbourhoodSendBroadcast(payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
238
+ neighbourhoodSendBroadcastU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
239
+ neighbourhoodSendSignal(payload: PerspectiveInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
240
+ neighbourhoodSendSignalU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
241
+ neighbourhoodSetOnlineStatus(perspectiveUUID: String!, status: PerspectiveInput!): Boolean!
242
+ neighbourhoodSetOnlineStatusU(perspectiveUUID: String!, status: PerspectiveUnsignedInput!): Boolean!
243
+ perspectiveAdd(name: String!): PerspectiveHandle!
244
+ perspectiveAddLink(link: LinkInput!, status: String = "shared", uuid: String!): LinkExpression!
245
+ perspectiveAddLinkExpression(link: LinkExpressionInput!, status: String, uuid: String!): LinkExpression!
246
+ perspectiveAddLinks(links: [LinkInput!]!, status: String, uuid: String!): [LinkExpression!]!
247
+ perspectiveLinkMutations(mutations: LinkMutations!, status: String, uuid: String!): LinkExpressionMutations!
248
+ perspectivePublishSnapshot(uuid: String!): String
249
+ perspectiveRemove(uuid: String!): Boolean!
250
+ perspectiveRemoveLink(link: LinkExpressionInput!, uuid: String!): Boolean!
251
+ perspectiveRemoveLinks(links: [LinkExpressionInput!]!, uuid: String!): [LinkExpression!]!
252
+ perspectiveUpdate(name: String!, uuid: String!): PerspectiveHandle
253
+ perspectiveUpdateLink(newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
254
+ runtimeAddFriends(dids: [String!]!): [String!]!
255
+ runtimeAddKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
256
+ runtimeFriendSendMessage(did: String!, message: PerspectiveInput!): Boolean!
257
+ runtimeHcAddAgentInfos(agentInfos: String!): Boolean!
258
+ runtimeOpenLink(url: String!): Boolean!
259
+ runtimeQuit: Boolean!
260
+ runtimeRemoveFriends(dids: [String!]!): [String!]!
261
+ runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
262
+ runtimeSetStatus(status: PerspectiveInput!): Boolean!
263
+ }
264
+
265
+ type Neighbourhood {
266
+ linkLanguage: String!
267
+ meta: Perspective!
268
+ }
269
+
270
+ type NeighbourhoodExpression {
271
+ author: String!
272
+ data: Neighbourhood!
273
+ proof: ExpressionProof!
274
+ timestamp: String!
275
+ }
276
+
277
+ type OnlineAgent {
278
+ did: String!
279
+ status: PerspectiveExpression!
280
+ }
281
+
282
+ type Perspective {
283
+ links: [LinkExpression!]!
284
+ }
285
+
286
+ type PerspectiveExpression {
287
+ author: String!
288
+ data: Perspective!
289
+ proof: ExpressionProof!
290
+ timestamp: String!
291
+ }
292
+
293
+ type PerspectiveHandle {
294
+ name: String!
295
+ neighbourhood: NeighbourhoodExpression
296
+ sharedUrl: String
297
+ state: String!
298
+ uuid: String!
299
+ }
300
+
301
+ input PerspectiveInput {
302
+ links: [LinkExpressionInput!]!
303
+ }
304
+
305
+ input PerspectiveUnsignedInput {
306
+ links: [LinkInput!] = []
307
+ }
308
+
309
+ type Query {
310
+ agent: Agent!
311
+ agentByDID(did: String!): Agent
312
+ agentGetApps: [Apps!]!
313
+ agentGetEntanglementProofs: [EntanglementProof!]!
314
+ agentIsLocked: Boolean!
315
+ agentStatus: AgentStatus!
316
+ expression(url: String!): ExpressionRendered
317
+ expressionInteractions(url: String!): [InteractionMeta!]!
318
+ expressionMany(urls: [String!]!): [ExpressionRendered]!
319
+ expressionRaw(url: String!): String
320
+ getTrustedAgents: [String!]!
321
+ language(address: String!): LanguageHandle
322
+ languageMeta(address: String!): LanguageMeta!
323
+ languageSource(address: String!): String!
324
+ languages(filter: String): [LanguageHandle!]!
325
+ neighbourhoodHasTelepresenceAdapter(perspectiveUUID: String!): Boolean!
326
+ neighbourhoodOnlineAgents(perspectiveUUID: String!): [OnlineAgent!]!
327
+ neighbourhoodOtherAgents(perspectiveUUID: String!): [String!]!
328
+ perspective(uuid: String!): PerspectiveHandle
329
+ perspectiveQueryLinks(query: LinkQuery!, uuid: String!): [LinkExpression!]
330
+ perspectiveQueryProlog(query: String!, uuid: String!): String!
331
+ perspectiveSnapshot(uuid: String!): Perspective
332
+ perspectives: [PerspectiveHandle!]!
333
+ runtimeFriendStatus(did: String!): PerspectiveExpression
334
+ runtimeFriends: [String!]!
335
+ runtimeHcAgentInfos: String!
336
+ runtimeInfo: RuntimeInfo!
337
+ runtimeKnownLinkLanguageTemplates: [String!]!
338
+ runtimeMessageInbox(filter: String): [PerspectiveExpression!]!
339
+ runtimeMessageOutbox(filter: String): [SentMessage!]!
340
+ runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
341
+ }
342
+
343
+ type Resource {
344
+ domain: String!
345
+ pointers: [String!]!
346
+ }
347
+
348
+ input ResourceInput {
349
+ domain: String!
350
+ pointers: [String!]!
351
+ }
352
+
353
+ type RuntimeInfo {
354
+ ad4mExecutorVersion: String!
355
+ isInitialized: Boolean!
356
+ isUnlocked: Boolean!
357
+ }
358
+
359
+ type SentMessage {
360
+ message: PerspectiveExpression!
361
+ recipient: String!
362
+ }
363
+
364
+ type Subscription {
365
+ agentAppsChanged: [Apps!]
366
+ agentStatusChanged: AgentStatus
367
+ agentUpdated: Agent
368
+ exceptionOccurred: ExceptionInfo
369
+ neighbourhoodSignal(perspectiveUUID: String!): PerspectiveExpression
370
+ perspectiveAdded: PerspectiveHandle
371
+ perspectiveLinkAdded(uuid: String!): LinkExpression
372
+ perspectiveLinkRemoved(uuid: String!): LinkExpression
373
+ perspectiveLinkUpdated(uuid: String!): LinkExpressionUpdated
374
+ perspectiveRemoved: String
375
+ perspectiveSyncStateChange(uuid: String!): String!
376
+ perspectiveUpdated: PerspectiveHandle
377
+ runtimeMessageReceived: PerspectiveExpression
378
+ }
379
+ `
@@ -0,0 +1,2 @@
1
+ import { ApolloQueryResult, FetchResult } from "@apollo/client/core";
2
+ export default function unwrapApolloResult(result: ApolloQueryResult<any> | FetchResult<any>): any;
@@ -0,0 +1,12 @@
1
+ export default function unwrapApolloResult(result) {
2
+ //console.debug('GQL result:', result)
3
+ //@ts-ignore
4
+ if (result.error) {
5
+ //@ts-ignore
6
+ throw result.error;
7
+ }
8
+ if (result.errors) {
9
+ throw result.errors;
10
+ }
11
+ return result.data;
12
+ }
@@ -0,0 +1,2 @@
1
+ export declare function formatList(list: any): any;
2
+ export declare function capSentence(cap: any): string;
@@ -0,0 +1,21 @@
1
+ export function formatList(list) {
2
+ if (!list?.length) {
3
+ return "";
4
+ }
5
+ if (list.length === 1) {
6
+ return list.toString();
7
+ }
8
+ if (list.length === 2) {
9
+ return list.join(' and ');
10
+ }
11
+ return list.slice(0, -1).join(', ') + ', and ' + list.slice(-1);
12
+ }
13
+ ;
14
+ export function capSentence(cap) {
15
+ const can = cap.can.includes("*") ? ["READ", "WRITE", "UPDATE"] : cap.can;
16
+ const domain = cap.with.domain === "*" ? "" : cap.with.domain;
17
+ const pointers = cap.with.pointers.includes("*")
18
+ ? ["all AD4M data"]
19
+ : cap.with.pointers;
20
+ return `${formatList(can)} your ${domain} actions, with access to ${formatList(pointers)}`;
21
+ }
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@coasys/ad4m",
3
+ "description": "*The Agent-Centric Distributed Application Meta-ontology* or just: *Agent-Centric DApp Meta-ontology* * A new meta-ontology for interoperable, decentralized application design * A spanning-layer to enable seamless integration between Holochain DNAs, blockchains, linked-data structures/ontologies and centralized back-ends * The basis for turning distinct, monolithic and siloed apps into a global, open and interoperable sense-making network",
4
+ "main": "lib/index.cjs",
5
+ "module": "lib/index.js",
6
+ "types": "lib/src/index.d.ts",
7
+ "type": "module",
8
+ "private": false,
9
+ "scripts": {
10
+ "build": "patch-package && tsc && pnpm run buildSchema && pnpm run bundle",
11
+ "buildSchema": "node --es-module-specifier-resolution=node lib/src/buildSchema.js",
12
+ "bundle": "rollup -c rollup.config.js",
13
+ "test": "jest --forceExit"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/perspect3vism/ad4m.git"
18
+ },
19
+ "author": {
20
+ "name": "Nicolas Luck",
21
+ "email": "nicolas@lucksus.eu"
22
+ },
23
+ "contributors": [
24
+ {
25
+ "name": "Joshua Parkin",
26
+ "email": "joshuadparkin@gmail.com"
27
+ }
28
+ ],
29
+ "license": "CAL-1.0",
30
+ "bugs": {
31
+ "url": "https://github.com/perspect3vism/ad4m/issues"
32
+ },
33
+ "homepage": "https://ad4m.dev",
34
+ "dependencies": {
35
+ "@apollo/client": "3.7.10",
36
+ "@holochain/client": "0.16.0",
37
+ "@types/jest": "^26.0.14",
38
+ "class-validator": "^0.13.1",
39
+ "express": "4.18.2",
40
+ "graphql": "15.7.2",
41
+ "reflect-metadata": "^0.1.13",
42
+ "type-graphql": "1.1.1"
43
+ },
44
+ "devDependencies": {
45
+ "@rollup/plugin-alias": "^3.1.5",
46
+ "@rollup/plugin-commonjs": "^20.0.0",
47
+ "@rollup/plugin-node-resolve": "^13.0.4",
48
+ "@apollo/server": "^4.9.4",
49
+ "concat-md": "^0.5.0",
50
+ "cross-fetch": "^3.1.4",
51
+ "graphql-ws": "5.12.0",
52
+ "honkit": "^4.0.0",
53
+ "jest": "^26.6.0",
54
+ "patch-package": "^8.0.0",
55
+ "rollup": "^2.56.3",
56
+ "ts-jest": "^26.5.6",
57
+ "typescript": "^4.6.2",
58
+ "ws": "8.13.0"
59
+ },
60
+ "version": "0.8.0-fix"
61
+ }
@@ -0,0 +1,27 @@
1
+ import alias from '@rollup/plugin-alias';
2
+ import nodeResolve from '@rollup/plugin-node-resolve';
3
+ import commonjs from '@rollup/plugin-commonjs';
4
+
5
+ module.exports = {
6
+ input: 'lib/src/index.js',
7
+ output: [
8
+ {
9
+ format: 'cjs',
10
+ file: "lib/index.cjs",
11
+ },
12
+ {
13
+ format: 'esm',
14
+ file: "lib/index.js",
15
+ }
16
+ ],
17
+ plugins: [
18
+ alias({
19
+ entries: [
20
+ { find: 'type-graphql', replacement: './lib/shims/type-graphql.js' },
21
+ { find: 'reflect-metadata', replacement: './lib/shims/reflect-metadata.js' }
22
+ ]
23
+ }),
24
+ nodeResolve(),
25
+ commonjs()
26
+ ]
27
+ };
File without changes
@@ -0,0 +1,75 @@
1
+ /*
2
+ This "shim" can be used on the frontend to prevent from errors on undefined decorators,
3
+ when you are sharing same classes across backend and frontend.
4
+
5
+ To use this shim, simply set up your Webpack configuration
6
+ to use this file instead of a normal TypeGraphQL module.
7
+
8
+ ```js
9
+ plugins: [
10
+ // ...here are any other existing plugins that you already have
11
+ new webpack.NormalModuleReplacementPlugin(/type-graphql$/, resource => {
12
+ resource.request = resource.request.replace(/type-graphql/, "type-graphql/dist/browser-shim");
13
+ }),
14
+ ]
15
+ ```
16
+
17
+ However, in some TypeScript projects like the ones using Angular,
18
+ which AoT compiler requires that a full `*.ts` file is provided
19
+ instead of just a `*.js` and `*.d.ts` files, to use this shim
20
+ we have to simply set up our TypeScript configuration in `tsconfig.json`
21
+ to use this file instead of a normal TypeGraphQL module:
22
+
23
+ ```json
24
+ {
25
+ "compilerOptions": {
26
+ "baseUrl": ".",
27
+ "paths": {
28
+ "type-graphql": [
29
+ "./node_modules/type-graphql/dist/browser-shim.ts"
30
+ ]
31
+ }
32
+ }
33
+ }
34
+ ```
35
+ */
36
+
37
+
38
+ import * as src from "../node_modules/type-graphql/dist/index.js";
39
+
40
+ export const dummyValue = "";
41
+ export function dummyFn() {
42
+ return;
43
+ }
44
+ export function dummyDecorator() {
45
+ return dummyFn;
46
+ }
47
+
48
+ export const Arg: typeof src.Arg = dummyDecorator;
49
+ export const Args: typeof src.Args = dummyDecorator;
50
+ export const ArgsType: typeof src.ArgsType = dummyDecorator;
51
+ export const Authorized: typeof src.Authorized = dummyDecorator;
52
+ export const Ctx: typeof src.Ctx = dummyDecorator;
53
+ export const registerEnumType: typeof src.registerEnumType = dummyFn;
54
+ export const Field: typeof src.Field = dummyDecorator;
55
+ export const FieldResolver: typeof src.FieldResolver = dummyDecorator;
56
+ export const Info: typeof src.Info = dummyDecorator;
57
+ export const InputType: typeof src.InputType = dummyDecorator;
58
+ export const InterfaceType: typeof src.InterfaceType = dummyDecorator;
59
+ export const Mutation: typeof src.Mutation = dummyDecorator;
60
+ export const ObjectType: typeof src.ObjectType = dummyDecorator;
61
+ export const PubSub: typeof src.PubSub = dummyDecorator;
62
+ export const Query: typeof src.Query = dummyDecorator;
63
+ export const Resolver: typeof src.Resolver = dummyDecorator;
64
+ export const Root: typeof src.Root = dummyDecorator;
65
+ export const Subscription: typeof src.Subscription = dummyDecorator;
66
+ export const createUnionType: typeof src.createUnionType = dummyFn as any;
67
+ export const UseMiddleware: typeof src.UseMiddleware = dummyDecorator;
68
+ export const PubSubEngine: typeof src.PubSubEngine = dummyDecorator as any;
69
+
70
+ export class ClassType<t> {}
71
+ export const Int: typeof src.Int = dummyValue as any;
72
+ export const Float: typeof src.Float = dummyValue as any;
73
+ export const ID: typeof src.ID = dummyValue as any;
74
+ export const GraphQLISODateTime: typeof src.GraphQLISODateTime = dummyValue as any;
75
+ export const GraphQLTimestamp: typeof src.GraphQLTimestamp = dummyValue as any;