@luvio/command-sse
Advanced tools
Comparing version 5.7.1 to 5.8.0
import { type ServiceDescriptor } from '@luvio/utils'; | ||
import { StreamingCommand } from '@luvio/command-streaming/v1'; | ||
import type { NamedFetchService } from '@luvio/service-fetch-network/v1'; | ||
export type SSEMessage = { | ||
event: string; | ||
data: string; | ||
id: string; | ||
retry?: number; | ||
}; | ||
/** | ||
* An implementation of StreamingCommand that handles SSE (Server-Sent Event) streams. | ||
*/ | ||
export declare abstract class SSECommand<StreamedData = SSEMessage, ExtraServices extends Record<string, unknown> = {}> extends StreamingCommand<StreamedData, ExtraServices> { | ||
protected services: NamedFetchService & ExtraServices; | ||
constructor(services: NamedFetchService & ExtraServices); | ||
/** | ||
* Decodes the bytes returned by fetch into the correct shape. | ||
* | ||
* @param byteStream ReadableStream<Uint8Array> returned by fetch | ||
* @returns ReadableStream<StreamedData> that will be the result of the Command | ||
*/ | ||
decodeByteStream(byteStream: ReadableStream<Uint8Array>): ReadableStream<StreamedData>; | ||
abstract decodeSSEStream(sseStream: ReadableStream<SSEMessage>): ReadableStream<StreamedData>; | ||
} | ||
import { SSECommand } from './sse-command'; | ||
export { SSEMessage } from './sse-command'; | ||
export type SSECommandServiceDescriptor = ServiceDescriptor<typeof SSECommand, 'SSECommandBaseClass', '1.0'>; | ||
export declare function buildSSECommandBaseClassService(): SSECommandServiceDescriptor; | ||
export declare class SSEParsingStream extends TransformStream<string, SSEMessage> { | ||
constructor(); | ||
} | ||
export declare function buildServiceDescriptor(): SSECommandServiceDescriptor; |
@@ -30,9 +30,2 @@ /** | ||
} | ||
function buildSSECommandBaseClassService() { | ||
return { | ||
type: 'SSECommandBaseClass', | ||
version: '1.0', | ||
service: SSECommand, | ||
}; | ||
} | ||
const sseRegex = /^(?<field>[^:]*?)(: ?(?<value>.*?))?(?:\r\n?|\n)/; | ||
@@ -118,2 +111,10 @@ // +-------v------++--------v--------++-----v----+ | ||
export { SSECommand, SSEParsingStream, buildSSECommandBaseClassService }; | ||
function buildServiceDescriptor() { | ||
return { | ||
type: 'SSECommandBaseClass', | ||
version: '1.0', | ||
service: SSECommand, | ||
}; | ||
} | ||
export { buildServiceDescriptor }; |
import { type ServiceDescriptor } from '@luvio/utils'; | ||
import { StreamingCommand } from '@luvio/command-streaming/v1'; | ||
import type { NamedFetchService } from '@luvio/service-fetch-network/v1'; | ||
export type SSEMessage = { | ||
event: string; | ||
data: string; | ||
id: string; | ||
retry?: number; | ||
}; | ||
/** | ||
* An implementation of StreamingCommand that handles SSE (Server-Sent Event) streams. | ||
*/ | ||
export declare abstract class SSECommand<StreamedData = SSEMessage, ExtraServices extends Record<string, unknown> = {}> extends StreamingCommand<StreamedData, ExtraServices> { | ||
protected services: NamedFetchService & ExtraServices; | ||
constructor(services: NamedFetchService & ExtraServices); | ||
/** | ||
* Decodes the bytes returned by fetch into the correct shape. | ||
* | ||
* @param byteStream ReadableStream<Uint8Array> returned by fetch | ||
* @returns ReadableStream<StreamedData> that will be the result of the Command | ||
*/ | ||
decodeByteStream(byteStream: ReadableStream<Uint8Array>): ReadableStream<StreamedData>; | ||
abstract decodeSSEStream(sseStream: ReadableStream<SSEMessage>): ReadableStream<StreamedData>; | ||
} | ||
import { SSECommand } from './sse-command'; | ||
export { SSEMessage } from './sse-command'; | ||
export type SSECommandServiceDescriptor = ServiceDescriptor<typeof SSECommand, 'SSECommandBaseClass', '1.0'>; | ||
export declare function buildSSECommandBaseClassService(): SSECommandServiceDescriptor; | ||
export declare class SSEParsingStream extends TransformStream<string, SSEMessage> { | ||
constructor(); | ||
} | ||
export declare function buildServiceDescriptor(): SSECommandServiceDescriptor; |
{ | ||
"name": "@luvio/command-sse", | ||
"version": "5.7.1", | ||
"version": "5.8.0", | ||
"private": false, | ||
@@ -34,6 +34,6 @@ "description": "Luvio SSE Streaming Command", | ||
"dependencies": { | ||
"@luvio/command-base": "^5.7.1", | ||
"@luvio/command-streaming": "^5.7.1", | ||
"@luvio/service-fetch-network": "^5.7.1", | ||
"@luvio/utils": "^5.7.1" | ||
"@luvio/command-base": "^5.8.0", | ||
"@luvio/command-streaming": "^5.8.0", | ||
"@luvio/service-fetch-network": "^5.8.0", | ||
"@luvio/utils": "^5.8.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "bundlesize": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14741
9
181
Updated@luvio/command-base@^5.8.0
Updated@luvio/utils@^5.8.0