Skip to content

Commit be64b42

Browse files
author
Eryk Solecki
committed
Topic class and tests
1 parent 2a9e5cd commit be64b42

File tree

11 files changed

+495
-303
lines changed

11 files changed

+495
-303
lines changed

packages/host/src/lib/serviceDiscovery/StreamHandler.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.

packages/host/src/lib/serviceDiscovery/StreamWrapper.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export type ContentType = "x-ndjson" | "text/plain" | "application/octet-stream"
2+
3+
export const isContentType = (contentType: string): contentType is ContentType => {
4+
return ["x-ndjson", "text/plain", "application/octet-stream"].includes(contentType);
5+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
export enum WorkState {
2+
Flowing = "flowing",
3+
Close = "close",
4+
Error = "error"
5+
}
6+
7+
export enum WritableState {
8+
Finish = "finish",
9+
Writable = "writable",
10+
Drain = "drain"
11+
}
12+
13+
export enum ReadableState {
14+
Readable = "readable",
15+
Pause = "pause",
16+
End = "end"
17+
}
18+
19+
export type StreamState = WorkState | WritableState | ReadableState;
20+
21+
export enum StreamType {
22+
Instance = "instance",
23+
Topic = "topic",
24+
Api = "api"
25+
}
26+
27+
export type StreamOptions = Record<string, any>;
28+
29+
export type OriginType = "space" | "hub"
30+
31+
export type StreamOrigin = {
32+
type: OriginType
33+
id: string;
34+
}
35+
36+
export interface StreamHandler {
37+
id(): string
38+
state(): StreamState
39+
type(): StreamType
40+
options(): StreamOptions
41+
origin(): StreamOrigin
42+
}

0 commit comments

Comments
 (0)