@coasys/ad4m 0.13.0-test-interpretation-1 → 0.13.0-test-model-layer

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 (279) hide show
  1. package/lib/index.cjs +2409 -625
  2. package/lib/index.js +2406 -626
  3. package/lib/src/Literal.js +8 -0
  4. package/lib/src/ai/AIClient.js +6 -3
  5. package/lib/src/apiClient.d.ts +40 -4
  6. package/lib/src/apiClient.js +149 -9
  7. package/lib/src/generated/api/RunInterpretationRequest.d.ts +16 -0
  8. package/lib/src/index.d.ts +3 -1
  9. package/lib/src/index.js +2 -0
  10. package/lib/src/model/Ad4mModel.d.ts +34 -16
  11. package/lib/src/model/Ad4mModel.js +302 -63
  12. package/lib/src/model/Ad4mModel.test.js +480 -735
  13. package/lib/src/model/ModelQueryBuilder.js +2 -2
  14. package/lib/src/model/decorators.d.ts +199 -12
  15. package/lib/src/model/decorators.js +88 -32
  16. package/lib/src/model/json-schema.js +7 -21
  17. package/lib/src/model/model-manifest.d.ts +41 -0
  18. package/lib/src/model/model-manifest.js +11 -0
  19. package/lib/src/model/query-common.d.ts +2 -2
  20. package/lib/src/model/query-sparql.d.ts +62 -0
  21. package/lib/src/model/query-sparql.js +78 -15
  22. package/lib/src/model/query-sparql.test.js +92 -10
  23. package/lib/src/model/query-utils.d.ts +7 -2
  24. package/lib/src/model/query-utils.js +21 -11
  25. package/lib/src/model/shacl-gen.js +77 -15
  26. package/lib/src/model/types.d.ts +32 -8
  27. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +33 -33
  28. package/lib/src/perspectives/AutoProcessor.d.ts +198 -2
  29. package/lib/src/perspectives/FlowInstance.d.ts +187 -0
  30. package/lib/src/perspectives/FlowInstance.js +336 -0
  31. package/lib/src/perspectives/FlowModels.d.ts +94 -0
  32. package/lib/src/perspectives/FlowModels.js +182 -0
  33. package/lib/src/perspectives/InterpretationModels.d.ts +41 -3
  34. package/lib/src/perspectives/InterpretationModels.js +60 -26
  35. package/lib/src/perspectives/PerspectiveClient.d.ts +88 -7
  36. package/lib/src/perspectives/PerspectiveClient.js +138 -11
  37. package/lib/src/perspectives/PerspectiveProxy.d.ts +150 -57
  38. package/lib/src/perspectives/PerspectiveProxy.js +411 -287
  39. package/lib/src/perspectives/SparqlBindings.d.ts +24 -3
  40. package/lib/src/perspectives/SparqlBindings.js +57 -6
  41. package/lib/src/shacl/SHACLFlow.d.ts +273 -47
  42. package/lib/src/shacl/SHACLFlow.js +397 -88
  43. package/lib/src/shacl/SHACLShape.d.ts +19 -3
  44. package/lib/src/shacl/SHACLShape.js +30 -1
  45. package/lib/src/shacl/SHACLShape.test.js +82 -0
  46. package/lib/src/shacl/index.d.ts +1 -1
  47. package/lib/src/shacl/index.js +1 -1
  48. package/package.json +3 -3
  49. package/src/Literal.ts +7 -0
  50. package/src/ai/AIClient.ts +6 -3
  51. package/src/apiClient.test.ts +227 -0
  52. package/src/apiClient.ts +185 -9
  53. package/src/generated/api/RunInterpretationRequest.ts +19 -3
  54. package/src/index.ts +3 -1
  55. package/src/model/Ad4mModel.test.ts +729 -22
  56. package/src/model/Ad4mModel.ts +305 -66
  57. package/src/model/ModelQueryBuilder.ts +2 -2
  58. package/src/model/decorators.ts +278 -44
  59. package/src/model/json-schema.ts +10 -25
  60. package/src/model/query-common.ts +2 -2
  61. package/src/model/query-sparql.test.ts +114 -13
  62. package/src/model/query-sparql.ts +83 -14
  63. package/src/model/query-utils.ts +22 -12
  64. package/src/model/relation-filtering.test.ts +70 -20
  65. package/src/model/shacl-gen.ts +78 -13
  66. package/src/model/shacl-roundtrip.test.ts +134 -2
  67. package/src/model/types.ts +30 -8
  68. package/src/perspectives/AutoProcessor.ts +204 -2
  69. package/src/perspectives/FlowInstance.ts +369 -0
  70. package/src/perspectives/FlowModels.ts +157 -0
  71. package/src/perspectives/InterpretationModels.ts +91 -21
  72. package/src/perspectives/PerspectiveClient.test.ts +67 -6
  73. package/src/perspectives/PerspectiveClient.ts +190 -14
  74. package/src/perspectives/PerspectiveProxy.test.ts +406 -0
  75. package/src/perspectives/PerspectiveProxy.ts +494 -308
  76. package/src/perspectives/SparqlBindings.test.ts +134 -0
  77. package/src/perspectives/SparqlBindings.ts +57 -6
  78. package/src/perspectives/shacl-rpc.test.ts +258 -0
  79. package/src/shacl/SHACLFlow.test.ts +762 -35
  80. package/src/shacl/SHACLFlow.ts +680 -112
  81. package/src/shacl/SHACLShape.test.ts +30 -4
  82. package/src/shacl/SHACLShape.ts +59 -6
  83. package/src/shacl/index.ts +1 -1
  84. package/lib/src/generated/rest/AIModelLoadingStatus.d.ts +0 -7
  85. package/lib/src/generated/rest/AIModelLoadingStatus.js +0 -2
  86. package/lib/src/generated/rest/AddAgentInfosRequest.d.ts +0 -3
  87. package/lib/src/generated/rest/AddAgentInfosRequest.js +0 -2
  88. package/lib/src/generated/rest/AddLinkExpressionRequest.d.ts +0 -6
  89. package/lib/src/generated/rest/AddLinkExpressionRequest.js +0 -1
  90. package/lib/src/generated/rest/AddLinkRequest.d.ts +0 -6
  91. package/lib/src/generated/rest/AddLinkRequest.js +0 -1
  92. package/lib/src/generated/rest/AddLinksBulkRequest.d.ts +0 -6
  93. package/lib/src/generated/rest/AddLinksBulkRequest.js +0 -1
  94. package/lib/src/generated/rest/AddSdnaRequest.d.ts +0 -6
  95. package/lib/src/generated/rest/AddSdnaRequest.js +0 -2
  96. package/lib/src/generated/rest/ApplyTemplateRequest.d.ts +0 -4
  97. package/lib/src/generated/rest/ApplyTemplateRequest.js +0 -2
  98. package/lib/src/generated/rest/AuthInfoInput.d.ts +0 -10
  99. package/lib/src/generated/rest/AuthInfoInput.js +0 -1
  100. package/lib/src/generated/rest/BroadcastRequest.d.ts +0 -6
  101. package/lib/src/generated/rest/BroadcastRequest.js +0 -1
  102. package/lib/src/generated/rest/CapabilityInput.d.ts +0 -5
  103. package/lib/src/generated/rest/CapabilityInput.js +0 -1
  104. package/lib/src/generated/rest/CommitBatchRequest.d.ts +0 -3
  105. package/lib/src/generated/rest/CommitBatchRequest.js +0 -2
  106. package/lib/src/generated/rest/ComputeLogEntry.d.ts +0 -9
  107. package/lib/src/generated/rest/ComputeLogEntry.js +0 -2
  108. package/lib/src/generated/rest/CreateExpressionRequest.d.ts +0 -4
  109. package/lib/src/generated/rest/CreateExpressionRequest.js +0 -2
  110. package/lib/src/generated/rest/CreatePerspectiveRequest.d.ts +0 -3
  111. package/lib/src/generated/rest/CreatePerspectiveRequest.js +0 -2
  112. package/lib/src/generated/rest/CreateSubjectRequest.d.ts +0 -6
  113. package/lib/src/generated/rest/CreateSubjectRequest.js +0 -2
  114. package/lib/src/generated/rest/CreateUserRequest.d.ts +0 -4
  115. package/lib/src/generated/rest/CreateUserRequest.js +0 -2
  116. package/lib/src/generated/rest/CreateUserResponse.d.ts +0 -5
  117. package/lib/src/generated/rest/CreateUserResponse.js +0 -2
  118. package/lib/src/generated/rest/DecoratedExpressionProof.d.ts +0 -6
  119. package/lib/src/generated/rest/DecoratedExpressionProof.js +0 -2
  120. package/lib/src/generated/rest/DecoratedLinkExpression.d.ts +0 -10
  121. package/lib/src/generated/rest/DecoratedLinkExpression.js +0 -1
  122. package/lib/src/generated/rest/DisposeQueryRequest.d.ts +0 -3
  123. package/lib/src/generated/rest/DisposeQueryRequest.js +0 -2
  124. package/lib/src/generated/rest/EmailTestRequest.d.ts +0 -6
  125. package/lib/src/generated/rest/EmailTestRequest.js +0 -2
  126. package/lib/src/generated/rest/EmbedRequest.d.ts +0 -4
  127. package/lib/src/generated/rest/EmbedRequest.js +0 -2
  128. package/lib/src/generated/rest/EntanglementProofInput.d.ts +0 -6
  129. package/lib/src/generated/rest/EntanglementProofInput.js +0 -2
  130. package/lib/src/generated/rest/EntanglementProofPreflightRequest.d.ts +0 -4
  131. package/lib/src/generated/rest/EntanglementProofPreflightRequest.js +0 -2
  132. package/lib/src/generated/rest/ExecuteCommandsRequest.d.ts +0 -4
  133. package/lib/src/generated/rest/ExecuteCommandsRequest.js +0 -2
  134. package/lib/src/generated/rest/ExportRequest.d.ts +0 -5
  135. package/lib/src/generated/rest/ExportRequest.js +0 -2
  136. package/lib/src/generated/rest/ExpressionManyRequest.d.ts +0 -3
  137. package/lib/src/generated/rest/ExpressionManyRequest.js +0 -2
  138. package/lib/src/generated/rest/ExpressionProof.d.ts +0 -4
  139. package/lib/src/generated/rest/ExpressionProof.js +0 -2
  140. package/lib/src/generated/rest/ExpressionProofInput.d.ts +0 -6
  141. package/lib/src/generated/rest/ExpressionProofInput.js +0 -2
  142. package/lib/src/generated/rest/FriendSendMessageRequest.d.ts +0 -3
  143. package/lib/src/generated/rest/FriendSendMessageRequest.js +0 -2
  144. package/lib/src/generated/rest/FriendsListRequest.d.ts +0 -3
  145. package/lib/src/generated/rest/FriendsListRequest.js +0 -2
  146. package/lib/src/generated/rest/GenerateAgentRequest.d.ts +0 -3
  147. package/lib/src/generated/rest/GenerateAgentRequest.js +0 -2
  148. package/lib/src/generated/rest/GenerateJwtRequest.d.ts +0 -4
  149. package/lib/src/generated/rest/GenerateJwtRequest.js +0 -2
  150. package/lib/src/generated/rest/GetSubjectDataRequest.d.ts +0 -4
  151. package/lib/src/generated/rest/GetSubjectDataRequest.js +0 -2
  152. package/lib/src/generated/rest/HostingInfoResponse.d.ts +0 -5
  153. package/lib/src/generated/rest/HostingInfoResponse.js +0 -2
  154. package/lib/src/generated/rest/HostingWalletResponse.d.ts +0 -4
  155. package/lib/src/generated/rest/HostingWalletResponse.js +0 -2
  156. package/lib/src/generated/rest/ImportAgentRequest.d.ts +0 -6
  157. package/lib/src/generated/rest/ImportAgentRequest.js +0 -2
  158. package/lib/src/generated/rest/ImportRequest.d.ts +0 -4
  159. package/lib/src/generated/rest/ImportRequest.js +0 -2
  160. package/lib/src/generated/rest/JoinNeighbourhoodRequest.d.ts +0 -3
  161. package/lib/src/generated/rest/JoinNeighbourhoodRequest.js +0 -2
  162. package/lib/src/generated/rest/KeepAliveQueryRequest.d.ts +0 -3
  163. package/lib/src/generated/rest/KeepAliveQueryRequest.js +0 -2
  164. package/lib/src/generated/rest/LanguageMetaInput.d.ts +0 -6
  165. package/lib/src/generated/rest/LanguageMetaInput.js +0 -2
  166. package/lib/src/generated/rest/Link.d.ts +0 -5
  167. package/lib/src/generated/rest/Link.js +0 -2
  168. package/lib/src/generated/rest/LinkExpression.d.ts +0 -10
  169. package/lib/src/generated/rest/LinkExpression.js +0 -1
  170. package/lib/src/generated/rest/LinkExpressionInput.d.ts +0 -10
  171. package/lib/src/generated/rest/LinkExpressionInput.js +0 -1
  172. package/lib/src/generated/rest/LinkInput.d.ts +0 -5
  173. package/lib/src/generated/rest/LinkInput.js +0 -2
  174. package/lib/src/generated/rest/LinkLanguageTemplatesRequest.d.ts +0 -3
  175. package/lib/src/generated/rest/LinkLanguageTemplatesRequest.js +0 -2
  176. package/lib/src/generated/rest/LinkMutationRequest.d.ts +0 -12
  177. package/lib/src/generated/rest/LinkMutationRequest.js +0 -1
  178. package/lib/src/generated/rest/LinkMutationResponse.d.ts +0 -9
  179. package/lib/src/generated/rest/LinkMutationResponse.js +0 -1
  180. package/lib/src/generated/rest/LinkMutations.d.ts +0 -6
  181. package/lib/src/generated/rest/LinkMutations.js +0 -1
  182. package/lib/src/generated/rest/LinkMutationsRequest.d.ts +0 -5
  183. package/lib/src/generated/rest/LinkMutationsRequest.js +0 -1
  184. package/lib/src/generated/rest/LinkStatus.d.ts +0 -1
  185. package/lib/src/generated/rest/LinkStatus.js +0 -2
  186. package/lib/src/generated/rest/LinkUpdateInput.d.ts +0 -5
  187. package/lib/src/generated/rest/LinkUpdateInput.js +0 -1
  188. package/lib/src/generated/rest/LockAgentRequest.d.ts +0 -3
  189. package/lib/src/generated/rest/LockAgentRequest.js +0 -2
  190. package/lib/src/generated/rest/LoginUserRequest.d.ts +0 -5
  191. package/lib/src/generated/rest/LoginUserRequest.js +0 -2
  192. package/lib/src/generated/rest/ModelType.d.ts +0 -1
  193. package/lib/src/generated/rest/ModelType.js +0 -2
  194. package/lib/src/generated/rest/NotificationGrantRequest.d.ts +0 -3
  195. package/lib/src/generated/rest/NotificationGrantRequest.js +0 -2
  196. package/lib/src/generated/rest/NotificationInput.d.ts +0 -10
  197. package/lib/src/generated/rest/NotificationInput.js +0 -2
  198. package/lib/src/generated/rest/OpenLinkRequest.d.ts +0 -3
  199. package/lib/src/generated/rest/OpenLinkRequest.js +0 -2
  200. package/lib/src/generated/rest/PermitCapabilityRequest.d.ts +0 -3
  201. package/lib/src/generated/rest/PermitCapabilityRequest.js +0 -2
  202. package/lib/src/generated/rest/PerspectiveInput.d.ts +0 -4
  203. package/lib/src/generated/rest/PerspectiveInput.js +0 -1
  204. package/lib/src/generated/rest/PromptRequest.d.ts +0 -4
  205. package/lib/src/generated/rest/PromptRequest.js +0 -2
  206. package/lib/src/generated/rest/PublicPerspectiveInput.d.ts +0 -4
  207. package/lib/src/generated/rest/PublicPerspectiveInput.js +0 -1
  208. package/lib/src/generated/rest/PublishLanguageRequest.d.ts +0 -5
  209. package/lib/src/generated/rest/PublishLanguageRequest.js +0 -1
  210. package/lib/src/generated/rest/PublishNeighbourhoodRequest.d.ts +0 -6
  211. package/lib/src/generated/rest/PublishNeighbourhoodRequest.js +0 -1
  212. package/lib/src/generated/rest/QueryRequest.d.ts +0 -7
  213. package/lib/src/generated/rest/QueryRequest.js +0 -2
  214. package/lib/src/generated/rest/RemoveLinkRequest.d.ts +0 -5
  215. package/lib/src/generated/rest/RemoveLinkRequest.js +0 -1
  216. package/lib/src/generated/rest/RemoveLinksBulkRequest.d.ts +0 -5
  217. package/lib/src/generated/rest/RemoveLinksBulkRequest.js +0 -1
  218. package/lib/src/generated/rest/RequestCapabilityRequest.d.ts +0 -4
  219. package/lib/src/generated/rest/RequestCapabilityRequest.js +0 -1
  220. package/lib/src/generated/rest/RequestPaymentRequest.d.ts +0 -3
  221. package/lib/src/generated/rest/RequestPaymentRequest.js +0 -2
  222. package/lib/src/generated/rest/RequestVerificationRequest.d.ts +0 -4
  223. package/lib/src/generated/rest/RequestVerificationRequest.js +0 -2
  224. package/lib/src/generated/rest/ResourceInput.d.ts +0 -4
  225. package/lib/src/generated/rest/ResourceInput.js +0 -2
  226. package/lib/src/generated/rest/SetDefaultModelRequest.d.ts +0 -4
  227. package/lib/src/generated/rest/SetDefaultModelRequest.js +0 -1
  228. package/lib/src/generated/rest/SetFreeHostingEnabledRequest.d.ts +0 -3
  229. package/lib/src/generated/rest/SetFreeHostingEnabledRequest.js +0 -2
  230. package/lib/src/generated/rest/SetHotWalletAddressRequest.d.ts +0 -3
  231. package/lib/src/generated/rest/SetHotWalletAddressRequest.js +0 -2
  232. package/lib/src/generated/rest/SetMultiUserRequest.d.ts +0 -3
  233. package/lib/src/generated/rest/SetMultiUserRequest.js +0 -2
  234. package/lib/src/generated/rest/SetOnlineStatusRequest.d.ts +0 -5
  235. package/lib/src/generated/rest/SetOnlineStatusRequest.js +0 -1
  236. package/lib/src/generated/rest/SetStatusRequest.d.ts +0 -3
  237. package/lib/src/generated/rest/SetStatusRequest.js +0 -2
  238. package/lib/src/generated/rest/SetUserFreeAccessRequest.d.ts +0 -4
  239. package/lib/src/generated/rest/SetUserFreeAccessRequest.js +0 -2
  240. package/lib/src/generated/rest/SignMessageRequest.d.ts +0 -3
  241. package/lib/src/generated/rest/SignMessageRequest.js +0 -2
  242. package/lib/src/generated/rest/SignalRequest.d.ts +0 -6
  243. package/lib/src/generated/rest/SignalRequest.js +0 -1
  244. package/lib/src/generated/rest/SubscribeQueryRequest.d.ts +0 -3
  245. package/lib/src/generated/rest/SubscribeQueryRequest.js +0 -2
  246. package/lib/src/generated/rest/SubscribeQueryResponse.d.ts +0 -4
  247. package/lib/src/generated/rest/SubscribeQueryResponse.js +0 -2
  248. package/lib/src/generated/rest/TrustedAgentsRequest.d.ts +0 -3
  249. package/lib/src/generated/rest/TrustedAgentsRequest.js +0 -2
  250. package/lib/src/generated/rest/UnlockAgentRequest.d.ts +0 -4
  251. package/lib/src/generated/rest/UnlockAgentRequest.js +0 -2
  252. package/lib/src/generated/rest/UpdateLinkRequest.d.ts +0 -7
  253. package/lib/src/generated/rest/UpdateLinkRequest.js +0 -1
  254. package/lib/src/generated/rest/UpdatePerspectiveRequest.d.ts +0 -3
  255. package/lib/src/generated/rest/UpdatePerspectiveRequest.js +0 -2
  256. package/lib/src/generated/rest/UpdateProfileRequest.d.ts +0 -5
  257. package/lib/src/generated/rest/UpdateProfileRequest.js +0 -1
  258. package/lib/src/generated/rest/UserStatistics.d.ts +0 -9
  259. package/lib/src/generated/rest/UserStatistics.js +0 -2
  260. package/lib/src/generated/rest/VerificationRequestResult.d.ts +0 -6
  261. package/lib/src/generated/rest/VerificationRequestResult.js +0 -2
  262. package/lib/src/generated/rest/VerifyEmailRequest.d.ts +0 -6
  263. package/lib/src/generated/rest/VerifyEmailRequest.js +0 -2
  264. package/lib/src/generated/rest/VerifySignatureRequest.d.ts +0 -5
  265. package/lib/src/generated/rest/VerifySignatureRequest.js +0 -2
  266. package/lib/src/generated/rest/WriteSettingsRequest.d.ts +0 -3
  267. package/lib/src/generated/rest/WriteSettingsRequest.js +0 -2
  268. package/lib/src/generated/rest/index.d.ts +0 -73
  269. package/lib/src/generated/rest/index.js +0 -8
  270. package/lib/src/generated/rest/routes.d.ts +0 -587
  271. package/lib/src/generated/rest/routes.js +0 -3
  272. package/lib/src/model/query-surreal.d.ts +0 -44
  273. package/lib/src/model/query-surreal.js +0 -249
  274. package/lib/src/model/surreal-utils.d.ts +0 -42
  275. package/lib/src/model/surreal-utils.js +0 -128
  276. package/lib/src/perspectives/PerspectiveProxy.test.d.ts +0 -1
  277. package/lib/src/perspectives/PerspectiveProxy.test.js +0 -34
  278. package/lib/src/restClient.d.ts +0 -52
  279. package/lib/src/restClient.js +0 -227
@@ -191,7 +191,7 @@ describe('SHACLShape', () => {
191
191
  minInclusive: 10,
192
192
  maxInclusive: 100,
193
193
  hasValue: 'expectedValue',
194
- resolveLanguage: 'test://language',
194
+ resolveLanguage: 'literal',
195
195
  local: true,
196
196
  writable: true,
197
197
  setter: [{ action: 'addLink', source: 'this', predicate: 'test://field', target: 'value' }],
@@ -212,7 +212,7 @@ describe('SHACLShape', () => {
212
212
  expect(prop.minInclusive).toBe(10);
213
213
  expect(prop.maxInclusive).toBe(100);
214
214
  expect(prop.hasValue).toBe('expectedValue');
215
- expect(prop.resolveLanguage).toBe('test://language');
215
+ expect(prop.resolveLanguage).toBe('literal');
216
216
  expect(prop.local).toBe(true);
217
217
  expect(prop.writable).toBe(true);
218
218
  expect(prop.setter).toBeDefined();
@@ -330,15 +330,41 @@ describe('SHACLShape', () => {
330
330
  original.addProperty({
331
331
  name: 'content',
332
332
  path: 'test://content',
333
- resolveLanguage: 'literal',
333
+ resolveLanguage: 'lang://custom',
334
334
  });
335
335
 
336
336
  const json = original.toJSON();
337
337
  const reconstructed = SHACLShape.fromJSON(json);
338
338
 
339
+ expect(reconstructed.properties[0].resolveLanguage).toBe('lang://custom');
340
+ });
341
+
342
+ it('preserves resolveLanguage:"literal" (envelope opt-in)', () => {
343
+ const original = new SHACLShape('test://Model');
344
+ original.addProperty({
345
+ name: 'content',
346
+ path: 'test://content',
347
+ resolveLanguage: 'literal',
348
+ });
349
+
350
+ const reconstructed = SHACLShape.fromJSON(original.toJSON());
339
351
  expect(reconstructed.properties[0].resolveLanguage).toBe('literal');
340
352
  });
341
353
 
354
+ it('round-trips resolveLanguage through toLinks/fromLinks', () => {
355
+ const original = new SHACLShape('test://Model');
356
+ original.addProperty({
357
+ name: 'content',
358
+ path: 'test://content',
359
+ resolveLanguage: 'lang://custom',
360
+ });
361
+
362
+ const links = original.toLinks();
363
+ const reconstructed = SHACLShape.fromLinks(links, 'test://ModelShape');
364
+ const prop = reconstructed.properties.find(p => p.name === 'content');
365
+ expect(prop?.resolveLanguage).toBe('lang://custom');
366
+ });
367
+
342
368
  it('preserves constructor and destructor actions', () => {
343
369
  const original = new SHACLShape('test://Model');
344
370
  original.constructor_actions = [
@@ -636,7 +662,7 @@ describe('SHACLShape', () => {
636
662
  name: 'image',
637
663
  path: 'image://data',
638
664
  datatype: 'xsd://string',
639
- resolveLanguage: '',
665
+ resolveLanguage: 'literal',
640
666
  transform: concat(literal('data:image/png;base64,'), focus()),
641
667
  });
642
668
 
@@ -124,6 +124,15 @@ export interface SHACLPropertyShape {
124
124
  /** Expected datatype (e.g., xsd:string, xsd:integer) */
125
125
  datatype?: string;
126
126
 
127
+ /**
128
+ * CRDT ordering strategy for this collection ("linkedList"), when it has one.
129
+ *
130
+ * Declared in the shape rather than passed per query so the executor applies
131
+ * it to every writer — the ORM, MCP agents, raw WS-RPC callers, another app
132
+ * on the same neighbourhood.
133
+ */
134
+ ordering?: string;
135
+
127
136
  /** Node kind constraint (IRI, Literal, BlankNode) */
128
137
  nodeKind?: 'IRI' | 'Literal' | 'BlankNode';
129
138
 
@@ -151,7 +160,13 @@ export interface SHACLPropertyShape {
151
160
  /** AD4M-specific: Writable property */
152
161
  writable?: boolean;
153
162
 
154
- /** AD4M-specific: Language to resolve property values through */
163
+ /** AD4M-specific: sole selector of storage mode:
164
+ * - unset → deterministic typed literal (fast POS-index
165
+ * path, the default for a plain `@Property()`).
166
+ * - `"literal"` → signed envelope on the built-in literal
167
+ * language (per-value provenance, e.g. Flux
168
+ * message bodies).
169
+ * - `<custom address>` → `expression_create` on that custom language. */
155
170
  resolveLanguage?: string;
156
171
 
157
172
  /** AD4M-specific: Setter action for this property */
@@ -206,8 +221,10 @@ export interface SHACLPropertyShape {
206
221
  filter?: boolean;
207
222
 
208
223
  /** AD4M-specific: Transform expression (SHACL-AF Node Expression).
209
- * Applied to resolved property values in the Rust model query engine.
210
- * Only used for properties with resolveLanguage set. */
224
+ * Applied to a property's resolved value in the Rust model query engine —
225
+ * for values resolved through a `resolveLanguage` (`"literal"` for a signed
226
+ * envelope, or a custom language) and for any property that declares a
227
+ * transform. */
211
228
  transform?: NodeExpression;
212
229
 
213
230
  /** AD4M-specific: Natural-language hint that steers the generic LLM
@@ -372,11 +389,19 @@ export class SHACLShape {
372
389
  if (prop.local !== undefined) {
373
390
  turtle += ` ad4m:local ${prop.local} ;\n`;
374
391
  }
375
-
392
+
376
393
  if (prop.writable !== undefined) {
377
394
  turtle += ` ad4m:writable ${prop.writable} ;\n`;
378
395
  }
379
-
396
+
397
+ // Interpreter dedup key: `toLinks()` and `toJSON()` preserve
398
+ // `identity`; a Turtle export must too or the round-trip through
399
+ // Turtle silently drops the interpretation-dedup marker
400
+ // (CodeRabbit #881 review).
401
+ if (prop.identity !== undefined) {
402
+ turtle += ` ad4m:identity ${prop.identity} ;\n`;
403
+ }
404
+
380
405
  // Remove trailing semicolon and close bracket
381
406
  turtle = turtle.slice(0, -2) + '\n';
382
407
  turtle += isLast ? ` ] .\n` : ` ] ;\n`;
@@ -470,6 +495,13 @@ export class SHACLShape {
470
495
  });
471
496
 
472
497
  // Constraints
498
+ if (prop.ordering) {
499
+ links.push({
500
+ source: propShapeId,
501
+ predicate: "ad4m://ordering",
502
+ target: `literal:string:${prop.ordering}`
503
+ } as any);
504
+ }
473
505
  if (prop.datatype) {
474
506
  links.push({
475
507
  source: propShapeId,
@@ -766,6 +798,15 @@ export class SHACLShape {
766
798
  l.source === propShapeId && l.predicate === "sh://datatype"
767
799
  );
768
800
  if (datatypeLink) prop.datatype = datatypeLink.target;
801
+
802
+ const orderingLink = links.find(l =>
803
+ l.source === propShapeId && l.predicate === "ad4m://ordering"
804
+ );
805
+ if (orderingLink) {
806
+ prop.ordering = orderingLink.target.replace(
807
+ /^literal:\/\/string:|^literal:string:/, ''
808
+ );
809
+ }
769
810
 
770
811
  const nodeKindLink = links.find(l =>
771
812
  l.source === propShapeId && l.predicate === "sh://nodeKind"
@@ -849,6 +890,7 @@ export class SHACLShape {
849
890
  prop.writable = val === 'true';
850
891
  }
851
892
 
893
+ // The general language selector (e.g. "literal" or a custom address).
852
894
  const resolveLangLink = links.find(l =>
853
895
  l.source === propShapeId && l.predicate === "ad4m://resolveLanguage"
854
896
  );
@@ -856,6 +898,11 @@ export class SHACLShape {
856
898
  prop.resolveLanguage = resolveLangLink.target.replace(/^literal:\/\/string:|^literal:string:/, '');
857
899
  }
858
900
 
901
+ // Storage mode is derived from `resolveLanguage` alone:
902
+ // - unset → deterministic typed literal (fast path)
903
+ // - "literal" → signed envelope on the built-in literal language
904
+ // - <address> → expression on that custom language
905
+
859
906
  // Parse action arrays
860
907
  const setterLink = links.find(l =>
861
908
  l.source === propShapeId && l.predicate === "ad4m://setter"
@@ -1069,6 +1116,11 @@ export class SHACLShape {
1069
1116
  transform: p.transform,
1070
1117
  interpretation_hint: p.interpretationHint,
1071
1118
  identity: p.identity,
1119
+ // The backend reads the ordering declaration back from the
1120
+ // `ad4m://ordering` link that `parse_shacl_to_links` writes from this
1121
+ // field. `ensureSubjectClass` ships `toJSON()`, so omitting it here
1122
+ // leaves `@HasMany({ ordering })` inert no matter what `toLinks()` does.
1123
+ ordering: p.ordering,
1072
1124
  })),
1073
1125
  constructor_actions: this.constructor_actions,
1074
1126
  destructor_actions: this.destructor_actions,
@@ -1105,7 +1157,7 @@ export class SHACLShape {
1105
1157
  hasValue: p.has_value,
1106
1158
  local: p.local,
1107
1159
  writable: p.writable,
1108
- resolveLanguage: p.resolve_language,
1160
+ resolveLanguage: p.resolve_language ?? (p as any).resolveLanguage,
1109
1161
  setter: p.setter,
1110
1162
  adder: p.adder,
1111
1163
  remover: p.remover,
@@ -1121,6 +1173,7 @@ export class SHACLShape {
1121
1173
  transform: p.transform,
1122
1174
  interpretationHint: p.interpretation_hint,
1123
1175
  identity: p.identity,
1176
+ ordering: p.ordering,
1124
1177
  });
1125
1178
  }
1126
1179
 
@@ -43,7 +43,7 @@ export {
43
43
  * ```typescript
44
44
  * @Property({
45
45
  * through: 'we://image',
46
- * resolveLanguage: FILE_STORAGE_LANGUAGE,
46
+ * resolveLanguage: 'literal',
47
47
  * transform: fileToDataUri,
48
48
  * })
49
49
  * avatar?: string;
@@ -1,7 +0,0 @@
1
- export type AIModelLoadingStatus = {
2
- model: string;
3
- progress: number;
4
- status: string;
5
- downloaded: boolean;
6
- loaded: boolean;
7
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,3 +0,0 @@
1
- export type AddAgentInfosRequest = {
2
- agentInfos: Array<string>;
3
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,6 +0,0 @@
1
- import type { LinkExpression } from "./LinkExpression";
2
- export type AddLinkExpressionRequest = {
3
- link: LinkExpression;
4
- status: string | null;
5
- batchId: string | null;
6
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import type { LinkInput } from "./LinkInput";
2
- export type AddLinkRequest = {
3
- link: LinkInput;
4
- status: string | null;
5
- batchId: string | null;
6
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import type { LinkInput } from "./LinkInput";
2
- export type AddLinksBulkRequest = {
3
- links: Array<LinkInput>;
4
- status: string | null;
5
- batchId: string | null;
6
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- export type AddSdnaRequest = {
2
- name: string;
3
- sdnaCode: string | null;
4
- sdnaType: string;
5
- shaclJson: string | null;
6
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,4 +0,0 @@
1
- export type ApplyTemplateRequest = {
2
- sourceLanguageHash: string;
3
- templateData: string;
4
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,10 +0,0 @@
1
- import type { CapabilityInput } from "./CapabilityInput";
2
- export type AuthInfoInput = {
3
- appDesc: string;
4
- appDomain: string;
5
- appIconPath: string | null;
6
- appName: string;
7
- appUrl: string | null;
8
- capabilities: Array<CapabilityInput> | null;
9
- userDid: string | null;
10
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import type { PerspectiveInput } from "./PerspectiveInput";
2
- export type BroadcastRequest = {
3
- payload: PerspectiveInput;
4
- signed: boolean | null;
5
- loopback: boolean | null;
6
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- import type { ResourceInput } from "./ResourceInput";
2
- export type CapabilityInput = {
3
- can: Array<string>;
4
- with: ResourceInput;
5
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export type CommitBatchRequest = {
2
- batchId: string;
3
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,9 +0,0 @@
1
- export type ComputeLogEntry = {
2
- id: number;
3
- userEmail: string;
4
- timestamp: string;
5
- operation: string;
6
- summary: string | null;
7
- cost: number;
8
- creditsAfter: number;
9
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,4 +0,0 @@
1
- export type CreateExpressionRequest = {
2
- content: string;
3
- languageAddress: string;
4
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,3 +0,0 @@
1
- export type CreatePerspectiveRequest = {
2
- name: string;
3
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,6 +0,0 @@
1
- export type CreateSubjectRequest = {
2
- subjectClass: string;
3
- expressionAddress: string;
4
- initialValues: string | null;
5
- batchId: string | null;
6
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,4 +0,0 @@
1
- export type CreateUserRequest = {
2
- email: string;
3
- password: string;
4
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,5 +0,0 @@
1
- export type CreateUserResponse = {
2
- did: string;
3
- success: boolean;
4
- error?: string;
5
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,6 +0,0 @@
1
- export type DecoratedExpressionProof = {
2
- key: string;
3
- signature: string;
4
- valid: boolean | null;
5
- invalid: boolean | null;
6
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,10 +0,0 @@
1
- import type { DecoratedExpressionProof } from "./DecoratedExpressionProof";
2
- import type { Link } from "./Link";
3
- import type { LinkStatus } from "./LinkStatus";
4
- export type DecoratedLinkExpression = {
5
- author: string;
6
- timestamp: string;
7
- data: Link;
8
- proof: DecoratedExpressionProof;
9
- status: LinkStatus | null;
10
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export type DisposeQueryRequest = {
2
- subscriptionId: string;
3
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,6 +0,0 @@
1
- export type EmailTestRequest = {
2
- action: string;
3
- to: string | null;
4
- email: string | null;
5
- expirySeconds: bigint | null;
6
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,4 +0,0 @@
1
- export type EmbedRequest = {
2
- modelId: string;
3
- text: string;
4
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,6 +0,0 @@
1
- export type EntanglementProofInput = {
2
- deviceKey: string;
3
- deviceKeyType: string;
4
- deviceKeySignedByDid: string;
5
- didSignedByDeviceKey: string | null;
6
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,4 +0,0 @@
1
- export type EntanglementProofPreflightRequest = {
2
- deviceKey: string;
3
- deviceKeyType: string;
4
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,4 +0,0 @@
1
- export type ExecuteCommandsRequest = {
2
- commands: any[];
3
- expression: any;
4
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,5 +0,0 @@
1
- export type ExportRequest = {
2
- type: string;
3
- filePath: string;
4
- perspectiveUuid: string | null;
5
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,3 +0,0 @@
1
- export type ExpressionManyRequest = {
2
- urls: Array<string>;
3
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,4 +0,0 @@
1
- export type ExpressionProof = {
2
- key: string;
3
- signature: string;
4
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,6 +0,0 @@
1
- export type ExpressionProofInput = {
2
- invalid: boolean | null;
3
- key: string | null;
4
- signature: string | null;
5
- valid: boolean | null;
6
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,3 +0,0 @@
1
- export type FriendSendMessageRequest = {
2
- message: string;
3
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,3 +0,0 @@
1
- export type FriendsListRequest = {
2
- dids: Array<string>;
3
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,3 +0,0 @@
1
- export type GenerateAgentRequest = {
2
- passphrase: string;
3
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,4 +0,0 @@
1
- export type GenerateJwtRequest = {
2
- rand: string;
3
- requestId: string;
4
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,4 +0,0 @@
1
- export type GetSubjectDataRequest = {
2
- subjectClass: string;
3
- expressionAddress: string;
4
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,5 +0,0 @@
1
- export type HostingInfoResponse = {
2
- userInfo: any | null;
3
- rates: any | null;
4
- version: any | null;
5
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,4 +0,0 @@
1
- export type HostingWalletResponse = {
2
- balance: any | null;
3
- pubkey: string | null;
4
- };
@@ -1,2 +0,0 @@
1
- // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
- export {};
@@ -1,6 +0,0 @@
1
- export type ImportAgentRequest = {
2
- did: string;
3
- didDocument: string;
4
- keystore: string;
5
- passphrase: string;
6
- };