@6qat/tcp-connection 0.2.6 → 0.2.7

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.
@@ -0,0 +1,38 @@
1
+ import { Context, Effect, Layer, Runtime, Stream } from 'effect';
2
+ declare const TcpConnectionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
3
+ readonly _tag: "TcpConnectionError";
4
+ } & Readonly<A>;
5
+ export declare class TcpConnectionError extends TcpConnectionError_base {
6
+ readonly errorType?: string | undefined;
7
+ constructor(errorType?: string | undefined);
8
+ }
9
+ export declare class TcpConnectionTimeoutError extends TcpConnectionError {
10
+ readonly message: string;
11
+ constructor(message: string);
12
+ }
13
+ export declare class TcpConnectionWriteError extends TcpConnectionError {
14
+ readonly message: string;
15
+ constructor(message: string);
16
+ }
17
+ export declare class TcpConnectionCloseError extends TcpConnectionError {
18
+ readonly message: string;
19
+ constructor(message: string);
20
+ }
21
+ declare const TcpConnection_base: Context.TagClass<TcpConnection, "TcpConnection", TcpConnectionShape>;
22
+ declare class TcpConnection extends TcpConnection_base {
23
+ }
24
+ interface TcpConnectionShape {
25
+ readonly incoming: Stream.Stream<Uint8Array, TcpConnectionError>;
26
+ readonly send: (data: Uint8Array) => Effect.Effect<void, TcpConnectionError>;
27
+ readonly sendWithRetry: (data: Uint8Array) => Effect.Effect<void, TcpConnectionError>;
28
+ }
29
+ declare const TcpConfig_base: Context.TagClass<TcpConfig, "TcpConfig", {
30
+ host: string;
31
+ port: number;
32
+ bufferSize?: number;
33
+ runtimeEffect?: Effect.Effect<Runtime.Runtime<never>, never, never>;
34
+ }>;
35
+ declare class TcpConfig extends TcpConfig_base {
36
+ }
37
+ declare const TcpConnectionLive: Layer.Layer<TcpConnection, TcpConnectionError, TcpConfig>;
38
+ export { TcpConfig, TcpConnection, TcpConnectionLive };
@@ -1,38 +1,38 @@
1
- import { Context, Effect, Layer, Runtime, Stream } from 'effect';
2
- declare const TcpConnectionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
3
- readonly _tag: "TcpConnectionError";
1
+ import { Context, Effect, Layer, Stream } from 'effect';
2
+ declare const TcpStreamError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
3
+ readonly _tag: "TcpStreamError";
4
4
  } & Readonly<A>;
5
- export declare class TcpConnectionError extends TcpConnectionError_base {
6
- readonly errorType?: string | undefined;
7
- constructor(errorType?: string | undefined);
8
- }
9
- export declare class TcpConnectionTimeoutError extends TcpConnectionError {
10
- readonly message: string;
11
- constructor(message: string);
12
- }
13
- export declare class TcpConnectionWriteError extends TcpConnectionError {
5
+ export declare class TcpStreamError extends TcpStreamError_base<{
14
6
  readonly message: string;
15
- constructor(message: string);
7
+ }> {
16
8
  }
17
- export declare class TcpConnectionCloseError extends TcpConnectionError {
18
- readonly message: string;
19
- constructor(message: string);
20
- }
21
- declare const TcpConnection_base: Context.TagClass<TcpConnection, "TcpConnection", TcpConnectionShape>;
22
- declare class TcpConnection extends TcpConnection_base {
9
+ interface TcpStreamShape {
10
+ readonly stream: Stream.Stream<Uint8Array, TcpStreamError>;
11
+ readonly send: (data: Uint8Array) => Effect.Effect<void, TcpStreamError>;
12
+ readonly sendText: (data: string) => Effect.Effect<void, TcpStreamError>;
13
+ readonly close: Effect.Effect<void>;
23
14
  }
24
- interface TcpConnectionShape {
25
- readonly incoming: Stream.Stream<Uint8Array, TcpConnectionError>;
26
- readonly send: (data: Uint8Array) => Effect.Effect<void, TcpConnectionError>;
27
- readonly sendWithRetry: (data: Uint8Array) => Effect.Effect<void, TcpConnectionError>;
15
+ declare const TcpStream_base: Context.TagClass<TcpStream, "TcpStream", TcpStreamShape>;
16
+ export declare class TcpStream extends TcpStream_base {
28
17
  }
29
- declare const TcpConfig_base: Context.TagClass<TcpConfig, "TcpConfig", {
18
+ /**
19
+ * ConnectionConfigShape is an interface that defines the shape of the data
20
+ * needed to connect to the server.
21
+ */
22
+ interface ConnectionConfigShape {
30
23
  host: string;
31
24
  port: number;
32
- bufferSize?: number;
33
- runtimeEffect?: Effect.Effect<Runtime.Runtime<never>, never, never>;
34
- }>;
35
- declare class TcpConfig extends TcpConfig_base {
25
+ magicToken?: string;
26
+ username?: string;
27
+ password?: string;
28
+ tickers?: string[];
29
+ }
30
+ declare const ConnectionConfig_base: Context.TagClass<ConnectionConfig, "ConnectionConfig", ConnectionConfigShape>;
31
+ /**
32
+ * ConnectionConfig is a Context.Tag that provides the connection configuration.
33
+ */
34
+ export declare class ConnectionConfig extends ConnectionConfig_base {
36
35
  }
37
- declare const TcpConnectionLive: Layer.Layer<TcpConnection, TcpConnectionError, TcpConfig>;
38
- export { TcpConfig, TcpConnection, TcpConnectionLive };
36
+ export declare const TcpStreamLive: () => Layer.Layer<TcpStream, TcpStreamError | import("effect/Cause").UnknownException | import("effect/Cause").TimeoutException, ConnectionConfig>;
37
+ export declare const ConnectionConfigLive: (host: string, port: number, tickers: string[], magicToken: string, username: string, password: string) => Layer.Layer<ConnectionConfig, never, never>;
38
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@6qat/tcp-connection",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "TCP connection library with Effect.js integration",
5
5
  "module": "dist/index.js",
6
6
  "main": "dist/index.js",