@honua/react 0.1.2-beta.0 → 0.1.4-beta.0

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 (281) hide show
  1. package/contract/discovery.d.ts +34 -0
  2. package/contract/discovery.d.ts.map +1 -1
  3. package/contract/index.d.ts +7 -5
  4. package/contract/index.d.ts.map +1 -1
  5. package/contract/index.js +3 -2
  6. package/contract/pmtiles.d.ts +10 -1
  7. package/contract/pmtiles.d.ts.map +1 -1
  8. package/contract/pmtiles.js +10 -2
  9. package/contract/protocol-module.d.ts +84 -9
  10. package/contract/protocol-module.d.ts.map +1 -1
  11. package/contract/query-filter-fes.d.ts +18 -0
  12. package/contract/query-filter-fes.d.ts.map +1 -0
  13. package/contract/query-filter-fes.js +122 -0
  14. package/contract/query-filter.d.ts +300 -0
  15. package/contract/query-filter.d.ts.map +1 -0
  16. package/contract/query-filter.js +883 -0
  17. package/contract/schema.d.ts +12 -0
  18. package/contract/schema.d.ts.map +1 -1
  19. package/contract/schema.js +34 -0
  20. package/contract/source-capability-support.d.ts.map +1 -1
  21. package/contract/source-capability-support.js +15 -3
  22. package/contract/source.d.ts +45 -25
  23. package/contract/source.d.ts.map +1 -1
  24. package/contract/source.js +719 -479
  25. package/contract/types.d.ts +87 -18
  26. package/contract/types.d.ts.map +1 -1
  27. package/contract/widget-source.d.ts.map +1 -1
  28. package/core/client.d.ts +45 -21
  29. package/core/client.d.ts.map +1 -1
  30. package/core/client.js +224 -46
  31. package/core/error-classifications.d.ts +6 -0
  32. package/core/error-classifications.d.ts.map +1 -1
  33. package/core/error-classifications.js +6 -0
  34. package/core/error-code-registry.d.ts +6 -0
  35. package/core/error-code-registry.d.ts.map +1 -1
  36. package/core/error-code-registry.js +6 -0
  37. package/core/error-envelope.js +2 -0
  38. package/core/errors.d.ts +1 -1
  39. package/core/errors.js +1 -1
  40. package/core/geoparquet-sql.d.ts +68 -4
  41. package/core/geoparquet-sql.d.ts.map +1 -1
  42. package/core/geoparquet-sql.js +325 -8
  43. package/core/odata-write-codec.d.ts.map +1 -1
  44. package/core/odata-write-codec.js +0 -1
  45. package/core/odata.d.ts +6 -0
  46. package/core/odata.d.ts.map +1 -1
  47. package/core/odata.js +6 -1
  48. package/core/ogc-processes.d.ts +182 -25
  49. package/core/ogc-processes.d.ts.map +1 -1
  50. package/core/ogc-processes.js +602 -30
  51. package/core/process-runner.d.ts +8 -1
  52. package/core/process-runner.d.ts.map +1 -1
  53. package/core/process-runner.js +1 -0
  54. package/core/protocol-transport.d.ts +2 -0
  55. package/core/protocol-transport.d.ts.map +1 -1
  56. package/core/stac.d.ts +31 -0
  57. package/core/stac.d.ts.map +1 -1
  58. package/core/stac.js +136 -19
  59. package/core/surfaces.d.ts.map +1 -1
  60. package/core/surfaces.js +273 -68
  61. package/core/types.d.ts +123 -9
  62. package/core/types.d.ts.map +1 -1
  63. package/core/wfs-axis-order.d.ts +18 -0
  64. package/core/wfs-axis-order.d.ts.map +1 -0
  65. package/core/wfs-axis-order.js +108 -0
  66. package/core/wfs-capabilities.d.ts +65 -24
  67. package/core/wfs-capabilities.d.ts.map +1 -1
  68. package/core/wfs-capabilities.js +237 -27
  69. package/core/wfs-filter.d.ts +26 -3
  70. package/core/wfs-filter.d.ts.map +1 -1
  71. package/core/wfs-filter.js +48 -53
  72. package/core/wfs-protocol-error.d.ts +12 -0
  73. package/core/wfs-protocol-error.d.ts.map +1 -0
  74. package/core/wfs-protocol-error.js +13 -0
  75. package/core/wfs.d.ts +53 -1
  76. package/core/wfs.d.ts.map +1 -1
  77. package/core/wfs.js +251 -29
  78. package/core/wms-feature-info.d.ts +92 -0
  79. package/core/wms-feature-info.d.ts.map +1 -0
  80. package/core/wms-feature-info.js +285 -0
  81. package/core/wms.d.ts +9 -0
  82. package/core/wms.d.ts.map +1 -1
  83. package/core/wms.js +17 -5
  84. package/esri-compat/event-bus.d.ts +20 -0
  85. package/esri-compat/event-bus.d.ts.map +1 -1
  86. package/esri-compat/feature-filter.d.ts +46 -1
  87. package/esri-compat/feature-filter.d.ts.map +1 -1
  88. package/esri-compat/feature-filter.js +49 -0
  89. package/esri-compat/geojson-layer.d.ts +4 -2
  90. package/esri-compat/geojson-layer.d.ts.map +1 -1
  91. package/esri-compat/geojson-layer.js +4 -2
  92. package/esri-compat/identity-manager.js +2 -2
  93. package/esri-compat/imagery-layer.d.ts +2 -1
  94. package/esri-compat/imagery-layer.d.ts.map +1 -1
  95. package/esri-compat/imagery-layer.js +2 -1
  96. package/esri-compat/layer-list.d.ts +8 -1
  97. package/esri-compat/layer-list.d.ts.map +1 -1
  98. package/esri-compat/layer-list.js +11 -4
  99. package/esri-compat/legend.d.ts.map +1 -1
  100. package/esri-compat/legend.js +1 -1
  101. package/esri-compat/locator.d.ts +297 -0
  102. package/esri-compat/locator.d.ts.map +1 -0
  103. package/esri-compat/locator.js +579 -0
  104. package/esri-compat/map-image-layer.d.ts.map +1 -1
  105. package/esri-compat/map-view.d.ts.map +1 -1
  106. package/esri-compat/map-view.js +1 -1
  107. package/esri-compat/scene-view.d.ts.map +1 -1
  108. package/esri-compat/time-slider.d.ts +29 -0
  109. package/esri-compat/time-slider.d.ts.map +1 -1
  110. package/esri-compat/time-slider.js +117 -0
  111. package/esri-compat/wfs-layer.d.ts +2 -1
  112. package/esri-compat/wfs-layer.d.ts.map +1 -1
  113. package/esri-compat/wfs-layer.js +2 -1
  114. package/esri-compat/widget-host.d.ts +42 -6
  115. package/esri-compat/widget-host.d.ts.map +1 -1
  116. package/esri-compat/widget-host.js +99 -10
  117. package/generated-app/projection.d.ts.map +1 -1
  118. package/generated-app/runtime.d.ts.map +1 -1
  119. package/map/data-to-map-bridge.d.ts +1 -1
  120. package/map/data-to-map-bridge.d.ts.map +1 -1
  121. package/map/data-to-map-bridge.js +1 -2
  122. package/map/honua-map.d.ts.map +1 -1
  123. package/map/honua-map.js +1 -1
  124. package/map/index.d.ts +2 -0
  125. package/map/index.d.ts.map +1 -1
  126. package/map/index.js +2 -0
  127. package/map/realtime-reconciliation-adapter.d.ts +98 -0
  128. package/map/realtime-reconciliation-adapter.d.ts.map +1 -0
  129. package/map/realtime-reconciliation-adapter.js +84 -0
  130. package/map/temporal-playback.d.ts +25 -0
  131. package/map/temporal-playback.d.ts.map +1 -1
  132. package/map/temporal-playback.js +29 -1
  133. package/package.json +4 -3
  134. package/query-planner/canonical-filter.d.ts +30 -0
  135. package/query-planner/canonical-filter.d.ts.map +1 -0
  136. package/query-planner/canonical-filter.js +30 -0
  137. package/query-planner/columnar-plan.d.ts +63 -0
  138. package/query-planner/columnar-plan.d.ts.map +1 -0
  139. package/query-planner/columnar-plan.js +94 -0
  140. package/query-planner/diagnostics.d.ts +3 -3
  141. package/query-planner/diagnostics.d.ts.map +1 -1
  142. package/query-planner/diagnostics.js +17 -4
  143. package/query-planner/duckdb.d.ts.map +1 -1
  144. package/query-planner/duckdb.js +16 -2
  145. package/query-planner/execution-context.d.ts.map +1 -1
  146. package/query-planner/execution-context.js +3 -1
  147. package/query-planner/executor.d.ts.map +1 -1
  148. package/query-planner/executor.js +7 -1
  149. package/query-planner/geoservices.d.ts.map +1 -1
  150. package/query-planner/geoservices.js +24 -5
  151. package/query-planner/grpc.d.ts.map +1 -1
  152. package/query-planner/grpc.js +29 -5
  153. package/query-planner/index.d.ts +20 -5
  154. package/query-planner/index.d.ts.map +1 -1
  155. package/query-planner/index.js +16 -3
  156. package/query-planner/ir.d.ts +6 -1
  157. package/query-planner/ir.d.ts.map +1 -1
  158. package/query-planner/ir.js +63 -1
  159. package/query-planner/odata-protocol-module.d.ts +54 -0
  160. package/query-planner/odata-protocol-module.d.ts.map +1 -0
  161. package/query-planner/odata-protocol-module.js +199 -0
  162. package/query-planner/odata-v1.d.ts +23 -0
  163. package/query-planner/odata-v1.d.ts.map +1 -0
  164. package/query-planner/odata-v1.js +202 -0
  165. package/query-planner/odata.d.ts +0 -3
  166. package/query-planner/odata.d.ts.map +1 -1
  167. package/query-planner/odata.js +0 -143
  168. package/query-planner/ogc-features.d.ts.map +1 -1
  169. package/query-planner/ogc-features.js +23 -1
  170. package/query-planner/planner.d.ts +2 -2
  171. package/query-planner/planner.d.ts.map +1 -1
  172. package/query-planner/planner.js +146 -27
  173. package/query-planner/representation.d.ts +59 -0
  174. package/query-planner/representation.d.ts.map +1 -0
  175. package/query-planner/representation.js +140 -0
  176. package/query-planner/types.d.ts +153 -3
  177. package/query-planner/types.d.ts.map +1 -1
  178. package/query-planner/wfs-protocol-module.d.ts +57 -0
  179. package/query-planner/wfs-protocol-module.d.ts.map +1 -0
  180. package/query-planner/wfs-protocol-module.js +731 -0
  181. package/query-planner/wfs-v1.d.ts +41 -0
  182. package/query-planner/wfs-v1.d.ts.map +1 -0
  183. package/query-planner/wfs-v1.js +366 -0
  184. package/query-planner/wfs.d.ts +1 -3
  185. package/query-planner/wfs.d.ts.map +1 -1
  186. package/query-planner/wfs.js +1 -70
  187. package/react/honua-map.d.ts +3 -1
  188. package/react/honua-map.d.ts.map +1 -1
  189. package/react/honua-map.js +11 -1
  190. package/react/hooks.d.ts +1 -1
  191. package/react/hooks.js +1 -1
  192. package/react/selection.d.ts.map +1 -1
  193. package/react/selection.js +0 -0
  194. package/react/use-mounted-source.d.ts +1 -1
  195. package/react/use-mounted-source.js +1 -1
  196. package/realtime/checkpoint-store.d.ts +206 -0
  197. package/realtime/checkpoint-store.d.ts.map +1 -0
  198. package/realtime/checkpoint-store.js +504 -0
  199. package/realtime/contract.d.ts +142 -0
  200. package/realtime/contract.d.ts.map +1 -0
  201. package/realtime/contract.js +154 -0
  202. package/realtime/exploration.d.ts +16 -0
  203. package/realtime/exploration.d.ts.map +1 -0
  204. package/realtime/exploration.js +32 -0
  205. package/realtime/honua-server.d.ts +131 -0
  206. package/realtime/honua-server.d.ts.map +1 -0
  207. package/realtime/honua-server.js +302 -0
  208. package/realtime/index.d.ts +39 -0
  209. package/realtime/index.d.ts.map +1 -0
  210. package/realtime/index.js +26 -0
  211. package/realtime/odata-delta.d.ts +114 -0
  212. package/realtime/odata-delta.d.ts.map +1 -0
  213. package/realtime/odata-delta.js +483 -0
  214. package/realtime/projections.d.ts +30 -0
  215. package/realtime/projections.d.ts.map +1 -0
  216. package/realtime/projections.js +51 -0
  217. package/realtime/reconciliation.d.ts +245 -0
  218. package/realtime/reconciliation.d.ts.map +1 -0
  219. package/realtime/reconciliation.js +377 -0
  220. package/realtime/reducer.d.ts +14 -0
  221. package/realtime/reducer.d.ts.map +1 -0
  222. package/realtime/reducer.js +351 -0
  223. package/realtime/resumable-transport.d.ts +111 -0
  224. package/realtime/resumable-transport.d.ts.map +1 -0
  225. package/realtime/resumable-transport.js +406 -0
  226. package/realtime/resumable.d.ts +104 -0
  227. package/realtime/resumable.d.ts.map +1 -0
  228. package/realtime/resumable.js +632 -0
  229. package/realtime/sse.d.ts +23 -0
  230. package/realtime/sse.d.ts.map +1 -0
  231. package/realtime/sse.js +147 -0
  232. package/realtime/store.d.ts +18 -0
  233. package/realtime/store.d.ts.map +1 -0
  234. package/realtime/store.js +63 -0
  235. package/realtime/types.d.ts +190 -0
  236. package/realtime/types.d.ts.map +1 -0
  237. package/realtime/types.js +10 -0
  238. package/realtime/websocket.d.ts +60 -0
  239. package/realtime/websocket.d.ts.map +1 -0
  240. package/realtime/websocket.js +157 -0
  241. package/realtime/wire.d.ts +28 -0
  242. package/realtime/wire.d.ts.map +1 -0
  243. package/realtime/wire.js +73 -0
  244. package/runtime/index.d.ts +6 -2
  245. package/runtime/index.d.ts.map +1 -1
  246. package/runtime/index.js +3 -1
  247. package/runtime/load-package.d.ts +24 -0
  248. package/runtime/load-package.d.ts.map +1 -1
  249. package/runtime/load-package.js +45 -1
  250. package/runtime/maplibre-renderer.d.ts +11 -0
  251. package/runtime/maplibre-renderer.d.ts.map +1 -1
  252. package/runtime/maplibre-renderer.js +32 -7
  253. package/runtime/offline-region-protocol.d.ts +73 -0
  254. package/runtime/offline-region-protocol.d.ts.map +1 -0
  255. package/runtime/offline-region-protocol.js +63 -0
  256. package/runtime/offline-region-style.d.ts +78 -0
  257. package/runtime/offline-region-style.d.ts.map +1 -0
  258. package/runtime/offline-region-style.js +147 -0
  259. package/runtime/pmtiles-protocol.d.ts +7 -8
  260. package/runtime/pmtiles-protocol.d.ts.map +1 -1
  261. package/runtime/pmtiles-protocol.js +19 -66
  262. package/runtime/protocol-registry.d.ts +55 -0
  263. package/runtime/protocol-registry.d.ts.map +1 -0
  264. package/runtime/protocol-registry.js +103 -0
  265. package/runtime/runtime.d.ts +2 -0
  266. package/runtime/runtime.d.ts.map +1 -1
  267. package/runtime/runtime.js +6 -1
  268. package/studio/index.d.ts +24 -7
  269. package/studio/index.d.ts.map +1 -1
  270. package/studio/index.js +21 -7
  271. package/studio/lifecycle-client.d.ts +164 -0
  272. package/studio/lifecycle-client.d.ts.map +1 -0
  273. package/studio/lifecycle-client.js +299 -0
  274. package/studio/lifecycle-errors.d.ts +91 -0
  275. package/studio/lifecycle-errors.d.ts.map +1 -0
  276. package/studio/lifecycle-errors.js +77 -0
  277. package/studio/lifecycle-types.d.ts +321 -0
  278. package/studio/lifecycle-types.d.ts.map +1 -0
  279. package/studio/lifecycle-types.js +22 -0
  280. package/webmap/convert-label.js +0 -1
  281. package/webmap/convert-symbol.d.ts.map +1 -1
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Durable {@link RealtimeCheckpointStore} implementations for
3
+ * `@honua/sdk-js/realtime` (issue #937).
4
+ *
5
+ * `resumable.ts` already owns the resume state machine: it loads a checkpoint,
6
+ * validates it with {@link evaluateRealtimeCheckpoint}, and requires an explicit
7
+ * replacement snapshot whenever the checkpoint no longer applies. What it never
8
+ * had was a shipped store, so a reload always resnapshotted even when a valid
9
+ * cursor was in hand a second earlier. This module supplies that durability
10
+ * without redefining any cursor semantics:
11
+ *
12
+ * - {@link createIndexedDbRealtimeCheckpointStore} persists one record per
13
+ * resume scope in the browser, keyed by the authorization-scope digest,
14
+ * source identity, and query identity that already define checkpoint scope.
15
+ * - {@link createMemoryRealtimeCheckpointStore} runs the identical
16
+ * normalization, screening, expiry, and eviction logic without IndexedDB, for
17
+ * tests and non-persistent hosts.
18
+ * - {@link createRealtimeCheckpointStore} binds that same logic to any
19
+ * {@link RealtimeCheckpointRecordStorage}, for hosts this module ships no
20
+ * adapter for.
21
+ *
22
+ * Four properties are deliberate:
23
+ *
24
+ * 1. **Cursors only.** A record carries the resume position (sequence, cursor,
25
+ * watermark, timestamp, delta token), the scope identity it belongs to, and
26
+ * two observation times. It never carries features, snapshots, request URLs,
27
+ * headers, or credentials. The authorization scope is reduced to a SHA-256
28
+ * digest before it reaches storage, and every remaining persisted string is
29
+ * screened with the shared persisted-string screen in
30
+ * `src/connect-url-safety.ts` — the same discipline the offline region store
31
+ * applies through `assertCredentialFreeManifest`.
32
+ * 2. **Fail-closed resume.** Load revalidates through
33
+ * {@link evaluateRealtimeCheckpoint} and discards the record outright when
34
+ * the source, query, source version, schema version, or authorization scope
35
+ * changed, when the record is corrupt, or when the checkpoint is older than
36
+ * the configured maximum age. A discarded checkpoint means the subscription
37
+ * resnapshots; it never means a partial delta stream is delivered as though
38
+ * it were complete.
39
+ * 3. **Bounded and atomic.** Each scope holds exactly one record (last write
40
+ * wins), the store holds at most `maxRecords` scope records, and the
41
+ * IndexedDB write plus its eviction sweep share a single readwrite
42
+ * transaction.
43
+ * 4. **Never throws into a subscription.** A storage failure, a refused
44
+ * credential-shaped value, or a corrupt record resolves and reports a
45
+ * {@link RealtimeCheckpointStoreDiagnosticV1} carrying a
46
+ * `HonuaRealtimeResumeError`, so the subscription degrades to a resnapshot
47
+ * instead of entering the gate's terminal `error` phase.
48
+ *
49
+ * The store stays opt-in: nothing here is wired into a subscription unless a
50
+ * caller passes it as `checkpointStore`, so no existing subscription changes
51
+ * behaviour by default.
52
+ *
53
+ * @module
54
+ */
55
+ import { HonuaRealtimeResumeError, type RealtimeCheckpointCompatibilityCode, type RealtimeCheckpointStore, type RealtimeResumeContextV1 } from "./resumable.js";
56
+ /**
57
+ * Versioned format string stamped on every persisted record. A record whose
58
+ * format string differs is treated as corrupt and discarded on load, the same
59
+ * posture the offline stores take, so a future format can never be
60
+ * misinterpreted as this one.
61
+ */
62
+ export declare const HONUA_REALTIME_CHECKPOINT_STORE_FORMAT: "honua.realtime-checkpoint-store/1.0";
63
+ /**
64
+ * Default maximum checkpoint age. A cursor older than this forces a resnapshot
65
+ * even when its scope still matches, because a server may retire a cursor
66
+ * window without telling the client; a silent gap is worse than an honest
67
+ * resnapshot.
68
+ */
69
+ export declare const DEFAULT_REALTIME_CHECKPOINT_MAX_AGE_MS: number;
70
+ /** Absolute ceiling on `maxAgeMs`. Callers may tighten it, never raise it. */
71
+ export declare const MAX_REALTIME_CHECKPOINT_MAX_AGE_MS: number;
72
+ /**
73
+ * Default cap on distinct resume scopes retained per store. Each scope holds at
74
+ * most one record, so this is also the record cap; the least recently written
75
+ * record is evicted first.
76
+ */
77
+ export declare const DEFAULT_REALTIME_CHECKPOINT_MAX_RECORDS = 64;
78
+ /** Absolute ceiling on `maxRecords`. Callers may tighten it, never raise it. */
79
+ export declare const MAX_REALTIME_CHECKPOINT_RECORDS = 512;
80
+ /** Resume position persisted with a checkpoint record. Never a payload. */
81
+ export interface RealtimeStoredResumePosition {
82
+ readonly sequence: number;
83
+ readonly cursor?: string;
84
+ readonly watermark?: string;
85
+ readonly timestamp?: string;
86
+ readonly deltaToken?: string;
87
+ }
88
+ /**
89
+ * One persisted checkpoint record.
90
+ *
91
+ * `savedAt` is the checkpoint's own observation time and drives expiry;
92
+ * `observedAt` is when this store wrote the record and drives eviction order.
93
+ * Recent event ids are deliberately absent: they are bounded delivery history,
94
+ * not resume state, so a restored checkpoint starts with an empty id window
95
+ * while its ordering guarantees are unchanged.
96
+ */
97
+ export interface RealtimeCheckpointRecordV1 {
98
+ readonly key: `sha256:${string}`;
99
+ readonly format: typeof HONUA_REALTIME_CHECKPOINT_STORE_FORMAT;
100
+ readonly sourceId: string;
101
+ readonly queryFingerprint: string;
102
+ readonly sourceVersion: string;
103
+ readonly schemaVersion: string;
104
+ /** Digest of the resume context's authorization-scope fingerprint, never the fingerprint itself. */
105
+ readonly authorizationScopeDigest: `sha256:${string}`;
106
+ readonly resume: RealtimeStoredResumePosition;
107
+ readonly savedAt: string;
108
+ readonly observedAt: string;
109
+ }
110
+ /**
111
+ * Why a checkpoint was not returned or not persisted. The first six values are
112
+ * exactly the incompatible {@link RealtimeCheckpointCompatibilityCode} results,
113
+ * so a discard reason reads in the same vocabulary the delivery gate uses.
114
+ *
115
+ * `unsupported-format` is deliberately distinct from `invalid-checkpoint`
116
+ * (issue #1046): a record written in another store format is not damage, it is
117
+ * a layout this build declines to interpret, and a host that sees a run of them
118
+ * is looking at a version rollback rather than a corrupt database. Realtime
119
+ * cursors are cheap to discard, so the posture stays discard-and-resnapshot;
120
+ * only the reporting distinguishes the two.
121
+ */
122
+ export type RealtimeCheckpointStoreReason = Exclude<RealtimeCheckpointCompatibilityCode, "compatible"> | "checkpoint-expired" | "credential-screened" | "storage-failed" | "unsupported-format";
123
+ /**
124
+ * Structured report of a load or save that did not produce a durable resume.
125
+ *
126
+ * `error` is a `HonuaRealtimeResumeError`, so a host routes it through the same
127
+ * envelope as every other realtime failure. Messages never echo a stored cursor,
128
+ * scope fingerprint, or offending value.
129
+ */
130
+ export interface RealtimeCheckpointStoreDiagnosticV1 {
131
+ readonly kind: "honua.realtime-checkpoint-store-diagnostic";
132
+ readonly version: 1;
133
+ readonly operation: "load" | "save";
134
+ readonly reason: RealtimeCheckpointStoreReason;
135
+ /** Scope key the operation addressed; a digest, never a raw identity. */
136
+ readonly scopeKey: `sha256:${string}`;
137
+ readonly error: HonuaRealtimeResumeError;
138
+ }
139
+ export interface RealtimeCheckpointStoreOptions {
140
+ /** Maximum checkpoint age before a resnapshot is forced. @default 900000 */
141
+ readonly maxAgeMs?: number;
142
+ /** Maximum distinct resume scopes retained; least recently written is evicted. @default 64 */
143
+ readonly maxRecords?: number;
144
+ readonly now?: () => number;
145
+ /** Receives every discard, refusal, and storage failure. Must not throw. */
146
+ readonly onDiagnostic?: (diagnostic: RealtimeCheckpointStoreDiagnosticV1) => void;
147
+ }
148
+ export interface IndexedDbRealtimeCheckpointStoreOptions extends RealtimeCheckpointStoreOptions {
149
+ /** Defaults to `honua-realtime-checkpoints`. Names are origin-scoped by IndexedDB. */
150
+ readonly name?: string;
151
+ /** Injectable for browser tests and hosts with an alternate IndexedDB factory. */
152
+ readonly indexedDB?: IDBFactory;
153
+ }
154
+ /**
155
+ * Storage primitives the scope, screening, expiry, and eviction logic is built
156
+ * on. Implement it to persist checkpoints somewhere this module does not ship an
157
+ * adapter for (a Node filesystem, SQLite, an extension store). Reads may return
158
+ * anything at all — every value is revalidated before it can resume a
159
+ * subscription — and every method may reject, which degrades to a resnapshot.
160
+ */
161
+ export interface RealtimeCheckpointRecordStorage {
162
+ read(key: string): Promise<unknown>;
163
+ /** Atomically write `record` and evict the oldest records beyond `maxRecords`. */
164
+ write(record: RealtimeCheckpointRecordV1, maxRecords: number): Promise<void>;
165
+ remove(key: string): Promise<void>;
166
+ list(): Promise<readonly unknown[]>;
167
+ clear(): Promise<void>;
168
+ }
169
+ /** A checkpoint store plus the record administration a host needs to audit or reset it. */
170
+ export interface RealtimeCheckpointStoreHandle extends RealtimeCheckpointStore {
171
+ /** Every valid persisted record, for enumeration in tests and diagnostics. */
172
+ records(): Promise<readonly RealtimeCheckpointRecordV1[]>;
173
+ /** Drop every stored checkpoint, for sign-out and scope teardown. */
174
+ clear(): Promise<void>;
175
+ }
176
+ /**
177
+ * Deterministic scope key for a resume context: a digest over the
178
+ * authorization-scope digest, source identity, and query identity — exactly the
179
+ * identities checkpoint scope validation is defined against. Source and schema
180
+ * versions are intentionally excluded so a version bump replaces the record in
181
+ * place and is discarded explicitly on load, instead of orphaning it under a
182
+ * key nothing will read again.
183
+ */
184
+ export declare function realtimeCheckpointScopeKey(context: RealtimeResumeContextV1): `sha256:${string}`;
185
+ /**
186
+ * Opaque digest of an authorization-scope fingerprint. The fingerprint is
187
+ * already documented as a non-secret opaque identity; persisting only its
188
+ * digest keeps that promise enforceable rather than assumed.
189
+ */
190
+ export declare function realtimeAuthorizationScopeDigest(fingerprint: string): `sha256:${string}`;
191
+ /**
192
+ * Bind the shared scope, screening, expiry, and eviction logic to any
193
+ * {@link RealtimeCheckpointRecordStorage}. The returned store never throws into
194
+ * a subscription: a rejected storage call, a refused value, or a corrupt record
195
+ * resolves and reports a diagnostic, so the subscription resnapshots.
196
+ */
197
+ export declare function createRealtimeCheckpointStore(storage: RealtimeCheckpointRecordStorage, options?: RealtimeCheckpointStoreOptions): RealtimeCheckpointStoreHandle;
198
+ /** In-memory store with the persistent store's exact semantics, for tests and non-persistent hosts. */
199
+ export declare function createMemoryRealtimeCheckpointStore(options?: RealtimeCheckpointStoreOptions): RealtimeCheckpointStoreHandle;
200
+ /** Map-backed storage with the same one-record-per-scope, oldest-first eviction contract. */
201
+ export declare function createMemoryCheckpointStorage(): RealtimeCheckpointRecordStorage;
202
+ /** Persistent browser store: one bounded, atomically written record per resume scope. */
203
+ export declare function createIndexedDbRealtimeCheckpointStore(options?: IndexedDbRealtimeCheckpointStoreOptions): RealtimeCheckpointStoreHandle;
204
+ /** IndexedDB storage; each method runs in exactly one transaction. */
205
+ export declare function createIndexedDbCheckpointStorage(options?: IndexedDbRealtimeCheckpointStoreOptions): RealtimeCheckpointRecordStorage;
206
+ //# sourceMappingURL=checkpoint-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-store.d.ts","sourceRoot":"","sources":["../../../src/realtime/checkpoint-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAIH,OAAO,EACL,wBAAwB,EAExB,KAAK,mCAAmC,EACxC,KAAK,uBAAuB,EAE5B,KAAK,uBAAuB,EAE7B,MAAM,gBAAgB,CAAC;AAGxB;;;;;GAKG;AACH,eAAO,MAAM,s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