@bufbuild/protobuf 1.3.1 → 1.3.2
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/cjs/google/protobuf/struct_pb.js +1 -1
- package/dist/cjs/google/protobuf/type_pb.js +1 -1
- package/dist/esm/binary-encoding.d.ts +421 -0
- package/dist/esm/binary-format.d.ts +87 -0
- package/dist/esm/codegen-info.d.ts +23 -0
- package/dist/esm/create-descriptor-set.d.ts +16 -0
- package/dist/esm/create-registry-from-desc.d.ts +15 -0
- package/dist/esm/create-registry.d.ts +8 -0
- package/dist/esm/descriptor-set.d.ts +606 -0
- package/dist/esm/enum.d.ts +35 -0
- package/dist/esm/field-list.d.ts +27 -0
- package/dist/esm/field.d.ts +255 -0
- package/dist/esm/google/protobuf/any_pb.d.ts +156 -0
- package/dist/esm/google/protobuf/api_pb.d.ts +256 -0
- package/dist/esm/google/protobuf/compiler/plugin_pb.d.ts +236 -0
- package/dist/esm/google/protobuf/descriptor_pb.d.ts +1851 -0
- package/dist/esm/google/protobuf/duration_pb.d.ts +100 -0
- package/dist/esm/google/protobuf/empty_pb.d.ts +28 -0
- package/dist/esm/google/protobuf/field_mask_pb.d.ts +227 -0
- package/dist/esm/google/protobuf/source_context_pb.d.ts +29 -0
- package/dist/esm/google/protobuf/struct_pb.d.ts +158 -0
- package/dist/esm/google/protobuf/struct_pb.js +1 -1
- package/dist/esm/google/protobuf/timestamp_pb.d.ts +132 -0
- package/dist/esm/google/protobuf/type_pb.d.ts +437 -0
- package/dist/esm/google/protobuf/type_pb.js +1 -1
- package/dist/esm/google/protobuf/wrappers_pb.d.ts +267 -0
- package/dist/esm/google/varint.d.ts +70 -0
- package/dist/esm/index.d.ts +38 -0
- package/dist/esm/json-format.d.ts +110 -0
- package/dist/esm/message-type.d.ts +51 -0
- package/dist/esm/message.d.ts +130 -0
- package/dist/esm/private/assert.d.ts +16 -0
- package/dist/esm/private/binary-format-common.d.ts +13 -0
- package/dist/esm/private/binary-format-proto2.d.ts +2 -0
- package/dist/esm/private/binary-format-proto3.d.ts +2 -0
- package/dist/esm/private/enum.d.ts +27 -0
- package/dist/esm/private/field-list.d.ts +18 -0
- package/dist/esm/private/field-wrapper.d.ts +25 -0
- package/dist/esm/private/field.d.ts +15 -0
- package/dist/esm/private/json-format-common.d.ts +9 -0
- package/dist/esm/private/json-format-proto2.d.ts +2 -0
- package/dist/esm/private/json-format-proto3.d.ts +2 -0
- package/dist/esm/private/message-type.d.ts +18 -0
- package/dist/esm/private/names.d.ts +43 -0
- package/dist/esm/private/options-map.d.ts +7 -0
- package/dist/esm/private/proto-runtime.d.ts +47 -0
- package/dist/esm/private/reify-wkt.d.ts +100 -0
- package/dist/esm/private/scalars.d.ts +27 -0
- package/dist/esm/private/util-common.d.ts +2 -0
- package/dist/esm/private/util.d.ts +38 -0
- package/dist/esm/proto-base64.d.ts +18 -0
- package/dist/esm/proto-delimited.d.ts +54 -0
- package/dist/esm/proto-double.d.ts +5 -0
- package/dist/esm/proto-int64.d.ts +95 -0
- package/dist/esm/proto2.d.ts +4 -0
- package/dist/esm/proto3.d.ts +4 -0
- package/dist/esm/service-type.d.ts +96 -0
- package/dist/esm/to-plain-message.d.ts +9 -0
- package/dist/esm/type-registry.d.ts +30 -0
- package/package.json +14 -9
- /package/dist/{types → cjs}/binary-encoding.d.ts +0 -0
- /package/dist/{types → cjs}/binary-format.d.ts +0 -0
- /package/dist/{types → cjs}/codegen-info.d.ts +0 -0
- /package/dist/{types → cjs}/create-descriptor-set.d.ts +0 -0
- /package/dist/{types → cjs}/create-registry-from-desc.d.ts +0 -0
- /package/dist/{types → cjs}/create-registry.d.ts +0 -0
- /package/dist/{types → cjs}/descriptor-set.d.ts +0 -0
- /package/dist/{types → cjs}/enum.d.ts +0 -0
- /package/dist/{types → cjs}/field-list.d.ts +0 -0
- /package/dist/{types → cjs}/field.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/any_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/api_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/compiler/plugin_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/descriptor_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/duration_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/empty_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/field_mask_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/source_context_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/struct_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/timestamp_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/type_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/protobuf/wrappers_pb.d.ts +0 -0
- /package/dist/{types → cjs}/google/varint.d.ts +0 -0
- /package/dist/{types → cjs}/index.d.ts +0 -0
- /package/dist/{types → cjs}/json-format.d.ts +0 -0
- /package/dist/{types → cjs}/message-type.d.ts +0 -0
- /package/dist/{types → cjs}/message.d.ts +0 -0
- /package/dist/{types → cjs}/private/assert.d.ts +0 -0
- /package/dist/{types → cjs}/private/binary-format-common.d.ts +0 -0
- /package/dist/{types → cjs}/private/binary-format-proto2.d.ts +0 -0
- /package/dist/{types → cjs}/private/binary-format-proto3.d.ts +0 -0
- /package/dist/{types → cjs}/private/enum.d.ts +0 -0
- /package/dist/{types → cjs}/private/field-list.d.ts +0 -0
- /package/dist/{types → cjs}/private/field-wrapper.d.ts +0 -0
- /package/dist/{types → cjs}/private/field.d.ts +0 -0
- /package/dist/{types → cjs}/private/json-format-common.d.ts +0 -0
- /package/dist/{types → cjs}/private/json-format-proto2.d.ts +0 -0
- /package/dist/{types → cjs}/private/json-format-proto3.d.ts +0 -0
- /package/dist/{types → cjs}/private/message-type.d.ts +0 -0
- /package/dist/{types → cjs}/private/names.d.ts +0 -0
- /package/dist/{types → cjs}/private/options-map.d.ts +0 -0
- /package/dist/{types → cjs}/private/proto-runtime.d.ts +0 -0
- /package/dist/{types → cjs}/private/reify-wkt.d.ts +0 -0
- /package/dist/{types → cjs}/private/scalars.d.ts +0 -0
- /package/dist/{types → cjs}/private/util-common.d.ts +0 -0
- /package/dist/{types → cjs}/private/util.d.ts +0 -0
- /package/dist/{types → cjs}/proto-base64.d.ts +0 -0
- /package/dist/{types → cjs}/proto-delimited.d.ts +0 -0
- /package/dist/{types → cjs}/proto-double.d.ts +0 -0
- /package/dist/{types → cjs}/proto-int64.d.ts +0 -0
- /package/dist/{types → cjs}/proto2.d.ts +0 -0
- /package/dist/{types → cjs}/proto3.d.ts +0 -0
- /package/dist/{types → cjs}/service-type.d.ts +0 -0
- /package/dist/{types → cjs}/to-plain-message.d.ts +0 -0
- /package/dist/{types → cjs}/type-registry.d.ts +0 -0
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.ListValue = exports.Value = exports.Struct = exports.NullValue = void 0;
|
|
17
|
-
// @generated by protoc-gen-es v1.3.
|
|
17
|
+
// @generated by protoc-gen-es v1.3.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
18
18
|
// @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
|
|
19
19
|
/* eslint-disable */
|
|
20
20
|
const proto3_js_1 = require("../../proto3.js");
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.Option = exports.EnumValue = exports.Enum = exports.Field_Cardinality = exports.Field_Kind = exports.Field = exports.Type = exports.Syntax = void 0;
|
|
17
|
-
// @generated by protoc-gen-es v1.3.
|
|
17
|
+
// @generated by protoc-gen-es v1.3.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
18
18
|
// @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
|
|
19
19
|
/* eslint-disable */
|
|
20
20
|
const proto3_js_1 = require("../../proto3.js");
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protobuf binary format wire types.
|
|
3
|
+
*
|
|
4
|
+
* A wire type provides just enough information to find the length of the
|
|
5
|
+
* following value.
|
|
6
|
+
*
|
|
7
|
+
* See https://developers.google.com/protocol-buffers/docs/encoding#structure
|
|
8
|
+
*/
|
|
9
|
+
export declare enum WireType {
|
|
10
|
+
/**
|
|
11
|
+
* Used for int32, int64, uint32, uint64, sint32, sint64, bool, enum
|
|
12
|
+
*/
|
|
13
|
+
Varint = 0,
|
|
14
|
+
/**
|
|
15
|
+
* Used for fixed64, sfixed64, double.
|
|
16
|
+
* Always 8 bytes with little-endian byte order.
|
|
17
|
+
*/
|
|
18
|
+
Bit64 = 1,
|
|
19
|
+
/**
|
|
20
|
+
* Used for string, bytes, embedded messages, packed repeated fields
|
|
21
|
+
*
|
|
22
|
+
* Only repeated numeric types (types which use the varint, 32-bit,
|
|
23
|
+
* or 64-bit wire types) can be packed. In proto3, such fields are
|
|
24
|
+
* packed by default.
|
|
25
|
+
*/
|
|
26
|
+
LengthDelimited = 2,
|
|
27
|
+
/**
|
|
28
|
+
* Used for groups
|
|
29
|
+
* @deprecated
|
|
30
|
+
*/
|
|
31
|
+
StartGroup = 3,
|
|
32
|
+
/**
|
|
33
|
+
* Used for groups
|
|
34
|
+
* @deprecated
|
|
35
|
+
*/
|
|
36
|
+
EndGroup = 4,
|
|
37
|
+
/**
|
|
38
|
+
* Used for fixed32, sfixed32, float.
|
|
39
|
+
* Always 4 bytes with little-endian byte order.
|
|
40
|
+
*/
|
|
41
|
+
Bit32 = 5
|
|
42
|
+
}
|
|
43
|
+
type TextEncoderLike = {
|
|
44
|
+
encode(input?: string): Uint8Array;
|
|
45
|
+
};
|
|
46
|
+
type TextDecoderLike = {
|
|
47
|
+
decode(input?: Uint8Array): string;
|
|
48
|
+
};
|
|
49
|
+
export interface IBinaryReader {
|
|
50
|
+
/**
|
|
51
|
+
* Current position.
|
|
52
|
+
*/
|
|
53
|
+
readonly pos: number;
|
|
54
|
+
/**
|
|
55
|
+
* Number of bytes available in this reader.
|
|
56
|
+
*/
|
|
57
|
+
readonly len: number;
|
|
58
|
+
/**
|
|
59
|
+
* Reads a tag - field number and wire type.
|
|
60
|
+
*/
|
|
61
|
+
tag(): [number, WireType];
|
|
62
|
+
/**
|
|
63
|
+
* Skip one element on the wire and return the skipped data.
|
|
64
|
+
*/
|
|
65
|
+
skip(wireType: WireType): Uint8Array;
|
|
66
|
+
/**
|
|
67
|
+
* Read a `int32` field, a signed 32 bit varint.
|
|
68
|
+
*/
|
|
69
|
+
uint32(): number;
|
|
70
|
+
/**
|
|
71
|
+
* Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
|
|
72
|
+
*/
|
|
73
|
+
int32(): number;
|
|
74
|
+
/**
|
|
75
|
+
* Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
|
|
76
|
+
*/
|
|
77
|
+
sint32(): number;
|
|
78
|
+
/**
|
|
79
|
+
* Read a `int64` field, a signed 64-bit varint.
|
|
80
|
+
*/
|
|
81
|
+
int64(): bigint | string;
|
|
82
|
+
/**
|
|
83
|
+
* Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
|
|
84
|
+
*/
|
|
85
|
+
sint64(): bigint | string;
|
|
86
|
+
/**
|
|
87
|
+
* Read a `fixed64` field, a signed, fixed-length 64-bit integer.
|
|
88
|
+
*/
|
|
89
|
+
sfixed64(): bigint | string;
|
|
90
|
+
/**
|
|
91
|
+
* Read a `uint64` field, an unsigned 64-bit varint.
|
|
92
|
+
*/
|
|
93
|
+
uint64(): bigint | string;
|
|
94
|
+
/**
|
|
95
|
+
* Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
|
|
96
|
+
*/
|
|
97
|
+
fixed64(): bigint | string;
|
|
98
|
+
/**
|
|
99
|
+
* Read a `bool` field, a variant.
|
|
100
|
+
*/
|
|
101
|
+
bool(): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.
|
|
104
|
+
*/
|
|
105
|
+
fixed32(): number;
|
|
106
|
+
/**
|
|
107
|
+
* Read a `sfixed32` field, a signed, fixed-length 32-bit integer.
|
|
108
|
+
*/
|
|
109
|
+
sfixed32(): number;
|
|
110
|
+
/**
|
|
111
|
+
* Read a `float` field, 32-bit floating point number.
|
|
112
|
+
*/
|
|
113
|
+
float(): number;
|
|
114
|
+
/**
|
|
115
|
+
* Read a `double` field, a 64-bit floating point number.
|
|
116
|
+
*/
|
|
117
|
+
double(): number;
|
|
118
|
+
/**
|
|
119
|
+
* Read a `bytes` field, length-delimited arbitrary data.
|
|
120
|
+
*/
|
|
121
|
+
bytes(): Uint8Array;
|
|
122
|
+
/**
|
|
123
|
+
* Read a `string` field, length-delimited data converted to UTF-8 text.
|
|
124
|
+
*/
|
|
125
|
+
string(): string;
|
|
126
|
+
}
|
|
127
|
+
export interface IBinaryWriter {
|
|
128
|
+
/**
|
|
129
|
+
* Return all bytes written and reset this writer.
|
|
130
|
+
*/
|
|
131
|
+
finish(): Uint8Array;
|
|
132
|
+
/**
|
|
133
|
+
* Start a new fork for length-delimited data like a message
|
|
134
|
+
* or a packed repeated field.
|
|
135
|
+
*
|
|
136
|
+
* Must be joined later with `join()`.
|
|
137
|
+
*/
|
|
138
|
+
fork(): IBinaryWriter;
|
|
139
|
+
/**
|
|
140
|
+
* Join the last fork. Write its length and bytes, then
|
|
141
|
+
* return to the previous state.
|
|
142
|
+
*/
|
|
143
|
+
join(): IBinaryWriter;
|
|
144
|
+
/**
|
|
145
|
+
* Writes a tag (field number and wire type).
|
|
146
|
+
*
|
|
147
|
+
* Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`
|
|
148
|
+
*
|
|
149
|
+
* Generated code should compute the tag ahead of time and call `uint32()`.
|
|
150
|
+
*/
|
|
151
|
+
tag(fieldNo: number, type: WireType): IBinaryWriter;
|
|
152
|
+
/**
|
|
153
|
+
* Write a chunk of raw bytes.
|
|
154
|
+
*/
|
|
155
|
+
raw(chunk: Uint8Array): IBinaryWriter;
|
|
156
|
+
/**
|
|
157
|
+
* Write a `uint32` value, an unsigned 32 bit varint.
|
|
158
|
+
*/
|
|
159
|
+
uint32(value: number): IBinaryWriter;
|
|
160
|
+
/**
|
|
161
|
+
* Write a `int32` value, a signed 32 bit varint.
|
|
162
|
+
*/
|
|
163
|
+
int32(value: number): IBinaryWriter;
|
|
164
|
+
/**
|
|
165
|
+
* Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
|
|
166
|
+
*/
|
|
167
|
+
sint32(value: number): IBinaryWriter;
|
|
168
|
+
/**
|
|
169
|
+
* Write a `int64` value, a signed 64-bit varint.
|
|
170
|
+
*/
|
|
171
|
+
int64(value: string | number | bigint): IBinaryWriter;
|
|
172
|
+
/**
|
|
173
|
+
* Write a `uint64` value, an unsigned 64-bit varint.
|
|
174
|
+
*/
|
|
175
|
+
uint64(value: string | number | bigint): IBinaryWriter;
|
|
176
|
+
/**
|
|
177
|
+
* Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
|
|
178
|
+
*/
|
|
179
|
+
sint64(value: string | number | bigint): IBinaryWriter;
|
|
180
|
+
/**
|
|
181
|
+
* Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
|
|
182
|
+
*/
|
|
183
|
+
fixed64(value: string | number | bigint): IBinaryWriter;
|
|
184
|
+
/**
|
|
185
|
+
* Write a `fixed64` value, a signed, fixed-length 64-bit integer.
|
|
186
|
+
*/
|
|
187
|
+
sfixed64(value: string | number | bigint): IBinaryWriter;
|
|
188
|
+
/**
|
|
189
|
+
* Write a `bool` value, a variant.
|
|
190
|
+
*/
|
|
191
|
+
bool(value: boolean): IBinaryWriter;
|
|
192
|
+
/**
|
|
193
|
+
* Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
|
|
194
|
+
*/
|
|
195
|
+
fixed32(value: number): IBinaryWriter;
|
|
196
|
+
/**
|
|
197
|
+
* Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
|
|
198
|
+
*/
|
|
199
|
+
sfixed32(value: number): IBinaryWriter;
|
|
200
|
+
/**
|
|
201
|
+
* Write a `float` value, 32-bit floating point number.
|
|
202
|
+
*/
|
|
203
|
+
float(value: number): IBinaryWriter;
|
|
204
|
+
/**
|
|
205
|
+
* Write a `double` value, a 64-bit floating point number.
|
|
206
|
+
*/
|
|
207
|
+
double(value: number): IBinaryWriter;
|
|
208
|
+
/**
|
|
209
|
+
* Write a `bytes` value, length-delimited arbitrary data.
|
|
210
|
+
*/
|
|
211
|
+
bytes(value: Uint8Array): IBinaryWriter;
|
|
212
|
+
/**
|
|
213
|
+
* Write a `string` value, length-delimited data converted to UTF-8 text.
|
|
214
|
+
*/
|
|
215
|
+
string(value: string): IBinaryWriter;
|
|
216
|
+
}
|
|
217
|
+
export declare class BinaryWriter implements IBinaryWriter {
|
|
218
|
+
/**
|
|
219
|
+
* We cannot allocate a buffer for the entire output
|
|
220
|
+
* because we don't know it's size.
|
|
221
|
+
*
|
|
222
|
+
* So we collect smaller chunks of known size and
|
|
223
|
+
* concat them later.
|
|
224
|
+
*
|
|
225
|
+
* Use `raw()` to push data to this array. It will flush
|
|
226
|
+
* `buf` first.
|
|
227
|
+
*/
|
|
228
|
+
private chunks;
|
|
229
|
+
/**
|
|
230
|
+
* A growing buffer for byte values. If you don't know
|
|
231
|
+
* the size of the data you are writing, push to this
|
|
232
|
+
* array.
|
|
233
|
+
*/
|
|
234
|
+
protected buf: number[];
|
|
235
|
+
/**
|
|
236
|
+
* Previous fork states.
|
|
237
|
+
*/
|
|
238
|
+
private stack;
|
|
239
|
+
/**
|
|
240
|
+
* Text encoder instance to convert UTF-8 to bytes.
|
|
241
|
+
*/
|
|
242
|
+
private readonly textEncoder;
|
|
243
|
+
constructor(textEncoder?: TextEncoderLike);
|
|
244
|
+
/**
|
|
245
|
+
* Return all bytes written and reset this writer.
|
|
246
|
+
*/
|
|
247
|
+
finish(): Uint8Array;
|
|
248
|
+
/**
|
|
249
|
+
* Start a new fork for length-delimited data like a message
|
|
250
|
+
* or a packed repeated field.
|
|
251
|
+
*
|
|
252
|
+
* Must be joined later with `join()`.
|
|
253
|
+
*/
|
|
254
|
+
fork(): IBinaryWriter;
|
|
255
|
+
/**
|
|
256
|
+
* Join the last fork. Write its length and bytes, then
|
|
257
|
+
* return to the previous state.
|
|
258
|
+
*/
|
|
259
|
+
join(): IBinaryWriter;
|
|
260
|
+
/**
|
|
261
|
+
* Writes a tag (field number and wire type).
|
|
262
|
+
*
|
|
263
|
+
* Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`.
|
|
264
|
+
*
|
|
265
|
+
* Generated code should compute the tag ahead of time and call `uint32()`.
|
|
266
|
+
*/
|
|
267
|
+
tag(fieldNo: number, type: WireType): IBinaryWriter;
|
|
268
|
+
/**
|
|
269
|
+
* Write a chunk of raw bytes.
|
|
270
|
+
*/
|
|
271
|
+
raw(chunk: Uint8Array): IBinaryWriter;
|
|
272
|
+
/**
|
|
273
|
+
* Write a `uint32` value, an unsigned 32 bit varint.
|
|
274
|
+
*/
|
|
275
|
+
uint32(value: number): IBinaryWriter;
|
|
276
|
+
/**
|
|
277
|
+
* Write a `int32` value, a signed 32 bit varint.
|
|
278
|
+
*/
|
|
279
|
+
int32(value: number): IBinaryWriter;
|
|
280
|
+
/**
|
|
281
|
+
* Write a `bool` value, a variant.
|
|
282
|
+
*/
|
|
283
|
+
bool(value: boolean): IBinaryWriter;
|
|
284
|
+
/**
|
|
285
|
+
* Write a `bytes` value, length-delimited arbitrary data.
|
|
286
|
+
*/
|
|
287
|
+
bytes(value: Uint8Array): IBinaryWriter;
|
|
288
|
+
/**
|
|
289
|
+
* Write a `string` value, length-delimited data converted to UTF-8 text.
|
|
290
|
+
*/
|
|
291
|
+
string(value: string): IBinaryWriter;
|
|
292
|
+
/**
|
|
293
|
+
* Write a `float` value, 32-bit floating point number.
|
|
294
|
+
*/
|
|
295
|
+
float(value: number): IBinaryWriter;
|
|
296
|
+
/**
|
|
297
|
+
* Write a `double` value, a 64-bit floating point number.
|
|
298
|
+
*/
|
|
299
|
+
double(value: number): IBinaryWriter;
|
|
300
|
+
/**
|
|
301
|
+
* Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
|
|
302
|
+
*/
|
|
303
|
+
fixed32(value: number): IBinaryWriter;
|
|
304
|
+
/**
|
|
305
|
+
* Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
|
|
306
|
+
*/
|
|
307
|
+
sfixed32(value: number): IBinaryWriter;
|
|
308
|
+
/**
|
|
309
|
+
* Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
|
|
310
|
+
*/
|
|
311
|
+
sint32(value: number): IBinaryWriter;
|
|
312
|
+
/**
|
|
313
|
+
* Write a `fixed64` value, a signed, fixed-length 64-bit integer.
|
|
314
|
+
*/
|
|
315
|
+
sfixed64(value: string | number | bigint): IBinaryWriter;
|
|
316
|
+
/**
|
|
317
|
+
* Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
|
|
318
|
+
*/
|
|
319
|
+
fixed64(value: string | number | bigint): IBinaryWriter;
|
|
320
|
+
/**
|
|
321
|
+
* Write a `int64` value, a signed 64-bit varint.
|
|
322
|
+
*/
|
|
323
|
+
int64(value: string | number | bigint): IBinaryWriter;
|
|
324
|
+
/**
|
|
325
|
+
* Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
|
|
326
|
+
*/
|
|
327
|
+
sint64(value: string | number | bigint): IBinaryWriter;
|
|
328
|
+
/**
|
|
329
|
+
* Write a `uint64` value, an unsigned 64-bit varint.
|
|
330
|
+
*/
|
|
331
|
+
uint64(value: string | number | bigint): IBinaryWriter;
|
|
332
|
+
}
|
|
333
|
+
export declare class BinaryReader implements IBinaryReader {
|
|
334
|
+
/**
|
|
335
|
+
* Current position.
|
|
336
|
+
*/
|
|
337
|
+
pos: number;
|
|
338
|
+
/**
|
|
339
|
+
* Number of bytes available in this reader.
|
|
340
|
+
*/
|
|
341
|
+
readonly len: number;
|
|
342
|
+
private readonly buf;
|
|
343
|
+
private readonly view;
|
|
344
|
+
private readonly textDecoder;
|
|
345
|
+
constructor(buf: Uint8Array, textDecoder?: TextDecoderLike);
|
|
346
|
+
/**
|
|
347
|
+
* Reads a tag - field number and wire type.
|
|
348
|
+
*/
|
|
349
|
+
tag(): [number, WireType];
|
|
350
|
+
/**
|
|
351
|
+
* Skip one element on the wire and return the skipped data.
|
|
352
|
+
* Supports WireType.StartGroup since v2.0.0-alpha.23.
|
|
353
|
+
*/
|
|
354
|
+
skip(wireType: WireType): Uint8Array;
|
|
355
|
+
protected varint64: () => [number, number];
|
|
356
|
+
/**
|
|
357
|
+
* Throws error if position in byte array is out of range.
|
|
358
|
+
*/
|
|
359
|
+
protected assertBounds(): void;
|
|
360
|
+
/**
|
|
361
|
+
* Read a `uint32` field, an unsigned 32 bit varint.
|
|
362
|
+
*/
|
|
363
|
+
uint32: () => number;
|
|
364
|
+
/**
|
|
365
|
+
* Read a `int32` field, a signed 32 bit varint.
|
|
366
|
+
*/
|
|
367
|
+
int32(): number;
|
|
368
|
+
/**
|
|
369
|
+
* Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
|
|
370
|
+
*/
|
|
371
|
+
sint32(): number;
|
|
372
|
+
/**
|
|
373
|
+
* Read a `int64` field, a signed 64-bit varint.
|
|
374
|
+
*/
|
|
375
|
+
int64(): bigint | string;
|
|
376
|
+
/**
|
|
377
|
+
* Read a `uint64` field, an unsigned 64-bit varint.
|
|
378
|
+
*/
|
|
379
|
+
uint64(): bigint | string;
|
|
380
|
+
/**
|
|
381
|
+
* Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
|
|
382
|
+
*/
|
|
383
|
+
sint64(): bigint | string;
|
|
384
|
+
/**
|
|
385
|
+
* Read a `bool` field, a variant.
|
|
386
|
+
*/
|
|
387
|
+
bool(): boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.
|
|
390
|
+
*/
|
|
391
|
+
fixed32(): number;
|
|
392
|
+
/**
|
|
393
|
+
* Read a `sfixed32` field, a signed, fixed-length 32-bit integer.
|
|
394
|
+
*/
|
|
395
|
+
sfixed32(): number;
|
|
396
|
+
/**
|
|
397
|
+
* Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
|
|
398
|
+
*/
|
|
399
|
+
fixed64(): bigint | string;
|
|
400
|
+
/**
|
|
401
|
+
* Read a `fixed64` field, a signed, fixed-length 64-bit integer.
|
|
402
|
+
*/
|
|
403
|
+
sfixed64(): bigint | string;
|
|
404
|
+
/**
|
|
405
|
+
* Read a `float` field, 32-bit floating point number.
|
|
406
|
+
*/
|
|
407
|
+
float(): number;
|
|
408
|
+
/**
|
|
409
|
+
* Read a `double` field, a 64-bit floating point number.
|
|
410
|
+
*/
|
|
411
|
+
double(): number;
|
|
412
|
+
/**
|
|
413
|
+
* Read a `bytes` field, length-delimited arbitrary data.
|
|
414
|
+
*/
|
|
415
|
+
bytes(): Uint8Array;
|
|
416
|
+
/**
|
|
417
|
+
* Read a `string` field, length-delimited data converted to UTF-8 text.
|
|
418
|
+
*/
|
|
419
|
+
string(): string;
|
|
420
|
+
}
|
|
421
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Message } from "./message.js";
|
|
2
|
+
import type { IBinaryReader, IBinaryWriter, WireType } from "./binary-encoding.js";
|
|
3
|
+
/**
|
|
4
|
+
* BinaryFormat is the contract for serializing messages to and from binary
|
|
5
|
+
* data. Implementations may be specific to a proto syntax, and can be
|
|
6
|
+
* reflection based, or delegate to speed optimized generated code.
|
|
7
|
+
*/
|
|
8
|
+
export interface BinaryFormat {
|
|
9
|
+
/**
|
|
10
|
+
* Provide options for parsing binary data.
|
|
11
|
+
*/
|
|
12
|
+
makeReadOptions(options?: Partial<BinaryReadOptions>): Readonly<BinaryReadOptions>;
|
|
13
|
+
/**
|
|
14
|
+
* Provide options for serializing binary data.
|
|
15
|
+
*/
|
|
16
|
+
makeWriteOptions(options?: Partial<BinaryWriteOptions>): Readonly<BinaryWriteOptions>;
|
|
17
|
+
/**
|
|
18
|
+
* Parse a message from binary data, merging fields.
|
|
19
|
+
*/
|
|
20
|
+
readMessage(message: Message, reader: IBinaryReader, length: number, options: BinaryReadOptions): void;
|
|
21
|
+
/**
|
|
22
|
+
* Serialize a message to binary data.
|
|
23
|
+
*/
|
|
24
|
+
writeMessage(message: Message, writer: IBinaryWriter, options: BinaryWriteOptions): void;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieve the unknown fields for the given message.
|
|
27
|
+
*
|
|
28
|
+
* Unknown fields are well-formed protocol buffer serialized data for
|
|
29
|
+
* fields that the parserdoes not recognize.
|
|
30
|
+
*
|
|
31
|
+
* For more details see https://developers.google.com/protocol-buffers/docs/proto3#unknowns
|
|
32
|
+
*/
|
|
33
|
+
listUnknownFields(message: Message): ReadonlyArray<{
|
|
34
|
+
no: number;
|
|
35
|
+
wireType: WireType;
|
|
36
|
+
data: Uint8Array;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Discard unknown fields for the given message.
|
|
40
|
+
*/
|
|
41
|
+
discardUnknownFields(message: Message): void;
|
|
42
|
+
/**
|
|
43
|
+
* Retrieve the unknown fields for the given message and write them to
|
|
44
|
+
* the given writer. This method is called when a message is serialized,
|
|
45
|
+
* so the fields that are unknown to the parser persist through a round
|
|
46
|
+
* trip.
|
|
47
|
+
*/
|
|
48
|
+
writeUnknownFields(message: Message, writer: IBinaryWriter): void;
|
|
49
|
+
/**
|
|
50
|
+
* Store an unknown field for the given message. The parser will use this
|
|
51
|
+
* method if it does not recognize a field, unless the option
|
|
52
|
+
* `readUnknownFields` has been disabled.
|
|
53
|
+
*/
|
|
54
|
+
onUnknownField(message: Message, no: number, wireType: WireType, data: Uint8Array): void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Options for parsing binary data.
|
|
58
|
+
*/
|
|
59
|
+
export interface BinaryReadOptions {
|
|
60
|
+
/**
|
|
61
|
+
* Retain unknown fields during parsing? The default behavior is to retain
|
|
62
|
+
* unknown fields and include them in the serialized output.
|
|
63
|
+
*
|
|
64
|
+
* For more details see https://developers.google.com/protocol-buffers/docs/proto3#unknowns
|
|
65
|
+
*/
|
|
66
|
+
readUnknownFields: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Allows to use a custom implementation to decode binary data.
|
|
69
|
+
*/
|
|
70
|
+
readerFactory: (bytes: Uint8Array) => IBinaryReader;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Options for serializing to binary data.
|
|
74
|
+
*/
|
|
75
|
+
export interface BinaryWriteOptions {
|
|
76
|
+
/**
|
|
77
|
+
* Include unknown fields in the serialized output? The default behavior
|
|
78
|
+
* is to retain unknown fields and include them in the serialized output.
|
|
79
|
+
*
|
|
80
|
+
* For more details see https://developers.google.com/protocol-buffers/docs/proto3#unknowns
|
|
81
|
+
*/
|
|
82
|
+
writeUnknownFields: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Allows to use a custom implementation to encode binary data.
|
|
85
|
+
*/
|
|
86
|
+
writerFactory: () => IBinaryWriter;
|
|
87
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { localName, safeIdentifier, safeObjectProperty } from "./private/names.js";
|
|
2
|
+
import { getUnwrappedFieldType } from "./private/field-wrapper.js";
|
|
3
|
+
import { scalarDefaultValue } from "./private/scalars.js";
|
|
4
|
+
import { reifyWkt } from "./private/reify-wkt.js";
|
|
5
|
+
interface CodegenInfo {
|
|
6
|
+
readonly packageName: string;
|
|
7
|
+
readonly localName: typeof localName;
|
|
8
|
+
readonly symbols: Record<RuntimeSymbolName, RuntimeSymbolInfo>;
|
|
9
|
+
readonly getUnwrappedFieldType: typeof getUnwrappedFieldType;
|
|
10
|
+
readonly wktSourceFiles: readonly string[];
|
|
11
|
+
readonly scalarDefaultValue: typeof scalarDefaultValue;
|
|
12
|
+
readonly reifyWkt: typeof reifyWkt;
|
|
13
|
+
readonly safeIdentifier: typeof safeIdentifier;
|
|
14
|
+
readonly safeObjectProperty: typeof safeObjectProperty;
|
|
15
|
+
}
|
|
16
|
+
type RuntimeSymbolName = "proto2" | "proto3" | "Message" | "PartialMessage" | "PlainMessage" | "FieldList" | "MessageType" | "BinaryReadOptions" | "BinaryWriteOptions" | "JsonReadOptions" | "JsonWriteOptions" | "JsonValue" | "JsonObject" | "protoDouble" | "protoInt64" | "ScalarType" | "MethodKind" | "MethodIdempotency" | "IMessageTypeRegistry";
|
|
17
|
+
type RuntimeSymbolInfo = {
|
|
18
|
+
typeOnly: boolean;
|
|
19
|
+
publicImportPath: string;
|
|
20
|
+
privateImportPath: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const codegenInfo: CodegenInfo;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FieldDescriptorProto } from "./google/protobuf/descriptor_pb.js";
|
|
2
|
+
import { FileDescriptorProto, FileDescriptorSet } from "./google/protobuf/descriptor_pb.js";
|
|
3
|
+
import type { DescriptorSet } from "./descriptor-set.js";
|
|
4
|
+
/**
|
|
5
|
+
* Create a DescriptorSet, a convenient interface for working with a set of
|
|
6
|
+
* google.protobuf.FileDescriptorProto.
|
|
7
|
+
*
|
|
8
|
+
* Note that files must be given in topological order, so each file appears
|
|
9
|
+
* before any file that imports it. Protocol buffer compilers always produce
|
|
10
|
+
* files in topological order.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createDescriptorSet(input: FileDescriptorProto[] | FileDescriptorSet | Uint8Array): DescriptorSet;
|
|
13
|
+
/**
|
|
14
|
+
* Get the default `packed` state of a repeated field.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isPackedFieldByDefault(proto: FieldDescriptorProto, syntax: "proto2" | "proto3"): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IEnumTypeRegistry, IMessageTypeRegistry, IServiceTypeRegistry } from "./type-registry.js";
|
|
2
|
+
import { FileDescriptorSet } from "./google/protobuf/descriptor_pb.js";
|
|
3
|
+
import type { DescriptorSet } from "./descriptor-set.js";
|
|
4
|
+
/**
|
|
5
|
+
* Create a registry from a set of descriptors. The types returned by this
|
|
6
|
+
* registry behave exactly like types from generated code.
|
|
7
|
+
*
|
|
8
|
+
* This function accepts google.protobuf.FileDescriptorSet in serialized or
|
|
9
|
+
* deserialized form. Alternatively, it also accepts a DescriptorSet (see
|
|
10
|
+
* createDescriptorSet()).
|
|
11
|
+
*
|
|
12
|
+
* By default, all well-known types with a specialized JSON representation
|
|
13
|
+
* are replaced with their generated counterpart in this package.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createRegistryFromDescriptors(input: DescriptorSet | FileDescriptorSet | Uint8Array, replaceWkt?: boolean): IMessageTypeRegistry & IEnumTypeRegistry & IServiceTypeRegistry;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MessageType } from "./message-type.js";
|
|
2
|
+
import type { EnumType } from "./enum.js";
|
|
3
|
+
import type { ServiceType } from "./service-type.js";
|
|
4
|
+
import type { IMessageTypeRegistry, IEnumTypeRegistry, IServiceTypeRegistry } from "./type-registry.js";
|
|
5
|
+
/**
|
|
6
|
+
* Create a new registry from the given types.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createRegistry(...types: Array<MessageType | EnumType | ServiceType>): IMessageTypeRegistry & IEnumTypeRegistry & IServiceTypeRegistry;
|