@undefineds.co/xpod 0.3.6 → 0.3.14

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 (249) hide show
  1. package/config/cli.json +1 -1
  2. package/config/cloud.json +54 -22
  3. package/config/local.json +56 -12
  4. package/config/resolver.json +10 -2
  5. package/config/xpod.base.json +50 -0
  6. package/config/xpod.json +8 -8
  7. package/dist/agents/config/resolve.js +10 -10
  8. package/dist/agents/config/resolve.js.map +1 -1
  9. package/dist/api/chatkit/index.d.ts +1 -1
  10. package/dist/api/chatkit/index.js.map +1 -1
  11. package/dist/api/chatkit/pod-store.d.ts +14 -11
  12. package/dist/api/chatkit/pod-store.js +114 -78
  13. package/dist/api/chatkit/pod-store.js.map +1 -1
  14. package/dist/api/chatkit/runtime/AcpAgentRuntime.js +1 -1
  15. package/dist/api/chatkit/runtime/AcpAgentRuntime.js.map +1 -1
  16. package/dist/api/chatkit/service.js +1 -1
  17. package/dist/api/chatkit/service.js.map +1 -1
  18. package/dist/api/chatkit/types.d.ts +11 -11
  19. package/dist/api/chatkit/types.js +3 -3
  20. package/dist/api/chatkit/types.js.map +1 -1
  21. package/dist/api/container/cloud.js +0 -8
  22. package/dist/api/container/cloud.js.map +1 -1
  23. package/dist/api/container/index.js +2 -1
  24. package/dist/api/container/index.js.map +1 -1
  25. package/dist/api/container/local.js +0 -7
  26. package/dist/api/container/local.js.map +1 -1
  27. package/dist/api/container/routes.js +3 -17
  28. package/dist/api/container/routes.js.map +1 -1
  29. package/dist/api/container/types.d.ts +0 -2
  30. package/dist/api/container/types.js.map +1 -1
  31. package/dist/api/handlers/PodManagementHandler.d.ts +3 -0
  32. package/dist/api/handlers/PodManagementHandler.js +71 -1
  33. package/dist/api/handlers/PodManagementHandler.js.map +1 -1
  34. package/dist/api/handlers/RunHandler.js +5 -5
  35. package/dist/api/handlers/RunHandler.js.map +1 -1
  36. package/dist/api/runs/AgentRuntimeTypes.d.ts +7 -8
  37. package/dist/api/runs/AgentRuntimeTypes.js.map +1 -1
  38. package/dist/api/runs/InngestRunExecutionBackend.d.ts +2 -2
  39. package/dist/api/runs/ManagedRunWorker.d.ts +1 -1
  40. package/dist/api/runs/ManagedRunWorker.js +6 -6
  41. package/dist/api/runs/ManagedRunWorker.js.map +1 -1
  42. package/dist/api/runs/PiAgentRuntimeDriver.d.ts +16 -1
  43. package/dist/api/runs/PiAgentRuntimeDriver.js +182 -23
  44. package/dist/api/runs/PiAgentRuntimeDriver.js.map +1 -1
  45. package/dist/api/runs/RunStateCenter.d.ts +3 -3
  46. package/dist/api/runs/RunStateCenter.js +13 -13
  47. package/dist/api/runs/RunStateCenter.js.map +1 -1
  48. package/dist/api/runs/store.d.ts +4 -4
  49. package/dist/api/runs/store.js +2 -2
  50. package/dist/api/runs/store.js.map +1 -1
  51. package/dist/api/service/VectorStoreService.d.ts +1 -1
  52. package/dist/api/service/VectorStoreService.js +16 -16
  53. package/dist/api/service/VectorStoreService.js.map +1 -1
  54. package/dist/api/tasks/InngestTaskScheduler.d.ts +4 -4
  55. package/dist/api/tasks/TaskMaterializer.d.ts +3 -3
  56. package/dist/api/tasks/TaskMaterializer.js +11 -11
  57. package/dist/api/tasks/TaskMaterializer.js.map +1 -1
  58. package/dist/api/tasks/TaskService.d.ts +3 -3
  59. package/dist/api/tasks/TaskService.js +11 -7
  60. package/dist/api/tasks/TaskService.js.map +1 -1
  61. package/dist/api/tasks/store.d.ts +10 -4
  62. package/dist/api/tasks/store.js +14 -4
  63. package/dist/api/tasks/store.js.map +1 -1
  64. package/dist/api/workspace/types.d.ts +3 -3
  65. package/dist/api/workspace/types.js +6 -6
  66. package/dist/api/workspace/types.js.map +1 -1
  67. package/dist/cli/commands/config.js +2 -2
  68. package/dist/cli/commands/config.js.map +1 -1
  69. package/dist/cli/commands/start.js +9 -3
  70. package/dist/cli/commands/start.js.map +1 -1
  71. package/dist/components/components.jsonld +8 -2
  72. package/dist/components/context.jsonld +302 -51
  73. package/dist/http/search/SearchHttpHandler.js +8 -8
  74. package/dist/http/search/SearchHttpHandler.js.map +1 -1
  75. package/dist/identity/drizzle/PodLookupRepository.d.ts +11 -1
  76. package/dist/identity/drizzle/PodLookupRepository.js +95 -4
  77. package/dist/identity/drizzle/PodLookupRepository.js.map +1 -1
  78. package/dist/identity/drizzle/db.js +4 -43
  79. package/dist/identity/drizzle/db.js.map +1 -1
  80. package/dist/identity/drizzle/schema.pg.d.ts +0 -5
  81. package/dist/identity/drizzle/schema.pg.js +2 -16
  82. package/dist/identity/drizzle/schema.pg.js.map +1 -1
  83. package/dist/identity/drizzle/schema.sqlite.d.ts +19 -176
  84. package/dist/identity/drizzle/schema.sqlite.js +2 -16
  85. package/dist/identity/drizzle/schema.sqlite.js.map +1 -1
  86. package/dist/identity/oidc/AutoDetectIdentityProviderHandler.d.ts +4 -4
  87. package/dist/identity/oidc/AutoDetectIdentityProviderHandler.js +7 -7
  88. package/dist/identity/oidc/AutoDetectIdentityProviderHandler.js.map +1 -1
  89. package/dist/identity/oidc/AutoDetectIdentityProviderHandler.jsonld +6 -6
  90. package/dist/identity/oidc/AutoDetectOidcHandler.d.ts +4 -4
  91. package/dist/identity/oidc/AutoDetectOidcHandler.js +6 -6
  92. package/dist/identity/oidc/AutoDetectOidcHandler.js.map +1 -1
  93. package/dist/identity/oidc/AutoDetectOidcHandler.jsonld +6 -6
  94. package/dist/identity/oidc/ScopedPickWebIdHandler.d.ts +37 -0
  95. package/dist/identity/oidc/ScopedPickWebIdHandler.js +211 -0
  96. package/dist/identity/oidc/ScopedPickWebIdHandler.js.map +1 -0
  97. package/dist/identity/oidc/ScopedPickWebIdHandler.jsonld +158 -0
  98. package/dist/index.d.ts +12 -2
  99. package/dist/index.js +16 -4
  100. package/dist/index.js.map +1 -1
  101. package/dist/main.js +8 -2
  102. package/dist/main.js.map +1 -1
  103. package/dist/provision/ProvisionPodCreator.d.ts +3 -4
  104. package/dist/provision/ProvisionPodCreator.js +8 -13
  105. package/dist/provision/ProvisionPodCreator.js.map +1 -1
  106. package/dist/provision/ProvisionPodCreator.jsonld +7 -7
  107. package/dist/runtime/Proxy.d.ts +0 -1
  108. package/dist/runtime/Proxy.js +0 -9
  109. package/dist/runtime/Proxy.js.map +1 -1
  110. package/dist/runtime/bootstrap.d.ts +1 -0
  111. package/dist/runtime/bootstrap.js +5 -2
  112. package/dist/runtime/bootstrap.js.map +1 -1
  113. package/dist/runtime/css-process.d.ts +12 -4
  114. package/dist/runtime/css-process.js +61 -14
  115. package/dist/runtime/css-process.js.map +1 -1
  116. package/dist/runtime/oidc-issuer.d.ts +3 -2
  117. package/dist/runtime/oidc-issuer.js +3 -2
  118. package/dist/runtime/oidc-issuer.js.map +1 -1
  119. package/dist/runtime/runtime-types.d.ts +1 -0
  120. package/dist/runtime/runtime-types.js.map +1 -1
  121. package/dist/solidfs/LocalFirstRdfRepresentationResolver.d.ts +21 -0
  122. package/dist/solidfs/LocalFirstRdfRepresentationResolver.js +38 -0
  123. package/dist/solidfs/LocalFirstRdfRepresentationResolver.js.map +1 -0
  124. package/dist/solidfs/LocalSolidFS.d.ts +18 -0
  125. package/dist/solidfs/LocalSolidFS.js +539 -0
  126. package/dist/solidfs/LocalSolidFS.js.map +1 -0
  127. package/dist/solidfs/PodSolidFsHttpClient.d.ts +16 -0
  128. package/dist/solidfs/PodSolidFsHttpClient.js +93 -0
  129. package/dist/solidfs/PodSolidFsHttpClient.js.map +1 -0
  130. package/dist/solidfs/PodSolidFsHydrator.d.ts +27 -0
  131. package/dist/solidfs/PodSolidFsHydrator.js +127 -0
  132. package/dist/solidfs/PodSolidFsHydrator.js.map +1 -0
  133. package/dist/solidfs/PodSolidFsSyncer.d.ts +21 -0
  134. package/dist/solidfs/PodSolidFsSyncer.js +78 -0
  135. package/dist/solidfs/PodSolidFsSyncer.js.map +1 -0
  136. package/dist/solidfs/RdfIndexSolidFsSyncer.d.ts +22 -0
  137. package/dist/solidfs/RdfIndexSolidFsSyncer.js +131 -0
  138. package/dist/solidfs/RdfIndexSolidFsSyncer.js.map +1 -0
  139. package/dist/solidfs/index.d.ts +7 -0
  140. package/dist/solidfs/index.js +24 -0
  141. package/dist/solidfs/index.js.map +1 -0
  142. package/dist/solidfs/types.d.ts +131 -0
  143. package/dist/solidfs/types.js +19 -0
  144. package/dist/solidfs/types.js.map +1 -0
  145. package/dist/storage/RepresentationPartialConvertingStore.js +6 -13
  146. package/dist/storage/RepresentationPartialConvertingStore.js.map +1 -1
  147. package/dist/storage/SparqlUpdateResourceStore.d.ts +4 -0
  148. package/dist/storage/SparqlUpdateResourceStore.js +13 -0
  149. package/dist/storage/SparqlUpdateResourceStore.js.map +1 -1
  150. package/dist/storage/SparqlUpdateResourceStore.jsonld +26 -0
  151. package/dist/storage/accessors/MixDataAccessor.d.ts +85 -4
  152. package/dist/storage/accessors/MixDataAccessor.js +511 -16
  153. package/dist/storage/accessors/MixDataAccessor.js.map +1 -1
  154. package/dist/storage/accessors/MixDataAccessor.jsonld +176 -1
  155. package/dist/storage/accessors/QuintStoreSparqlDataAccessor.d.ts +7 -0
  156. package/dist/storage/accessors/QuintStoreSparqlDataAccessor.js +72 -4
  157. package/dist/storage/accessors/QuintStoreSparqlDataAccessor.js.map +1 -1
  158. package/dist/storage/accessors/QuintStoreSparqlDataAccessor.jsonld +24 -0
  159. package/dist/storage/quint/BaseQuintStore.d.ts +3 -0
  160. package/dist/storage/quint/BaseQuintStore.js +51 -27
  161. package/dist/storage/quint/BaseQuintStore.js.map +1 -1
  162. package/dist/storage/quint/PgQuintStore.d.ts +1 -0
  163. package/dist/storage/quint/PgQuintStore.js +50 -32
  164. package/dist/storage/quint/PgQuintStore.js.map +1 -1
  165. package/dist/storage/quint/PgQuintStore.jsonld +4 -3
  166. package/dist/storage/quint/SqliteQuintStore.d.ts +5 -0
  167. package/dist/storage/quint/SqliteQuintStore.js +100 -0
  168. package/dist/storage/quint/SqliteQuintStore.js.map +1 -1
  169. package/dist/storage/quint/SqliteQuintStore.jsonld +20 -0
  170. package/dist/storage/quint/types.d.ts +16 -0
  171. package/dist/storage/quint/types.js.map +1 -1
  172. package/dist/storage/rdf/Rdf3xTripleIndex.d.ts +55 -0
  173. package/dist/storage/rdf/Rdf3xTripleIndex.js +1235 -0
  174. package/dist/storage/rdf/Rdf3xTripleIndex.js.map +1 -0
  175. package/dist/storage/rdf/RdfContentTypes.d.ts +9 -0
  176. package/dist/storage/rdf/RdfContentTypes.js +79 -0
  177. package/dist/storage/rdf/RdfContentTypes.js.map +1 -0
  178. package/dist/storage/rdf/RdfLocalQueryEngine.d.ts +76 -0
  179. package/dist/storage/rdf/RdfLocalQueryEngine.js +2636 -0
  180. package/dist/storage/rdf/RdfLocalQueryEngine.js.map +1 -0
  181. package/dist/storage/rdf/RdfQuadIndex.d.ts +98 -0
  182. package/dist/storage/rdf/RdfQuadIndex.js +1840 -0
  183. package/dist/storage/rdf/RdfQuadIndex.js.map +1 -0
  184. package/dist/storage/rdf/RdfQuadIndex.jsonld +416 -0
  185. package/dist/storage/rdf/RdfShadowComparator.d.ts +12 -0
  186. package/dist/storage/rdf/RdfShadowComparator.js +47 -0
  187. package/dist/storage/rdf/RdfShadowComparator.js.map +1 -0
  188. package/dist/storage/rdf/RdfSparqlAdapter.d.ts +147 -0
  189. package/dist/storage/rdf/RdfSparqlAdapter.js +2420 -0
  190. package/dist/storage/rdf/RdfSparqlAdapter.js.map +1 -0
  191. package/dist/storage/rdf/RdfSparqlAdapter.jsonld +414 -0
  192. package/dist/storage/rdf/RdfTermDictionary.d.ts +27 -0
  193. package/dist/storage/rdf/RdfTermDictionary.js +352 -0
  194. package/dist/storage/rdf/RdfTermDictionary.js.map +1 -0
  195. package/dist/storage/rdf/RdfTermDictionary.jsonld +114 -0
  196. package/dist/storage/rdf/RdfTermSemantics.d.ts +6 -0
  197. package/dist/storage/rdf/RdfTermSemantics.js +40 -0
  198. package/dist/storage/rdf/RdfTermSemantics.js.map +1 -0
  199. package/dist/storage/rdf/RdfTextIndex.d.ts +23 -0
  200. package/dist/storage/rdf/RdfTextIndex.js +569 -0
  201. package/dist/storage/rdf/RdfTextIndex.js.map +1 -0
  202. package/dist/storage/rdf/RdfVectorIndex.d.ts +22 -0
  203. package/dist/storage/rdf/RdfVectorIndex.js +631 -0
  204. package/dist/storage/rdf/RdfVectorIndex.js.map +1 -0
  205. package/dist/storage/rdf/RdfXmlSerializer.d.ts +2 -0
  206. package/dist/storage/rdf/RdfXmlSerializer.js +123 -0
  207. package/dist/storage/rdf/RdfXmlSerializer.js.map +1 -0
  208. package/dist/storage/rdf/ShadowRdfQuintStore.d.ts +58 -0
  209. package/dist/storage/rdf/ShadowRdfQuintStore.js +202 -0
  210. package/dist/storage/rdf/ShadowRdfQuintStore.js.map +1 -0
  211. package/dist/storage/rdf/ShadowRdfQuintStore.jsonld +308 -0
  212. package/dist/storage/rdf/SolidRdfEngine.d.ts +51 -0
  213. package/dist/storage/rdf/SolidRdfEngine.js +264 -0
  214. package/dist/storage/rdf/SolidRdfEngine.js.map +1 -0
  215. package/dist/storage/rdf/SolidRdfEngine.jsonld +338 -0
  216. package/dist/storage/rdf/SolidRdfSparqlEngine.d.ts +92 -0
  217. package/dist/storage/rdf/SolidRdfSparqlEngine.js +477 -0
  218. package/dist/storage/rdf/SolidRdfSparqlEngine.js.map +1 -0
  219. package/dist/storage/rdf/SolidRdfSparqlEngine.jsonld +257 -0
  220. package/dist/storage/rdf/index.d.ts +15 -0
  221. package/dist/storage/rdf/index.js +61 -0
  222. package/dist/storage/rdf/index.js.map +1 -0
  223. package/dist/storage/rdf/models-benchmark.d.ts +260 -0
  224. package/dist/storage/rdf/models-benchmark.js +1405 -0
  225. package/dist/storage/rdf/models-benchmark.js.map +1 -0
  226. package/dist/storage/rdf/types.d.ts +726 -0
  227. package/dist/storage/rdf/types.js +3 -0
  228. package/dist/storage/rdf/types.js.map +1 -0
  229. package/dist/storage/rdf/types.jsonld +316 -0
  230. package/dist/storage/vector/VectorIndexingListener.d.ts +5 -5
  231. package/dist/storage/vector/VectorIndexingListener.js +19 -19
  232. package/dist/storage/vector/VectorIndexingListener.js.map +1 -1
  233. package/package.json +3 -2
  234. package/templates/pod/acp/.acr.hbs +39 -0
  235. package/templates/pod/acp/README.acr +18 -0
  236. package/templates/pod/acp/profile/card.acr +22 -0
  237. package/templates/pod/base/README$.md.hbs +27 -0
  238. package/templates/pod/base/profile/card$.ttl.hbs +13 -0
  239. package/templates/pod/wac/.acl.hbs +26 -0
  240. package/templates/pod/wac/README.acl.hbs +14 -0
  241. package/templates/pod/wac/profile/card.acl.hbs +19 -0
  242. package/dist/api/handlers/WebIdProfileHandler.d.ts +0 -16
  243. package/dist/api/handlers/WebIdProfileHandler.js +0 -423
  244. package/dist/api/handlers/WebIdProfileHandler.js.map +0 -1
  245. package/dist/identity/drizzle/WebIdProfileRepository.d.ts +0 -63
  246. package/dist/identity/drizzle/WebIdProfileRepository.js +0 -168
  247. package/dist/identity/drizzle/WebIdProfileRepository.js.map +0 -1
  248. package/dist/identity/drizzle/WebIdProfileRepository.jsonld +0 -112
  249. package/dist/storage/quint/BaseQuintStore.jsonld +0 -257
@@ -0,0 +1,308 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@undefineds.co/xpod/^0.0.0/components/context.jsonld"
4
+ ],
5
+ "@id": "npmd:@undefineds.co/xpod",
6
+ "components": [
7
+ {
8
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStoreOptions",
9
+ "@type": "AbstractClass",
10
+ "requireElement": "ShadowRdfQuintStoreOptions",
11
+ "parameters": [],
12
+ "memberFields": [
13
+ {
14
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStoreOptions__member_compatibilityStore",
15
+ "memberFieldName": "compatibilityStore"
16
+ },
17
+ {
18
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStoreOptions__member_index",
19
+ "memberFieldName": "index"
20
+ },
21
+ {
22
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStoreOptions__member_autoOpen",
23
+ "memberFieldName": "autoOpen"
24
+ },
25
+ {
26
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStoreOptions__member_autoBackfill",
27
+ "memberFieldName": "autoBackfill"
28
+ }
29
+ ],
30
+ "constructorArguments": []
31
+ },
32
+ {
33
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore",
34
+ "@type": "Class",
35
+ "requireElement": "ShadowRdfQuintStore",
36
+ "extends": [
37
+ "undefineds:dist/storage/quint/types.jsonld#QuintStore"
38
+ ],
39
+ "comment": "Shadow-first bridge from the existing TEXT QuintStore to the term-id RDF index. Reads keep using the compatibility store. Writes are mirrored into RdfQuadIndex so callers can run explicit shadow comparisons before any query path is switched to SolidRdfEngine.",
40
+ "parameters": [
41
+ {
42
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_compatibilityStore",
43
+ "range": "undefineds:dist/storage/quint/types.jsonld#QuintStore"
44
+ },
45
+ {
46
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_index_path",
47
+ "range": "xsd:string"
48
+ },
49
+ {
50
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_index_debug",
51
+ "range": {
52
+ "@type": "ParameterRangeUnion",
53
+ "parameterRangeElements": [
54
+ "xsd:boolean",
55
+ {
56
+ "@type": "ParameterRangeUndefined"
57
+ }
58
+ ]
59
+ }
60
+ },
61
+ {
62
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_autoOpen",
63
+ "range": {
64
+ "@type": "ParameterRangeUnion",
65
+ "parameterRangeElements": [
66
+ "xsd:boolean",
67
+ {
68
+ "@type": "ParameterRangeUndefined"
69
+ }
70
+ ]
71
+ }
72
+ },
73
+ {
74
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_autoBackfill_enabled",
75
+ "range": {
76
+ "@type": "ParameterRangeUnion",
77
+ "parameterRangeElements": [
78
+ "xsd:boolean",
79
+ {
80
+ "@type": "ParameterRangeUndefined"
81
+ }
82
+ ]
83
+ }
84
+ },
85
+ {
86
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_autoBackfill_clear",
87
+ "range": {
88
+ "@type": "ParameterRangeUnion",
89
+ "parameterRangeElements": [
90
+ "xsd:boolean",
91
+ {
92
+ "@type": "ParameterRangeUndefined"
93
+ }
94
+ ]
95
+ }
96
+ },
97
+ {
98
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_autoBackfill_batchSize",
99
+ "range": {
100
+ "@type": "ParameterRangeUnion",
101
+ "parameterRangeElements": [
102
+ "xsd:number",
103
+ {
104
+ "@type": "ParameterRangeUndefined"
105
+ }
106
+ ]
107
+ }
108
+ }
109
+ ],
110
+ "memberFields": [
111
+ {
112
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_index",
113
+ "memberFieldName": "index",
114
+ "range": "undefineds:dist/storage/rdf/RdfQuadIndex.jsonld#RdfQuadIndex"
115
+ },
116
+ {
117
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_compatibilityStore",
118
+ "memberFieldName": "compatibilityStore"
119
+ },
120
+ {
121
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_ownsIndex",
122
+ "memberFieldName": "ownsIndex"
123
+ },
124
+ {
125
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_comparator",
126
+ "memberFieldName": "comparator"
127
+ },
128
+ {
129
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_autoBackfill",
130
+ "memberFieldName": "autoBackfill"
131
+ },
132
+ {
133
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_opened",
134
+ "memberFieldName": "opened"
135
+ },
136
+ {
137
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_opening",
138
+ "memberFieldName": "opening"
139
+ },
140
+ {
141
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_autoBackfilled",
142
+ "memberFieldName": "autoBackfilled"
143
+ },
144
+ {
145
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_constructor",
146
+ "memberFieldName": "constructor"
147
+ },
148
+ {
149
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_open",
150
+ "memberFieldName": "open"
151
+ },
152
+ {
153
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_openOnce",
154
+ "memberFieldName": "openOnce"
155
+ },
156
+ {
157
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_close",
158
+ "memberFieldName": "close"
159
+ },
160
+ {
161
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_get",
162
+ "memberFieldName": "get"
163
+ },
164
+ {
165
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_match",
166
+ "memberFieldName": "match"
167
+ },
168
+ {
169
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_getByGraphPrefix",
170
+ "memberFieldName": "getByGraphPrefix"
171
+ },
172
+ {
173
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_count",
174
+ "memberFieldName": "count"
175
+ },
176
+ {
177
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_getCompound",
178
+ "memberFieldName": "getCompound"
179
+ },
180
+ {
181
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_getAttributes",
182
+ "memberFieldName": "getAttributes"
183
+ },
184
+ {
185
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_put",
186
+ "memberFieldName": "put"
187
+ },
188
+ {
189
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_multiPut",
190
+ "memberFieldName": "multiPut"
191
+ },
192
+ {
193
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_replaceSource",
194
+ "memberFieldName": "replaceSource"
195
+ },
196
+ {
197
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_deleteSource",
198
+ "memberFieldName": "deleteSource"
199
+ },
200
+ {
201
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_updateEmbedding",
202
+ "memberFieldName": "updateEmbedding"
203
+ },
204
+ {
205
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_del",
206
+ "memberFieldName": "del"
207
+ },
208
+ {
209
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_multiDel",
210
+ "memberFieldName": "multiDel"
211
+ },
212
+ {
213
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_stats",
214
+ "memberFieldName": "stats"
215
+ },
216
+ {
217
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_clear",
218
+ "memberFieldName": "clear"
219
+ },
220
+ {
221
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_backfillShadowIndex",
222
+ "memberFieldName": "backfillShadowIndex"
223
+ },
224
+ {
225
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_shadowGet",
226
+ "memberFieldName": "shadowGet"
227
+ },
228
+ {
229
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_runAutoBackfill",
230
+ "memberFieldName": "runAutoBackfill"
231
+ },
232
+ {
233
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_shouldAutoBackfill",
234
+ "memberFieldName": "shouldAutoBackfill"
235
+ },
236
+ {
237
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore__member_autoBackfillOptions",
238
+ "memberFieldName": "autoBackfillOptions"
239
+ }
240
+ ],
241
+ "constructorArguments": [
242
+ {
243
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options__constructorArgument",
244
+ "fields": [
245
+ {
246
+ "keyRaw": "compatibilityStore",
247
+ "value": {
248
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_compatibilityStore"
249
+ }
250
+ },
251
+ {
252
+ "keyRaw": "index",
253
+ "value": {
254
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_index__constructorArgument",
255
+ "fields": [
256
+ {
257
+ "keyRaw": "path",
258
+ "value": {
259
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_index_path"
260
+ }
261
+ },
262
+ {
263
+ "keyRaw": "debug",
264
+ "value": {
265
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_index_debug"
266
+ }
267
+ }
268
+ ]
269
+ }
270
+ },
271
+ {
272
+ "keyRaw": "autoOpen",
273
+ "value": {
274
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_autoOpen"
275
+ }
276
+ },
277
+ {
278
+ "keyRaw": "autoBackfill",
279
+ "value": {
280
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_autoBackfill__constructorArgument",
281
+ "fields": [
282
+ {
283
+ "keyRaw": "enabled",
284
+ "value": {
285
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_autoBackfill_enabled"
286
+ }
287
+ },
288
+ {
289
+ "keyRaw": "clear",
290
+ "value": {
291
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_autoBackfill_clear"
292
+ }
293
+ },
294
+ {
295
+ "keyRaw": "batchSize",
296
+ "value": {
297
+ "@id": "undefineds:dist/storage/rdf/ShadowRdfQuintStore.jsonld#ShadowRdfQuintStore_options_autoBackfill_batchSize"
298
+ }
299
+ }
300
+ ]
301
+ }
302
+ }
303
+ ]
304
+ }
305
+ ]
306
+ }
307
+ ]
308
+ }
@@ -0,0 +1,51 @@
1
+ import type { Quad } from '@rdfjs/types';
2
+ import type { QuintPattern, QuintStore } from '../quint/types';
3
+ import type { Rdf3xShadowJoinResult, Rdf3xShadowScanResult, Rdf3xTripleIndexOptions, RdfIndexPutOptions, RdfPatternQuery, RdfQuadJoinOptions, RdfQuadJoinPattern, RdfQuadIndexOptions, RdfQuadIndexScanResult, RdfSourceInput, RdfShadowScanResult, RdfTextChunkInput, RdfTextIndexOptions, RdfTextSearchOptions, RdfTextSearchResult, RdfTextSourceInput, RdfVectorChunkInput, RdfVectorIndexOptions, RdfVectorSearchOptions, RdfVectorSearchResult, RdfVectorSourceInput } from './types';
4
+ import { RdfQuadIndex } from './RdfQuadIndex';
5
+ import { Rdf3xTripleIndex } from './Rdf3xTripleIndex';
6
+ import { RdfTextIndex } from './RdfTextIndex';
7
+ import { RdfVectorIndex } from './RdfVectorIndex';
8
+ import type { RdfLocalQuery, RdfLocalQueryResult } from './types';
9
+ export interface SolidRdfEngineOptions {
10
+ index: RdfQuadIndex | RdfQuadIndexOptions;
11
+ textIndex?: RdfTextIndex | RdfTextIndexOptions;
12
+ vectorIndex?: RdfVectorIndex | RdfVectorIndexOptions;
13
+ rdf3xIndex?: Rdf3xTripleIndex | Rdf3xTripleIndexOptions;
14
+ compatibilityStore?: QuintStore;
15
+ autoOpen?: boolean;
16
+ }
17
+ export declare class SolidRdfEngine {
18
+ readonly index: RdfQuadIndex;
19
+ readonly textIndex?: RdfTextIndex;
20
+ readonly vectorIndex?: RdfVectorIndex;
21
+ readonly rdf3xIndex?: Rdf3xTripleIndex;
22
+ private readonly ownsIndex;
23
+ private readonly ownsTextIndex;
24
+ private readonly ownsVectorIndex;
25
+ private readonly ownsRdf3xIndex;
26
+ private readonly compatibilityStore?;
27
+ private shadowComparator?;
28
+ private readonly queryEngine;
29
+ constructor(options: SolidRdfEngineOptions);
30
+ open(): void;
31
+ close(): Promise<void>;
32
+ put(quads: Quad | Quad[], options?: RdfIndexPutOptions): void;
33
+ replaceSource(quads: Quad[], source: RdfSourceInput): void;
34
+ deleteSource(source: string): number;
35
+ delete(pattern: QuintPattern): number;
36
+ scan(query: RdfPatternQuery): RdfQuadIndexScanResult;
37
+ query(query: RdfLocalQuery): RdfLocalQueryResult;
38
+ indexTextSource(source: RdfTextSourceInput, text: string, chunks?: RdfTextChunkInput[]): void;
39
+ deleteTextSource(source: string): number;
40
+ searchText(options: RdfTextSearchOptions | string): RdfTextSearchResult[];
41
+ indexVectorSource(source: RdfVectorSourceInput, chunks: RdfVectorChunkInput[]): void;
42
+ deleteVectorSource(source: string): number;
43
+ searchVector(options: RdfVectorSearchOptions): RdfVectorSearchResult[];
44
+ shadowScan(query: RdfPatternQuery): Promise<RdfShadowScanResult>;
45
+ shadowRdf3xScan(query: RdfPatternQuery): Rdf3xShadowScanResult;
46
+ shadowRdf3xJoin(patterns: RdfQuadJoinPattern[], options?: RdfQuadJoinOptions): Rdf3xShadowJoinResult;
47
+ supportsPrimary(query: RdfPatternQuery): boolean;
48
+ private requireTextIndex;
49
+ private requireVectorIndex;
50
+ private requireRdf3xIndex;
51
+ }
@@ -0,0 +1,264 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SolidRdfEngine = void 0;
4
+ const n3_1 = require("n3");
5
+ const types_1 = require("../quint/types");
6
+ const RdfQuadIndex_1 = require("./RdfQuadIndex");
7
+ const Rdf3xTripleIndex_1 = require("./Rdf3xTripleIndex");
8
+ const RdfTextIndex_1 = require("./RdfTextIndex");
9
+ const RdfVectorIndex_1 = require("./RdfVectorIndex");
10
+ const RdfShadowComparator_1 = require("./RdfShadowComparator");
11
+ const RdfLocalQueryEngine_1 = require("./RdfLocalQueryEngine");
12
+ class SolidRdfEngine {
13
+ constructor(options) {
14
+ if (options.index instanceof RdfQuadIndex_1.RdfQuadIndex) {
15
+ this.index = options.index;
16
+ this.ownsIndex = false;
17
+ }
18
+ else {
19
+ this.index = new RdfQuadIndex_1.RdfQuadIndex(options.index);
20
+ this.ownsIndex = true;
21
+ }
22
+ if (options.textIndex instanceof RdfTextIndex_1.RdfTextIndex) {
23
+ this.textIndex = options.textIndex;
24
+ this.ownsTextIndex = false;
25
+ }
26
+ else if (isRdfTextIndexOptions(options.textIndex)) {
27
+ this.textIndex = new RdfTextIndex_1.RdfTextIndex(options.textIndex);
28
+ this.ownsTextIndex = true;
29
+ }
30
+ else {
31
+ this.ownsTextIndex = false;
32
+ }
33
+ if (options.vectorIndex instanceof RdfVectorIndex_1.RdfVectorIndex) {
34
+ this.vectorIndex = options.vectorIndex;
35
+ this.ownsVectorIndex = false;
36
+ }
37
+ else if (isRdfVectorIndexOptions(options.vectorIndex)) {
38
+ this.vectorIndex = new RdfVectorIndex_1.RdfVectorIndex(options.vectorIndex);
39
+ this.ownsVectorIndex = true;
40
+ }
41
+ else {
42
+ this.ownsVectorIndex = false;
43
+ }
44
+ if (options.rdf3xIndex instanceof Rdf3xTripleIndex_1.Rdf3xTripleIndex) {
45
+ this.rdf3xIndex = options.rdf3xIndex;
46
+ this.ownsRdf3xIndex = false;
47
+ }
48
+ else if (isRdf3xTripleIndexOptions(options.rdf3xIndex)) {
49
+ this.rdf3xIndex = new Rdf3xTripleIndex_1.Rdf3xTripleIndex(options.rdf3xIndex);
50
+ this.ownsRdf3xIndex = true;
51
+ }
52
+ else {
53
+ this.ownsRdf3xIndex = false;
54
+ }
55
+ this.compatibilityStore = options.compatibilityStore;
56
+ this.queryEngine = new RdfLocalQueryEngine_1.RdfLocalQueryEngine(this.index, this.textIndex, this.vectorIndex);
57
+ if (this.compatibilityStore) {
58
+ this.shadowComparator = new RdfShadowComparator_1.RdfShadowComparator(this.index, this.compatibilityStore);
59
+ }
60
+ if (options.autoOpen) {
61
+ this.open();
62
+ }
63
+ }
64
+ open() {
65
+ this.index.open();
66
+ this.textIndex?.open();
67
+ this.vectorIndex?.open();
68
+ this.rdf3xIndex?.open();
69
+ }
70
+ async close() {
71
+ if (this.ownsRdf3xIndex) {
72
+ this.rdf3xIndex?.close();
73
+ }
74
+ if (this.ownsVectorIndex) {
75
+ this.vectorIndex?.close();
76
+ }
77
+ if (this.ownsTextIndex) {
78
+ this.textIndex?.close();
79
+ }
80
+ if (this.ownsIndex) {
81
+ this.index.close();
82
+ }
83
+ if (this.compatibilityStore) {
84
+ await this.compatibilityStore.close();
85
+ }
86
+ }
87
+ put(quads, options) {
88
+ this.index.multiPut(Array.isArray(quads) ? quads : [quads], options);
89
+ }
90
+ replaceSource(quads, source) {
91
+ this.index.replaceSource(quads, source);
92
+ }
93
+ deleteSource(source) {
94
+ return this.index.deleteSource(source);
95
+ }
96
+ delete(pattern) {
97
+ return this.index.delete(pattern);
98
+ }
99
+ scan(query) {
100
+ return this.index.scan(query.pattern, query.options);
101
+ }
102
+ query(query) {
103
+ return this.queryEngine.query(query);
104
+ }
105
+ indexTextSource(source, text, chunks) {
106
+ this.requireTextIndex().indexText(source, text, chunks);
107
+ }
108
+ deleteTextSource(source) {
109
+ return this.requireTextIndex().deleteSource(source);
110
+ }
111
+ searchText(options) {
112
+ return this.requireTextIndex().search(typeof options === 'string' ? { query: options } : options);
113
+ }
114
+ indexVectorSource(source, chunks) {
115
+ this.requireVectorIndex().indexVector(source, chunks);
116
+ }
117
+ deleteVectorSource(source) {
118
+ return this.requireVectorIndex().deleteSource(source);
119
+ }
120
+ searchVector(options) {
121
+ return this.requireVectorIndex().search(options);
122
+ }
123
+ async shadowScan(query) {
124
+ if (!this.shadowComparator) {
125
+ throw new Error('SolidRdfEngine shadowScan requires a compatibility QuintStore');
126
+ }
127
+ return this.shadowComparator.compareScan(query);
128
+ }
129
+ shadowRdf3xScan(query) {
130
+ const rdf3xIndex = this.requireRdf3xIndex();
131
+ const rdf3xPattern = toRdf3xTriplePattern(query.pattern);
132
+ const rebuild = rdf3xIndex.rebuildFromCurrentQuads();
133
+ const primary = this.index.scan(query.pattern, query.options);
134
+ const rdf3x = rdf3xIndex.scan(rdf3xPattern, query.options);
135
+ const diff = (0, RdfShadowComparator_1.diffQuads)(rdf3x.quads, primary.quads);
136
+ const orderedMatch = canonicalQuadKeys(primary.quads).join('\n') === canonicalQuadKeys(rdf3x.quads).join('\n');
137
+ return {
138
+ matched: diff.missingFromPrimary.length === 0 && diff.extraInPrimary.length === 0,
139
+ orderedMatch,
140
+ primary: primary.quads,
141
+ rdf3x: rdf3x.quads,
142
+ diff: {
143
+ missingFromRdf3x: diff.extraInPrimary,
144
+ extraInRdf3x: diff.missingFromPrimary,
145
+ },
146
+ primaryMetrics: primary.metrics,
147
+ rdf3xMetrics: rdf3x.metrics,
148
+ rebuild,
149
+ };
150
+ }
151
+ shadowRdf3xJoin(patterns, options) {
152
+ const rdf3xIndex = this.requireRdf3xIndex();
153
+ const rebuild = rdf3xIndex.rebuildFromCurrentQuads();
154
+ const primary = this.index.joinPatterns(patterns, options);
155
+ const rdf3x = rdf3xIndex.joinPatterns(patterns, options);
156
+ const primaryKeys = primary.bindings.map(canonicalBindingKey);
157
+ const rdf3xKeys = rdf3x.bindings.map(canonicalBindingKey);
158
+ const diff = diffBindingKeys(rdf3xKeys, primaryKeys);
159
+ return {
160
+ matched: diff.missingFromRdf3x.length === 0 && diff.extraInRdf3x.length === 0,
161
+ orderedMatch: primaryKeys.join('\n') === rdf3xKeys.join('\n'),
162
+ primary: primary.bindings,
163
+ rdf3x: rdf3x.bindings,
164
+ diff,
165
+ primaryMetrics: primary.metrics,
166
+ rdf3xMetrics: rdf3x.metrics,
167
+ rebuild,
168
+ };
169
+ }
170
+ supportsPrimary(query) {
171
+ try {
172
+ this.index.scan(query.pattern, { ...query.options, limit: 0 });
173
+ return true;
174
+ }
175
+ catch {
176
+ return false;
177
+ }
178
+ }
179
+ requireTextIndex() {
180
+ if (!this.textIndex) {
181
+ throw new Error('SolidRdfEngine text index is not configured');
182
+ }
183
+ return this.textIndex;
184
+ }
185
+ requireVectorIndex() {
186
+ if (!this.vectorIndex) {
187
+ throw new Error('SolidRdfEngine vector index is not configured');
188
+ }
189
+ return this.vectorIndex;
190
+ }
191
+ requireRdf3xIndex() {
192
+ if (!this.rdf3xIndex) {
193
+ throw new Error('SolidRdfEngine RDF-3X shadow index is not configured');
194
+ }
195
+ return this.rdf3xIndex;
196
+ }
197
+ }
198
+ exports.SolidRdfEngine = SolidRdfEngine;
199
+ function isRdfTextIndexOptions(input) {
200
+ return input !== undefined && !(input instanceof RdfTextIndex_1.RdfTextIndex) && typeof input.path === 'string';
201
+ }
202
+ function isRdfVectorIndexOptions(input) {
203
+ return input !== undefined && !(input instanceof RdfVectorIndex_1.RdfVectorIndex) && typeof input.path === 'string';
204
+ }
205
+ function isRdf3xTripleIndexOptions(input) {
206
+ return input !== undefined && !(input instanceof Rdf3xTripleIndex_1.Rdf3xTripleIndex) && typeof input.path === 'string';
207
+ }
208
+ function canonicalQuadKeys(quads) {
209
+ return quads.map((quad) => [
210
+ (0, n3_1.termToId)(quad.graph),
211
+ (0, n3_1.termToId)(quad.subject),
212
+ (0, n3_1.termToId)(quad.predicate),
213
+ (0, n3_1.termToId)(quad.object),
214
+ ].join('\u001f'));
215
+ }
216
+ function canonicalBindingKey(binding) {
217
+ return Object.keys(binding)
218
+ .sort()
219
+ .map((key) => `${key}=${(0, n3_1.termToId)(binding[key])}`)
220
+ .join('\u001f');
221
+ }
222
+ function diffBindingKeys(rdf3xKeys, primaryKeys) {
223
+ const rdf3xSet = new Set(rdf3xKeys);
224
+ const primarySet = new Set(primaryKeys);
225
+ return {
226
+ missingFromRdf3x: Array.from(primarySet).filter((key) => !rdf3xSet.has(key)).sort(),
227
+ extraInRdf3x: Array.from(rdf3xSet).filter((key) => !primarySet.has(key)).sort(),
228
+ };
229
+ }
230
+ function toRdf3xTriplePattern(pattern) {
231
+ const result = {};
232
+ for (const key of ['graph', 'subject', 'predicate', 'object']) {
233
+ const value = pattern[key];
234
+ if (!value) {
235
+ continue;
236
+ }
237
+ if (!(0, types_1.isTerm)(value)) {
238
+ if (key === 'graph' && isStartsWithOperator(value)) {
239
+ result.graph = { $startsWith: value.$startsWith };
240
+ continue;
241
+ }
242
+ if (key === 'object' && isNumericObjectRangeOperator(value)) {
243
+ result.object = value;
244
+ continue;
245
+ }
246
+ throw new Error(`SolidRdfEngine RDF-3X shadow scan only supports exact ${key} terms${key === 'graph' ? ' or graph $startsWith' : ''}`);
247
+ }
248
+ result[key] = value;
249
+ }
250
+ return result;
251
+ }
252
+ function isStartsWithOperator(value) {
253
+ return value !== null
254
+ && typeof value === 'object'
255
+ && '$startsWith' in value
256
+ && typeof value.$startsWith === 'string';
257
+ }
258
+ function isNumericObjectRangeOperator(value) {
259
+ return value !== null
260
+ && typeof value === 'object'
261
+ && !('termType' in value)
262
+ && ['$gt', '$gte', '$lt', '$lte'].some((operator) => operator in value);
263
+ }
264
+ //# sourceMappingURL=SolidRdfEngine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolidRdfEngine.js","sourceRoot":"","sources":["../../../src/storage/rdf/SolidRdfEngine.ts"],"names":[],"mappings":";;;AACA,2BAA8B;AAE9B,0CAAwC;AA0BxC,iDAA8C;AAC9C,yDAAsD;AACtD,iDAA8C;AAC9C,qDAAkD;AAClD,+DAAuE;AACvE,+DAA4D;AAY5D,MAAa,cAAc;IAazB,YAAmB,OAA8B;QAC/C,IAAI,OAAO,CAAC,KAAK,YAAY,2BAAY,EAAE,CAAC;YAC1C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAC3B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,GAAG,IAAI,2BAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,CAAC;QACD,IAAI,OAAO,CAAC,SAAS,YAAY,2BAAY,EAAE,CAAC;YAC9C,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;YACnC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC7B,CAAC;aAAM,IAAI,qBAAqB,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACpD,IAAI,CAAC,SAAS,GAAG,IAAI,2BAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACrD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC7B,CAAC;QACD,I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I,KAAK,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import type { Quad } from '@rdfjs/types';\nimport { termToId } from 'n3';\nimport type { QuintPattern, QuintStore } from '../quint/types';\nimport { isTerm } from '../quint/types';\nimport type {\n Rdf3xNumericObjectRangePattern,\n Rdf3xShadowJoinResult,\n Rdf3xShadowScanResult,\n Rdf3xTripleIndexOptions,\n Rdf3xTriplePattern,\n RdfIndexPutOptions,\n RdfPatternQuery,\n RdfQuadJoinOptions,\n RdfQuadJoinPattern,\n RdfQuadIndexOptions,\n RdfQuadIndexScanResult,\n RdfSourceInput,\n RdfShadowScanResult,\n RdfTextChunkInput,\n RdfTextIndexOptions,\n RdfTextSearchOptions,\n RdfTextSearchResult,\n RdfTextSourceInput,\n RdfVectorChunkInput,\n RdfVectorIndexOptions,\n RdfVectorSearchOptions,\n RdfVectorSearchResult,\n RdfVectorSourceInput,\n} from './types';\nimport { RdfQuadIndex } from './RdfQuadIndex';\nimport { Rdf3xTripleIndex } from './Rdf3xTripleIndex';\nimport { RdfTextIndex } from './RdfTextIndex';\nimport { RdfVectorIndex } from './RdfVectorIndex';\nimport { RdfShadowComparator, diffQuads } from './RdfShadowComparator';\nimport { RdfLocalQueryEngine } from './RdfLocalQueryEngine';\nimport type { RdfLocalQuery, RdfLocalQueryResult } from './types';\n\nexport interface SolidRdfEngineOptions {\n index: RdfQuadIndex | RdfQuadIndexOptions;\n textIndex?: RdfTextIndex | RdfTextIndexOptions;\n vectorIndex?: RdfVectorIndex | RdfVectorIndexOptions;\n rdf3xIndex?: Rdf3xTripleIndex | Rdf3xTripleIndexOptions;\n compatibilityStore?: QuintStore;\n autoOpen?: boolean;\n}\n\nexport class SolidRdfEngine {\n public readonly index: RdfQuadIndex;\n public readonly textIndex?: RdfTextIndex;\n public readonly vectorIndex?: RdfVectorIndex;\n public readonly rdf3xIndex?: Rdf3xTripleIndex;\n private readonly ownsIndex: boolean;\n private readonly ownsTextIndex: boolean;\n private readonly ownsVectorIndex: boolean;\n private readonly ownsRdf3xIndex: boolean;\n private readonly compatibilityStore?: QuintStore;\n private shadowComparator?: RdfShadowComparator;\n private readonly queryEngine: RdfLocalQueryEngine;\n\n public constructor(options: SolidRdfEngineOptions) {\n if (options.index instanceof RdfQuadIndex) {\n this.index = options.index;\n this.ownsIndex = false;\n } else {\n this.index = new RdfQuadIndex(options.index);\n this.ownsIndex = true;\n }\n if (options.textIndex instanceof RdfTextIndex) {\n this.textIndex = options.textIndex;\n this.ownsTextIndex = false;\n } else if (isRdfTextIndexOptions(options.textIndex)) {\n this.textIndex = new RdfTextIndex(options.textIndex);\n this.ownsTextIndex = true;\n } else {\n this.ownsTextIndex = false;\n }\n if (options.vectorIndex instanceof RdfVectorIndex) {\n this.vectorIndex = options.vectorIndex;\n this.ownsVectorIndex = false;\n } else if (isRdfVectorIndexOptions(options.vectorIndex)) {\n this.vectorIndex = new RdfVectorIndex(options.vectorIndex);\n this.ownsVectorIndex = true;\n } else {\n this.ownsVectorIndex = false;\n }\n if (options.rdf3xIndex instanceof Rdf3xTripleIndex) {\n this.rdf3xIndex = options.rdf3xIndex;\n this.ownsRdf3xIndex = false;\n } else if (isRdf3xTripleIndexOptions(options.rdf3xIndex)) {\n this.rdf3xIndex = new Rdf3xTripleIndex(options.rdf3xIndex);\n this.ownsRdf3xIndex = true;\n } else {\n this.ownsRdf3xIndex = false;\n }\n this.compatibilityStore = options.compatibilityStore;\n this.queryEngine = new RdfLocalQueryEngine(this.index, this.textIndex, this.vectorIndex);\n if (this.compatibilityStore) {\n this.shadowComparator = new RdfShadowComparator(this.index, this.compatibilityStore);\n }\n if (options.autoOpen) {\n this.open();\n }\n }\n\n public open(): void {\n this.index.open();\n this.textIndex?.open();\n this.vectorIndex?.open();\n this.rdf3xIndex?.open();\n }\n\n public async close(): Promise<void> {\n if (this.ownsRdf3xIndex) {\n this.rdf3xIndex?.close();\n }\n if (this.ownsVectorIndex) {\n this.vectorIndex?.close();\n }\n if (this.ownsTextIndex) {\n this.textIndex?.close();\n }\n if (this.ownsIndex) {\n this.index.close();\n }\n if (this.compatibilityStore) {\n await this.compatibilityStore.close();\n }\n }\n\n public put(quads: Quad | Quad[], options?: RdfIndexPutOptions): void {\n this.index.multiPut(Array.isArray(quads) ? quads : [quads], options);\n }\n\n public replaceSource(quads: Quad[], source: RdfSourceInput): void {\n this.index.replaceSource(quads, source);\n }\n\n public deleteSource(source: string): number {\n return this.index.deleteSource(source);\n }\n\n public delete(pattern: QuintPattern): number {\n return this.index.delete(pattern);\n }\n\n public scan(query: RdfPatternQuery): RdfQuadIndexScanResult {\n return this.index.scan(query.pattern, query.options);\n }\n\n public query(query: RdfLocalQuery): RdfLocalQueryResult {\n return this.queryEngine.query(query);\n }\n\n public indexTextSource(source: RdfTextSourceInput, text: string, chunks?: RdfTextChunkInput[]): void {\n this.requireTextIndex().indexText(source, text, chunks);\n }\n\n public deleteTextSource(source: string): number {\n return this.requireTextIndex().deleteSource(source);\n }\n\n public searchText(options: RdfTextSearchOptions | string): RdfTextSearchResult[] {\n return this.requireTextIndex().search(typeof options === 'string' ? { query: options } : options);\n }\n\n public indexVectorSource(source: RdfVectorSourceInput, chunks: RdfVectorChunkInput[]): void {\n this.requireVectorIndex().indexVector(source, chunks);\n }\n\n public deleteVectorSource(source: string): number {\n return this.requireVectorIndex().deleteSource(source);\n }\n\n public searchVector(options: RdfVectorSearchOptions): RdfVectorSearchResult[] {\n return this.requireVectorIndex().search(options);\n }\n\n public async shadowScan(query: RdfPatternQuery): Promise<RdfShadowScanResult> {\n if (!this.shadowComparator) {\n throw new Error('SolidRdfEngine shadowScan requires a compatibility QuintStore');\n }\n return this.shadowComparator.compareScan(query);\n }\n\n public shadowRdf3xScan(query: RdfPatternQuery): Rdf3xShadowScanResult {\n const rdf3xIndex = this.requireRdf3xIndex();\n const rdf3xPattern = toRdf3xTriplePattern(query.pattern);\n const rebuild = rdf3xIndex.rebuildFromCurrentQuads();\n const primary = this.index.scan(query.pattern, query.options);\n const rdf3x = rdf3xIndex.scan(rdf3xPattern, query.options);\n const diff = diffQuads(rdf3x.quads, primary.quads);\n const orderedMatch = canonicalQuadKeys(primary.quads).join('\\n') === canonicalQuadKeys(rdf3x.quads).join('\\n');\n return {\n matched: diff.missingFromPrimary.length === 0 && diff.extraInPrimary.length === 0,\n orderedMatch,\n primary: primary.quads,\n rdf3x: rdf3x.quads,\n diff: {\n missingFromRdf3x: diff.extraInPrimary,\n extraInRdf3x: diff.missingFromPrimary,\n },\n primaryMetrics: primary.metrics,\n rdf3xMetrics: rdf3x.metrics,\n rebuild,\n };\n }\n\n public shadowRdf3xJoin(\n patterns: RdfQuadJoinPattern[],\n options?: RdfQuadJoinOptions,\n ): Rdf3xShadowJoinResult {\n const rdf3xIndex = this.requireRdf3xIndex();\n const rebuild = rdf3xIndex.rebuildFromCurrentQuads();\n const primary = this.index.joinPatterns(patterns, options);\n const rdf3x = rdf3xIndex.joinPatterns(patterns, options);\n const primaryKeys = primary.bindings.map(canonicalBindingKey);\n const rdf3xKeys = rdf3x.bindings.map(canonicalBindingKey);\n const diff = diffBindingKeys(rdf3xKeys, primaryKeys);\n return {\n matched: diff.missingFromRdf3x.length === 0 && diff.extraInRdf3x.length === 0,\n orderedMatch: primaryKeys.join('\\n') === rdf3xKeys.join('\\n'),\n primary: primary.bindings,\n rdf3x: rdf3x.bindings,\n diff,\n primaryMetrics: primary.metrics,\n rdf3xMetrics: rdf3x.metrics,\n rebuild,\n };\n }\n\n public supportsPrimary(query: RdfPatternQuery): boolean {\n try {\n this.index.scan(query.pattern, { ...query.options, limit: 0 });\n return true;\n } catch {\n return false;\n }\n }\n\n private requireTextIndex(): RdfTextIndex {\n if (!this.textIndex) {\n throw new Error('SolidRdfEngine text index is not configured');\n }\n return this.textIndex;\n }\n\n private requireVectorIndex(): RdfVectorIndex {\n if (!this.vectorIndex) {\n throw new Error('SolidRdfEngine vector index is not configured');\n }\n return this.vectorIndex;\n }\n\n private requireRdf3xIndex(): Rdf3xTripleIndex {\n if (!this.rdf3xIndex) {\n throw new Error('SolidRdfEngine RDF-3X shadow index is not configured');\n }\n return this.rdf3xIndex;\n }\n}\n\nfunction isRdfTextIndexOptions(input: RdfTextIndex | RdfTextIndexOptions | undefined): input is RdfTextIndexOptions {\n return input !== undefined && !(input instanceof RdfTextIndex) && typeof input.path === 'string';\n}\n\nfunction isRdfVectorIndexOptions(input: RdfVectorIndex | RdfVectorIndexOptions | undefined): input is RdfVectorIndexOptions {\n return input !== undefined && !(input instanceof RdfVectorIndex) && typeof input.path === 'string';\n}\n\nfunction isRdf3xTripleIndexOptions(input: Rdf3xTripleIndex | Rdf3xTripleIndexOptions | undefined): input is Rdf3xTripleIndexOptions {\n return input !== undefined && !(input instanceof Rdf3xTripleIndex) && typeof input.path === 'string';\n}\n\nfunction canonicalQuadKeys(quads: Quad[]): string[] {\n return quads.map((quad) => [\n termToId(quad.graph as any),\n termToId(quad.subject as any),\n termToId(quad.predicate as any),\n termToId(quad.object as any),\n ].join('\\u001f'));\n}\n\nfunction canonicalBindingKey(binding: Record<string, unknown>): string {\n return Object.keys(binding)\n .sort()\n .map((key) => `${key}=${termToId(binding[key] as any)}`)\n .join('\\u001f');\n}\n\nfunction diffBindingKeys(\n rdf3xKeys: string[],\n primaryKeys: string[],\n): Rdf3xShadowJoinResult['diff'] {\n const rdf3xSet = new Set(rdf3xKeys);\n const primarySet = new Set(primaryKeys);\n return {\n missingFromRdf3x: Array.from(primarySet).filter((key) => !rdf3xSet.has(key)).sort(),\n extraInRdf3x: Array.from(rdf3xSet).filter((key) => !primarySet.has(key)).sort(),\n };\n}\n\nfunction toRdf3xTriplePattern(pattern: QuintPattern): Rdf3xTriplePattern {\n const result: Rdf3xTriplePattern = {};\n for (const key of ['graph', 'subject', 'predicate', 'object'] as const) {\n const value = pattern[key];\n if (!value) {\n continue;\n }\n if (!isTerm(value)) {\n if (key === 'graph' && isStartsWithOperator(value)) {\n result.graph = { $startsWith: value.$startsWith };\n continue;\n }\n if (key === 'object' && isNumericObjectRangeOperator(value)) {\n result.object = value;\n continue;\n }\n throw new Error(`SolidRdfEngine RDF-3X shadow scan only supports exact ${key} terms${key === 'graph' ? ' or graph $startsWith' : ''}`);\n }\n result[key] = value;\n }\n return result;\n}\n\nfunction isStartsWithOperator(value: unknown): value is { $startsWith: string } {\n return value !== null\n && typeof value === 'object'\n && '$startsWith' in value\n && typeof (value as { $startsWith?: unknown }).$startsWith === 'string';\n}\n\nfunction isNumericObjectRangeOperator(value: unknown): value is Rdf3xNumericObjectRangePattern {\n return value !== null\n && typeof value === 'object'\n && !('termType' in value)\n && ['$gt', '$gte', '$lt', '$lte'].some((operator) => operator in value);\n}\n"]}