@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.
- package/contract/discovery.d.ts +34 -0
- package/contract/discovery.d.ts.map +1 -1
- package/contract/index.d.ts +7 -5
- package/contract/index.d.ts.map +1 -1
- package/contract/index.js +3 -2
- package/contract/pmtiles.d.ts +10 -1
- package/contract/pmtiles.d.ts.map +1 -1
- package/contract/pmtiles.js +10 -2
- package/contract/protocol-module.d.ts +84 -9
- package/contract/protocol-module.d.ts.map +1 -1
- package/contract/query-filter-fes.d.ts +18 -0
- package/contract/query-filter-fes.d.ts.map +1 -0
- package/contract/query-filter-fes.js +122 -0
- package/contract/query-filter.d.ts +300 -0
- package/contract/query-filter.d.ts.map +1 -0
- package/contract/query-filter.js +883 -0
- package/contract/schema.d.ts +12 -0
- package/contract/schema.d.ts.map +1 -1
- package/contract/schema.js +34 -0
- package/contract/source-capability-support.d.ts.map +1 -1
- package/contract/source-capability-support.js +15 -3
- package/contract/source.d.ts +45 -25
- package/contract/source.d.ts.map +1 -1
- package/contract/source.js +719 -479
- package/contract/types.d.ts +87 -18
- package/contract/types.d.ts.map +1 -1
- package/contract/widget-source.d.ts.map +1 -1
- package/core/client.d.ts +45 -21
- package/core/client.d.ts.map +1 -1
- package/core/client.js +224 -46
- package/core/error-classifications.d.ts +6 -0
- package/core/error-classifications.d.ts.map +1 -1
- package/core/error-classifications.js +6 -0
- package/core/error-code-registry.d.ts +6 -0
- package/core/error-code-registry.d.ts.map +1 -1
- package/core/error-code-registry.js +6 -0
- package/core/error-envelope.js +2 -0
- package/core/errors.d.ts +1 -1
- package/core/errors.js +1 -1
- package/core/geoparquet-sql.d.ts +68 -4
- package/core/geoparquet-sql.d.ts.map +1 -1
- package/core/geoparquet-sql.js +325 -8
- package/core/odata-write-codec.d.ts.map +1 -1
- package/core/odata-write-codec.js +0 -1
- package/core/odata.d.ts +6 -0
- package/core/odata.d.ts.map +1 -1
- package/core/odata.js +6 -1
- package/core/ogc-processes.d.ts +182 -25
- package/core/ogc-processes.d.ts.map +1 -1
- package/core/ogc-processes.js +602 -30
- package/core/process-runner.d.ts +8 -1
- package/core/process-runner.d.ts.map +1 -1
- package/core/process-runner.js +1 -0
- package/core/protocol-transport.d.ts +2 -0
- package/core/protocol-transport.d.ts.map +1 -1
- package/core/stac.d.ts +31 -0
- package/core/stac.d.ts.map +1 -1
- package/core/stac.js +136 -19
- package/core/surfaces.d.ts.map +1 -1
- package/core/surfaces.js +273 -68
- package/core/types.d.ts +123 -9
- package/core/types.d.ts.map +1 -1
- package/core/wfs-axis-order.d.ts +18 -0
- package/core/wfs-axis-order.d.ts.map +1 -0
- package/core/wfs-axis-order.js +108 -0
- package/core/wfs-capabilities.d.ts +65 -24
- package/core/wfs-capabilities.d.ts.map +1 -1
- package/core/wfs-capabilities.js +237 -27
- package/core/wfs-filter.d.ts +26 -3
- package/core/wfs-filter.d.ts.map +1 -1
- package/core/wfs-filter.js +48 -53
- package/core/wfs-protocol-error.d.ts +12 -0
- package/core/wfs-protocol-error.d.ts.map +1 -0
- package/core/wfs-protocol-error.js +13 -0
- package/core/wfs.d.ts +53 -1
- package/core/wfs.d.ts.map +1 -1
- package/core/wfs.js +251 -29
- package/core/wms-feature-info.d.ts +92 -0
- package/core/wms-feature-info.d.ts.map +1 -0
- package/core/wms-feature-info.js +285 -0
- package/core/wms.d.ts +9 -0
- package/core/wms.d.ts.map +1 -1
- package/core/wms.js +17 -5
- package/esri-compat/event-bus.d.ts +20 -0
- package/esri-compat/event-bus.d.ts.map +1 -1
- package/esri-compat/feature-filter.d.ts +46 -1
- package/esri-compat/feature-filter.d.ts.map +1 -1
- package/esri-compat/feature-filter.js +49 -0
- package/esri-compat/geojson-layer.d.ts +4 -2
- package/esri-compat/geojson-layer.d.ts.map +1 -1
- package/esri-compat/geojson-layer.js +4 -2
- package/esri-compat/identity-manager.js +2 -2
- package/esri-compat/imagery-layer.d.ts +2 -1
- package/esri-compat/imagery-layer.d.ts.map +1 -1
- package/esri-compat/imagery-layer.js +2 -1
- package/esri-compat/layer-list.d.ts +8 -1
- package/esri-compat/layer-list.d.ts.map +1 -1
- package/esri-compat/layer-list.js +11 -4
- package/esri-compat/legend.d.ts.map +1 -1
- package/esri-compat/legend.js +1 -1
- package/esri-compat/locator.d.ts +297 -0
- package/esri-compat/locator.d.ts.map +1 -0
- package/esri-compat/locator.js +579 -0
- package/esri-compat/map-image-layer.d.ts.map +1 -1
- package/esri-compat/map-view.d.ts.map +1 -1
- package/esri-compat/map-view.js +1 -1
- package/esri-compat/scene-view.d.ts.map +1 -1
- package/esri-compat/time-slider.d.ts +29 -0
- package/esri-compat/time-slider.d.ts.map +1 -1
- package/esri-compat/time-slider.js +117 -0
- package/esri-compat/wfs-layer.d.ts +2 -1
- package/esri-compat/wfs-layer.d.ts.map +1 -1
- package/esri-compat/wfs-layer.js +2 -1
- package/esri-compat/widget-host.d.ts +42 -6
- package/esri-compat/widget-host.d.ts.map +1 -1
- package/esri-compat/widget-host.js +99 -10
- package/generated-app/projection.d.ts.map +1 -1
- package/generated-app/runtime.d.ts.map +1 -1
- package/map/data-to-map-bridge.d.ts +1 -1
- package/map/data-to-map-bridge.d.ts.map +1 -1
- package/map/data-to-map-bridge.js +1 -2
- package/map/honua-map.d.ts.map +1 -1
- package/map/honua-map.js +1 -1
- package/map/index.d.ts +2 -0
- package/map/index.d.ts.map +1 -1
- package/map/index.js +2 -0
- package/map/realtime-reconciliation-adapter.d.ts +98 -0
- package/map/realtime-reconciliation-adapter.d.ts.map +1 -0
- package/map/realtime-reconciliation-adapter.js +84 -0
- package/map/temporal-playback.d.ts +25 -0
- package/map/temporal-playback.d.ts.map +1 -1
- package/map/temporal-playback.js +29 -1
- package/package.json +4 -3
- package/query-planner/canonical-filter.d.ts +30 -0
- package/query-planner/canonical-filter.d.ts.map +1 -0
- package/query-planner/canonical-filter.js +30 -0
- package/query-planner/columnar-plan.d.ts +63 -0
- package/query-planner/columnar-plan.d.ts.map +1 -0
- package/query-planner/columnar-plan.js +94 -0
- package/query-planner/diagnostics.d.ts +3 -3
- package/query-planner/diagnostics.d.ts.map +1 -1
- package/query-planner/diagnostics.js +17 -4
- package/query-planner/duckdb.d.ts.map +1 -1
- package/query-planner/duckdb.js +16 -2
- package/query-planner/execution-context.d.ts.map +1 -1
- package/query-planner/execution-context.js +3 -1
- package/query-planner/executor.d.ts.map +1 -1
- package/query-planner/executor.js +7 -1
- package/query-planner/geoservices.d.ts.map +1 -1
- package/query-planner/geoservices.js +24 -5
- package/query-planner/grpc.d.ts.map +1 -1
- package/query-planner/grpc.js +29 -5
- package/query-planner/index.d.ts +20 -5
- package/query-planner/index.d.ts.map +1 -1
- package/query-planner/index.js +16 -3
- package/query-planner/ir.d.ts +6 -1
- package/query-planner/ir.d.ts.map +1 -1
- package/query-planner/ir.js +63 -1
- package/query-planner/odata-protocol-module.d.ts +54 -0
- package/query-planner/odata-protocol-module.d.ts.map +1 -0
- package/query-planner/odata-protocol-module.js +199 -0
- package/query-planner/odata-v1.d.ts +23 -0
- package/query-planner/odata-v1.d.ts.map +1 -0
- package/query-planner/odata-v1.js +202 -0
- package/query-planner/odata.d.ts +0 -3
- package/query-planner/odata.d.ts.map +1 -1
- package/query-planner/odata.js +0 -143
- package/query-planner/ogc-features.d.ts.map +1 -1
- package/query-planner/ogc-features.js +23 -1
- package/query-planner/planner.d.ts +2 -2
- package/query-planner/planner.d.ts.map +1 -1
- package/query-planner/planner.js +146 -27
- package/query-planner/representation.d.ts +59 -0
- package/query-planner/representation.d.ts.map +1 -0
- package/query-planner/representation.js +140 -0
- package/query-planner/types.d.ts +153 -3
- package/query-planner/types.d.ts.map +1 -1
- package/query-planner/wfs-protocol-module.d.ts +57 -0
- package/query-planner/wfs-protocol-module.d.ts.map +1 -0
- package/query-planner/wfs-protocol-module.js +731 -0
- package/query-planner/wfs-v1.d.ts +41 -0
- package/query-planner/wfs-v1.d.ts.map +1 -0
- package/query-planner/wfs-v1.js +366 -0
- package/query-planner/wfs.d.ts +1 -3
- package/query-planner/wfs.d.ts.map +1 -1
- package/query-planner/wfs.js +1 -70
- package/react/honua-map.d.ts +3 -1
- package/react/honua-map.d.ts.map +1 -1
- package/react/honua-map.js +11 -1
- package/react/hooks.d.ts +1 -1
- package/react/hooks.js +1 -1
- package/react/selection.d.ts.map +1 -1
- package/react/selection.js +0 -0
- package/react/use-mounted-source.d.ts +1 -1
- package/react/use-mounted-source.js +1 -1
- package/realtime/checkpoint-store.d.ts +206 -0
- package/realtime/checkpoint-store.d.ts.map +1 -0
- package/realtime/checkpoint-store.js +504 -0
- package/realtime/contract.d.ts +142 -0
- package/realtime/contract.d.ts.map +1 -0
- package/realtime/contract.js +154 -0
- package/realtime/exploration.d.ts +16 -0
- package/realtime/exploration.d.ts.map +1 -0
- package/realtime/exploration.js +32 -0
- package/realtime/honua-server.d.ts +131 -0
- package/realtime/honua-server.d.ts.map +1 -0
- package/realtime/honua-server.js +302 -0
- package/realtime/index.d.ts +39 -0
- package/realtime/index.d.ts.map +1 -0
- package/realtime/index.js +26 -0
- package/realtime/odata-delta.d.ts +114 -0
- package/realtime/odata-delta.d.ts.map +1 -0
- package/realtime/odata-delta.js +483 -0
- package/realtime/projections.d.ts +30 -0
- package/realtime/projections.d.ts.map +1 -0
- package/realtime/projections.js +51 -0
- package/realtime/reconciliation.d.ts +245 -0
- package/realtime/reconciliation.d.ts.map +1 -0
- package/realtime/reconciliation.js +377 -0
- package/realtime/reducer.d.ts +14 -0
- package/realtime/reducer.d.ts.map +1 -0
- package/realtime/reducer.js +351 -0
- package/realtime/resumable-transport.d.ts +111 -0
- package/realtime/resumable-transport.d.ts.map +1 -0
- package/realtime/resumable-transport.js +406 -0
- package/realtime/resumable.d.ts +104 -0
- package/realtime/resumable.d.ts.map +1 -0
- package/realtime/resumable.js +632 -0
- package/realtime/sse.d.ts +23 -0
- package/realtime/sse.d.ts.map +1 -0
- package/realtime/sse.js +147 -0
- package/realtime/store.d.ts +18 -0
- package/realtime/store.d.ts.map +1 -0
- package/realtime/store.js +63 -0
- package/realtime/types.d.ts +190 -0
- package/realtime/types.d.ts.map +1 -0
- package/realtime/types.js +10 -0
- package/realtime/websocket.d.ts +60 -0
- package/realtime/websocket.d.ts.map +1 -0
- package/realtime/websocket.js +157 -0
- package/realtime/wire.d.ts +28 -0
- package/realtime/wire.d.ts.map +1 -0
- package/realtime/wire.js +73 -0
- package/runtime/index.d.ts +6 -2
- package/runtime/index.d.ts.map +1 -1
- package/runtime/index.js +3 -1
- package/runtime/load-package.d.ts +24 -0
- package/runtime/load-package.d.ts.map +1 -1
- package/runtime/load-package.js +45 -1
- package/runtime/maplibre-renderer.d.ts +11 -0
- package/runtime/maplibre-renderer.d.ts.map +1 -1
- package/runtime/maplibre-renderer.js +32 -7
- package/runtime/offline-region-protocol.d.ts +73 -0
- package/runtime/offline-region-protocol.d.ts.map +1 -0
- package/runtime/offline-region-protocol.js +63 -0
- package/runtime/offline-region-style.d.ts +78 -0
- package/runtime/offline-region-style.d.ts.map +1 -0
- package/runtime/offline-region-style.js +147 -0
- package/runtime/pmtiles-protocol.d.ts +7 -8
- package/runtime/pmtiles-protocol.d.ts.map +1 -1
- package/runtime/pmtiles-protocol.js +19 -66
- package/runtime/protocol-registry.d.ts +55 -0
- package/runtime/protocol-registry.d.ts.map +1 -0
- package/runtime/protocol-registry.js +103 -0
- package/runtime/runtime.d.ts +2 -0
- package/runtime/runtime.d.ts.map +1 -1
- package/runtime/runtime.js +6 -1
- package/studio/index.d.ts +24 -7
- package/studio/index.d.ts.map +1 -1
- package/studio/index.js +21 -7
- package/studio/lifecycle-client.d.ts +164 -0
- package/studio/lifecycle-client.d.ts.map +1 -0
- package/studio/lifecycle-client.js +299 -0
- package/studio/lifecycle-errors.d.ts +91 -0
- package/studio/lifecycle-errors.d.ts.map +1 -0
- package/studio/lifecycle-errors.js +77 -0
- package/studio/lifecycle-types.d.ts +321 -0
- package/studio/lifecycle-types.d.ts.map +1 -0
- package/studio/lifecycle-types.js +22 -0
- package/webmap/convert-label.js +0 -1
- 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,sCAAsC,EAAG,qCAA8C,CAAC;AAErG;;;;;GAKG;AACH,eAAO,MAAM,sCAAsC,QAAiB,CAAC;AAErE,8EAA8E;AAC9E,eAAO,MAAM,kCAAkC,QAAsB,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,uCAAuC,KAAK,CAAC;AAE1D,gFAAgF;AAChF,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,2EAA2E;AAC3E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CA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