@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
|
@@ -0,0 +1,267 @@
|
|
|
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 { FieldList } from "../../field-list.js";
|
|
6
|
+
import type { BinaryReadOptions } from "../../binary-format.js";
|
|
7
|
+
/**
|
|
8
|
+
* Wrapper message for `double`.
|
|
9
|
+
*
|
|
10
|
+
* The JSON representation for `DoubleValue` is JSON number.
|
|
11
|
+
*
|
|
12
|
+
* @generated from message google.protobuf.DoubleValue
|
|
13
|
+
*/
|
|
14
|
+
export declare class DoubleValue extends Message<DoubleValue> {
|
|
15
|
+
/**
|
|
16
|
+
* The double value.
|
|
17
|
+
*
|
|
18
|
+
* @generated from field: double value = 1;
|
|
19
|
+
*/
|
|
20
|
+
value: number;
|
|
21
|
+
constructor(data?: PartialMessage<DoubleValue>);
|
|
22
|
+
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
|
|
23
|
+
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
|
|
24
|
+
static readonly runtime: typeof proto3;
|
|
25
|
+
static readonly typeName = "google.protobuf.DoubleValue";
|
|
26
|
+
static readonly fields: FieldList;
|
|
27
|
+
static readonly fieldWrapper: {
|
|
28
|
+
wrapField(value: number): DoubleValue;
|
|
29
|
+
unwrapField(value: DoubleValue): number;
|
|
30
|
+
};
|
|
31
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DoubleValue;
|
|
32
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DoubleValue;
|
|
33
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DoubleValue;
|
|
34
|
+
static equals(a: DoubleValue | PlainMessage<DoubleValue> | undefined, b: DoubleValue | PlainMessage<DoubleValue> | undefined): boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Wrapper message for `float`.
|
|
38
|
+
*
|
|
39
|
+
* The JSON representation for `FloatValue` is JSON number.
|
|
40
|
+
*
|
|
41
|
+
* @generated from message google.protobuf.FloatValue
|
|
42
|
+
*/
|
|
43
|
+
export declare class FloatValue extends Message<FloatValue> {
|
|
44
|
+
/**
|
|
45
|
+
* The float value.
|
|
46
|
+
*
|
|
47
|
+
* @generated from field: float value = 1;
|
|
48
|
+
*/
|
|
49
|
+
value: number;
|
|
50
|
+
constructor(data?: PartialMessage<FloatValue>);
|
|
51
|
+
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
|
|
52
|
+
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
|
|
53
|
+
static readonly runtime: typeof proto3;
|
|
54
|
+
static readonly typeName = "google.protobuf.FloatValue";
|
|
55
|
+
static readonly fields: FieldList;
|
|
56
|
+
static readonly fieldWrapper: {
|
|
57
|
+
wrapField(value: number): FloatValue;
|
|
58
|
+
unwrapField(value: FloatValue): number;
|
|
59
|
+
};
|
|
60
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FloatValue;
|
|
61
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): FloatValue;
|
|
62
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): FloatValue;
|
|
63
|
+
static equals(a: FloatValue | PlainMessage<FloatValue> | undefined, b: FloatValue | PlainMessage<FloatValue> | undefined): boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Wrapper message for `int64`.
|
|
67
|
+
*
|
|
68
|
+
* The JSON representation for `Int64Value` is JSON string.
|
|
69
|
+
*
|
|
70
|
+
* @generated from message google.protobuf.Int64Value
|
|
71
|
+
*/
|
|
72
|
+
export declare class Int64Value extends Message<Int64Value> {
|
|
73
|
+
/**
|
|
74
|
+
* The int64 value.
|
|
75
|
+
*
|
|
76
|
+
* @generated from field: int64 value = 1;
|
|
77
|
+
*/
|
|
78
|
+
value: bigint;
|
|
79
|
+
constructor(data?: PartialMessage<Int64Value>);
|
|
80
|
+
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
|
|
81
|
+
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
|
|
82
|
+
static readonly runtime: typeof proto3;
|
|
83
|
+
static readonly typeName = "google.protobuf.Int64Value";
|
|
84
|
+
static readonly fields: FieldList;
|
|
85
|
+
static readonly fieldWrapper: {
|
|
86
|
+
wrapField(value: bigint): Int64Value;
|
|
87
|
+
unwrapField(value: Int64Value): bigint;
|
|
88
|
+
};
|
|
89
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Int64Value;
|
|
90
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Int64Value;
|
|
91
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Int64Value;
|
|
92
|
+
static equals(a: Int64Value | PlainMessage<Int64Value> | undefined, b: Int64Value | PlainMessage<Int64Value> | undefined): boolean;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Wrapper message for `uint64`.
|
|
96
|
+
*
|
|
97
|
+
* The JSON representation for `UInt64Value` is JSON string.
|
|
98
|
+
*
|
|
99
|
+
* @generated from message google.protobuf.UInt64Value
|
|
100
|
+
*/
|
|
101
|
+
export declare class UInt64Value extends Message<UInt64Value> {
|
|
102
|
+
/**
|
|
103
|
+
* The uint64 value.
|
|
104
|
+
*
|
|
105
|
+
* @generated from field: uint64 value = 1;
|
|
106
|
+
*/
|
|
107
|
+
value: bigint;
|
|
108
|
+
constructor(data?: PartialMessage<UInt64Value>);
|
|
109
|
+
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
|
|
110
|
+
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
|
|
111
|
+
static readonly runtime: typeof proto3;
|
|
112
|
+
static readonly typeName = "google.protobuf.UInt64Value";
|
|
113
|
+
static readonly fields: FieldList;
|
|
114
|
+
static readonly fieldWrapper: {
|
|
115
|
+
wrapField(value: bigint): UInt64Value;
|
|
116
|
+
unwrapField(value: UInt64Value): bigint;
|
|
117
|
+
};
|
|
118
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UInt64Value;
|
|
119
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UInt64Value;
|
|
120
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UInt64Value;
|
|
121
|
+
static equals(a: UInt64Value | PlainMessage<UInt64Value> | undefined, b: UInt64Value | PlainMessage<UInt64Value> | undefined): boolean;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Wrapper message for `int32`.
|
|
125
|
+
*
|
|
126
|
+
* The JSON representation for `Int32Value` is JSON number.
|
|
127
|
+
*
|
|
128
|
+
* @generated from message google.protobuf.Int32Value
|
|
129
|
+
*/
|
|
130
|
+
export declare class Int32Value extends Message<Int32Value> {
|
|
131
|
+
/**
|
|
132
|
+
* The int32 value.
|
|
133
|
+
*
|
|
134
|
+
* @generated from field: int32 value = 1;
|
|
135
|
+
*/
|
|
136
|
+
value: number;
|
|
137
|
+
constructor(data?: PartialMessage<Int32Value>);
|
|
138
|
+
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
|
|
139
|
+
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
|
|
140
|
+
static readonly runtime: typeof proto3;
|
|
141
|
+
static readonly typeName = "google.protobuf.Int32Value";
|
|
142
|
+
static readonly fields: FieldList;
|
|
143
|
+
static readonly fieldWrapper: {
|
|
144
|
+
wrapField(value: number): Int32Value;
|
|
145
|
+
unwrapField(value: Int32Value): number;
|
|
146
|
+
};
|
|
147
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Int32Value;
|
|
148
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Int32Value;
|
|
149
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Int32Value;
|
|
150
|
+
static equals(a: Int32Value | PlainMessage<Int32Value> | undefined, b: Int32Value | PlainMessage<Int32Value> | undefined): boolean;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Wrapper message for `uint32`.
|
|
154
|
+
*
|
|
155
|
+
* The JSON representation for `UInt32Value` is JSON number.
|
|
156
|
+
*
|
|
157
|
+
* @generated from message google.protobuf.UInt32Value
|
|
158
|
+
*/
|
|
159
|
+
export declare class UInt32Value extends Message<UInt32Value> {
|
|
160
|
+
/**
|
|
161
|
+
* The uint32 value.
|
|
162
|
+
*
|
|
163
|
+
* @generated from field: uint32 value = 1;
|
|
164
|
+
*/
|
|
165
|
+
value: number;
|
|
166
|
+
constructor(data?: PartialMessage<UInt32Value>);
|
|
167
|
+
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
|
|
168
|
+
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
|
|
169
|
+
static readonly runtime: typeof proto3;
|
|
170
|
+
static readonly typeName = "google.protobuf.UInt32Value";
|
|
171
|
+
static readonly fields: FieldList;
|
|
172
|
+
static readonly fieldWrapper: {
|
|
173
|
+
wrapField(value: number): UInt32Value;
|
|
174
|
+
unwrapField(value: UInt32Value): number;
|
|
175
|
+
};
|
|
176
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UInt32Value;
|
|
177
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UInt32Value;
|
|
178
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UInt32Value;
|
|
179
|
+
static equals(a: UInt32Value | PlainMessage<UInt32Value> | undefined, b: UInt32Value | PlainMessage<UInt32Value> | undefined): boolean;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Wrapper message for `bool`.
|
|
183
|
+
*
|
|
184
|
+
* The JSON representation for `BoolValue` is JSON `true` and `false`.
|
|
185
|
+
*
|
|
186
|
+
* @generated from message google.protobuf.BoolValue
|
|
187
|
+
*/
|
|
188
|
+
export declare class BoolValue extends Message<BoolValue> {
|
|
189
|
+
/**
|
|
190
|
+
* The bool value.
|
|
191
|
+
*
|
|
192
|
+
* @generated from field: bool value = 1;
|
|
193
|
+
*/
|
|
194
|
+
value: boolean;
|
|
195
|
+
constructor(data?: PartialMessage<BoolValue>);
|
|
196
|
+
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
|
|
197
|
+
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
|
|
198
|
+
static readonly runtime: typeof proto3;
|
|
199
|
+
static readonly typeName = "google.protobuf.BoolValue";
|
|
200
|
+
static readonly fields: FieldList;
|
|
201
|
+
static readonly fieldWrapper: {
|
|
202
|
+
wrapField(value: boolean): BoolValue;
|
|
203
|
+
unwrapField(value: BoolValue): boolean;
|
|
204
|
+
};
|
|
205
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): BoolValue;
|
|
206
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): BoolValue;
|
|
207
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): BoolValue;
|
|
208
|
+
static equals(a: BoolValue | PlainMessage<BoolValue> | undefined, b: BoolValue | PlainMessage<BoolValue> | undefined): boolean;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Wrapper message for `string`.
|
|
212
|
+
*
|
|
213
|
+
* The JSON representation for `StringValue` is JSON string.
|
|
214
|
+
*
|
|
215
|
+
* @generated from message google.protobuf.StringValue
|
|
216
|
+
*/
|
|
217
|
+
export declare class StringValue extends Message<StringValue> {
|
|
218
|
+
/**
|
|
219
|
+
* The string value.
|
|
220
|
+
*
|
|
221
|
+
* @generated from field: string value = 1;
|
|
222
|
+
*/
|
|
223
|
+
value: string;
|
|
224
|
+
constructor(data?: PartialMessage<StringValue>);
|
|
225
|
+
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
|
|
226
|
+
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
|
|
227
|
+
static readonly runtime: typeof proto3;
|
|
228
|
+
static readonly typeName = "google.protobuf.StringValue";
|
|
229
|
+
static readonly fields: FieldList;
|
|
230
|
+
static readonly fieldWrapper: {
|
|
231
|
+
wrapField(value: string): StringValue;
|
|
232
|
+
unwrapField(value: StringValue): string;
|
|
233
|
+
};
|
|
234
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): StringValue;
|
|
235
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): StringValue;
|
|
236
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): StringValue;
|
|
237
|
+
static equals(a: StringValue | PlainMessage<StringValue> | undefined, b: StringValue | PlainMessage<StringValue> | undefined): boolean;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Wrapper message for `bytes`.
|
|
241
|
+
*
|
|
242
|
+
* The JSON representation for `BytesValue` is JSON string.
|
|
243
|
+
*
|
|
244
|
+
* @generated from message google.protobuf.BytesValue
|
|
245
|
+
*/
|
|
246
|
+
export declare class BytesValue extends Message<BytesValue> {
|
|
247
|
+
/**
|
|
248
|
+
* The bytes value.
|
|
249
|
+
*
|
|
250
|
+
* @generated from field: bytes value = 1;
|
|
251
|
+
*/
|
|
252
|
+
value: Uint8Array;
|
|
253
|
+
constructor(data?: PartialMessage<BytesValue>);
|
|
254
|
+
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
|
|
255
|
+
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
|
|
256
|
+
static readonly runtime: typeof proto3;
|
|
257
|
+
static readonly typeName = "google.protobuf.BytesValue";
|
|
258
|
+
static readonly fields: FieldList;
|
|
259
|
+
static readonly fieldWrapper: {
|
|
260
|
+
wrapField(value: Uint8Array): BytesValue;
|
|
261
|
+
unwrapField(value: BytesValue): Uint8Array;
|
|
262
|
+
};
|
|
263
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): BytesValue;
|
|
264
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): BytesValue;
|
|
265
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): BytesValue;
|
|
266
|
+
static equals(a: BytesValue | PlainMessage<BytesValue> | undefined, b: BytesValue | PlainMessage<BytesValue> | undefined): boolean;
|
|
267
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a 64 bit varint as two JS numbers.
|
|
3
|
+
*
|
|
4
|
+
* Returns tuple:
|
|
5
|
+
* [0]: low bits
|
|
6
|
+
* [1]: high bits
|
|
7
|
+
*
|
|
8
|
+
* Copyright 2008 Google Inc. All rights reserved.
|
|
9
|
+
*
|
|
10
|
+
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175
|
|
11
|
+
*/
|
|
12
|
+
export declare function varint64read(this: ReaderLike): [number, number];
|
|
13
|
+
/**
|
|
14
|
+
* Write a 64 bit varint, given as two JS numbers, to the given bytes array.
|
|
15
|
+
*
|
|
16
|
+
* Copyright 2008 Google Inc. All rights reserved.
|
|
17
|
+
*
|
|
18
|
+
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344
|
|
19
|
+
*/
|
|
20
|
+
export declare function varint64write(lo: number, hi: number, bytes: number[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* Parse decimal string of 64 bit integer value as two JS numbers.
|
|
23
|
+
*
|
|
24
|
+
* Copyright 2008 Google Inc. All rights reserved.
|
|
25
|
+
*
|
|
26
|
+
* See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
|
|
27
|
+
*/
|
|
28
|
+
export declare function int64FromString(dec: string): {
|
|
29
|
+
lo: number;
|
|
30
|
+
hi: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Losslessly converts a 64-bit signed integer in 32:32 split representation
|
|
34
|
+
* into a decimal string.
|
|
35
|
+
*
|
|
36
|
+
* Copyright 2008 Google Inc. All rights reserved.
|
|
37
|
+
*
|
|
38
|
+
* See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
|
|
39
|
+
*/
|
|
40
|
+
export declare function int64ToString(lo: number, hi: number): string;
|
|
41
|
+
/**
|
|
42
|
+
* Losslessly converts a 64-bit unsigned integer in 32:32 split representation
|
|
43
|
+
* into a decimal string.
|
|
44
|
+
*
|
|
45
|
+
* Copyright 2008 Google Inc. All rights reserved.
|
|
46
|
+
*
|
|
47
|
+
* See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
|
|
48
|
+
*/
|
|
49
|
+
export declare function uInt64ToString(lo: number, hi: number): string;
|
|
50
|
+
/**
|
|
51
|
+
* Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`
|
|
52
|
+
*
|
|
53
|
+
* Copyright 2008 Google Inc. All rights reserved.
|
|
54
|
+
*
|
|
55
|
+
* See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144
|
|
56
|
+
*/
|
|
57
|
+
export declare function varint32write(value: number, bytes: number[]): void;
|
|
58
|
+
/**
|
|
59
|
+
* Read an unsigned 32 bit varint.
|
|
60
|
+
*
|
|
61
|
+
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220
|
|
62
|
+
*/
|
|
63
|
+
export declare function varint32read(this: ReaderLike): number;
|
|
64
|
+
type ReaderLike = {
|
|
65
|
+
buf: Uint8Array;
|
|
66
|
+
pos: number;
|
|
67
|
+
len: number;
|
|
68
|
+
assertBounds(): void;
|
|
69
|
+
};
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export { proto3 } from "./proto3.js";
|
|
2
|
+
export { proto2 } from "./proto2.js";
|
|
3
|
+
export { protoDouble } from "./proto-double.js";
|
|
4
|
+
export { protoInt64 } from "./proto-int64.js";
|
|
5
|
+
export { protoBase64 } from "./proto-base64.js";
|
|
6
|
+
export { protoDelimited } from "./proto-delimited.js";
|
|
7
|
+
export { codegenInfo } from "./codegen-info.js";
|
|
8
|
+
export { Message } from "./message.js";
|
|
9
|
+
export type { AnyMessage, PartialMessage, PlainMessage } from "./message.js";
|
|
10
|
+
export type { FieldInfo } from "./field.js";
|
|
11
|
+
export type { FieldList } from "./field-list.js";
|
|
12
|
+
export { ScalarType } from "./field.js";
|
|
13
|
+
export type { MessageType } from "./message-type.js";
|
|
14
|
+
export type { EnumType, EnumValueInfo } from "./enum.js";
|
|
15
|
+
export type { ServiceType, MethodInfo, MethodInfoUnary, MethodInfoServerStreaming, MethodInfoClientStreaming, MethodInfoBiDiStreaming, } from "./service-type.js";
|
|
16
|
+
export { MethodKind, MethodIdempotency } from "./service-type.js";
|
|
17
|
+
export { WireType, BinaryWriter, BinaryReader } from "./binary-encoding.js";
|
|
18
|
+
export type { IBinaryReader, IBinaryWriter } from "./binary-encoding.js";
|
|
19
|
+
export type { BinaryFormat, BinaryWriteOptions, BinaryReadOptions, } from "./binary-format.js";
|
|
20
|
+
export type { JsonFormat, JsonObject, JsonValue, JsonReadOptions, JsonWriteOptions, JsonWriteStringOptions, } from "./json-format.js";
|
|
21
|
+
export type { DescriptorSet, AnyDesc, DescFile, DescEnum, DescEnumValue, DescMessage, DescOneof, DescField, DescService, DescMethod, DescExtension, DescComments, } from "./descriptor-set.js";
|
|
22
|
+
export { createDescriptorSet } from "./create-descriptor-set.js";
|
|
23
|
+
export type { IMessageTypeRegistry } from "./type-registry.js";
|
|
24
|
+
export { createRegistry } from "./create-registry.js";
|
|
25
|
+
export { createRegistryFromDescriptors } from "./create-registry-from-desc.js";
|
|
26
|
+
export { toPlainMessage } from "./to-plain-message.js";
|
|
27
|
+
export * from "./google/protobuf/compiler/plugin_pb.js";
|
|
28
|
+
export * from "./google/protobuf/api_pb.js";
|
|
29
|
+
export * from "./google/protobuf/any_pb.js";
|
|
30
|
+
export * from "./google/protobuf/descriptor_pb.js";
|
|
31
|
+
export * from "./google/protobuf/duration_pb.js";
|
|
32
|
+
export * from "./google/protobuf/empty_pb.js";
|
|
33
|
+
export * from "./google/protobuf/field_mask_pb.js";
|
|
34
|
+
export * from "./google/protobuf/source_context_pb.js";
|
|
35
|
+
export * from "./google/protobuf/struct_pb.js";
|
|
36
|
+
export * from "./google/protobuf/timestamp_pb.js";
|
|
37
|
+
export * from "./google/protobuf/type_pb.js";
|
|
38
|
+
export * from "./google/protobuf/wrappers_pb.js";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { Message } from "./message.js";
|
|
2
|
+
import type { MessageType } from "./message-type.js";
|
|
3
|
+
import type { ScalarType } from "./field.js";
|
|
4
|
+
import type { IMessageTypeRegistry } from "./type-registry.js";
|
|
5
|
+
/**
|
|
6
|
+
* JsonFormat is the contract for serializing messages to and from JSON.
|
|
7
|
+
* Implementations may be specific to a proto syntax, and can be reflection
|
|
8
|
+
* based, or delegate to speed optimized generated code.
|
|
9
|
+
*/
|
|
10
|
+
export interface JsonFormat {
|
|
11
|
+
/**
|
|
12
|
+
* Provide options for parsing JSON data.
|
|
13
|
+
*/
|
|
14
|
+
makeReadOptions(options?: Partial<JsonReadOptions>): Readonly<JsonReadOptions>;
|
|
15
|
+
/**
|
|
16
|
+
* Provide options for serializing to JSON.
|
|
17
|
+
*/
|
|
18
|
+
makeWriteOptions(options?: Partial<JsonWriteStringOptions>): Readonly<JsonWriteStringOptions>;
|
|
19
|
+
/**
|
|
20
|
+
* Parse a message from JSON.
|
|
21
|
+
*/
|
|
22
|
+
readMessage<T extends Message<T>>(type: MessageType<T>, jsonValue: JsonValue, options: JsonReadOptions, message?: T): T;
|
|
23
|
+
/**
|
|
24
|
+
* Serialize a message to JSON.
|
|
25
|
+
*/
|
|
26
|
+
writeMessage(message: Message, options: JsonWriteOptions): JsonValue;
|
|
27
|
+
/**
|
|
28
|
+
* Parse a single scalar value from JSON.
|
|
29
|
+
* This method may throw an error, but it may have a blank error message.
|
|
30
|
+
* Callers are expected to provide context.
|
|
31
|
+
*/
|
|
32
|
+
readScalar(type: ScalarType, json: JsonValue): any;
|
|
33
|
+
/**
|
|
34
|
+
* Serialize a single scalar value to JSON.
|
|
35
|
+
*/
|
|
36
|
+
writeScalar(type: ScalarType, value: any, emitDefaultValues: boolean): JsonValue | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Returns a short string representation of a JSON value, suitable for error messages.
|
|
39
|
+
*/
|
|
40
|
+
debug(json: JsonValue): string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Options for parsing JSON data.
|
|
44
|
+
*/
|
|
45
|
+
export interface JsonReadOptions {
|
|
46
|
+
/**
|
|
47
|
+
* Ignore unknown fields: Proto3 JSON parser should reject unknown fields
|
|
48
|
+
* by default. This option ignores unknown fields in parsing, as well as
|
|
49
|
+
* unrecognized enum string representations.
|
|
50
|
+
*/
|
|
51
|
+
ignoreUnknownFields: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* This option is required to read `google.protobuf.Any`
|
|
54
|
+
* from JSON format.
|
|
55
|
+
*/
|
|
56
|
+
typeRegistry?: IMessageTypeRegistry;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Options for serializing to JSON.
|
|
60
|
+
*/
|
|
61
|
+
export interface JsonWriteOptions {
|
|
62
|
+
/**
|
|
63
|
+
* Emit fields with default values: Fields with default values are omitted
|
|
64
|
+
* by default in proto3 JSON output. This option overrides this behavior
|
|
65
|
+
* and outputs fields with their default values.
|
|
66
|
+
*/
|
|
67
|
+
emitDefaultValues: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Emit enum values as integers instead of strings: The name of an enum
|
|
70
|
+
* value is used by default in JSON output. An option may be provided to
|
|
71
|
+
* use the numeric value of the enum value instead.
|
|
72
|
+
*/
|
|
73
|
+
enumAsInteger: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Use proto field name instead of lowerCamelCase name: By default proto3
|
|
76
|
+
* JSON printer should convert the field name to lowerCamelCase and use
|
|
77
|
+
* that as the JSON name. An implementation may provide an option to use
|
|
78
|
+
* proto field name as the JSON name instead. Proto3 JSON parsers are
|
|
79
|
+
* required to accept both the converted lowerCamelCase name and the proto
|
|
80
|
+
* field name.
|
|
81
|
+
*/
|
|
82
|
+
useProtoFieldName: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* This option is required to write `google.protobuf.Any`
|
|
85
|
+
* to JSON format.
|
|
86
|
+
*/
|
|
87
|
+
typeRegistry?: IMessageTypeRegistry;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Options for serializing to JSON.
|
|
91
|
+
*/
|
|
92
|
+
export interface JsonWriteStringOptions extends JsonWriteOptions {
|
|
93
|
+
prettySpaces: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Represents any possible JSON value:
|
|
97
|
+
* - number
|
|
98
|
+
* - string
|
|
99
|
+
* - boolean
|
|
100
|
+
* - null
|
|
101
|
+
* - object (with any JSON value as property)
|
|
102
|
+
* - array (with any JSON value as element)
|
|
103
|
+
*/
|
|
104
|
+
export type JsonValue = number | string | boolean | null | JsonObject | JsonValue[];
|
|
105
|
+
/**
|
|
106
|
+
* Represents a JSON object.
|
|
107
|
+
*/
|
|
108
|
+
export type JsonObject = {
|
|
109
|
+
[k: string]: JsonValue;
|
|
110
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { FieldList } from "./field-list.js";
|
|
2
|
+
import type { ProtoRuntime } from "./private/proto-runtime.js";
|
|
3
|
+
import type { JsonReadOptions, JsonValue } from "./json-format.js";
|
|
4
|
+
import type { BinaryReadOptions } from "./binary-format.js";
|
|
5
|
+
import type { AnyMessage, Message, PartialMessage, PlainMessage } from "./message.js";
|
|
6
|
+
import type { FieldWrapper } from "./private/field-wrapper.js";
|
|
7
|
+
/**
|
|
8
|
+
* MessageType represents a protobuf message. It provides:
|
|
9
|
+
* - a constructor that produces an instance of the message
|
|
10
|
+
* - metadata for reflection-based operations
|
|
11
|
+
* - common functionality like serialization
|
|
12
|
+
*/
|
|
13
|
+
export interface MessageType<T extends Message<T> = AnyMessage> {
|
|
14
|
+
/**
|
|
15
|
+
* Create a new instance of this type.
|
|
16
|
+
*/
|
|
17
|
+
new (data?: PartialMessage<T>): T;
|
|
18
|
+
/**
|
|
19
|
+
* The fully qualified name of the message.
|
|
20
|
+
*/
|
|
21
|
+
readonly typeName: string;
|
|
22
|
+
/**
|
|
23
|
+
* Field metadata.
|
|
24
|
+
*/
|
|
25
|
+
readonly fields: FieldList;
|
|
26
|
+
/**
|
|
27
|
+
* Provides serialization and other functionality.
|
|
28
|
+
*/
|
|
29
|
+
readonly runtime: ProtoRuntime;
|
|
30
|
+
/**
|
|
31
|
+
* When used as a field, unwrap this message to a simple value.
|
|
32
|
+
*/
|
|
33
|
+
readonly fieldWrapper?: FieldWrapper<T>;
|
|
34
|
+
/**
|
|
35
|
+
* Parse serialized binary data.
|
|
36
|
+
*/
|
|
37
|
+
fromBinary(data: Uint8Array, options?: Partial<BinaryReadOptions>): T;
|
|
38
|
+
/**
|
|
39
|
+
* Parse a JSON object.
|
|
40
|
+
*/
|
|
41
|
+
fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): T;
|
|
42
|
+
/**
|
|
43
|
+
* Parse a JSON string.
|
|
44
|
+
*/
|
|
45
|
+
fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): T;
|
|
46
|
+
/**
|
|
47
|
+
* Returns true if the given arguments have equal field values, recursively.
|
|
48
|
+
* Will also return true if both messages are `undefined` or `null`.
|
|
49
|
+
*/
|
|
50
|
+
equals(a: T | PlainMessage<T> | undefined | null, b: T | PlainMessage<T> | undefined | null): boolean;
|
|
51
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { BinaryReadOptions, BinaryWriteOptions } from "./binary-format.js";
|
|
2
|
+
import type { JsonReadOptions, JsonValue, JsonWriteOptions, JsonWriteStringOptions } from "./json-format.js";
|
|
3
|
+
import type { MessageType } from "./message-type.js";
|
|
4
|
+
/**
|
|
5
|
+
* AnyMessage is an interface implemented by all messages. If you need to
|
|
6
|
+
* handle messages of unknown type, this interface provides a convenient
|
|
7
|
+
* index signature to access fields with message["fieldname"].
|
|
8
|
+
*/
|
|
9
|
+
export interface AnyMessage extends Message<AnyMessage> {
|
|
10
|
+
[k: string]: any;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Message is the base class of every message, generated, or created at
|
|
14
|
+
* runtime.
|
|
15
|
+
*
|
|
16
|
+
* It is _not_ safe to extend this class. If you want to create a message at
|
|
17
|
+
* run time, use proto3.makeMessageType().
|
|
18
|
+
*/
|
|
19
|
+
export declare class Message<T extends Message<T> = AnyMessage> {
|
|
20
|
+
/**
|
|
21
|
+
* Compare with a message of the same type.
|
|
22
|
+
*/
|
|
23
|
+
equals(other: T | PlainMessage<T> | undefined | null): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Create a deep copy.
|
|
26
|
+
*/
|
|
27
|
+
clone(): T;
|
|
28
|
+
/**
|
|
29
|
+
* Parse from binary data, merging fields.
|
|
30
|
+
*
|
|
31
|
+
* Repeated fields are appended. Map entries are added, overwriting
|
|
32
|
+
* existing keys.
|
|
33
|
+
*
|
|
34
|
+
* If a message field is already present, it will be merged with the
|
|
35
|
+
* new data.
|
|
36
|
+
*/
|
|
37
|
+
fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): this;
|
|
38
|
+
/**
|
|
39
|
+
* Parse a message from a JSON value.
|
|
40
|
+
*/
|
|
41
|
+
fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): this;
|
|
42
|
+
/**
|
|
43
|
+
* Parse a message from a JSON string.
|
|
44
|
+
*/
|
|
45
|
+
fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): this;
|
|
46
|
+
/**
|
|
47
|
+
* Serialize the message to binary data.
|
|
48
|
+
*/
|
|
49
|
+
toBinary(options?: Partial<BinaryWriteOptions>): Uint8Array;
|
|
50
|
+
/**
|
|
51
|
+
* Serialize the message to a JSON value, a JavaScript value that can be
|
|
52
|
+
* passed to JSON.stringify().
|
|
53
|
+
*/
|
|
54
|
+
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
|
|
55
|
+
/**
|
|
56
|
+
* Serialize the message to a JSON string.
|
|
57
|
+
*/
|
|
58
|
+
toJsonString(options?: Partial<JsonWriteStringOptions>): string;
|
|
59
|
+
/**
|
|
60
|
+
* Override for serialization behavior. This will be invoked when calling
|
|
61
|
+
* JSON.stringify on this message (i.e. JSON.stringify(msg)).
|
|
62
|
+
*
|
|
63
|
+
* Note that this will not serialize google.protobuf.Any with a packed
|
|
64
|
+
* message because the protobuf JSON format specifies that it needs to be
|
|
65
|
+
* unpacked, and this is only possible with a type registry to look up the
|
|
66
|
+
* message type. As a result, attempting to serialize a message with this
|
|
67
|
+
* type will throw an Error.
|
|
68
|
+
*
|
|
69
|
+
* This method is protected because you should not need to invoke it
|
|
70
|
+
* directly -- instead use JSON.stringify or toJsonString for
|
|
71
|
+
* stringified JSON. Alternatively, if actual JSON is desired, you should
|
|
72
|
+
* use toJson.
|
|
73
|
+
*/
|
|
74
|
+
protected toJSON(): JsonValue;
|
|
75
|
+
/**
|
|
76
|
+
* Retrieve the MessageType of this message - a singleton that represents
|
|
77
|
+
* the protobuf message declaration and provides metadata for reflection-
|
|
78
|
+
* based operations.
|
|
79
|
+
*/
|
|
80
|
+
getType(): MessageType<T>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* PlainMessage<T> strips all methods from a message, leaving only fields
|
|
84
|
+
* and oneof groups. It is recursive, meaning it applies this same logic to all
|
|
85
|
+
* nested message fields as well.
|
|
86
|
+
*/
|
|
87
|
+
export type PlainMessage<T extends Message<T>> = {
|
|
88
|
+
[P in keyof T as T[P] extends Function ? never : P]: PlainField<T[P]>;
|
|
89
|
+
};
|
|
90
|
+
type PlainField<F> = F extends (Date | Uint8Array | bigint | boolean | string | number) ? F : F extends Array<infer U> ? Array<PlainField<U>> : F extends ReadonlyArray<infer U> ? ReadonlyArray<PlainField<U>> : F extends Message<infer U> ? PlainMessage<U> : F extends OneofSelectedMessage<infer C, infer V> ? {
|
|
91
|
+
case: C;
|
|
92
|
+
value: PlainField<V>;
|
|
93
|
+
} : F extends {
|
|
94
|
+
case: string | undefined;
|
|
95
|
+
value?: unknown;
|
|
96
|
+
} ? F : F extends {
|
|
97
|
+
[key: string | number]: Message<infer U>;
|
|
98
|
+
} ? {
|
|
99
|
+
[key: string | number]: PlainField<U>;
|
|
100
|
+
} : F;
|
|
101
|
+
/**
|
|
102
|
+
* PartialMessage<T> constructs a type from a message. The resulting type
|
|
103
|
+
* only contains the protobuf field members of the message, and all of them
|
|
104
|
+
* are optional.
|
|
105
|
+
*
|
|
106
|
+
* Note that the optionality of the fields is the only difference between
|
|
107
|
+
* PartialMessage and PlainMessage.
|
|
108
|
+
*
|
|
109
|
+
* PartialMessage is similar to the built-in type Partial<T>, but recursive,
|
|
110
|
+
* and respects `oneof` groups.
|
|
111
|
+
*/
|
|
112
|
+
export type PartialMessage<T extends Message<T>> = {
|
|
113
|
+
[P in keyof T as T[P] extends Function ? never : P]?: PartialField<T[P]>;
|
|
114
|
+
};
|
|
115
|
+
type PartialField<F> = F extends (Date | Uint8Array | bigint | boolean | string | number) ? F : F extends Array<infer U> ? Array<PartialField<U>> : F extends ReadonlyArray<infer U> ? ReadonlyArray<PartialField<U>> : F extends Message<infer U> ? PartialMessage<U> : F extends OneofSelectedMessage<infer C, infer V> ? {
|
|
116
|
+
case: C;
|
|
117
|
+
value: PartialMessage<V>;
|
|
118
|
+
} : F extends {
|
|
119
|
+
case: string | undefined;
|
|
120
|
+
value?: unknown;
|
|
121
|
+
} ? F : F extends {
|
|
122
|
+
[key: string | number]: Message<infer U>;
|
|
123
|
+
} ? {
|
|
124
|
+
[key: string | number]: PartialMessage<U>;
|
|
125
|
+
} : F;
|
|
126
|
+
type OneofSelectedMessage<K extends string, M extends Message<M>> = {
|
|
127
|
+
case: K;
|
|
128
|
+
value: M;
|
|
129
|
+
};
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assert that condition is truthy or throw error (with message)
|
|
3
|
+
*/
|
|
4
|
+
export declare function assert(condition: unknown, msg?: string): asserts condition;
|
|
5
|
+
/**
|
|
6
|
+
* Assert a valid signed protobuf 32-bit integer.
|
|
7
|
+
*/
|
|
8
|
+
export declare function assertInt32(arg: unknown): asserts arg is number;
|
|
9
|
+
/**
|
|
10
|
+
* Assert a valid unsigned protobuf 32-bit integer.
|
|
11
|
+
*/
|
|
12
|
+
export declare function assertUInt32(arg: unknown): asserts arg is number;
|
|
13
|
+
/**
|
|
14
|
+
* Assert a valid protobuf float value.
|
|
15
|
+
*/
|
|
16
|
+
export declare function assertFloat32(arg: unknown): asserts arg is number;
|