@coasys/ad4m 0.12.1-dev → 0.13.0-postmessage-ws-proxy.3

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 (393) hide show
  1. package/README.md +2 -25
  2. package/jest-setup.ts +1 -1
  3. package/lib/index.cjs +8677 -15318
  4. package/lib/index.js +14507 -21223
  5. package/lib/src/Ad4mClient.d.ts +9 -3
  6. package/lib/src/Ad4mClient.js +40 -13
  7. package/lib/src/Literal.js +6 -5
  8. package/lib/src/agent/Agent.js +26 -272
  9. package/lib/src/agent/AgentClient.d.ts +33 -21
  10. package/lib/src/agent/AgentClient.js +180 -374
  11. package/lib/src/agent/AgentStatus.js +2 -37
  12. package/lib/src/ai/AIClient.d.ts +12 -4
  13. package/lib/src/ai/AIClient.js +81 -285
  14. package/lib/src/ai/AITypes.d.ts +55 -0
  15. package/lib/src/ai/AITypes.js +18 -0
  16. package/lib/src/ai/Tasks.js +10 -133
  17. package/lib/src/apiClient.d.ts +53 -0
  18. package/lib/src/apiClient.js +234 -0
  19. package/lib/src/cache/PersistentCache.d.ts +40 -0
  20. package/lib/src/cache/PersistentCache.js +139 -0
  21. package/lib/src/expression/Expression.d.ts +1 -1
  22. package/lib/src/expression/Expression.js +13 -122
  23. package/lib/src/expression/ExpressionClient.d.ts +11 -3
  24. package/lib/src/expression/ExpressionClient.js +120 -75
  25. package/lib/src/expression/ExpressionRef.js +4 -27
  26. package/lib/src/generated/api/AIModelLoadingStatus.d.ts +7 -0
  27. package/lib/src/generated/api/AIModelLoadingStatus.js +2 -0
  28. package/lib/src/generated/api/AddLinkExpressionRequest.d.ts +6 -0
  29. package/lib/src/generated/api/AddLinkExpressionRequest.js +1 -0
  30. package/lib/src/generated/api/AddLinkRequest.d.ts +6 -0
  31. package/lib/src/generated/api/AddLinkRequest.js +1 -0
  32. package/lib/src/generated/api/AddLinksBulkRequest.d.ts +6 -0
  33. package/lib/src/generated/api/AddLinksBulkRequest.js +1 -0
  34. package/lib/src/generated/api/AddSdnaRequest.d.ts +6 -0
  35. package/lib/src/generated/api/AddSdnaRequest.js +2 -0
  36. package/lib/src/generated/api/ApplyTemplateRequest.d.ts +4 -0
  37. package/lib/src/generated/api/ApplyTemplateRequest.js +2 -0
  38. package/lib/src/generated/api/AuthInfoInput.d.ts +10 -0
  39. package/lib/src/generated/api/AuthInfoInput.js +1 -0
  40. package/lib/src/generated/api/CapabilityInput.d.ts +5 -0
  41. package/lib/src/generated/api/CapabilityInput.js +1 -0
  42. package/lib/src/generated/api/CommitBatchRequest.d.ts +3 -0
  43. package/lib/src/generated/api/CommitBatchRequest.js +2 -0
  44. package/lib/src/generated/api/ComputeLogEntry.d.ts +9 -0
  45. package/lib/src/generated/api/ComputeLogEntry.js +2 -0
  46. package/lib/src/generated/api/CreateExpressionRequest.d.ts +4 -0
  47. package/lib/src/generated/api/CreateExpressionRequest.js +2 -0
  48. package/lib/src/generated/api/CreatePerspectiveRequest.d.ts +3 -0
  49. package/lib/src/generated/api/CreatePerspectiveRequest.js +2 -0
  50. package/lib/src/generated/api/CreateSubjectRequest.d.ts +6 -0
  51. package/lib/src/generated/api/CreateSubjectRequest.js +2 -0
  52. package/lib/src/generated/api/EmbedRequest.d.ts +4 -0
  53. package/lib/src/generated/api/EmbedRequest.js +2 -0
  54. package/lib/src/generated/api/EntanglementProofInput.d.ts +6 -0
  55. package/lib/src/generated/api/EntanglementProofInput.js +2 -0
  56. package/lib/src/generated/api/ExecuteCommandsRequest.d.ts +4 -0
  57. package/lib/src/generated/api/ExecuteCommandsRequest.js +2 -0
  58. package/lib/src/generated/api/ExportRequest.d.ts +5 -0
  59. package/lib/src/generated/api/ExportRequest.js +2 -0
  60. package/lib/src/generated/api/ExpressionManyRequest.d.ts +3 -0
  61. package/lib/src/generated/api/ExpressionManyRequest.js +2 -0
  62. package/lib/src/generated/api/ExpressionProof.d.ts +4 -0
  63. package/lib/src/generated/api/ExpressionProof.js +2 -0
  64. package/lib/src/generated/api/ExpressionProofInput.d.ts +6 -0
  65. package/lib/src/generated/api/ExpressionProofInput.js +2 -0
  66. package/lib/src/generated/api/FriendSendMessageRequest.d.ts +3 -0
  67. package/lib/src/generated/api/FriendSendMessageRequest.js +2 -0
  68. package/lib/src/generated/api/FriendsListRequest.d.ts +3 -0
  69. package/lib/src/generated/api/FriendsListRequest.js +2 -0
  70. package/lib/src/generated/api/GenerateAgentRequest.d.ts +3 -0
  71. package/lib/src/generated/api/GenerateAgentRequest.js +2 -0
  72. package/lib/src/generated/api/GenerateJwtRequest.d.ts +4 -0
  73. package/lib/src/generated/api/GenerateJwtRequest.js +2 -0
  74. package/lib/src/generated/api/GetSubjectDataRequest.d.ts +4 -0
  75. package/lib/src/generated/api/GetSubjectDataRequest.js +2 -0
  76. package/lib/src/generated/api/ImportAgentRequest.d.ts +6 -0
  77. package/lib/src/generated/api/ImportAgentRequest.js +2 -0
  78. package/lib/src/generated/api/ImportRequest.d.ts +4 -0
  79. package/lib/src/generated/api/ImportRequest.js +2 -0
  80. package/lib/src/generated/api/JoinNeighbourhoodRequest.d.ts +3 -0
  81. package/lib/src/generated/api/JoinNeighbourhoodRequest.js +2 -0
  82. package/lib/src/generated/api/LanguageMetaInput.d.ts +6 -0
  83. package/lib/src/generated/api/LanguageMetaInput.js +2 -0
  84. package/lib/src/generated/api/Link.d.ts +5 -0
  85. package/lib/src/generated/api/Link.js +2 -0
  86. package/lib/src/generated/api/LinkExpression.d.ts +10 -0
  87. package/lib/src/generated/api/LinkExpression.js +1 -0
  88. package/lib/src/generated/api/LinkExpressionInput.d.ts +10 -0
  89. package/lib/src/generated/api/LinkExpressionInput.js +1 -0
  90. package/lib/src/generated/api/LinkInput.d.ts +5 -0
  91. package/lib/src/generated/api/LinkInput.js +2 -0
  92. package/lib/src/generated/api/LinkLanguageTemplatesRequest.d.ts +3 -0
  93. package/lib/src/generated/api/LinkLanguageTemplatesRequest.js +2 -0
  94. package/lib/src/generated/api/LinkMutations.d.ts +6 -0
  95. package/lib/src/generated/api/LinkMutations.js +1 -0
  96. package/lib/src/generated/api/LinkStatus.d.ts +1 -0
  97. package/lib/src/generated/api/LinkStatus.js +2 -0
  98. package/lib/src/generated/api/LockAgentRequest.d.ts +3 -0
  99. package/lib/src/generated/api/LockAgentRequest.js +2 -0
  100. package/lib/src/generated/api/ModelType.d.ts +1 -0
  101. package/lib/src/generated/api/ModelType.js +2 -0
  102. package/lib/src/generated/api/NotificationInput.d.ts +10 -0
  103. package/lib/src/generated/api/NotificationInput.js +2 -0
  104. package/lib/src/generated/api/OpenLinkRequest.d.ts +3 -0
  105. package/lib/src/generated/api/OpenLinkRequest.js +2 -0
  106. package/lib/src/generated/api/PermitCapabilityRequest.d.ts +3 -0
  107. package/lib/src/generated/api/PermitCapabilityRequest.js +2 -0
  108. package/lib/src/generated/api/PerspectiveInput.d.ts +4 -0
  109. package/lib/src/generated/api/PerspectiveInput.js +1 -0
  110. package/lib/src/generated/api/PromptRequest.d.ts +4 -0
  111. package/lib/src/generated/api/PromptRequest.js +2 -0
  112. package/lib/src/generated/api/PublishLanguageRequest.d.ts +5 -0
  113. package/lib/src/generated/api/PublishLanguageRequest.js +1 -0
  114. package/lib/src/generated/api/PublishNeighbourhoodRequest.d.ts +6 -0
  115. package/lib/src/generated/api/PublishNeighbourhoodRequest.js +1 -0
  116. package/lib/src/generated/api/QueryRequest.d.ts +7 -0
  117. package/lib/src/generated/api/QueryRequest.js +2 -0
  118. package/lib/src/generated/api/RemoveLinkRequest.d.ts +5 -0
  119. package/lib/src/generated/api/RemoveLinkRequest.js +1 -0
  120. package/lib/src/generated/api/RemoveLinksBulkRequest.d.ts +5 -0
  121. package/lib/src/generated/api/RemoveLinksBulkRequest.js +1 -0
  122. package/lib/src/generated/api/ResourceInput.d.ts +4 -0
  123. package/lib/src/generated/api/ResourceInput.js +2 -0
  124. package/lib/src/generated/api/SetDefaultModelRequest.d.ts +4 -0
  125. package/lib/src/generated/api/SetDefaultModelRequest.js +1 -0
  126. package/lib/src/generated/api/SetFreeHostingEnabledRequest.d.ts +3 -0
  127. package/lib/src/generated/api/SetFreeHostingEnabledRequest.js +2 -0
  128. package/lib/src/generated/api/SetMultiUserRequest.d.ts +3 -0
  129. package/lib/src/generated/api/SetMultiUserRequest.js +2 -0
  130. package/lib/src/generated/api/SetStatusRequest.d.ts +3 -0
  131. package/lib/src/generated/api/SetStatusRequest.js +2 -0
  132. package/lib/src/generated/api/SignMessageRequest.d.ts +3 -0
  133. package/lib/src/generated/api/SignMessageRequest.js +2 -0
  134. package/lib/src/generated/api/TrustedAgentsRequest.d.ts +3 -0
  135. package/lib/src/generated/api/TrustedAgentsRequest.js +2 -0
  136. package/lib/src/generated/api/UnlockAgentRequest.d.ts +4 -0
  137. package/lib/src/generated/api/UnlockAgentRequest.js +2 -0
  138. package/lib/src/generated/api/UpdateLinkRequest.d.ts +7 -0
  139. package/lib/src/generated/api/UpdateLinkRequest.js +1 -0
  140. package/lib/src/generated/api/UpdatePerspectiveRequest.d.ts +3 -0
  141. package/lib/src/generated/api/UpdatePerspectiveRequest.js +2 -0
  142. package/lib/src/generated/api/UserStatistics.d.ts +9 -0
  143. package/lib/src/generated/api/UserStatistics.js +2 -0
  144. package/lib/src/generated/api/VerificationRequestResult.d.ts +6 -0
  145. package/lib/src/generated/api/VerificationRequestResult.js +2 -0
  146. package/lib/src/generated/api/VerifySignatureRequest.d.ts +5 -0
  147. package/lib/src/generated/api/VerifySignatureRequest.js +2 -0
  148. package/lib/src/generated/api/WriteSettingsRequest.d.ts +3 -0
  149. package/lib/src/generated/api/WriteSettingsRequest.js +2 -0
  150. package/lib/src/generated/api/index.d.ts +42 -0
  151. package/lib/src/generated/api/index.js +7 -0
  152. package/lib/src/index.d.ts +8 -2
  153. package/lib/src/index.js +8 -2
  154. package/lib/src/jestSetup.d.ts +0 -1
  155. package/lib/src/jestSetup.js +1 -1
  156. package/lib/src/language/Icon.js +2 -21
  157. package/lib/src/language/Language.d.ts +26 -176
  158. package/lib/src/language/Language.js +32 -72
  159. package/lib/src/language/LanguageClient.d.ts +2 -2
  160. package/lib/src/language/LanguageClient.js +15 -105
  161. package/lib/src/language/LanguageHandle.js +2 -41
  162. package/lib/src/language/LanguageMeta.js +4 -75
  163. package/lib/src/language/LanguageRef.js +2 -25
  164. package/lib/src/links/Links.js +14 -111
  165. package/lib/src/model/Ad4mModel.d.ts +143 -63
  166. package/lib/src/model/Ad4mModel.js +583 -425
  167. package/lib/src/model/Ad4mModel.test.js +1434 -688
  168. package/lib/src/model/ModelQueryBuilder.d.ts +61 -45
  169. package/lib/src/model/ModelQueryBuilder.js +315 -157
  170. package/lib/src/model/Subject.js +6 -6
  171. package/lib/src/model/decorators.d.ts +36 -8
  172. package/lib/src/model/decorators.js +41 -14
  173. package/lib/src/model/hydration-batch.d.ts +34 -0
  174. package/lib/src/model/hydration-batch.js +147 -0
  175. package/lib/src/model/hydration-batching.test.d.ts +7 -0
  176. package/lib/src/model/hydration-batching.test.js +456 -0
  177. package/lib/src/model/hydration.d.ts +3 -92
  178. package/lib/src/model/hydration.js +3 -691
  179. package/lib/src/model/index.d.ts +3 -4
  180. package/lib/src/model/index.js +3 -4
  181. package/lib/src/model/json-schema.js +2 -2
  182. package/lib/src/model/model-manifest.d.ts +41 -0
  183. package/lib/src/model/model-manifest.js +11 -0
  184. package/lib/src/model/query-cache.d.ts +30 -0
  185. package/lib/src/model/query-cache.js +66 -0
  186. package/lib/src/model/query-cache.test.d.ts +1 -0
  187. package/lib/src/model/query-cache.test.js +43 -0
  188. package/lib/src/model/query-common.d.ts +1 -1
  189. package/lib/src/model/query-common.js +1 -1
  190. package/lib/src/model/query-sparql-batch.d.ts +17 -0
  191. package/lib/src/model/query-sparql-batch.js +260 -0
  192. package/lib/src/model/query-sparql.d.ts +51 -0
  193. package/lib/src/model/query-sparql.js +466 -0
  194. package/lib/src/model/query-sparql.test.d.ts +1 -0
  195. package/lib/src/model/query-sparql.test.js +312 -0
  196. package/lib/src/model/{surreal-utils.d.ts → query-utils.d.ts} +13 -9
  197. package/lib/src/model/query-utils.js +189 -0
  198. package/lib/src/model/relation-filtering.test.js +15 -15
  199. package/lib/src/model/sdna.js +1 -1
  200. package/lib/src/model/shacl-gen.js +154 -57
  201. package/lib/src/model/subscription-delta.test.d.ts +24 -0
  202. package/lib/src/model/subscription-delta.test.js +180 -0
  203. package/lib/src/model/subscription-pool.d.ts +39 -0
  204. package/lib/src/model/subscription-pool.js +165 -0
  205. package/lib/src/model/types.d.ts +195 -5
  206. package/lib/src/model/types.js +5 -2
  207. package/lib/src/neighbourhood/Neighbourhood.js +4 -32
  208. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +3 -3
  209. package/lib/src/neighbourhood/NeighbourhoodClient.js +40 -203
  210. package/lib/src/perspectives/LinkQuery.js +2 -42
  211. package/lib/src/perspectives/Perspective.d.ts +1 -1
  212. package/lib/src/perspectives/Perspective.js +10 -52
  213. package/lib/src/perspectives/PerspectiveClient.d.ts +22 -32
  214. package/lib/src/perspectives/PerspectiveClient.js +188 -454
  215. package/lib/src/perspectives/PerspectiveClient.test.d.ts +1 -0
  216. package/lib/src/perspectives/PerspectiveClient.test.js +224 -0
  217. package/lib/src/perspectives/PerspectiveDiff.js +4 -31
  218. package/lib/src/perspectives/PerspectiveHandle.js +3 -43
  219. package/lib/src/perspectives/PerspectiveProxy.d.ts +157 -78
  220. package/lib/src/perspectives/PerspectiveProxy.js +475 -389
  221. package/lib/src/perspectives/PerspectiveResolver.d.ts +0 -1
  222. package/lib/src/perspectives/PerspectiveResolver.js +0 -11
  223. package/lib/src/perspectives/SparqlBindings.d.ts +47 -0
  224. package/lib/src/perspectives/SparqlBindings.js +65 -0
  225. package/lib/src/perspectives/WakerSubscriptionManager.d.ts +3 -3
  226. package/lib/src/perspectives/WakerSubscriptionManager.js +12 -12
  227. package/lib/src/runtime/RuntimeClient.d.ts +8 -6
  228. package/lib/src/runtime/RuntimeClient.js +97 -454
  229. package/lib/src/runtime/RuntimeResolver.d.ts +14 -0
  230. package/lib/src/runtime/RuntimeResolver.js +84 -0
  231. package/lib/src/runtime/RuntimeTypes.d.ts +101 -0
  232. package/lib/src/runtime/RuntimeTypes.js +45 -0
  233. package/lib/src/schema.gql +14 -1
  234. package/lib/src/shacl/SHACLFlow.d.ts +1 -1
  235. package/lib/src/shacl/SHACLFlow.js +9 -9
  236. package/lib/src/shacl/SHACLShape.d.ts +26 -1
  237. package/lib/src/shacl/SHACLShape.js +140 -38
  238. package/lib/src/shacl/SHACLShape.test.js +82 -0
  239. package/lib/src/typeDefs.js +3 -615
  240. package/lib/src/utils.d.ts +6 -6
  241. package/lib/src/utils.js +6 -6
  242. package/package.json +9 -24
  243. package/rollup.config.js +0 -7
  244. package/src/Ad4mClient.test.ts +1192 -1288
  245. package/src/Ad4mClient.ts +46 -15
  246. package/src/Literal.test.ts +10 -5
  247. package/src/Literal.ts +6 -5
  248. package/src/agent/Agent.ts +0 -99
  249. package/src/agent/AgentClient.ts +238 -467
  250. package/src/agent/AgentStatus.ts +0 -12
  251. package/src/ai/AIClient.ts +96 -296
  252. package/src/ai/AITypes.ts +66 -0
  253. package/src/ai/Tasks.ts +0 -52
  254. package/src/apiClient.ts +287 -0
  255. package/src/cache/PersistentCache.ts +145 -0
  256. package/src/cache/cache.test.ts +713 -0
  257. package/src/expression/Expression.ts +3 -43
  258. package/src/expression/ExpressionClient.ts +148 -77
  259. package/src/expression/ExpressionRef.ts +2 -8
  260. package/src/generated/api/AIModelLoadingStatus.ts +3 -0
  261. package/src/generated/api/AddLinkExpressionRequest.ts +4 -0
  262. package/src/generated/api/AddLinkRequest.ts +4 -0
  263. package/src/generated/api/AddLinksBulkRequest.ts +4 -0
  264. package/src/generated/api/AddSdnaRequest.ts +3 -0
  265. package/src/generated/api/ApplyTemplateRequest.ts +3 -0
  266. package/src/generated/api/AuthInfoInput.ts +4 -0
  267. package/src/generated/api/CapabilityInput.ts +4 -0
  268. package/src/generated/api/CommitBatchRequest.ts +3 -0
  269. package/src/generated/api/ComputeLogEntry.ts +3 -0
  270. package/src/generated/api/CreateExpressionRequest.ts +3 -0
  271. package/src/generated/api/CreatePerspectiveRequest.ts +3 -0
  272. package/src/generated/api/CreateSubjectRequest.ts +3 -0
  273. package/src/generated/api/EmbedRequest.ts +3 -0
  274. package/src/generated/api/EntanglementProofInput.ts +3 -0
  275. package/src/generated/api/ExecuteCommandsRequest.ts +3 -0
  276. package/src/generated/api/ExportRequest.ts +3 -0
  277. package/src/generated/api/ExpressionManyRequest.ts +3 -0
  278. package/src/generated/api/ExpressionProof.ts +3 -0
  279. package/src/generated/api/ExpressionProofInput.ts +3 -0
  280. package/src/generated/api/FriendSendMessageRequest.ts +3 -0
  281. package/src/generated/api/FriendsListRequest.ts +3 -0
  282. package/src/generated/api/GenerateAgentRequest.ts +3 -0
  283. package/src/generated/api/GenerateJwtRequest.ts +3 -0
  284. package/src/generated/api/GetSubjectDataRequest.ts +3 -0
  285. package/src/generated/api/ImportAgentRequest.ts +3 -0
  286. package/src/generated/api/ImportRequest.ts +3 -0
  287. package/src/generated/api/JoinNeighbourhoodRequest.ts +3 -0
  288. package/src/generated/api/LanguageMetaInput.ts +3 -0
  289. package/src/generated/api/Link.ts +3 -0
  290. package/src/generated/api/LinkExpression.ts +6 -0
  291. package/src/generated/api/LinkExpressionInput.ts +6 -0
  292. package/src/generated/api/LinkInput.ts +3 -0
  293. package/src/generated/api/LinkLanguageTemplatesRequest.ts +3 -0
  294. package/src/generated/api/LinkMutations.ts +5 -0
  295. package/src/generated/api/LinkStatus.ts +3 -0
  296. package/src/generated/api/LockAgentRequest.ts +3 -0
  297. package/src/generated/api/ModelType.ts +3 -0
  298. package/src/generated/api/NotificationInput.ts +3 -0
  299. package/src/generated/api/OpenLinkRequest.ts +3 -0
  300. package/src/generated/api/PermitCapabilityRequest.ts +3 -0
  301. package/src/generated/api/PerspectiveInput.ts +4 -0
  302. package/src/generated/api/PromptRequest.ts +3 -0
  303. package/src/generated/api/PublishLanguageRequest.ts +4 -0
  304. package/src/generated/api/PublishNeighbourhoodRequest.ts +4 -0
  305. package/src/generated/api/QueryRequest.ts +6 -0
  306. package/src/generated/api/RemoveLinkRequest.ts +4 -0
  307. package/src/generated/api/RemoveLinksBulkRequest.ts +4 -0
  308. package/src/generated/api/ResourceInput.ts +3 -0
  309. package/src/generated/api/SetDefaultModelRequest.ts +4 -0
  310. package/src/generated/api/SetFreeHostingEnabledRequest.ts +3 -0
  311. package/src/generated/api/SetMultiUserRequest.ts +3 -0
  312. package/src/generated/api/SetStatusRequest.ts +3 -0
  313. package/src/generated/api/SignMessageRequest.ts +3 -0
  314. package/src/generated/api/TrustedAgentsRequest.ts +3 -0
  315. package/src/generated/api/UnlockAgentRequest.ts +3 -0
  316. package/src/generated/api/UpdateLinkRequest.ts +5 -0
  317. package/src/generated/api/UpdatePerspectiveRequest.ts +3 -0
  318. package/src/generated/api/UserStatistics.ts +3 -0
  319. package/src/generated/api/VerificationRequestResult.ts +3 -0
  320. package/src/generated/api/VerifySignatureRequest.ts +3 -0
  321. package/src/generated/api/WriteSettingsRequest.ts +3 -0
  322. package/src/generated/api/index.ts +49 -0
  323. package/src/index.ts +8 -2
  324. package/src/jestSetup.ts +1 -1
  325. package/src/language/Icon.ts +0 -4
  326. package/src/language/Language.ts +51 -248
  327. package/src/language/LanguageClient.ts +21 -132
  328. package/src/language/LanguageHandle.ts +0 -14
  329. package/src/language/LanguageMeta.ts +0 -29
  330. package/src/language/LanguageRef.ts +0 -7
  331. package/src/links/Links.ts +0 -37
  332. package/src/model/Ad4mModel.test.ts +1664 -792
  333. package/src/model/Ad4mModel.ts +664 -499
  334. package/src/model/ModelQueryBuilder.ts +362 -183
  335. package/src/model/decorators.ts +71 -22
  336. package/src/model/hydration.ts +3 -772
  337. package/src/model/index.ts +3 -4
  338. package/src/model/json-schema.ts +2 -2
  339. package/src/model/query-cache.test.ts +54 -0
  340. package/src/model/query-cache.ts +79 -0
  341. package/src/model/query-common.ts +1 -1
  342. package/src/model/query-sparql.test.ts +376 -0
  343. package/src/model/query-sparql.ts +504 -0
  344. package/src/model/query-utils.ts +209 -0
  345. package/src/model/relation-filtering.test.ts +60 -53
  346. package/src/model/sdna.ts +1 -1
  347. package/src/model/shacl-gen.ts +163 -64
  348. package/src/model/shacl-roundtrip.test.ts +197 -0
  349. package/src/model/types-typed-query.test.ts +360 -0
  350. package/src/model/types.ts +256 -5
  351. package/src/neighbourhood/Neighbourhood.ts +0 -9
  352. package/src/neighbourhood/NeighbourhoodClient.ts +42 -207
  353. package/src/neighbourhood/NeighbourhoodProxy.test.ts +34 -36
  354. package/src/perspectives/LinkQuery.ts +0 -15
  355. package/src/perspectives/Perspective.ts +1 -12
  356. package/src/perspectives/PerspectiveClient.test.ts +262 -0
  357. package/src/perspectives/PerspectiveClient.ts +252 -468
  358. package/src/perspectives/PerspectiveDiff.ts +0 -8
  359. package/src/perspectives/PerspectiveHandle.ts +1 -12
  360. package/src/perspectives/PerspectiveProxy.test.ts +125 -0
  361. package/src/perspectives/PerspectiveProxy.ts +522 -434
  362. package/src/perspectives/SparqlBindings.ts +79 -0
  363. package/src/perspectives/WakerSubscriptionManager.ts +13 -13
  364. package/src/runtime/RuntimeClient.ts +118 -461
  365. package/src/runtime/RuntimeTypes.ts +144 -0
  366. package/src/shacl/SHACLFlow.ts +9 -9
  367. package/src/shacl/SHACLShape.test.ts +204 -0
  368. package/src/shacl/SHACLShape.ts +191 -39
  369. package/src/typeDefs.ts +3 -5
  370. package/src/utils.ts +6 -6
  371. package/tsconfig.json +3 -7
  372. package/lib/src/model/query-surreal.d.ts +0 -44
  373. package/lib/src/model/query-surreal.js +0 -249
  374. package/lib/src/model/surreal-utils.js +0 -128
  375. package/shims/reflect-metadata.ts +0 -0
  376. package/shims/type-graphql.ts +0 -75
  377. package/src/PubSub.ts +0 -17
  378. package/src/agent/AgentResolver.ts +0 -263
  379. package/src/ai/AIResolver.ts +0 -372
  380. package/src/buildSchema.ts +0 -43
  381. package/src/expression/ExpressionResolver.ts +0 -64
  382. package/src/language/LanguageContext.ts +0 -37
  383. package/src/language/LanguageResolver.ts +0 -98
  384. package/src/model/Subject.ts +0 -159
  385. package/src/model/prolog-facts.ts +0 -145
  386. package/src/model/query-prolog.ts +0 -148
  387. package/src/model/query-surreal.ts +0 -280
  388. package/src/model/surreal-utils.ts +0 -147
  389. package/src/neighbourhood/NeighbourhoodResolver.ts +0 -100
  390. package/src/perspectives/PerspectiveResolver.ts +0 -372
  391. package/src/runtime/RuntimeResolver.ts +0 -691
  392. package/src/unwrapApolloResult.ts +0 -16
  393. package/tsconfig-browser.json +0 -82
@@ -1,691 +0,0 @@
1
- import { Arg, Mutation, Resolver, Query, Subscription, ObjectType, Field, Int, InputType } from "type-graphql";
2
- import { Perspective, PerspectiveExpression, PerspectiveInput } from "../perspectives/Perspective";
3
- import { ExpressionProof } from "../expression/Expression";
4
- import { LinkExpression } from "../links/Links";
5
- import { ExceptionType } from "../Exception";
6
- import { RUNTIME_MESSAGED_RECEIVED_TOPIC, EXCEPTION_OCCURRED_TOPIC, RUNTIME_NOTIFICATION_REQUESTED_TOPIC, RUNTIME_NOTIFICATION_TRIGGERED_TOPIC } from '../PubSub';
7
- import { UserCreationResult, AuthInfoInput } from "../agent/Agent";
8
-
9
- const testLink = new LinkExpression()
10
- testLink.author = "did:ad4m:test"
11
- testLink.timestamp = Date.now()
12
- testLink.data = {
13
- source: 'root',
14
- target: 'neighbourhood://Qm12345'
15
- }
16
- testLink.proof = {
17
- signature: '',
18
- key: '',
19
- valid: true
20
- }
21
-
22
- const testPerspectiveExpression = new PerspectiveExpression()
23
- testPerspectiveExpression.author = 'did:ad4m:test'
24
- testPerspectiveExpression.timestamp = Date.now().toString()
25
- testPerspectiveExpression.proof = new ExpressionProof('', '')
26
- testPerspectiveExpression.data = new Perspective([testLink])
27
-
28
- @ObjectType()
29
- export class SentMessage {
30
- @Field()
31
- recipient: string;
32
- @Field()
33
- message: PerspectiveExpression;
34
- }
35
-
36
- @ObjectType()
37
- export class RuntimeInfo {
38
- @Field()
39
- ad4mExecutorVersion: string;
40
- @Field()
41
- isInitialized: Boolean;
42
- @Field()
43
- isUnlocked: Boolean;
44
- }
45
-
46
- @ObjectType()
47
- export class ExceptionInfo {
48
- @Field()
49
- title: string;
50
- @Field()
51
- message: string;
52
- @Field(type => Int)
53
- type: ExceptionType;
54
- @Field({ nullable: true })
55
- addon?: string;
56
- }
57
-
58
- // This class defines a Notification and is what an app provides
59
- // when registering and installing a notification.
60
- @InputType()
61
- export class NotificationInput {
62
- @Field()
63
- description: string;
64
- @Field()
65
- appName: string;
66
- @Field()
67
- appUrl: string;
68
- @Field()
69
- appIconPath: string;
70
-
71
- // This is Prolog query which will be executed on every perspective change.
72
- // All matched unbound variables will be part of the triggerMatch, i.e.
73
- // the content that will be sent to the launcher via subscription
74
- // and to the webhook.
75
- @Field()
76
- trigger: string;
77
-
78
- // List Perspectives this Notification is active on.
79
- @Field(type => [String])
80
- perspectiveIds: string[];
81
-
82
- // URL to which the notification matches will be sent via POST
83
- @Field()
84
- webhookUrl: string;
85
-
86
- // Authentication bearer token to be sent via POST to the webhookUrl.
87
- @Field()
88
- webhookAuth: string;
89
- }
90
-
91
- // This is a notification as it is stored in the runtime.
92
- // Above definition plus ID and granted flag.
93
- @ObjectType()
94
- export class Notification {
95
- @Field()
96
- id: string;
97
- @Field()
98
- granted: boolean;
99
- @Field()
100
- description: string;
101
- @Field()
102
- appName: string;
103
- @Field()
104
- appUrl: string;
105
- @Field()
106
- appIconPath: string;
107
-
108
- // This is Prolog query which will be executed on every perspective change.
109
- // All matched unbound variables will be part of the triggerMatch, i.e.
110
- // the content that will be sent to the launcher via subscription
111
- // and to the webhook.
112
- @Field()
113
- trigger: string;
114
-
115
- // List Perspectives this Notification is active on.
116
- @Field(type => [String])
117
- perspectiveIds: string[];
118
-
119
- // URL to which the notification matches will be sent via POST
120
- @Field()
121
- webhookUrl: string;
122
-
123
- // Authentication bearer token to be sent via POST to the webhookUrl.
124
- @Field()
125
- webhookAuth: string;
126
- }
127
-
128
- // This is what is sent to the launcher and the webhook.
129
- @ObjectType()
130
- export class TriggeredNotification {
131
- @Field()
132
- notification: Notification;
133
- @Field()
134
- perspectiveId: string;
135
-
136
- // This is the Prolog query match that triggered the notification.
137
- // It is a list of all variable bindings that match the notification's trigger.
138
- @Field()
139
- triggerMatch: string;
140
- }
141
-
142
- @ObjectType()
143
- export class ImportStats {
144
- @Field()
145
- total: number;
146
-
147
- @Field()
148
- imported: number;
149
-
150
- @Field()
151
- failed: number;
152
-
153
- @Field()
154
- omitted: number;
155
-
156
- @Field(type => [String])
157
- errors: string[];
158
- }
159
-
160
- @ObjectType()
161
- export class ImportResult {
162
- @Field()
163
- perspectives: ImportStats;
164
-
165
- @Field()
166
- links: ImportStats;
167
-
168
- @Field()
169
- expressions: ImportStats;
170
-
171
- @Field()
172
- perspectiveDiffs: ImportStats;
173
-
174
- @Field()
175
- notifications: ImportStats;
176
-
177
- @Field()
178
- models: ImportStats;
179
-
180
- @Field()
181
- defaultModels: ImportStats;
182
-
183
- @Field()
184
- tasks: ImportStats;
185
-
186
- @Field()
187
- friends: ImportStats;
188
-
189
- @Field()
190
- trustedAgents: ImportStats;
191
-
192
- @Field()
193
- knownLinkLanguages: ImportStats;
194
- }
195
-
196
- @ObjectType()
197
- export class UserStatistics {
198
- @Field()
199
- email: string;
200
-
201
- @Field()
202
- did: string;
203
-
204
- @Field({nullable: true})
205
- lastSeen?: string;
206
-
207
- @Field(type => Int)
208
- perspectiveCount: number;
209
-
210
- @Field()
211
- remainingCredits: string;
212
-
213
- @Field()
214
- freeAccess: boolean;
215
-
216
- @Field({nullable: true})
217
- hotWalletAddress?: string;
218
- }
219
-
220
- @ObjectType()
221
- export class VerificationRequestResult {
222
- @Field()
223
- success: boolean;
224
-
225
- @Field()
226
- message: string;
227
-
228
- @Field()
229
- requiresPassword: boolean;
230
-
231
- @Field()
232
- isExistingUser: boolean;
233
- }
234
-
235
- @ObjectType()
236
- export class HostingUserInfo {
237
- @Field()
238
- email: string;
239
-
240
- @Field()
241
- remainingCredits: string;
242
-
243
- @Field({ nullable: true })
244
- hotWalletAddress?: string;
245
-
246
- @Field()
247
- freeAccess: boolean;
248
-
249
- constructor(email: string, remainingCredits: string, hotWalletAddress?: string, freeAccess: boolean = false) {
250
- this.email = email;
251
- this.remainingCredits = remainingCredits;
252
- this.hotWalletAddress = hotWalletAddress;
253
- this.freeAccess = freeAccess;
254
- }
255
- }
256
-
257
- @ObjectType()
258
- export class PaymentRequestResult {
259
- @Field()
260
- success: boolean;
261
-
262
- @Field()
263
- message: string;
264
-
265
- constructor(success: boolean, message: string) {
266
- this.success = success;
267
- this.message = message;
268
- }
269
- }
270
-
271
- /**
272
- * Resolver classes are used here to define the GraphQL schema
273
- * (through the type-graphql annotations)
274
- * and are spawned in the client tests in Ad4mClient.test.ts.
275
- * For the latter, they return test fixtures.
276
- */
277
- @Resolver()
278
- export default class RuntimeResolver {
279
- @Mutation(returns => Boolean)
280
- runtimeQuit(): Boolean {
281
- return true
282
- }
283
-
284
- @Mutation(returns => Boolean)
285
- runtimeOpenLink(@Arg('url') url: string): Boolean {
286
- return true
287
- }
288
-
289
- @Query(returns => RuntimeInfo)
290
- runtimeInfo(): RuntimeInfo {
291
- return {
292
- ad4mExecutorVersion: "x.x.x",
293
- isInitialized: true,
294
- isUnlocked: true
295
- } as RuntimeInfo
296
- }
297
-
298
- @Mutation(returns => [String])
299
- addTrustedAgents(@Arg("agents", type => [String]) agents: string[]): string[] {
300
- return agents
301
- }
302
-
303
- @Mutation(returns => [String])
304
- deleteTrustedAgents(@Arg("agents", type => [String]) agents: string[]): string[] {
305
- return []
306
- }
307
-
308
- @Query(returns => [String])
309
- getTrustedAgents(): string[] {
310
- return ["agentPubKey"]
311
- }
312
-
313
- @Query(returns => [String])
314
- runtimeKnownLinkLanguageTemplates(): string[] {
315
- return ["Qm12345abcdef"]
316
- }
317
-
318
- @Mutation(returns => [String])
319
- runtimeAddKnownLinkLanguageTemplates(@Arg("addresses", type => [String]) addresses: string[]): string[] {
320
- return addresses
321
- }
322
-
323
- @Mutation(returns => [String])
324
- runtimeRemoveKnownLinkLanguageTemplates(@Arg("addresses", type => [String]) addresses: string[]): string[] {
325
- return []
326
- }
327
-
328
- @Query(returns => [String])
329
- runtimeFriends(): string[] {
330
- return ["did:test:friend"]
331
- }
332
-
333
- @Mutation(returns => [String])
334
- runtimeAddFriends(@Arg("dids", type => [String]) dids: string[]): string[] {
335
- return dids
336
- }
337
-
338
- @Mutation(returns => [String])
339
- runtimeRemoveFriends(@Arg("dids", type => [String]) dids: string[]): string[] {
340
- return []
341
- }
342
-
343
- @Query()
344
- runtimeHcAgentInfos(): string {
345
- return JSON.stringify([{"agent":{"type":"Buffer","data":[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},"signature":{"type":"Buffer","data":[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},"agent_info":{"type":"Buffer","data":[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{"agent":{"type":"Buffer","data":[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},"signature":{"type":"Buffer","data":[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},"agent_info":{"type":"Buffer","data":[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{"agent":{"type":"Buffer","data":[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},"signature":{"type":"Buffer","data":[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},"agent_info":{"type":"Buffer","data":[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{"agent":{"type":"Buffer","data":[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},"signature":{"type":"Buffer","data":[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},"agent_info":{"type":"Buffer","data":[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])
346
- }
347
-
348
- @Query()
349
- runtimeGetNetworkMetrics(): string {
350
- return JSON.stringify({
351
- "metrics": {},
352
- "stats": {}
353
- })
354
- }
355
-
356
- @Mutation(returns => Boolean)
357
- runtimeRestartHolochain(): boolean {
358
- return true
359
- }
360
-
361
- @Mutation(returns => Boolean)
362
- runtimeHcAddAgentInfos(@Arg("agentInfos", type => String) agentInfos): boolean {
363
- return true
364
- }
365
-
366
- @Query(returns => Boolean)
367
- runtimeVerifyStringSignedByDid(
368
- @Arg("did", type => String) did: string,
369
- @Arg("didSigningKeyId", type => String) didSigningKeyId: string,
370
- @Arg("data", type => String) data: string,
371
- @Arg("signedData", type => String) signedData: string) {
372
- return true
373
- }
374
-
375
- @Mutation()
376
- runtimeSetStatus(@Arg("status", type => PerspectiveInput) status: Perspective): boolean {
377
- return true
378
- }
379
-
380
- @Query({nullable: true})
381
- runtimeFriendStatus(@Arg("did", type => String) did: string): PerspectiveExpression {
382
- return testPerspectiveExpression
383
- }
384
-
385
- @Mutation()
386
- runtimeFriendSendMessage(
387
- @Arg("did", type => String) did: string,
388
- @Arg("message", type => PerspectiveInput) message: PerspectiveInput
389
- ): boolean {
390
- return true
391
- }
392
-
393
- @Query(returns => [PerspectiveExpression])
394
- runtimeMessageInbox(@Arg("filter", type => String, {nullable: true }) filter?: string): PerspectiveExpression[] {
395
- return [testPerspectiveExpression]
396
- }
397
-
398
- @Query(returns => [SentMessage])
399
- runtimeMessageOutbox(@Arg("filter", type => String, {nullable: true }) filter?: string): SentMessage[] {
400
- return [{
401
- recipient: "did:test:recipient",
402
- message: testPerspectiveExpression
403
- } as SentMessage]
404
- }
405
-
406
-
407
- @Subscription({topics: RUNTIME_MESSAGED_RECEIVED_TOPIC, nullable: true})
408
- runtimeMessageReceived(): PerspectiveExpression {
409
- return testPerspectiveExpression
410
- }
411
-
412
- @Subscription({topics: EXCEPTION_OCCURRED_TOPIC, nullable: true})
413
- exceptionOccurred(): ExceptionInfo {
414
- return {
415
- title: "Test title",
416
- message: "Test message",
417
- type: ExceptionType.LanguageIsNotLoaded,
418
- }
419
- }
420
-
421
- @Mutation()
422
- runtimeRequestInstallNotification(
423
- @Arg("notification", type => NotificationInput) notification: NotificationInput
424
- ): string {
425
- return "new-notification-id"
426
- }
427
-
428
- @Query(returns => [Notification])
429
- runtimeNotifications(): Notification[] {
430
- return [{
431
- id: "test-id",
432
- granted: false,
433
- description: "Test description",
434
- appName: "Test app name",
435
- appUrl: "https://example.com",
436
- appIconPath: "https://fluxsocial.io/favicon",
437
- trigger: "triple(X, ad4m://has_type, flux://message)",
438
- perspectiveIds: ["u983ud-jdhh38d"],
439
- webhookUrl: "https://example.com/webhook",
440
- webhookAuth: "test-auth",
441
-
442
- }]
443
- }
444
-
445
- @Mutation()
446
- runtimeUpdateNotification(
447
- @Arg("id", type => String) id: string,
448
- @Arg("notification", type => NotificationInput) notification: NotificationInput
449
- ): boolean {
450
- return true
451
- }
452
-
453
- @Mutation()
454
- runtimeRemoveNotification(@Arg("id", type => String) id: string): boolean {
455
- return true
456
- }
457
-
458
- @Mutation()
459
- runtimeGrantNotification(@Arg("id", type => String) id: string): boolean {
460
- return true
461
- }
462
-
463
- @Subscription({topics: RUNTIME_NOTIFICATION_TRIGGERED_TOPIC, nullable: true})
464
- runtimeNotificationTriggered(): TriggeredNotification {
465
- return {
466
- perspectiveId: "test-perspective-id",
467
- triggerMatch: "test-trigger-match",
468
- notification: {
469
- id: "test-id",
470
- granted: false,
471
- description: "Test description",
472
- appName: "Test app name",
473
- appUrl: "https://example.com",
474
- appIconPath: "https://fluxsocial.io/favicon",
475
- trigger: "triple(X, ad4m://has_type, flux://message)",
476
- perspectiveIds: ["u983ud-jdhh38d"],
477
- webhookUrl: "https://example.com/webhook",
478
- webhookAuth: "test-auth",
479
- }
480
- }
481
- }
482
-
483
- @Mutation()
484
- runtimeExportDb(@Arg("filePath", type => String) filePath: string): boolean {
485
- return true
486
- }
487
-
488
- @Mutation()
489
- runtimeImportDb(@Arg("filePath", type => String) filePath: string): boolean {
490
- return true
491
- }
492
-
493
- @Mutation()
494
- runtimeExportPerspective(
495
- @Arg("perspectiveUuid", type => String) perspectiveUuid: string,
496
- @Arg("filePath", type => String) filePath: string
497
- ): boolean {
498
- return true
499
- }
500
-
501
- @Mutation()
502
- runtimeImportPerspective(@Arg("filePath", type => String) filePath: string): boolean {
503
- return true
504
- }
505
-
506
- @Query(returns => Boolean)
507
- runtimeMultiUserEnabled(): boolean {
508
- return false
509
- }
510
-
511
- @Mutation(returns => Boolean)
512
- runtimeSetMultiUserEnabled(@Arg("enabled") enabled: boolean): boolean {
513
- return enabled
514
- }
515
-
516
- @Query(returns => [UserStatistics])
517
- runtimeListUsers(): UserStatistics[] {
518
- return [{
519
- email: "test@example.com",
520
- did: "did:key:test123",
521
- lastSeen: new Date().toISOString(),
522
- perspectiveCount: 5,
523
- remainingCredits: "0",
524
- freeAccess: false
525
- }]
526
- }
527
-
528
- @Mutation(returns => VerificationRequestResult)
529
- runtimeRequestLoginVerification(
530
- @Arg("email") email: string,
531
- @Arg("appInfo", { nullable: true }) appInfo?: AuthInfoInput
532
- ): VerificationRequestResult {
533
- // For testing: simulate existing user
534
- return {
535
- success: true,
536
- message: "Verification email sent",
537
- requiresPassword: false,
538
- isExistingUser: true
539
- }
540
- }
541
-
542
- @Mutation(returns => String)
543
- runtimeVerifyEmailCode(
544
- @Arg("email") email: string,
545
- @Arg("code") code: string,
546
- @Arg("verificationType") verificationType: string
547
- ): string {
548
- // For testing: return a test JWT token
549
- return "test-jwt-token-from-email-verification"
550
- }
551
-
552
- @Mutation(returns => Boolean)
553
- runtimeTestEmail(@Arg("to") to: string): boolean {
554
- // For testing: simulate successful email send
555
- return true
556
- }
557
-
558
- @Mutation(returns => UserCreationResult)
559
- runtimeCreateUser(
560
- @Arg("email") email: string,
561
- @Arg("password") password: string,
562
- @Arg("appInfo", { nullable: true }) appInfo?: AuthInfoInput
563
- ): UserCreationResult {
564
- // For testing: simulate successful user creation (email verification flow)
565
- return new UserCreationResult("did:key:test123", true)
566
- }
567
-
568
- @Mutation(returns => String)
569
- runtimeLoginUser(
570
- @Arg("email") email: string,
571
- @Arg("password") password: string
572
- ): string {
573
- // For testing: return a test JWT token
574
- return "test-jwt-token-from-password-login"
575
- }
576
-
577
- @Mutation(returns => Boolean)
578
- runtimeEmailTestModeEnable(): boolean {
579
- // For testing: enable test mode
580
- return true
581
- }
582
-
583
- @Mutation(returns => Boolean)
584
- runtimeEmailTestModeDisable(): boolean {
585
- // For testing: disable test mode
586
- return true
587
- }
588
-
589
- @Mutation(returns => String, { nullable: true })
590
- runtimeEmailTestGetCode(@Arg("email") email: string): string | null {
591
- // For testing: return a mock code
592
- return "123456"
593
- }
594
-
595
- @Mutation(returns => Boolean)
596
- runtimeEmailTestClearCodes(): boolean {
597
- // For testing: clear codes
598
- return true
599
- }
600
-
601
- @Mutation(returns => Boolean)
602
- runtimeEmailTestSetExpiry(
603
- @Arg("email") email: string,
604
- @Arg("verificationType") verificationType: string,
605
- @Arg("expiresAt") expiresAt: number
606
- ): boolean {
607
- // For testing: simulate setting expiry (no-op in mock)
608
- return true
609
- }
610
-
611
- // Hosting mutations & queries
612
-
613
- @Query(returns => HostingUserInfo)
614
- runtimeHostingUserInfo(): HostingUserInfo {
615
- return new HostingUserInfo("test@example.com", "100000000", null, false)
616
- }
617
-
618
- @Mutation(returns => Boolean)
619
- runtimeSetHotWalletAddress(
620
- @Arg("address") address: string
621
- ): boolean {
622
- return true
623
- }
624
-
625
- @Mutation(returns => PaymentRequestResult)
626
- runtimeRequestPayment(
627
- @Arg("amountHOT") amountHOT: string
628
- ): PaymentRequestResult {
629
- return new PaymentRequestResult(true, "Mock payment of " + amountHOT + " base units credited")
630
- }
631
-
632
- @Mutation(returns => Boolean)
633
- runtimeSetUserCredits(
634
- @Arg("email") email: string,
635
- @Arg("amount") amount: number
636
- ): boolean {
637
- return true
638
- }
639
-
640
- @Mutation(returns => Boolean)
641
- runtimeSetUserFreeAccess(
642
- @Arg("email") email: string,
643
- @Arg("enabled") enabled: boolean
644
- ): boolean {
645
- return true
646
- }
647
-
648
- @Mutation(returns => PaymentRequestResult)
649
- runtimeReinstallUnytDna(): PaymentRequestResult {
650
- return new PaymentRequestResult(true, "")
651
- }
652
-
653
- @Mutation(returns => PaymentRequestResult)
654
- runtimeSendHot(
655
- @Arg("recipient") recipient: string,
656
- @Arg("amount") amount: string
657
- ): PaymentRequestResult {
658
- return new PaymentRequestResult(true, "")
659
- }
660
-
661
- @Mutation(returns => PaymentRequestResult)
662
- runtimeSetUnytMembraneProof(
663
- @Arg("proof") proof: string
664
- ): PaymentRequestResult {
665
- return new PaymentRequestResult(true, "")
666
- }
667
-
668
- @Query(returns => String)
669
- runtimeHotWalletBalance(): string {
670
- return ""
671
- }
672
-
673
- @Query(returns => String)
674
- runtimeHotWalletHistory(
675
- @Arg("page", { nullable: true }) page?: number,
676
- @Arg("perPage", { nullable: true }) perPage?: number
677
- ): string {
678
- return ""
679
- }
680
-
681
- @Query(returns => String)
682
- runtimeHotAgentPubkey(): string {
683
- return ""
684
- }
685
-
686
- @Query(returns => String)
687
- runtimeUnytVersionInfo(): string {
688
- return ""
689
- }
690
- }
691
-
@@ -1,16 +0,0 @@
1
- import { ApolloQueryResult, FetchResult } from "@apollo/client/core"
2
-
3
- export default function unwrapApolloResult(result: ApolloQueryResult<any> | FetchResult<any>) {
4
- if(!result) {
5
- throw "Got no result from Apollo"
6
- }
7
- //@ts-ignore
8
- if(result.error) {
9
- //@ts-ignore
10
- throw result.error
11
- }
12
- if(result.errors) {
13
- throw result.errors
14
- }
15
- return result.data
16
- }