@bufbuild/protobuf 2.0.0 → 2.2.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/dist/cjs/registry.js +1 -1
- package/dist/cjs/types.d.ts +38 -4
- package/dist/cjs/wire/binary-encoding.js +4 -1
- package/dist/cjs/wkt/gen/google/protobuf/any_pb.d.ts +88 -1
- package/dist/cjs/wkt/gen/google/protobuf/api_pb.d.ts +148 -3
- package/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +128 -5
- package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +721 -55
- package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/dist/cjs/wkt/gen/google/protobuf/duration_pb.d.ts +61 -1
- package/dist/cjs/wkt/gen/google/protobuf/empty_pb.d.ts +10 -1
- package/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.d.ts +201 -1
- package/dist/cjs/wkt/gen/google/protobuf/source_context_pb.d.ts +7 -1
- package/dist/cjs/wkt/gen/google/protobuf/struct_pb.d.ts +29 -4
- package/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.d.ts +92 -1
- package/dist/cjs/wkt/gen/google/protobuf/type_pb.d.ts +89 -8
- package/dist/cjs/wkt/gen/google/protobuf/wrappers_pb.d.ts +45 -9
- package/dist/esm/registry.js +1 -1
- package/dist/esm/types.d.ts +38 -4
- package/dist/esm/wire/binary-encoding.js +4 -1
- package/dist/esm/wkt/gen/google/protobuf/any_pb.d.ts +88 -1
- package/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +148 -3
- package/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +128 -5
- package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +721 -55
- package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/dist/esm/wkt/gen/google/protobuf/duration_pb.d.ts +61 -1
- package/dist/esm/wkt/gen/google/protobuf/empty_pb.d.ts +10 -1
- package/dist/esm/wkt/gen/google/protobuf/field_mask_pb.d.ts +201 -1
- package/dist/esm/wkt/gen/google/protobuf/source_context_pb.d.ts +7 -1
- package/dist/esm/wkt/gen/google/protobuf/struct_pb.d.ts +29 -4
- package/dist/esm/wkt/gen/google/protobuf/timestamp_pb.d.ts +92 -1
- package/dist/esm/wkt/gen/google/protobuf/type_pb.d.ts +89 -8
- package/dist/esm/wkt/gen/google/protobuf/wrappers_pb.d.ts +45 -9
- package/package.json +1 -1
|
@@ -56,34 +56,50 @@ export type Type = Message<"google.protobuf.Type"> & {
|
|
|
56
56
|
edition: string;
|
|
57
57
|
};
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* A protocol buffer message type.
|
|
60
|
+
*
|
|
61
|
+
* @generated from message google.protobuf.Type
|
|
60
62
|
*/
|
|
61
63
|
export type TypeJson = {
|
|
62
64
|
/**
|
|
65
|
+
* The fully qualified message name.
|
|
66
|
+
*
|
|
63
67
|
* @generated from field: string name = 1;
|
|
64
68
|
*/
|
|
65
69
|
name?: string;
|
|
66
70
|
/**
|
|
71
|
+
* The list of fields.
|
|
72
|
+
*
|
|
67
73
|
* @generated from field: repeated google.protobuf.Field fields = 2;
|
|
68
74
|
*/
|
|
69
75
|
fields?: FieldJson[];
|
|
70
76
|
/**
|
|
77
|
+
* The list of types appearing in `oneof` definitions in this type.
|
|
78
|
+
*
|
|
71
79
|
* @generated from field: repeated string oneofs = 3;
|
|
72
80
|
*/
|
|
73
81
|
oneofs?: string[];
|
|
74
82
|
/**
|
|
83
|
+
* The protocol buffer options.
|
|
84
|
+
*
|
|
75
85
|
* @generated from field: repeated google.protobuf.Option options = 4;
|
|
76
86
|
*/
|
|
77
87
|
options?: OptionJson[];
|
|
78
88
|
/**
|
|
89
|
+
* The source context.
|
|
90
|
+
*
|
|
79
91
|
* @generated from field: google.protobuf.SourceContext source_context = 5;
|
|
80
92
|
*/
|
|
81
93
|
sourceContext?: SourceContextJson;
|
|
82
94
|
/**
|
|
95
|
+
* The source syntax.
|
|
96
|
+
*
|
|
83
97
|
* @generated from field: google.protobuf.Syntax syntax = 6;
|
|
84
98
|
*/
|
|
85
99
|
syntax?: SyntaxJson;
|
|
86
100
|
/**
|
|
101
|
+
* The source edition string, only valid when syntax is SYNTAX_EDITIONS.
|
|
102
|
+
*
|
|
87
103
|
* @generated from field: string edition = 7;
|
|
88
104
|
*/
|
|
89
105
|
edition?: string;
|
|
@@ -163,46 +179,70 @@ export type Field = Message<"google.protobuf.Field"> & {
|
|
|
163
179
|
defaultValue: string;
|
|
164
180
|
};
|
|
165
181
|
/**
|
|
166
|
-
*
|
|
182
|
+
* A single field of a message type.
|
|
183
|
+
*
|
|
184
|
+
* @generated from message google.protobuf.Field
|
|
167
185
|
*/
|
|
168
186
|
export type FieldJson = {
|
|
169
187
|
/**
|
|
188
|
+
* The field type.
|
|
189
|
+
*
|
|
170
190
|
* @generated from field: google.protobuf.Field.Kind kind = 1;
|
|
171
191
|
*/
|
|
172
192
|
kind?: Field_KindJson;
|
|
173
193
|
/**
|
|
194
|
+
* The field cardinality.
|
|
195
|
+
*
|
|
174
196
|
* @generated from field: google.protobuf.Field.Cardinality cardinality = 2;
|
|
175
197
|
*/
|
|
176
198
|
cardinality?: Field_CardinalityJson;
|
|
177
199
|
/**
|
|
200
|
+
* The field number.
|
|
201
|
+
*
|
|
178
202
|
* @generated from field: int32 number = 3;
|
|
179
203
|
*/
|
|
180
204
|
number?: number;
|
|
181
205
|
/**
|
|
206
|
+
* The field name.
|
|
207
|
+
*
|
|
182
208
|
* @generated from field: string name = 4;
|
|
183
209
|
*/
|
|
184
210
|
name?: string;
|
|
185
211
|
/**
|
|
212
|
+
* The field type URL, without the scheme, for message or enumeration
|
|
213
|
+
* types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
|
|
214
|
+
*
|
|
186
215
|
* @generated from field: string type_url = 6;
|
|
187
216
|
*/
|
|
188
217
|
typeUrl?: string;
|
|
189
218
|
/**
|
|
219
|
+
* The index of the field type in `Type.oneofs`, for message or enumeration
|
|
220
|
+
* types. The first type has index 1; zero means the type is not in the list.
|
|
221
|
+
*
|
|
190
222
|
* @generated from field: int32 oneof_index = 7;
|
|
191
223
|
*/
|
|
192
224
|
oneofIndex?: number;
|
|
193
225
|
/**
|
|
226
|
+
* Whether to use alternative packed wire representation.
|
|
227
|
+
*
|
|
194
228
|
* @generated from field: bool packed = 8;
|
|
195
229
|
*/
|
|
196
230
|
packed?: boolean;
|
|
197
231
|
/**
|
|
232
|
+
* The protocol buffer options.
|
|
233
|
+
*
|
|
198
234
|
* @generated from field: repeated google.protobuf.Option options = 9;
|
|
199
235
|
*/
|
|
200
236
|
options?: OptionJson[];
|
|
201
237
|
/**
|
|
238
|
+
* The field JSON name.
|
|
239
|
+
*
|
|
202
240
|
* @generated from field: string json_name = 10;
|
|
203
241
|
*/
|
|
204
242
|
jsonName?: string;
|
|
205
243
|
/**
|
|
244
|
+
* The string value of the default value of this field. Proto2 syntax only.
|
|
245
|
+
*
|
|
206
246
|
* @generated from field: string default_value = 11;
|
|
207
247
|
*/
|
|
208
248
|
defaultValue?: string;
|
|
@@ -334,7 +374,9 @@ export declare enum Field_Kind {
|
|
|
334
374
|
TYPE_SINT64 = 18
|
|
335
375
|
}
|
|
336
376
|
/**
|
|
337
|
-
*
|
|
377
|
+
* Basic field types.
|
|
378
|
+
*
|
|
379
|
+
* @generated from enum google.protobuf.Field.Kind
|
|
338
380
|
*/
|
|
339
381
|
export type Field_KindJson = "TYPE_UNKNOWN" | "TYPE_DOUBLE" | "TYPE_FLOAT" | "TYPE_INT64" | "TYPE_UINT64" | "TYPE_INT32" | "TYPE_FIXED64" | "TYPE_FIXED32" | "TYPE_BOOL" | "TYPE_STRING" | "TYPE_GROUP" | "TYPE_MESSAGE" | "TYPE_BYTES" | "TYPE_UINT32" | "TYPE_ENUM" | "TYPE_SFIXED32" | "TYPE_SFIXED64" | "TYPE_SINT32" | "TYPE_SINT64";
|
|
340
382
|
/**
|
|
@@ -373,7 +415,9 @@ export declare enum Field_Cardinality {
|
|
|
373
415
|
REPEATED = 3
|
|
374
416
|
}
|
|
375
417
|
/**
|
|
376
|
-
*
|
|
418
|
+
* Whether a field is optional, required, or repeated.
|
|
419
|
+
*
|
|
420
|
+
* @generated from enum google.protobuf.Field.Cardinality
|
|
377
421
|
*/
|
|
378
422
|
export type Field_CardinalityJson = "CARDINALITY_UNKNOWN" | "CARDINALITY_OPTIONAL" | "CARDINALITY_REQUIRED" | "CARDINALITY_REPEATED";
|
|
379
423
|
/**
|
|
@@ -424,30 +468,44 @@ export type Enum = Message<"google.protobuf.Enum"> & {
|
|
|
424
468
|
edition: string;
|
|
425
469
|
};
|
|
426
470
|
/**
|
|
427
|
-
*
|
|
471
|
+
* Enum type definition.
|
|
472
|
+
*
|
|
473
|
+
* @generated from message google.protobuf.Enum
|
|
428
474
|
*/
|
|
429
475
|
export type EnumJson = {
|
|
430
476
|
/**
|
|
477
|
+
* Enum type name.
|
|
478
|
+
*
|
|
431
479
|
* @generated from field: string name = 1;
|
|
432
480
|
*/
|
|
433
481
|
name?: string;
|
|
434
482
|
/**
|
|
483
|
+
* Enum value definitions.
|
|
484
|
+
*
|
|
435
485
|
* @generated from field: repeated google.protobuf.EnumValue enumvalue = 2;
|
|
436
486
|
*/
|
|
437
487
|
enumvalue?: EnumValueJson[];
|
|
438
488
|
/**
|
|
489
|
+
* Protocol buffer options.
|
|
490
|
+
*
|
|
439
491
|
* @generated from field: repeated google.protobuf.Option options = 3;
|
|
440
492
|
*/
|
|
441
493
|
options?: OptionJson[];
|
|
442
494
|
/**
|
|
495
|
+
* The source context.
|
|
496
|
+
*
|
|
443
497
|
* @generated from field: google.protobuf.SourceContext source_context = 4;
|
|
444
498
|
*/
|
|
445
499
|
sourceContext?: SourceContextJson;
|
|
446
500
|
/**
|
|
501
|
+
* The source syntax.
|
|
502
|
+
*
|
|
447
503
|
* @generated from field: google.protobuf.Syntax syntax = 5;
|
|
448
504
|
*/
|
|
449
505
|
syntax?: SyntaxJson;
|
|
450
506
|
/**
|
|
507
|
+
* The source edition string, only valid when syntax is SYNTAX_EDITIONS.
|
|
508
|
+
*
|
|
451
509
|
* @generated from field: string edition = 6;
|
|
452
510
|
*/
|
|
453
511
|
edition?: string;
|
|
@@ -483,18 +541,26 @@ export type EnumValue = Message<"google.protobuf.EnumValue"> & {
|
|
|
483
541
|
options: Option[];
|
|
484
542
|
};
|
|
485
543
|
/**
|
|
486
|
-
*
|
|
544
|
+
* Enum value definition.
|
|
545
|
+
*
|
|
546
|
+
* @generated from message google.protobuf.EnumValue
|
|
487
547
|
*/
|
|
488
548
|
export type EnumValueJson = {
|
|
489
549
|
/**
|
|
550
|
+
* Enum value name.
|
|
551
|
+
*
|
|
490
552
|
* @generated from field: string name = 1;
|
|
491
553
|
*/
|
|
492
554
|
name?: string;
|
|
493
555
|
/**
|
|
556
|
+
* Enum value number.
|
|
557
|
+
*
|
|
494
558
|
* @generated from field: int32 number = 2;
|
|
495
559
|
*/
|
|
496
560
|
number?: number;
|
|
497
561
|
/**
|
|
562
|
+
* Protocol buffer options.
|
|
563
|
+
*
|
|
498
564
|
* @generated from field: repeated google.protobuf.Option options = 3;
|
|
499
565
|
*/
|
|
500
566
|
options?: OptionJson[];
|
|
@@ -531,14 +597,27 @@ export type Option = Message<"google.protobuf.Option"> & {
|
|
|
531
597
|
value?: Any;
|
|
532
598
|
};
|
|
533
599
|
/**
|
|
534
|
-
*
|
|
600
|
+
* A protocol buffer option, which can be attached to a message, field,
|
|
601
|
+
* enumeration, etc.
|
|
602
|
+
*
|
|
603
|
+
* @generated from message google.protobuf.Option
|
|
535
604
|
*/
|
|
536
605
|
export type OptionJson = {
|
|
537
606
|
/**
|
|
607
|
+
* The option's name. For protobuf built-in options (options defined in
|
|
608
|
+
* descriptor.proto), this is the short name. For example, `"map_entry"`.
|
|
609
|
+
* For custom options, it should be the fully-qualified name. For example,
|
|
610
|
+
* `"google.api.http"`.
|
|
611
|
+
*
|
|
538
612
|
* @generated from field: string name = 1;
|
|
539
613
|
*/
|
|
540
614
|
name?: string;
|
|
541
615
|
/**
|
|
616
|
+
* The option's value packed in an Any message. If the value is a primitive,
|
|
617
|
+
* the corresponding wrapper type defined in google/protobuf/wrappers.proto
|
|
618
|
+
* should be used. If the value is an enum, it should be stored as an int32
|
|
619
|
+
* value using the google.protobuf.Int32Value type.
|
|
620
|
+
*
|
|
542
621
|
* @generated from field: google.protobuf.Any value = 2;
|
|
543
622
|
*/
|
|
544
623
|
value?: AnyJson;
|
|
@@ -574,7 +653,9 @@ export declare enum Syntax {
|
|
|
574
653
|
EDITIONS = 2
|
|
575
654
|
}
|
|
576
655
|
/**
|
|
577
|
-
*
|
|
656
|
+
* The syntax in which a protocol buffer element is defined.
|
|
657
|
+
*
|
|
658
|
+
* @generated from enum google.protobuf.Syntax
|
|
578
659
|
*/
|
|
579
660
|
export type SyntaxJson = "SYNTAX_PROTO2" | "SYNTAX_PROTO3" | "SYNTAX_EDITIONS";
|
|
580
661
|
/**
|
|
@@ -20,7 +20,11 @@ export type DoubleValue = Message<"google.protobuf.DoubleValue"> & {
|
|
|
20
20
|
value: number;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Wrapper message for `double`.
|
|
24
|
+
*
|
|
25
|
+
* The JSON representation for `DoubleValue` is JSON number.
|
|
26
|
+
*
|
|
27
|
+
* @generated from message google.protobuf.DoubleValue
|
|
24
28
|
*/
|
|
25
29
|
export type DoubleValueJson = number | "NaN" | "Infinity" | "-Infinity";
|
|
26
30
|
/**
|
|
@@ -44,7 +48,11 @@ export type FloatValue = Message<"google.protobuf.FloatValue"> & {
|
|
|
44
48
|
value: number;
|
|
45
49
|
};
|
|
46
50
|
/**
|
|
47
|
-
*
|
|
51
|
+
* Wrapper message for `float`.
|
|
52
|
+
*
|
|
53
|
+
* The JSON representation for `FloatValue` is JSON number.
|
|
54
|
+
*
|
|
55
|
+
* @generated from message google.protobuf.FloatValue
|
|
48
56
|
*/
|
|
49
57
|
export type FloatValueJson = number | "NaN" | "Infinity" | "-Infinity";
|
|
50
58
|
/**
|
|
@@ -68,7 +76,11 @@ export type Int64Value = Message<"google.protobuf.Int64Value"> & {
|
|
|
68
76
|
value: bigint;
|
|
69
77
|
};
|
|
70
78
|
/**
|
|
71
|
-
*
|
|
79
|
+
* Wrapper message for `int64`.
|
|
80
|
+
*
|
|
81
|
+
* The JSON representation for `Int64Value` is JSON string.
|
|
82
|
+
*
|
|
83
|
+
* @generated from message google.protobuf.Int64Value
|
|
72
84
|
*/
|
|
73
85
|
export type Int64ValueJson = string;
|
|
74
86
|
/**
|
|
@@ -92,7 +104,11 @@ export type UInt64Value = Message<"google.protobuf.UInt64Value"> & {
|
|
|
92
104
|
value: bigint;
|
|
93
105
|
};
|
|
94
106
|
/**
|
|
95
|
-
*
|
|
107
|
+
* Wrapper message for `uint64`.
|
|
108
|
+
*
|
|
109
|
+
* The JSON representation for `UInt64Value` is JSON string.
|
|
110
|
+
*
|
|
111
|
+
* @generated from message google.protobuf.UInt64Value
|
|
96
112
|
*/
|
|
97
113
|
export type UInt64ValueJson = string;
|
|
98
114
|
/**
|
|
@@ -116,7 +132,11 @@ export type Int32Value = Message<"google.protobuf.Int32Value"> & {
|
|
|
116
132
|
value: number;
|
|
117
133
|
};
|
|
118
134
|
/**
|
|
119
|
-
*
|
|
135
|
+
* Wrapper message for `int32`.
|
|
136
|
+
*
|
|
137
|
+
* The JSON representation for `Int32Value` is JSON number.
|
|
138
|
+
*
|
|
139
|
+
* @generated from message google.protobuf.Int32Value
|
|
120
140
|
*/
|
|
121
141
|
export type Int32ValueJson = number;
|
|
122
142
|
/**
|
|
@@ -140,7 +160,11 @@ export type UInt32Value = Message<"google.protobuf.UInt32Value"> & {
|
|
|
140
160
|
value: number;
|
|
141
161
|
};
|
|
142
162
|
/**
|
|
143
|
-
*
|
|
163
|
+
* Wrapper message for `uint32`.
|
|
164
|
+
*
|
|
165
|
+
* The JSON representation for `UInt32Value` is JSON number.
|
|
166
|
+
*
|
|
167
|
+
* @generated from message google.protobuf.UInt32Value
|
|
144
168
|
*/
|
|
145
169
|
export type UInt32ValueJson = number;
|
|
146
170
|
/**
|
|
@@ -164,7 +188,11 @@ export type BoolValue = Message<"google.protobuf.BoolValue"> & {
|
|
|
164
188
|
value: boolean;
|
|
165
189
|
};
|
|
166
190
|
/**
|
|
167
|
-
*
|
|
191
|
+
* Wrapper message for `bool`.
|
|
192
|
+
*
|
|
193
|
+
* The JSON representation for `BoolValue` is JSON `true` and `false`.
|
|
194
|
+
*
|
|
195
|
+
* @generated from message google.protobuf.BoolValue
|
|
168
196
|
*/
|
|
169
197
|
export type BoolValueJson = boolean;
|
|
170
198
|
/**
|
|
@@ -188,7 +216,11 @@ export type StringValue = Message<"google.protobuf.StringValue"> & {
|
|
|
188
216
|
value: string;
|
|
189
217
|
};
|
|
190
218
|
/**
|
|
191
|
-
*
|
|
219
|
+
* Wrapper message for `string`.
|
|
220
|
+
*
|
|
221
|
+
* The JSON representation for `StringValue` is JSON string.
|
|
222
|
+
*
|
|
223
|
+
* @generated from message google.protobuf.StringValue
|
|
192
224
|
*/
|
|
193
225
|
export type StringValueJson = string;
|
|
194
226
|
/**
|
|
@@ -212,7 +244,11 @@ export type BytesValue = Message<"google.protobuf.BytesValue"> & {
|
|
|
212
244
|
value: Uint8Array;
|
|
213
245
|
};
|
|
214
246
|
/**
|
|
215
|
-
*
|
|
247
|
+
* Wrapper message for `bytes`.
|
|
248
|
+
*
|
|
249
|
+
* The JSON representation for `BytesValue` is JSON string.
|
|
250
|
+
*
|
|
251
|
+
* @generated from message google.protobuf.BytesValue
|
|
216
252
|
*/
|
|
217
253
|
export type BytesValueJson = string;
|
|
218
254
|
/**
|
package/dist/esm/registry.js
CHANGED
|
@@ -224,7 +224,7 @@ const DELIMITED = 2;
|
|
|
224
224
|
const OPEN = 1;
|
|
225
225
|
// prettier-ignore
|
|
226
226
|
// bootstrap-inject defaults: EDITION_PROTO2 to EDITION_2023: export const minimumEdition: SupportedEdition = $minimumEdition, maximumEdition: SupportedEdition = $maximumEdition;
|
|
227
|
-
// generated from protoc
|
|
227
|
+
// generated from protoc v28.0
|
|
228
228
|
export const minimumEdition = 998, maximumEdition = 1000;
|
|
229
229
|
const featureDefaults = {
|
|
230
230
|
// EDITION_PROTO2
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GenEnum, GenExtension, GenMessage } from "./codegenv1/types.js";
|
|
2
|
-
import type { DescEnum, DescExtension, DescMessage } from "./descriptors.js";
|
|
2
|
+
import type { DescEnum, DescExtension, DescMessage, DescMethod } from "./descriptors.js";
|
|
3
3
|
import type { OneofADT } from "./reflect/guard.js";
|
|
4
4
|
import type { WireType } from "./wire/index.js";
|
|
5
5
|
import type { JsonValue } from "./json-value.js";
|
|
@@ -28,7 +28,7 @@ export type MessageJsonType<Desc extends DescMessage> = Desc extends GenMessage<
|
|
|
28
28
|
* Extract the init type from a message descriptor.
|
|
29
29
|
* The init type is accepted by the function create().
|
|
30
30
|
*/
|
|
31
|
-
export type MessageInitShape<Desc extends DescMessage> = Desc extends GenMessage<infer RuntimeShape> ?
|
|
31
|
+
export type MessageInitShape<Desc extends DescMessage> = Desc extends GenMessage<infer RuntimeShape> ? MessageInit<RuntimeShape> : Record<string, unknown>;
|
|
32
32
|
/**
|
|
33
33
|
* Extract the enum type of from an enum descriptor.
|
|
34
34
|
*/
|
|
@@ -54,12 +54,32 @@ export type UnknownField = {
|
|
|
54
54
|
readonly wireType: WireType;
|
|
55
55
|
readonly data: Uint8Array;
|
|
56
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Describes a streaming RPC declaration.
|
|
59
|
+
*/
|
|
60
|
+
export type DescMethodStreaming<I extends DescMessage = DescMessage, O extends DescMessage = DescMessage> = DescMethodClientStreaming<I, O> | DescMethodServerStreaming<I, O> | DescMethodBiDiStreaming<I, O>;
|
|
61
|
+
/**
|
|
62
|
+
* Describes a unary RPC declaration.
|
|
63
|
+
*/
|
|
64
|
+
export type DescMethodUnary<I extends DescMessage = DescMessage, O extends DescMessage = DescMessage> = DescMethodTyped<"unary", I, O>;
|
|
65
|
+
/**
|
|
66
|
+
* Describes a server streaming RPC declaration.
|
|
67
|
+
*/
|
|
68
|
+
export type DescMethodServerStreaming<I extends DescMessage = DescMessage, O extends DescMessage = DescMessage> = DescMethodTyped<"server_streaming", I, O>;
|
|
69
|
+
/**
|
|
70
|
+
* Describes a client streaming RPC declaration.
|
|
71
|
+
*/
|
|
72
|
+
export type DescMethodClientStreaming<I extends DescMessage = DescMessage, O extends DescMessage = DescMessage> = DescMethodTyped<"client_streaming", I, O>;
|
|
73
|
+
/**
|
|
74
|
+
* Describes a bidi streaming RPC declaration.
|
|
75
|
+
*/
|
|
76
|
+
export type DescMethodBiDiStreaming<I extends DescMessage = DescMessage, O extends DescMessage = DescMessage> = DescMethodTyped<"bidi_streaming", I, O>;
|
|
57
77
|
/**
|
|
58
78
|
* The init type for a message, which makes all fields optional.
|
|
59
79
|
* The init type is accepted by the function create().
|
|
60
80
|
*/
|
|
61
|
-
type MessageInit<T extends Message> = {
|
|
62
|
-
[P in keyof T as P extends "$
|
|
81
|
+
type MessageInit<T extends Message> = T | {
|
|
82
|
+
[P in keyof T as P extends "$unknown" ? never : P]?: P extends "$typeName" ? never : FieldInit<T[P]>;
|
|
63
83
|
};
|
|
64
84
|
type FieldInit<F> = F extends (Date | Uint8Array | bigint | boolean | string | number) ? F : F extends Array<infer U> ? Array<FieldInit<U>> : F extends ReadonlyArray<infer U> ? ReadonlyArray<FieldInit<U>> : F extends Message ? MessageInit<F> : F extends OneofSelectedMessage<infer C, infer V> ? {
|
|
65
85
|
case: C;
|
|
@@ -74,4 +94,18 @@ type OneofSelectedMessage<K extends string, M extends Message> = {
|
|
|
74
94
|
case: K;
|
|
75
95
|
value: M;
|
|
76
96
|
};
|
|
97
|
+
type DescMethodTyped<K extends DescMethod["methodKind"], I extends DescMessage, O extends DescMessage> = Omit<DescMethod, "methodKind" | "input" | "output"> & {
|
|
98
|
+
/**
|
|
99
|
+
* One of the four available method types.
|
|
100
|
+
*/
|
|
101
|
+
readonly methodKind: K;
|
|
102
|
+
/**
|
|
103
|
+
* The message type for requests.
|
|
104
|
+
*/
|
|
105
|
+
readonly input: I;
|
|
106
|
+
/**
|
|
107
|
+
* The message type for responses.
|
|
108
|
+
*/
|
|
109
|
+
readonly output: O;
|
|
110
|
+
};
|
|
77
111
|
export {};
|
|
@@ -91,7 +91,10 @@ export class BinaryWriter {
|
|
|
91
91
|
* Return all bytes written and reset this writer.
|
|
92
92
|
*/
|
|
93
93
|
finish() {
|
|
94
|
-
|
|
94
|
+
if (this.buf.length) {
|
|
95
|
+
this.chunks.push(new Uint8Array(this.buf)); // flush the buffer
|
|
96
|
+
this.buf = [];
|
|
97
|
+
}
|
|
95
98
|
let len = 0;
|
|
96
99
|
for (let i = 0; i < this.chunks.length; i++)
|
|
97
100
|
len += this.chunks[i].length;
|
|
@@ -137,7 +137,94 @@ export type Any = Message<"google.protobuf.Any"> & {
|
|
|
137
137
|
value: Uint8Array;
|
|
138
138
|
};
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
140
|
+
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
141
|
+
* URL that describes the type of the serialized message.
|
|
142
|
+
*
|
|
143
|
+
* Protobuf library provides support to pack/unpack Any values in the form
|
|
144
|
+
* of utility functions or additional generated methods of the Any type.
|
|
145
|
+
*
|
|
146
|
+
* Example 1: Pack and unpack a message in C++.
|
|
147
|
+
*
|
|
148
|
+
* Foo foo = ...;
|
|
149
|
+
* Any any;
|
|
150
|
+
* any.PackFrom(foo);
|
|
151
|
+
* ...
|
|
152
|
+
* if (any.UnpackTo(&foo)) {
|
|
153
|
+
* ...
|
|
154
|
+
* }
|
|
155
|
+
*
|
|
156
|
+
* Example 2: Pack and unpack a message in Java.
|
|
157
|
+
*
|
|
158
|
+
* Foo foo = ...;
|
|
159
|
+
* Any any = Any.pack(foo);
|
|
160
|
+
* ...
|
|
161
|
+
* if (any.is(Foo.class)) {
|
|
162
|
+
* foo = any.unpack(Foo.class);
|
|
163
|
+
* }
|
|
164
|
+
* // or ...
|
|
165
|
+
* if (any.isSameTypeAs(Foo.getDefaultInstance())) {
|
|
166
|
+
* foo = any.unpack(Foo.getDefaultInstance());
|
|
167
|
+
* }
|
|
168
|
+
*
|
|
169
|
+
* Example 3: Pack and unpack a message in Python.
|
|
170
|
+
*
|
|
171
|
+
* foo = Foo(...)
|
|
172
|
+
* any = Any()
|
|
173
|
+
* any.Pack(foo)
|
|
174
|
+
* ...
|
|
175
|
+
* if any.Is(Foo.DESCRIPTOR):
|
|
176
|
+
* any.Unpack(foo)
|
|
177
|
+
* ...
|
|
178
|
+
*
|
|
179
|
+
* Example 4: Pack and unpack a message in Go
|
|
180
|
+
*
|
|
181
|
+
* foo := &pb.Foo{...}
|
|
182
|
+
* any, err := anypb.New(foo)
|
|
183
|
+
* if err != nil {
|
|
184
|
+
* ...
|
|
185
|
+
* }
|
|
186
|
+
* ...
|
|
187
|
+
* foo := &pb.Foo{}
|
|
188
|
+
* if err := any.UnmarshalTo(foo); err != nil {
|
|
189
|
+
* ...
|
|
190
|
+
* }
|
|
191
|
+
*
|
|
192
|
+
* The pack methods provided by protobuf library will by default use
|
|
193
|
+
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
194
|
+
* methods only use the fully qualified type name after the last '/'
|
|
195
|
+
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
196
|
+
* name "y.z".
|
|
197
|
+
*
|
|
198
|
+
* JSON
|
|
199
|
+
* ====
|
|
200
|
+
* The JSON representation of an `Any` value uses the regular
|
|
201
|
+
* representation of the deserialized, embedded message, with an
|
|
202
|
+
* additional field `@type` which contains the type URL. Example:
|
|
203
|
+
*
|
|
204
|
+
* package google.profile;
|
|
205
|
+
* message Person {
|
|
206
|
+
* string first_name = 1;
|
|
207
|
+
* string last_name = 2;
|
|
208
|
+
* }
|
|
209
|
+
*
|
|
210
|
+
* {
|
|
211
|
+
* "@type": "type.googleapis.com/google.profile.Person",
|
|
212
|
+
* "firstName": <string>,
|
|
213
|
+
* "lastName": <string>
|
|
214
|
+
* }
|
|
215
|
+
*
|
|
216
|
+
* If the embedded message type is well-known and has a custom JSON
|
|
217
|
+
* representation, that representation will be embedded adding a field
|
|
218
|
+
* `value` which holds the custom JSON in addition to the `@type`
|
|
219
|
+
* field. Example (for message [google.protobuf.Duration][]):
|
|
220
|
+
*
|
|
221
|
+
* {
|
|
222
|
+
* "@type": "type.googleapis.com/google.protobuf.Duration",
|
|
223
|
+
* "value": "1.212s"
|
|
224
|
+
* }
|
|
225
|
+
*
|
|
226
|
+
*
|
|
227
|
+
* @generated from message google.protobuf.Any
|
|
141
228
|
*/
|
|
142
229
|
export type AnyJson = {
|
|
143
230
|
"@type"?: string;
|