@enbox/dwn-sdk-js 0.4.0 → 0.4.1

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 (513) hide show
  1. package/README.md +4 -4
  2. package/dist/browser.mjs +8 -8
  3. package/dist/browser.mjs.map +4 -4
  4. package/dist/esm/generated/precompiled-validators.js +799 -885
  5. package/dist/esm/generated/precompiled-validators.js.map +1 -1
  6. package/dist/esm/src/core/dwn-constant.js +5 -0
  7. package/dist/esm/src/core/dwn-constant.js.map +1 -1
  8. package/dist/esm/src/core/dwn-error.js +12 -4
  9. package/dist/esm/src/core/dwn-error.js.map +1 -1
  10. package/dist/esm/src/core/grant-authorization.js +9 -18
  11. package/dist/esm/src/core/grant-authorization.js.map +1 -1
  12. package/dist/esm/src/core/message-reply.js.map +1 -1
  13. package/dist/esm/src/core/messages-grant-authorization.js +28 -45
  14. package/dist/esm/src/core/messages-grant-authorization.js.map +1 -1
  15. package/dist/esm/src/core/protocol-authorization-action.js +25 -27
  16. package/dist/esm/src/core/protocol-authorization-action.js.map +1 -1
  17. package/dist/esm/src/core/protocol-authorization-validation.js +30 -68
  18. package/dist/esm/src/core/protocol-authorization-validation.js.map +1 -1
  19. package/dist/esm/src/core/protocol-authorization.js +44 -118
  20. package/dist/esm/src/core/protocol-authorization.js.map +1 -1
  21. package/dist/esm/src/core/protocols-grant-authorization.js +5 -5
  22. package/dist/esm/src/core/protocols-grant-authorization.js.map +1 -1
  23. package/dist/esm/src/core/recording-validation-state-reader.js +84 -0
  24. package/dist/esm/src/core/recording-validation-state-reader.js.map +1 -0
  25. package/dist/esm/src/core/records-grant-authorization.js +11 -11
  26. package/dist/esm/src/core/records-grant-authorization.js.map +1 -1
  27. package/dist/esm/src/core/replication-apply.js +123 -28
  28. package/dist/esm/src/core/replication-apply.js.map +1 -1
  29. package/dist/esm/src/core/resumable-task-manager.js +5 -4
  30. package/dist/esm/src/core/resumable-task-manager.js.map +1 -1
  31. package/dist/esm/src/core/validation-state-reader.js +237 -0
  32. package/dist/esm/src/core/validation-state-reader.js.map +1 -0
  33. package/dist/esm/src/dwn.js +165 -132
  34. package/dist/esm/src/dwn.js.map +1 -1
  35. package/dist/esm/src/enums/dwn-interface-method.js +0 -1
  36. package/dist/esm/src/enums/dwn-interface-method.js.map +1 -1
  37. package/dist/esm/src/event-stream/durable-event-log.js +365 -0
  38. package/dist/esm/src/event-stream/durable-event-log.js.map +1 -0
  39. package/dist/esm/src/event-stream/event-emitter-wake-publisher.js +25 -0
  40. package/dist/esm/src/event-stream/event-emitter-wake-publisher.js.map +1 -0
  41. package/dist/esm/src/handlers/messages-query.js +159 -0
  42. package/dist/esm/src/handlers/messages-query.js.map +1 -0
  43. package/dist/esm/src/handlers/messages-read.js +5 -5
  44. package/dist/esm/src/handlers/messages-read.js.map +1 -1
  45. package/dist/esm/src/handlers/messages-subscribe.js +8 -8
  46. package/dist/esm/src/handlers/messages-subscribe.js.map +1 -1
  47. package/dist/esm/src/handlers/protocols-configure.js +30 -49
  48. package/dist/esm/src/handlers/protocols-configure.js.map +1 -1
  49. package/dist/esm/src/handlers/protocols-query.js +1 -1
  50. package/dist/esm/src/handlers/protocols-query.js.map +1 -1
  51. package/dist/esm/src/handlers/records-count.js +20 -11
  52. package/dist/esm/src/handlers/records-count.js.map +1 -1
  53. package/dist/esm/src/handlers/records-delete.js +20 -16
  54. package/dist/esm/src/handlers/records-delete.js.map +1 -1
  55. package/dist/esm/src/handlers/records-query.js +35 -11
  56. package/dist/esm/src/handlers/records-query.js.map +1 -1
  57. package/dist/esm/src/handlers/records-read.js +52 -42
  58. package/dist/esm/src/handlers/records-read.js.map +1 -1
  59. package/dist/esm/src/handlers/records-subscribe.js +107 -11
  60. package/dist/esm/src/handlers/records-subscribe.js.map +1 -1
  61. package/dist/esm/src/handlers/records-write.js +62 -116
  62. package/dist/esm/src/handlers/records-write.js.map +1 -1
  63. package/dist/esm/src/index.js +6 -7
  64. package/dist/esm/src/index.js.map +1 -1
  65. package/dist/esm/src/interfaces/{messages-sync.js → messages-query.js} +21 -15
  66. package/dist/esm/src/interfaces/messages-query.js.map +1 -0
  67. package/dist/esm/src/interfaces/protocols-configure.js +7 -3
  68. package/dist/esm/src/interfaces/protocols-configure.js.map +1 -1
  69. package/dist/esm/src/interfaces/protocols-query.js +3 -4
  70. package/dist/esm/src/interfaces/protocols-query.js.map +1 -1
  71. package/dist/esm/src/interfaces/records-count.js +4 -3
  72. package/dist/esm/src/interfaces/records-count.js.map +1 -1
  73. package/dist/esm/src/interfaces/records-delete.js +21 -4
  74. package/dist/esm/src/interfaces/records-delete.js.map +1 -1
  75. package/dist/esm/src/interfaces/records-query.js +4 -3
  76. package/dist/esm/src/interfaces/records-query.js.map +1 -1
  77. package/dist/esm/src/interfaces/records-read.js +3 -3
  78. package/dist/esm/src/interfaces/records-read.js.map +1 -1
  79. package/dist/esm/src/interfaces/records-subscribe.js +4 -3
  80. package/dist/esm/src/interfaces/records-subscribe.js.map +1 -1
  81. package/dist/esm/src/interfaces/records-write.js +27 -13
  82. package/dist/esm/src/interfaces/records-write.js.map +1 -1
  83. package/dist/esm/src/protocols/permissions.js +27 -34
  84. package/dist/esm/src/protocols/permissions.js.map +1 -1
  85. package/dist/esm/src/store/index-level.js +24 -9
  86. package/dist/esm/src/store/index-level.js.map +1 -1
  87. package/dist/esm/src/store/level-wrapper.js +7 -0
  88. package/dist/esm/src/store/level-wrapper.js.map +1 -1
  89. package/dist/esm/src/store/message-store-level.js +536 -42
  90. package/dist/esm/src/store/message-store-level.js.map +1 -1
  91. package/dist/esm/src/store/storage-controller.js +58 -49
  92. package/dist/esm/src/store/storage-controller.js.map +1 -1
  93. package/dist/esm/src/types/message-types.js.map +1 -1
  94. package/dist/esm/src/types/validation-state-reader.js +2 -0
  95. package/dist/esm/src/types/validation-state-reader.js.map +1 -0
  96. package/dist/esm/src/utils/messages.js +17 -0
  97. package/dist/esm/src/utils/messages.js.map +1 -1
  98. package/dist/esm/src/utils/record-limit-occupancy.js +244 -0
  99. package/dist/esm/src/utils/record-limit-occupancy.js.map +1 -0
  100. package/dist/esm/src/utils/records.js +50 -14
  101. package/dist/esm/src/utils/records.js.map +1 -1
  102. package/dist/esm/src/utils/replication.js +85 -0
  103. package/dist/esm/src/utils/replication.js.map +1 -0
  104. package/dist/esm/tests/core/grant-authorization.spec.js +4 -4
  105. package/dist/esm/tests/core/grant-authorization.spec.js.map +1 -1
  106. package/dist/esm/tests/core/process-message-parity.spec.js +222 -0
  107. package/dist/esm/tests/core/process-message-parity.spec.js.map +1 -0
  108. package/dist/esm/tests/core/protocol-authorization.spec.js +5 -2
  109. package/dist/esm/tests/core/protocol-authorization.spec.js.map +1 -1
  110. package/dist/esm/tests/core/records-grant-authorization.spec.js +5 -5
  111. package/dist/esm/tests/core/records-grant-authorization.spec.js.map +1 -1
  112. package/dist/esm/tests/core/replication-apply.spec.js +55 -1
  113. package/dist/esm/tests/core/replication-apply.spec.js.map +1 -1
  114. package/dist/esm/tests/core/replication-replay-property.spec.js +350 -0
  115. package/dist/esm/tests/core/replication-replay-property.spec.js.map +1 -0
  116. package/dist/esm/tests/core/validation-read-closure.spec.js +469 -0
  117. package/dist/esm/tests/core/validation-read-closure.spec.js.map +1 -0
  118. package/dist/esm/tests/core/validation-state-reader.spec.js +716 -0
  119. package/dist/esm/tests/core/validation-state-reader.spec.js.map +1 -0
  120. package/dist/esm/tests/durable-event-log.spec.js +373 -0
  121. package/dist/esm/tests/durable-event-log.spec.js.map +1 -0
  122. package/dist/esm/tests/dwn.spec.js +504 -35
  123. package/dist/esm/tests/dwn.spec.js.map +1 -1
  124. package/dist/esm/tests/features/author-delegated-grant.spec.js +9 -6
  125. package/dist/esm/tests/features/author-delegated-grant.spec.js.map +1 -1
  126. package/dist/esm/tests/features/owner-delegated-grant.spec.js +1 -4
  127. package/dist/esm/tests/features/owner-delegated-grant.spec.js.map +1 -1
  128. package/dist/esm/tests/features/owner-signature.spec.js +1 -4
  129. package/dist/esm/tests/features/owner-signature.spec.js.map +1 -1
  130. package/dist/esm/tests/features/permissions.spec.js +165 -4
  131. package/dist/esm/tests/features/permissions.spec.js.map +1 -1
  132. package/dist/esm/tests/features/protocol-composition.spec.js +8 -11
  133. package/dist/esm/tests/features/protocol-composition.spec.js.map +1 -1
  134. package/dist/esm/tests/features/protocol-create-action.spec.js +1 -4
  135. package/dist/esm/tests/features/protocol-create-action.spec.js.map +1 -1
  136. package/dist/esm/tests/features/protocol-delete-action.spec.js +3 -5
  137. package/dist/esm/tests/features/protocol-delete-action.spec.js.map +1 -1
  138. package/dist/esm/tests/features/protocol-update-action.spec.js +3 -6
  139. package/dist/esm/tests/features/protocol-update-action.spec.js.map +1 -1
  140. package/dist/esm/tests/features/records-delivery.spec.js +1 -4
  141. package/dist/esm/tests/features/records-delivery.spec.js.map +1 -1
  142. package/dist/esm/tests/features/records-immutable.spec.js +1 -4
  143. package/dist/esm/tests/features/records-immutable.spec.js.map +1 -1
  144. package/dist/esm/tests/features/records-nested-query-scope.spec.js +281 -0
  145. package/dist/esm/tests/features/records-nested-query-scope.spec.js.map +1 -0
  146. package/dist/esm/tests/features/records-prune-cross-protocol.spec.js +3 -7
  147. package/dist/esm/tests/features/records-prune-cross-protocol.spec.js.map +1 -1
  148. package/dist/esm/tests/features/records-prune.spec.js +11 -22
  149. package/dist/esm/tests/features/records-prune.spec.js.map +1 -1
  150. package/dist/esm/tests/features/records-record-limit.spec.js +441 -231
  151. package/dist/esm/tests/features/records-record-limit.spec.js.map +1 -1
  152. package/dist/esm/tests/features/records-squash.spec.js +6 -4
  153. package/dist/esm/tests/features/records-squash.spec.js.map +1 -1
  154. package/dist/esm/tests/features/records-tags.spec.js +1 -4
  155. package/dist/esm/tests/features/records-tags.spec.js.map +1 -1
  156. package/dist/esm/tests/features/resumable-tasks.spec.js +3 -5
  157. package/dist/esm/tests/features/resumable-tasks.spec.js.map +1 -1
  158. package/dist/esm/tests/fuzz/message-store.fuzz.spec.js +1 -2
  159. package/dist/esm/tests/fuzz/message-store.fuzz.spec.js.map +1 -1
  160. package/dist/esm/tests/fuzz/process-message.fuzz.spec.js +2 -4
  161. package/dist/esm/tests/fuzz/process-message.fuzz.spec.js.map +1 -1
  162. package/dist/esm/tests/fuzz/schema-validation.fuzz.spec.js +1 -1
  163. package/dist/esm/tests/fuzz/schema-validation.fuzz.spec.js.map +1 -1
  164. package/dist/esm/tests/handlers/messages-query.spec.js +246 -0
  165. package/dist/esm/tests/handlers/messages-query.spec.js.map +1 -0
  166. package/dist/esm/tests/handlers/messages-read.spec.js +2 -5
  167. package/dist/esm/tests/handlers/messages-read.spec.js.map +1 -1
  168. package/dist/esm/tests/handlers/messages-subscribe.spec.js +3 -14
  169. package/dist/esm/tests/handlers/messages-subscribe.spec.js.map +1 -1
  170. package/dist/esm/tests/handlers/protocols-configure.spec.js +27 -26
  171. package/dist/esm/tests/handlers/protocols-configure.spec.js.map +1 -1
  172. package/dist/esm/tests/handlers/protocols-query.spec.js +1 -4
  173. package/dist/esm/tests/handlers/protocols-query.spec.js.map +1 -1
  174. package/dist/esm/tests/handlers/records-count.spec.js +1 -4
  175. package/dist/esm/tests/handlers/records-count.spec.js.map +1 -1
  176. package/dist/esm/tests/handlers/records-delete.spec.js +312 -30
  177. package/dist/esm/tests/handlers/records-delete.spec.js.map +1 -1
  178. package/dist/esm/tests/handlers/records-query.spec.js +32 -9
  179. package/dist/esm/tests/handlers/records-query.spec.js.map +1 -1
  180. package/dist/esm/tests/handlers/records-read.spec.js +4 -4
  181. package/dist/esm/tests/handlers/records-read.spec.js.map +1 -1
  182. package/dist/esm/tests/handlers/records-subscribe.spec.js +33 -14
  183. package/dist/esm/tests/handlers/records-subscribe.spec.js.map +1 -1
  184. package/dist/esm/tests/handlers/records-write.spec.js +82 -36
  185. package/dist/esm/tests/handlers/records-write.spec.js.map +1 -1
  186. package/dist/esm/tests/interfaces/records-delete.spec.js +69 -2
  187. package/dist/esm/tests/interfaces/records-delete.spec.js.map +1 -1
  188. package/dist/esm/tests/interfaces/records-write.spec.js +4 -3
  189. package/dist/esm/tests/interfaces/records-write.spec.js.map +1 -1
  190. package/dist/esm/tests/protocols/permissions.spec.js +55 -6
  191. package/dist/esm/tests/protocols/permissions.spec.js.map +1 -1
  192. package/dist/esm/tests/scenarios/aggregator.spec.js +1 -4
  193. package/dist/esm/tests/scenarios/aggregator.spec.js.map +1 -1
  194. package/dist/esm/tests/scenarios/deleted-record.spec.js +1 -4
  195. package/dist/esm/tests/scenarios/deleted-record.spec.js.map +1 -1
  196. package/dist/esm/tests/scenarios/end-to-end-tests.spec.js +1 -4
  197. package/dist/esm/tests/scenarios/end-to-end-tests.spec.js.map +1 -1
  198. package/dist/esm/tests/scenarios/nested-roles.spec.js +1 -4
  199. package/dist/esm/tests/scenarios/nested-roles.spec.js.map +1 -1
  200. package/dist/esm/tests/scenarios/subscriptions.spec.js +1 -4
  201. package/dist/esm/tests/scenarios/subscriptions.spec.js.map +1 -1
  202. package/dist/esm/tests/store/message-store-level.spec.js +361 -5
  203. package/dist/esm/tests/store/message-store-level.spec.js.map +1 -1
  204. package/dist/esm/tests/store/message-store.spec.js +60 -0
  205. package/dist/esm/tests/store/message-store.spec.js.map +1 -1
  206. package/dist/esm/tests/test-event-stream.js +7 -3
  207. package/dist/esm/tests/test-event-stream.js.map +1 -1
  208. package/dist/esm/tests/test-stores.js +19 -9
  209. package/dist/esm/tests/test-stores.js.map +1 -1
  210. package/dist/esm/tests/test-suite.js +4 -2
  211. package/dist/esm/tests/test-suite.js.map +1 -1
  212. package/dist/esm/tests/utils/test-data-generator.js +25 -0
  213. package/dist/esm/tests/utils/test-data-generator.js.map +1 -1
  214. package/dist/esm/tests/utils/test-stub-generator.js.map +1 -1
  215. package/dist/esm/tests/utils/test-validation-state-reader.js +16 -0
  216. package/dist/esm/tests/utils/test-validation-state-reader.js.map +1 -0
  217. package/dist/types/generated/precompiled-validators.d.ts +6 -6
  218. package/dist/types/generated/precompiled-validators.d.ts.map +1 -1
  219. package/dist/types/src/core/core-protocol.d.ts +3 -3
  220. package/dist/types/src/core/core-protocol.d.ts.map +1 -1
  221. package/dist/types/src/core/dwn-constant.d.ts +5 -0
  222. package/dist/types/src/core/dwn-constant.d.ts.map +1 -1
  223. package/dist/types/src/core/dwn-error.d.ts +12 -4
  224. package/dist/types/src/core/dwn-error.d.ts.map +1 -1
  225. package/dist/types/src/core/grant-authorization.d.ts +5 -5
  226. package/dist/types/src/core/grant-authorization.d.ts.map +1 -1
  227. package/dist/types/src/core/message-reply.d.ts +5 -4
  228. package/dist/types/src/core/message-reply.d.ts.map +1 -1
  229. package/dist/types/src/core/messages-grant-authorization.d.ts +12 -14
  230. package/dist/types/src/core/messages-grant-authorization.d.ts.map +1 -1
  231. package/dist/types/src/core/protocol-authorization-action.d.ts +4 -5
  232. package/dist/types/src/core/protocol-authorization-action.d.ts.map +1 -1
  233. package/dist/types/src/core/protocol-authorization-validation.d.ts +13 -16
  234. package/dist/types/src/core/protocol-authorization-validation.d.ts.map +1 -1
  235. package/dist/types/src/core/protocol-authorization.d.ts +8 -33
  236. package/dist/types/src/core/protocol-authorization.d.ts.map +1 -1
  237. package/dist/types/src/core/protocols-grant-authorization.d.ts +4 -4
  238. package/dist/types/src/core/protocols-grant-authorization.d.ts.map +1 -1
  239. package/dist/types/src/core/recording-validation-state-reader.d.ts +75 -0
  240. package/dist/types/src/core/recording-validation-state-reader.d.ts.map +1 -0
  241. package/dist/types/src/core/records-grant-authorization.d.ts +8 -8
  242. package/dist/types/src/core/records-grant-authorization.d.ts.map +1 -1
  243. package/dist/types/src/core/replication-apply.d.ts +36 -0
  244. package/dist/types/src/core/replication-apply.d.ts.map +1 -1
  245. package/dist/types/src/core/resumable-task-manager.d.ts +1 -1
  246. package/dist/types/src/core/resumable-task-manager.d.ts.map +1 -1
  247. package/dist/types/src/core/validation-state-reader.d.ts +79 -0
  248. package/dist/types/src/core/validation-state-reader.d.ts.map +1 -0
  249. package/dist/types/src/dwn.d.ts +33 -20
  250. package/dist/types/src/dwn.d.ts.map +1 -1
  251. package/dist/types/src/enums/dwn-interface-method.d.ts +0 -1
  252. package/dist/types/src/enums/dwn-interface-method.d.ts.map +1 -1
  253. package/dist/types/src/event-stream/durable-event-log.d.ts +69 -0
  254. package/dist/types/src/event-stream/durable-event-log.d.ts.map +1 -0
  255. package/dist/types/src/event-stream/event-emitter-wake-publisher.d.ts +13 -0
  256. package/dist/types/src/event-stream/event-emitter-wake-publisher.d.ts.map +1 -0
  257. package/dist/types/src/handlers/messages-query.d.ts +20 -0
  258. package/dist/types/src/handlers/messages-query.d.ts.map +1 -0
  259. package/dist/types/src/handlers/messages-read.d.ts +1 -1
  260. package/dist/types/src/handlers/messages-read.d.ts.map +1 -1
  261. package/dist/types/src/handlers/messages-subscribe.d.ts.map +1 -1
  262. package/dist/types/src/handlers/protocols-configure.d.ts +0 -5
  263. package/dist/types/src/handlers/protocols-configure.d.ts.map +1 -1
  264. package/dist/types/src/handlers/records-count.d.ts +2 -1
  265. package/dist/types/src/handlers/records-count.d.ts.map +1 -1
  266. package/dist/types/src/handlers/records-delete.d.ts +2 -2
  267. package/dist/types/src/handlers/records-delete.d.ts.map +1 -1
  268. package/dist/types/src/handlers/records-query.d.ts +1 -1
  269. package/dist/types/src/handlers/records-query.d.ts.map +1 -1
  270. package/dist/types/src/handlers/records-read.d.ts +2 -1
  271. package/dist/types/src/handlers/records-read.d.ts.map +1 -1
  272. package/dist/types/src/handlers/records-subscribe.d.ts +4 -5
  273. package/dist/types/src/handlers/records-subscribe.d.ts.map +1 -1
  274. package/dist/types/src/handlers/records-write.d.ts +3 -11
  275. package/dist/types/src/handlers/records-write.d.ts.map +1 -1
  276. package/dist/types/src/index.d.ts +14 -16
  277. package/dist/types/src/index.d.ts.map +1 -1
  278. package/dist/types/src/interfaces/messages-query.d.ts +23 -0
  279. package/dist/types/src/interfaces/messages-query.d.ts.map +1 -0
  280. package/dist/types/src/interfaces/protocols-configure.d.ts +3 -3
  281. package/dist/types/src/interfaces/protocols-configure.d.ts.map +1 -1
  282. package/dist/types/src/interfaces/protocols-query.d.ts +2 -2
  283. package/dist/types/src/interfaces/protocols-query.d.ts.map +1 -1
  284. package/dist/types/src/interfaces/records-count.d.ts +3 -3
  285. package/dist/types/src/interfaces/records-count.d.ts.map +1 -1
  286. package/dist/types/src/interfaces/records-delete.d.ts +11 -3
  287. package/dist/types/src/interfaces/records-delete.d.ts.map +1 -1
  288. package/dist/types/src/interfaces/records-query.d.ts +3 -3
  289. package/dist/types/src/interfaces/records-query.d.ts.map +1 -1
  290. package/dist/types/src/interfaces/records-read.d.ts +3 -3
  291. package/dist/types/src/interfaces/records-read.d.ts.map +1 -1
  292. package/dist/types/src/interfaces/records-subscribe.d.ts +3 -3
  293. package/dist/types/src/interfaces/records-subscribe.d.ts.map +1 -1
  294. package/dist/types/src/interfaces/records-write.d.ts +15 -7
  295. package/dist/types/src/interfaces/records-write.d.ts.map +1 -1
  296. package/dist/types/src/protocols/permissions.d.ts +9 -12
  297. package/dist/types/src/protocols/permissions.d.ts.map +1 -1
  298. package/dist/types/src/store/index-level.d.ts +10 -1
  299. package/dist/types/src/store/index-level.d.ts.map +1 -1
  300. package/dist/types/src/store/level-wrapper.d.ts +5 -0
  301. package/dist/types/src/store/level-wrapper.d.ts.map +1 -1
  302. package/dist/types/src/store/message-store-level.d.ts +94 -14
  303. package/dist/types/src/store/message-store-level.d.ts.map +1 -1
  304. package/dist/types/src/store/storage-controller.d.ts +17 -14
  305. package/dist/types/src/store/storage-controller.d.ts.map +1 -1
  306. package/dist/types/src/types/message-store.d.ts +29 -1
  307. package/dist/types/src/types/message-store.d.ts.map +1 -1
  308. package/dist/types/src/types/message-types.d.ts +2 -0
  309. package/dist/types/src/types/message-types.d.ts.map +1 -1
  310. package/dist/types/src/types/messages-types.d.ts +21 -37
  311. package/dist/types/src/types/messages-types.d.ts.map +1 -1
  312. package/dist/types/src/types/method-handler.d.ts +2 -2
  313. package/dist/types/src/types/method-handler.d.ts.map +1 -1
  314. package/dist/types/src/types/permission-types.d.ts +1 -1
  315. package/dist/types/src/types/subscriptions.d.ts +50 -39
  316. package/dist/types/src/types/subscriptions.d.ts.map +1 -1
  317. package/dist/types/src/types/validation-state-reader.d.ts +116 -0
  318. package/dist/types/src/types/validation-state-reader.d.ts.map +1 -0
  319. package/dist/types/src/utils/messages.d.ts +10 -0
  320. package/dist/types/src/utils/messages.d.ts.map +1 -1
  321. package/dist/types/src/utils/record-limit-occupancy.d.ts +40 -0
  322. package/dist/types/src/utils/record-limit-occupancy.d.ts.map +1 -0
  323. package/dist/types/src/utils/records.d.ts +25 -3
  324. package/dist/types/src/utils/records.d.ts.map +1 -1
  325. package/dist/types/src/utils/replication.d.ts +22 -0
  326. package/dist/types/src/utils/replication.d.ts.map +1 -0
  327. package/dist/types/tests/core/process-message-parity.spec.d.ts +2 -0
  328. package/dist/types/tests/core/process-message-parity.spec.d.ts.map +1 -0
  329. package/dist/types/tests/core/replication-replay-property.spec.d.ts +2 -0
  330. package/dist/types/tests/core/replication-replay-property.spec.d.ts.map +1 -0
  331. package/dist/types/tests/core/validation-read-closure.spec.d.ts +2 -0
  332. package/dist/types/tests/core/validation-read-closure.spec.d.ts.map +1 -0
  333. package/dist/types/tests/core/validation-state-reader.spec.d.ts +2 -0
  334. package/dist/types/tests/core/validation-state-reader.spec.d.ts.map +1 -0
  335. package/dist/types/tests/durable-event-log.spec.d.ts +2 -0
  336. package/dist/types/tests/durable-event-log.spec.d.ts.map +1 -0
  337. package/dist/types/tests/dwn.spec.d.ts.map +1 -1
  338. package/dist/types/tests/features/author-delegated-grant.spec.d.ts.map +1 -1
  339. package/dist/types/tests/features/owner-delegated-grant.spec.d.ts.map +1 -1
  340. package/dist/types/tests/features/owner-signature.spec.d.ts.map +1 -1
  341. package/dist/types/tests/features/permissions.spec.d.ts.map +1 -1
  342. package/dist/types/tests/features/protocol-composition.spec.d.ts.map +1 -1
  343. package/dist/types/tests/features/protocol-create-action.spec.d.ts.map +1 -1
  344. package/dist/types/tests/features/protocol-delete-action.spec.d.ts.map +1 -1
  345. package/dist/types/tests/features/protocol-update-action.spec.d.ts.map +1 -1
  346. package/dist/types/tests/features/records-delivery.spec.d.ts.map +1 -1
  347. package/dist/types/tests/features/records-immutable.spec.d.ts.map +1 -1
  348. package/dist/types/tests/features/records-nested-query-scope.spec.d.ts +2 -0
  349. package/dist/types/tests/features/records-nested-query-scope.spec.d.ts.map +1 -0
  350. package/dist/types/tests/features/records-prune-cross-protocol.spec.d.ts.map +1 -1
  351. package/dist/types/tests/features/records-prune.spec.d.ts.map +1 -1
  352. package/dist/types/tests/features/records-record-limit.spec.d.ts.map +1 -1
  353. package/dist/types/tests/features/records-squash.spec.d.ts.map +1 -1
  354. package/dist/types/tests/features/records-tags.spec.d.ts.map +1 -1
  355. package/dist/types/tests/features/resumable-tasks.spec.d.ts.map +1 -1
  356. package/dist/types/tests/handlers/messages-query.spec.d.ts +2 -0
  357. package/dist/types/tests/handlers/messages-query.spec.d.ts.map +1 -0
  358. package/dist/types/tests/handlers/messages-read.spec.d.ts.map +1 -1
  359. package/dist/types/tests/handlers/messages-subscribe.spec.d.ts.map +1 -1
  360. package/dist/types/tests/handlers/protocols-configure.spec.d.ts.map +1 -1
  361. package/dist/types/tests/handlers/protocols-query.spec.d.ts.map +1 -1
  362. package/dist/types/tests/handlers/records-count.spec.d.ts.map +1 -1
  363. package/dist/types/tests/handlers/records-delete.spec.d.ts.map +1 -1
  364. package/dist/types/tests/handlers/records-query.spec.d.ts.map +1 -1
  365. package/dist/types/tests/handlers/records-read.spec.d.ts.map +1 -1
  366. package/dist/types/tests/handlers/records-subscribe.spec.d.ts.map +1 -1
  367. package/dist/types/tests/handlers/records-write.spec.d.ts.map +1 -1
  368. package/dist/types/tests/scenarios/deleted-record.spec.d.ts.map +1 -1
  369. package/dist/types/tests/scenarios/end-to-end-tests.spec.d.ts.map +1 -1
  370. package/dist/types/tests/scenarios/nested-roles.spec.d.ts.map +1 -1
  371. package/dist/types/tests/scenarios/subscriptions.spec.d.ts.map +1 -1
  372. package/dist/types/tests/store/message-store.spec.d.ts.map +1 -1
  373. package/dist/types/tests/test-event-stream.d.ts +1 -1
  374. package/dist/types/tests/test-event-stream.d.ts.map +1 -1
  375. package/dist/types/tests/test-stores.d.ts +5 -4
  376. package/dist/types/tests/test-stores.d.ts.map +1 -1
  377. package/dist/types/tests/test-suite.d.ts +1 -2
  378. package/dist/types/tests/test-suite.d.ts.map +1 -1
  379. package/dist/types/tests/utils/test-data-generator.d.ts +20 -1
  380. package/dist/types/tests/utils/test-data-generator.d.ts.map +1 -1
  381. package/dist/types/tests/utils/test-validation-state-reader.d.ts +15 -0
  382. package/dist/types/tests/utils/test-validation-state-reader.d.ts.map +1 -0
  383. package/package.json +2 -2
  384. package/src/core/core-protocol.ts +3 -3
  385. package/src/core/dwn-constant.ts +7 -1
  386. package/src/core/dwn-error.ts +12 -4
  387. package/src/core/grant-authorization.ts +11 -20
  388. package/src/core/message-reply.ts +6 -5
  389. package/src/core/messages-grant-authorization.ts +37 -70
  390. package/src/core/protocol-authorization-action.ts +29 -38
  391. package/src/core/protocol-authorization-validation.ts +39 -96
  392. package/src/core/protocol-authorization.ts +56 -202
  393. package/src/core/protocols-grant-authorization.ts +9 -9
  394. package/src/core/recording-validation-state-reader.ts +130 -0
  395. package/src/core/records-grant-authorization.ts +16 -16
  396. package/src/core/replication-apply.ts +172 -32
  397. package/src/core/resumable-task-manager.ts +10 -8
  398. package/src/core/validation-state-reader.ts +350 -0
  399. package/src/dwn.ts +285 -192
  400. package/src/enums/dwn-interface-method.ts +0 -1
  401. package/src/event-stream/durable-event-log.ts +509 -0
  402. package/src/event-stream/event-emitter-wake-publisher.ts +34 -0
  403. package/src/handlers/messages-query.ts +203 -0
  404. package/src/handlers/messages-read.ts +9 -10
  405. package/src/handlers/messages-subscribe.ts +12 -13
  406. package/src/handlers/protocols-configure.ts +37 -58
  407. package/src/handlers/protocols-query.ts +1 -1
  408. package/src/handlers/records-count.ts +24 -17
  409. package/src/handlers/records-delete.ts +29 -27
  410. package/src/handlers/records-query.ts +38 -17
  411. package/src/handlers/records-read.ts +63 -50
  412. package/src/handlers/records-subscribe.ts +132 -19
  413. package/src/handlers/records-write.ts +77 -168
  414. package/src/index.ts +14 -17
  415. package/src/interfaces/messages-query.ts +70 -0
  416. package/src/interfaces/protocols-configure.ts +12 -4
  417. package/src/interfaces/protocols-query.ts +4 -5
  418. package/src/interfaces/records-count.ts +9 -4
  419. package/src/interfaces/records-delete.ts +25 -5
  420. package/src/interfaces/records-query.ts +9 -4
  421. package/src/interfaces/records-read.ts +4 -4
  422. package/src/interfaces/records-subscribe.ts +9 -4
  423. package/src/interfaces/records-write.ts +41 -13
  424. package/src/protocols/permissions.ts +32 -52
  425. package/src/store/index-level.ts +30 -9
  426. package/src/store/level-wrapper.ts +9 -1
  427. package/src/store/message-store-level.ts +757 -47
  428. package/src/store/storage-controller.ts +74 -63
  429. package/src/types/message-store.ts +45 -2
  430. package/src/types/message-types.ts +3 -1
  431. package/src/types/messages-types.ts +26 -45
  432. package/src/types/method-handler.ts +3 -3
  433. package/src/types/permission-types.ts +1 -1
  434. package/src/types/subscriptions.ts +53 -42
  435. package/src/types/validation-state-reader.ts +127 -0
  436. package/src/utils/messages.ts +25 -1
  437. package/src/utils/record-limit-occupancy.ts +377 -0
  438. package/src/utils/records.ts +69 -13
  439. package/src/utils/replication.ts +122 -0
  440. package/dist/esm/src/core/record-chain.js +0 -64
  441. package/dist/esm/src/core/record-chain.js.map +0 -1
  442. package/dist/esm/src/event-stream/event-emitter-event-log.js +0 -334
  443. package/dist/esm/src/event-stream/event-emitter-event-log.js.map +0 -1
  444. package/dist/esm/src/handlers/messages-sync.js +0 -278
  445. package/dist/esm/src/handlers/messages-sync.js.map +0 -1
  446. package/dist/esm/src/interfaces/messages-sync.js.map +0 -1
  447. package/dist/esm/src/smt/smt-store-level.js +0 -103
  448. package/dist/esm/src/smt/smt-store-level.js.map +0 -1
  449. package/dist/esm/src/smt/smt-store-memory.js +0 -41
  450. package/dist/esm/src/smt/smt-store-memory.js.map +0 -1
  451. package/dist/esm/src/smt/smt-utils.js +0 -129
  452. package/dist/esm/src/smt/smt-utils.js.map +0 -1
  453. package/dist/esm/src/smt/sparse-merkle-tree.js +0 -577
  454. package/dist/esm/src/smt/sparse-merkle-tree.js.map +0 -1
  455. package/dist/esm/src/state-index/state-index-level.js +0 -191
  456. package/dist/esm/src/state-index/state-index-level.js.map +0 -1
  457. package/dist/esm/src/types/smt-types.js +0 -5
  458. package/dist/esm/src/types/smt-types.js.map +0 -1
  459. package/dist/esm/src/types/state-index.js +0 -2
  460. package/dist/esm/src/types/state-index.js.map +0 -1
  461. package/dist/esm/tests/event-emitter-event-log.spec.js +0 -499
  462. package/dist/esm/tests/event-emitter-event-log.spec.js.map +0 -1
  463. package/dist/esm/tests/handlers/messages-sync.spec.js +0 -1088
  464. package/dist/esm/tests/handlers/messages-sync.spec.js.map +0 -1
  465. package/dist/esm/tests/smt/smt-store-level.spec.js +0 -132
  466. package/dist/esm/tests/smt/smt-store-level.spec.js.map +0 -1
  467. package/dist/esm/tests/smt/sparse-merkle-tree.spec.js +0 -732
  468. package/dist/esm/tests/smt/sparse-merkle-tree.spec.js.map +0 -1
  469. package/dist/esm/tests/state-index/state-index-level.spec.js +0 -245
  470. package/dist/esm/tests/state-index/state-index-level.spec.js.map +0 -1
  471. package/dist/types/src/core/record-chain.d.ts +0 -24
  472. package/dist/types/src/core/record-chain.d.ts.map +0 -1
  473. package/dist/types/src/event-stream/event-emitter-event-log.d.ts +0 -80
  474. package/dist/types/src/event-stream/event-emitter-event-log.d.ts.map +0 -1
  475. package/dist/types/src/handlers/messages-sync.d.ts +0 -39
  476. package/dist/types/src/handlers/messages-sync.d.ts.map +0 -1
  477. package/dist/types/src/interfaces/messages-sync.d.ts +0 -20
  478. package/dist/types/src/interfaces/messages-sync.d.ts.map +0 -1
  479. package/dist/types/src/smt/smt-store-level.d.ts +0 -32
  480. package/dist/types/src/smt/smt-store-level.d.ts.map +0 -1
  481. package/dist/types/src/smt/smt-store-memory.d.ts +0 -22
  482. package/dist/types/src/smt/smt-store-memory.d.ts.map +0 -1
  483. package/dist/types/src/smt/smt-utils.d.ts +0 -58
  484. package/dist/types/src/smt/smt-utils.d.ts.map +0 -1
  485. package/dist/types/src/smt/sparse-merkle-tree.d.ts +0 -124
  486. package/dist/types/src/smt/sparse-merkle-tree.d.ts.map +0 -1
  487. package/dist/types/src/state-index/state-index-level.d.ts +0 -83
  488. package/dist/types/src/state-index/state-index-level.d.ts.map +0 -1
  489. package/dist/types/src/types/smt-types.d.ts +0 -81
  490. package/dist/types/src/types/smt-types.d.ts.map +0 -1
  491. package/dist/types/src/types/state-index.d.ts +0 -90
  492. package/dist/types/src/types/state-index.d.ts.map +0 -1
  493. package/dist/types/tests/event-emitter-event-log.spec.d.ts +0 -2
  494. package/dist/types/tests/event-emitter-event-log.spec.d.ts.map +0 -1
  495. package/dist/types/tests/handlers/messages-sync.spec.d.ts +0 -2
  496. package/dist/types/tests/handlers/messages-sync.spec.d.ts.map +0 -1
  497. package/dist/types/tests/smt/smt-store-level.spec.d.ts +0 -2
  498. package/dist/types/tests/smt/smt-store-level.spec.d.ts.map +0 -1
  499. package/dist/types/tests/smt/sparse-merkle-tree.spec.d.ts +0 -2
  500. package/dist/types/tests/smt/sparse-merkle-tree.spec.d.ts.map +0 -1
  501. package/dist/types/tests/state-index/state-index-level.spec.d.ts +0 -2
  502. package/dist/types/tests/state-index/state-index-level.spec.d.ts.map +0 -1
  503. package/src/core/record-chain.ts +0 -99
  504. package/src/event-stream/event-emitter-event-log.ts +0 -430
  505. package/src/handlers/messages-sync.ts +0 -403
  506. package/src/interfaces/messages-sync.ts +0 -69
  507. package/src/smt/smt-store-level.ts +0 -143
  508. package/src/smt/smt-store-memory.ts +0 -53
  509. package/src/smt/smt-utils.ts +0 -149
  510. package/src/smt/sparse-merkle-tree.ts +0 -698
  511. package/src/state-index/state-index-level.ts +0 -239
  512. package/src/types/smt-types.ts +0 -95
  513. package/src/types/state-index.ts +0 -100
@@ -19,7 +19,6 @@ export declare enum DwnErrorCode {
19
19
  EventLogNotOpenError = "EventLogNotOpenError",
20
20
  EventLogProgressGap = "EventLogProgressGap",
21
21
  MessagesGrantAuthorizationMismatchedProtocol = "MessagesGrantAuthorizationMismatchedProtocol",
22
- MessagesGrantAuthorizationProtocolSyncInfrastructureProtocol = "MessagesGrantAuthorizationProtocolSyncInfrastructureProtocol",
23
22
  MessagesGrantAuthorizationSubscribeProtocolMismatch = "MessagesGrantAuthorizationSubscribeProtocolMismatch",
24
23
  MessagesGrantAuthorizationUnfilteredSubscribeProtocolScope = "MessagesGrantAuthorizationUnfilteredSubscribeProtocolScope",
25
24
  MessagesSubscribeAuthorizationFailed = "MessagesSubscribeAuthorizationFailed",
@@ -44,6 +43,13 @@ export declare enum DwnErrorCode {
44
43
  IndexInvalidSortPropertyInMemory = "IndexInvalidSortPropertyInMemory",
45
44
  IndexMissingIndexableProperty = "IndexMissingIndexableProperty",
46
45
  JwsDecodePlainObjectPayloadInvalid = "JwsDecodePlainObjectPayloadInvalid",
46
+ MessageStoreDeleteLogEntryMissing = "MessageStoreDeleteLogEntryMissing",
47
+ MessageStoreFingerprintScopeMutation = "MessageStoreFingerprintScopeMutation",
48
+ MessageStorePreSubstrateLayout = "MessageStorePreSubstrateLayout",
49
+ MessageStoreReplicationPositionOverflow = "MessageStoreReplicationPositionOverflow",
50
+ MessageStoreUpdateMessageAndIndexesCidMismatch = "MessageStoreUpdateMessageAndIndexesCidMismatch",
51
+ MessageStoreUpdateMessageAndIndexesMessageNotFound = "MessageStoreUpdateMessageAndIndexesMessageNotFound",
52
+ MessageStoreUpdateIndexesMessageNotFound = "MessageStoreUpdateIndexesMessageNotFound",
47
53
  MessagePermissionGrantCreateInvocationAmbiguous = "MessagePermissionGrantCreateInvocationAmbiguous",
48
54
  MessagePermissionGrantDescriptorPayloadMismatch = "MessagePermissionGrantDescriptorPayloadMismatch",
49
55
  MessagePermissionGrantIdsDescriptorPayloadMismatch = "MessagePermissionGrantIdsDescriptorPayloadMismatch",
@@ -51,11 +57,11 @@ export declare enum DwnErrorCode {
51
57
  MessagePermissionGrantIdsNotCanonical = "MessagePermissionGrantIdsNotCanonical",
52
58
  MessagePermissionGrantValidateInvocationAmbiguous = "MessagePermissionGrantValidateInvocationAmbiguous",
53
59
  MessagesReadInvalidCid = "MessagesReadInvalidCid",
60
+ MessagesQueryAuthorizationFailed = "MessagesQueryAuthorizationFailed",
61
+ MessagesQueryReplicationFeedUnimplemented = "MessagesQueryReplicationFeedUnimplemented",
54
62
  MessagesReadAuthorizationFailed = "MessagesReadAuthorizationFailed",
55
63
  MessageGetInvalidCid = "MessageGetInvalidCid",
56
64
  MessagesReadVerifyScopeFailed = "MessagesReadVerifyScopeFailed",
57
- MessagesSyncAuthorizationFailed = "MessagesSyncAuthorizationFailed",
58
- MessagesSyncInvalidPrefix = "MessagesSyncInvalidPrefix",
59
65
  ParseCidCodecNotSupported = "ParseCidCodecNotSupported",
60
66
  ParseCidMultihashNotSupported = "ParseCidMultihashNotSupported",
61
67
  PermissionsProtocolCreateGrantScopeContextIdProtocolPathConflict = "PermissionsProtocolCreateGrantScopeContextIdProtocolPathConflict",
@@ -97,7 +103,6 @@ export declare enum DwnErrorCode {
97
103
  ProtocolAuthorizationMatchingRoleRecordNotFound = "ProtocolAuthorizationMatchingRoleRecordNotFound",
98
104
  ProtocolAuthorizationMaxSizeInvalid = "ProtocolAuthorizationMaxSizeInvalid",
99
105
  ProtocolAuthorizationMinSizeInvalid = "ProtocolAuthorizationMinSizeInvalid",
100
- ProtocolAuthorizationRecordLimitExceeded = "ProtocolAuthorizationRecordLimitExceeded",
101
106
  ProtocolAuthorizationRecordLimitStrategyNotImplemented = "ProtocolAuthorizationRecordLimitStrategyNotImplemented",
102
107
  ProtocolAuthorizationSquashNotEnabled = "ProtocolAuthorizationSquashNotEnabled",
103
108
  ProtocolAuthorizationSquashNotInitialWrite = "ProtocolAuthorizationSquashNotInitialWrite",
@@ -150,6 +155,7 @@ export declare enum DwnErrorCode {
150
155
  RecordsAuthorDelegatedGrantNotADelegatedGrant = "RecordsAuthorDelegatedGrantNotADelegatedGrant",
151
156
  RecordsDecryptNoMatchingKeyEncryptedFound = "RecordsDecryptNoMatchingKeyEncryptedFound",
152
157
  RecordsCountFilterMissingRequiredProperties = "RecordsCountFilterMissingRequiredProperties",
158
+ RecordsCountNestedProtocolPathContextIdInvalid = "RecordsCountNestedProtocolPathContextIdInvalid",
153
159
  RecordsQueryCreateFilterPublishedSortInvalid = "RecordsQueryCreateFilterPublishedSortInvalid",
154
160
  RecordsQueryParseFilterPublishedSortInvalid = "RecordsQueryParseFilterPublishedSortInvalid",
155
161
  RecordsGrantAuthorizationConditionPublicationProhibited = "RecordsGrantAuthorizationConditionPublicationProhibited",
@@ -167,10 +173,12 @@ export declare enum DwnErrorCode {
167
173
  RecordsOwnerDelegatedGrantGrantedToAndOwnerSignatureMismatch = "RecordsOwnerDelegatedGrantGrantedToAndOwnerSignatureMismatch",
168
174
  RecordsOwnerDelegatedGrantNotADelegatedGrant = "RecordsOwnerDelegatedGrantNotADelegatedGrant",
169
175
  RecordsQueryFilterMissingRequiredProperties = "RecordsQueryFilterMissingRequiredProperties",
176
+ RecordsQueryNestedProtocolPathContextIdInvalid = "RecordsQueryNestedProtocolPathContextIdInvalid",
170
177
  RecordsReadCreateFilterPublishedSortInvalid = "RecordsReadCreateFilterPublishedSortInvalid",
171
178
  RecordsReadParseFilterPublishedSortInvalid = "RecordsReadParseFilterPublishedSortInvalid",
172
179
  RecordsSubscribeEventLogUnimplemented = "RecordsSubscribeEventLogUnimplemented",
173
180
  RecordsSubscribeFilterMissingRequiredProperties = "RecordsSubscribeFilterMissingRequiredProperties",
181
+ RecordsSubscribeNestedProtocolPathContextIdInvalid = "RecordsSubscribeNestedProtocolPathContextIdInvalid",
174
182
  RecordsWriteAttestationIntegrityMoreThanOneSignature = "RecordsWriteAttestationIntegrityMoreThanOneSignature",
175
183
  RecordsWriteAttestationIntegrityDescriptorCidMismatch = "RecordsWriteAttestationIntegrityDescriptorCidMismatch",
176
184
  RecordsWriteAttestationIntegrityInvalidPayloadProperty = "RecordsWriteAttestationIntegrityInvalidPayloadProperty",
@@ -1 +1 @@
1
- {"version":3,"file":"dwn-error.d.ts","sourceRoot":"","sources":["../../../../src/core/dwn-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACb,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAKlD;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,sBAAsB,2BAA2B;IACjD,iCAAiC,sCAAsC;IACvE,8CAA8C,mDAAmD;IACjG,+BAA+B,oCAAoC;IACnE,2BAA2B,gCAAgC;IAC3D,+BAA+B,oCAAoC;IACnE,iBAAiB,sBAAsB;IACvC,oBAAoB,yBAAyB;IAC7C,mBAAmB,wBAAwB;IAC3C,4CAA4C,iDAAiD;IAC7F,4DAA4D,iEAAiE;IAC7H,mDAAmD,wDAAwD;IAC3G,0DAA0D,+DAA+D;IACzH,oCAAoC,yCAAyC;IAC7E,4CAA4C,iDAAiD;IAC7F,sCAAsC,2CAA2C;IACjF,sCAAsC,2CAA2C;IACjF,kCAAkC,uCAAuC;IACzE,4BAA4B,iCAAiC;IAC7D,4BAA4B,iCAAiC;IAC7D,8BAA8B,mCAAmC;IACjE,8BAA8B,mCAAmC;IACjE,8BAA8B,mCAAmC;IACjE,mCAAmC,wCAAwC;IAC3E,gCAAgC,qCAAqC;IACrE,qCAAqC,0CAA0C;IAC/E,oCAAoC,yCAAyC;IAC7E,mCAAmC,wCAAwC;IAC3E,0BAA0B,+BAA+B;IACzD,gCAAgC,qCAAqC;IACrE,2BAA2B,gCAAgC;IAC3D,8BAA8B,mCAAmC;IACjE,gCAAgC,qCAAqC;IACrE,6BAA6B,kCAAkC;IAC/D,kCAAkC,uC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E;IACvI,gDAAgD,qDAAqD;IACrG,kDAAkD,uDAAuD;IACzG,iDAAiD,sDAAsD;IACvG,2CAA2C,gDAAgD;IAC3F,sBAAsB,2BAA2B;IACjD,6BAA6B,kCAAkC;IAC/D,4CAA4C,iDAAiD;IAC7F,oBAAoB,yBAAyB;IAC7C,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,wBAAwB,6BAA6B;IACrD,0BAA0B,+BAA+B;IACzD,sBAAsB,2BAA2B;IACjD,+BAA+B,oCAAoC;CACpE"}
@@ -1,6 +1,6 @@
1
1
  import type { GenericMessage } from '../types/message-types.js';
2
- import type { MessageStore } from '../types/message-store.js';
3
2
  import type { PermissionGrant } from '../protocols/permission-grant.js';
3
+ import type { ValidationStateReader } from '../types/validation-state-reader.js';
4
4
  export declare class GrantAuthorization {
5
5
  /**
6
6
  * Performs base permissions-grant-based authorization against the given message:
@@ -10,7 +10,7 @@ export declare class GrantAuthorization {
10
10
  *
11
11
  * NOTE: Does not validate grant `conditions` or `scope` beyond `interface` and `method`
12
12
  *
13
- * @param messageStore Used to check if the grant has been revoked.
13
+ * @param validationStateReader Used to check if the grant has been revoked.
14
14
  * @throws {DwnError} if validation fails
15
15
  */
16
16
  static performBaseValidation(input: {
@@ -18,7 +18,7 @@ export declare class GrantAuthorization {
18
18
  expectedGrantor: string;
19
19
  expectedGrantee: string;
20
20
  permissionGrant: PermissionGrant;
21
- messageStore: MessageStore;
21
+ validationStateReader: ValidationStateReader;
22
22
  }): Promise<void>;
23
23
  /**
24
24
  * Verifies the given `expectedGrantor` and `expectedGrantee` values against
@@ -29,7 +29,7 @@ export declare class GrantAuthorization {
29
29
  /**
30
30
  * Verify that the incoming message is within the allowed time frame of the grant,
31
31
  * and the grant has not been revoked.
32
- * @param messageStore Used to check if the grant has been revoked.
32
+ * @param validationStateReader Used to check if the grant has been revoked.
33
33
  * @throws {DwnError} if incomingMessage has timestamp for a time in which the grant is not active.
34
34
  */
35
35
  private static verifyGrantActive;
@@ -37,7 +37,7 @@ export declare class GrantAuthorization {
37
37
  * Verify that the `interface` and `method` grant scopes match the incoming message.
38
38
  *
39
39
  * For the Messages interface, a `Read` scope is treated as a unified scope that also authorizes
40
- * `Subscribe` and `Sync` operations.
40
+ * `Query`, `Subscribe`, and `Sync` operations.
41
41
  *
42
42
  * @throws {DwnError} if the `interface` and `method` of the incoming message do not match the scope of the permission grant.
43
43
  */
@@ -1 +1 @@
1
- {"version":3,"file":"grant-authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/grant-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAOxE,qBAAa,kBAAkB;IAE7B;;;;;;;;;;OAUG;WACiB,qBAAqB,CAAC,KAAK,EAAE;QAC/C,eAAe,EAAE,cAAc,CAAC;QAChC,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC1B,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBnB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,+BAA+B;IAuB9C;;;;;OAKG;mBACkB,iBAAiB;IAwCtC;;;;;;;OAOG;mBACkB,kCAAkC;CAuCxD"}
1
+ {"version":3,"file":"grant-authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/grant-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAKjF,qBAAa,kBAAkB;IAE7B;;;;;;;;;;OAUG;WACiB,qBAAqB,CAAC,KAAK,EAAE;QAC/C,eAAe,EAAE,cAAc,CAAC;QAChC,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,qBAAqB,EAAE,qBAAqB,CAAC;KAC5C,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBnB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,+BAA+B;IAuB9C;;;;;OAKG;mBACkB,iBAAiB;IAiCtC;;;;;;;OAOG;mBACkB,kCAAkC;CAuCxD"}
@@ -1,8 +1,9 @@
1
- import type { MessagesReadReplyEntry } from '../types/messages-types.js';
2
1
  import type { PaginationCursor } from '../types/query-types.js';
2
+ import type { ProgressToken } from '../types/subscriptions.js';
3
3
  import type { ProtocolsConfigureMessage } from '../types/protocols-types.js';
4
4
  import type { RecordsReadReplyEntry } from '../types/records-types.js';
5
5
  import type { GenericMessageReply, MessageSubscription, QueryResultEntry } from '../types/message-types.js';
6
+ import type { MessagesQueryReplyEntry, MessagesReadReplyEntry } from '../types/messages-types.js';
6
7
  export declare function messageReplyFromError(e: unknown, code: number): GenericMessageReply;
7
8
  /**
8
9
  * Catch-all message reply type. It is recommended to use GenericMessageReply or a message-specific reply type wherever possible.
@@ -15,15 +16,15 @@ export type UnionMessageReply = GenericMessageReply & {
15
16
  entry?: MessagesReadReplyEntry & RecordsReadReplyEntry;
16
17
  /**
17
18
  * Resulting message entries or events returned from the invocation of the corresponding message.
18
- * e.g. the resulting messages from a RecordsQuery, or array of messageCid strings for MessagesSync
19
+ * e.g. the resulting messages from a RecordsQuery or MessagesQuery.
19
20
  * Mutually exclusive with `record`.
20
21
  */
21
- entries?: QueryResultEntry[] | ProtocolsConfigureMessage[] | string[];
22
+ entries?: QueryResultEntry[] | ProtocolsConfigureMessage[] | MessagesQueryReplyEntry[] | string[];
22
23
  /**
23
24
  * A cursor for pagination if applicable (e.g. RecordsQuery).
24
25
  * Mutually exclusive with `record`.
25
26
  */
26
- cursor?: PaginationCursor;
27
+ cursor?: PaginationCursor | ProgressToken;
27
28
  /**
28
29
  * A subscription object if a subscription was requested.
29
30
  */
@@ -1 +1 @@
1
- {"version":3,"file":"message-reply.d.ts","sourceRoot":"","sources":["../../../../src/core/message-reply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE5G,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAKnF;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG;IACpD;;;OAGG;IACH,KAAK,CAAC,EAAE,sBAAsB,GAAG,qBAAqB,CAAC;IAEvD;;;;OAIG;IACH,OAAO,CAAC,EAAE,gBAAgB,EAAE,GAAG,yBAAyB,EAAE,GAAG,MAAM,EAAE,CAAC;IAEtE;;;OAGG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B;;OAEG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC,CAAC"}
1
+ {"version":3,"file":"message-reply.d.ts","sourceRoot":"","sources":["../../../../src/core/message-reply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC5G,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAElG,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAKnF;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG;IACpD;;;OAGG;IACH,KAAK,CAAC,EAAE,sBAAsB,GAAG,qBAAqB,CAAC;IAEvD;;;;OAIG;IACH,OAAO,CAAC,EAAE,gBAAgB,EAAE,GAAG,yBAAyB,EAAE,GAAG,uBAAuB,EAAE,GAAG,MAAM,EAAE,CAAC;IAElG;;;OAGG;IACH,MAAM,CAAC,EAAE,gBAAgB,GAAG,aAAa,CAAC;IAE1C;;OAEG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import type { GenericMessage } from '../types/message-types.js';
2
- import type { MessageStore } from '../types/message-store.js';
3
2
  import type { PermissionGrant } from '../protocols/permission-grant.js';
4
- import type { MessagesReadMessage, MessagesSubscribeMessage, MessagesSyncMessage } from '../types/messages-types.js';
3
+ import type { ValidationStateReader } from '../types/validation-state-reader.js';
4
+ import type { MessagesQueryMessage, MessagesReadMessage, MessagesSubscribeMessage } from '../types/messages-types.js';
5
5
  export declare class MessagesGrantAuthorization {
6
- static fetchPermissionGrants(tenant: string, messageStore: MessageStore, permissionGrantIds: string[]): Promise<PermissionGrant[]>;
6
+ static fetchPermissionGrants(tenant: string, validationStateReader: ValidationStateReader, permissionGrantIds: string[]): Promise<PermissionGrant[]>;
7
7
  /**
8
8
  * Authorizes a MessagesReadMessage using the given permission grant.
9
- * @param messageStore Used to check if the given grant has been revoked; and to fetch related RecordsWrites if needed.
9
+ * @param validationStateReader Used to check grant revocation and fetch related RecordsWrites if needed.
10
10
  */
11
11
  static authorizeMessagesRead(input: {
12
12
  messagesReadMessage: MessagesReadMessage;
@@ -14,22 +14,20 @@ export declare class MessagesGrantAuthorization {
14
14
  expectedGrantor: string;
15
15
  expectedGrantee: string;
16
16
  permissionGrants: PermissionGrant[];
17
- messageStore: MessageStore;
17
+ validationStateReader: ValidationStateReader;
18
18
  }): Promise<void>;
19
19
  /**
20
- * Authorizes the scope of a permission grant for MessagesSubscribe or MessagesSync.
21
- * @param messageStore Used to check if the grant has been revoked.
20
+ * Authorizes the scope of a permission grant for MessagesQuery or MessagesSubscribe.
21
+ * @param validationStateReader Used to check if the grant has been revoked.
22
22
  */
23
- static authorizeSubscribeOrSync(input: {
24
- incomingMessage: MessagesSubscribeMessage | MessagesSyncMessage;
23
+ static authorizeQueryOrSubscribe(input: {
24
+ incomingMessage: MessagesQueryMessage | MessagesSubscribeMessage;
25
25
  expectedGrantor: string;
26
26
  expectedGrantee: string;
27
27
  permissionGrants: PermissionGrant[];
28
- messageStore: MessageStore;
28
+ validationStateReader: ValidationStateReader;
29
29
  }): Promise<void>;
30
- private static authorizeSyncScope;
31
- private static authorizeProtocolSyncScope;
32
- private static authorizeSubscribeScope;
30
+ private static authorizeFilterScope;
33
31
  private static someScopeMatches;
34
32
  private static hasUnscopedGrant;
35
33
  /**
@@ -43,7 +41,7 @@ export declare class MessagesGrantAuthorization {
43
41
  expectedGrantor: string;
44
42
  expectedGrantee: string;
45
43
  permissionGrants: PermissionGrant[];
46
- messageStore: MessageStore;
44
+ validationStateReader: ValidationStateReader;
47
45
  deliveryTimestamp: string;
48
46
  }): Promise<void>;
49
47
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"messages-grant-authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/messages-grant-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,O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MAAM,CAAC;QACxB,gBAAgB,EAAE,eAAe,EAAE,CAAC;QACpC,YAAY,EAAE,YAAY,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BjB;;;OAGG;mBACkB,gCAAgC;IAsBrD;;OAEG;mBACkB,iBAAiB;mBA6BjB,+BAA+B;mBAwB/B,iCAAiC;IAoBtD,OAAO,CAAC,MAAM,CAAC,mCAAmC;mBAU7B,yBAAyB;IAY9C,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAMpC,OAAO,CAAC,MAAM,CAAC,cAAc;CAG9B"}
1
+ {"version":3,"file":"messages-grant-authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/messages-grant-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAEjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAStH,qBAAa,0BAA0B;WAEjB,qBAAqB,CACvC,MAAM,EAAE,MAAM,EACd,qBAAqB,EAAE,qBAAqB,EAC5C,kBAAkB,EAAE,MAAM,EAAE,GAC3B,OAAO,CAAC,eAAe,EAAE,CAAC;IAM7B;;;OAGG;WACiB,qBAAqB,CAAC,KAAK,EAAE;QAC/C,mBAAmB,EAAE,mBAAmB,CAAC;QACzC,aAAa,EAAE,cAAc,CAAC;QAC9B,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,gBAAgB,EAAE,eAAe,EAAE,CAAC;QACpC,qBAAqB,EAAE,qBAAqB,CAAC;KAC9C,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBjB;;;OAGG;WACiB,yBAAyB,CAAC,KAAK,EAAE;QACnD,eAAe,EAAE,oBAAoB,GAAG,wBAAwB,CAAC;QACjE,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,gBAAgB,EAAE,eAAe,EAAE,CAAC;QACpC,qBAAqB,EAAE,qBAAqB,CAAC;KAC9C,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBjB,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAyBnC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAI/B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAI/B;;;;;OAKG;WACiB,0BAA0B,CAAC,KAAK,EAAE;QACpD,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,gBAAgB,EAAE,eAAe,EAAE,CAAC;QACpC,qBAAqB,EAAE,qBAAqB,CAAC;QAC7C,iBAAiB,EAAE,MAAM,CAAC;KAC3B,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BjB;;;OAGG;mBACkB,gCAAgC;IAsBrD;;OAEG;mBACkB,iBAAiB;mBA6BjB,+BAA+B;mBAwB/B,iCAAiC;IAoBtD,OAAO,CAAC,MAAM,CAAC,mCAAmC;mBAU7B,yBAAyB;IAY9C,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAMpC,OAAO,CAAC,MAAM,CAAC,cAAc;CAG9B"}
@@ -1,20 +1,19 @@
1
- import type { MessageStore } from '../types/message-store.js';
2
1
  import type { RecordsCount } from '../interfaces/records-count.js';
3
2
  import type { RecordsDelete } from '../interfaces/records-delete.js';
4
3
  import type { RecordsQuery } from '../interfaces/records-query.js';
5
4
  import type { RecordsRead } from '../interfaces/records-read.js';
6
5
  import type { RecordsSubscribe } from '../interfaces/records-subscribe.js';
7
6
  import type { RecordsWriteMessage } from '../types/records-types.js';
7
+ import type { ValidationStateReader } from '../types/validation-state-reader.js';
8
8
  import type { ProtocolActionRule, ProtocolDefinition, ProtocolRuleSet } from '../types/protocols-types.js';
9
9
  import { RecordsWrite } from '../interfaces/records-write.js';
10
10
  import { ProtocolAction } from '../types/protocols-types.js';
11
- import type { FetchProtocolDefinitionFn } from './protocol-authorization.js';
12
11
  /**
13
12
  * Check if the incoming message is invoking a role. If so, validate the invoked role.
14
13
  * For cross-protocol role invocation, the role record may live in a different protocol
15
14
  * (resolved via the composing protocol's `uses` map).
16
15
  */
17
- export declare function verifyInvokedRole(tenant: string, incomingMessage: RecordsCount | RecordsDelete | RecordsQuery | RecordsRead | RecordsSubscribe | RecordsWrite, protocolUri: string, contextId: string | undefined, protocolDefinition: ProtocolDefinition, messageStore: MessageStore, fetchProtocolDefinition: FetchProtocolDefinitionFn, governingTimestamp?: string): Promise<void>;
16
+ export declare function verifyInvokedRole(tenant: string, incomingMessage: RecordsCount | RecordsDelete | RecordsQuery | RecordsRead | RecordsSubscribe | RecordsWrite, protocolUri: string, contextId: string | undefined, protocolDefinition: ProtocolDefinition, validationStateReader: ValidationStateReader, protocolDefinitionTimestamp?: string): Promise<void>;
18
17
  /**
19
18
  * Returns all the ProtocolActions that would authorized the incoming message
20
19
  * (but we still need to later verify if there is a rule defined that matches one of the actions).
@@ -25,13 +24,13 @@ export declare function verifyInvokedRole(tenant: string, incomingMessage: Recor
25
24
  * It is important to recognize that the `write` access that allowed the original record author to create the record maybe revoked
26
25
  * (e.g. by role revocation) by the time a "non-initial" write by the same author is attempted.
27
26
  */
28
- export declare function getActionsSeekingARuleMatch(tenant: string, incomingMessage: RecordsCount | RecordsDelete | RecordsQuery | RecordsRead | RecordsSubscribe | RecordsWrite, messageStore: MessageStore): Promise<ProtocolAction[]>;
27
+ export declare function getActionsSeekingARuleMatch(tenant: string, incomingMessage: RecordsCount | RecordsDelete | RecordsQuery | RecordsRead | RecordsSubscribe | RecordsWrite, validationStateReader: ValidationStateReader): Promise<ProtocolAction[]>;
29
28
  /**
30
29
  * Verifies the given message is authorized by one of the action rules in the given protocol rule set.
31
30
  * @param protocolDefinition Optional protocol definition for resolving cross-protocol `of` and `role` references.
32
31
  * @throws {Error} if action not allowed.
33
32
  */
34
- export declare function authorizeAgainstAllowedActions(tenant: string, incomingMessage: RecordsCount | RecordsDelete | RecordsQuery | RecordsRead | RecordsSubscribe | RecordsWrite, ruleSet: ProtocolRuleSet, recordChain: RecordsWriteMessage[], messageStore: MessageStore, protocolDefinition?: ProtocolDefinition): Promise<void>;
33
+ export declare function authorizeAgainstAllowedActions(tenant: string, incomingMessage: RecordsCount | RecordsDelete | RecordsQuery | RecordsRead | RecordsSubscribe | RecordsWrite, ruleSet: ProtocolRuleSet, recordChain: RecordsWriteMessage[], validationStateReader: ValidationStateReader, protocolDefinition?: ProtocolDefinition): Promise<void>;
35
34
  /**
36
35
  * Checks if the `who: 'author' | 'recipient'` action rule has a matching record in the record chain.
37
36
  * For cross-protocol `of` references (e.g., `"threads:thread"`), matches against both the protocol URI
@@ -1 +1 @@
1
- {"version":3,"file":"protocol-authorization-action.d.ts","sourceRoot":"","sources":["../../../../src/core/protocol-authorization-action.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG3G,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAI9D,OAAO,EAAE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,CAClD,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,YAAY,GAAG,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,gBAAgB,GAAG,YAAY,EAC5G,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,mBAAmB,EAAE,EAClC,qBAAqB,EAAE,qBAAqB,EAC5C,kBAAkB,CAAC,EAAE,kBAAkB,GACtC,OAAO,CAAC,IAAI,CAAC,CAyFf;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,EAC9B,WAAW,EAAE,mBAAmB,EAAE,EAClC,mBAAmB,CAAC,EAAE,kBAAkB,GACvC,OAAO,CAAC,OAAO,CAAC,CA0ClB"}
@@ -1,14 +1,13 @@
1
- import type { MessageStore } from '../types/message-store.js';
1
+ import type { RecordsWrite } from '../interfaces/records-write.js';
2
2
  import type { RecordsWriteMessage } from '../types/records-types.js';
3
+ import type { ValidationStateReader } from '../types/validation-state-reader.js';
3
4
  import type { ProtocolDefinition, ProtocolRuleSet, ProtocolTypes } from '../types/protocols-types.js';
4
- import type { RecordsWrite } from '../interfaces/records-write.js';
5
- import type { FetchProtocolDefinitionFn } from './protocol-authorization.js';
6
5
  /**
7
6
  * Verifies the `protocolPath` declared in the given message matches the path of actual record chain.
8
7
  * For cross-protocol composition, the parent record may belong to a different protocol (resolved via `$ref` in the composing protocol).
9
8
  * @throws {DwnError} if fails verification.
10
9
  */
11
- export declare function verifyProtocolPathAndContextId(tenant: string, inboundMessage: RecordsWrite, messageStore: MessageStore, fetchProtocolDefinition: FetchProtocolDefinitionFn, governingTimestamp?: string): Promise<void>;
10
+ export declare function verifyProtocolPathAndContextId(tenant: string, inboundMessage: RecordsWrite, validationStateReader: ValidationStateReader, protocolDefinitionTimestamp?: string): Promise<void>;
12
11
  /**
13
12
  * Resolves the protocol URI that should be used when querying for the parent record.
14
13
  * For standard (non-composed) records, this is the same as the child's protocol.
@@ -21,19 +20,19 @@ export declare function verifyProtocolPathAndContextId(tenant: string, inboundMe
21
20
  * live in the referenced protocol. Specifically, the `$ref` at the topmost ancestor tells us
22
21
  * the parent's protocol URI.
23
22
  */
24
- export declare function resolveParentProtocolUri(tenant: string, childProtocolUri: string, childProtocolPath: string, messageStore: MessageStore, fetchProtocolDefinition: FetchProtocolDefinitionFn, governingTimestamp?: string): Promise<string>;
23
+ export declare function resolveParentProtocolUri(tenant: string, childProtocolUri: string, childProtocolPath: string, validationStateReader: ValidationStateReader, protocolDefinitionTimestamp?: string): Promise<string>;
25
24
  /**
26
25
  * Verifies the `dataFormat` and `schema` declared in the given message matches the type in the protocol.
27
26
  * For cross-protocol composition, if the type is at a `$ref` position in the structure,
28
27
  * the type definition is looked up in the referenced protocol's `types` map instead.
29
28
  */
30
- export declare function verifyTypeWithComposition(tenant: string, inboundMessage: RecordsWriteMessage, protocolDefinition: ProtocolDefinition, messageStore: MessageStore, fetchProtocolDefinition: FetchProtocolDefinitionFn, governingTimestamp?: string): Promise<void>;
29
+ export declare function verifyTypeWithComposition(tenant: string, inboundMessage: RecordsWriteMessage, protocolDefinition: ProtocolDefinition, validationStateReader: ValidationStateReader, protocolDefinitionTimestamp?: string): Promise<void>;
31
30
  /**
32
31
  * Resolves the `ProtocolTypes` map that contains the type definition for the given protocol path.
33
32
  * For non-composed records, this is the protocol definition's own `types` map.
34
33
  * For records at a `$ref` position, this is the referenced protocol's `types` map.
35
34
  */
36
- export declare function resolveProtocolTypesForPath(tenant: string, protocolPath: string, protocolDefinition: ProtocolDefinition, messageStore: MessageStore, fetchProtocolDefinition: FetchProtocolDefinitionFn, governingTimestamp?: string): Promise<ProtocolTypes>;
35
+ export declare function resolveProtocolTypesForPath(tenant: string, protocolPath: string, protocolDefinition: ProtocolDefinition, validationStateReader: ValidationStateReader, protocolDefinitionTimestamp?: string): Promise<ProtocolTypes>;
37
36
  /**
38
37
  * Verifies the `dataFormat` and `schema` declared in the given message (if it is a RecordsWrite) matches dataFormat
39
38
  * and schema of the type in the given protocol.
@@ -56,19 +55,17 @@ export declare function verifyTagsIfNeeded(incomingMessage: RecordsWrite, ruleSe
56
55
  * Else it verifies the validity of the given `RecordsWrite` as a role record, including:
57
56
  * 1. The same role has not been assigned to the same entity/recipient.
58
57
  */
59
- export declare function verifyAsRoleRecordIfNeeded(tenant: string, incomingMessage: RecordsWrite, ruleSet: ProtocolRuleSet, messageStore: MessageStore): Promise<void>;
58
+ export declare function verifyAsRoleRecordIfNeeded(tenant: string, incomingMessage: RecordsWrite, ruleSet: ProtocolRuleSet, validationStateReader: ValidationStateReader): Promise<void>;
60
59
  /**
61
- * Verifies that a new record creation does not exceed the `$recordLimit` defined in the rule set.
60
+ * Verifies that the `$recordLimit` strategy is supported for a new record creation.
62
61
  *
63
- * This check only applies to initial writes (new records). Updates to existing records are not counted.
64
- * The count is scoped to the same `protocol + protocolPath` within the parent context:
65
- * - For root-level records: counted across the entire protocol for the tenant.
66
- * - For nested records: counted within the parent record's context.
62
+ * This check only applies to initial writes (new records). Updates to existing records do not
63
+ * affect record-limit occupancy. The supported `reject` strategy admits every candidate and
64
+ * projects the visible occupant set at read time, so validation stays independent of arrival order.
67
65
  *
68
- * @throws {DwnError} with `ProtocolAuthorizationRecordLimitExceeded` if the limit is reached and strategy is `reject`.
69
- * @throws {DwnError} with `ProtocolAuthorizationRecordLimitStrategyNotImplemented` if strategy is not yet implemented.
66
+ * @throws {DwnError} with `ProtocolAuthorizationRecordLimitStrategyNotImplemented` if strategy is not implemented.
70
67
  */
71
- export declare function verifyRecordLimit(tenant: string, incomingMessage: RecordsWrite, ruleSet: ProtocolRuleSet, messageStore: MessageStore): Promise<void>;
68
+ export declare function verifyRecordLimit(incomingMessage: RecordsWrite, ruleSet: ProtocolRuleSet): Promise<void>;
72
69
  /**
73
70
  * Verifies that a `RecordsWrite` with `squash: true` is eligible:
74
71
  * 1. The protocol rule set at the record's `protocolPath` must have `$squash: true`.
@@ -1 +1 @@
1
- {"version":3,"file":"protocol-authorization-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B,EAAE,yBAAyB,EAClD,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,aAAa,CAAC,CAqBxB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,cAAc,EAAE,mBAAmB,EACnC,aAAa,EAAE,aAAa,EAC5B,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAsCN;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe,GACvB,IAAI,CAgBN;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe,GACvB,IAAI,CA8BN;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC,CA6Cf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC,CAiDf;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAwBf;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAcf"}
1
+ {"version":3,"file":"protocol-authorization-validation.d.ts","sourceRoot":"","sources":["../../../../src/core/protocol-authorization-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2B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ED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe,GACvB,IAAI,CA8BN;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe,EACxB,qBAAqB,EAAE,qBAAqB,GAC3C,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAwBf;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAcf"}
@@ -1,23 +1,17 @@
1
- import type { CoreProtocolRegistry } from './core-protocol.js';
2
- import type { MessageStore } from '../types/message-store.js';
3
1
  import type { RecordsCount } from '../interfaces/records-count.js';
4
2
  import type { RecordsDelete } from '../interfaces/records-delete.js';
5
3
  import type { RecordsQuery } from '../interfaces/records-query.js';
6
4
  import type { RecordsRead } from '../interfaces/records-read.js';
7
5
  import type { RecordsSubscribe } from '../interfaces/records-subscribe.js';
8
6
  import type { RecordsWrite } from '../interfaces/records-write.js';
9
- import type { ProtocolDefinition } from '../types/protocols-types.js';
10
- /**
11
- * Function signature for fetching a protocol definition.
12
- * Used by extracted modules to break the circular dependency on `ProtocolAuthorization`.
13
- */
14
- export type FetchProtocolDefinitionFn = (tenant: string, protocolUri: string, messageStore: MessageStore, messageTimestamp?: string) => Promise<ProtocolDefinition>;
7
+ import type { ValidationStateReader } from '../types/validation-state-reader.js';
8
+ import type { ProtocolRuleSet } from '../types/protocols-types.js';
15
9
  export declare class ProtocolAuthorization {
16
10
  /**
17
11
  * Performs validation on the structure of RecordsWrite messages that use a protocol.
18
12
  * @throws {Error} if validation fails.
19
13
  */
20
- static validateReferentialIntegrity(tenant: string, incomingMessage: RecordsWrite, messageStore: MessageStore, coreProtocols?: CoreProtocolRegistry): Promise<void>;
14
+ static validateReferentialIntegrity(tenant: string, incomingMessage: RecordsWrite, validationStateReader: ValidationStateReader): Promise<ProtocolRuleSet>;
21
15
  /**
22
16
  * Revalidates a stored initial write against the protocol definition that governed its creation timestamp.
23
17
  *
@@ -25,43 +19,24 @@ export declare class ProtocolAuthorization {
25
19
  * structure and avoids live dependency checks. Missing grant, role, or parent records must not cause
26
20
  * an already-admitted record to be hard-purged.
27
21
  */
28
- static validateStoredInitialWrite(tenant: string, incomingMessage: RecordsWrite, messageStore: MessageStore, coreProtocols?: CoreProtocolRegistry): Promise<void>;
22
+ static validateStoredInitialWrite(tenant: string, incomingMessage: RecordsWrite, validationStateReader: ValidationStateReader): Promise<void>;
29
23
  /**
30
24
  * Performs protocol-based authorization against the incoming RecordsWrite message.
31
25
  * @throws {Error} if authorization fails.
32
26
  */
33
- static authorizeWrite(tenant: string, incomingMessage: RecordsWrite, messageStore: MessageStore, coreProtocols?: CoreProtocolRegistry): Promise<void>;
27
+ static authorizeWrite(tenant: string, incomingMessage: RecordsWrite, validationStateReader: ValidationStateReader): Promise<void>;
34
28
  /**
35
29
  * Performs protocol-based authorization against the incoming `RecordsRead` message.
36
30
  * @param newestRecordsWrite The latest RecordsWrite associated with the recordId being read.
37
31
  * @throws {Error} if authorization fails.
38
32
  */
39
- static authorizeRead(tenant: string, incomingMessage: RecordsRead, newestRecordsWrite: RecordsWrite, messageStore: MessageStore, coreProtocols?: CoreProtocolRegistry): Promise<void>;
40
- static authorizeQueryOrSubscribe(tenant: string, incomingMessage: RecordsCount | RecordsQuery | RecordsSubscribe, messageStore: MessageStore, coreProtocols?: CoreProtocolRegistry): Promise<void>;
33
+ static authorizeRead(tenant: string, incomingMessage: RecordsRead, newestRecordsWrite: RecordsWrite, validationStateReader: ValidationStateReader): Promise<void>;
34
+ static authorizeQueryOrSubscribe(tenant: string, incomingMessage: RecordsCount | RecordsQuery | RecordsSubscribe, validationStateReader: ValidationStateReader): Promise<void>;
41
35
  /**
42
36
  * Performs protocol-based authorization against the incoming `RecordsDelete` message.
43
37
  * @param recordsWrite A `RecordsWrite` of the record being deleted.
44
38
  */
45
- static authorizeDelete(tenant: string, incomingMessage: RecordsDelete, recordsWrite: RecordsWrite, messageStore: MessageStore, coreProtocols?: CoreProtocolRegistry): Promise<void>;
46
- /**
47
- * Fetches the protocol definition based on the protocol specified in the given message.
48
- * When `messageTimestamp` is provided, returns the protocol definition that was active at that
49
- * point in time — i.e. the ProtocolsConfigure with the greatest `messageTimestamp` that is <= the
50
- * given timestamp. When not provided, returns the latest (current) protocol definition.
51
- *
52
- * When `coreProtocols` is provided, core protocol definitions are returned directly from the
53
- * registry without a message store query. The extra parameter does not affect the
54
- * `FetchProtocolDefinitionFn` callback type — callers that pass this function as a callback
55
- * should bind the registry via a closure (see `createBoundFetchDefinition`).
56
- */
57
- static fetchProtocolDefinition(tenant: string, protocolUri: string, messageStore: MessageStore, messageTimestamp?: string, coreProtocols?: CoreProtocolRegistry): Promise<ProtocolDefinition>;
58
- /**
59
- * Creates a `FetchProtocolDefinitionFn` closure that binds the given `CoreProtocolRegistry`.
60
- * This allows core protocol definitions to be resolved from the registry without changing
61
- * the `FetchProtocolDefinitionFn` type signature — zero ripple to downstream consumers
62
- * like `protocol-authorization-action.ts` and `protocol-authorization-validation.ts`.
63
- */
64
- private static createBoundFetchDefinition;
39
+ static authorizeDelete(tenant: string, incomingMessage: RecordsDelete, recordsWrite: RecordsWrite, validationStateReader: ValidationStateReader): Promise<void>;
65
40
  /**
66
41
  * Gets the rule set corresponding to the given protocolPath.
67
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"protocol-authorization.d.ts","source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,EAC9B,YAAY,EAAE,YAAY,EAC1B,qBAAqB,EAAE,qBAAqB,GAC3C,OAAO,CAAC,IAAI,CAAC;IA2ChB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;mBAYJ,wBAAwB;IAW7C,OAAO,CAAC,MAAM,CAAC,6CAA6C;IAc5D,OAAO,CAAC,MAAM,CAAC,oCAAoC;IAkDnD,OAAO,CAAC,MAAM,CAAC,sCAAsC;CAQtD"}
@@ -1,5 +1,5 @@
1
- import type { MessageStore } from '../types/message-store.js';
2
1
  import type { PermissionGrant } from '../protocols/permission-grant.js';
2
+ import type { ValidationStateReader } from '../types/validation-state-reader.js';
3
3
  import type { ProtocolsConfigureMessage, ProtocolsQueryMessage } from '../types/protocols-types.js';
4
4
  export declare class ProtocolsGrantAuthorization {
5
5
  /**
@@ -10,18 +10,18 @@ export declare class ProtocolsGrantAuthorization {
10
10
  expectedGrantor: string;
11
11
  expectedGrantee: string;
12
12
  permissionGrant: PermissionGrant;
13
- messageStore: MessageStore;
13
+ validationStateReader: ValidationStateReader;
14
14
  }): Promise<void>;
15
15
  /**
16
16
  * Authorizes the scope of a permission grant for a ProtocolsQuery message.
17
- * @param messageStore Used to check if the grant has been revoked.
17
+ * @param validationStateReader Used to check if the grant has been revoked.
18
18
  */
19
19
  static authorizeQuery(input: {
20
20
  expectedGrantor: string;
21
21
  expectedGrantee: string;
22
22
  incomingMessage: ProtocolsQueryMessage;
23
23
  permissionGrant: PermissionGrant;
24
- messageStore: MessageStore;
24
+ validationStateReader: ValidationStateReader;
25
25
  }): Promise<void>;
26
26
  /**
27
27
  * Verifies a ProtocolsConfigure against the scope of the given grant.
@@ -1 +1 @@
1
- {"version":3,"file":"protocols-grant-authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols-grant-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,KAAK,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAKpG,qBAAa,2BAA2B;IACtC;;OAEG;WACiB,kBAAkB,CAAC,KAAK,EAAE;QAC5C,yBAAyB,EAAE,yBAAyB,CAAC;QACrD,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBjB;;;OAGG;WACiB,cAAc,CAAC,KAAK,EAAE;QACxC,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,qBAAqB,CAAC;QACvC,eAAe,EAAE,eAAe,CAAC;QACjC,YAAY,EAAE,YAAY,CAAC;KAC5B,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBjB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;CAiB3B"}
1
+ {"version":3,"file":"protocols-grant-authorization.d.ts","sourceRoot":"","sources":["../../../../src/core/protocols-grant-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,KAAK,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAKpG,qBAAa,2BAA2B;IACtC;;OAEG;WACiB,kBAAkB,CAAC,KAAK,EAAE;QAC5C,yBAAyB,EAAE,yBAAyB,CAAC;QACrD,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,eAAe,CAAC;QACjC,qBAAqB,EAAE,qBAAqB,CAAC;KAC9C,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBjB;;;OAGG;WACiB,cAAc,CAAC,KAAK,EAAE;QACxC,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,qBAAqB,CAAC;QACvC,eAAe,EAAE,eAAe,CAAC;QACjC,qBAAqB,EAAE,qBAAqB,CAAC;KAC9C,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBjB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;CAiB3B"}
@@ -0,0 +1,75 @@
1
+ import type { GenericMessage } from '../types/message-types.js';
2
+ import type { PermissionGrant } from '../protocols/permission-grant.js';
3
+ import type { ProtocolDefinition } from '../types/protocols-types.js';
4
+ import type { RecordsWrite } from '../interfaces/records-write.js';
5
+ import type { RecordsWriteMessage } from '../types/records-types.js';
6
+ import type { ValidationStateReader } from '../types/validation-state-reader.js';
7
+ /**
8
+ * One recorded validation-time state read: the reader method invoked.
9
+ */
10
+ export type RecordedValidationRead = {
11
+ method: keyof ValidationStateReader;
12
+ };
13
+ /**
14
+ * A `ValidationStateReader` decorator that records every read before delegating to the wrapped
15
+ * reader. Used by the replay-basis closure tests (and harnesses) to assert that admission
16
+ * performs no validation read outside the reader surface, and to keep recorded read-traces as a
17
+ * regression artifact when validation reads change.
18
+ *
19
+ * Inject via `DwnConfig.instrumentValidationStateReader`.
20
+ */
21
+ export declare class RecordingValidationStateReader implements ValidationStateReader {
22
+ private readonly inner;
23
+ private readonly recordedReads;
24
+ constructor(inner: ValidationStateReader);
25
+ /** All reads recorded since construction or the last `clearRecordedReads()`. */
26
+ get reads(): RecordedValidationRead[];
27
+ /** Clears the recorded reads, e.g. between closure-test scenarios. */
28
+ clearRecordedReads(): void;
29
+ /** @inheritdoc */
30
+ fetchInitialRecordsWrite(tenant: string, recordId: string): Promise<RecordsWrite | undefined>;
31
+ /** @inheritdoc */
32
+ fetchInitialWrite(tenant: string, recordId: string): Promise<RecordsWriteMessage | undefined>;
33
+ /** @inheritdoc */
34
+ constructRecordChain(tenant: string, descendantRecordId: string | undefined): Promise<RecordsWriteMessage[]>;
35
+ /** @inheritdoc */
36
+ fetchParentRecord(input: {
37
+ tenant: string;
38
+ parentProtocolUri: string;
39
+ parentId: string;
40
+ }): Promise<RecordsWriteMessage | undefined>;
41
+ /** @inheritdoc */
42
+ hasMatchingRoleRecord(input: {
43
+ tenant: string;
44
+ protocol: string;
45
+ protocolPath: string;
46
+ recipient: string;
47
+ contextIdPrefix?: string;
48
+ }): Promise<boolean>;
49
+ /** @inheritdoc */
50
+ queryLatestRoleRecords(input: {
51
+ tenant: string;
52
+ protocol: string;
53
+ protocolPath: string;
54
+ recipient: string;
55
+ contextIdPrefix?: string;
56
+ }): Promise<RecordsWriteMessage[]>;
57
+ /** @inheritdoc */
58
+ fetchGrant(tenant: string, permissionGrantId: string): Promise<PermissionGrant>;
59
+ /** @inheritdoc */
60
+ fetchOldestGrantRevocation(tenant: string, permissionGrantId: string): Promise<GenericMessage | undefined>;
61
+ /** @inheritdoc */
62
+ fetchNewestRecordsWrite(tenant: string, recordId: string): Promise<RecordsWriteMessage>;
63
+ /** @inheritdoc */
64
+ fetchProtocolDefinition(tenant: string, protocolUri: string, messageTimestamp?: string): Promise<ProtocolDefinition>;
65
+ /** @inheritdoc */
66
+ fetchLatestSquashRecordAtScope(input: {
67
+ tenant: string;
68
+ protocol: string;
69
+ protocolPath: string;
70
+ contextIdPrefix?: string;
71
+ }): Promise<RecordsWriteMessage | undefined>;
72
+ /** @inheritdoc */
73
+ hasStoredData(tenant: string, recordId: string, dataCid: string): Promise<boolean>;
74
+ }
75
+ //# sourceMappingURL=recording-validation-state-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recording-validation-state-reader.d.ts","sourceRoot":"","sources":["../../../../src/core/recording-validation-state-reader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EA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