@coasys/ad4m 0.12.0 → 0.13.0-postmessage-ws-proxy.0

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 (388) hide show
  1. package/README.md +2 -25
  2. package/jest-setup.ts +1 -1
  3. package/lib/index.cjs +7444 -13939
  4. package/lib/index.js +5322 -11888
  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 -373
  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 +7 -2
  153. package/lib/src/index.js +7 -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 +150 -62
  166. package/lib/src/model/Ad4mModel.js +689 -417
  167. package/lib/src/model/Ad4mModel.test.js +1434 -688
  168. package/lib/src/model/ModelQueryBuilder.d.ts +59 -38
  169. package/lib/src/model/ModelQueryBuilder.js +317 -153
  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 +46 -18
  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 +60 -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 +189 -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 +156 -78
  220. package/lib/src/perspectives/PerspectiveProxy.js +474 -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/WakerSubscriptionManager.d.ts +3 -3
  224. package/lib/src/perspectives/WakerSubscriptionManager.js +12 -12
  225. package/lib/src/runtime/RuntimeClient.d.ts +34 -6
  226. package/lib/src/runtime/RuntimeClient.js +131 -362
  227. package/lib/src/runtime/RuntimeResolver.d.ts +28 -1
  228. package/lib/src/runtime/RuntimeResolver.js +197 -4
  229. package/lib/src/runtime/RuntimeTypes.d.ts +101 -0
  230. package/lib/src/runtime/RuntimeTypes.js +45 -0
  231. package/lib/src/schema.gql +27 -1
  232. package/lib/src/shacl/SHACLFlow.d.ts +1 -1
  233. package/lib/src/shacl/SHACLFlow.js +9 -9
  234. package/lib/src/shacl/SHACLShape.d.ts +8 -1
  235. package/lib/src/shacl/SHACLShape.js +57 -38
  236. package/lib/src/shacl/SHACLShape.test.js +82 -0
  237. package/lib/src/typeDefs.js +3 -602
  238. package/lib/src/utils.d.ts +6 -6
  239. package/lib/src/utils.js +6 -6
  240. package/package.json +6 -18
  241. package/rollup.config.js +0 -7
  242. package/src/Ad4mClient.test.ts +1192 -1288
  243. package/src/Ad4mClient.ts +46 -15
  244. package/src/Literal.test.ts +10 -5
  245. package/src/Literal.ts +6 -5
  246. package/src/agent/Agent.ts +0 -99
  247. package/src/agent/AgentClient.ts +238 -465
  248. package/src/agent/AgentStatus.ts +0 -12
  249. package/src/ai/AIClient.ts +96 -296
  250. package/src/ai/AITypes.ts +66 -0
  251. package/src/ai/Tasks.ts +0 -52
  252. package/src/apiClient.ts +287 -0
  253. package/src/cache/PersistentCache.ts +145 -0
  254. package/src/cache/cache.test.ts +713 -0
  255. package/src/expression/Expression.ts +3 -43
  256. package/src/expression/ExpressionClient.ts +148 -77
  257. package/src/expression/ExpressionRef.ts +2 -8
  258. package/src/generated/api/AIModelLoadingStatus.ts +3 -0
  259. package/src/generated/api/AddLinkExpressionRequest.ts +4 -0
  260. package/src/generated/api/AddLinkRequest.ts +4 -0
  261. package/src/generated/api/AddLinksBulkRequest.ts +4 -0
  262. package/src/generated/api/AddSdnaRequest.ts +3 -0
  263. package/src/generated/api/ApplyTemplateRequest.ts +3 -0
  264. package/src/generated/api/AuthInfoInput.ts +4 -0
  265. package/src/generated/api/CapabilityInput.ts +4 -0
  266. package/src/generated/api/CommitBatchRequest.ts +3 -0
  267. package/src/generated/api/ComputeLogEntry.ts +3 -0
  268. package/src/generated/api/CreateExpressionRequest.ts +3 -0
  269. package/src/generated/api/CreatePerspectiveRequest.ts +3 -0
  270. package/src/generated/api/CreateSubjectRequest.ts +3 -0
  271. package/src/generated/api/EmbedRequest.ts +3 -0
  272. package/src/generated/api/EntanglementProofInput.ts +3 -0
  273. package/src/generated/api/ExecuteCommandsRequest.ts +3 -0
  274. package/src/generated/api/ExportRequest.ts +3 -0
  275. package/src/generated/api/ExpressionManyRequest.ts +3 -0
  276. package/src/generated/api/ExpressionProof.ts +3 -0
  277. package/src/generated/api/ExpressionProofInput.ts +3 -0
  278. package/src/generated/api/FriendSendMessageRequest.ts +3 -0
  279. package/src/generated/api/FriendsListRequest.ts +3 -0
  280. package/src/generated/api/GenerateAgentRequest.ts +3 -0
  281. package/src/generated/api/GenerateJwtRequest.ts +3 -0
  282. package/src/generated/api/GetSubjectDataRequest.ts +3 -0
  283. package/src/generated/api/ImportAgentRequest.ts +3 -0
  284. package/src/generated/api/ImportRequest.ts +3 -0
  285. package/src/generated/api/JoinNeighbourhoodRequest.ts +3 -0
  286. package/src/generated/api/LanguageMetaInput.ts +3 -0
  287. package/src/generated/api/Link.ts +3 -0
  288. package/src/generated/api/LinkExpression.ts +6 -0
  289. package/src/generated/api/LinkExpressionInput.ts +6 -0
  290. package/src/generated/api/LinkInput.ts +3 -0
  291. package/src/generated/api/LinkLanguageTemplatesRequest.ts +3 -0
  292. package/src/generated/api/LinkMutations.ts +5 -0
  293. package/src/generated/api/LinkStatus.ts +3 -0
  294. package/src/generated/api/LockAgentRequest.ts +3 -0
  295. package/src/generated/api/ModelType.ts +3 -0
  296. package/src/generated/api/NotificationInput.ts +3 -0
  297. package/src/generated/api/OpenLinkRequest.ts +3 -0
  298. package/src/generated/api/PermitCapabilityRequest.ts +3 -0
  299. package/src/generated/api/PerspectiveInput.ts +4 -0
  300. package/src/generated/api/PromptRequest.ts +3 -0
  301. package/src/generated/api/PublishLanguageRequest.ts +4 -0
  302. package/src/generated/api/PublishNeighbourhoodRequest.ts +4 -0
  303. package/src/generated/api/QueryRequest.ts +6 -0
  304. package/src/generated/api/RemoveLinkRequest.ts +4 -0
  305. package/src/generated/api/RemoveLinksBulkRequest.ts +4 -0
  306. package/src/generated/api/ResourceInput.ts +3 -0
  307. package/src/generated/api/SetDefaultModelRequest.ts +4 -0
  308. package/src/generated/api/SetFreeHostingEnabledRequest.ts +3 -0
  309. package/src/generated/api/SetMultiUserRequest.ts +3 -0
  310. package/src/generated/api/SetStatusRequest.ts +3 -0
  311. package/src/generated/api/SignMessageRequest.ts +3 -0
  312. package/src/generated/api/TrustedAgentsRequest.ts +3 -0
  313. package/src/generated/api/UnlockAgentRequest.ts +3 -0
  314. package/src/generated/api/UpdateLinkRequest.ts +5 -0
  315. package/src/generated/api/UpdatePerspectiveRequest.ts +3 -0
  316. package/src/generated/api/UserStatistics.ts +3 -0
  317. package/src/generated/api/VerificationRequestResult.ts +3 -0
  318. package/src/generated/api/VerifySignatureRequest.ts +3 -0
  319. package/src/generated/api/WriteSettingsRequest.ts +3 -0
  320. package/src/generated/api/index.ts +49 -0
  321. package/src/index.ts +7 -2
  322. package/src/jestSetup.ts +1 -1
  323. package/src/language/Icon.ts +0 -4
  324. package/src/language/Language.ts +51 -248
  325. package/src/language/LanguageClient.ts +21 -132
  326. package/src/language/LanguageHandle.ts +0 -14
  327. package/src/language/LanguageMeta.ts +0 -29
  328. package/src/language/LanguageRef.ts +0 -7
  329. package/src/links/Links.ts +0 -37
  330. package/src/model/Ad4mModel.test.ts +1690 -777
  331. package/src/model/Ad4mModel.ts +749 -477
  332. package/src/model/ModelQueryBuilder.ts +356 -171
  333. package/src/model/decorators.ts +71 -22
  334. package/src/model/hydration.ts +3 -772
  335. package/src/model/index.ts +3 -4
  336. package/src/model/json-schema.ts +2 -2
  337. package/src/model/query-cache.test.ts +54 -0
  338. package/src/model/query-cache.ts +79 -0
  339. package/src/model/query-common.ts +1 -1
  340. package/src/model/query-sparql.test.ts +376 -0
  341. package/src/model/query-sparql.ts +504 -0
  342. package/src/model/query-utils.ts +209 -0
  343. package/src/model/relation-filtering.test.ts +15 -15
  344. package/src/model/sdna.ts +1 -1
  345. package/src/model/shacl-gen.ts +47 -17
  346. package/src/model/types.ts +65 -5
  347. package/src/neighbourhood/Neighbourhood.ts +0 -9
  348. package/src/neighbourhood/NeighbourhoodClient.ts +42 -207
  349. package/src/neighbourhood/NeighbourhoodProxy.test.ts +34 -36
  350. package/src/perspectives/LinkQuery.ts +0 -15
  351. package/src/perspectives/Perspective.ts +1 -12
  352. package/src/perspectives/PerspectiveClient.test.ts +262 -0
  353. package/src/perspectives/PerspectiveClient.ts +254 -468
  354. package/src/perspectives/PerspectiveDiff.ts +0 -8
  355. package/src/perspectives/PerspectiveHandle.ts +1 -12
  356. package/src/perspectives/PerspectiveProxy.test.ts +125 -0
  357. package/src/perspectives/PerspectiveProxy.ts +522 -434
  358. package/src/perspectives/WakerSubscriptionManager.ts +13 -13
  359. package/src/runtime/RuntimeClient.ts +166 -369
  360. package/src/runtime/RuntimeTypes.ts +144 -0
  361. package/src/shacl/SHACLFlow.ts +9 -9
  362. package/src/shacl/SHACLShape.test.ts +94 -0
  363. package/src/shacl/SHACLShape.ts +66 -39
  364. package/src/typeDefs.ts +3 -5
  365. package/src/utils.ts +6 -6
  366. package/tsconfig.json +3 -7
  367. package/lib/src/model/query-surreal.d.ts +0 -44
  368. package/lib/src/model/query-surreal.js +0 -249
  369. package/lib/src/model/surreal-utils.js +0 -128
  370. package/shims/reflect-metadata.ts +0 -0
  371. package/shims/type-graphql.ts +0 -75
  372. package/src/PubSub.ts +0 -17
  373. package/src/agent/AgentResolver.ts +0 -263
  374. package/src/ai/AIResolver.ts +0 -372
  375. package/src/buildSchema.ts +0 -43
  376. package/src/expression/ExpressionResolver.ts +0 -64
  377. package/src/language/LanguageContext.ts +0 -37
  378. package/src/language/LanguageResolver.ts +0 -98
  379. package/src/model/Subject.ts +0 -159
  380. package/src/model/prolog-facts.ts +0 -145
  381. package/src/model/query-prolog.ts +0 -148
  382. package/src/model/query-surreal.ts +0 -280
  383. package/src/model/surreal-utils.ts +0 -147
  384. package/src/neighbourhood/NeighbourhoodResolver.ts +0 -100
  385. package/src/perspectives/PerspectiveResolver.ts +0 -372
  386. package/src/runtime/RuntimeResolver.ts +0 -617
  387. package/src/unwrapApolloResult.ts +0 -16
  388. package/tsconfig-browser.json +0 -82
@@ -1,617 +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
-
211
- @ObjectType()
212
- export class VerificationRequestResult {
213
- @Field()
214
- success: boolean;
215
-
216
- @Field()
217
- message: string;
218
-
219
- @Field()
220
- requiresPassword: boolean;
221
-
222
- @Field()
223
- isExistingUser: boolean;
224
- }
225
-
226
- @ObjectType()
227
- export class HostingUserInfo {
228
- @Field()
229
- email: string;
230
-
231
- @Field()
232
- remainingCredits: string;
233
-
234
- @Field({ nullable: true })
235
- hotWalletAddress?: string;
236
-
237
- constructor(email: string, remainingCredits: string, hotWalletAddress?: string) {
238
- this.email = email;
239
- this.remainingCredits = remainingCredits;
240
- this.hotWalletAddress = hotWalletAddress;
241
- }
242
- }
243
-
244
- @ObjectType()
245
- export class PaymentRequestResult {
246
- @Field()
247
- success: boolean;
248
-
249
- @Field()
250
- message: string;
251
-
252
- constructor(success: boolean, message: string) {
253
- this.success = success;
254
- this.message = message;
255
- }
256
- }
257
-
258
- /**
259
- * Resolver classes are used here to define the GraphQL schema
260
- * (through the type-graphql annotations)
261
- * and are spawned in the client tests in Ad4mClient.test.ts.
262
- * For the latter, they return test fixtures.
263
- */
264
- @Resolver()
265
- export default class RuntimeResolver {
266
- @Mutation(returns => Boolean)
267
- runtimeQuit(): Boolean {
268
- return true
269
- }
270
-
271
- @Mutation(returns => Boolean)
272
- runtimeOpenLink(@Arg('url') url: string): Boolean {
273
- return true
274
- }
275
-
276
- @Query(returns => RuntimeInfo)
277
- runtimeInfo(): RuntimeInfo {
278
- return {
279
- ad4mExecutorVersion: "x.x.x",
280
- isInitialized: true,
281
- isUnlocked: true
282
- } as RuntimeInfo
283
- }
284
-
285
- @Mutation(returns => [String])
286
- addTrustedAgents(@Arg("agents", type => [String]) agents: string[]): string[] {
287
- return agents
288
- }
289
-
290
- @Mutation(returns => [String])
291
- deleteTrustedAgents(@Arg("agents", type => [String]) agents: string[]): string[] {
292
- return []
293
- }
294
-
295
- @Query(returns => [String])
296
- getTrustedAgents(): string[] {
297
- return ["agentPubKey"]
298
- }
299
-
300
- @Query(returns => [String])
301
- runtimeKnownLinkLanguageTemplates(): string[] {
302
- return ["Qm12345abcdef"]
303
- }
304
-
305
- @Mutation(returns => [String])
306
- runtimeAddKnownLinkLanguageTemplates(@Arg("addresses", type => [String]) addresses: string[]): string[] {
307
- return addresses
308
- }
309
-
310
- @Mutation(returns => [String])
311
- runtimeRemoveKnownLinkLanguageTemplates(@Arg("addresses", type => [String]) addresses: string[]): string[] {
312
- return []
313
- }
314
-
315
- @Query(returns => [String])
316
- runtimeFriends(): string[] {
317
- return ["did:test:friend"]
318
- }
319
-
320
- @Mutation(returns => [String])
321
- runtimeAddFriends(@Arg("dids", type => [String]) dids: string[]): string[] {
322
- return dids
323
- }
324
-
325
- @Mutation(returns => [String])
326
- runtimeRemoveFriends(@Arg("dids", type => [String]) dids: string[]): string[] {
327
- return []
328
- }
329
-
330
- @Query()
331
- runtimeHcAgentInfos(): string {
332
- 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]}}])
333
- }
334
-
335
- @Query()
336
- runtimeGetNetworkMetrics(): string {
337
- return JSON.stringify({
338
- "metrics": {},
339
- "stats": {}
340
- })
341
- }
342
-
343
- @Mutation(returns => Boolean)
344
- runtimeRestartHolochain(): boolean {
345
- return true
346
- }
347
-
348
- @Mutation(returns => Boolean)
349
- runtimeHcAddAgentInfos(@Arg("agentInfos", type => String) agentInfos): boolean {
350
- return true
351
- }
352
-
353
- @Query(returns => Boolean)
354
- runtimeVerifyStringSignedByDid(
355
- @Arg("did", type => String) did: string,
356
- @Arg("didSigningKeyId", type => String) didSigningKeyId: string,
357
- @Arg("data", type => String) data: string,
358
- @Arg("signedData", type => String) signedData: string) {
359
- return true
360
- }
361
-
362
- @Mutation()
363
- runtimeSetStatus(@Arg("status", type => PerspectiveInput) status: Perspective): boolean {
364
- return true
365
- }
366
-
367
- @Query({nullable: true})
368
- runtimeFriendStatus(@Arg("did", type => String) did: string): PerspectiveExpression {
369
- return testPerspectiveExpression
370
- }
371
-
372
- @Mutation()
373
- runtimeFriendSendMessage(
374
- @Arg("did", type => String) did: string,
375
- @Arg("message", type => PerspectiveInput) message: PerspectiveInput
376
- ): boolean {
377
- return true
378
- }
379
-
380
- @Query(returns => [PerspectiveExpression])
381
- runtimeMessageInbox(@Arg("filter", type => String, {nullable: true }) filter?: string): PerspectiveExpression[] {
382
- return [testPerspectiveExpression]
383
- }
384
-
385
- @Query(returns => [SentMessage])
386
- runtimeMessageOutbox(@Arg("filter", type => String, {nullable: true }) filter?: string): SentMessage[] {
387
- return [{
388
- recipient: "did:test:recipient",
389
- message: testPerspectiveExpression
390
- } as SentMessage]
391
- }
392
-
393
-
394
- @Subscription({topics: RUNTIME_MESSAGED_RECEIVED_TOPIC, nullable: true})
395
- runtimeMessageReceived(): PerspectiveExpression {
396
- return testPerspectiveExpression
397
- }
398
-
399
- @Subscription({topics: EXCEPTION_OCCURRED_TOPIC, nullable: true})
400
- exceptionOccurred(): ExceptionInfo {
401
- return {
402
- title: "Test title",
403
- message: "Test message",
404
- type: ExceptionType.LanguageIsNotLoaded,
405
- }
406
- }
407
-
408
- @Mutation()
409
- runtimeRequestInstallNotification(
410
- @Arg("notification", type => NotificationInput) notification: NotificationInput
411
- ): string {
412
- return "new-notification-id"
413
- }
414
-
415
- @Query(returns => [Notification])
416
- runtimeNotifications(): Notification[] {
417
- return [{
418
- id: "test-id",
419
- granted: false,
420
- description: "Test description",
421
- appName: "Test app name",
422
- appUrl: "https://example.com",
423
- appIconPath: "https://fluxsocial.io/favicon",
424
- trigger: "triple(X, ad4m://has_type, flux://message)",
425
- perspectiveIds: ["u983ud-jdhh38d"],
426
- webhookUrl: "https://example.com/webhook",
427
- webhookAuth: "test-auth",
428
-
429
- }]
430
- }
431
-
432
- @Mutation()
433
- runtimeUpdateNotification(
434
- @Arg("id", type => String) id: string,
435
- @Arg("notification", type => NotificationInput) notification: NotificationInput
436
- ): boolean {
437
- return true
438
- }
439
-
440
- @Mutation()
441
- runtimeRemoveNotification(@Arg("id", type => String) id: string): boolean {
442
- return true
443
- }
444
-
445
- @Mutation()
446
- runtimeGrantNotification(@Arg("id", type => String) id: string): boolean {
447
- return true
448
- }
449
-
450
- @Subscription({topics: RUNTIME_NOTIFICATION_TRIGGERED_TOPIC, nullable: true})
451
- runtimeNotificationTriggered(): TriggeredNotification {
452
- return {
453
- perspectiveId: "test-perspective-id",
454
- triggerMatch: "test-trigger-match",
455
- notification: {
456
- id: "test-id",
457
- granted: false,
458
- description: "Test description",
459
- appName: "Test app name",
460
- appUrl: "https://example.com",
461
- appIconPath: "https://fluxsocial.io/favicon",
462
- trigger: "triple(X, ad4m://has_type, flux://message)",
463
- perspectiveIds: ["u983ud-jdhh38d"],
464
- webhookUrl: "https://example.com/webhook",
465
- webhookAuth: "test-auth",
466
- }
467
- }
468
- }
469
-
470
- @Mutation()
471
- runtimeExportDb(@Arg("filePath", type => String) filePath: string): boolean {
472
- return true
473
- }
474
-
475
- @Mutation()
476
- runtimeImportDb(@Arg("filePath", type => String) filePath: string): boolean {
477
- return true
478
- }
479
-
480
- @Mutation()
481
- runtimeExportPerspective(
482
- @Arg("perspectiveUuid", type => String) perspectiveUuid: string,
483
- @Arg("filePath", type => String) filePath: string
484
- ): boolean {
485
- return true
486
- }
487
-
488
- @Mutation()
489
- runtimeImportPerspective(@Arg("filePath", type => String) filePath: string): boolean {
490
- return true
491
- }
492
-
493
- @Query(returns => Boolean)
494
- runtimeMultiUserEnabled(): boolean {
495
- return false
496
- }
497
-
498
- @Mutation(returns => Boolean)
499
- runtimeSetMultiUserEnabled(@Arg("enabled") enabled: boolean): boolean {
500
- return enabled
501
- }
502
-
503
- @Query(returns => [UserStatistics])
504
- runtimeListUsers(): UserStatistics[] {
505
- return [{
506
- email: "test@example.com",
507
- did: "did:key:test123",
508
- lastSeen: new Date().toISOString(),
509
- perspectiveCount: 5
510
- }]
511
- }
512
-
513
- @Mutation(returns => VerificationRequestResult)
514
- runtimeRequestLoginVerification(
515
- @Arg("email") email: string,
516
- @Arg("appInfo", { nullable: true }) appInfo?: AuthInfoInput
517
- ): VerificationRequestResult {
518
- // For testing: simulate existing user
519
- return {
520
- success: true,
521
- message: "Verification email sent",
522
- requiresPassword: false,
523
- isExistingUser: true
524
- }
525
- }
526
-
527
- @Mutation(returns => String)
528
- runtimeVerifyEmailCode(
529
- @Arg("email") email: string,
530
- @Arg("code") code: string,
531
- @Arg("verificationType") verificationType: string
532
- ): string {
533
- // For testing: return a test JWT token
534
- return "test-jwt-token-from-email-verification"
535
- }
536
-
537
- @Mutation(returns => Boolean)
538
- runtimeTestEmail(@Arg("to") to: string): boolean {
539
- // For testing: simulate successful email send
540
- return true
541
- }
542
-
543
- @Mutation(returns => UserCreationResult)
544
- runtimeCreateUser(
545
- @Arg("email") email: string,
546
- @Arg("password") password: string,
547
- @Arg("appInfo", { nullable: true }) appInfo?: AuthInfoInput
548
- ): UserCreationResult {
549
- // For testing: simulate successful user creation (email verification flow)
550
- return new UserCreationResult("did:key:test123", true)
551
- }
552
-
553
- @Mutation(returns => String)
554
- runtimeLoginUser(
555
- @Arg("email") email: string,
556
- @Arg("password") password: string
557
- ): string {
558
- // For testing: return a test JWT token
559
- return "test-jwt-token-from-password-login"
560
- }
561
-
562
- @Mutation(returns => Boolean)
563
- runtimeEmailTestModeEnable(): boolean {
564
- // For testing: enable test mode
565
- return true
566
- }
567
-
568
- @Mutation(returns => Boolean)
569
- runtimeEmailTestModeDisable(): boolean {
570
- // For testing: disable test mode
571
- return true
572
- }
573
-
574
- @Mutation(returns => String, { nullable: true })
575
- runtimeEmailTestGetCode(@Arg("email") email: string): string | null {
576
- // For testing: return a mock code
577
- return "123456"
578
- }
579
-
580
- @Mutation(returns => Boolean)
581
- runtimeEmailTestClearCodes(): boolean {
582
- // For testing: clear codes
583
- return true
584
- }
585
-
586
- @Mutation(returns => Boolean)
587
- runtimeEmailTestSetExpiry(
588
- @Arg("email") email: string,
589
- @Arg("verificationType") verificationType: string,
590
- @Arg("expiresAt") expiresAt: number
591
- ): boolean {
592
- // For testing: simulate setting expiry (no-op in mock)
593
- return true
594
- }
595
-
596
- // Hosting mutations & queries
597
-
598
- @Query(returns => HostingUserInfo)
599
- runtimeHostingUserInfo(): HostingUserInfo {
600
- return new HostingUserInfo("test@example.com", "100000000", null)
601
- }
602
-
603
- @Mutation(returns => Boolean)
604
- runtimeSetHotWalletAddress(
605
- @Arg("address") address: string
606
- ): boolean {
607
- return true
608
- }
609
-
610
- @Mutation(returns => PaymentRequestResult)
611
- runtimeRequestPayment(
612
- @Arg("amountHOT") amountHOT: string
613
- ): PaymentRequestResult {
614
- return new PaymentRequestResult(true, "Mock payment of " + amountHOT + " base units credited")
615
- }
616
- }
617
-
@@ -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
- }