@pezkuwi/rpc-provider 16.5.8 → 16.5.9
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/cjs/packageInfo.js +1 -1
- package/package.json +12 -12
- package/packageInfo.js +1 -1
- package/build/LICENSE +0 -201
- package/build/README.md +0 -68
- package/build/bizinikiwi-connect/Health.d.ts +0 -7
- package/build/bizinikiwi-connect/Health.js +0 -259
- package/build/bizinikiwi-connect/index.d.ts +0 -22
- package/build/bizinikiwi-connect/index.js +0 -319
- package/build/bizinikiwi-connect/types.d.ts +0 -12
- package/build/bizinikiwi-connect/types.js +0 -1
- package/build/bundle.d.ts +0 -5
- package/build/bundle.js +0 -5
- package/build/cjs/bizinikiwi-connect/Health.d.ts +0 -7
- package/build/cjs/bizinikiwi-connect/Health.js +0 -264
- package/build/cjs/bizinikiwi-connect/index.d.ts +0 -22
- package/build/cjs/bizinikiwi-connect/index.js +0 -323
- package/build/cjs/bizinikiwi-connect/types.d.ts +0 -12
- package/build/cjs/bizinikiwi-connect/types.js +0 -2
- package/build/cjs/bundle.d.ts +0 -5
- package/build/cjs/bundle.js +0 -14
- package/build/cjs/coder/error.d.ts +0 -29
- package/build/cjs/coder/error.js +0 -53
- package/build/cjs/coder/index.d.ts +0 -8
- package/build/cjs/coder/index.js +0 -63
- package/build/cjs/defaults.d.ts +0 -5
- package/build/cjs/defaults.js +0 -8
- package/build/cjs/http/index.d.ts +0 -81
- package/build/cjs/http/index.js +0 -196
- package/build/cjs/http/types.d.ts +0 -7
- package/build/cjs/http/types.js +0 -2
- package/build/cjs/index.d.ts +0 -2
- package/build/cjs/index.js +0 -5
- package/build/cjs/lru.d.ts +0 -15
- package/build/cjs/lru.js +0 -150
- package/build/cjs/mock/index.d.ts +0 -35
- package/build/cjs/mock/index.js +0 -196
- package/build/cjs/mock/mockHttp.d.ts +0 -9
- package/build/cjs/mock/mockHttp.js +0 -17
- package/build/cjs/mock/mockWs.d.ts +0 -26
- package/build/cjs/mock/mockWs.js +0 -47
- package/build/cjs/mock/types.d.ts +0 -23
- package/build/cjs/mock/types.js +0 -2
- package/build/cjs/package.json +0 -3
- package/build/cjs/packageDetect.d.ts +0 -1
- package/build/cjs/packageDetect.js +0 -6
- package/build/cjs/packageInfo.d.ts +0 -6
- package/build/cjs/packageInfo.js +0 -4
- package/build/cjs/types.d.ts +0 -85
- package/build/cjs/types.js +0 -2
- package/build/cjs/ws/errors.d.ts +0 -1
- package/build/cjs/ws/errors.js +0 -41
- package/build/cjs/ws/index.d.ts +0 -121
- package/build/cjs/ws/index.js +0 -529
- package/build/coder/error.d.ts +0 -29
- package/build/coder/error.js +0 -50
- package/build/coder/index.d.ts +0 -8
- package/build/coder/index.js +0 -58
- package/build/defaults.d.ts +0 -5
- package/build/defaults.js +0 -6
- package/build/http/index.d.ts +0 -81
- package/build/http/index.js +0 -191
- package/build/http/types.d.ts +0 -7
- package/build/http/types.js +0 -1
- package/build/index.d.ts +0 -2
- package/build/index.js +0 -2
- package/build/lru.d.ts +0 -15
- package/build/lru.js +0 -146
- package/build/mock/index.d.ts +0 -35
- package/build/mock/index.js +0 -191
- package/build/mock/mockHttp.d.ts +0 -9
- package/build/mock/mockHttp.js +0 -12
- package/build/mock/mockWs.d.ts +0 -26
- package/build/mock/mockWs.js +0 -43
- package/build/mock/types.d.ts +0 -23
- package/build/mock/types.js +0 -1
- package/build/package.json +0 -344
- package/build/packageDetect.d.ts +0 -1
- package/build/packageDetect.js +0 -4
- package/build/packageInfo.d.ts +0 -6
- package/build/packageInfo.js +0 -1
- package/build/types.d.ts +0 -85
- package/build/types.js +0 -1
- package/build/ws/errors.d.ts +0 -1
- package/build/ws/errors.js +0 -38
- package/build/ws/index.d.ts +0 -121
- package/build/ws/index.js +0 -524
- package/build-deno/README.md +0 -66
- package/build-deno/bizinikiwi-connect/Health.ts +0 -323
- package/build-deno/bizinikiwi-connect/index.ts +0 -417
- package/build-deno/bizinikiwi-connect/types.ts +0 -14
- package/build-deno/bundle.ts +0 -6
- package/build-deno/coder/error.ts +0 -64
- package/build-deno/coder/index.ts +0 -86
- package/build-deno/defaults.ts +0 -8
- package/build-deno/http/index.ts +0 -236
- package/build-deno/http/types.ts +0 -9
- package/build-deno/index.ts +0 -4
- package/build-deno/lru.ts +0 -189
- package/build-deno/mock/index.ts +0 -257
- package/build-deno/mock/mockHttp.ts +0 -33
- package/build-deno/mock/mockWs.ts +0 -87
- package/build-deno/mock/types.ts +0 -34
- package/build-deno/mod.ts +0 -2
- package/build-deno/packageDetect.ts +0 -8
- package/build-deno/packageInfo.ts +0 -3
- package/build-deno/types.ts +0 -99
- package/build-deno/ws/errors.ts +0 -38
- package/build-deno/ws/index.ts +0 -650
- package/build-tsc/bizinikiwi-connect/Health.d.ts +0 -7
- package/build-tsc/bizinikiwi-connect/index.d.ts +0 -22
- package/build-tsc/bizinikiwi-connect/types.d.ts +0 -12
- package/build-tsc/bundle.d.ts +0 -5
- package/build-tsc/coder/error.d.ts +0 -29
- package/build-tsc/coder/index.d.ts +0 -8
- package/build-tsc/defaults.d.ts +0 -5
- package/build-tsc/http/index.d.ts +0 -81
- package/build-tsc/http/types.d.ts +0 -7
- package/build-tsc/index.d.ts +0 -2
- package/build-tsc/lru.d.ts +0 -15
- package/build-tsc/mock/index.d.ts +0 -35
- package/build-tsc/mock/mockHttp.d.ts +0 -9
- package/build-tsc/mock/mockWs.d.ts +0 -26
- package/build-tsc/mock/types.d.ts +0 -23
- package/build-tsc/packageDetect.d.ts +0 -1
- package/build-tsc/packageInfo.d.ts +0 -6
- package/build-tsc/types.d.ts +0 -85
- package/build-tsc/ws/errors.d.ts +0 -1
- package/build-tsc/ws/index.d.ts +0 -121
- package/build-tsc-cjs/bizinikiwi-connect/Health.js +0 -264
- package/build-tsc-cjs/bizinikiwi-connect/index.js +0 -323
- package/build-tsc-cjs/bizinikiwi-connect/types.js +0 -2
- package/build-tsc-cjs/bundle.js +0 -14
- package/build-tsc-cjs/coder/error.js +0 -53
- package/build-tsc-cjs/coder/index.js +0 -63
- package/build-tsc-cjs/defaults.js +0 -8
- package/build-tsc-cjs/http/index.js +0 -196
- package/build-tsc-cjs/http/types.js +0 -2
- package/build-tsc-cjs/index.js +0 -5
- package/build-tsc-cjs/lru.js +0 -150
- package/build-tsc-cjs/mock/index.js +0 -196
- package/build-tsc-cjs/mock/mockHttp.js +0 -17
- package/build-tsc-cjs/mock/mockWs.js +0 -47
- package/build-tsc-cjs/mock/types.js +0 -2
- package/build-tsc-cjs/packageDetect.js +0 -6
- package/build-tsc-cjs/packageInfo.js +0 -4
- package/build-tsc-cjs/types.js +0 -2
- package/build-tsc-cjs/ws/errors.js +0 -41
- package/build-tsc-cjs/ws/index.js +0 -529
- package/build-tsc-esm/bizinikiwi-connect/Health.js +0 -259
- package/build-tsc-esm/bizinikiwi-connect/index.js +0 -319
- package/build-tsc-esm/bizinikiwi-connect/types.js +0 -1
- package/build-tsc-esm/bundle.js +0 -5
- package/build-tsc-esm/coder/error.js +0 -50
- package/build-tsc-esm/coder/index.js +0 -58
- package/build-tsc-esm/defaults.js +0 -6
- package/build-tsc-esm/http/index.js +0 -191
- package/build-tsc-esm/http/types.js +0 -1
- package/build-tsc-esm/index.js +0 -2
- package/build-tsc-esm/lru.js +0 -146
- package/build-tsc-esm/mock/index.js +0 -191
- package/build-tsc-esm/mock/mockHttp.js +0 -12
- package/build-tsc-esm/mock/mockWs.js +0 -43
- package/build-tsc-esm/mock/types.js +0 -1
- package/build-tsc-esm/packageDetect.js +0 -4
- package/build-tsc-esm/packageInfo.js +0 -1
- package/build-tsc-esm/types.js +0 -1
- package/build-tsc-esm/ws/errors.js +0 -38
- package/build-tsc-esm/ws/index.js +0 -524
- package/src/bizinikiwi-connect/Health.ts +0 -325
- package/src/bizinikiwi-connect/index.spec.ts +0 -671
- package/src/bizinikiwi-connect/index.ts +0 -427
- package/src/bizinikiwi-connect/types.ts +0 -16
- package/src/bundle.ts +0 -8
- package/src/coder/decodeResponse.spec.ts +0 -70
- package/src/coder/encodeJson.spec.ts +0 -20
- package/src/coder/encodeObject.spec.ts +0 -25
- package/src/coder/error.spec.ts +0 -111
- package/src/coder/error.ts +0 -66
- package/src/coder/index.ts +0 -88
- package/src/defaults.ts +0 -10
- package/src/http/index.spec.ts +0 -72
- package/src/http/index.ts +0 -238
- package/src/http/send.spec.ts +0 -61
- package/src/http/types.ts +0 -11
- package/src/index.ts +0 -6
- package/src/lru.spec.ts +0 -74
- package/src/lru.ts +0 -197
- package/src/mock/index.ts +0 -259
- package/src/mock/mockHttp.ts +0 -35
- package/src/mock/mockWs.ts +0 -92
- package/src/mock/on.spec.ts +0 -43
- package/src/mock/send.spec.ts +0 -38
- package/src/mock/subscribe.spec.ts +0 -81
- package/src/mock/types.ts +0 -36
- package/src/mock/unsubscribe.spec.ts +0 -57
- package/src/mod.ts +0 -4
- package/src/packageDetect.ts +0 -12
- package/src/packageInfo.ts +0 -6
- package/src/types.ts +0 -101
- package/src/ws/connect.spec.ts +0 -167
- package/src/ws/errors.ts +0 -41
- package/src/ws/index.spec.ts +0 -97
- package/src/ws/index.ts +0 -652
- package/src/ws/send.spec.ts +0 -126
- package/src/ws/state.spec.ts +0 -20
- package/src/ws/subscribe.spec.ts +0 -68
- package/src/ws/unsubscribe.spec.ts +0 -100
- package/tsconfig.build.json +0 -17
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.spec.json +0 -18
- package/tsconfig.spec.tsbuildinfo +0 -1
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Mock } from './types.ts';
|
|
3
|
-
|
|
4
|
-
import nock from 'https://esm.sh/nock@13.5.5';
|
|
5
|
-
|
|
6
|
-
interface Request {
|
|
7
|
-
code?: number;
|
|
8
|
-
method: string;
|
|
9
|
-
reply?: Record<string, unknown>;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface HttpMock extends Mock {
|
|
13
|
-
post: (uri: string) => {
|
|
14
|
-
reply: (code: number, handler: (uri: string, body: { id: string }) => unknown) => HttpMock
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const TEST_HTTP_URL = 'http://localhost:9944';
|
|
19
|
-
|
|
20
|
-
export function mockHttp (requests: Request[]): Mock {
|
|
21
|
-
nock.cleanAll();
|
|
22
|
-
|
|
23
|
-
return requests.reduce((scope: HttpMock, request: Request) =>
|
|
24
|
-
scope
|
|
25
|
-
.post('/')
|
|
26
|
-
.reply(request.code || 200, (_uri: string, body: { id: string }) => {
|
|
27
|
-
scope.body = scope.body || {};
|
|
28
|
-
scope.body[request.method] = body;
|
|
29
|
-
|
|
30
|
-
return Object.assign({ id: body.id, jsonrpc: '2.0' }, request.reply || {}) as unknown;
|
|
31
|
-
}),
|
|
32
|
-
nock(TEST_HTTP_URL) as unknown as HttpMock);
|
|
33
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Server, WebSocket } from 'https://esm.sh/mock-socket@9.3.1';
|
|
3
|
-
|
|
4
|
-
import { stringify } from 'https://deno.land/x/pezkuwi/util/mod.ts';
|
|
5
|
-
|
|
6
|
-
interface Scope {
|
|
7
|
-
body: Record<string, Record<string, unknown>>;
|
|
8
|
-
requests: number;
|
|
9
|
-
server: Server;
|
|
10
|
-
done: any;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface ErrorDef {
|
|
14
|
-
id: number;
|
|
15
|
-
error: {
|
|
16
|
-
code: number;
|
|
17
|
-
message: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface ReplyDef {
|
|
22
|
-
id: number;
|
|
23
|
-
reply: {
|
|
24
|
-
result: unknown;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface RpcBase {
|
|
29
|
-
id: number;
|
|
30
|
-
jsonrpc: '2.0';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
type RpcError = RpcBase & ErrorDef;
|
|
34
|
-
type RpcReply = RpcBase & { result: unknown };
|
|
35
|
-
|
|
36
|
-
export type Request = { method: string } & (ErrorDef | ReplyDef);
|
|
37
|
-
|
|
38
|
-
global.WebSocket = WebSocket as typeof global.WebSocket;
|
|
39
|
-
|
|
40
|
-
export const TEST_WS_URL = 'ws://localhost:9955';
|
|
41
|
-
|
|
42
|
-
function createError ({ error: { code, message }, id }: ErrorDef): RpcError {
|
|
43
|
-
return {
|
|
44
|
-
error: {
|
|
45
|
-
code,
|
|
46
|
-
message
|
|
47
|
-
},
|
|
48
|
-
id,
|
|
49
|
-
jsonrpc: '2.0'
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function createReply ({ id, reply: { result } }: ReplyDef): RpcReply {
|
|
54
|
-
return {
|
|
55
|
-
id,
|
|
56
|
-
jsonrpc: '2.0',
|
|
57
|
-
result
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function mockWs (requests: Request[], wsUrl: string = TEST_WS_URL): Scope {
|
|
62
|
-
const server = new Server(wsUrl);
|
|
63
|
-
|
|
64
|
-
let requestCount = 0;
|
|
65
|
-
const scope: Scope = {
|
|
66
|
-
body: {},
|
|
67
|
-
done: () => new Promise<void>((resolve) => server.stop(resolve)),
|
|
68
|
-
requests: 0,
|
|
69
|
-
server
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
server.on('connection', (socket): void => {
|
|
73
|
-
socket.on('message', (body): void => {
|
|
74
|
-
const request = requests[requestCount];
|
|
75
|
-
const response = (request as ErrorDef).error
|
|
76
|
-
? createError(request as ErrorDef)
|
|
77
|
-
: createReply(request as ReplyDef);
|
|
78
|
-
|
|
79
|
-
scope.body[request.method] = body as unknown as Record<string, unknown>;
|
|
80
|
-
requestCount++;
|
|
81
|
-
|
|
82
|
-
socket.send(stringify(response));
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
return scope;
|
|
87
|
-
}
|
package/build-deno/mock/types.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Server } from 'https://esm.sh/mock-socket@9.3.1';
|
|
3
|
-
|
|
4
|
-
export type Global = typeof globalThis & {
|
|
5
|
-
WebSocket: typeof WebSocket;
|
|
6
|
-
fetch: any;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface Mock {
|
|
10
|
-
body: Record<string, Record<string, unknown>>;
|
|
11
|
-
requests: number;
|
|
12
|
-
server: Server;
|
|
13
|
-
done: () => Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type MockStateSubscriptionCallback = (error: Error | null, value: any) => void;
|
|
17
|
-
|
|
18
|
-
export interface MockStateSubscription {
|
|
19
|
-
callbacks: Record<number, MockStateSubscriptionCallback>;
|
|
20
|
-
lastValue: any;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface MockStateSubscriptions {
|
|
24
|
-
// known
|
|
25
|
-
chain_subscribeNewHead: MockStateSubscription;
|
|
26
|
-
state_subscribeStorage: MockStateSubscription;
|
|
27
|
-
|
|
28
|
-
// others
|
|
29
|
-
[key: string]: MockStateSubscription;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export type MockStateDb = Record<string, Uint8Array>;
|
|
33
|
-
|
|
34
|
-
export type MockStateRequests = Record<string, (db: MockStateDb, params: any[]) => string>;
|
package/build-deno/mod.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { packageInfo as typesInfo } from 'https://deno.land/x/pezkuwi/types/packageInfo.ts';
|
|
4
|
-
import { detectPackage } from 'https://deno.land/x/pezkuwi/util/mod.ts';
|
|
5
|
-
|
|
6
|
-
import { packageInfo } from './packageInfo.ts';
|
|
7
|
-
|
|
8
|
-
detectPackage(packageInfo, null, [typesInfo]);
|
package/build-deno/types.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export interface JsonRpcObject {
|
|
3
|
-
id: number;
|
|
4
|
-
jsonrpc: '2.0';
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface JsonRpcRequest extends JsonRpcObject {
|
|
8
|
-
method: string;
|
|
9
|
-
params: unknown[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface JsonRpcResponseBaseError {
|
|
13
|
-
code: number;
|
|
14
|
-
data?: number | string;
|
|
15
|
-
message: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface RpcErrorInterface<T> {
|
|
19
|
-
code: number;
|
|
20
|
-
data?: T;
|
|
21
|
-
message: string;
|
|
22
|
-
stack: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface JsonRpcResponseSingle<T> {
|
|
26
|
-
error?: JsonRpcResponseBaseError;
|
|
27
|
-
result: T;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface JsonRpcResponseSubscription<T> {
|
|
31
|
-
method?: string;
|
|
32
|
-
params: {
|
|
33
|
-
error?: JsonRpcResponseBaseError;
|
|
34
|
-
result: T;
|
|
35
|
-
subscription: number | string;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export type JsonRpcResponseBase<T> = JsonRpcResponseSingle<T> & JsonRpcResponseSubscription<T>;
|
|
40
|
-
|
|
41
|
-
export type JsonRpcResponse<T> = JsonRpcObject & JsonRpcResponseBase<T>;
|
|
42
|
-
|
|
43
|
-
export type ProviderInterfaceCallback = (error: Error | null, result: any) => void;
|
|
44
|
-
|
|
45
|
-
export type ProviderInterfaceEmitted = 'connected' | 'disconnected' | 'error';
|
|
46
|
-
|
|
47
|
-
export type ProviderInterfaceEmitCb = (value?: any) => any;
|
|
48
|
-
|
|
49
|
-
export interface ProviderInterface {
|
|
50
|
-
/** true if the provider supports subscriptions (not available for HTTP) */
|
|
51
|
-
readonly hasSubscriptions: boolean;
|
|
52
|
-
/** true if the clone() functionality is available on the provider */
|
|
53
|
-
readonly isClonable: boolean;
|
|
54
|
-
/** true if the provider is currently connected (ws/sc has connection logic) */
|
|
55
|
-
readonly isConnected: boolean;
|
|
56
|
-
/** (optional) stats for the provider with connections/bytes */
|
|
57
|
-
readonly stats?: ProviderStats;
|
|
58
|
-
/** (optional) stats for the provider with connections/bytes */
|
|
59
|
-
readonly ttl?: number | null;
|
|
60
|
-
|
|
61
|
-
clone (): ProviderInterface;
|
|
62
|
-
connect (): Promise<void>;
|
|
63
|
-
disconnect (): Promise<void>;
|
|
64
|
-
on (type: ProviderInterfaceEmitted, sub: ProviderInterfaceEmitCb): () => void;
|
|
65
|
-
send <T = any> (method: string, params: unknown[], isCacheable?: boolean): Promise<T>;
|
|
66
|
-
subscribe (type: string, method: string, params: unknown[], cb: ProviderInterfaceCallback): Promise<number | string>;
|
|
67
|
-
unsubscribe (type: string, method: string, id: number | string): Promise<boolean>;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** Stats for a specific endpoint */
|
|
71
|
-
export interface EndpointStats {
|
|
72
|
-
/** The total number of bytes sent */
|
|
73
|
-
bytesRecv: number;
|
|
74
|
-
/** The total number of bytes received */
|
|
75
|
-
bytesSent: number;
|
|
76
|
-
/** The number of cached/in-progress requests made */
|
|
77
|
-
cached: number;
|
|
78
|
-
/** The number of errors found */
|
|
79
|
-
errors: number;
|
|
80
|
-
/** The number of requests */
|
|
81
|
-
requests: number;
|
|
82
|
-
/** The number of subscriptions */
|
|
83
|
-
subscriptions: number;
|
|
84
|
-
/** The number of request timeouts */
|
|
85
|
-
timeout: number;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/** Overall stats for the provider */
|
|
89
|
-
export interface ProviderStats {
|
|
90
|
-
/** Details for the active/open requests */
|
|
91
|
-
active: {
|
|
92
|
-
/** Number of active requests */
|
|
93
|
-
requests: number;
|
|
94
|
-
/** Number of active subscriptions */
|
|
95
|
-
subscriptions: number;
|
|
96
|
-
};
|
|
97
|
-
/** The total requests that have been made */
|
|
98
|
-
total: EndpointStats;
|
|
99
|
-
}
|
package/build-deno/ws/errors.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const known: Record<number, string> = {
|
|
4
|
-
1000: 'Normal Closure',
|
|
5
|
-
1001: 'Going Away',
|
|
6
|
-
1002: 'Protocol Error',
|
|
7
|
-
1003: 'Unsupported Data',
|
|
8
|
-
1004: '(For future)',
|
|
9
|
-
1005: 'No Status Received',
|
|
10
|
-
1006: 'Abnormal Closure',
|
|
11
|
-
1007: 'Invalid frame payload data',
|
|
12
|
-
1008: 'Policy Violation',
|
|
13
|
-
1009: 'Message too big',
|
|
14
|
-
1010: 'Missing Extension',
|
|
15
|
-
1011: 'Internal Error',
|
|
16
|
-
1012: 'Service Restart',
|
|
17
|
-
1013: 'Try Again Later',
|
|
18
|
-
1014: 'Bad Gateway',
|
|
19
|
-
1015: 'TLS Handshake'
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export function getWSErrorString (code: number): string {
|
|
23
|
-
if (code >= 0 && code <= 999) {
|
|
24
|
-
return '(Unused)';
|
|
25
|
-
} else if (code >= 1016) {
|
|
26
|
-
if (code <= 1999) {
|
|
27
|
-
return '(For WebSocket standard)';
|
|
28
|
-
} else if (code <= 2999) {
|
|
29
|
-
return '(For WebSocket extensions)';
|
|
30
|
-
} else if (code <= 3999) {
|
|
31
|
-
return '(For libraries and frameworks)';
|
|
32
|
-
} else if (code <= 4999) {
|
|
33
|
-
return '(For applications)';
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return known[code] || '(Unknown)';
|
|
38
|
-
}
|