@bufbuild/protobuf 1.3.0 → 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/cjs/private/json-format-common.js +2 -1
- package/dist/cjs/private/util-common.js +37 -8
- 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-common.js +2 -1
- 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-common.js +37 -8
- 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
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import type { EnumType } from "./enum.js";
|
|
2
|
+
import type { MessageType } from "./message-type.js";
|
|
3
|
+
/**
|
|
4
|
+
* FieldInfo describes a field of a protobuf message for runtime reflection. We
|
|
5
|
+
* distinguish between the following kinds of fields:
|
|
6
|
+
*
|
|
7
|
+
* - "scalar": string, bool, float, int32, etc. The scalar type is "T".
|
|
8
|
+
* - "enum": The field was declared with an enum type. The enum type is "T".
|
|
9
|
+
* - "message": The field was declared with a message type. The message type is "T".
|
|
10
|
+
* - "map": The field was declared with map<K,V>. The key type is "K", the value type is "V".
|
|
11
|
+
*
|
|
12
|
+
* Every field always has the following properties:
|
|
13
|
+
*
|
|
14
|
+
* - "no": The field number of the protobuf field.
|
|
15
|
+
* - "name": The original name of the protobuf field.
|
|
16
|
+
* - "localName": The name of the field as used in generated code.
|
|
17
|
+
* - "jsonName": The name for JSON serialization / deserialization.
|
|
18
|
+
* - "opt": Whether the field is optional.
|
|
19
|
+
* - "repeated": Whether the field is repeated.
|
|
20
|
+
* - "packed": Whether the repeated field is packed.
|
|
21
|
+
*
|
|
22
|
+
* Additionally, fields may have the following properties:
|
|
23
|
+
*
|
|
24
|
+
* - "oneof": If the field is member of a oneof group.
|
|
25
|
+
* - "default": Only proto2: An explicit default value.
|
|
26
|
+
*/
|
|
27
|
+
export type FieldInfo = fiRules<fiScalar> | fiRules<fiEnum> | fiRules<fiMessage> | fiRules<fiMap>;
|
|
28
|
+
/**
|
|
29
|
+
* Version of `FieldInfo` that allows the following properties
|
|
30
|
+
* to be omitted:
|
|
31
|
+
*
|
|
32
|
+
* - "localName", "jsonName": can be omitted if equal to lowerCamelCase(name)
|
|
33
|
+
* - "opt": Can be omitted if false.
|
|
34
|
+
* - "repeated": Can be omitted if false.
|
|
35
|
+
* - "packed": Can be omitted if equal to the standard packing of the field.
|
|
36
|
+
*/
|
|
37
|
+
export type PartialFieldInfo = fiPartialRules<fiScalar> | fiPartialRules<fiEnum> | fiPartialRules<fiMessage> | fiPartialRules<fiMap>;
|
|
38
|
+
/**
|
|
39
|
+
* Provides convenient access to field information of a oneof.
|
|
40
|
+
*/
|
|
41
|
+
export interface OneofInfo {
|
|
42
|
+
readonly kind: "oneof";
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly localName: string;
|
|
45
|
+
readonly repeated: false;
|
|
46
|
+
readonly packed: false;
|
|
47
|
+
readonly opt: false;
|
|
48
|
+
readonly default: undefined;
|
|
49
|
+
readonly fields: readonly FieldInfo[];
|
|
50
|
+
/**
|
|
51
|
+
* Return field information by local name.
|
|
52
|
+
*/
|
|
53
|
+
findField(localName: string): FieldInfo | undefined;
|
|
54
|
+
}
|
|
55
|
+
interface fiShared {
|
|
56
|
+
/**
|
|
57
|
+
* The field number of the .proto field.
|
|
58
|
+
*/
|
|
59
|
+
readonly no: number;
|
|
60
|
+
/**
|
|
61
|
+
* The original name of the .proto field.
|
|
62
|
+
*/
|
|
63
|
+
readonly name: string;
|
|
64
|
+
/**
|
|
65
|
+
* The name of the field as used in generated code.
|
|
66
|
+
*/
|
|
67
|
+
readonly localName: string;
|
|
68
|
+
/**
|
|
69
|
+
* The name for JSON serialization / deserialization.
|
|
70
|
+
*/
|
|
71
|
+
readonly jsonName: string;
|
|
72
|
+
/**
|
|
73
|
+
* The `oneof` group, if this field belongs to one.
|
|
74
|
+
*/
|
|
75
|
+
readonly oneof?: OneofInfo | undefined;
|
|
76
|
+
}
|
|
77
|
+
interface fiScalar extends fiShared {
|
|
78
|
+
readonly kind: "scalar";
|
|
79
|
+
/**
|
|
80
|
+
* Scalar type of the field.
|
|
81
|
+
*/
|
|
82
|
+
readonly T: ScalarType;
|
|
83
|
+
/**
|
|
84
|
+
* Is the field repeated?
|
|
85
|
+
*/
|
|
86
|
+
readonly repeated: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Is this repeated field packed?
|
|
89
|
+
* BYTES and STRING can never be packed, since they are length-delimited.
|
|
90
|
+
* Other types can be packed with the field option "packed".
|
|
91
|
+
* For proto3, fields are packed by default.
|
|
92
|
+
*/
|
|
93
|
+
readonly packed: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Is the field optional?
|
|
96
|
+
*/
|
|
97
|
+
readonly opt: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Only proto2: An explicit default value.
|
|
100
|
+
*/
|
|
101
|
+
readonly default: number | boolean | string | bigint | Uint8Array | undefined;
|
|
102
|
+
}
|
|
103
|
+
interface fiMessage extends fiShared {
|
|
104
|
+
readonly kind: "message";
|
|
105
|
+
/**
|
|
106
|
+
* Message handler for the field.
|
|
107
|
+
*/
|
|
108
|
+
readonly T: MessageType;
|
|
109
|
+
/**
|
|
110
|
+
* Is the field repeated?
|
|
111
|
+
*/
|
|
112
|
+
readonly repeated: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Is this repeated field packed? Never true for messages.
|
|
115
|
+
*/
|
|
116
|
+
readonly packed: false;
|
|
117
|
+
/**
|
|
118
|
+
* An explicit default value (only proto2). Never set for messages.
|
|
119
|
+
*/
|
|
120
|
+
readonly default: undefined;
|
|
121
|
+
}
|
|
122
|
+
interface fiEnum extends fiShared {
|
|
123
|
+
readonly kind: "enum";
|
|
124
|
+
/**
|
|
125
|
+
* Enum type information for the field.
|
|
126
|
+
*/
|
|
127
|
+
readonly T: EnumType;
|
|
128
|
+
/**
|
|
129
|
+
* Is the field repeated?
|
|
130
|
+
*/
|
|
131
|
+
readonly repeated: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Is this repeated field packed?
|
|
134
|
+
* Repeated enums can be packed with the field option "packed".
|
|
135
|
+
* For proto3, they are packed by default.
|
|
136
|
+
*/
|
|
137
|
+
readonly packed: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Is the field optional?
|
|
140
|
+
*/
|
|
141
|
+
readonly opt: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Only proto2: An explicit default value.
|
|
144
|
+
*/
|
|
145
|
+
readonly default: number | undefined;
|
|
146
|
+
}
|
|
147
|
+
interface fiMap extends fiShared {
|
|
148
|
+
readonly kind: "map";
|
|
149
|
+
/**
|
|
150
|
+
* Map key type.
|
|
151
|
+
*
|
|
152
|
+
* The key_type can be any integral or string type
|
|
153
|
+
* (so, any scalar type except for floating point
|
|
154
|
+
* types and bytes)
|
|
155
|
+
*/
|
|
156
|
+
readonly K: Exclude<ScalarType, ScalarType.FLOAT | ScalarType.DOUBLE | ScalarType.BYTES>;
|
|
157
|
+
/**
|
|
158
|
+
* Map value type. Can be scalar, enum, or message.
|
|
159
|
+
*/
|
|
160
|
+
readonly V: {
|
|
161
|
+
readonly kind: "scalar";
|
|
162
|
+
readonly T: ScalarType;
|
|
163
|
+
} | {
|
|
164
|
+
readonly kind: "enum";
|
|
165
|
+
readonly T: EnumType;
|
|
166
|
+
} | {
|
|
167
|
+
readonly kind: "message";
|
|
168
|
+
readonly T: MessageType;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Is the field repeated? Never true for maps.
|
|
172
|
+
*/
|
|
173
|
+
readonly repeated: false;
|
|
174
|
+
/**
|
|
175
|
+
* Is this repeated field packed? Never true for maps.
|
|
176
|
+
*/
|
|
177
|
+
readonly packed: false;
|
|
178
|
+
/**
|
|
179
|
+
* An explicit default value (only proto2). Never set for maps.
|
|
180
|
+
*/
|
|
181
|
+
readonly default: undefined;
|
|
182
|
+
}
|
|
183
|
+
type fiRules<T> = Omit<T, "oneof" | "repeat" | "repeated" | "packed" | "opt"> & ({
|
|
184
|
+
readonly repeated: false;
|
|
185
|
+
readonly packed: false;
|
|
186
|
+
readonly opt: false;
|
|
187
|
+
readonly oneof: undefined;
|
|
188
|
+
} | {
|
|
189
|
+
readonly repeated: false;
|
|
190
|
+
readonly packed: false;
|
|
191
|
+
readonly opt: true;
|
|
192
|
+
readonly oneof: undefined;
|
|
193
|
+
} | {
|
|
194
|
+
readonly repeated: boolean;
|
|
195
|
+
readonly packed: boolean;
|
|
196
|
+
readonly opt: false;
|
|
197
|
+
readonly oneof: undefined;
|
|
198
|
+
} | {
|
|
199
|
+
readonly repeated: false;
|
|
200
|
+
readonly packed: false;
|
|
201
|
+
readonly opt: false;
|
|
202
|
+
readonly oneof: OneofInfo;
|
|
203
|
+
});
|
|
204
|
+
type fiPartialRules<T extends fiScalar | fiMap | fiEnum | fiMessage> = Omit<T, "jsonName" | "localName" | "oneof" | "repeat" | "repeated" | "packed" | "opt" | "default"> & ({
|
|
205
|
+
readonly jsonName?: string;
|
|
206
|
+
readonly repeated?: false;
|
|
207
|
+
readonly packed?: false;
|
|
208
|
+
readonly opt?: false;
|
|
209
|
+
readonly oneof?: undefined;
|
|
210
|
+
default?: T["default"];
|
|
211
|
+
} | {
|
|
212
|
+
readonly jsonName?: string;
|
|
213
|
+
readonly repeated?: false;
|
|
214
|
+
readonly packed?: false;
|
|
215
|
+
readonly opt: true;
|
|
216
|
+
readonly oneof?: undefined;
|
|
217
|
+
default?: T["default"];
|
|
218
|
+
} | {
|
|
219
|
+
readonly jsonName?: string;
|
|
220
|
+
readonly repeated?: boolean;
|
|
221
|
+
readonly packed?: boolean;
|
|
222
|
+
readonly opt?: false;
|
|
223
|
+
readonly oneof?: undefined;
|
|
224
|
+
default?: T["default"];
|
|
225
|
+
} | {
|
|
226
|
+
readonly jsonName?: string;
|
|
227
|
+
readonly repeated?: false;
|
|
228
|
+
readonly packed?: false;
|
|
229
|
+
readonly opt?: false;
|
|
230
|
+
readonly oneof: string;
|
|
231
|
+
default?: T["default"];
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* Scalar value types. This is a subset of field types declared by protobuf
|
|
235
|
+
* enum google.protobuf.FieldDescriptorProto.Type The types GROUP and MESSAGE
|
|
236
|
+
* are omitted, but the numerical values are identical.
|
|
237
|
+
*/
|
|
238
|
+
export declare enum ScalarType {
|
|
239
|
+
DOUBLE = 1,
|
|
240
|
+
FLOAT = 2,
|
|
241
|
+
INT64 = 3,
|
|
242
|
+
UINT64 = 4,
|
|
243
|
+
INT32 = 5,
|
|
244
|
+
FIXED64 = 6,
|
|
245
|
+
FIXED32 = 7,
|
|
246
|
+
BOOL = 8,
|
|
247
|
+
STRING = 9,
|
|
248
|
+
BYTES = 12,
|
|
249
|
+
UINT32 = 13,
|
|
250
|
+
SFIXED32 = 15,
|
|
251
|
+
SFIXED64 = 16,
|
|
252
|
+
SINT32 = 17,
|
|
253
|
+
SINT64 = 18
|
|
254
|
+
}
|
|
255
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { PartialMessage, PlainMessage } from "../../message.js";
|
|
2
|
+
import { Message } from "../../message.js";
|
|
3
|
+
import { proto3 } from "../../proto3.js";
|
|
4
|
+
import type { JsonReadOptions, JsonValue, JsonWriteOptions } from "../../json-format.js";
|
|
5
|
+
import type { IMessageTypeRegistry } from "../../type-registry.js";
|
|
6
|
+
import type { MessageType } from "../../message-type.js";
|
|
7
|
+
import type { FieldList } from "../../field-list.js";
|
|
8
|
+
import type { BinaryReadOptions } from "../../binary-format.js";
|
|
9
|
+
/**
|
|
10
|
+
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
11
|
+
* URL that describes the type of the serialized message.
|
|
12
|
+
*
|
|
13
|
+
* Protobuf library provides support to pack/unpack Any values in the form
|
|
14
|
+
* of utility functions or additional generated methods of the Any type.
|
|
15
|
+
*
|
|
16
|
+
* Example 1: Pack and unpack a message in C++.
|
|
17
|
+
*
|
|
18
|
+
* Foo foo = ...;
|
|
19
|
+
* Any any;
|
|
20
|
+
* any.PackFrom(foo);
|
|
21
|
+
* ...
|
|
22
|
+
* if (any.UnpackTo(&foo)) {
|
|
23
|
+
* ...
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* Example 2: Pack and unpack a message in Java.
|
|
27
|
+
*
|
|
28
|
+
* Foo foo = ...;
|
|
29
|
+
* Any any = Any.pack(foo);
|
|
30
|
+
* ...
|
|
31
|
+
* if (any.is(Foo.class)) {
|
|
32
|
+
* foo = any.unpack(Foo.class);
|
|
33
|
+
* }
|
|
34
|
+
* // or ...
|
|
35
|
+
* if (any.isSameTypeAs(Foo.getDefaultInstance())) {
|
|
36
|
+
* foo = any.unpack(Foo.getDefaultInstance());
|
|
37
|
+
* }
|
|
38
|
+
*
|
|
39
|
+
* Example 3: Pack and unpack a message in Python.
|
|
40
|
+
*
|
|
41
|
+
* foo = Foo(...)
|
|
42
|
+
* any = Any()
|
|
43
|
+
* any.Pack(foo)
|
|
44
|
+
* ...
|
|
45
|
+
* if any.Is(Foo.DESCRIPTOR):
|
|
46
|
+
* any.Unpack(foo)
|
|
47
|
+
* ...
|
|
48
|
+
*
|
|
49
|
+
* Example 4: Pack and unpack a message in Go
|
|
50
|
+
*
|
|
51
|
+
* foo := &pb.Foo{...}
|
|
52
|
+
* any, err := anypb.New(foo)
|
|
53
|
+
* if err != nil {
|
|
54
|
+
* ...
|
|
55
|
+
* }
|
|
56
|
+
* ...
|
|
57
|
+
* foo := &pb.Foo{}
|
|
58
|
+
* if err := any.UnmarshalTo(foo); err != nil {
|
|
59
|
+
* ...
|
|
60
|
+
* }
|
|
61
|
+
*
|
|
62
|
+
* The pack methods provided by protobuf library will by default use
|
|
63
|
+
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
64
|
+
* methods only use the fully qualified type name after the last '/'
|
|
65
|
+
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
66
|
+
* name "y.z".
|
|
67
|
+
*
|
|
68
|
+
* JSON
|
|
69
|
+
* ====
|
|
70
|
+
* The JSON representation of an `Any` value uses the regular
|
|
71
|
+
* representation of the deserialized, embedded message, with an
|
|
72
|
+
* additional field `@type` which contains the type URL. Example:
|
|
73
|
+
*
|
|
74
|
+
* package google.profile;
|
|
75
|
+
* message Person {
|
|
76
|
+
* string first_name = 1;
|
|
77
|
+
* string last_name = 2;
|
|
78
|
+
* }
|
|
79
|
+
*
|
|
80
|
+
* {
|
|
81
|
+
* "@type": "type.googleapis.com/google.profile.Person",
|
|
82
|
+
* "firstName": <string>,
|
|
83
|
+
* "lastName": <string>
|
|
84
|
+
* }
|
|
85
|
+
*
|
|
86
|
+
* If the embedded message type is well-known and has a custom JSON
|
|
87
|
+
* representation, that representation will be embedded adding a field
|
|
88
|
+
* `value` which holds the custom JSON in addition to the `@type`
|
|
89
|
+
* field. Example (for message [google.protobuf.Duration][]):
|
|
90
|
+
*
|
|
91
|
+
* {
|
|
92
|
+
* "@type": "type.googleapis.com/google.protobuf.Duration",
|
|
93
|
+
* "value": "1.212s"
|
|
94
|
+
* }
|
|
95
|
+
*
|
|
96
|
+
*
|
|
97
|
+
* @generated from message google.protobuf.Any
|
|
98
|
+
*/
|
|
99
|
+
export declare class Any extends Message<Any> {
|
|
100
|
+
/**
|
|
101
|
+
* A URL/resource name that uniquely identifies the type of the serialized
|
|
102
|
+
* protocol buffer message. This string must contain at least
|
|
103
|
+
* one "/" character. The last segment of the URL's path must represent
|
|
104
|
+
* the fully qualified name of the type (as in
|
|
105
|
+
* `path/google.protobuf.Duration`). The name should be in a canonical form
|
|
106
|
+
* (e.g., leading "." is not accepted).
|
|
107
|
+
*
|
|
108
|
+
* In practice, teams usually precompile into the binary all types that they
|
|
109
|
+
* expect it to use in the context of Any. However, for URLs which use the
|
|
110
|
+
* scheme `http`, `https`, or no scheme, one can optionally set up a type
|
|
111
|
+
* server that maps type URLs to message definitions as follows:
|
|
112
|
+
*
|
|
113
|
+
* * If no scheme is provided, `https` is assumed.
|
|
114
|
+
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
|
115
|
+
* value in binary format, or produce an error.
|
|
116
|
+
* * Applications are allowed to cache lookup results based on the
|
|
117
|
+
* URL, or have them precompiled into a binary to avoid any
|
|
118
|
+
* lookup. Therefore, binary compatibility needs to be preserved
|
|
119
|
+
* on changes to types. (Use versioned type names to manage
|
|
120
|
+
* breaking changes.)
|
|
121
|
+
*
|
|
122
|
+
* Note: this functionality is not currently available in the official
|
|
123
|
+
* protobuf release, and it is not used for type URLs beginning with
|
|
124
|
+
* type.googleapis.com.
|
|
125
|
+
*
|
|
126
|
+
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
127
|
+
* used with implementation specific semantics.
|
|
128
|
+
*
|
|
129
|
+
*
|
|
130
|
+
* @generated from field: string type_url = 1;
|
|
131
|
+
*/
|
|
132
|
+
typeUrl: string;
|
|
133
|
+
/**
|
|
134
|
+
* Must be a valid serialized protocol buffer of the above specified type.
|
|
135
|
+
*
|
|
136
|
+
* @generated from field: bytes value = 2;
|
|
137
|
+
*/
|
|
138
|
+
value: Uint8Array;
|
|
139
|
+
constructor(data?: PartialMessage<Any>);
|
|
140
|
+
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
|
|
141
|
+
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
|
|
142
|
+
packFrom(message: Message): void;
|
|
143
|
+
unpackTo(target: Message): boolean;
|
|
144
|
+
unpack(registry: IMessageTypeRegistry): Message | undefined;
|
|
145
|
+
is(type: MessageType | string): boolean;
|
|
146
|
+
private typeNameToUrl;
|
|
147
|
+
private typeUrlToName;
|
|
148
|
+
static readonly runtime: typeof proto3;
|
|
149
|
+
static readonly typeName = "google.protobuf.Any";
|
|
150
|
+
static readonly fields: FieldList;
|
|
151
|
+
static pack(message: Message): Any;
|
|
152
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Any;
|
|
153
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Any;
|
|
154
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Any;
|
|
155
|
+
static equals(a: Any | PlainMessage<Any> | undefined, b: Any | PlainMessage<Any> | undefined): boolean;
|
|
156
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import type { PartialMessage, PlainMessage } from "../../message.js";
|
|
2
|
+
import { Message } from "../../message.js";
|
|
3
|
+
import { Option, Syntax } from "./type_pb.js";
|
|
4
|
+
import { SourceContext } from "./source_context_pb.js";
|
|
5
|
+
import { proto3 } from "../../proto3.js";
|
|
6
|
+
import type { FieldList } from "../../field-list.js";
|
|
7
|
+
import type { BinaryReadOptions } from "../../binary-format.js";
|
|
8
|
+
import type { JsonReadOptions, JsonValue } from "../../json-format.js";
|
|
9
|
+
/**
|
|
10
|
+
* Api is a light-weight descriptor for an API Interface.
|
|
11
|
+
*
|
|
12
|
+
* Interfaces are also described as "protocol buffer services" in some contexts,
|
|
13
|
+
* such as by the "service" keyword in a .proto file, but they are different
|
|
14
|
+
* from API Services, which represent a concrete implementation of an interface
|
|
15
|
+
* as opposed to simply a description of methods and bindings. They are also
|
|
16
|
+
* sometimes simply referred to as "APIs" in other contexts, such as the name of
|
|
17
|
+
* this message itself. See https://cloud.google.com/apis/design/glossary for
|
|
18
|
+
* detailed terminology.
|
|
19
|
+
*
|
|
20
|
+
* @generated from message google.protobuf.Api
|
|
21
|
+
*/
|
|
22
|
+
export declare class Api extends Message<Api> {
|
|
23
|
+
/**
|
|
24
|
+
* The fully qualified name of this interface, including package name
|
|
25
|
+
* followed by the interface's simple name.
|
|
26
|
+
*
|
|
27
|
+
* @generated from field: string name = 1;
|
|
28
|
+
*/
|
|
29
|
+
name: string;
|
|
30
|
+
/**
|
|
31
|
+
* The methods of this interface, in unspecified order.
|
|
32
|
+
*
|
|
33
|
+
* @generated from field: repeated google.protobuf.Method methods = 2;
|
|
34
|
+
*/
|
|
35
|
+
methods: Method[];
|
|
36
|
+
/**
|
|
37
|
+
* Any metadata attached to the interface.
|
|
38
|
+
*
|
|
39
|
+
* @generated from field: repeated google.protobuf.Option options = 3;
|
|
40
|
+
*/
|
|
41
|
+
options: Option[];
|
|
42
|
+
/**
|
|
43
|
+
* A version string for this interface. If specified, must have the form
|
|
44
|
+
* `major-version.minor-version`, as in `1.10`. If the minor version is
|
|
45
|
+
* omitted, it defaults to zero. If the entire version field is empty, the
|
|
46
|
+
* major version is derived from the package name, as outlined below. If the
|
|
47
|
+
* field is not empty, the version in the package name will be verified to be
|
|
48
|
+
* consistent with what is provided here.
|
|
49
|
+
*
|
|
50
|
+
* The versioning schema uses [semantic
|
|
51
|
+
* versioning](http://semver.org) where the major version number
|
|
52
|
+
* indicates a breaking change and the minor version an additive,
|
|
53
|
+
* non-breaking change. Both version numbers are signals to users
|
|
54
|
+
* what to expect from different versions, and should be carefully
|
|
55
|
+
* chosen based on the product plan.
|
|
56
|
+
*
|
|
57
|
+
* The major version is also reflected in the package name of the
|
|
58
|
+
* interface, which must end in `v<major-version>`, as in
|
|
59
|
+
* `google.feature.v1`. For major versions 0 and 1, the suffix can
|
|
60
|
+
* be omitted. Zero major versions must only be used for
|
|
61
|
+
* experimental, non-GA interfaces.
|
|
62
|
+
*
|
|
63
|
+
*
|
|
64
|
+
* @generated from field: string version = 4;
|
|
65
|
+
*/
|
|
66
|
+
version: string;
|
|
67
|
+
/**
|
|
68
|
+
* Source context for the protocol buffer service represented by this
|
|
69
|
+
* message.
|
|
70
|
+
*
|
|
71
|
+
* @generated from field: google.protobuf.SourceContext source_context = 5;
|
|
72
|
+
*/
|
|
73
|
+
sourceContext?: SourceContext;
|
|
74
|
+
/**
|
|
75
|
+
* Included interfaces. See [Mixin][].
|
|
76
|
+
*
|
|
77
|
+
* @generated from field: repeated google.protobuf.Mixin mixins = 6;
|
|
78
|
+
*/
|
|
79
|
+
mixins: Mixin[];
|
|
80
|
+
/**
|
|
81
|
+
* The source syntax of the service.
|
|
82
|
+
*
|
|
83
|
+
* @generated from field: google.protobuf.Syntax syntax = 7;
|
|
84
|
+
*/
|
|
85
|
+
syntax: Syntax;
|
|
86
|
+
constructor(data?: PartialMessage<Api>);
|
|
87
|
+
static readonly runtime: typeof proto3;
|
|
88
|
+
static readonly typeName = "google.protobuf.Api";
|
|
89
|
+
static readonly fields: FieldList;
|
|
90
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Api;
|
|
91
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Api;
|
|
92
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Api;
|
|
93
|
+
static equals(a: Api | PlainMessage<Api> | undefined, b: Api | PlainMessage<Api> | undefined): boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Method represents a method of an API interface.
|
|
97
|
+
*
|
|
98
|
+
* @generated from message google.protobuf.Method
|
|
99
|
+
*/
|
|
100
|
+
export declare class Method extends Message<Method> {
|
|
101
|
+
/**
|
|
102
|
+
* The simple name of this method.
|
|
103
|
+
*
|
|
104
|
+
* @generated from field: string name = 1;
|
|
105
|
+
*/
|
|
106
|
+
name: string;
|
|
107
|
+
/**
|
|
108
|
+
* A URL of the input message type.
|
|
109
|
+
*
|
|
110
|
+
* @generated from field: string request_type_url = 2;
|
|
111
|
+
*/
|
|
112
|
+
requestTypeUrl: string;
|
|
113
|
+
/**
|
|
114
|
+
* If true, the request is streamed.
|
|
115
|
+
*
|
|
116
|
+
* @generated from field: bool request_streaming = 3;
|
|
117
|
+
*/
|
|
118
|
+
requestStreaming: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* The URL of the output message type.
|
|
121
|
+
*
|
|
122
|
+
* @generated from field: string response_type_url = 4;
|
|
123
|
+
*/
|
|
124
|
+
responseTypeUrl: string;
|
|
125
|
+
/**
|
|
126
|
+
* If true, the response is streamed.
|
|
127
|
+
*
|
|
128
|
+
* @generated from field: bool response_streaming = 5;
|
|
129
|
+
*/
|
|
130
|
+
responseStreaming: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Any metadata attached to the method.
|
|
133
|
+
*
|
|
134
|
+
* @generated from field: repeated google.protobuf.Option options = 6;
|
|
135
|
+
*/
|
|
136
|
+
options: Option[];
|
|
137
|
+
/**
|
|
138
|
+
* The source syntax of this method.
|
|
139
|
+
*
|
|
140
|
+
* @generated from field: google.protobuf.Syntax syntax = 7;
|
|
141
|
+
*/
|
|
142
|
+
syntax: Syntax;
|
|
143
|
+
constructor(data?: PartialMessage<Method>);
|
|
144
|
+
static readonly runtime: typeof proto3;
|
|
145
|
+
static readonly typeName = "google.protobuf.Method";
|
|
146
|
+
static readonly fields: FieldList;
|
|
147
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Method;
|
|
148
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Method;
|
|
149
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Method;
|
|
150
|
+
static equals(a: Method | PlainMessage<Method> | undefined, b: Method | PlainMessage<Method> | undefined): boolean;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Declares an API Interface to be included in this interface. The including
|
|
154
|
+
* interface must redeclare all the methods from the included interface, but
|
|
155
|
+
* documentation and options are inherited as follows:
|
|
156
|
+
*
|
|
157
|
+
* - If after comment and whitespace stripping, the documentation
|
|
158
|
+
* string of the redeclared method is empty, it will be inherited
|
|
159
|
+
* from the original method.
|
|
160
|
+
*
|
|
161
|
+
* - Each annotation belonging to the service config (http,
|
|
162
|
+
* visibility) which is not set in the redeclared method will be
|
|
163
|
+
* inherited.
|
|
164
|
+
*
|
|
165
|
+
* - If an http annotation is inherited, the path pattern will be
|
|
166
|
+
* modified as follows. Any version prefix will be replaced by the
|
|
167
|
+
* version of the including interface plus the [root][] path if
|
|
168
|
+
* specified.
|
|
169
|
+
*
|
|
170
|
+
* Example of a simple mixin:
|
|
171
|
+
*
|
|
172
|
+
* package google.acl.v1;
|
|
173
|
+
* service AccessControl {
|
|
174
|
+
* // Get the underlying ACL object.
|
|
175
|
+
* rpc GetAcl(GetAclRequest) returns (Acl) {
|
|
176
|
+
* option (google.api.http).get = "/v1/{resource=**}:getAcl";
|
|
177
|
+
* }
|
|
178
|
+
* }
|
|
179
|
+
*
|
|
180
|
+
* package google.storage.v2;
|
|
181
|
+
* service Storage {
|
|
182
|
+
* rpc GetAcl(GetAclRequest) returns (Acl);
|
|
183
|
+
*
|
|
184
|
+
* // Get a data record.
|
|
185
|
+
* rpc GetData(GetDataRequest) returns (Data) {
|
|
186
|
+
* option (google.api.http).get = "/v2/{resource=**}";
|
|
187
|
+
* }
|
|
188
|
+
* }
|
|
189
|
+
*
|
|
190
|
+
* Example of a mixin configuration:
|
|
191
|
+
*
|
|
192
|
+
* apis:
|
|
193
|
+
* - name: google.storage.v2.Storage
|
|
194
|
+
* mixins:
|
|
195
|
+
* - name: google.acl.v1.AccessControl
|
|
196
|
+
*
|
|
197
|
+
* The mixin construct implies that all methods in `AccessControl` are
|
|
198
|
+
* also declared with same name and request/response types in
|
|
199
|
+
* `Storage`. A documentation generator or annotation processor will
|
|
200
|
+
* see the effective `Storage.GetAcl` method after inherting
|
|
201
|
+
* documentation and annotations as follows:
|
|
202
|
+
*
|
|
203
|
+
* service Storage {
|
|
204
|
+
* // Get the underlying ACL object.
|
|
205
|
+
* rpc GetAcl(GetAclRequest) returns (Acl) {
|
|
206
|
+
* option (google.api.http).get = "/v2/{resource=**}:getAcl";
|
|
207
|
+
* }
|
|
208
|
+
* ...
|
|
209
|
+
* }
|
|
210
|
+
*
|
|
211
|
+
* Note how the version in the path pattern changed from `v1` to `v2`.
|
|
212
|
+
*
|
|
213
|
+
* If the `root` field in the mixin is specified, it should be a
|
|
214
|
+
* relative path under which inherited HTTP paths are placed. Example:
|
|
215
|
+
*
|
|
216
|
+
* apis:
|
|
217
|
+
* - name: google.storage.v2.Storage
|
|
218
|
+
* mixins:
|
|
219
|
+
* - name: google.acl.v1.AccessControl
|
|
220
|
+
* root: acls
|
|
221
|
+
*
|
|
222
|
+
* This implies the following inherited HTTP annotation:
|
|
223
|
+
*
|
|
224
|
+
* service Storage {
|
|
225
|
+
* // Get the underlying ACL object.
|
|
226
|
+
* rpc GetAcl(GetAclRequest) returns (Acl) {
|
|
227
|
+
* option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
|
|
228
|
+
* }
|
|
229
|
+
* ...
|
|
230
|
+
* }
|
|
231
|
+
*
|
|
232
|
+
* @generated from message google.protobuf.Mixin
|
|
233
|
+
*/
|
|
234
|
+
export declare class Mixin extends Message<Mixin> {
|
|
235
|
+
/**
|
|
236
|
+
* The fully qualified name of the interface which is included.
|
|
237
|
+
*
|
|
238
|
+
* @generated from field: string name = 1;
|
|
239
|
+
*/
|
|
240
|
+
name: string;
|
|
241
|
+
/**
|
|
242
|
+
* If non-empty specifies a path under which inherited HTTP paths
|
|
243
|
+
* are rooted.
|
|
244
|
+
*
|
|
245
|
+
* @generated from field: string root = 2;
|
|
246
|
+
*/
|
|
247
|
+
root: string;
|
|
248
|
+
constructor(data?: PartialMessage<Mixin>);
|
|
249
|
+
static readonly runtime: typeof proto3;
|
|
250
|
+
static readonly typeName = "google.protobuf.Mixin";
|
|
251
|
+
static readonly fields: FieldList;
|
|
252
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Mixin;
|
|
253
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Mixin;
|
|
254
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Mixin;
|
|
255
|
+
static equals(a: Mixin | PlainMessage<Mixin> | undefined, b: Mixin | PlainMessage<Mixin> | undefined): boolean;
|
|
256
|
+
}
|