@coasys/ad4m 0.13.0-test-3 → 0.13.0-test-5

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 (337) hide show
  1. package/README.md +2 -25
  2. package/jest-setup.ts +1 -1
  3. package/lib/index.cjs +6717 -15519
  4. package/lib/index.js +4811 -13662
  5. package/lib/src/Ad4mClient.d.ts +7 -3
  6. package/lib/src/Ad4mClient.js +39 -13
  7. package/lib/src/agent/Agent.js +26 -272
  8. package/lib/src/agent/AgentClient.d.ts +10 -21
  9. package/lib/src/agent/AgentClient.js +75 -427
  10. package/lib/src/agent/AgentStatus.js +2 -37
  11. package/lib/src/ai/AIClient.d.ts +12 -4
  12. package/lib/src/ai/AIClient.js +81 -285
  13. package/lib/src/ai/AITypes.d.ts +55 -0
  14. package/lib/src/ai/AITypes.js +18 -0
  15. package/lib/src/ai/Tasks.js +10 -133
  16. package/lib/src/apiClient.d.ts +52 -0
  17. package/lib/src/apiClient.js +231 -0
  18. package/lib/src/expression/Expression.d.ts +1 -1
  19. package/lib/src/expression/Expression.js +13 -122
  20. package/lib/src/expression/ExpressionClient.d.ts +3 -3
  21. package/lib/src/expression/ExpressionClient.js +13 -76
  22. package/lib/src/expression/ExpressionRef.js +2 -25
  23. package/lib/src/generated/api/AIModelLoadingStatus.d.ts +7 -0
  24. package/lib/src/generated/api/AIModelLoadingStatus.js +2 -0
  25. package/lib/src/generated/api/AddLinkExpressionRequest.d.ts +6 -0
  26. package/lib/src/generated/api/AddLinkExpressionRequest.js +1 -0
  27. package/lib/src/generated/api/AddLinkRequest.d.ts +6 -0
  28. package/lib/src/generated/api/AddLinkRequest.js +1 -0
  29. package/lib/src/generated/api/AddLinksBulkRequest.d.ts +6 -0
  30. package/lib/src/generated/api/AddLinksBulkRequest.js +1 -0
  31. package/lib/src/generated/api/AddSdnaRequest.d.ts +6 -0
  32. package/lib/src/generated/api/AddSdnaRequest.js +2 -0
  33. package/lib/src/generated/api/ApplyTemplateRequest.d.ts +4 -0
  34. package/lib/src/generated/api/ApplyTemplateRequest.js +2 -0
  35. package/lib/src/generated/api/AuthInfoInput.d.ts +10 -0
  36. package/lib/src/generated/api/AuthInfoInput.js +1 -0
  37. package/lib/src/generated/api/CapabilityInput.d.ts +5 -0
  38. package/lib/src/generated/api/CapabilityInput.js +1 -0
  39. package/lib/src/generated/api/CommitBatchRequest.d.ts +3 -0
  40. package/lib/src/generated/api/CommitBatchRequest.js +2 -0
  41. package/lib/src/generated/api/ComputeLogEntry.d.ts +9 -0
  42. package/lib/src/generated/api/ComputeLogEntry.js +2 -0
  43. package/lib/src/generated/api/CreateExpressionRequest.d.ts +4 -0
  44. package/lib/src/generated/api/CreateExpressionRequest.js +2 -0
  45. package/lib/src/generated/api/CreatePerspectiveRequest.d.ts +3 -0
  46. package/lib/src/generated/api/CreatePerspectiveRequest.js +2 -0
  47. package/lib/src/generated/api/CreateSubjectRequest.d.ts +6 -0
  48. package/lib/src/generated/api/CreateSubjectRequest.js +2 -0
  49. package/lib/src/generated/api/EmbedRequest.d.ts +4 -0
  50. package/lib/src/generated/api/EmbedRequest.js +2 -0
  51. package/lib/src/generated/api/EntanglementProofInput.d.ts +6 -0
  52. package/lib/src/generated/api/EntanglementProofInput.js +2 -0
  53. package/lib/src/generated/api/ExecuteCommandsRequest.d.ts +4 -0
  54. package/lib/src/generated/api/ExecuteCommandsRequest.js +2 -0
  55. package/lib/src/generated/api/ExportRequest.d.ts +5 -0
  56. package/lib/src/generated/api/ExportRequest.js +2 -0
  57. package/lib/src/generated/api/ExpressionManyRequest.d.ts +3 -0
  58. package/lib/src/generated/api/ExpressionManyRequest.js +2 -0
  59. package/lib/src/generated/api/ExpressionProof.d.ts +4 -0
  60. package/lib/src/generated/api/ExpressionProof.js +2 -0
  61. package/lib/src/generated/api/ExpressionProofInput.d.ts +6 -0
  62. package/lib/src/generated/api/ExpressionProofInput.js +2 -0
  63. package/lib/src/generated/api/FriendSendMessageRequest.d.ts +3 -0
  64. package/lib/src/generated/api/FriendSendMessageRequest.js +2 -0
  65. package/lib/src/generated/api/FriendsListRequest.d.ts +3 -0
  66. package/lib/src/generated/api/FriendsListRequest.js +2 -0
  67. package/lib/src/generated/api/GenerateAgentRequest.d.ts +3 -0
  68. package/lib/src/generated/api/GenerateAgentRequest.js +2 -0
  69. package/lib/src/generated/api/GenerateJwtRequest.d.ts +4 -0
  70. package/lib/src/generated/api/GenerateJwtRequest.js +2 -0
  71. package/lib/src/generated/api/GetSubjectDataRequest.d.ts +4 -0
  72. package/lib/src/generated/api/GetSubjectDataRequest.js +2 -0
  73. package/lib/src/generated/api/ImportAgentRequest.d.ts +6 -0
  74. package/lib/src/generated/api/ImportAgentRequest.js +2 -0
  75. package/lib/src/generated/api/ImportRequest.d.ts +4 -0
  76. package/lib/src/generated/api/ImportRequest.js +2 -0
  77. package/lib/src/generated/api/JoinNeighbourhoodRequest.d.ts +3 -0
  78. package/lib/src/generated/api/JoinNeighbourhoodRequest.js +2 -0
  79. package/lib/src/generated/api/LanguageMetaInput.d.ts +6 -0
  80. package/lib/src/generated/api/LanguageMetaInput.js +2 -0
  81. package/lib/src/generated/api/Link.d.ts +5 -0
  82. package/lib/src/generated/api/Link.js +2 -0
  83. package/lib/src/generated/api/LinkExpression.d.ts +10 -0
  84. package/lib/src/generated/api/LinkExpression.js +1 -0
  85. package/lib/src/generated/api/LinkExpressionInput.d.ts +10 -0
  86. package/lib/src/generated/api/LinkExpressionInput.js +1 -0
  87. package/lib/src/generated/api/LinkInput.d.ts +5 -0
  88. package/lib/src/generated/api/LinkInput.js +2 -0
  89. package/lib/src/generated/api/LinkLanguageTemplatesRequest.d.ts +3 -0
  90. package/lib/src/generated/api/LinkLanguageTemplatesRequest.js +2 -0
  91. package/lib/src/generated/api/LinkMutations.d.ts +6 -0
  92. package/lib/src/generated/api/LinkMutations.js +1 -0
  93. package/lib/src/generated/api/LinkStatus.d.ts +1 -0
  94. package/lib/src/generated/api/LinkStatus.js +2 -0
  95. package/lib/src/generated/api/LockAgentRequest.d.ts +3 -0
  96. package/lib/src/generated/api/LockAgentRequest.js +2 -0
  97. package/lib/src/generated/api/ModelType.d.ts +1 -0
  98. package/lib/src/generated/api/ModelType.js +2 -0
  99. package/lib/src/generated/api/NotificationInput.d.ts +10 -0
  100. package/lib/src/generated/api/NotificationInput.js +2 -0
  101. package/lib/src/generated/api/OpenLinkRequest.d.ts +3 -0
  102. package/lib/src/generated/api/OpenLinkRequest.js +2 -0
  103. package/lib/src/generated/api/PermitCapabilityRequest.d.ts +3 -0
  104. package/lib/src/generated/api/PermitCapabilityRequest.js +2 -0
  105. package/lib/src/generated/api/PerspectiveInput.d.ts +4 -0
  106. package/lib/src/generated/api/PerspectiveInput.js +1 -0
  107. package/lib/src/generated/api/PromptRequest.d.ts +4 -0
  108. package/lib/src/generated/api/PromptRequest.js +2 -0
  109. package/lib/src/generated/api/PublishLanguageRequest.d.ts +5 -0
  110. package/lib/src/generated/api/PublishLanguageRequest.js +1 -0
  111. package/lib/src/generated/api/PublishNeighbourhoodRequest.d.ts +6 -0
  112. package/lib/src/generated/api/PublishNeighbourhoodRequest.js +1 -0
  113. package/lib/src/generated/api/QueryRequest.d.ts +7 -0
  114. package/lib/src/generated/api/QueryRequest.js +2 -0
  115. package/lib/src/generated/api/RemoveLinkRequest.d.ts +5 -0
  116. package/lib/src/generated/api/RemoveLinkRequest.js +1 -0
  117. package/lib/src/generated/api/RemoveLinksBulkRequest.d.ts +5 -0
  118. package/lib/src/generated/api/RemoveLinksBulkRequest.js +1 -0
  119. package/lib/src/generated/api/ResourceInput.d.ts +4 -0
  120. package/lib/src/generated/api/ResourceInput.js +2 -0
  121. package/lib/src/generated/api/SetDefaultModelRequest.d.ts +4 -0
  122. package/lib/src/generated/api/SetDefaultModelRequest.js +1 -0
  123. package/lib/src/generated/api/SetFreeHostingEnabledRequest.d.ts +3 -0
  124. package/lib/src/generated/api/SetFreeHostingEnabledRequest.js +2 -0
  125. package/lib/src/generated/api/SetMultiUserRequest.d.ts +3 -0
  126. package/lib/src/generated/api/SetMultiUserRequest.js +2 -0
  127. package/lib/src/generated/api/SetStatusRequest.d.ts +3 -0
  128. package/lib/src/generated/api/SetStatusRequest.js +2 -0
  129. package/lib/src/generated/api/SignMessageRequest.d.ts +3 -0
  130. package/lib/src/generated/api/SignMessageRequest.js +2 -0
  131. package/lib/src/generated/api/TrustedAgentsRequest.d.ts +3 -0
  132. package/lib/src/generated/api/TrustedAgentsRequest.js +2 -0
  133. package/lib/src/generated/api/UnlockAgentRequest.d.ts +4 -0
  134. package/lib/src/generated/api/UnlockAgentRequest.js +2 -0
  135. package/lib/src/generated/api/UpdateLinkRequest.d.ts +7 -0
  136. package/lib/src/generated/api/UpdateLinkRequest.js +1 -0
  137. package/lib/src/generated/api/UpdatePerspectiveRequest.d.ts +3 -0
  138. package/lib/src/generated/api/UpdatePerspectiveRequest.js +2 -0
  139. package/lib/src/generated/api/UserStatistics.d.ts +9 -0
  140. package/lib/src/generated/api/UserStatistics.js +2 -0
  141. package/lib/src/generated/api/VerificationRequestResult.d.ts +6 -0
  142. package/lib/src/generated/api/VerificationRequestResult.js +2 -0
  143. package/lib/src/generated/api/VerifySignatureRequest.d.ts +5 -0
  144. package/lib/src/generated/api/VerifySignatureRequest.js +2 -0
  145. package/lib/src/generated/api/WriteSettingsRequest.d.ts +3 -0
  146. package/lib/src/generated/api/WriteSettingsRequest.js +2 -0
  147. package/lib/src/generated/api/index.d.ts +42 -0
  148. package/lib/src/generated/api/index.js +7 -0
  149. package/lib/src/index.d.ts +6 -1
  150. package/lib/src/index.js +6 -1
  151. package/lib/src/jestSetup.d.ts +0 -1
  152. package/lib/src/jestSetup.js +1 -1
  153. package/lib/src/language/Icon.js +2 -21
  154. package/lib/src/language/Language.d.ts +1 -1
  155. package/lib/src/language/Language.js +10 -76
  156. package/lib/src/language/LanguageClient.d.ts +2 -2
  157. package/lib/src/language/LanguageClient.js +15 -105
  158. package/lib/src/language/LanguageHandle.js +2 -41
  159. package/lib/src/language/LanguageMeta.js +4 -75
  160. package/lib/src/language/LanguageRef.js +2 -25
  161. package/lib/src/links/Links.js +14 -111
  162. package/lib/src/model/Ad4mModel.d.ts +76 -44
  163. package/lib/src/model/Ad4mModel.js +635 -479
  164. package/lib/src/model/Ad4mModel.test.js +371 -815
  165. package/lib/src/model/ModelQueryBuilder.d.ts +15 -27
  166. package/lib/src/model/ModelQueryBuilder.js +163 -224
  167. package/lib/src/model/decorators.d.ts +22 -0
  168. package/lib/src/model/decorators.js +7 -0
  169. package/lib/src/model/hydration.d.ts +3 -93
  170. package/lib/src/model/hydration.js +3 -970
  171. package/lib/src/model/index.d.ts +0 -4
  172. package/lib/src/model/index.js +0 -4
  173. package/lib/src/model/model-manifest.d.ts +41 -0
  174. package/lib/src/model/model-manifest.js +11 -0
  175. package/lib/src/model/query-sparql.d.ts +4 -67
  176. package/lib/src/model/query-sparql.js +26 -322
  177. package/lib/src/model/query-sparql.test.js +35 -218
  178. package/lib/src/model/query-utils.d.ts +1 -0
  179. package/lib/src/model/query-utils.js +46 -1
  180. package/lib/src/model/shacl-gen.js +4 -0
  181. package/lib/src/model/types.d.ts +51 -43
  182. package/lib/src/model/types.js +4 -1
  183. package/lib/src/neighbourhood/Neighbourhood.js +4 -32
  184. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +3 -3
  185. package/lib/src/neighbourhood/NeighbourhoodClient.js +40 -203
  186. package/lib/src/perspectives/LinkQuery.js +2 -42
  187. package/lib/src/perspectives/Perspective.d.ts +1 -1
  188. package/lib/src/perspectives/Perspective.js +10 -52
  189. package/lib/src/perspectives/PerspectiveClient.d.ts +13 -17
  190. package/lib/src/perspectives/PerspectiveClient.js +179 -429
  191. package/lib/src/perspectives/PerspectiveClient.test.js +55 -0
  192. package/lib/src/perspectives/PerspectiveDiff.js +4 -31
  193. package/lib/src/perspectives/PerspectiveHandle.js +3 -43
  194. package/lib/src/perspectives/PerspectiveProxy.d.ts +106 -71
  195. package/lib/src/perspectives/PerspectiveProxy.js +289 -310
  196. package/lib/src/runtime/RuntimeClient.d.ts +6 -6
  197. package/lib/src/runtime/RuntimeClient.js +93 -467
  198. package/lib/src/runtime/RuntimeTypes.d.ts +101 -0
  199. package/lib/src/runtime/RuntimeTypes.js +45 -0
  200. package/lib/src/shacl/SHACLShape.d.ts +7 -0
  201. package/lib/src/shacl/SHACLShape.js +19 -0
  202. package/lib/src/shacl/SHACLShape.test.js +82 -0
  203. package/lib/src/typeDefs.js +3 -628
  204. package/package.json +6 -18
  205. package/rollup.config.js +0 -7
  206. package/src/Ad4mClient.test.ts +1179 -1340
  207. package/src/Ad4mClient.ts +40 -15
  208. package/src/agent/Agent.ts +0 -99
  209. package/src/agent/AgentClient.ts +112 -526
  210. package/src/agent/AgentStatus.ts +0 -12
  211. package/src/ai/AIClient.ts +96 -296
  212. package/src/ai/AITypes.ts +66 -0
  213. package/src/ai/Tasks.ts +0 -52
  214. package/src/apiClient.ts +283 -0
  215. package/src/expression/Expression.ts +3 -43
  216. package/src/expression/ExpressionClient.ts +14 -77
  217. package/src/expression/ExpressionRef.ts +0 -6
  218. package/src/generated/api/AIModelLoadingStatus.ts +3 -0
  219. package/src/generated/api/AddLinkExpressionRequest.ts +4 -0
  220. package/src/generated/api/AddLinkRequest.ts +4 -0
  221. package/src/generated/api/AddLinksBulkRequest.ts +4 -0
  222. package/src/generated/api/AddSdnaRequest.ts +3 -0
  223. package/src/generated/api/ApplyTemplateRequest.ts +3 -0
  224. package/src/generated/api/AuthInfoInput.ts +4 -0
  225. package/src/generated/api/CapabilityInput.ts +4 -0
  226. package/src/generated/api/CommitBatchRequest.ts +3 -0
  227. package/src/generated/api/ComputeLogEntry.ts +3 -0
  228. package/src/generated/api/CreateExpressionRequest.ts +3 -0
  229. package/src/generated/api/CreatePerspectiveRequest.ts +3 -0
  230. package/src/generated/api/CreateSubjectRequest.ts +3 -0
  231. package/src/generated/api/EmbedRequest.ts +3 -0
  232. package/src/generated/api/EntanglementProofInput.ts +3 -0
  233. package/src/generated/api/ExecuteCommandsRequest.ts +3 -0
  234. package/src/generated/api/ExportRequest.ts +3 -0
  235. package/src/generated/api/ExpressionManyRequest.ts +3 -0
  236. package/src/generated/api/ExpressionProof.ts +3 -0
  237. package/src/generated/api/ExpressionProofInput.ts +3 -0
  238. package/src/generated/api/FriendSendMessageRequest.ts +3 -0
  239. package/src/generated/api/FriendsListRequest.ts +3 -0
  240. package/src/generated/api/GenerateAgentRequest.ts +3 -0
  241. package/src/generated/api/GenerateJwtRequest.ts +3 -0
  242. package/src/generated/api/GetSubjectDataRequest.ts +3 -0
  243. package/src/generated/api/ImportAgentRequest.ts +3 -0
  244. package/src/generated/api/ImportRequest.ts +3 -0
  245. package/src/generated/api/JoinNeighbourhoodRequest.ts +3 -0
  246. package/src/generated/api/LanguageMetaInput.ts +3 -0
  247. package/src/generated/api/Link.ts +3 -0
  248. package/src/generated/api/LinkExpression.ts +6 -0
  249. package/src/generated/api/LinkExpressionInput.ts +6 -0
  250. package/src/generated/api/LinkInput.ts +3 -0
  251. package/src/generated/api/LinkLanguageTemplatesRequest.ts +3 -0
  252. package/src/generated/api/LinkMutations.ts +5 -0
  253. package/src/generated/api/LinkStatus.ts +3 -0
  254. package/src/generated/api/LockAgentRequest.ts +3 -0
  255. package/src/generated/api/ModelType.ts +3 -0
  256. package/src/generated/api/NotificationInput.ts +3 -0
  257. package/src/generated/api/OpenLinkRequest.ts +3 -0
  258. package/src/generated/api/PermitCapabilityRequest.ts +3 -0
  259. package/src/generated/api/PerspectiveInput.ts +4 -0
  260. package/src/generated/api/PromptRequest.ts +3 -0
  261. package/src/generated/api/PublishLanguageRequest.ts +4 -0
  262. package/src/generated/api/PublishNeighbourhoodRequest.ts +4 -0
  263. package/src/generated/api/QueryRequest.ts +6 -0
  264. package/src/generated/api/RemoveLinkRequest.ts +4 -0
  265. package/src/generated/api/RemoveLinksBulkRequest.ts +4 -0
  266. package/src/generated/api/ResourceInput.ts +3 -0
  267. package/src/generated/api/SetDefaultModelRequest.ts +4 -0
  268. package/src/generated/api/SetFreeHostingEnabledRequest.ts +3 -0
  269. package/src/generated/api/SetMultiUserRequest.ts +3 -0
  270. package/src/generated/api/SetStatusRequest.ts +3 -0
  271. package/src/generated/api/SignMessageRequest.ts +3 -0
  272. package/src/generated/api/TrustedAgentsRequest.ts +3 -0
  273. package/src/generated/api/UnlockAgentRequest.ts +3 -0
  274. package/src/generated/api/UpdateLinkRequest.ts +5 -0
  275. package/src/generated/api/UpdatePerspectiveRequest.ts +3 -0
  276. package/src/generated/api/UserStatistics.ts +3 -0
  277. package/src/generated/api/VerificationRequestResult.ts +3 -0
  278. package/src/generated/api/VerifySignatureRequest.ts +3 -0
  279. package/src/generated/api/WriteSettingsRequest.ts +3 -0
  280. package/src/generated/api/index.ts +49 -0
  281. package/src/index.ts +6 -1
  282. package/src/jestSetup.ts +1 -1
  283. package/src/language/Icon.ts +0 -4
  284. package/src/language/Language.ts +2 -23
  285. package/src/language/LanguageClient.ts +21 -132
  286. package/src/language/LanguageHandle.ts +0 -14
  287. package/src/language/LanguageMeta.ts +0 -29
  288. package/src/language/LanguageRef.ts +0 -7
  289. package/src/links/Links.ts +0 -37
  290. package/src/model/Ad4mModel.test.ts +766 -1173
  291. package/src/model/Ad4mModel.ts +664 -529
  292. package/src/model/ModelQueryBuilder.ts +203 -251
  293. package/src/model/decorators.ts +29 -0
  294. package/src/model/hydration.ts +3 -1037
  295. package/src/model/index.ts +0 -4
  296. package/src/model/query-sparql.test.ts +34 -242
  297. package/src/model/query-sparql.ts +27 -337
  298. package/src/model/query-utils.ts +47 -2
  299. package/src/model/shacl-gen.ts +5 -0
  300. package/src/model/types.ts +55 -44
  301. package/src/neighbourhood/Neighbourhood.ts +0 -9
  302. package/src/neighbourhood/NeighbourhoodClient.ts +42 -207
  303. package/src/neighbourhood/NeighbourhoodProxy.test.ts +34 -36
  304. package/src/perspectives/LinkQuery.ts +0 -15
  305. package/src/perspectives/Perspective.ts +1 -12
  306. package/src/perspectives/PerspectiveClient.test.ts +206 -148
  307. package/src/perspectives/PerspectiveClient.ts +247 -442
  308. package/src/perspectives/PerspectiveDiff.ts +0 -8
  309. package/src/perspectives/PerspectiveHandle.ts +1 -12
  310. package/src/perspectives/PerspectiveProxy.test.ts +41 -0
  311. package/src/perspectives/PerspectiveProxy.ts +331 -348
  312. package/src/runtime/RuntimeClient.ts +112 -474
  313. package/src/runtime/RuntimeTypes.ts +144 -0
  314. package/src/shacl/SHACLShape.test.ts +94 -0
  315. package/src/shacl/SHACLShape.ts +27 -0
  316. package/src/typeDefs.ts +3 -5
  317. package/tsconfig.json +3 -7
  318. package/shims/reflect-metadata.ts +0 -0
  319. package/shims/type-graphql.ts +0 -75
  320. package/src/PubSub.ts +0 -17
  321. package/src/agent/AgentResolver.ts +0 -263
  322. package/src/ai/AIResolver.ts +0 -372
  323. package/src/buildSchema.ts +0 -43
  324. package/src/expression/ExpressionResolver.ts +0 -64
  325. package/src/language/LanguageResolver.ts +0 -98
  326. package/src/model/Subject.ts +0 -159
  327. package/src/model/hydration-batch.ts +0 -205
  328. package/src/model/hydration-batching.test.ts +0 -563
  329. package/src/model/prolog-facts.ts +0 -145
  330. package/src/model/query-prolog.ts +0 -148
  331. package/src/model/query-sparql-batch.ts +0 -301
  332. package/src/model/subscription-delta.test.ts +0 -207
  333. package/src/model/subscription-pool.ts +0 -211
  334. package/src/neighbourhood/NeighbourhoodResolver.ts +0 -100
  335. package/src/perspectives/PerspectiveResolver.ts +0 -364
  336. package/src/runtime/RuntimeResolver.ts +0 -749
  337. package/src/unwrapApolloResult.ts +0 -16
@@ -167,3 +167,58 @@ describe('PerspectiveClient proxy cache', () => {
167
167
  expect(original.name).toBe('FreshName'); // original ref also updated
168
168
  });
169
169
  });
170
+ describe('PerspectiveProxy getClassShape sh:in URI-decoding', () => {
171
+ // This tests the sh:in parsing logic in getClassShape() which was fixed
172
+ // to URI-decode values from the Rust executor's SPARQL results
173
+ function parseShInValue(raw) {
174
+ // Reproduce the exact parsing logic from PerspectiveProxy.getClassShape()
175
+ try {
176
+ if (raw.startsWith('literal:string:')) {
177
+ raw = decodeURIComponent(raw.substring('literal:string:'.length));
178
+ }
179
+ return JSON.parse(raw);
180
+ }
181
+ catch {
182
+ return undefined;
183
+ }
184
+ }
185
+ it('parses plain JSON sh:in values', () => {
186
+ const result = parseShInValue('[{"value":"a"},{"value":"b","label":"B"}]');
187
+ expect(result).toEqual([
188
+ { value: 'a' },
189
+ { value: 'b', label: 'B' },
190
+ ]);
191
+ });
192
+ it('strips literal:string: prefix and parses', () => {
193
+ const result = parseShInValue('literal:string:[{"value":"x"},{"value":"y"}]');
194
+ expect(result).toEqual([
195
+ { value: 'x' },
196
+ { value: 'y' },
197
+ ]);
198
+ });
199
+ it('URI-decodes encoded sh:in values from Rust executor', () => {
200
+ // Rust executor may URI-encode the JSON when returning SPARQL results
201
+ const encoded = 'literal:string:' + encodeURIComponent('[{"value":"hello world"},{"value":"a&b"}]');
202
+ const result = parseShInValue(encoded);
203
+ expect(result).toEqual([
204
+ { value: 'hello world' },
205
+ { value: 'a&b' },
206
+ ]);
207
+ });
208
+ it('handles double-encoded brackets and quotes', () => {
209
+ const encoded = 'literal:string:%5B%7B%22value%22%3A%22active%22%7D%2C%7B%22value%22%3A%22inactive%22%7D%5D';
210
+ const result = parseShInValue(encoded);
211
+ expect(result).toEqual([
212
+ { value: 'active' },
213
+ { value: 'inactive' },
214
+ ]);
215
+ });
216
+ it('returns undefined for malformed JSON', () => {
217
+ const result = parseShInValue('literal:string:not-json');
218
+ expect(result).toBeUndefined();
219
+ });
220
+ it('handles already-decoded values without prefix', () => {
221
+ const result = parseShInValue('[{"value":"test"}]');
222
+ expect(result).toEqual([{ value: 'test' }]);
223
+ });
224
+ });
@@ -1,33 +1,6 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { Field, ObjectType } from "type-graphql";
11
1
  import { ExpressionGeneric } from "../expression/Expression";
12
- import { LinkExpression } from "../links/Links";
13
- let PerspectiveDiff = class PerspectiveDiff {
14
- };
15
- __decorate([
16
- Field(type => [LinkExpression]),
17
- __metadata("design:type", Array)
18
- ], PerspectiveDiff.prototype, "additions", void 0);
19
- __decorate([
20
- Field(type => [LinkExpression]),
21
- __metadata("design:type", Array)
22
- ], PerspectiveDiff.prototype, "removals", void 0);
23
- PerspectiveDiff = __decorate([
24
- ObjectType()
25
- ], PerspectiveDiff);
26
- export { PerspectiveDiff };
27
- let PerspectiveDiffExpression = class PerspectiveDiffExpression extends ExpressionGeneric(PerspectiveDiff) {
28
- };
29
- PerspectiveDiffExpression = __decorate([
30
- ObjectType()
31
- ], PerspectiveDiffExpression);
32
- export { PerspectiveDiffExpression };
2
+ export class PerspectiveDiff {
3
+ }
4
+ export class PerspectiveDiffExpression extends ExpressionGeneric(PerspectiveDiff) {
5
+ }
33
6
  ;
@@ -1,14 +1,3 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { Field, ObjectType } from "type-graphql";
11
- import { NeighbourhoodExpression } from "../neighbourhood/Neighbourhood";
12
1
  export var PerspectiveState;
13
2
  (function (PerspectiveState) {
14
3
  PerspectiveState["Private"] = "PRIVATE";
@@ -18,10 +7,10 @@ export var PerspectiveState;
18
7
  PerspectiveState["LinkLanguageInstalledButNotSynced"] = "LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED";
19
8
  PerspectiveState["Synced"] = "SYNCED";
20
9
  })(PerspectiveState || (PerspectiveState = {}));
21
- // This type is used in the GraphQL interface to reference a mutable
10
+ // This type is used in the REST interface to reference a mutable
22
11
  // prespective that is implemented locally by the Ad4m runtime.
23
12
  // The UUID is used in mutations to identify the perspective that gets mutated.
24
- let PerspectiveHandle = class PerspectiveHandle {
13
+ export class PerspectiveHandle {
25
14
  constructor(uuid, name, state) {
26
15
  this.uuid = uuid;
27
16
  this.name = name;
@@ -32,33 +21,4 @@ let PerspectiveHandle = class PerspectiveHandle {
32
21
  this.state = PerspectiveState.Private;
33
22
  }
34
23
  }
35
- };
36
- __decorate([
37
- Field(),
38
- __metadata("design:type", String)
39
- ], PerspectiveHandle.prototype, "uuid", void 0);
40
- __decorate([
41
- Field(),
42
- __metadata("design:type", String)
43
- ], PerspectiveHandle.prototype, "name", void 0);
44
- __decorate([
45
- Field(),
46
- __metadata("design:type", String)
47
- ], PerspectiveHandle.prototype, "state", void 0);
48
- __decorate([
49
- Field(type => String, { nullable: true }),
50
- __metadata("design:type", String)
51
- ], PerspectiveHandle.prototype, "sharedUrl", void 0);
52
- __decorate([
53
- Field(type => NeighbourhoodExpression, { nullable: true }),
54
- __metadata("design:type", NeighbourhoodExpression)
55
- ], PerspectiveHandle.prototype, "neighbourhood", void 0);
56
- __decorate([
57
- Field(type => [String], { nullable: true }),
58
- __metadata("design:type", Array)
59
- ], PerspectiveHandle.prototype, "owners", void 0);
60
- PerspectiveHandle = __decorate([
61
- ObjectType(),
62
- __metadata("design:paramtypes", [String, String, String])
63
- ], PerspectiveHandle);
64
- export { PerspectiveHandle };
24
+ }
@@ -16,7 +16,7 @@ type QueryCallback = (result: AllInstancesResult) => void;
16
16
  * This class handles:
17
17
  * - Keeping the subscription alive by sending periodic keepalive signals
18
18
  * - Managing callbacks for result updates
19
- * - Subscribing to query updates via GraphQL subscriptions
19
+ * - Subscribing to query updates via WebSocket subscriptions
20
20
  * - Maintaining the latest query result
21
21
  * - Ensuring subscription is fully initialized before allowing access
22
22
  * - Cleaning up resources when disposed
@@ -107,7 +107,7 @@ export declare class QuerySubscriptionProxy {
107
107
  *
108
108
  * This method:
109
109
  * 1. Stops the keepalive timer
110
- * 2. Unsubscribes from GraphQL subscription updates
110
+ * 2. Unsubscribes from subscription updates
111
111
  * 3. Clears all registered callbacks
112
112
  * 4. Cleans up any pending initialization timeout
113
113
  *
@@ -175,6 +175,8 @@ export declare class PerspectiveProxy {
175
175
  state: PerspectiveState | null;
176
176
  /** List of owners of this perspective */
177
177
  owners?: string[];
178
+ /** @internal Exposed for ModelQueryBuilder subscription management */
179
+ get client(): PerspectiveClient;
178
180
  /**
179
181
  * Creates a new PerspectiveProxy instance.
180
182
  * Note: Don't create this directly, use ad4m.perspective.add() instead.
@@ -317,6 +319,49 @@ export declare class PerspectiveProxy {
317
319
  * @returns Query results as parsed JSON
318
320
  */
319
321
  querySparql(query: string): Promise<any>;
322
+ /**
323
+ * Execute a model query — the executor-side replacement for SPARQL query building + JS hydration.
324
+ *
325
+ * @param className - The model class name (e.g. "Recipe")
326
+ * @param queryJson - Structured query as JSON string
327
+ * @param shapeJson - Optional shape metadata JSON from the model class
328
+ * @returns Object with `instances` array and `totalCount`
329
+ */
330
+ modelQuery(className: string, queryJson: string, shapeJson?: string): Promise<{
331
+ instances: any[];
332
+ totalCount: number;
333
+ }>;
334
+ /**
335
+ * Evaluate property getters for a batch of instances in a single RPC call.
336
+ * Returns a map of `{ instanceId: { prop: value, ... } }`.
337
+ *
338
+ * Use this instead of `Ad4mModel.evaluateGetters()` for lazy-loading
339
+ * getter-backed properties on visible items (e.g. `replyingTo` on messages).
340
+ *
341
+ * @param className - The model class name (e.g. "Message")
342
+ * @param instanceIds - Array of instance base expression URIs
343
+ * @param shapeJson - Shape metadata JSON from the model class
344
+ * @param propertyNames - Optional subset of property names to evaluate
345
+ * @returns Map of instance ID → evaluated property values
346
+ */
347
+ evaluateGetters(className: string, instanceIds: string[], shapeJson: string, propertyNames?: string[]): Promise<Record<string, Record<string, any>>>;
348
+ /**
349
+ * Subscribe to model query changes. Builds trigger SPARQL from the model shape
350
+ * internally in Rust, registers a subscription, runs the initial query, and
351
+ * pushes updated results when relevant links change.
352
+ *
353
+ * The subscription reuses the same GraphQL subscription channel as subscribeQuery().
354
+ * Use keepAliveQuery() / disposeQuerySubscription() with the returned subscriptionId.
355
+ *
356
+ * @param className - The model class name
357
+ * @param queryJson - JSON-serialized query parameters (same as modelQuery)
358
+ * @param shapeJson - Optional shape metadata JSON from the model class
359
+ * @returns Object with `subscriptionId` and initial `result`
360
+ */
361
+ modelSubscribe(className: string, queryJson: string, shapeJson?: string): Promise<{
362
+ subscriptionId: string;
363
+ result: any;
364
+ }>;
320
365
  /**
321
366
  * Adds a new link to the perspective.
322
367
  *
@@ -526,7 +571,7 @@ export declare class PerspectiveProxy {
526
571
  * Adds Social DNA code to the perspective.
527
572
  *
528
573
  * **Recommended:** Use {@link addShacl} instead, which accepts the `SHACLShape` type directly.
529
- * This method is primarily for the GraphQL layer and legacy Prolog code.
574
+ * This method is primarily for the RPC API layer and legacy Prolog code.
530
575
  *
531
576
  * @param name - Unique name for this SDNA definition
532
577
  * @param sdnaCode - Prolog SDNA code (legacy, can be empty string if shaclJson provided)
@@ -675,16 +720,6 @@ export declare class PerspectiveProxy {
675
720
  * that matches the given properties will be used.
676
721
  */
677
722
  isSubjectInstance<T>(expression: string, subjectClass: T): Promise<boolean>;
678
- /** For an existing subject instance (existing in the perspective's links)
679
- * this function returns a proxy object that can be used to access the subject's
680
- * properties and methods.
681
- *
682
- * @param base URI of the subject's root expression
683
- * @param subjectClass Either a string with the name of the subject class, or an object
684
- * with the properties of the subject class. In the latter case, the first subject class
685
- * that matches the given properties will be used.
686
- */
687
- getSubjectProxy<T>(base: string, subjectClass: T): Promise<T>;
688
723
  /**
689
724
  * Gets subject class metadata from SHACL links using SHACLShape.fromLinks().
690
725
  * Retrieves the SHACL shape and extracts metadata for instance queries.
@@ -705,23 +740,6 @@ export declare class PerspectiveProxy {
705
740
  condition?: string;
706
741
  }>;
707
742
  } | null>;
708
- /** @deprecated Use getSubjectClassMetadata() */
709
- getSubjectClassMetadataFromSDNA(className: string): Promise<{
710
- requiredPredicates: string[];
711
- requiredTriples: Array<{
712
- predicate: string;
713
- target?: string;
714
- }>;
715
- properties: Map<string, {
716
- predicate: string;
717
- resolveLanguage?: string;
718
- }>;
719
- relations: Map<string, {
720
- predicate: string;
721
- instanceFilter?: string;
722
- condition?: string;
723
- }>;
724
- } | null>;
725
743
  /**
726
744
  * Generates a SPARQL query to find instances based on class metadata.
727
745
  */
@@ -730,53 +748,12 @@ export declare class PerspectiveProxy {
730
748
  * Returns base URIs of matching instances.
731
749
  */
732
750
  private findInstancesByMetadata;
733
- /**
734
- * Gets a property value using SPARQL when Prolog fails.
735
- * This is used as a fallback in SdnaOnly mode where link data isn't in Prolog.
736
- */
737
- getPropertyValueViaSparql(baseExpression: string, className: string, propertyName: string): Promise<any>;
738
- /**
739
- * Gets relation values using SPARQL when Prolog fails.
740
- * This is used as a fallback in SdnaOnly mode where link data isn't in Prolog.
741
- * Note: This is used by Subject.ts (legacy pattern). Ad4mModel.ts uses getModelMetadata() instead.
742
- */
743
- getRelationValuesViaSparql(baseExpression: string, className: string, relationName: string): Promise<any[]>;
744
- /**
745
- * Batch-checks multiple expressions against subject class metadata using a single or limited SPARQL queries.
746
- * This avoids N+1 query problems by checking all values at once.
747
- */
748
- batchCheckSubjectInstances(expressions: string[], metadata: {
749
- requiredPredicates: string[];
750
- requiredTriples: Array<{
751
- predicate: string;
752
- target?: string;
753
- }>;
754
- properties: Map<string, {
755
- predicate: string;
756
- resolveLanguage?: string;
757
- }>;
758
- relations: Map<string, {
759
- predicate: string;
760
- instanceFilter?: string;
761
- condition?: string;
762
- }>;
763
- }): Promise<string[]>;
764
- /**
765
- * Fallback sequential instance checking when batch checking isn't available.
766
- */
767
- private filterInstancesSequential;
768
751
  /** Returns all subject instances of the given subject class as proxy objects.
769
752
  * @param subjectClass Either a string with the name of the subject class, or an object
770
753
  * with the properties of the subject class. In the latter case, all subject classes
771
754
  * that match the given properties will be used.
772
755
  */
773
756
  getAllSubjectInstances<T>(subjectClass: T): Promise<T[]>;
774
- /** Returns all subject proxies of the given subject class as proxy objects.
775
- * @param subjectClass Either a string with the name of the subject class, or an object
776
- * with the properties of the subject class. In the latter case, all subject classes
777
- * that match the given properties will be used.
778
- */
779
- getAllSubjectProxies<T>(subjectClass: T): Promise<T[]>;
780
757
  /**
781
758
  * Find a subject class by matching an object's properties/relations against SHACL shapes.
782
759
  * Queries SHACL links client-side to find a class whose properties contain all required ones.
@@ -808,6 +785,64 @@ export declare class PerspectiveProxy {
808
785
  * Call this after wiping a perspective's links so that
809
786
  * subsequent register() calls re-add SHACL definitions. */
810
787
  clearEnsuredSubjectClasses(): void;
788
+ /**
789
+ * Returns a list of all class names that have been registered as SHACL
790
+ * subject classes in this perspective (via `ensureSDNASubjectClass` or `addSdna`).
791
+ *
792
+ * @returns Array of class name strings (e.g. `["Channel", "Message", "Task"]`)
793
+ */
794
+ listRegisteredClasses(): Promise<string[]>;
795
+ /**
796
+ * Returns the SHACL shape metadata for a registered class, including
797
+ * property names, predicates, datatypes, and cardinality constraints.
798
+ *
799
+ * @param className - The name of the registered class
800
+ * @returns Shape metadata or `null` if the class is not registered
801
+ */
802
+ getClassShape(className: string): Promise<{
803
+ className: string;
804
+ shapeUri: string;
805
+ properties: Array<{
806
+ name: string;
807
+ predicate: string;
808
+ datatype?: string;
809
+ required: boolean;
810
+ collection: boolean;
811
+ writable: boolean;
812
+ options?: Array<{
813
+ value: string;
814
+ label?: string;
815
+ }>;
816
+ }>;
817
+ } | null>;
818
+ /**
819
+ * Detects which registered subject classes a given instance conforms to,
820
+ * based on its stored triples matching the class shapes' required properties.
821
+ *
822
+ * @param baseExpression - The instance's base expression / subject URI
823
+ * @returns Array of class names the instance matches
824
+ */
825
+ getInstanceClasses(baseExpression: string): Promise<string[]>;
826
+ /**
827
+ * Returns all named options (sh:in values) for a registered class, grouped by property.
828
+ *
829
+ * @param className - The name of the registered class
830
+ * @returns Record mapping property name → array of { value, label } options
831
+ */
832
+ getNamedOptions(className: string): Promise<Record<string, Array<{
833
+ value: string;
834
+ label?: string;
835
+ }>>>;
836
+ /**
837
+ * Adds a named option (sh:in value) to a property of a registered class.
838
+ * This appends to the existing sh:in list stored on the property shape.
839
+ *
840
+ * @param className - The registered class name
841
+ * @param propertyName - The property to add the option to
842
+ * @param value - The RDF value for the option
843
+ * @param label - Optional human-readable label
844
+ */
845
+ addNamedOption(className: string, propertyName: string, value: string, label?: string): Promise<void>;
811
846
  getNeighbourhoodProxy(): NeighbourhoodProxy;
812
847
  /**
813
848
  * Returns a proxy object for working with AI capabilities.