@rikaidev/yomi 0.2.6 → 0.3.0
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/README.md +14 -4
- package/dist/auth/credential-store.js +0 -34
- package/dist/insight/graph.js +90 -0
- package/dist/insight/index.js +61 -0
- package/dist/insight/pending.js +92 -0
- package/dist/insight/relationships.js +125 -0
- package/dist/insight/rhythm.js +50 -0
- package/dist/line/auth/protocol/index.js +0 -2
- package/dist/line/auth/pwless/index.js +1 -1
- package/dist/line/client/index.js +1 -1
- package/dist/line/client/talk-service/chat-query.js +3 -3
- package/dist/line/client/talk-service/contact-query.js +1 -1
- package/dist/line/client/talk-service/requests.js +1 -1
- package/dist/line/core/e2ee/crypto/crypto-primitives.js +2 -15
- package/dist/line/core/e2ee/index.js +0 -1
- package/dist/line/core/e2ee/keys/decrypt.js +0 -1
- package/dist/line/core/e2ee/keys/group-key.js +0 -1
- package/dist/line/core/e2ee/keys/key-payload.js +1 -1
- package/dist/line/core/e2ee/keys/message-decrypt.js +1 -1
- package/dist/line/core/e2ee/keys/peer-key.js +1 -1
- package/dist/line/core/media-decrypt.js +1 -1
- package/dist/line/core/mention.js +1 -1
- package/dist/line/core/message-query-service.js +2 -2
- package/dist/line/core/session-state/persist.js +1 -1
- package/dist/line/core/thrift/binary/type-codec-dsl.js +1 -1
- package/dist/line/core/thrift/compact/type-codec-dsl.js +1 -43
- package/dist/line/core/thrift/fields/builders.js +1 -11
- package/dist/line/core/thrift/index.js +1 -6
- package/dist/line/core/thrift/primitives/varint.js +1 -1
- package/dist/line/core/thrift/types.js +0 -6
- package/dist/mcp/handlers/index.js +1 -0
- package/dist/mcp/handlers/insight.js +129 -0
- package/dist/mcp/handlers/shared.js +2 -2
- package/dist/mcp/media.js +2 -2
- package/dist/mcp/names.js +1 -1
- package/dist/mcp/server.js +7 -4
- package/dist/mcp/tools.js +17 -0
- package/dist/search/collector.js +1 -1
- package/dist/search/store.js +31 -14
- package/dist/util/data-dir.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -1
- package/dist/line/core/e2ee/types.js +0 -4
- package/dist/line/core/store.js +0 -8
- package/dist/line/core/thrift/binary/binary-reader.js +0 -151
- package/dist/line/core/thrift/compact/compact-reader.js +0 -180
- package/dist/line/core/thrift/compact/compact-writer.js +0 -161
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thrift Binary Reader
|
|
3
|
-
*
|
|
4
|
-
* Reads Thrift protocol messages in binary format.
|
|
5
|
-
*
|
|
6
|
-
* @class TBinaryReader
|
|
7
|
-
*/
|
|
8
|
-
import { THRIFT_TYPE } from '../types.js';
|
|
9
|
-
import { getBinaryTypeCodecDefinition } from './type-codec-dsl.js';
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
export class TBinaryReader {
|
|
14
|
-
buffer;
|
|
15
|
-
offset = 0;
|
|
16
|
-
readHandlers;
|
|
17
|
-
constructor(buffer) {
|
|
18
|
-
this.buffer = buffer;
|
|
19
|
-
this.readHandlers = {
|
|
20
|
-
readBoolValue: () => this.readByte() !== 0,
|
|
21
|
-
readByteValue: () => this.readByte(),
|
|
22
|
-
readI16Value: () => this.readI16(),
|
|
23
|
-
readI32Value: () => this.readI32(),
|
|
24
|
-
readI64Value: () => this.readI64(),
|
|
25
|
-
readStringValue: () => this.readString(),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Read message header
|
|
30
|
-
*
|
|
31
|
-
* @returns {{name: string, type: number, seqId: number}} Message header
|
|
32
|
-
*/
|
|
33
|
-
readMessageBegin() {
|
|
34
|
-
const versionType = this.readI32();
|
|
35
|
-
const version = versionType & 0xffff0000;
|
|
36
|
-
const type = versionType & 0x0000ffff;
|
|
37
|
-
if (version !== 0x8000) {
|
|
38
|
-
throw new Error('Invalid version');
|
|
39
|
-
}
|
|
40
|
-
const name = this.readString();
|
|
41
|
-
const seqId = this.readI32();
|
|
42
|
-
return { name, type, seqId };
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Read message end
|
|
46
|
-
*/
|
|
47
|
-
readMessageEnd() {
|
|
48
|
-
// No-op for binary protocol
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Read field begin
|
|
52
|
-
*
|
|
53
|
-
* @returns {{type: number, id: number}} Field header
|
|
54
|
-
*/
|
|
55
|
-
readFieldBegin() {
|
|
56
|
-
const type = this.readByte();
|
|
57
|
-
if (type === THRIFT_TYPE.STOP) {
|
|
58
|
-
return { type: THRIFT_TYPE.STOP, id: 0 };
|
|
59
|
-
}
|
|
60
|
-
const id = this.readI16();
|
|
61
|
-
return { type, id };
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Read field end
|
|
65
|
-
*/
|
|
66
|
-
readFieldEnd() {
|
|
67
|
-
// No-op
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Read byte
|
|
71
|
-
*
|
|
72
|
-
* @returns {number} Byte value
|
|
73
|
-
*/
|
|
74
|
-
readByte() {
|
|
75
|
-
return this.buffer[this.offset++];
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Read 16-bit integer
|
|
79
|
-
*
|
|
80
|
-
* @returns {number} Integer value
|
|
81
|
-
*/
|
|
82
|
-
readI16() {
|
|
83
|
-
const b1 = this.buffer[this.offset++];
|
|
84
|
-
const b2 = this.buffer[this.offset++];
|
|
85
|
-
return (b1 << 8) | b2;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Read 32-bit integer
|
|
89
|
-
*
|
|
90
|
-
* @returns {number} Integer value
|
|
91
|
-
*/
|
|
92
|
-
readI32() {
|
|
93
|
-
const b1 = this.buffer[this.offset++];
|
|
94
|
-
const b2 = this.buffer[this.offset++];
|
|
95
|
-
const b3 = this.buffer[this.offset++];
|
|
96
|
-
const b4 = this.buffer[this.offset++];
|
|
97
|
-
return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Read 64-bit integer
|
|
101
|
-
*
|
|
102
|
-
* @returns {number} Integer value
|
|
103
|
-
*/
|
|
104
|
-
readI64() {
|
|
105
|
-
const hi = this.readI32();
|
|
106
|
-
const lo = this.readI32();
|
|
107
|
-
return hi * 0x100000000 + lo;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Read string
|
|
111
|
-
*
|
|
112
|
-
* @returns {string} String value
|
|
113
|
-
*/
|
|
114
|
-
readString() {
|
|
115
|
-
const len = this.readI32();
|
|
116
|
-
const bytes = this.buffer.slice(this.offset, this.offset + len);
|
|
117
|
-
this.offset += len;
|
|
118
|
-
return new TextDecoder().decode(bytes);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Read value by type
|
|
122
|
-
*
|
|
123
|
-
* @param {number} type - Value type
|
|
124
|
-
* @returns {unknown} Value
|
|
125
|
-
*/
|
|
126
|
-
readValue(type) {
|
|
127
|
-
const definition = getBinaryTypeCodecDefinition(type);
|
|
128
|
-
if (!definition) {
|
|
129
|
-
throw new Error(`Unsupported type: ${type}`);
|
|
130
|
-
}
|
|
131
|
-
return this.readHandlers[definition.readHandler]();
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Read struct fields
|
|
135
|
-
*
|
|
136
|
-
* @returns {ThriftField[]} Fields
|
|
137
|
-
*/
|
|
138
|
-
readStruct() {
|
|
139
|
-
const fields = [];
|
|
140
|
-
while (true) {
|
|
141
|
-
const { type, id } = this.readFieldBegin();
|
|
142
|
-
if (type === THRIFT_TYPE.STOP) {
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
const value = this.readValue(type);
|
|
146
|
-
fields.push({ id, type: type, value });
|
|
147
|
-
this.readFieldEnd();
|
|
148
|
-
}
|
|
149
|
-
return fields;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thrift Compact Reader
|
|
3
|
-
*
|
|
4
|
-
* Reads Thrift protocol messages in compact binary format.
|
|
5
|
-
*
|
|
6
|
-
* @class TCompactReader
|
|
7
|
-
*/
|
|
8
|
-
import { THRIFT_TYPE } from '../types.js';
|
|
9
|
-
import { getCompactTypeCodecDefinition } from './type-codec-dsl.js';
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
export class TCompactReader {
|
|
14
|
-
buffer;
|
|
15
|
-
offset = 0;
|
|
16
|
-
lastFieldId = 0;
|
|
17
|
-
readHandlers;
|
|
18
|
-
constructor(buffer) {
|
|
19
|
-
this.buffer = buffer;
|
|
20
|
-
this.readHandlers = {
|
|
21
|
-
readBoolValue: () => this.readByte() !== 0,
|
|
22
|
-
readByteValue: () => this.readByte(),
|
|
23
|
-
readI16Value: () => this.readZigzag32(),
|
|
24
|
-
readI32Value: () => this.readZigzag32(),
|
|
25
|
-
readI64Value: () => this.readZigzag64(),
|
|
26
|
-
readStringValue: () => this.readString(),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Read message header
|
|
31
|
-
*
|
|
32
|
-
* @returns {{name: string, type: number, seqId: number}} Message header
|
|
33
|
-
*/
|
|
34
|
-
readMessageBegin() {
|
|
35
|
-
const protocolId = this.readVarint32();
|
|
36
|
-
if ((protocolId & 0xff000000) !== 0x82010000) {
|
|
37
|
-
throw new Error('Invalid compact protocol');
|
|
38
|
-
}
|
|
39
|
-
const type = (protocolId >> 4) & 0x0f;
|
|
40
|
-
const name = this.readString();
|
|
41
|
-
const seqId = this.readVarint32();
|
|
42
|
-
return { name, type, seqId };
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Read message end
|
|
46
|
-
*/
|
|
47
|
-
readMessageEnd() {
|
|
48
|
-
// No-op
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Read field begin
|
|
52
|
-
*
|
|
53
|
-
* @returns {{type: number, id: number}} Field header
|
|
54
|
-
*/
|
|
55
|
-
readFieldBegin() {
|
|
56
|
-
const header = this.readByte();
|
|
57
|
-
if ((header & 0x0f) === THRIFT_TYPE.STOP) {
|
|
58
|
-
return { type: THRIFT_TYPE.STOP, id: 0 };
|
|
59
|
-
}
|
|
60
|
-
const delta = (header >> 4) & 0x0f;
|
|
61
|
-
const type = header & 0x0f;
|
|
62
|
-
if (delta > 0) {
|
|
63
|
-
this.lastFieldId += delta;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
this.lastFieldId = this.readVarint32();
|
|
67
|
-
}
|
|
68
|
-
return { type, id: this.lastFieldId };
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Read field end
|
|
72
|
-
*/
|
|
73
|
-
readFieldEnd() {
|
|
74
|
-
// No-op
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Read byte
|
|
78
|
-
*
|
|
79
|
-
* @returns {number} Byte value
|
|
80
|
-
*/
|
|
81
|
-
readByte() {
|
|
82
|
-
return this.buffer[this.offset++];
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Read varint32
|
|
86
|
-
*
|
|
87
|
-
* @returns {number} Integer value
|
|
88
|
-
*/
|
|
89
|
-
readVarint32() {
|
|
90
|
-
let result = 0;
|
|
91
|
-
let shift = 0;
|
|
92
|
-
while (true) {
|
|
93
|
-
const b = this.readByte();
|
|
94
|
-
result |= (b & 0x7f) << shift;
|
|
95
|
-
if ((b & 0x80) === 0) {
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
shift += 7;
|
|
99
|
-
}
|
|
100
|
-
return result;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Read zigzag32
|
|
104
|
-
*
|
|
105
|
-
* @returns {number} Integer value
|
|
106
|
-
*/
|
|
107
|
-
readZigzag32() {
|
|
108
|
-
const n = this.readVarint32();
|
|
109
|
-
return (n >>> 1) ^ -(n & 1);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Read zigzag64
|
|
113
|
-
*
|
|
114
|
-
* @returns {number} Integer value
|
|
115
|
-
*/
|
|
116
|
-
readZigzag64() {
|
|
117
|
-
const n = this.readVarint64();
|
|
118
|
-
return (n >>> 1) ^ -(n & 1);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Read varint64
|
|
122
|
-
*
|
|
123
|
-
* @returns {number} Integer value
|
|
124
|
-
*/
|
|
125
|
-
readVarint64() {
|
|
126
|
-
let result = 0n;
|
|
127
|
-
let shift = 0;
|
|
128
|
-
while (true) {
|
|
129
|
-
const b = this.readByte();
|
|
130
|
-
result |= BigInt(b & 0x7f) << BigInt(shift);
|
|
131
|
-
if ((b & 0x80) === 0) {
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
shift += 7;
|
|
135
|
-
}
|
|
136
|
-
return Number(result);
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Read string
|
|
140
|
-
*
|
|
141
|
-
* @returns {string} String value
|
|
142
|
-
*/
|
|
143
|
-
readString() {
|
|
144
|
-
const len = this.readVarint32();
|
|
145
|
-
const bytes = this.buffer.slice(this.offset, this.offset + len);
|
|
146
|
-
this.offset += len;
|
|
147
|
-
return new TextDecoder().decode(bytes);
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Read value
|
|
151
|
-
*
|
|
152
|
-
* @param {number} type - Value type
|
|
153
|
-
* @returns {unknown} Value
|
|
154
|
-
*/
|
|
155
|
-
readValue(type) {
|
|
156
|
-
const definition = getCompactTypeCodecDefinition(type);
|
|
157
|
-
if (!definition) {
|
|
158
|
-
throw new Error(`Unsupported type: ${type}`);
|
|
159
|
-
}
|
|
160
|
-
return this.readHandlers[definition.readHandler]();
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Read struct
|
|
164
|
-
*
|
|
165
|
-
* @returns {ThriftField[]} Fields
|
|
166
|
-
*/
|
|
167
|
-
readStruct() {
|
|
168
|
-
const fields = [];
|
|
169
|
-
while (true) {
|
|
170
|
-
const { type, id } = this.readFieldBegin();
|
|
171
|
-
if (type === THRIFT_TYPE.STOP) {
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
const value = this.readValue(type);
|
|
175
|
-
fields.push({ id, type: type, value });
|
|
176
|
-
this.readFieldEnd();
|
|
177
|
-
}
|
|
178
|
-
return fields;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thrift Compact Writer
|
|
3
|
-
*
|
|
4
|
-
* Writes Thrift protocol messages in compact binary format.
|
|
5
|
-
*
|
|
6
|
-
* @class TCompactWriter
|
|
7
|
-
*/
|
|
8
|
-
import { THRIFT_TYPE } from '../types.js';
|
|
9
|
-
import { getCompactTypeCodecDefinition } from './type-codec-dsl.js';
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
export class TCompactWriter {
|
|
14
|
-
buffer = [];
|
|
15
|
-
lastFieldId = 0;
|
|
16
|
-
writeHandlers;
|
|
17
|
-
constructor() {
|
|
18
|
-
this.writeHandlers = {
|
|
19
|
-
writeBoolValue: (value) => this.writeByte(value ? 1 : 0),
|
|
20
|
-
writeByteValue: (value) => this.writeByte(value),
|
|
21
|
-
writeI16Value: (value) => this.writeZigzag32(value),
|
|
22
|
-
writeI32Value: (value) => this.writeZigzag32(value),
|
|
23
|
-
writeI64Value: (value) => this.writeZigzag64(Number(value)),
|
|
24
|
-
writeStringValue: (value) => this.writeString(value),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Write message header
|
|
29
|
-
*
|
|
30
|
-
* @param {string} name - Method name
|
|
31
|
-
* @param {number} seqId - Sequence ID
|
|
32
|
-
* @param {Function} fieldsBuilder - Function to write fields
|
|
33
|
-
*/
|
|
34
|
-
writeMessage(name, seqId, fieldsBuilder) {
|
|
35
|
-
this.buffer = [];
|
|
36
|
-
this.lastFieldId = 0;
|
|
37
|
-
// Protocol version + type
|
|
38
|
-
this.writeVarint32(0x820100 | 1);
|
|
39
|
-
this.writeString(name);
|
|
40
|
-
this.writeVarint32(seqId);
|
|
41
|
-
fieldsBuilder();
|
|
42
|
-
this.writeByte(THRIFT_TYPE.STOP);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Write field header
|
|
46
|
-
*
|
|
47
|
-
* @param {number} id - Field ID
|
|
48
|
-
* @param {number} type - Field type
|
|
49
|
-
*/
|
|
50
|
-
writeFieldBegin(id, type) {
|
|
51
|
-
const delta = id - this.lastFieldId;
|
|
52
|
-
if (delta > 0 && delta <= 15) {
|
|
53
|
-
this.writeByte((delta << 4) | type);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
this.writeByte(type);
|
|
57
|
-
this.writeVarint32(id);
|
|
58
|
-
}
|
|
59
|
-
this.lastFieldId = id;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Write field stop
|
|
63
|
-
*/
|
|
64
|
-
writeFieldStop() {
|
|
65
|
-
this.writeByte(THRIFT_TYPE.STOP);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Write byte
|
|
69
|
-
*
|
|
70
|
-
* @param {number} b - Byte value
|
|
71
|
-
*/
|
|
72
|
-
writeByte(b) {
|
|
73
|
-
this.buffer.push(b & 0xff);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Write varint32
|
|
77
|
-
*
|
|
78
|
-
* @param {number} n - Integer value
|
|
79
|
-
*/
|
|
80
|
-
writeVarint32(n) {
|
|
81
|
-
while (n > 0x7f) {
|
|
82
|
-
this.buffer.push((n & 0x7f) | 0x80);
|
|
83
|
-
n >>= 7;
|
|
84
|
-
}
|
|
85
|
-
this.buffer.push(n);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Write varint64
|
|
89
|
-
*
|
|
90
|
-
* @param {number} n - Integer value
|
|
91
|
-
*/
|
|
92
|
-
writeVarint64(n) {
|
|
93
|
-
while (n > 0x7f) {
|
|
94
|
-
this.buffer.push((n & 0x7f) | 0x80);
|
|
95
|
-
n >>= 7;
|
|
96
|
-
}
|
|
97
|
-
this.buffer.push(n);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Write zigzag encoded 32-bit integer
|
|
101
|
-
*
|
|
102
|
-
* @param {number} n - Integer value
|
|
103
|
-
*/
|
|
104
|
-
writeZigzag32(n) {
|
|
105
|
-
this.writeVarint32((n << 1) ^ (n >> 31));
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Write zigzag encoded 64-bit integer
|
|
109
|
-
*
|
|
110
|
-
* @param {number} n - Integer value
|
|
111
|
-
*/
|
|
112
|
-
writeZigzag64(n) {
|
|
113
|
-
this.writeVarint64((n << 1) ^ (n >> 63));
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Write string
|
|
117
|
-
*
|
|
118
|
-
* @param {string} s - String value
|
|
119
|
-
*/
|
|
120
|
-
writeString(s) {
|
|
121
|
-
const bytes = new TextEncoder().encode(s);
|
|
122
|
-
this.writeVarint32(bytes.length);
|
|
123
|
-
for (const b of bytes) {
|
|
124
|
-
this.buffer.push(b);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Write list
|
|
129
|
-
*
|
|
130
|
-
* @param {number} elemType - Element type
|
|
131
|
-
* @param {unknown[]} arr - Array of elements
|
|
132
|
-
*/
|
|
133
|
-
writeList(elemType, arr) {
|
|
134
|
-
this.writeByte(elemType);
|
|
135
|
-
this.writeVarint32(arr.length);
|
|
136
|
-
for (const item of arr) {
|
|
137
|
-
this.writeValue(elemType, item);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Write value
|
|
142
|
-
*
|
|
143
|
-
* @param {number} type - Value type
|
|
144
|
-
* @param {unknown} value - Value
|
|
145
|
-
*/
|
|
146
|
-
writeValue(type, value) {
|
|
147
|
-
const definition = getCompactTypeCodecDefinition(type);
|
|
148
|
-
if (!definition) {
|
|
149
|
-
throw new Error(`Unsupported type: ${type}`);
|
|
150
|
-
}
|
|
151
|
-
this.writeHandlers[definition.writeHandler](value);
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Get buffer
|
|
155
|
-
*
|
|
156
|
-
* @returns {Uint8Array} Buffer
|
|
157
|
-
*/
|
|
158
|
-
getBuffer() {
|
|
159
|
-
return new Uint8Array(this.buffer);
|
|
160
|
-
}
|
|
161
|
-
}
|