@fencyai/react 0.1.172 → 0.1.173
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/hooks/useFencyEventSource/index.d.ts +0 -1
- package/dist/hooks/useFencyEventSource/index.d.ts.map +1 -1
- package/dist/index.js +1207 -971
- package/dist/provider/StreamEventManager.d.ts +14 -1
- package/dist/provider/StreamEventManager.d.ts.map +1 -1
- package/dist/provider/createStreamWorkerCode.d.ts +7 -0
- package/dist/provider/createStreamWorkerCode.d.ts.map +1 -0
- package/dist/utils/base64Decode.d.ts +5 -0
- package/dist/utils/base64Decode.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -9,18 +9,31 @@ export interface Subscription {
|
|
|
9
9
|
/**
|
|
10
10
|
* Centralized manager for EventSource connections to streams.
|
|
11
11
|
* Ensures only one connection per stream regardless of how many hooks subscribe.
|
|
12
|
+
*
|
|
13
|
+
* When a Web Worker is available, the main thread performs fetch (correct CORS origin)
|
|
14
|
+
* and transfers the response body to the worker for parsing, so the read loop is not
|
|
15
|
+
* stalled by background tab throttling. Otherwise falls back to fetchEventSource on
|
|
16
|
+
* the main thread with openWhenHidden so the connection is not aborted on tab switch.
|
|
12
17
|
*/
|
|
13
18
|
export declare class StreamEventManager {
|
|
14
|
-
private
|
|
19
|
+
private activeConnections;
|
|
15
20
|
private subscribers;
|
|
16
21
|
private fency;
|
|
22
|
+
private worker;
|
|
23
|
+
private workerBlobUrl;
|
|
24
|
+
private workerSupported;
|
|
17
25
|
constructor(fency: FencyInstance);
|
|
26
|
+
private tryInitWorker;
|
|
27
|
+
private handleWorkerMessage;
|
|
18
28
|
/**
|
|
19
29
|
* Called by FencyProvider when activeStreams changes.
|
|
20
30
|
* Creates new connections and removes old ones.
|
|
21
31
|
*/
|
|
22
32
|
updateStreams(streams: StreamCache[]): void;
|
|
23
33
|
private connectStream;
|
|
34
|
+
private connectStreamInWorker;
|
|
35
|
+
private startWorkerStream;
|
|
36
|
+
private connectStreamOnMainThread;
|
|
24
37
|
/**
|
|
25
38
|
* Subscribe to events from all active streams.
|
|
26
39
|
* Returns an unsubscribe function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamEventManager.d.ts","sourceRoot":"","sources":["../../src/provider/StreamEventManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"StreamEventManager.d.ts","sourceRoot":"","sources":["../../src/provider/StreamEventManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAO3C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAQnD,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;AAC7D,KAAK,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;AAEtE,MAAM,WAAW,YAAY;IACzB,SAAS,EAAE,aAAa,CAAA;IACxB,OAAO,EAAE,aAAa,CAAA;CACzB;AAeD;;;;;;;;GAQG;AACH,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,iBAAiB,CAA2C;IACpE,OAAO,CAAC,WAAW,CAAuC;IAC1D,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,eAAe,CAAQ;gBAEnB,KAAK,EAAE,aAAa;IAKhC,OAAO,CAAC,aAAa;IAkCrB,OAAO,CAAC,mBAAmB;IAuB3B;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI;IAiB3C,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,qBAAqB;YAqBf,iBAAiB;IA0D/B,OAAO,CAAC,yBAAyB;IAgDjC;;;OAGG;IACH,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,GAAG,MAAM,IAAI;IAQpE,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,cAAc;IAMtB;;OAEG;IACH,OAAO,IAAI,IAAI;CAqBlB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the source code for the inline SSE stream Web Worker.
|
|
3
|
+
* Consumes a ReadableStream transferred from the main thread (same-origin fetch + CORS)
|
|
4
|
+
* so the read loop runs off the main thread and is not stalled by tab throttling.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createStreamWorkerCode(): string;
|
|
7
|
+
//# sourceMappingURL=createStreamWorkerCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createStreamWorkerCode.d.ts","sourceRoot":"","sources":["../../src/provider/createStreamWorkerCode.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAiJ/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64Decode.d.ts","sourceRoot":"","sources":["../../src/utils/base64Decode.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAOnD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fencyai/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.173",
|
|
4
4
|
"description": "React components and hooks for the Fency AI platform",
|
|
5
5
|
"author": "staklau <steinaageklaussen@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@microsoft/fetch-event-source": "^2.0.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@fencyai/js": "^0.1.
|
|
41
|
+
"@fencyai/js": "^0.1.173",
|
|
42
42
|
"@microsoft/api-documenter": "^7.30.0",
|
|
43
43
|
"@testing-library/react": "^16.3.2",
|
|
44
44
|
"@types/jest": "^30.0.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"vite-plugin-lib-inject-css": "^2.1.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@fencyai/js": "^0.1.
|
|
58
|
+
"@fencyai/js": "^0.1.173",
|
|
59
59
|
"motion": "^11.15.0 || ^12.0.0",
|
|
60
60
|
"react": ">=16.8.0",
|
|
61
61
|
"react-markdown": "^10.1.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"optional": false
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "741b9a50e65d334a345e637969905738174c2772"
|
|
72
72
|
}
|