@ahoo-wang/fetcher-eventstream 0.0.9 → 0.1.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.
package/README.md CHANGED
@@ -14,6 +14,9 @@ Support for text/event-stream in Fetcher, enabling Server-Sent Events (SSE) func
14
14
  - **Interceptor Integration**: Automatically adds `eventStream()` method to responses with `text/event-stream` content type
15
15
  - **SSE Parsing**: Parses Server-Sent Events according to the specification, including data, event, id, and retry fields
16
16
  - **Streaming Support**: Handles chunked data and multi-line events correctly
17
+ - **Comment Handling**: Properly ignores comment lines (lines starting with `:`) as per SSE specification
18
+ - **Event ID Tracking**: Maintains last event ID for automatic reconnection
19
+ - **Retry Management**: Handles retry timeout values for connection reattempts
17
20
  - **TypeScript Support**: Complete TypeScript type definitions
18
21
 
19
22
  ## Installation
@@ -2,7 +2,7 @@ import { ServerSentEventStream } from './serverSentEventTransformStream';
2
2
  import { ResponseInterceptor } from '@ahoo-wang/fetcher';
3
3
  declare global {
4
4
  interface Response {
5
- eventStream(): ServerSentEventStream | undefined;
5
+ eventStream?(): ServerSentEventStream;
6
6
  }
7
7
  }
8
8
  export declare class EventStreamInterceptor implements ResponseInterceptor {
@@ -1 +1 @@
1
- {"version":3,"file":"eventStreamInterceptor.d.ts","sourceRoot":"","sources":["../src/eventStreamInterceptor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAGL,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,QAAQ;QAChB,WAAW,IAAI,qBAAqB,GAAG,SAAS,CAAC;KAClD;CACF;AAED,qBAAa,sBAAuB,YAAW,mBAAmB;IAChE,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;CAYxC"}
1
+ {"version":3,"file":"eventStreamInterceptor.d.ts","sourceRoot":"","sources":["../src/eventStreamInterceptor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAGL,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,QAAQ;QAChB,WAAW,CAAC,IAAI,qBAAqB,CAAC;KACvC;CACF;AAED,qBAAa,sBAAuB,YAAW,mBAAmB;IAChE,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;CAYxC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahoo-wang/fetcher-eventstream",
3
- "version": "0.0.9",
3
+ "version": "0.1.1",
4
4
  "description": "Support for text/event-stream in Fetcher",
5
5
  "keywords": [
6
6
  "fetch",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@ahoo-wang/fetcher": "0.0.9"
36
+ "@ahoo-wang/fetcher": "0.1.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@vitest/coverage-v8": "^3.2.4",