@hehanlin/open-agent-bridge 0.6.3 → 0.6.4
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/node_modules/@byted/frontier-web-sdk/README.md +11 -0
- package/node_modules/@byted/frontier-web-sdk/lib/fws.esm.js +2438 -0
- package/node_modules/@byted/frontier-web-sdk/lib/fws.js +2535 -0
- package/node_modules/@byted/frontier-web-sdk/lib/fws.umd.js +2699 -0
- package/node_modules/@byted/frontier-web-sdk/lib/fws.umd.min.js +1 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/db/index.d.ts +5 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/db/qos-idb.d.ts +22 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/db/qos-localstorage.d.ts +20 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/db/qos-ministorage.d.ts +20 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/fws.d.ts +225 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/idl/bppb2.d.ts +27 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/idl/protobuf.d.ts +8 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/manager/cursor-manager.d.ts +25 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/manager/endpoint-manager.d.ts +15 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/manager/qos-manager.d.ts +17 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/manager/tnc-manager.d.ts +0 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/message/ack-process.d.ts +3 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/message/cursor-helper.d.ts +3 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/message/cursor-process.d.ts +3 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/message/decode-process.d.ts +2 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/message/dispatch-message-process.d.ts +3 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/message/finish-message-process.d.ts +3 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/message/index.d.ts +7 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/message/qos-helper.d.ts +12 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/message/qos-process.d.ts +3 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/open/finish-open-process.d.ts +2 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/open/index.d.ts +3 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/open/open-process.d.ts +2 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/open/open-success-process.d.ts +2 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/process/process-trigger.d.ts +3 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/arraybuffer-trans.d.ts +2 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/buffer.d.ts +115 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/check-payload-type.d.ts +1 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/cursor-serialize.d.ts +14 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/env-params-gen.d.ts +5 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/env.d.ts +5 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/event-emitter.d.ts +39 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/event.d.ts +88 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/get-socket-error.d.ts +1 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/header-key.d.ts +2 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/log-id.d.ts +6 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/long.d.ts +25 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/pkg-loss-counter.d.ts +8 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/pool.d.ts +29 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/utf8.d.ts +24 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/utils/websocket.d.ts +2 -0
- package/node_modules/@byted/frontier-web-sdk/lib/types/websocket/mini-websocket.d.ts +20 -0
- package/node_modules/@byted/frontier-web-sdk/package.json +52 -0
- package/node_modules/idb/CHANGELOG.md +87 -0
- package/node_modules/idb/LICENSE +6 -0
- package/node_modules/idb/README.md +497 -0
- package/node_modules/idb/build/async-iterators.cjs +57 -0
- package/node_modules/idb/build/async-iterators.d.ts +1 -0
- package/node_modules/idb/build/async-iterators.js +55 -0
- package/node_modules/idb/build/database-extras.d.ts +1 -0
- package/node_modules/idb/build/entry.d.ts +615 -0
- package/node_modules/idb/build/index.cjs +94 -0
- package/node_modules/idb/build/index.d.ts +2 -0
- package/node_modules/idb/build/index.js +88 -0
- package/node_modules/idb/build/umd-with-async-ittr.js +1 -0
- package/node_modules/idb/build/umd.js +1 -0
- package/node_modules/idb/build/util.d.ts +3 -0
- package/node_modules/idb/build/wrap-idb-value.cjs +191 -0
- package/node_modules/idb/build/wrap-idb-value.d.ts +34 -0
- package/node_modules/idb/build/wrap-idb-value.js +185 -0
- package/node_modules/idb/package.json +59 -0
- package/node_modules/idb/with-async-ittr.cjs +2 -0
- package/node_modules/idb/with-async-ittr.d.ts +1 -0
- package/node_modules/idb/with-async-ittr.js +2 -0
- package/package.json +4 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Long } from './long';
|
|
4
|
+
export declare function IndexOutOfRangeError(pos: number, span: number, length: number): RangeError;
|
|
5
|
+
export declare function writeUInt32(buf: Buffer | Uint8Array, pos: number, num: number): number;
|
|
6
|
+
export declare function readUInt32(buffer: Buffer | Uint8Array, pos: number): {
|
|
7
|
+
value: number;
|
|
8
|
+
offset: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function writeUInt16(targetBuffer: Buffer | Uint8Array, pos: number, num: number): number;
|
|
11
|
+
export declare function readUInt16(buffer: Buffer | Uint8Array, pos: number): {
|
|
12
|
+
value: number;
|
|
13
|
+
offset: number;
|
|
14
|
+
};
|
|
15
|
+
export declare function readString(buf: Buffer | Uint8Array, pos: number, len: number): {
|
|
16
|
+
value: string;
|
|
17
|
+
offset: number;
|
|
18
|
+
};
|
|
19
|
+
export declare function writeString(val: string, buf: Buffer | Uint8Array, pos: number): number;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*
|
|
23
|
+
* @export
|
|
24
|
+
* @param {(Buffer | Uint8Array)} buf
|
|
25
|
+
* @param {number} pos
|
|
26
|
+
* @return {*} {{value: Long, offset: number}}
|
|
27
|
+
*/
|
|
28
|
+
export declare function readVarInt64(buf: Buffer | Uint8Array, pos: number, unsigned?: boolean): {
|
|
29
|
+
value: Long;
|
|
30
|
+
offset: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
*
|
|
35
|
+
* @export
|
|
36
|
+
* @param {Long} val
|
|
37
|
+
* @param {(Buffer|Uint8Array)} buf
|
|
38
|
+
* @param {number} pos
|
|
39
|
+
* @return {number} written offset
|
|
40
|
+
*/
|
|
41
|
+
export declare function writeVarInt64(val: Long, buf: Buffer | Uint8Array, pos: number): number;
|
|
42
|
+
export declare function readInt64FromBE(buf: Buffer | Uint8Array, pos: number): {
|
|
43
|
+
value: Long;
|
|
44
|
+
offset: number;
|
|
45
|
+
};
|
|
46
|
+
export declare function writeInt64ToBE(val: Long, buf: Buffer | Uint8Array, pos: number): number;
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
*
|
|
50
|
+
* @export
|
|
51
|
+
* @param {(Buffer|Uint8Array)} buf
|
|
52
|
+
* @param {number} pos
|
|
53
|
+
* @param {number} len
|
|
54
|
+
* @return {({value: Buffer|Uint8Array,pos: number})} {({value: Buffer|Uint8Array,pos: number})}
|
|
55
|
+
*/
|
|
56
|
+
export declare function readBytes(buf: Buffer | Uint8Array, pos: number, len: number): {
|
|
57
|
+
value: Buffer | Uint8Array;
|
|
58
|
+
offset: number;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
* @param {(Buffer | Uint8Array)} val
|
|
65
|
+
* @param {(Buffer | Uint8Array)} buf
|
|
66
|
+
* @param {number} pos
|
|
67
|
+
* @return {number} written offset
|
|
68
|
+
*/
|
|
69
|
+
export declare function writeBytes(val: Buffer | Uint8Array | number[], buf: Buffer | Uint8Array, pos: number): number;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
*
|
|
73
|
+
* @export
|
|
74
|
+
* @param {(Buffer | Uint8Array)} buf
|
|
75
|
+
* @param {number} pos
|
|
76
|
+
* @return {({value: number; offset: number})} written offset
|
|
77
|
+
*/
|
|
78
|
+
export declare function readByte(buf: Buffer | Uint8Array, pos: number): {
|
|
79
|
+
value: number;
|
|
80
|
+
offset: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
*
|
|
85
|
+
* @export
|
|
86
|
+
* @param {number} val
|
|
87
|
+
* @param {(Buffer | Uint8Array)} buf
|
|
88
|
+
* @param {number} pos
|
|
89
|
+
* @return {number} written offset
|
|
90
|
+
*/
|
|
91
|
+
export declare function writeByte(val: number, buf: Buffer | Uint8Array, pos: number): number;
|
|
92
|
+
export declare const alloc: ((size: number) => Uint8Array) | ((size: number) => Buffer);
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
|
+
*
|
|
96
|
+
* @export
|
|
97
|
+
* @param {Long} value
|
|
98
|
+
* @return {number} {number}
|
|
99
|
+
*/
|
|
100
|
+
export declare function calcVarInt64Length(value: Long): number;
|
|
101
|
+
export declare function fillBytes(val: number, buf: Buffer | Uint8Array, pos: number, len: number): number;
|
|
102
|
+
/**
|
|
103
|
+
*
|
|
104
|
+
*
|
|
105
|
+
* @export
|
|
106
|
+
* @param {ArrayBuffer} arrayBuffer
|
|
107
|
+
* @return {*} {(Buffer|Uint8Array)}
|
|
108
|
+
*/
|
|
109
|
+
export declare function dataView(arrayBuffer: ArrayBuffer): Buffer | Uint8Array;
|
|
110
|
+
export declare function writeVarInt32(val: number, buf: Buffer | Uint8Array, pos: number): void;
|
|
111
|
+
export declare function calcVarInt32Length(value: number): 2 | 4 | 1 | 3 | 5;
|
|
112
|
+
export declare const readVarInt32: (buf: Buffer | Uint8Array, pos: number, unsigned?: boolean) => {
|
|
113
|
+
value: number;
|
|
114
|
+
offset: number;
|
|
115
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function checkPayloadType(payload: any): "" | "application/json" | "text/plain;charset=utf-8";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CursorDBSchema } from '../manager/cursor-manager';
|
|
2
|
+
export declare const CURSOR_FILE_NAME_FRAME = 16;
|
|
3
|
+
export declare const CURSOR_DATA_FRAME = 32;
|
|
4
|
+
export interface CursorFrameInfo {
|
|
5
|
+
frameType: number;
|
|
6
|
+
payload: Uint8Array | undefined;
|
|
7
|
+
headers: {
|
|
8
|
+
key: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
export declare function serializeCursorData(cursors: CursorDBSchema['value'][], defaultCursor: number, cursorFileName: string): CursorFrameInfo;
|
|
13
|
+
export declare function deserializeCursorData(cursorData: Uint8Array): CursorDBSchema['value'][];
|
|
14
|
+
export declare function serializeCursorFileName(): CursorFrameInfo;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constructs a new event emitter instance.
|
|
3
|
+
* @classdesc A minimal event emitter.
|
|
4
|
+
* @constructor
|
|
5
|
+
*/
|
|
6
|
+
type EventEmitterListener = (...args: any[]) => void;
|
|
7
|
+
export declare class EventEmitter {
|
|
8
|
+
private _listeners;
|
|
9
|
+
onerror: any;
|
|
10
|
+
/**
|
|
11
|
+
* Registered listeners.
|
|
12
|
+
* @type {Object.<string,*>}
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Emits an event by calling its listeners with the specified arguments.
|
|
18
|
+
* @param {string} evt Event name
|
|
19
|
+
* @param {...*} args Arguments
|
|
20
|
+
* @returns {this} `this`
|
|
21
|
+
*/
|
|
22
|
+
emit(evt: string, ...args: any[]): EventEmitter;
|
|
23
|
+
/**
|
|
24
|
+
* Removes an event listener or any matching listeners if arguments are omitted.
|
|
25
|
+
* @param {string} [evt] Event name. Removes all listeners if omitted.
|
|
26
|
+
* @param {EventEmitterListener} [fn] Listener to remove. Removes all listeners of `evt` if omitted.
|
|
27
|
+
* @returns {this} `this`
|
|
28
|
+
*/
|
|
29
|
+
off(evt?: string, fn?: EventEmitterListener): EventEmitter;
|
|
30
|
+
/**
|
|
31
|
+
* Registers an event listener.
|
|
32
|
+
* @param {string} evt Event name
|
|
33
|
+
* @param {EventEmitterListener} fn Listener
|
|
34
|
+
* @param {*} [ctx] Listener context
|
|
35
|
+
* @returns {this} `this`
|
|
36
|
+
*/
|
|
37
|
+
on(evt: string, fn: EventEmitterListener, ctx?: any): EventEmitter;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { FrontierMessage } from '../idl/protobuf';
|
|
2
|
+
export declare enum ErrorCode {
|
|
3
|
+
NATIVE_ERROR = 5001,
|
|
4
|
+
CONNECTING_ERROR = 5002,
|
|
5
|
+
MAX_RETRIES_ERROR = 5003,
|
|
6
|
+
MESSAGE_ERROR = 5004,
|
|
7
|
+
OPEN_ERROR = 5005
|
|
8
|
+
}
|
|
9
|
+
export declare class Event {
|
|
10
|
+
readonly target: EventTarget | null;
|
|
11
|
+
readonly type: string;
|
|
12
|
+
constructor(type: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class ReconnectEvent extends Event {
|
|
15
|
+
readonly message: any;
|
|
16
|
+
constructor(type: string, eventInitDict?: {
|
|
17
|
+
message?: any;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export declare class CustomErrorEvent extends Event {
|
|
21
|
+
readonly colno: number;
|
|
22
|
+
readonly error: any;
|
|
23
|
+
readonly filename: string;
|
|
24
|
+
readonly lineno: number;
|
|
25
|
+
readonly message: string;
|
|
26
|
+
readonly code: number;
|
|
27
|
+
constructor(type: string, eventInitDict?: {
|
|
28
|
+
colno?: number;
|
|
29
|
+
error?: any;
|
|
30
|
+
code?: number;
|
|
31
|
+
filename?: string;
|
|
32
|
+
lineno?: number;
|
|
33
|
+
message?: string;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export declare class CustomCloseEvent extends Event {
|
|
37
|
+
readonly code: number;
|
|
38
|
+
readonly reason: string;
|
|
39
|
+
readonly wasClean: boolean;
|
|
40
|
+
readonly willReconnect: boolean;
|
|
41
|
+
constructor(type: string, eventInitDict?: {
|
|
42
|
+
code?: number;
|
|
43
|
+
reason?: string;
|
|
44
|
+
wasClean?: boolean;
|
|
45
|
+
willReconnect?: boolean;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export declare class MessageEvent extends Event {
|
|
49
|
+
readonly data: any;
|
|
50
|
+
constructor(type: string, eventInitDict?: {
|
|
51
|
+
data?: any;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export declare class FrontierMessageEvent extends MessageEvent {
|
|
55
|
+
readonly data: any;
|
|
56
|
+
readonly message: FrontierMessage;
|
|
57
|
+
constructor(type: string, eventInitDict?: {
|
|
58
|
+
data?: any;
|
|
59
|
+
message?: any;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export declare class OpenEvent extends Event {
|
|
63
|
+
readonly data: any;
|
|
64
|
+
constructor(type: string, eventInitDict?: {
|
|
65
|
+
data?: any;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export declare function createErrorEvent(type: string, { message, code, error }: {
|
|
69
|
+
message?: string;
|
|
70
|
+
code?: number;
|
|
71
|
+
error?: any;
|
|
72
|
+
}): CustomErrorEvent;
|
|
73
|
+
export declare function createCloseEvent(type: string, { code, reason, wasClean, willReconnect }: {
|
|
74
|
+
code?: number;
|
|
75
|
+
reason?: string;
|
|
76
|
+
wasClean?: boolean;
|
|
77
|
+
willReconnect?: boolean;
|
|
78
|
+
}): CustomCloseEvent;
|
|
79
|
+
export declare function createMessageEvent(type: string, { data, message }: {
|
|
80
|
+
data?: any;
|
|
81
|
+
message?: any;
|
|
82
|
+
}): FrontierMessageEvent;
|
|
83
|
+
export declare function createOpenEvent(type: string, { data }: {
|
|
84
|
+
data?: any;
|
|
85
|
+
}): OpenEvent;
|
|
86
|
+
export declare function createReconnectEvent(type: string, { message }: {
|
|
87
|
+
message?: any;
|
|
88
|
+
}): ReconnectEvent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSocketError(url: string): Promise<string>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
export declare class Long {
|
|
4
|
+
low: number;
|
|
5
|
+
high: number;
|
|
6
|
+
unsigned: boolean;
|
|
7
|
+
isLong: boolean;
|
|
8
|
+
constructor(low: number, high: number, unsigned: boolean);
|
|
9
|
+
static isLong(obj: any): obj is Long;
|
|
10
|
+
static fromBits(lowBits: number, highBits: number, unsigned: boolean): Long;
|
|
11
|
+
static fromBytes(bytes: number[] | Buffer | Uint8Array, unsigned: boolean, le?: boolean): Long;
|
|
12
|
+
static fromBytesLE(bytes: number[] | Buffer | Uint8Array, unsigned: boolean): Long;
|
|
13
|
+
static fromBytesBE(bytes: number[] | Buffer | Uint8Array, unsigned: boolean): Long;
|
|
14
|
+
static fromHash(hash: string): Long;
|
|
15
|
+
toHash(): string;
|
|
16
|
+
static fromNumber(value: number, unsigned?: boolean): Long;
|
|
17
|
+
toNumber(): number;
|
|
18
|
+
isZero(): boolean;
|
|
19
|
+
add(addend: Long | number): Long;
|
|
20
|
+
equals(other: Long | number): boolean;
|
|
21
|
+
addOne(): Long;
|
|
22
|
+
toBytes(le?: boolean): number[];
|
|
23
|
+
toBytesLE(): number[];
|
|
24
|
+
toBytesBE(): number[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An allocator as used by {@link util.pool}.
|
|
3
|
+
* @typedef PoolAllocator
|
|
4
|
+
* @type {function}
|
|
5
|
+
* @param {number} size Buffer size
|
|
6
|
+
* @returns {Uint8Array} Buffer
|
|
7
|
+
*/
|
|
8
|
+
type PoolAllocator = (size: number) => Uint8Array;
|
|
9
|
+
/**
|
|
10
|
+
* A slicer as used by {@link util.pool}.
|
|
11
|
+
* @typedef PoolSlicer
|
|
12
|
+
* @type {function}
|
|
13
|
+
* @param {number} start Start offset
|
|
14
|
+
* @param {number} end End offset
|
|
15
|
+
* @returns {Uint8Array} Buffer slice
|
|
16
|
+
* @this {Uint8Array}
|
|
17
|
+
*/
|
|
18
|
+
type PoolSlicer = (this: Uint8Array | null, start: number, end: number) => Uint8Array;
|
|
19
|
+
/**
|
|
20
|
+
* A general purpose buffer pool.
|
|
21
|
+
* @memberof util
|
|
22
|
+
* @function
|
|
23
|
+
* @param {PoolAllocator} alloc Allocator
|
|
24
|
+
* @param {PoolSlicer} slice Slicer
|
|
25
|
+
* @param {number} [size=8192] Slab size
|
|
26
|
+
* @returns {PoolAllocator} Pooled allocator
|
|
27
|
+
*/
|
|
28
|
+
export declare function pool(alloc: PoolAllocator, slice: PoolSlicer, size?: number): PoolAllocator;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the UTF8 byte length of a string.
|
|
3
|
+
* @param {string} string String
|
|
4
|
+
* @returns {number} Byte length
|
|
5
|
+
*/
|
|
6
|
+
/// <reference types="node" />
|
|
7
|
+
/// <reference types="node" />
|
|
8
|
+
export declare function utf8Length(string: string): number;
|
|
9
|
+
/**
|
|
10
|
+
* Reads UTF8 bytes as a string.
|
|
11
|
+
* @param {Buffer} buffer Source buffer
|
|
12
|
+
* @param {number} start Source start
|
|
13
|
+
* @param {number} end Source end
|
|
14
|
+
* @returns {string} String read
|
|
15
|
+
*/
|
|
16
|
+
export declare function utf8Read(buffer: Buffer | Uint8Array, start: number, end: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Writes a string as UTF8 bytes.
|
|
19
|
+
* @param {string} string Source string
|
|
20
|
+
* @param {Buffer} buffer Destination buffer
|
|
21
|
+
* @param {number} offset Destination offset
|
|
22
|
+
* @returns {number} Bytes written
|
|
23
|
+
*/
|
|
24
|
+
export declare function utf8Write(string: string, buffer: Buffer | Uint8Array, offset: number): number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EventEmitter } from '../utils/event-emitter';
|
|
2
|
+
export declare class MiniWebSocket extends EventEmitter {
|
|
3
|
+
private _socket;
|
|
4
|
+
private _formatErrorMessage;
|
|
5
|
+
constructor(url: string, protocols: any, headers: any);
|
|
6
|
+
private _createSocketSuccessHandler;
|
|
7
|
+
private _createSocketFailHandler;
|
|
8
|
+
private _addWsListeners;
|
|
9
|
+
send(data: any): void;
|
|
10
|
+
close(code?: number, reason?: string): void;
|
|
11
|
+
addEventListener(type: string, listener: EventListener): void;
|
|
12
|
+
removeEventListener(type: string, listener: EventListener): void;
|
|
13
|
+
get readyState(): any;
|
|
14
|
+
get binaryType(): any;
|
|
15
|
+
set binaryType(_val: any);
|
|
16
|
+
get url(): string;
|
|
17
|
+
get protocol(): string;
|
|
18
|
+
get extensions(): string;
|
|
19
|
+
get bufferedAmount(): number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@byted/frontier-web-sdk",
|
|
3
|
+
"version": "1.25.13",
|
|
4
|
+
"description": "frontier-sdk-1.0 for web, nodejs and mini-program",
|
|
5
|
+
"main": "lib/fws.js",
|
|
6
|
+
"module": "lib/fws.esm.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./lib/types/fws.d.ts",
|
|
10
|
+
"import": "./lib/fws.esm.js",
|
|
11
|
+
"require": "./lib/fws.js",
|
|
12
|
+
"default": "./lib/fws.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"lib"
|
|
17
|
+
],
|
|
18
|
+
"keywords": [
|
|
19
|
+
"websocket",
|
|
20
|
+
"client",
|
|
21
|
+
"reconnecting",
|
|
22
|
+
"reconnection",
|
|
23
|
+
"reconnect",
|
|
24
|
+
"frontier"
|
|
25
|
+
],
|
|
26
|
+
"types": "lib/types/fws.d.ts",
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"registry": "https://bnpm.byted.org/"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@rslib/core": "^0.12.4",
|
|
32
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
33
|
+
"@types/node": "^18.0.0",
|
|
34
|
+
"@types/ws": "^7.4.0",
|
|
35
|
+
"node-fetch": "^2.6.4",
|
|
36
|
+
"tslib": "^2.3.1",
|
|
37
|
+
"typescript": "^4.2.3",
|
|
38
|
+
"vitest": "^3.2.4",
|
|
39
|
+
"ws": "^8.2.1"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"idb": "~7.0.2"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "pnpm run clean && pnpm exec rslib build",
|
|
46
|
+
"clean": "rm -rf lib && rm -rf coverage",
|
|
47
|
+
"format:check": "pnpm exec oxfmt -c ../../.oxfmt.json --check src test rslib.config.ts vitest.config.ts",
|
|
48
|
+
"lint": "pnpm exec oxlint -c ../../.oxlintrc.json --tsconfig ./tsconfig.json src test rslib.config.ts vitest.config.ts",
|
|
49
|
+
"test": "pnpm exec vitest run --coverage",
|
|
50
|
+
"typecheck": "pnpm exec tsc -p tsconfig.json --noEmit && pnpm exec tsc -p tsconfig.test.json --noEmit"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Breaking changes in 7.x
|
|
2
|
+
|
|
3
|
+
- No longer committing `build` to GitHub.
|
|
4
|
+
- Renamed files in dist.
|
|
5
|
+
- Added conditional exports.
|
|
6
|
+
- iife build is now a umd.
|
|
7
|
+
|
|
8
|
+
# Breaking changes in 6.x
|
|
9
|
+
|
|
10
|
+
Some TypeScript definitions changed so write-methods are missing from 'readonly' transactions. This might be backwards-incompatible with code that performs a lot of type wrangling.
|
|
11
|
+
|
|
12
|
+
# Breaking changes in 5.x
|
|
13
|
+
|
|
14
|
+
I moved some files around, so I bumped the major version for safety.
|
|
15
|
+
|
|
16
|
+
# Changes in 4.x
|
|
17
|
+
|
|
18
|
+
## Breaking changes
|
|
19
|
+
|
|
20
|
+
### Opening a database
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
// Old 3.x way
|
|
24
|
+
import { openDb } from 'idb';
|
|
25
|
+
|
|
26
|
+
openDb('db-name', 1, (upgradeDb) => {
|
|
27
|
+
console.log(upgradeDb.oldVersion);
|
|
28
|
+
console.log(upgradeDb.transaction);
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
// New 4.x way
|
|
34
|
+
import { openDB } from 'idb';
|
|
35
|
+
|
|
36
|
+
openDB('db-name', 1, {
|
|
37
|
+
upgrade(db, oldVersion, newVersion, transaction) {
|
|
38
|
+
console.log(oldVersion);
|
|
39
|
+
console.log(transaction);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- `openDb` and `deleteDb` were renamed `openDB` and `deleteDB` to be more consistent with DOM naming.
|
|
45
|
+
- The signature of `openDB` changed. The third parameter used to be the upgrade callback, it's now an option object which can include an `upgrade` method.
|
|
46
|
+
- There's no `UpgradeDB` anymore. You get the same database `openDB` resolves with. Versions numbers and the upgrade transaction are included as additional parameters.
|
|
47
|
+
|
|
48
|
+
### Promises & throwing
|
|
49
|
+
|
|
50
|
+
The library turns all `IDBRequest` objects into promises, but it doesn't know in advance which methods may return promises.
|
|
51
|
+
|
|
52
|
+
As a result, methods such as `store.put` may throw instead of returning a promise.
|
|
53
|
+
|
|
54
|
+
If you're using async functions, there isn't a difference.
|
|
55
|
+
|
|
56
|
+
### Other breaking changes
|
|
57
|
+
|
|
58
|
+
- `iterateCursor` and `iterateKeyCursor` have been removed. These existed to work around browsers microtask issues which have since been fixed. Async iterators provide similar functionality.
|
|
59
|
+
- All pseudo-private properties (those beginning with an underscore) are gone. Use `unwrap()` to get access to bare IDB objects.
|
|
60
|
+
- `transaction.complete` was renamed to `transaction.done` to be shorter and more consistent with the DOM.
|
|
61
|
+
- `getAll` is no longer polyfilled on indexes and stores.
|
|
62
|
+
- The library no longer officially supports IE11.
|
|
63
|
+
|
|
64
|
+
## New stuff
|
|
65
|
+
|
|
66
|
+
- The library now uses proxies, so objects will include everything from their plain-IDB equivalents.
|
|
67
|
+
- TypeScript support has massively improved, including the ability to provide types for your database.
|
|
68
|
+
- Optional support for async iterators, which makes handling cursors much easier.
|
|
69
|
+
- Database objects now have shortcuts for single actions (like `get`, `put`, `add`, `getAll` etc etc).
|
|
70
|
+
- For transactions that cover a single store `transaction.store` is a reference to that store.
|
|
71
|
+
- `openDB` lets you add callbacks for when your database is blocking another connection, or when you're blocked by another connection.
|
|
72
|
+
|
|
73
|
+
# Changes in 3.x
|
|
74
|
+
|
|
75
|
+
The library became a module.
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
// Old 2.x way:
|
|
79
|
+
import idb from 'idb';
|
|
80
|
+
idb.open(…);
|
|
81
|
+
idb.delete(…);
|
|
82
|
+
|
|
83
|
+
// 3.x way:
|
|
84
|
+
import { openDb, deleteDb } from 'idb';
|
|
85
|
+
openDb(…);
|
|
86
|
+
deleteDb(…);
|
|
87
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
ISC License (ISC)
|
|
2
|
+
Copyright (c) 2016, Jake Archibald <jaffathecake@gmail.com>
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
5
|
+
|
|
6
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|