@happyvertical/smrt-web 0.75.1 → 0.76.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.
|
@@ -60,7 +60,14 @@ module does no tenant filtering and needs no identity.
|
|
|
60
60
|
**SSE vs polling — feature-detect once, downgrade-on-fatal.** Construction
|
|
61
61
|
feature-detects EventSource: present → `connectSse()`; absent → `startPolling()`.
|
|
62
62
|
`transport` reflects it. A transient SSE `onerror` (readyState still OPEN) needs
|
|
63
|
-
no code — the browser auto-reconnects, resending Last-Event-ID.
|
|
63
|
+
no code — the browser auto-reconnects, resending Last-Event-ID. **Every
|
|
64
|
+
`onopen` after the first invalidates everything** (#5940): a connection can open
|
|
65
|
+
and end before its start reaches the client (a start the server could not
|
|
66
|
+
resolve answers a 200 that ends; a drop can precede the first SSE block), so
|
|
67
|
+
the reconnect carries no cursor and starts at a later head, and the `id:`-only
|
|
68
|
+
opening block dispatches no event the client could check. The connection phase
|
|
69
|
+
is a union (`unopened | open | dropped`) handled exhaustively in `opensStale`.
|
|
70
|
+
A **fatal** error
|
|
64
71
|
(readyState CLOSED — server 401 / route disabled) downgrades to polling **for the
|
|
65
72
|
subscriber's life (no flap-back)**.
|
|
66
73
|
|
|
@@ -2500,6 +2500,17 @@ function createSmrtWebQuery(_collection, transport, options = {}) {
|
|
|
2500
2500
|
//#endregion
|
|
2501
2501
|
//#region src/sse-client.ts
|
|
2502
2502
|
var EVENT_SOURCE_CLOSED = 2;
|
|
2503
|
+
function assertNever(value) {
|
|
2504
|
+
throw new Error(`unhandled SSE connection phase: ${String(value)}`);
|
|
2505
|
+
}
|
|
2506
|
+
function opensStale(phase) {
|
|
2507
|
+
switch (phase) {
|
|
2508
|
+
case "unopened": return false;
|
|
2509
|
+
case "open":
|
|
2510
|
+
case "dropped": return true;
|
|
2511
|
+
default: return assertNever(phase);
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2503
2514
|
function defaultEventSourceFactory(url, init) {
|
|
2504
2515
|
const EventSourceCtor = globalThis.EventSource;
|
|
2505
2516
|
if (typeof EventSourceCtor !== "function") return void 0;
|
|
@@ -2511,6 +2522,7 @@ function createSmrtWebEventSubscriber(config) {
|
|
|
2511
2522
|
let lastSeq = null;
|
|
2512
2523
|
let transport = "idle";
|
|
2513
2524
|
let eventSource = null;
|
|
2525
|
+
let sseConnection = "unopened";
|
|
2514
2526
|
let pollTimer = null;
|
|
2515
2527
|
let closed = false;
|
|
2516
2528
|
const registeredTables = () => [...tableInvalidators.keys()].sort((a, b) => a.localeCompare(b));
|
|
@@ -2619,8 +2631,15 @@ function createSmrtWebEventSubscriber(config) {
|
|
|
2619
2631
|
source.addEventListener("change", onChange);
|
|
2620
2632
|
source.addEventListener("resync", onResync);
|
|
2621
2633
|
source.addEventListener("manifest", onManifest);
|
|
2634
|
+
source.onopen = () => {
|
|
2635
|
+
if (closed) return;
|
|
2636
|
+
const stale = opensStale(sseConnection);
|
|
2637
|
+
sseConnection = "open";
|
|
2638
|
+
if (stale) invalidateAll();
|
|
2639
|
+
};
|
|
2622
2640
|
source.onerror = () => {
|
|
2623
2641
|
if (closed) return;
|
|
2642
|
+
if (sseConnection === "open") sseConnection = "dropped";
|
|
2624
2643
|
if (source.readyState === EVENT_SOURCE_CLOSED) {
|
|
2625
2644
|
try {
|
|
2626
2645
|
source.close();
|
|
@@ -3766,4 +3785,4 @@ function createSmrtCollection(definition, options) {
|
|
|
3766
3785
|
//#endregion
|
|
3767
3786
|
export { wipeDurableStore as A, MAX_SMRT_WEB_DATA_QUERY_FACETS as B, getOutboxHandle as C, pruneDurableNamespace as D, listDurableNamespaces as E, classifySmrtWebDataSurfaceActionResult as F, MAX_SMRT_WEB_DATA_QUERY_ROWS as G, MAX_SMRT_WEB_DATA_QUERY_OFFSET as H, dataSurfaceActionCommandTransport as I, executeSmrtWebDataQuery as J, MAX_SMRT_WEB_DATA_QUERY_STRING_LENGTH as K, executeSmrtWebDataSurfaceAction as L, MAX_SMRT_WEB_DATA_SURFACE_ACTION_IDENTIFIER_LENGTH as M, MAX_SMRT_WEB_DATA_SURFACE_ACTION_JSON_DEPTH as N, durableStoreNamespace as O, MAX_SMRT_WEB_DATA_SURFACE_ACTION_RESULT_BYTES as P, normalizeSmrtWebDataSurfaceActionResult as R, persistDataSurface as S, offlineOutbox as T, MAX_SMRT_WEB_DATA_QUERY_PAGE_LIMIT as U, MAX_SMRT_WEB_DATA_QUERY_FACET_VALUES as V, MAX_SMRT_WEB_DATA_QUERY_RESULT_BYTES as W, runWrapMutation as X, normalizeSmrtWebDataQueryResult as Y, createSmrtWebEventSubscriber as _, createSmrtWebClient as a, DEFAULT_PERSIST_DEBOUNCE_MS as b, newLocalId as c, unwrapListResult as d, validateSmrtWebClient as f, createUpdateState as g, registerWebMcpTools as h, createSmrtCollection as i, MAX_SMRT_WEB_DATA_SURFACE_ACTION_CONTAINER_ITEMS as j, registerDurableResource as k, throwIfSmrtWebError as l, registerWebMcpBespokeTool as m, buildListQuery as n, getEngineCollection as o, registerViewIntent as p, MAX_SMRT_WEB_DATA_QUERY_WARNINGS as q, createDefinitionFetchers as r, invalidateSmrtWebCollections as s, SmrtWebRequestError as t, unwrapItemResult as u, liveInvalidation as v, offlineCommandQueue as w, persistCollection as x, createSmrtWebQuery as y, MAX_SMRT_WEB_DATA_QUERY_CONTAINER_ITEMS as z };
|
|
3768
3787
|
|
|
3769
|
-
//# sourceMappingURL=src-
|
|
3788
|
+
//# sourceMappingURL=src-C-l2Y7G1.js.map
|