@qontinui/ui-bridge-native 0.3.0 → 0.3.2
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/dist/{StateAnnotation-WmK1YjwP.d.ts → StateAnnotation--zm0Jfqj.d.ts} +4 -4
- package/dist/{StateAnnotation-D8reaRcS.d.mts → StateAnnotation-BgFoVWFy.d.mts} +4 -4
- package/dist/control/index.d.mts +4 -4
- package/dist/control/index.d.ts +4 -4
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +89 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +89 -6
- package/dist/core/index.mjs.map +1 -1
- package/dist/design/index.d.mts +1 -1
- package/dist/design/index.d.ts +1 -1
- package/dist/{http-server-D2U1k48d.d.mts → http-server--550eD1F.d.mts} +106 -4
- package/dist/{http-server-ck8clUsZ.d.ts → http-server-C9NaNBEP.d.ts} +106 -4
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +576 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +576 -49
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +5 -5
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +576 -49
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +576 -49
- package/dist/react/index.mjs.map +1 -1
- package/dist/{registry-KdUW_koV.d.mts → registry-B5JadBN9.d.mts} +49 -2
- package/dist/{registry-BxXaxmsT.d.ts → registry-pAUpQq2O.d.ts} +49 -2
- package/dist/server/index.d.mts +65 -6
- package/dist/server/index.d.ts +65 -6
- package/dist/server/index.js +438 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +437 -3
- package/dist/server/index.mjs.map +1 -1
- package/dist/{types-DjB0zJJH.d.mts → types-B0XA4vOF.d.mts} +1 -1
- package/dist/{types-BwdPNpII.d.mts → types-CGVut7mc.d.mts} +43 -1
- package/dist/{types-BwdPNpII.d.ts → types-CGVut7mc.d.ts} +43 -1
- package/dist/{types-DCEv5qb6.d.ts → types-CjEKTDYT.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BridgeEventListener, s as NativeSnapshotEnrichers, r as NativeSnapshotEnricher, j as NativeElementRef, l as NativeElementType, w as NativeStandardAction, h as NativeCustomAction, z as RegisteredNativeElement, k as NativeElementState, R as RegisteredNativeComponent, E as Workflow, b as BridgeEventType, e as NativeBridgeSnapshot, q as NativeRegistrationCoverage } from './types-
|
|
1
|
+
import { a as BridgeEventListener, H as NativeAppInfo, I as NativeRouteProviderLike, s as NativeSnapshotEnrichers, r as NativeSnapshotEnricher, j as NativeElementRef, l as NativeElementType, w as NativeStandardAction, h as NativeCustomAction, z as RegisteredNativeElement, k as NativeElementState, R as RegisteredNativeComponent, E as Workflow, b as BridgeEventType, e as NativeBridgeSnapshot, q as NativeRegistrationCoverage } from './types-CGVut7mc.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Native Element and Component Registry
|
|
@@ -69,6 +69,29 @@ declare class NativeUIBridgeRegistry {
|
|
|
69
69
|
private config;
|
|
70
70
|
private enrichers;
|
|
71
71
|
private snapshotExtras;
|
|
72
|
+
/**
|
|
73
|
+
* App identification metadata (appId/appName/appType/framework). Set via
|
|
74
|
+
* `setAppInfo` — typically wired in the server constructor from the
|
|
75
|
+
* `NativeUIBridgeConfig` the host passes to `UIBridgeNativeProvider`.
|
|
76
|
+
*
|
|
77
|
+
* When set, `createSnapshot` includes it on the resulting snapshot so
|
|
78
|
+
* agents can identify the app from snapshot bytes alone (parity with the
|
|
79
|
+
* `uiBridge` block on the `health` response). Snapshots created before
|
|
80
|
+
* this is wired simply omit the field.
|
|
81
|
+
*/
|
|
82
|
+
private appInfo;
|
|
83
|
+
/**
|
|
84
|
+
* Optional route provider. When set, `createSnapshot` reads
|
|
85
|
+
* `currentRoute`/`segments` from it whenever the caller does not pass an
|
|
86
|
+
* explicit `routeInfo` argument. This lets the default `getSnapshot` HTTP
|
|
87
|
+
* handler — which has no direct reference to the `NativeUIBridgeServer`
|
|
88
|
+
* instance — still emit a populated `currentRoute` field.
|
|
89
|
+
*
|
|
90
|
+
* Wired by `NativeUIBridgeServer.setRouteProvider`, which forwards the
|
|
91
|
+
* provider into the registry alongside the per-handler overrides it
|
|
92
|
+
* already installs.
|
|
93
|
+
*/
|
|
94
|
+
private routeProvider;
|
|
72
95
|
/**
|
|
73
96
|
* Sticky flag: flips `true` the first time any element is registered and
|
|
74
97
|
* stays `true` even after elements are unregistered. Lets agents distinguish
|
|
@@ -77,6 +100,23 @@ declare class NativeUIBridgeRegistry {
|
|
|
77
100
|
*/
|
|
78
101
|
private everHadRegistrations;
|
|
79
102
|
constructor(config?: NativeRegistryConfig);
|
|
103
|
+
/**
|
|
104
|
+
* Set the app identification metadata returned alongside snapshots.
|
|
105
|
+
* Idempotent — re-calling with the same shape is a no-op.
|
|
106
|
+
* Pass `null` (or omit a previous call) to clear.
|
|
107
|
+
*/
|
|
108
|
+
setAppInfo(info: NativeAppInfo | null | undefined): void;
|
|
109
|
+
/** Read-only accessor for the registered app info, if any. */
|
|
110
|
+
getAppInfo(): NativeAppInfo | null;
|
|
111
|
+
/**
|
|
112
|
+
* Set a route provider whose `getCurrentRoute`/`getSegments` are read by
|
|
113
|
+
* `createSnapshot` when no explicit `routeInfo` argument is supplied.
|
|
114
|
+
*
|
|
115
|
+
* Call with `null` to detach (e.g. when the host swaps providers on HMR).
|
|
116
|
+
*/
|
|
117
|
+
setRouteProvider(provider: NativeRouteProviderLike | null | undefined): void;
|
|
118
|
+
/** Read-only accessor for the registered route provider, if any. */
|
|
119
|
+
getRouteProvider(): NativeRouteProviderLike | null;
|
|
80
120
|
/**
|
|
81
121
|
* Register/replace canonical enrichers (modal/toast/undo). HMR-safe — calling
|
|
82
122
|
* with a partial set merges into existing slots instead of clobbering them.
|
|
@@ -207,7 +247,14 @@ declare class NativeUIBridgeRegistry {
|
|
|
207
247
|
*/
|
|
208
248
|
emit(type: BridgeEventType, data: unknown): void;
|
|
209
249
|
/**
|
|
210
|
-
* Create a snapshot of the current state
|
|
250
|
+
* Create a snapshot of the current state.
|
|
251
|
+
*
|
|
252
|
+
* Route resolution: `routeInfo` wins when provided. Otherwise — and this
|
|
253
|
+
* is the path the default `getSnapshot` HTTP handler takes — we fall back
|
|
254
|
+
* to the registered `routeProvider`. This means callers that never wire a
|
|
255
|
+
* server-level override (the bare-server / cloud-relay path) still get a
|
|
256
|
+
* populated `currentRoute` field as long as `setRouteProvider` was called
|
|
257
|
+
* on the registry.
|
|
211
258
|
*/
|
|
212
259
|
createSnapshot(routeInfo?: {
|
|
213
260
|
currentRoute?: string | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BridgeEventListener, s as NativeSnapshotEnrichers, r as NativeSnapshotEnricher, j as NativeElementRef, l as NativeElementType, w as NativeStandardAction, h as NativeCustomAction, z as RegisteredNativeElement, k as NativeElementState, R as RegisteredNativeComponent, E as Workflow, b as BridgeEventType, e as NativeBridgeSnapshot, q as NativeRegistrationCoverage } from './types-
|
|
1
|
+
import { a as BridgeEventListener, H as NativeAppInfo, I as NativeRouteProviderLike, s as NativeSnapshotEnrichers, r as NativeSnapshotEnricher, j as NativeElementRef, l as NativeElementType, w as NativeStandardAction, h as NativeCustomAction, z as RegisteredNativeElement, k as NativeElementState, R as RegisteredNativeComponent, E as Workflow, b as BridgeEventType, e as NativeBridgeSnapshot, q as NativeRegistrationCoverage } from './types-CGVut7mc.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Native Element and Component Registry
|
|
@@ -69,6 +69,29 @@ declare class NativeUIBridgeRegistry {
|
|
|
69
69
|
private config;
|
|
70
70
|
private enrichers;
|
|
71
71
|
private snapshotExtras;
|
|
72
|
+
/**
|
|
73
|
+
* App identification metadata (appId/appName/appType/framework). Set via
|
|
74
|
+
* `setAppInfo` — typically wired in the server constructor from the
|
|
75
|
+
* `NativeUIBridgeConfig` the host passes to `UIBridgeNativeProvider`.
|
|
76
|
+
*
|
|
77
|
+
* When set, `createSnapshot` includes it on the resulting snapshot so
|
|
78
|
+
* agents can identify the app from snapshot bytes alone (parity with the
|
|
79
|
+
* `uiBridge` block on the `health` response). Snapshots created before
|
|
80
|
+
* this is wired simply omit the field.
|
|
81
|
+
*/
|
|
82
|
+
private appInfo;
|
|
83
|
+
/**
|
|
84
|
+
* Optional route provider. When set, `createSnapshot` reads
|
|
85
|
+
* `currentRoute`/`segments` from it whenever the caller does not pass an
|
|
86
|
+
* explicit `routeInfo` argument. This lets the default `getSnapshot` HTTP
|
|
87
|
+
* handler — which has no direct reference to the `NativeUIBridgeServer`
|
|
88
|
+
* instance — still emit a populated `currentRoute` field.
|
|
89
|
+
*
|
|
90
|
+
* Wired by `NativeUIBridgeServer.setRouteProvider`, which forwards the
|
|
91
|
+
* provider into the registry alongside the per-handler overrides it
|
|
92
|
+
* already installs.
|
|
93
|
+
*/
|
|
94
|
+
private routeProvider;
|
|
72
95
|
/**
|
|
73
96
|
* Sticky flag: flips `true` the first time any element is registered and
|
|
74
97
|
* stays `true` even after elements are unregistered. Lets agents distinguish
|
|
@@ -77,6 +100,23 @@ declare class NativeUIBridgeRegistry {
|
|
|
77
100
|
*/
|
|
78
101
|
private everHadRegistrations;
|
|
79
102
|
constructor(config?: NativeRegistryConfig);
|
|
103
|
+
/**
|
|
104
|
+
* Set the app identification metadata returned alongside snapshots.
|
|
105
|
+
* Idempotent — re-calling with the same shape is a no-op.
|
|
106
|
+
* Pass `null` (or omit a previous call) to clear.
|
|
107
|
+
*/
|
|
108
|
+
setAppInfo(info: NativeAppInfo | null | undefined): void;
|
|
109
|
+
/** Read-only accessor for the registered app info, if any. */
|
|
110
|
+
getAppInfo(): NativeAppInfo | null;
|
|
111
|
+
/**
|
|
112
|
+
* Set a route provider whose `getCurrentRoute`/`getSegments` are read by
|
|
113
|
+
* `createSnapshot` when no explicit `routeInfo` argument is supplied.
|
|
114
|
+
*
|
|
115
|
+
* Call with `null` to detach (e.g. when the host swaps providers on HMR).
|
|
116
|
+
*/
|
|
117
|
+
setRouteProvider(provider: NativeRouteProviderLike | null | undefined): void;
|
|
118
|
+
/** Read-only accessor for the registered route provider, if any. */
|
|
119
|
+
getRouteProvider(): NativeRouteProviderLike | null;
|
|
80
120
|
/**
|
|
81
121
|
* Register/replace canonical enrichers (modal/toast/undo). HMR-safe — calling
|
|
82
122
|
* with a partial set merges into existing slots instead of clobbering them.
|
|
@@ -207,7 +247,14 @@ declare class NativeUIBridgeRegistry {
|
|
|
207
247
|
*/
|
|
208
248
|
emit(type: BridgeEventType, data: unknown): void;
|
|
209
249
|
/**
|
|
210
|
-
* Create a snapshot of the current state
|
|
250
|
+
* Create a snapshot of the current state.
|
|
251
|
+
*
|
|
252
|
+
* Route resolution: `routeInfo` wins when provided. Otherwise — and this
|
|
253
|
+
* is the path the default `getSnapshot` HTTP handler takes — we fall back
|
|
254
|
+
* to the registered `routeProvider`. This means callers that never wire a
|
|
255
|
+
* server-level override (the bare-server / cloud-relay path) still get a
|
|
256
|
+
* populated `currentRoute` field as long as `setRouteProvider` was called
|
|
257
|
+
* on the registry.
|
|
211
258
|
*/
|
|
212
259
|
createSnapshot(routeInfo?: {
|
|
213
260
|
currentRoute?: string | null;
|
package/dist/server/index.d.mts
CHANGED
|
@@ -1,9 +1,64 @@
|
|
|
1
|
-
import { k as NativeServerHandlers, e as HandlerContext, A as APIResponse } from '../http-server
|
|
2
|
-
export { D as DismissModalResponse, F as FillFormFieldInput, a as FillFormFieldResult, b as FillFormRequest, c as FillFormResponse, H as HTTPRequest, d as HTTPResponse, f as HandlerFunction, J as JsonRpcBatchRequest, g as JsonRpcBatchResponse,
|
|
3
|
-
import { a as NativeUIBridgeRegistry } from '../registry-
|
|
4
|
-
import { N as NativeActionExecutor } from '../types-
|
|
1
|
+
import { C as ConsoleErrorEntry, u as NetworkRequestEntry, k as NativeServerHandlers, e as HandlerContext, A as APIResponse } from '../http-server--550eD1F.mjs';
|
|
2
|
+
export { v as ConsoleErrorsResponse, D as DismissModalResponse, F as FillFormFieldInput, a as FillFormFieldResult, b as FillFormRequest, c as FillFormResponse, H as HTTPRequest, d as HTTPResponse, f as HandlerFunction, J as JsonRpcBatchRequest, g as JsonRpcBatchResponse, w as JsonRpcClientMessage, h as JsonRpcEvent, i as JsonRpcRequest, j as JsonRpcResponse, x as JsonRpcServerMessage, y as JsonRpcSubscribe, z as JsonRpcUnsubscribe, N as NativeServerConfig, l as NativeUIBridgeServer, m as NavigationProvider, B as NetworkRequestsResponse, P as PushModalRequest, E as PushModalResponse, R as RequestHandler, n as RouteDefinition, o as RouteProvider, S as ScreenshotProvider, p as ServerAdapter, T as TapAtRequest, G as TapAtResponse, U as UI_BRIDGE_NATIVE_ROUTES, W as WebSocketConnection, q as WebSocketEventBridge, r as WebSocketMessageHandler, s as WebSocketServerAdapter, t as createNativeServer, I as isBatchRequest, K as isSubscribe, L as isUnsubscribe } from '../http-server--550eD1F.mjs';
|
|
3
|
+
import { a as NativeUIBridgeRegistry } from '../registry-B5JadBN9.mjs';
|
|
4
|
+
import { N as NativeActionExecutor } from '../types-B0XA4vOF.mjs';
|
|
5
5
|
import { E as ElementDesignData, S as StateStyles, R as ResponsiveSnapshot } from '../design-types-BHr6Q1FX.mjs';
|
|
6
|
-
import '../types-
|
|
6
|
+
import '../types-CGVut7mc.mjs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* UI Bridge Native — observability ring buffers.
|
|
10
|
+
*
|
|
11
|
+
* Two small last-N buffers backing the `/control/console-errors` and
|
|
12
|
+
* `/sdk/network-requests` endpoints. Each buffer monkey-patches the relevant
|
|
13
|
+
* global on `install()` and restores the original on `uninstall()`, so they
|
|
14
|
+
* can be installed/torn-down with the server's lifecycle.
|
|
15
|
+
*
|
|
16
|
+
* Both buffers are gated behind `features.testHooks` by the caller (see
|
|
17
|
+
* NativeUIBridgeServer). Production builds default to `testHooks: false`,
|
|
18
|
+
* so these patches never run on real users' devices.
|
|
19
|
+
*
|
|
20
|
+
* Implementation notes:
|
|
21
|
+
* - Buffers default to capacity 100 entries and drop oldest on overflow.
|
|
22
|
+
* - Patches are idempotent: `install()` is a no-op when already installed;
|
|
23
|
+
* `uninstall()` is a no-op when not installed.
|
|
24
|
+
* - Patches only restore the *original* function captured at install time;
|
|
25
|
+
* if other code wraps `console.error` / `fetch` between install and
|
|
26
|
+
* uninstall, those wrappers will be lost. Acceptable for test hooks.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
declare class ConsoleErrorBuffer {
|
|
30
|
+
private buffer;
|
|
31
|
+
private installed;
|
|
32
|
+
private originalError?;
|
|
33
|
+
private originalWarn?;
|
|
34
|
+
constructor(capacity?: number);
|
|
35
|
+
install(): void;
|
|
36
|
+
uninstall(): void;
|
|
37
|
+
entries(opts?: {
|
|
38
|
+
since?: number;
|
|
39
|
+
limit?: number;
|
|
40
|
+
}): ConsoleErrorEntry[];
|
|
41
|
+
size(): number;
|
|
42
|
+
clear(): void;
|
|
43
|
+
isInstalled(): boolean;
|
|
44
|
+
}
|
|
45
|
+
declare class NetworkRequestBuffer {
|
|
46
|
+
private buffer;
|
|
47
|
+
private installed;
|
|
48
|
+
private originalFetch?;
|
|
49
|
+
private originalXhrOpen?;
|
|
50
|
+
private originalXhrSend?;
|
|
51
|
+
constructor(capacity?: number);
|
|
52
|
+
install(): void;
|
|
53
|
+
uninstall(): void;
|
|
54
|
+
entries(opts?: {
|
|
55
|
+
since?: number;
|
|
56
|
+
limit?: number;
|
|
57
|
+
}): NetworkRequestEntry[];
|
|
58
|
+
size(): number;
|
|
59
|
+
clear(): void;
|
|
60
|
+
isInstalled(): boolean;
|
|
61
|
+
}
|
|
7
62
|
|
|
8
63
|
/**
|
|
9
64
|
* UI Bridge Native Server Handlers
|
|
@@ -21,6 +76,10 @@ declare function createServerHandlers(registry: NativeUIBridgeRegistry, executor
|
|
|
21
76
|
appType: string;
|
|
22
77
|
framework?: string;
|
|
23
78
|
};
|
|
79
|
+
/** Optional console-error ring buffer powering `GET /control/console-errors`. */
|
|
80
|
+
consoleErrorBuffer?: ConsoleErrorBuffer;
|
|
81
|
+
/** Optional network-request ring buffer powering `GET /sdk/network-requests`. */
|
|
82
|
+
networkRequestBuffer?: NetworkRequestBuffer;
|
|
24
83
|
}): NativeServerHandlers;
|
|
25
84
|
|
|
26
85
|
/**
|
|
@@ -116,4 +175,4 @@ interface NativeDesignHandlers {
|
|
|
116
175
|
*/
|
|
117
176
|
declare function createDesignHandlers(registry: NativeUIBridgeRegistry): NativeDesignHandlers;
|
|
118
177
|
|
|
119
|
-
export { APIResponse, type DecodeResult, type DecodedFrame, HandlerContext, type NativeDesignHandlers, NativeServerHandlers, OPCODE_BINARY, OPCODE_CLOSE, OPCODE_CONTINUATION, OPCODE_PING, OPCODE_PONG, OPCODE_TEXT, buildUpgradeResponse, computeAcceptKey, createDesignHandlers, createServerHandlers, decodeFrames, decodeTextPayload, encodeCloseFrame, encodePingFrame, encodePongFrame, encodeTextFrame };
|
|
178
|
+
export { APIResponse, ConsoleErrorBuffer, ConsoleErrorEntry, type DecodeResult, type DecodedFrame, HandlerContext, type NativeDesignHandlers, NativeServerHandlers, NetworkRequestBuffer, NetworkRequestEntry, OPCODE_BINARY, OPCODE_CLOSE, OPCODE_CONTINUATION, OPCODE_PING, OPCODE_PONG, OPCODE_TEXT, buildUpgradeResponse, computeAcceptKey, createDesignHandlers, createServerHandlers, decodeFrames, decodeTextPayload, encodeCloseFrame, encodePingFrame, encodePongFrame, encodeTextFrame };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,9 +1,64 @@
|
|
|
1
|
-
import { k as NativeServerHandlers, e as HandlerContext, A as APIResponse } from '../http-server-
|
|
2
|
-
export { D as DismissModalResponse, F as FillFormFieldInput, a as FillFormFieldResult, b as FillFormRequest, c as FillFormResponse, H as HTTPRequest, d as HTTPResponse, f as HandlerFunction, J as JsonRpcBatchRequest, g as JsonRpcBatchResponse,
|
|
3
|
-
import { a as NativeUIBridgeRegistry } from '../registry-
|
|
4
|
-
import { N as NativeActionExecutor } from '../types-
|
|
1
|
+
import { C as ConsoleErrorEntry, u as NetworkRequestEntry, k as NativeServerHandlers, e as HandlerContext, A as APIResponse } from '../http-server-C9NaNBEP.js';
|
|
2
|
+
export { v as ConsoleErrorsResponse, D as DismissModalResponse, F as FillFormFieldInput, a as FillFormFieldResult, b as FillFormRequest, c as FillFormResponse, H as HTTPRequest, d as HTTPResponse, f as HandlerFunction, J as JsonRpcBatchRequest, g as JsonRpcBatchResponse, w as JsonRpcClientMessage, h as JsonRpcEvent, i as JsonRpcRequest, j as JsonRpcResponse, x as JsonRpcServerMessage, y as JsonRpcSubscribe, z as JsonRpcUnsubscribe, N as NativeServerConfig, l as NativeUIBridgeServer, m as NavigationProvider, B as NetworkRequestsResponse, P as PushModalRequest, E as PushModalResponse, R as RequestHandler, n as RouteDefinition, o as RouteProvider, S as ScreenshotProvider, p as ServerAdapter, T as TapAtRequest, G as TapAtResponse, U as UI_BRIDGE_NATIVE_ROUTES, W as WebSocketConnection, q as WebSocketEventBridge, r as WebSocketMessageHandler, s as WebSocketServerAdapter, t as createNativeServer, I as isBatchRequest, K as isSubscribe, L as isUnsubscribe } from '../http-server-C9NaNBEP.js';
|
|
3
|
+
import { a as NativeUIBridgeRegistry } from '../registry-pAUpQq2O.js';
|
|
4
|
+
import { N as NativeActionExecutor } from '../types-CjEKTDYT.js';
|
|
5
5
|
import { E as ElementDesignData, S as StateStyles, R as ResponsiveSnapshot } from '../design-types-BHr6Q1FX.js';
|
|
6
|
-
import '../types-
|
|
6
|
+
import '../types-CGVut7mc.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* UI Bridge Native — observability ring buffers.
|
|
10
|
+
*
|
|
11
|
+
* Two small last-N buffers backing the `/control/console-errors` and
|
|
12
|
+
* `/sdk/network-requests` endpoints. Each buffer monkey-patches the relevant
|
|
13
|
+
* global on `install()` and restores the original on `uninstall()`, so they
|
|
14
|
+
* can be installed/torn-down with the server's lifecycle.
|
|
15
|
+
*
|
|
16
|
+
* Both buffers are gated behind `features.testHooks` by the caller (see
|
|
17
|
+
* NativeUIBridgeServer). Production builds default to `testHooks: false`,
|
|
18
|
+
* so these patches never run on real users' devices.
|
|
19
|
+
*
|
|
20
|
+
* Implementation notes:
|
|
21
|
+
* - Buffers default to capacity 100 entries and drop oldest on overflow.
|
|
22
|
+
* - Patches are idempotent: `install()` is a no-op when already installed;
|
|
23
|
+
* `uninstall()` is a no-op when not installed.
|
|
24
|
+
* - Patches only restore the *original* function captured at install time;
|
|
25
|
+
* if other code wraps `console.error` / `fetch` between install and
|
|
26
|
+
* uninstall, those wrappers will be lost. Acceptable for test hooks.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
declare class ConsoleErrorBuffer {
|
|
30
|
+
private buffer;
|
|
31
|
+
private installed;
|
|
32
|
+
private originalError?;
|
|
33
|
+
private originalWarn?;
|
|
34
|
+
constructor(capacity?: number);
|
|
35
|
+
install(): void;
|
|
36
|
+
uninstall(): void;
|
|
37
|
+
entries(opts?: {
|
|
38
|
+
since?: number;
|
|
39
|
+
limit?: number;
|
|
40
|
+
}): ConsoleErrorEntry[];
|
|
41
|
+
size(): number;
|
|
42
|
+
clear(): void;
|
|
43
|
+
isInstalled(): boolean;
|
|
44
|
+
}
|
|
45
|
+
declare class NetworkRequestBuffer {
|
|
46
|
+
private buffer;
|
|
47
|
+
private installed;
|
|
48
|
+
private originalFetch?;
|
|
49
|
+
private originalXhrOpen?;
|
|
50
|
+
private originalXhrSend?;
|
|
51
|
+
constructor(capacity?: number);
|
|
52
|
+
install(): void;
|
|
53
|
+
uninstall(): void;
|
|
54
|
+
entries(opts?: {
|
|
55
|
+
since?: number;
|
|
56
|
+
limit?: number;
|
|
57
|
+
}): NetworkRequestEntry[];
|
|
58
|
+
size(): number;
|
|
59
|
+
clear(): void;
|
|
60
|
+
isInstalled(): boolean;
|
|
61
|
+
}
|
|
7
62
|
|
|
8
63
|
/**
|
|
9
64
|
* UI Bridge Native Server Handlers
|
|
@@ -21,6 +76,10 @@ declare function createServerHandlers(registry: NativeUIBridgeRegistry, executor
|
|
|
21
76
|
appType: string;
|
|
22
77
|
framework?: string;
|
|
23
78
|
};
|
|
79
|
+
/** Optional console-error ring buffer powering `GET /control/console-errors`. */
|
|
80
|
+
consoleErrorBuffer?: ConsoleErrorBuffer;
|
|
81
|
+
/** Optional network-request ring buffer powering `GET /sdk/network-requests`. */
|
|
82
|
+
networkRequestBuffer?: NetworkRequestBuffer;
|
|
24
83
|
}): NativeServerHandlers;
|
|
25
84
|
|
|
26
85
|
/**
|
|
@@ -116,4 +175,4 @@ interface NativeDesignHandlers {
|
|
|
116
175
|
*/
|
|
117
176
|
declare function createDesignHandlers(registry: NativeUIBridgeRegistry): NativeDesignHandlers;
|
|
118
177
|
|
|
119
|
-
export { APIResponse, type DecodeResult, type DecodedFrame, HandlerContext, type NativeDesignHandlers, NativeServerHandlers, OPCODE_BINARY, OPCODE_CLOSE, OPCODE_CONTINUATION, OPCODE_PING, OPCODE_PONG, OPCODE_TEXT, buildUpgradeResponse, computeAcceptKey, createDesignHandlers, createServerHandlers, decodeFrames, decodeTextPayload, encodeCloseFrame, encodePingFrame, encodePongFrame, encodeTextFrame };
|
|
178
|
+
export { APIResponse, ConsoleErrorBuffer, ConsoleErrorEntry, type DecodeResult, type DecodedFrame, HandlerContext, type NativeDesignHandlers, NativeServerHandlers, NetworkRequestBuffer, NetworkRequestEntry, OPCODE_BINARY, OPCODE_CLOSE, OPCODE_CONTINUATION, OPCODE_PING, OPCODE_PONG, OPCODE_TEXT, buildUpgradeResponse, computeAcceptKey, createDesignHandlers, createServerHandlers, decodeFrames, decodeTextPayload, encodeCloseFrame, encodePingFrame, encodePongFrame, encodeTextFrame };
|