@opendatalabs/personal-server-ts-core 1.33.8 → 1.34.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 (333) hide show
  1. package/dist/additions/budget.d.ts +28 -0
  2. package/dist/additions/budget.d.ts.map +1 -0
  3. package/dist/additions/budget.js +119 -0
  4. package/dist/additions/budget.js.map +1 -0
  5. package/dist/additions/durable.d.ts +64 -0
  6. package/dist/additions/durable.d.ts.map +1 -0
  7. package/dist/additions/durable.js +591 -0
  8. package/dist/additions/durable.js.map +1 -0
  9. package/dist/additions/first-added.d.ts +32 -48
  10. package/dist/additions/first-added.d.ts.map +1 -1
  11. package/dist/additions/first-added.js +68 -123
  12. package/dist/additions/first-added.js.map +1 -1
  13. package/dist/additions/index.d.ts +3 -0
  14. package/dist/additions/index.d.ts.map +1 -1
  15. package/dist/additions/index.js +3 -0
  16. package/dist/additions/index.js.map +1 -1
  17. package/dist/additions/ledger-store.js +1 -1
  18. package/dist/additions/record-rules.d.ts.map +1 -1
  19. package/dist/additions/record-rules.js +7 -0
  20. package/dist/additions/record-rules.js.map +1 -1
  21. package/dist/additions/summary.d.ts +88 -1
  22. package/dist/additions/summary.d.ts.map +1 -1
  23. package/dist/additions/summary.js +173 -8
  24. package/dist/additions/summary.js.map +1 -1
  25. package/dist/additions/version-inventory.d.ts +80 -0
  26. package/dist/additions/version-inventory.d.ts.map +1 -0
  27. package/dist/additions/version-inventory.js +232 -0
  28. package/dist/additions/version-inventory.js.map +1 -0
  29. package/dist/api/index.d.ts +70 -2
  30. package/dist/api/index.d.ts.map +1 -1
  31. package/dist/api/index.js +506 -79
  32. package/dist/api/index.js.map +1 -1
  33. package/dist/auth/index.d.ts +1 -1
  34. package/dist/auth/index.d.ts.map +1 -1
  35. package/dist/auth/index.js +1 -1
  36. package/dist/auth/index.js.map +1 -1
  37. package/dist/auth/request.d.ts +6 -0
  38. package/dist/auth/request.d.ts.map +1 -1
  39. package/dist/auth/request.js +66 -4
  40. package/dist/auth/request.js.map +1 -1
  41. package/dist/contracts/data.d.ts +54 -8
  42. package/dist/contracts/data.d.ts.map +1 -1
  43. package/dist/contracts/data.js +178 -35
  44. package/dist/contracts/data.js.map +1 -1
  45. package/dist/contracts/index.d.ts +1 -1
  46. package/dist/contracts/index.d.ts.map +1 -1
  47. package/dist/derivatives/registration.d.ts +0 -5
  48. package/dist/derivatives/registration.d.ts.map +1 -1
  49. package/dist/derivatives/registration.js +2 -1
  50. package/dist/derivatives/registration.js.map +1 -1
  51. package/dist/errors/pdpp-catalog.d.ts +36 -0
  52. package/dist/errors/pdpp-catalog.d.ts.map +1 -0
  53. package/dist/errors/pdpp-catalog.js +86 -0
  54. package/dist/errors/pdpp-catalog.js.map +1 -0
  55. package/dist/grants/index.d.ts +2 -0
  56. package/dist/grants/index.d.ts.map +1 -1
  57. package/dist/grants/index.js +4 -0
  58. package/dist/grants/index.js.map +1 -1
  59. package/dist/grants/pdpp-binding-store.d.ts +89 -0
  60. package/dist/grants/pdpp-binding-store.d.ts.map +1 -0
  61. package/dist/grants/pdpp-binding-store.js +112 -0
  62. package/dist/grants/pdpp-binding-store.js.map +1 -0
  63. package/dist/grants/pdpp-binding.d.ts +169 -0
  64. package/dist/grants/pdpp-binding.d.ts.map +1 -0
  65. package/dist/grants/pdpp-binding.js +236 -0
  66. package/dist/grants/pdpp-binding.js.map +1 -0
  67. package/dist/legacy-projection/bindings.d.ts +28 -1
  68. package/dist/legacy-projection/bindings.d.ts.map +1 -1
  69. package/dist/legacy-projection/bindings.js +622 -189
  70. package/dist/legacy-projection/bindings.js.map +1 -1
  71. package/dist/legacy-projection/claude-source-record.d.ts +22 -0
  72. package/dist/legacy-projection/claude-source-record.d.ts.map +1 -0
  73. package/dist/legacy-projection/claude-source-record.js +360 -0
  74. package/dist/legacy-projection/claude-source-record.js.map +1 -0
  75. package/dist/legacy-projection/declared-text.d.ts +41 -0
  76. package/dist/legacy-projection/declared-text.d.ts.map +1 -0
  77. package/dist/legacy-projection/declared-text.js +199 -0
  78. package/dist/legacy-projection/declared-text.js.map +1 -0
  79. package/dist/legacy-projection/github-browser-bindings.d.ts.map +1 -1
  80. package/dist/legacy-projection/github-browser-bindings.js +89 -5
  81. package/dist/legacy-projection/github-browser-bindings.js.map +1 -1
  82. package/dist/legacy-projection/github-legacy-fields.d.ts +6 -0
  83. package/dist/legacy-projection/github-legacy-fields.d.ts.map +1 -0
  84. package/dist/legacy-projection/github-legacy-fields.js +202 -0
  85. package/dist/legacy-projection/github-legacy-fields.js.map +1 -0
  86. package/dist/legacy-projection/index.d.ts +5 -1
  87. package/dist/legacy-projection/index.d.ts.map +1 -1
  88. package/dist/legacy-projection/index.js +55 -1
  89. package/dist/legacy-projection/index.js.map +1 -1
  90. package/dist/legacy-projection/oura-browser-bindings.d.ts.map +1 -1
  91. package/dist/legacy-projection/oura-browser-bindings.js +43 -41
  92. package/dist/legacy-projection/oura-browser-bindings.js.map +1 -1
  93. package/dist/legacy-projection/types.d.ts +38 -2
  94. package/dist/legacy-projection/types.d.ts.map +1 -1
  95. package/dist/mcp/read-client.d.ts.map +1 -1
  96. package/dist/mcp/read-client.js +10 -1
  97. package/dist/mcp/read-client.js.map +1 -1
  98. package/dist/mcp/resources.d.ts.map +1 -1
  99. package/dist/mcp/resources.js +3 -0
  100. package/dist/mcp/resources.js.map +1 -1
  101. package/dist/mcp/tools.d.ts.map +1 -1
  102. package/dist/mcp/tools.js +11 -2
  103. package/dist/mcp/tools.js.map +1 -1
  104. package/dist/pdpp/approval.d.ts +271 -0
  105. package/dist/pdpp/approval.d.ts.map +1 -0
  106. package/dist/pdpp/approval.js +467 -0
  107. package/dist/pdpp/approval.js.map +1 -0
  108. package/dist/pdpp/client-identity.d.ts +88 -0
  109. package/dist/pdpp/client-identity.d.ts.map +1 -0
  110. package/dist/pdpp/client-identity.js +196 -0
  111. package/dist/pdpp/client-identity.js.map +1 -0
  112. package/dist/pdpp/client-metadata.d.ts +95 -0
  113. package/dist/pdpp/client-metadata.d.ts.map +1 -0
  114. package/dist/pdpp/client-metadata.js +96 -0
  115. package/dist/pdpp/client-metadata.js.map +1 -0
  116. package/dist/pdpp/commitments.d.ts +75 -0
  117. package/dist/pdpp/commitments.d.ts.map +1 -0
  118. package/dist/pdpp/commitments.js +113 -0
  119. package/dist/pdpp/commitments.js.map +1 -0
  120. package/dist/pdpp/declaration.d.ts +118 -0
  121. package/dist/pdpp/declaration.d.ts.map +1 -0
  122. package/dist/pdpp/declaration.js +836 -0
  123. package/dist/pdpp/declaration.js.map +1 -0
  124. package/dist/pdpp/index.d.ts +37 -0
  125. package/dist/pdpp/index.d.ts.map +1 -0
  126. package/dist/pdpp/index.js +23 -0
  127. package/dist/pdpp/index.js.map +1 -0
  128. package/dist/pdpp/issuance.d.ts +126 -0
  129. package/dist/pdpp/issuance.d.ts.map +1 -0
  130. package/dist/pdpp/issuance.js +180 -0
  131. package/dist/pdpp/issuance.js.map +1 -0
  132. package/dist/pdpp/pkce.d.ts +53 -0
  133. package/dist/pdpp/pkce.d.ts.map +1 -0
  134. package/dist/pdpp/pkce.js +109 -0
  135. package/dist/pdpp/pkce.js.map +1 -0
  136. package/dist/pdpp/redirect.d.ts +60 -0
  137. package/dist/pdpp/redirect.d.ts.map +1 -0
  138. package/dist/pdpp/redirect.js +125 -0
  139. package/dist/pdpp/redirect.js.map +1 -0
  140. package/dist/pdpp/resolve.d.ts +109 -0
  141. package/dist/pdpp/resolve.d.ts.map +1 -0
  142. package/dist/pdpp/resolve.js +393 -0
  143. package/dist/pdpp/resolve.js.map +1 -0
  144. package/dist/pdpp/review.d.ts +280 -0
  145. package/dist/pdpp/review.d.ts.map +1 -0
  146. package/dist/pdpp/review.js +205 -0
  147. package/dist/pdpp/review.js.map +1 -0
  148. package/dist/pdpp/selection.d.ts +50 -0
  149. package/dist/pdpp/selection.d.ts.map +1 -0
  150. package/dist/pdpp/selection.js +442 -0
  151. package/dist/pdpp/selection.js.map +1 -0
  152. package/dist/pdpp/store.d.ts +228 -0
  153. package/dist/pdpp/store.d.ts.map +1 -0
  154. package/dist/pdpp/store.js +542 -0
  155. package/dist/pdpp/store.js.map +1 -0
  156. package/dist/pdpp/tokens.d.ts +181 -0
  157. package/dist/pdpp/tokens.d.ts.map +1 -0
  158. package/dist/pdpp/tokens.js +419 -0
  159. package/dist/pdpp/tokens.js.map +1 -0
  160. package/dist/pdpp/types.d.ts +441 -0
  161. package/dist/pdpp/types.d.ts.map +1 -0
  162. package/dist/pdpp/types.js +61 -0
  163. package/dist/pdpp/types.js.map +1 -0
  164. package/dist/pdpp-version.d.ts +28 -0
  165. package/dist/pdpp-version.d.ts.map +1 -0
  166. package/dist/pdpp-version.js +28 -0
  167. package/dist/pdpp-version.js.map +1 -0
  168. package/dist/policy/data-read.d.ts +24 -0
  169. package/dist/policy/data-read.d.ts.map +1 -1
  170. package/dist/policy/data-read.js +60 -3
  171. package/dist/policy/data-read.js.map +1 -1
  172. package/dist/policy/data-write.d.ts.map +1 -1
  173. package/dist/policy/data-write.js +3 -0
  174. package/dist/policy/data-write.js.map +1 -1
  175. package/dist/policy/index.d.ts +1 -0
  176. package/dist/policy/index.d.ts.map +1 -1
  177. package/dist/policy/index.js +1 -0
  178. package/dist/policy/index.js.map +1 -1
  179. package/dist/policy/reserved-scopes.d.ts +3 -0
  180. package/dist/policy/reserved-scopes.d.ts.map +1 -0
  181. package/dist/policy/reserved-scopes.js +5 -0
  182. package/dist/policy/reserved-scopes.js.map +1 -0
  183. package/dist/ports/index.d.ts +63 -0
  184. package/dist/ports/index.d.ts.map +1 -1
  185. package/dist/ports/index.js.map +1 -1
  186. package/dist/ports/pdpp-auth.d.ts +129 -0
  187. package/dist/ports/pdpp-auth.d.ts.map +1 -0
  188. package/dist/ports/pdpp-auth.js +60 -0
  189. package/dist/ports/pdpp-auth.js.map +1 -0
  190. package/dist/ports/pdpp-auth.test-utils.d.ts +9 -0
  191. package/dist/ports/pdpp-auth.test-utils.d.ts.map +1 -0
  192. package/dist/ports/pdpp-auth.test-utils.js +18 -0
  193. package/dist/ports/pdpp-auth.test-utils.js.map +1 -0
  194. package/dist/schemas/server-config.d.ts +44 -0
  195. package/dist/schemas/server-config.d.ts.map +1 -1
  196. package/dist/schemas/server-config.js +91 -0
  197. package/dist/schemas/server-config.js.map +1 -1
  198. package/dist/signing/request-signer.d.ts +2 -0
  199. package/dist/signing/request-signer.d.ts.map +1 -1
  200. package/dist/signing/request-signer.js +1 -0
  201. package/dist/signing/request-signer.js.map +1 -1
  202. package/dist/storage/adapters/interface.d.ts +3 -0
  203. package/dist/storage/adapters/interface.d.ts.map +1 -1
  204. package/dist/storage/adapters/vana-audience.d.ts +12 -0
  205. package/dist/storage/adapters/vana-audience.d.ts.map +1 -0
  206. package/dist/storage/adapters/vana-audience.js +72 -0
  207. package/dist/storage/adapters/vana-audience.js.map +1 -0
  208. package/dist/storage/adapters/vana.d.ts +2 -0
  209. package/dist/storage/adapters/vana.d.ts.map +1 -1
  210. package/dist/storage/adapters/vana.js +53 -20
  211. package/dist/storage/adapters/vana.js.map +1 -1
  212. package/dist/storage/canonical-legacy-projection.d.ts +262 -0
  213. package/dist/storage/canonical-legacy-projection.d.ts.map +1 -0
  214. package/dist/storage/canonical-legacy-projection.js +761 -0
  215. package/dist/storage/canonical-legacy-projection.js.map +1 -0
  216. package/dist/storage/index/manager.d.ts +29 -2
  217. package/dist/storage/index/manager.d.ts.map +1 -1
  218. package/dist/storage/index/schema.d.ts +1 -1
  219. package/dist/storage/index/schema.js +1 -1
  220. package/dist/storage/index/types.d.ts +7 -1
  221. package/dist/storage/index/types.d.ts.map +1 -1
  222. package/dist/storage/legacy-projection.d.ts +13 -10
  223. package/dist/storage/legacy-projection.d.ts.map +1 -1
  224. package/dist/storage/legacy-projection.js +269 -74
  225. package/dist/storage/legacy-projection.js.map +1 -1
  226. package/dist/storage/legacy-scope-coverage-exceptions.d.ts +8 -0
  227. package/dist/storage/legacy-scope-coverage-exceptions.d.ts.map +1 -0
  228. package/dist/storage/legacy-scope-coverage-exceptions.js +10 -0
  229. package/dist/storage/legacy-scope-coverage-exceptions.js.map +1 -0
  230. package/dist/storage/legacy-scope-coverage.d.ts +53 -0
  231. package/dist/storage/legacy-scope-coverage.d.ts.map +1 -0
  232. package/dist/storage/legacy-scope-coverage.js +403 -0
  233. package/dist/storage/legacy-scope-coverage.js.map +1 -0
  234. package/dist/storage/legacy-scope-entity-keys.d.ts +4 -0
  235. package/dist/storage/legacy-scope-entity-keys.d.ts.map +1 -0
  236. package/dist/storage/legacy-scope-entity-keys.js +92 -0
  237. package/dist/storage/legacy-scope-entity-keys.js.map +1 -0
  238. package/dist/storage/legacy-scope-view.d.ts +154 -0
  239. package/dist/storage/legacy-scope-view.d.ts.map +1 -0
  240. package/dist/storage/legacy-scope-view.js +735 -0
  241. package/dist/storage/legacy-scope-view.js.map +1 -0
  242. package/dist/storage/pdpp-records/completion.d.ts +91 -0
  243. package/dist/storage/pdpp-records/completion.d.ts.map +1 -0
  244. package/dist/storage/pdpp-records/completion.js +170 -0
  245. package/dist/storage/pdpp-records/completion.js.map +1 -0
  246. package/dist/storage/pdpp-records/cursor.d.ts +41 -0
  247. package/dist/storage/pdpp-records/cursor.d.ts.map +1 -0
  248. package/dist/storage/pdpp-records/cursor.js +49 -0
  249. package/dist/storage/pdpp-records/cursor.js.map +1 -0
  250. package/dist/storage/pdpp-records/declaration-witness.d.ts +58 -0
  251. package/dist/storage/pdpp-records/declaration-witness.d.ts.map +1 -0
  252. package/dist/storage/pdpp-records/declaration-witness.js +230 -0
  253. package/dist/storage/pdpp-records/declaration-witness.js.map +1 -0
  254. package/dist/storage/pdpp-records/enforcement.d.ts +52 -0
  255. package/dist/storage/pdpp-records/enforcement.d.ts.map +1 -0
  256. package/dist/storage/pdpp-records/enforcement.js +116 -0
  257. package/dist/storage/pdpp-records/enforcement.js.map +1 -0
  258. package/dist/storage/pdpp-records/index.d.ts +5 -0
  259. package/dist/storage/pdpp-records/index.d.ts.map +1 -0
  260. package/dist/storage/pdpp-records/index.js +5 -0
  261. package/dist/storage/pdpp-records/index.js.map +1 -0
  262. package/dist/storage/pdpp-records/ingest-plan.d.ts +39 -0
  263. package/dist/storage/pdpp-records/ingest-plan.d.ts.map +1 -0
  264. package/dist/storage/pdpp-records/ingest-plan.js +103 -0
  265. package/dist/storage/pdpp-records/ingest-plan.js.map +1 -0
  266. package/dist/storage/pdpp-records/interface.d.ts +104 -0
  267. package/dist/storage/pdpp-records/interface.d.ts.map +1 -0
  268. package/dist/storage/pdpp-records/interface.js +2 -0
  269. package/dist/storage/pdpp-records/interface.js.map +1 -0
  270. package/dist/storage/pdpp-records/memory-store.d.ts +9 -0
  271. package/dist/storage/pdpp-records/memory-store.d.ts.map +1 -0
  272. package/dist/storage/pdpp-records/memory-store.js +466 -0
  273. package/dist/storage/pdpp-records/memory-store.js.map +1 -0
  274. package/dist/storage/pdpp-records/portable.d.ts +9 -0
  275. package/dist/storage/pdpp-records/portable.d.ts.map +1 -0
  276. package/dist/storage/pdpp-records/portable.js +8 -0
  277. package/dist/storage/pdpp-records/portable.js.map +1 -0
  278. package/dist/storage/pdpp-records/read-port.d.ts +44 -0
  279. package/dist/storage/pdpp-records/read-port.d.ts.map +1 -0
  280. package/dist/storage/pdpp-records/read-port.js +22 -0
  281. package/dist/storage/pdpp-records/read-port.js.map +1 -0
  282. package/dist/storage/pdpp-records/record-key.d.ts +52 -0
  283. package/dist/storage/pdpp-records/record-key.d.ts.map +1 -0
  284. package/dist/storage/pdpp-records/record-key.js +97 -0
  285. package/dist/storage/pdpp-records/record-key.js.map +1 -0
  286. package/dist/storage/pdpp-records/schema.d.ts +41 -0
  287. package/dist/storage/pdpp-records/schema.d.ts.map +1 -0
  288. package/dist/storage/pdpp-records/schema.js +153 -0
  289. package/dist/storage/pdpp-records/schema.js.map +1 -0
  290. package/dist/storage/pdpp-records/stream-declaration.d.ts +88 -0
  291. package/dist/storage/pdpp-records/stream-declaration.d.ts.map +1 -0
  292. package/dist/storage/pdpp-records/stream-declaration.js +57 -0
  293. package/dist/storage/pdpp-records/stream-declaration.js.map +1 -0
  294. package/dist/storage/pdpp-records/types.d.ts +138 -0
  295. package/dist/storage/pdpp-records/types.d.ts.map +1 -0
  296. package/dist/storage/pdpp-records/types.js +38 -0
  297. package/dist/storage/pdpp-records/types.js.map +1 -0
  298. package/dist/sync/data-point-feed.d.ts +3 -0
  299. package/dist/sync/data-point-feed.d.ts.map +1 -1
  300. package/dist/sync/data-point-feed.js +17 -1
  301. package/dist/sync/data-point-feed.js.map +1 -1
  302. package/dist/sync/delete-data-port.d.ts +2 -0
  303. package/dist/sync/delete-data-port.d.ts.map +1 -1
  304. package/dist/sync/delete-data-port.js +1 -1
  305. package/dist/sync/delete-data-port.js.map +1 -1
  306. package/dist/sync/engine/sync-manager.d.ts.map +1 -1
  307. package/dist/sync/engine/sync-manager.js +5 -2
  308. package/dist/sync/engine/sync-manager.js.map +1 -1
  309. package/dist/sync/index.d.ts +3 -1
  310. package/dist/sync/index.d.ts.map +1 -1
  311. package/dist/sync/index.js +4 -0
  312. package/dist/sync/index.js.map +1 -1
  313. package/dist/sync/pdpp-import.d.ts +192 -0
  314. package/dist/sync/pdpp-import.d.ts.map +1 -0
  315. package/dist/sync/pdpp-import.js +441 -0
  316. package/dist/sync/pdpp-import.js.map +1 -0
  317. package/dist/sync/scope-deletions.d.ts +10 -0
  318. package/dist/sync/scope-deletions.d.ts.map +1 -1
  319. package/dist/sync/scope-deletions.js +40 -7
  320. package/dist/sync/scope-deletions.js.map +1 -1
  321. package/dist/sync/workers/download.d.ts +14 -0
  322. package/dist/sync/workers/download.d.ts.map +1 -1
  323. package/dist/sync/workers/download.js +149 -13
  324. package/dist/sync/workers/download.js.map +1 -1
  325. package/dist/sync/workers/upload.d.ts +2 -0
  326. package/dist/sync/workers/upload.d.ts.map +1 -1
  327. package/dist/sync/workers/upload.js +7 -0
  328. package/dist/sync/workers/upload.js.map +1 -1
  329. package/dist/test-utils/memory-storage.d.ts +1 -1
  330. package/dist/test-utils/memory-storage.d.ts.map +1 -1
  331. package/dist/test-utils/memory-storage.js +11 -5
  332. package/dist/test-utils/memory-storage.js.map +1 -1
  333. package/package.json +54 -4
@@ -0,0 +1,104 @@
1
+ import type { RecordDataValidator } from "./ingest-plan.js";
2
+ import type { ChangesSinceOptions, ChangesSincePage, IngestResult, ListRecordsOptions, ListRecordsPage, PdppBlobMeta, PdppRecordEnvelopeInput, PdppStoredRecord, StreamListing, StreamSemantics } from "./types.js";
3
+ /**
4
+ * Persistence index for PDPP records. Implementable by a SQLite backend
5
+ * (desktop, `sqlite-store.ts`) and an in-memory backend that stands in for
6
+ * the Enclave runtime (`memory-store.ts`) — real Enclave persistence
7
+ * integration needs the supplied Enclave runtime and is out of scope here.
8
+ */
9
+ export interface PdppRecordStore {
10
+ /**
11
+ * Decides each envelope with `planIngest` and writes the accepted ones
12
+ * atomically: a thrown error rolls back every write from this call, it
13
+ * never leaves partial version/history state. Each envelope gets exactly
14
+ * one outcome in `results`. A rejected envelope writes nothing and does
15
+ * not fail the rest of the batch. An `unchanged` envelope writes nothing
16
+ * either: no version, no history row, no write-clock tick.
17
+ *
18
+ * Declarations are looked up per envelope by `(stream, instance)`, since
19
+ * one stream name can belong to several sources.
20
+ *
21
+ * The SQLite PS backend also accepts a method and generation. It validates
22
+ * the generation in this transaction and binds an empty instance to that
23
+ * method with its first accepted write. That backend rejects every
24
+ * envelope of a call that omits the binding, with `method_required`.
25
+ *
26
+ * `validateData` rejects an upsert whose data does not conform to the
27
+ * declared stream schema; that envelope writes nothing.
28
+ */
29
+ ingestBatch(envelopes: PdppRecordEnvelopeInput[], streamSemantics: (stream: string, instance: string) => StreamSemantics, primaryKeyFields: (stream: string, instance: string) => string[], binding?: {
30
+ method: string;
31
+ generation: number;
32
+ }, validateData?: RecordDataValidator): IngestResult;
33
+ getRecord(instance: string, stream: string, recordKey: string): PdppStoredRecord | undefined;
34
+ listRecords(stream: string, options: ListRecordsOptions): ListRecordsPage;
35
+ /**
36
+ * Owner-authenticated explicit delete directive (DELETE endpoint). Only
37
+ * valid for mutable_state streams; returns false if the stream is
38
+ * append_only or the record does not exist.
39
+ */
40
+ deleteRecord(instance: string, stream: string, recordKey: string, deletedAt: string, streamSemantics: StreamSemantics): boolean;
41
+ changesSince(stream: string, options: ChangesSinceOptions): ChangesSincePage;
42
+ listStreams(instanceIds: string[]): StreamListing[];
43
+ putBlobMeta(meta: PdppBlobMeta): void;
44
+ getBlobMeta(blobId: string): PdppBlobMeta | undefined;
45
+ /**
46
+ * Atomically persists blob bytes and their metadata together (metadata and
47
+ * bytes are never written as two separate, independently-failable steps —
48
+ * the existing-row check and the write happen inside one transaction, not
49
+ * a check followed by a racing upsert). blob_id is derived from the bytes
50
+ * themselves (content-addressed: `sha256:<hex>`, this store's own
51
+ * convention, not a spec-core requirement), not supplied by the caller —
52
+ * a producer cannot claim an arbitrary id for its bytes, and identical
53
+ * bytes always resolve to the same blob_id regardless of which ingest
54
+ * wrote them first.
55
+ *
56
+ * Re-storing bytes that hash to an already-known blob_id is a verified
57
+ * no-op only when mimeType matches AND the previously-stored bytes
58
+ * actually still hash/size-match their own recorded metadata:
59
+ * - metadata-only row (no bytes ever stored, e.g. a legacy fixture that
60
+ * called `putBlobMeta` directly): completed by writing the bytes now.
61
+ * - existing bytes verified intact and mimeType matches: idempotent
62
+ * no-op, returns the existing metadata unchanged.
63
+ * - existing bytes present but corrupt/truncated relative to their own
64
+ * metadata: throws BlobConflictError rather than silently reporting
65
+ * success over content that can no longer be trusted, or silently
66
+ * overwriting it as if this were the first write.
67
+ * - mimeType differs from the existing record (regardless of byte
68
+ * health): throws BlobConflictError — refusing to let a second write
69
+ * silently redefine what an existing blob_id means.
70
+ */
71
+ storeBlobBytes(bytes: Uint8Array, mimeType: string): PdppBlobMeta;
72
+ /**
73
+ * Reads back bytes for a blob_id, verifying the stored payload's actual
74
+ * size and SHA-256 still match the recorded metadata before returning
75
+ * anything. Returns undefined when the blob has metadata-only rows (legacy
76
+ * or test fixtures that called `putBlobMeta` directly), no bytes were ever
77
+ * stored, or the stored bytes are corrupt/truncated relative to their own
78
+ * metadata -- fail closed rather than deliver unverified bytes under a
79
+ * trusted-looking 200.
80
+ */
81
+ getBlobBytes(blobId: string): Uint8Array<ArrayBuffer> | undefined;
82
+ /**
83
+ * Finds every non-deleted record that references a `blob_id` via
84
+ * `data.blob_ref.blob_id` (spec §4 "Binary data (blob_ref)"). Identical
85
+ * blob bytes can legitimately be referenced by more than one record or
86
+ * instance, so callers must check every returned reference and grant
87
+ * access if ANY one passes their authorization constraints (spec §8 "Get
88
+ * a blob") -- an inaccessible reference must never hide an accessible
89
+ * one. A `blob_id` alone is never sufficient to authorize access: the
90
+ * resource server must verify the grant includes a stream containing a
91
+ * record that references this blob, that record passes all grant
92
+ * filters, and `blob_ref` is in the grant's authorized field projection.
93
+ * Returns an empty array if no ingested record currently references this
94
+ * blob_id.
95
+ */
96
+ findBlobReferences(blobId: string): BlobReference[];
97
+ close(): void;
98
+ }
99
+ export interface BlobReference {
100
+ instance: string;
101
+ stream: string;
102
+ recordKey: string;
103
+ }
104
+ //# sourceMappingURL=interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/storage/pdpp-records/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CACT,SAAS,EAAE,uBAAuB,EAAE,EACpC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,K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AAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/storage/pdpp-records/interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import type { PdppRecordStore } from "./interface.js";
2
+ /**
3
+ * In-memory PdppRecordStore. Stands in for the Enclave runtime for this
4
+ * lane's own tests and as a second implementation of the shared interface.
5
+ * This is NOT a real Enclave persistence integration — that needs the
6
+ * supplied Enclave runtime, which this lane does not have access to.
7
+ */
8
+ export declare function createMemoryRecordStore(): PdppRecordStore;
9
+ //# sourceMappingURL=memory-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../../src/storage/pdpp-records/memory-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAsDtD;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,eAAe,CAsgBzD"}
@@ -0,0 +1,466 @@
1
+ import { createHash } from "node:crypto";
2
+ import { randomUUID } from "node:crypto";
3
+ import { planIngest, summarizeIngest, } from "./ingest-plan.js";
4
+ import { decodeCursor, encodeCursor } from "./cursor.js";
5
+ import { BlobConflictError, CursorExpiredError, InvalidCursorError, } from "./types.js";
6
+ import { InvalidCursorSyntaxError } from "./cursor.js";
7
+ function blobIdForBytes(bytes) {
8
+ return `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
9
+ }
10
+ function rowKey(instance, stream, recordKey) {
11
+ return `${instance}\0${stream}\0${recordKey}`;
12
+ }
13
+ function parseOffset(value) {
14
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
15
+ throw new InvalidCursorError();
16
+ }
17
+ return value;
18
+ }
19
+ /**
20
+ * In-memory PdppRecordStore. Stands in for the Enclave runtime for this
21
+ * lane's own tests and as a second implementation of the shared interface.
22
+ * This is NOT a real Enclave persistence integration — that needs the
23
+ * supplied Enclave runtime, which this lane does not have access to.
24
+ */
25
+ export function createMemoryRecordStore() {
26
+ const current = new Map();
27
+ const history = [];
28
+ const blobs = new Map();
29
+ const blobBytes = new Map();
30
+ const epoch = randomUUID();
31
+ let writeClock = 0; // monotonic logical clock, avoids wall-clock ties in tests
32
+ function nextWriteTimestamp() {
33
+ writeClock += 1;
34
+ // Encode as an ISO-ish sortable string using the logical clock so
35
+ // multiple writes within the same millisecond still order correctly.
36
+ return new Date(writeClock).toISOString();
37
+ }
38
+ function cursorEpoch() {
39
+ return epoch;
40
+ }
41
+ function assertCursorScope(payload, stream) {
42
+ if (payload.stream !== stream) {
43
+ throw new CursorExpiredError();
44
+ }
45
+ if (payload.epoch !== cursorEpoch()) {
46
+ throw new CursorExpiredError();
47
+ }
48
+ }
49
+ function ingestBatch(envelopes, streamSemantics, primaryKeyFields, _binding, validateData) {
50
+ const results = [];
51
+ // Stage writes and commit them together, so a thrown error leaves no
52
+ // partial state (the in-memory twin of the SQLite transaction). Later
53
+ // envelopes read the staged rows, so two envelopes for one key are
54
+ // decided in order.
55
+ const staged = new Map();
56
+ const stagedHistory = [];
57
+ const read = (key) => staged.get(key) ?? current.get(key);
58
+ envelopes.forEach((envelope, index) => {
59
+ const plan = planIngest(index, envelope, streamSemantics(envelope.stream, envelope.instance), primaryKeyFields(envelope.stream, envelope.instance), (recordKey) => {
60
+ const row = read(rowKey(envelope.instance, envelope.stream, recordKey));
61
+ if (!row)
62
+ return undefined;
63
+ return row.deleted
64
+ ? { deleted: true, data: null }
65
+ : { deleted: false, data: row.data };
66
+ }, validateData);
67
+ results.push(plan.outcome);
68
+ if (!plan.write)
69
+ return;
70
+ const { recordKey, data } = plan.write;
71
+ const key = rowKey(envelope.instance, envelope.stream, recordKey);
72
+ const version = (read(key)?.version ?? 0) + 1;
73
+ const row = data === null
74
+ ? {
75
+ instance: envelope.instance,
76
+ stream: envelope.stream,
77
+ recordKey,
78
+ version,
79
+ deletedAt: envelope.emitted_at,
80
+ emittedAt: envelope.emitted_at,
81
+ deleted: true,
82
+ }
83
+ : {
84
+ instance: envelope.instance,
85
+ stream: envelope.stream,
86
+ recordKey,
87
+ data,
88
+ version,
89
+ emittedAt: envelope.emitted_at,
90
+ deleted: false,
91
+ };
92
+ staged.set(key, row);
93
+ stagedHistory.push({
94
+ instance: envelope.instance,
95
+ stream: envelope.stream,
96
+ recordKey,
97
+ version,
98
+ writtenAt: nextWriteTimestamp(),
99
+ row,
100
+ });
101
+ });
102
+ for (const [key, row] of staged)
103
+ current.set(key, row);
104
+ history.push(...stagedHistory);
105
+ return summarizeIngest(results);
106
+ }
107
+ function getRecord(instance, stream, recordKey) {
108
+ const row = current.get(rowKey(instance, stream, recordKey));
109
+ if (!row || row.deleted)
110
+ return undefined;
111
+ return row;
112
+ }
113
+ function projectFields(data, fields) {
114
+ if (!fields)
115
+ return data;
116
+ const projected = {};
117
+ for (const field of fields) {
118
+ if (field in data)
119
+ projected[field] = data[field];
120
+ }
121
+ return projected;
122
+ }
123
+ function sortKey(row) {
124
+ // cursor_field is modeled here as emittedAt (stand-in for the declared
125
+ // cursor_field — the ingest path only knows emitted_at, per-stream
126
+ // declared cursor fields are a SourceDeclaration concern the RS route
127
+ // layer resolves before calling into the store).
128
+ return [row.emittedAt, row.recordKey];
129
+ }
130
+ function listRecords(stream, options) {
131
+ let startAfter = null;
132
+ if (options.cursor) {
133
+ const payload = decodeCursor(options.cursor);
134
+ if (payload.kind !== "list")
135
+ throw new InvalidCursorError();
136
+ assertCursorScope(payload, stream);
137
+ if (payload.order !== options.order)
138
+ throw new InvalidCursorError();
139
+ startAfter = [payload.sortValue ?? "", payload.recordKey];
140
+ }
141
+ const rows = Array.from(current.values()).filter((row) => !row.deleted &&
142
+ row.stream === stream &&
143
+ options.instanceIds.includes(row.instance));
144
+ rows.sort((a, b) => {
145
+ const [aVal, aKey] = sortKey(a);
146
+ const [bVal, bKey] = sortKey(b);
147
+ const cmp = aVal === bVal ? aKey.localeCompare(bKey) : aVal < bVal ? -1 : 1;
148
+ return options.order === "asc" ? cmp : -cmp;
149
+ });
150
+ let filtered = rows;
151
+ if (startAfter) {
152
+ const [afterVal, afterKey] = startAfter;
153
+ filtered = rows.filter((row) => {
154
+ const [val, key] = sortKey(row);
155
+ const cmp = val === afterVal
156
+ ? key.localeCompare(afterKey)
157
+ : val < afterVal
158
+ ? -1
159
+ : 1;
160
+ return options.order === "asc" ? cmp > 0 : cmp < 0;
161
+ });
162
+ }
163
+ const page = filtered.slice(0, options.limit);
164
+ const hasMore = filtered.length > options.limit;
165
+ const last = page[page.length - 1];
166
+ return {
167
+ data: page.map((row) => ({
168
+ ...row,
169
+ data: projectFields(row.data, options.fields),
170
+ })),
171
+ hasMore,
172
+ nextCursor: hasMore && last
173
+ ? encodeCursor({
174
+ kind: "list",
175
+ stream,
176
+ epoch: cursorEpoch(),
177
+ order: options.order,
178
+ sortValue: sortKey(last)[0],
179
+ recordKey: last.recordKey,
180
+ })
181
+ : undefined,
182
+ };
183
+ }
184
+ function deleteRecord(instance, stream, recordKey, deletedAt, streamSemantics) {
185
+ if (streamSemantics === "append_only")
186
+ return false;
187
+ const key = rowKey(instance, stream, recordKey);
188
+ const existing = current.get(key);
189
+ if (!existing || existing.deleted)
190
+ return false;
191
+ const version = existing.version + 1;
192
+ const tombstone = {
193
+ instance,
194
+ stream,
195
+ recordKey,
196
+ version,
197
+ deletedAt,
198
+ emittedAt: deletedAt,
199
+ deleted: true,
200
+ };
201
+ current.set(key, tombstone);
202
+ history.push({
203
+ instance,
204
+ stream,
205
+ recordKey,
206
+ version,
207
+ writtenAt: nextWriteTimestamp(),
208
+ row: tombstone,
209
+ });
210
+ return true;
211
+ }
212
+ function changesSince(stream, options) {
213
+ let horizon;
214
+ let sinceHorizon;
215
+ let offset = 0;
216
+ if (options.cursor) {
217
+ // Continuing an already-anchored session: horizon and sinceHorizon
218
+ // both come from the page cursor, not re-derived from changesSince.
219
+ const payload = decodeCursor(options.cursor);
220
+ if (payload.kind !== "changes_since")
221
+ throw new InvalidCursorError();
222
+ assertCursorScope(payload, stream);
223
+ horizon = payload.horizon;
224
+ sinceHorizon = payload.sinceHorizon;
225
+ offset = parseOffset(payload.offset);
226
+ }
227
+ else if (options.changesSince) {
228
+ let payload;
229
+ try {
230
+ payload = decodeCursor(options.changesSince);
231
+ }
232
+ catch (err) {
233
+ if (err instanceof InvalidCursorSyntaxError) {
234
+ throw new CursorExpiredError();
235
+ }
236
+ throw err;
237
+ }
238
+ if (payload.kind !== "changes_since")
239
+ throw new InvalidCursorError();
240
+ assertCursorScope(payload, stream);
241
+ // The incoming token is the *previous* session's horizon. This
242
+ // session's page-1 horizon is anchored fresh at "now" so writes that
243
+ // land mid-session don't leak into this session's later pages.
244
+ sinceHorizon = payload.horizon;
245
+ horizon = nextWriteTimestamp();
246
+ }
247
+ else {
248
+ // First-ever sync: no baseline, every current record is "changed".
249
+ sinceHorizon = null;
250
+ horizon = nextWriteTimestamp();
251
+ }
252
+ // Every write strictly after `horizon` is excluded from every page of
253
+ // this session (session-horizon anchoring) — new writes surface only
254
+ // via the next session's `changes_since`.
255
+ const relevant = history.filter((entry) => entry.stream === stream &&
256
+ options.instanceIds.includes(entry.instance) &&
257
+ entry.writtenAt <= horizon);
258
+ const latestAsOfHorizon = new Map();
259
+ for (const entry of relevant) {
260
+ const k = rowKey(entry.instance, entry.stream, entry.recordKey);
261
+ const prior = latestAsOfHorizon.get(k);
262
+ if (!prior || entry.version > prior.version) {
263
+ latestAsOfHorizon.set(k, entry);
264
+ }
265
+ }
266
+ const changed = [];
267
+ for (const entry of latestAsOfHorizon.values()) {
268
+ if (sinceHorizon !== null) {
269
+ const wroteSincePrior = history.some((h) => h.stream === entry.stream &&
270
+ h.recordKey === entry.recordKey &&
271
+ h.instance === entry.instance &&
272
+ h.writtenAt > sinceHorizon &&
273
+ h.writtenAt <= horizon);
274
+ if (!wroteSincePrior)
275
+ continue;
276
+ }
277
+ if (entry.row.deleted) {
278
+ changed.push(entry.row);
279
+ continue;
280
+ }
281
+ const projectedNow = projectFields(entry.row.data, options.fields);
282
+ if (sinceHorizon !== null && options.fields) {
283
+ // Eligibility MUST be computed on the grant-authorized projection
284
+ // (spec §4): if only unauthorized fields changed since the prior
285
+ // session horizon, this record must not appear as "changed".
286
+ const priorEntry = [...history]
287
+ .filter((h) => h.stream === entry.stream &&
288
+ h.recordKey === entry.recordKey &&
289
+ h.instance === entry.instance &&
290
+ h.writtenAt <= sinceHorizon)
291
+ .sort((a, b) => b.version - a.version)[0];
292
+ if (priorEntry && !priorEntry.row.deleted) {
293
+ const priorProjected = projectFields(priorEntry.row.data, options.fields);
294
+ if (JSON.stringify(priorProjected) === JSON.stringify(projectedNow)) {
295
+ continue;
296
+ }
297
+ }
298
+ }
299
+ // Return the RAW (unprojected) row here, not `projectedNow`. Eligibility
300
+ // above legitimately needs the grant-authorized projection to decide
301
+ // "did the authorized fields change" without leaking a hidden-field
302
+ // change. But a caller enforcing time_constraint against `row.data`
303
+ // (packages/server/src/routes/pdpp-records.ts) needs the real field
304
+ // value, not one already stripped to the grant's fields — projecting
305
+ // here would silently break that filter for any grant whose fields
306
+ // don't happen to include the time_constraint field. Field projection
307
+ // for the response is the caller's job, applied AFTER any filtering
308
+ // that reads real field values.
309
+ changed.push(entry.row);
310
+ }
311
+ changed.sort((a, b) => a.recordKey.localeCompare(b.recordKey));
312
+ const page = changed.slice(offset, offset + options.limit);
313
+ const hasMore = offset + options.limit < changed.length;
314
+ return {
315
+ data: page,
316
+ hasMore,
317
+ nextCursor: hasMore
318
+ ? encodeCursor({
319
+ kind: "changes_since",
320
+ stream,
321
+ epoch: cursorEpoch(),
322
+ horizon,
323
+ sinceHorizon,
324
+ offset: offset + options.limit,
325
+ })
326
+ : undefined,
327
+ nextChangesSince: hasMore
328
+ ? undefined
329
+ : encodeCursor({
330
+ kind: "changes_since",
331
+ stream,
332
+ epoch: cursorEpoch(),
333
+ horizon,
334
+ sinceHorizon: null,
335
+ offset: 0,
336
+ }),
337
+ };
338
+ }
339
+ function listStreams(instanceIds) {
340
+ const byStream = new Map();
341
+ for (const row of current.values()) {
342
+ if (row.deleted)
343
+ continue;
344
+ if (!instanceIds.includes(row.instance))
345
+ continue;
346
+ const entry = byStream.get(row.stream) ?? { count: 0, lastUpdated: null };
347
+ entry.count += 1;
348
+ const updated = row.emittedAt;
349
+ if (!entry.lastUpdated || updated > entry.lastUpdated) {
350
+ entry.lastUpdated = updated;
351
+ }
352
+ byStream.set(row.stream, entry);
353
+ }
354
+ return Array.from(byStream.entries()).map(([stream, v]) => ({
355
+ stream,
356
+ recordCount: v.count,
357
+ lastUpdated: v.lastUpdated,
358
+ }));
359
+ }
360
+ function findBlobReferences(blobId) {
361
+ // Scanned on demand rather than maintained as a separate mutable index:
362
+ // this store already holds every current row in memory, and a scan
363
+ // avoids a second piece of state that could drift from `current` on
364
+ // every ingest/delete. A record's blob reference lives at
365
+ // `data.blob_ref.blob_id` per spec §4 "Binary data (blob_ref)". Every
366
+ // matching non-deleted row is returned -- identical bytes can
367
+ // legitimately be referenced by more than one record.
368
+ const references = [];
369
+ for (const row of current.values()) {
370
+ if (row.deleted)
371
+ continue;
372
+ const blobRef = row.data.blob_ref;
373
+ if (blobRef &&
374
+ typeof blobRef === "object" &&
375
+ blobRef.blob_id === blobId) {
376
+ references.push({
377
+ instance: row.instance,
378
+ stream: row.stream,
379
+ recordKey: row.recordKey,
380
+ });
381
+ }
382
+ }
383
+ return references;
384
+ }
385
+ /** True only when the stored bytes actually hash/size-match `meta`. */
386
+ function storedBytesVerify(meta) {
387
+ const bytes = blobBytes.get(meta.blobId);
388
+ if (!bytes)
389
+ return false;
390
+ if (bytes.byteLength !== meta.sizeBytes)
391
+ return false;
392
+ return createHash("sha256").update(bytes).digest("hex") === meta.sha256;
393
+ }
394
+ function storeBlobBytes(bytes, mimeType) {
395
+ const blobId = blobIdForBytes(bytes);
396
+ const existing = blobs.get(blobId);
397
+ if (existing) {
398
+ const sha256 = blobId.slice("sha256:".length);
399
+ if (existing.mimeType !== mimeType ||
400
+ existing.sha256 !== sha256 ||
401
+ existing.sizeBytes !== bytes.byteLength) {
402
+ throw new BlobConflictError(blobId, existing);
403
+ }
404
+ if (!blobBytes.has(existing.blobId)) {
405
+ // Metadata-only row (legacy/test fixture via putBlobMeta, or a prior
406
+ // write that never got this far): complete it with real bytes now,
407
+ // rather than reporting a false "already stored" no-op.
408
+ blobBytes.set(blobId, bytes.slice());
409
+ return existing;
410
+ }
411
+ if (!storedBytesVerify(existing)) {
412
+ // Bytes are present but corrupt relative to their own metadata.
413
+ // Reporting success here would hand back an existing-looking
414
+ // success while the underlying content stays broken; refuse
415
+ // instead of silently repairing or silently succeeding.
416
+ throw new BlobConflictError(blobId, existing);
417
+ }
418
+ // Verified idempotent no-op: content and mimeType both match.
419
+ return existing;
420
+ }
421
+ const sha256 = blobId.slice("sha256:".length);
422
+ const meta = {
423
+ blobId,
424
+ mimeType,
425
+ sizeBytes: bytes.byteLength,
426
+ sha256,
427
+ };
428
+ // Bytes and metadata become visible together: no reader can observe one
429
+ // without the other.
430
+ blobBytes.set(blobId, bytes.slice());
431
+ blobs.set(blobId, meta);
432
+ return meta;
433
+ }
434
+ function getBlobBytes(blobId) {
435
+ const meta = blobs.get(blobId);
436
+ const bytes = blobBytes.get(blobId);
437
+ if (!meta || !bytes)
438
+ return undefined;
439
+ if (bytes.byteLength !== meta.sizeBytes)
440
+ return undefined;
441
+ const actualHash = createHash("sha256").update(bytes).digest("hex");
442
+ if (actualHash !== meta.sha256)
443
+ return undefined;
444
+ return bytes.slice();
445
+ }
446
+ return {
447
+ ingestBatch,
448
+ getRecord,
449
+ listRecords,
450
+ deleteRecord,
451
+ changesSince,
452
+ listStreams,
453
+ putBlobMeta: (meta) => blobs.set(meta.blobId, meta),
454
+ getBlobMeta: (blobId) => blobs.get(blobId),
455
+ storeBlobBytes,
456
+ getBlobBytes,
457
+ findBlobReferences,
458
+ close: () => {
459
+ current.clear();
460
+ history.length = 0;
461
+ blobs.clear();
462
+ blobBytes.clear();
463
+ },
464
+ };
465
+ }
466
+ //# sourceMappingURL=memory-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-store.js","sourceRoot":"","sources":["../../../src/storage/pdpp-records/memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,UAAU,EACV,eAAe,GAEhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GAcnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,SAAS,cAAc,CAAC,KAAiB;IACvC,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACtE,CAAC;AAID,SAAS,MAAM,CAAC,QAAgB,EAAE,MAAc,EAAE,SAAiB;IACjE,OAAO,GAAG,QAAQ,KAAK,MAAM,KAAK,SAAS,EAAE,CAAC;AAChD,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC3E,MAAM,IAAI,kBAAkB,EAAE,CAAC;IACjC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAYD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,OAAO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CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpE,IAAI,UAAU,KAAK,IAAI,CAAC,MAAM;YAAE,OAAO,SAAS,CAAC;QACjD,OAAO,KAAK,CAAC,KAAK,EAA6B,CAAC;IAClD,CAAC;IAED,OAAO;QACL,WAAW;QACX,SAAS;QACT,WAAW;QACX,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,WAAW,EAAE,CAAC,IAAkB,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC;QACjE,WAAW,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;QAClD,cAAc;QACd,YAAY;QACZ,kBAAkB;QAClB,KAAK,EAAE,GAAG,EAAE;YACV,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;YACnB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,SAAS,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /** Record decisions and contracts shared by Node and browser runtimes. */
2
+ export * from "./types.js";
3
+ export type { PdppRecordStore, BlobReference } from "./interface.js";
4
+ export { encodeRecordKey, computeRecordKeyFromData, keyMatchesData, RecordKeyError, } from "./record-key.js";
5
+ export * from "./cursor.js";
6
+ export * from "./ingest-plan.js";
7
+ export * from "./stream-declaration.js";
8
+ export * from "./enforcement.js";
9
+ //# sourceMappingURL=portable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portable.d.ts","sourceRoot":"","sources":["../../../src/storage/pdpp-records/portable.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,cAAc,YAAY,CAAC;AAC3B,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,cAAc,EACd,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** Record decisions and contracts shared by Node and browser runtimes. */
2
+ export * from "./types.js";
3
+ export { encodeRecordKey, computeRecordKeyFromData, keyMatchesData, RecordKeyError, } from "./record-key.js";
4
+ export * from "./cursor.js";
5
+ export * from "./ingest-plan.js";
6
+ export * from "./stream-declaration.js";
7
+ export * from "./enforcement.js";
8
+ //# sourceMappingURL=portable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portable.js","sourceRoot":"","sources":["../../../src/storage/pdpp-records/portable.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,cAAc,YAAY,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,cAAc,EACd,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC"}