@redonvn/event-ws-cliproxyapi-sdk 0.1.0 → 0.2.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/dist/types.d.ts DELETED
@@ -1,101 +0,0 @@
1
- export type HTTPHeaders = Record<string, string | string[]>;
2
- export type WSHeaders = Record<string, string[]>;
3
- export interface HTTPRequest {
4
- method: string;
5
- url: string;
6
- headers?: WSHeaders;
7
- body?: string;
8
- sent_at?: string;
9
- }
10
- export interface HTTPResponse {
11
- status: number;
12
- headers?: HTTPHeaders;
13
- body?: string;
14
- }
15
- export interface WSHttpRequestPayload {
16
- method: string;
17
- url: string;
18
- headers?: WSHeaders;
19
- body?: string;
20
- sent_at?: string;
21
- }
22
- export interface WSHttpResponsePayload {
23
- status: number;
24
- headers?: WSHeaders;
25
- body?: string;
26
- }
27
- export interface WSStreamChunkPayload {
28
- data: string;
29
- }
30
- export interface WSErrorPayload {
31
- error: string;
32
- status?: number;
33
- }
34
- export interface WSHttpRequestMessage {
35
- id: string;
36
- type: 'http_request';
37
- payload: WSHttpRequestPayload;
38
- }
39
- export interface WSHttpResponseMessage {
40
- id: string;
41
- type: 'http_response';
42
- payload: WSHttpResponsePayload;
43
- }
44
- export interface WSStreamStartMessage {
45
- id: string;
46
- type: 'stream_start';
47
- payload: WSHttpResponsePayload;
48
- }
49
- export interface WSStreamChunkMessage {
50
- id: string;
51
- type: 'stream_chunk';
52
- payload: WSStreamChunkPayload;
53
- }
54
- export interface WSStreamEndMessage {
55
- id: string;
56
- type: 'stream_end';
57
- payload?: undefined;
58
- }
59
- export interface WSErrorMessage {
60
- id: string;
61
- type: 'error';
62
- payload: WSErrorPayload;
63
- }
64
- export interface WSPingMessage {
65
- id: string;
66
- type: 'ping';
67
- payload?: undefined;
68
- }
69
- export interface WSPongMessage {
70
- id: string;
71
- type: 'pong';
72
- payload?: undefined;
73
- }
74
- export type WSMessage = WSHttpRequestMessage | WSHttpResponseMessage | WSStreamStartMessage | WSStreamChunkMessage | WSStreamEndMessage | WSErrorMessage | WSPingMessage | WSPongMessage;
75
- export interface ProviderOptions {
76
- baseUrl: string;
77
- accessKey?: string;
78
- }
79
- export type ProviderEvent = {
80
- type: 'error';
81
- requestId?: string;
82
- error: string;
83
- } | {
84
- type: 'ws:open';
85
- } | {
86
- type: 'ws:close';
87
- code?: number;
88
- reason?: string;
89
- } | {
90
- type: 'request';
91
- requestId: string;
92
- request: HTTPRequest;
93
- };
94
- export interface WSRequestContext {
95
- requestId: string;
96
- respond: (resp: HTTPResponse) => void;
97
- streamStart: (status?: number, headers?: HTTPHeaders) => void;
98
- streamChunk: (chunk: string) => void;
99
- streamEnd: () => void;
100
- error: (message: string, status?: number) => void;
101
- }
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- export {};
File without changes
@@ -1,2 +0,0 @@
1
- "use strict";
2
- // Placeholder for shared utilities