@bufbuild/protobuf 0.0.1-alpha.1

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.
Files changed (146) hide show
  1. package/README.md +6 -0
  2. package/dist/cjs/binary-encoding.js +434 -0
  3. package/dist/cjs/binary-format.js +2 -0
  4. package/dist/cjs/descriptor-registry.js +518 -0
  5. package/dist/cjs/descriptor-set.js +557 -0
  6. package/dist/cjs/enum.js +2 -0
  7. package/dist/cjs/field-list.js +2 -0
  8. package/dist/cjs/field.js +40 -0
  9. package/dist/cjs/google/protobuf/any_pb.js +280 -0
  10. package/dist/cjs/google/protobuf/api_pb.js +383 -0
  11. package/dist/cjs/google/protobuf/compiler/plugin_pb.js +334 -0
  12. package/dist/cjs/google/protobuf/descriptor_pb.js +2311 -0
  13. package/dist/cjs/google/protobuf/duration_pb.js +201 -0
  14. package/dist/cjs/google/protobuf/empty_pb.js +72 -0
  15. package/dist/cjs/google/protobuf/field_mask_pb.js +347 -0
  16. package/dist/cjs/google/protobuf/source_context_pb.js +74 -0
  17. package/dist/cjs/google/protobuf/struct_pb.js +288 -0
  18. package/dist/cjs/google/protobuf/timestamp_pb.js +271 -0
  19. package/dist/cjs/google/protobuf/type_pb.js +613 -0
  20. package/dist/cjs/google/protobuf/wrappers_pb.js +658 -0
  21. package/dist/cjs/google/varint.js +280 -0
  22. package/dist/cjs/index.js +148 -0
  23. package/dist/cjs/json-format.js +2 -0
  24. package/dist/cjs/message-type.js +2 -0
  25. package/dist/cjs/message.js +98 -0
  26. package/dist/cjs/private/assert.js +52 -0
  27. package/dist/cjs/private/base64.js +118 -0
  28. package/dist/cjs/private/binary-format-common.js +253 -0
  29. package/dist/cjs/private/binary-format-proto2.js +120 -0
  30. package/dist/cjs/private/binary-format-proto3.js +102 -0
  31. package/dist/cjs/private/enum.js +70 -0
  32. package/dist/cjs/private/field-list.js +62 -0
  33. package/dist/cjs/private/field-wrapper.js +25 -0
  34. package/dist/cjs/private/field.js +34 -0
  35. package/dist/cjs/private/json-format-common.js +482 -0
  36. package/dist/cjs/private/json-format-proto2.js +100 -0
  37. package/dist/cjs/private/json-format-proto3.js +103 -0
  38. package/dist/cjs/private/message-type.js +37 -0
  39. package/dist/cjs/private/names.js +101 -0
  40. package/dist/cjs/private/options-map.js +2 -0
  41. package/dist/cjs/private/proto-runtime.js +24 -0
  42. package/dist/cjs/private/scalars.js +138 -0
  43. package/dist/cjs/private/util-common.js +229 -0
  44. package/dist/cjs/private/util.js +2 -0
  45. package/dist/cjs/proto-int64.js +121 -0
  46. package/dist/cjs/proto2.js +86 -0
  47. package/dist/cjs/proto3.js +99 -0
  48. package/dist/cjs/service-type.js +43 -0
  49. package/dist/cjs/type-registry.js +42 -0
  50. package/dist/esm/binary-encoding.js +434 -0
  51. package/dist/esm/binary-format.js +1 -0
  52. package/dist/esm/descriptor-registry.js +521 -0
  53. package/dist/esm/descriptor-set.js +517 -0
  54. package/dist/esm/enum.js +1 -0
  55. package/dist/esm/field-list.js +1 -0
  56. package/dist/esm/field.js +37 -0
  57. package/dist/esm/google/protobuf/any_pb.js +276 -0
  58. package/dist/esm/google/protobuf/api_pb.js +350 -0
  59. package/dist/esm/google/protobuf/compiler/plugin_pb.js +318 -0
  60. package/dist/esm/google/protobuf/descriptor_pb.js +2213 -0
  61. package/dist/esm/google/protobuf/duration_pb.js +197 -0
  62. package/dist/esm/google/protobuf/empty_pb.js +68 -0
  63. package/dist/esm/google/protobuf/field_mask_pb.js +343 -0
  64. package/dist/esm/google/protobuf/source_context_pb.js +70 -0
  65. package/dist/esm/google/protobuf/struct_pb.js +282 -0
  66. package/dist/esm/google/protobuf/timestamp_pb.js +267 -0
  67. package/dist/esm/google/protobuf/type_pb.js +569 -0
  68. package/dist/esm/google/protobuf/wrappers_pb.js +574 -0
  69. package/dist/esm/google/varint.js +265 -0
  70. package/dist/esm/index.js +24 -0
  71. package/dist/esm/json-format.js +1 -0
  72. package/dist/esm/message-type.js +1 -0
  73. package/dist/esm/message.js +94 -0
  74. package/dist/esm/private/assert.js +41 -0
  75. package/dist/esm/private/base64.js +113 -0
  76. package/dist/esm/private/binary-format-common.js +243 -0
  77. package/dist/esm/private/binary-format-proto2.js +87 -0
  78. package/dist/esm/private/binary-format-proto3.js +74 -0
  79. package/dist/esm/private/enum.js +64 -0
  80. package/dist/esm/private/field-list.js +58 -0
  81. package/dist/esm/private/field-wrapper.js +20 -0
  82. package/dist/esm/private/field.js +27 -0
  83. package/dist/esm/private/json-format-common.js +473 -0
  84. package/dist/esm/private/json-format-proto2.js +90 -0
  85. package/dist/esm/private/json-format-proto3.js +89 -0
  86. package/dist/esm/private/message-type.js +33 -0
  87. package/dist/esm/private/names.js +90 -0
  88. package/dist/esm/private/options-map.js +1 -0
  89. package/dist/esm/private/proto-runtime.js +15 -0
  90. package/dist/esm/private/scalars.js +129 -0
  91. package/dist/esm/private/util-common.js +207 -0
  92. package/dist/esm/private/util.js +1 -0
  93. package/dist/esm/proto-int64.js +118 -0
  94. package/dist/esm/proto2.js +77 -0
  95. package/dist/esm/proto3.js +90 -0
  96. package/dist/esm/service-type.js +37 -0
  97. package/dist/esm/type-registry.js +38 -0
  98. package/dist/types/binary-encoding.d.ts +421 -0
  99. package/dist/types/binary-format.d.ts +109 -0
  100. package/dist/types/descriptor-registry.d.ts +42 -0
  101. package/dist/types/descriptor-set.d.ts +171 -0
  102. package/dist/types/enum.d.ts +31 -0
  103. package/dist/types/field-list.d.ts +27 -0
  104. package/dist/types/field.d.ts +295 -0
  105. package/dist/types/google/protobuf/any_pb.d.ts +167 -0
  106. package/dist/types/google/protobuf/api_pb.d.ts +296 -0
  107. package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +294 -0
  108. package/dist/types/google/protobuf/descriptor_pb.d.ts +1959 -0
  109. package/dist/types/google/protobuf/duration_pb.d.ts +117 -0
  110. package/dist/types/google/protobuf/empty_pb.d.ts +44 -0
  111. package/dist/types/google/protobuf/field_mask_pb.d.ts +243 -0
  112. package/dist/types/google/protobuf/source_context_pb.d.ts +44 -0
  113. package/dist/types/google/protobuf/struct_pb.d.ts +205 -0
  114. package/dist/types/google/protobuf/timestamp_pb.d.ts +151 -0
  115. package/dist/types/google/protobuf/type_pb.d.ts +482 -0
  116. package/dist/types/google/protobuf/wrappers_pb.d.ts +379 -0
  117. package/dist/types/google/varint.d.ts +65 -0
  118. package/dist/types/index.d.ts +53 -0
  119. package/dist/types/json-format.d.ts +129 -0
  120. package/dist/types/message-type.d.ts +58 -0
  121. package/dist/types/message.d.ts +124 -0
  122. package/dist/types/private/assert.d.ts +19 -0
  123. package/dist/types/private/base64.d.ts +18 -0
  124. package/dist/types/private/binary-format-common.d.ts +38 -0
  125. package/dist/types/private/binary-format-proto2.d.ts +2 -0
  126. package/dist/types/private/binary-format-proto3.d.ts +2 -0
  127. package/dist/types/private/enum.d.ts +29 -0
  128. package/dist/types/private/field-list.d.ts +25 -0
  129. package/dist/types/private/field-wrapper.d.ts +27 -0
  130. package/dist/types/private/field.d.ts +15 -0
  131. package/dist/types/private/json-format-common.d.ts +30 -0
  132. package/dist/types/private/json-format-proto2.d.ts +2 -0
  133. package/dist/types/private/json-format-proto3.d.ts +2 -0
  134. package/dist/types/private/message-type.d.ts +15 -0
  135. package/dist/types/private/names.d.ts +19 -0
  136. package/dist/types/private/options-map.d.ts +7 -0
  137. package/dist/types/private/proto-runtime.d.ts +55 -0
  138. package/dist/types/private/scalars.d.ts +33 -0
  139. package/dist/types/private/util-common.d.ts +5 -0
  140. package/dist/types/private/util.d.ts +55 -0
  141. package/dist/types/proto-int64.d.ts +94 -0
  142. package/dist/types/proto2.d.ts +4 -0
  143. package/dist/types/proto3.d.ts +4 -0
  144. package/dist/types/service-type.d.ts +118 -0
  145. package/dist/types/type-registry.d.ts +37 -0
  146. package/package.json +31 -0
@@ -0,0 +1,379 @@
1
+ import type {
2
+ BinaryReadOptions,
3
+ FieldList,
4
+ JsonReadOptions,
5
+ JsonValue,
6
+ JsonWriteOptions,
7
+ PartialMessage,
8
+ PlainMessage,
9
+ } from "../../index.js";
10
+ import { Message } from "../../index.js";
11
+ /**
12
+ * Wrapper message for `double`.
13
+ *
14
+ * The JSON representation for `DoubleValue` is JSON number.
15
+ *
16
+ * @generated from message google.protobuf.DoubleValue
17
+ */
18
+ export declare class DoubleValue extends Message<DoubleValue> {
19
+ /**
20
+ * The double value.
21
+ *
22
+ * @generated from field: double value = 1;
23
+ */
24
+ value: number;
25
+ constructor(data?: PartialMessage<DoubleValue>);
26
+ toJson(options?: Partial<JsonWriteOptions>): JsonValue;
27
+ fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
28
+ static readonly runtime: import("../../private/proto-runtime.js").ProtoRuntime;
29
+ static readonly typeName = "google.protobuf.DoubleValue";
30
+ static readonly fields: FieldList;
31
+ static readonly fieldWrapper: {
32
+ wrapField(value: number | DoubleValue): DoubleValue;
33
+ unwrapField(value: DoubleValue): number;
34
+ };
35
+ static fromBinary(
36
+ bytes: Uint8Array,
37
+ options?: Partial<BinaryReadOptions>
38
+ ): DoubleValue;
39
+ static fromJson(
40
+ jsonValue: JsonValue,
41
+ options?: Partial<JsonReadOptions>
42
+ ): DoubleValue;
43
+ static fromJsonString(
44
+ jsonString: string,
45
+ options?: Partial<JsonReadOptions>
46
+ ): DoubleValue;
47
+ static equals(
48
+ a: DoubleValue | PlainMessage<DoubleValue> | undefined,
49
+ b: DoubleValue | PlainMessage<DoubleValue> | undefined
50
+ ): boolean;
51
+ }
52
+ /**
53
+ * Wrapper message for `float`.
54
+ *
55
+ * The JSON representation for `FloatValue` is JSON number.
56
+ *
57
+ * @generated from message google.protobuf.FloatValue
58
+ */
59
+ export declare class FloatValue extends Message<FloatValue> {
60
+ /**
61
+ * The float value.
62
+ *
63
+ * @generated from field: float value = 1;
64
+ */
65
+ value: number;
66
+ constructor(data?: PartialMessage<FloatValue>);
67
+ toJson(options?: Partial<JsonWriteOptions>): JsonValue;
68
+ fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
69
+ static readonly runtime: import("../../private/proto-runtime.js").ProtoRuntime;
70
+ static readonly typeName = "google.protobuf.FloatValue";
71
+ static readonly fields: FieldList;
72
+ static readonly fieldWrapper: {
73
+ wrapField(value: number | FloatValue): FloatValue;
74
+ unwrapField(value: FloatValue): number;
75
+ };
76
+ static fromBinary(
77
+ bytes: Uint8Array,
78
+ options?: Partial<BinaryReadOptions>
79
+ ): FloatValue;
80
+ static fromJson(
81
+ jsonValue: JsonValue,
82
+ options?: Partial<JsonReadOptions>
83
+ ): FloatValue;
84
+ static fromJsonString(
85
+ jsonString: string,
86
+ options?: Partial<JsonReadOptions>
87
+ ): FloatValue;
88
+ static equals(
89
+ a: FloatValue | PlainMessage<FloatValue> | undefined,
90
+ b: FloatValue | PlainMessage<FloatValue> | undefined
91
+ ): boolean;
92
+ }
93
+ /**
94
+ * Wrapper message for `int64`.
95
+ *
96
+ * The JSON representation for `Int64Value` is JSON string.
97
+ *
98
+ * @generated from message google.protobuf.Int64Value
99
+ */
100
+ export declare class Int64Value extends Message<Int64Value> {
101
+ /**
102
+ * The int64 value.
103
+ *
104
+ * @generated from field: int64 value = 1;
105
+ */
106
+ value: bigint;
107
+ constructor(data?: PartialMessage<Int64Value>);
108
+ toJson(options?: Partial<JsonWriteOptions>): JsonValue;
109
+ fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
110
+ static readonly runtime: import("../../private/proto-runtime.js").ProtoRuntime;
111
+ static readonly typeName = "google.protobuf.Int64Value";
112
+ static readonly fields: FieldList;
113
+ static readonly fieldWrapper: {
114
+ wrapField(value: bigint | Int64Value): Int64Value;
115
+ unwrapField(value: Int64Value): bigint;
116
+ };
117
+ static fromBinary(
118
+ bytes: Uint8Array,
119
+ options?: Partial<BinaryReadOptions>
120
+ ): Int64Value;
121
+ static fromJson(
122
+ jsonValue: JsonValue,
123
+ options?: Partial<JsonReadOptions>
124
+ ): Int64Value;
125
+ static fromJsonString(
126
+ jsonString: string,
127
+ options?: Partial<JsonReadOptions>
128
+ ): Int64Value;
129
+ static equals(
130
+ a: Int64Value | PlainMessage<Int64Value> | undefined,
131
+ b: Int64Value | PlainMessage<Int64Value> | undefined
132
+ ): boolean;
133
+ }
134
+ /**
135
+ * Wrapper message for `uint64`.
136
+ *
137
+ * The JSON representation for `UInt64Value` is JSON string.
138
+ *
139
+ * @generated from message google.protobuf.UInt64Value
140
+ */
141
+ export declare class UInt64Value extends Message<UInt64Value> {
142
+ /**
143
+ * The uint64 value.
144
+ *
145
+ * @generated from field: uint64 value = 1;
146
+ */
147
+ value: bigint;
148
+ constructor(data?: PartialMessage<UInt64Value>);
149
+ toJson(options?: Partial<JsonWriteOptions>): JsonValue;
150
+ fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
151
+ static readonly runtime: import("../../private/proto-runtime.js").ProtoRuntime;
152
+ static readonly typeName = "google.protobuf.UInt64Value";
153
+ static readonly fields: FieldList;
154
+ static readonly fieldWrapper: {
155
+ wrapField(value: bigint | UInt64Value): UInt64Value;
156
+ unwrapField(value: UInt64Value): bigint;
157
+ };
158
+ static fromBinary(
159
+ bytes: Uint8Array,
160
+ options?: Partial<BinaryReadOptions>
161
+ ): UInt64Value;
162
+ static fromJson(
163
+ jsonValue: JsonValue,
164
+ options?: Partial<JsonReadOptions>
165
+ ): UInt64Value;
166
+ static fromJsonString(
167
+ jsonString: string,
168
+ options?: Partial<JsonReadOptions>
169
+ ): UInt64Value;
170
+ static equals(
171
+ a: UInt64Value | PlainMessage<UInt64Value> | undefined,
172
+ b: UInt64Value | PlainMessage<UInt64Value> | undefined
173
+ ): boolean;
174
+ }
175
+ /**
176
+ * Wrapper message for `int32`.
177
+ *
178
+ * The JSON representation for `Int32Value` is JSON number.
179
+ *
180
+ * @generated from message google.protobuf.Int32Value
181
+ */
182
+ export declare class Int32Value extends Message<Int32Value> {
183
+ /**
184
+ * The int32 value.
185
+ *
186
+ * @generated from field: int32 value = 1;
187
+ */
188
+ value: number;
189
+ constructor(data?: PartialMessage<Int32Value>);
190
+ toJson(options?: Partial<JsonWriteOptions>): JsonValue;
191
+ fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
192
+ static readonly runtime: import("../../private/proto-runtime.js").ProtoRuntime;
193
+ static readonly typeName = "google.protobuf.Int32Value";
194
+ static readonly fields: FieldList;
195
+ static readonly fieldWrapper: {
196
+ wrapField(value: number | Int32Value): Int32Value;
197
+ unwrapField(value: Int32Value): number;
198
+ };
199
+ static fromBinary(
200
+ bytes: Uint8Array,
201
+ options?: Partial<BinaryReadOptions>
202
+ ): Int32Value;
203
+ static fromJson(
204
+ jsonValue: JsonValue,
205
+ options?: Partial<JsonReadOptions>
206
+ ): Int32Value;
207
+ static fromJsonString(
208
+ jsonString: string,
209
+ options?: Partial<JsonReadOptions>
210
+ ): Int32Value;
211
+ static equals(
212
+ a: Int32Value | PlainMessage<Int32Value> | undefined,
213
+ b: Int32Value | PlainMessage<Int32Value> | undefined
214
+ ): boolean;
215
+ }
216
+ /**
217
+ * Wrapper message for `uint32`.
218
+ *
219
+ * The JSON representation for `UInt32Value` is JSON number.
220
+ *
221
+ * @generated from message google.protobuf.UInt32Value
222
+ */
223
+ export declare class UInt32Value extends Message<UInt32Value> {
224
+ /**
225
+ * The uint32 value.
226
+ *
227
+ * @generated from field: uint32 value = 1;
228
+ */
229
+ value: number;
230
+ constructor(data?: PartialMessage<UInt32Value>);
231
+ toJson(options?: Partial<JsonWriteOptions>): JsonValue;
232
+ fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
233
+ static readonly runtime: import("../../private/proto-runtime.js").ProtoRuntime;
234
+ static readonly typeName = "google.protobuf.UInt32Value";
235
+ static readonly fields: FieldList;
236
+ static readonly fieldWrapper: {
237
+ wrapField(value: number | UInt32Value): UInt32Value;
238
+ unwrapField(value: UInt32Value): number;
239
+ };
240
+ static fromBinary(
241
+ bytes: Uint8Array,
242
+ options?: Partial<BinaryReadOptions>
243
+ ): UInt32Value;
244
+ static fromJson(
245
+ jsonValue: JsonValue,
246
+ options?: Partial<JsonReadOptions>
247
+ ): UInt32Value;
248
+ static fromJsonString(
249
+ jsonString: string,
250
+ options?: Partial<JsonReadOptions>
251
+ ): UInt32Value;
252
+ static equals(
253
+ a: UInt32Value | PlainMessage<UInt32Value> | undefined,
254
+ b: UInt32Value | PlainMessage<UInt32Value> | undefined
255
+ ): boolean;
256
+ }
257
+ /**
258
+ * Wrapper message for `bool`.
259
+ *
260
+ * The JSON representation for `BoolValue` is JSON `true` and `false`.
261
+ *
262
+ * @generated from message google.protobuf.BoolValue
263
+ */
264
+ export declare class BoolValue extends Message<BoolValue> {
265
+ /**
266
+ * The bool value.
267
+ *
268
+ * @generated from field: bool value = 1;
269
+ */
270
+ value: boolean;
271
+ constructor(data?: PartialMessage<BoolValue>);
272
+ toJson(options?: Partial<JsonWriteOptions>): JsonValue;
273
+ fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
274
+ static readonly runtime: import("../../private/proto-runtime.js").ProtoRuntime;
275
+ static readonly typeName = "google.protobuf.BoolValue";
276
+ static readonly fields: FieldList;
277
+ static readonly fieldWrapper: {
278
+ wrapField(value: boolean | BoolValue): BoolValue;
279
+ unwrapField(value: BoolValue): boolean;
280
+ };
281
+ static fromBinary(
282
+ bytes: Uint8Array,
283
+ options?: Partial<BinaryReadOptions>
284
+ ): BoolValue;
285
+ static fromJson(
286
+ jsonValue: JsonValue,
287
+ options?: Partial<JsonReadOptions>
288
+ ): BoolValue;
289
+ static fromJsonString(
290
+ jsonString: string,
291
+ options?: Partial<JsonReadOptions>
292
+ ): BoolValue;
293
+ static equals(
294
+ a: BoolValue | PlainMessage<BoolValue> | undefined,
295
+ b: BoolValue | PlainMessage<BoolValue> | undefined
296
+ ): boolean;
297
+ }
298
+ /**
299
+ * Wrapper message for `string`.
300
+ *
301
+ * The JSON representation for `StringValue` is JSON string.
302
+ *
303
+ * @generated from message google.protobuf.StringValue
304
+ */
305
+ export declare class StringValue extends Message<StringValue> {
306
+ /**
307
+ * The string value.
308
+ *
309
+ * @generated from field: string value = 1;
310
+ */
311
+ value: string;
312
+ constructor(data?: PartialMessage<StringValue>);
313
+ toJson(options?: Partial<JsonWriteOptions>): JsonValue;
314
+ fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
315
+ static readonly runtime: import("../../private/proto-runtime.js").ProtoRuntime;
316
+ static readonly typeName = "google.protobuf.StringValue";
317
+ static readonly fields: FieldList;
318
+ static readonly fieldWrapper: {
319
+ wrapField(value: string | StringValue): StringValue;
320
+ unwrapField(value: StringValue): string;
321
+ };
322
+ static fromBinary(
323
+ bytes: Uint8Array,
324
+ options?: Partial<BinaryReadOptions>
325
+ ): StringValue;
326
+ static fromJson(
327
+ jsonValue: JsonValue,
328
+ options?: Partial<JsonReadOptions>
329
+ ): StringValue;
330
+ static fromJsonString(
331
+ jsonString: string,
332
+ options?: Partial<JsonReadOptions>
333
+ ): StringValue;
334
+ static equals(
335
+ a: StringValue | PlainMessage<StringValue> | undefined,
336
+ b: StringValue | PlainMessage<StringValue> | undefined
337
+ ): boolean;
338
+ }
339
+ /**
340
+ * Wrapper message for `bytes`.
341
+ *
342
+ * The JSON representation for `BytesValue` is JSON string.
343
+ *
344
+ * @generated from message google.protobuf.BytesValue
345
+ */
346
+ export declare class BytesValue extends Message<BytesValue> {
347
+ /**
348
+ * The bytes value.
349
+ *
350
+ * @generated from field: bytes value = 1;
351
+ */
352
+ value: Uint8Array;
353
+ constructor(data?: PartialMessage<BytesValue>);
354
+ toJson(options?: Partial<JsonWriteOptions>): JsonValue;
355
+ fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
356
+ static readonly runtime: import("../../private/proto-runtime.js").ProtoRuntime;
357
+ static readonly typeName = "google.protobuf.BytesValue";
358
+ static readonly fields: FieldList;
359
+ static readonly fieldWrapper: {
360
+ wrapField(value: Uint8Array | BytesValue): BytesValue;
361
+ unwrapField(value: BytesValue): Uint8Array;
362
+ };
363
+ static fromBinary(
364
+ bytes: Uint8Array,
365
+ options?: Partial<BinaryReadOptions>
366
+ ): BytesValue;
367
+ static fromJson(
368
+ jsonValue: JsonValue,
369
+ options?: Partial<JsonReadOptions>
370
+ ): BytesValue;
371
+ static fromJsonString(
372
+ jsonString: string,
373
+ options?: Partial<JsonReadOptions>
374
+ ): BytesValue;
375
+ static equals(
376
+ a: BytesValue | PlainMessage<BytesValue> | undefined,
377
+ b: BytesValue | PlainMessage<BytesValue> | undefined
378
+ ): boolean;
379
+ }
@@ -0,0 +1,65 @@
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(
21
+ lo: number,
22
+ hi: number,
23
+ bytes: number[]
24
+ ): void;
25
+ /**
26
+ * Parse decimal string of 64 bit integer value as two JS numbers.
27
+ *
28
+ * Returns tuple:
29
+ * [0]: minus sign?
30
+ * [1]: low bits
31
+ * [2]: high bits
32
+ *
33
+ * Copyright 2008 Google Inc.
34
+ */
35
+ export declare function int64fromString(dec: string): [boolean, number, number];
36
+ /**
37
+ * Format 64 bit integer value (as two JS numbers) to decimal string.
38
+ *
39
+ * Copyright 2008 Google Inc.
40
+ */
41
+ export declare function int64toString(
42
+ bitsLow: number,
43
+ bitsHigh: number
44
+ ): string;
45
+ /**
46
+ * Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`
47
+ *
48
+ * Copyright 2008 Google Inc. All rights reserved.
49
+ *
50
+ * See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144
51
+ */
52
+ export declare function varint32write(value: number, bytes: number[]): void;
53
+ /**
54
+ * Read an unsigned 32 bit varint.
55
+ *
56
+ * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220
57
+ */
58
+ export declare function varint32read(this: ReaderLike): number;
59
+ declare type ReaderLike = {
60
+ buf: Uint8Array;
61
+ pos: number;
62
+ len: number;
63
+ assertBounds(): void;
64
+ };
65
+ export {};
@@ -0,0 +1,53 @@
1
+ export { proto3 } from "./proto3.js";
2
+ export { proto2 } from "./proto2.js";
3
+ export { protoInt64 } from "./proto-int64.js";
4
+ export {
5
+ Message,
6
+ AnyMessage,
7
+ PartialMessage,
8
+ PlainMessage,
9
+ } 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 {
16
+ ServiceType,
17
+ MethodInfo,
18
+ MethodInfoUnary,
19
+ MethodInfoServerStreaming,
20
+ MethodInfoClientStreaming,
21
+ MethodInfoBiDiStreaming,
22
+ } from "./service-type.js";
23
+ export { MethodKind, MethodIdempotency } from "./service-type.js";
24
+ export { TypeRegistry, IMessageTypeRegistry } from "./type-registry.js";
25
+ export { DescriptorRegistry } from "./descriptor-registry.js";
26
+ export { DescriptorSet } from "./descriptor-set.js";
27
+ export { WireType, BinaryWriter, BinaryReader } from "./binary-encoding.js";
28
+ export type { IBinaryReader, IBinaryWriter } from "./binary-encoding.js";
29
+ export type {
30
+ BinaryFormat,
31
+ BinaryWriteOptions,
32
+ BinaryReadOptions,
33
+ } from "./binary-format.js";
34
+ export {
35
+ JsonFormat,
36
+ JsonObject,
37
+ JsonValue,
38
+ JsonReadOptions,
39
+ JsonWriteOptions,
40
+ JsonWriteStringOptions,
41
+ } from "./json-format.js";
42
+ export * from "./google/protobuf/compiler/plugin_pb.js";
43
+ export * from "./google/protobuf/api_pb.js";
44
+ export * from "./google/protobuf/any_pb.js";
45
+ export * from "./google/protobuf/descriptor_pb.js";
46
+ export * from "./google/protobuf/duration_pb.js";
47
+ export * from "./google/protobuf/empty_pb.js";
48
+ export * from "./google/protobuf/field_mask_pb.js";
49
+ export * from "./google/protobuf/source_context_pb.js";
50
+ export * from "./google/protobuf/struct_pb.js";
51
+ export * from "./google/protobuf/timestamp_pb.js";
52
+ export * from "./google/protobuf/type_pb.js";
53
+ export * from "./google/protobuf/wrappers_pb.js";
@@ -0,0 +1,129 @@
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";
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(
15
+ options?: Partial<JsonReadOptions>
16
+ ): Readonly<JsonReadOptions>;
17
+ /**
18
+ * Provide options for serializing to JSON.
19
+ */
20
+ makeWriteOptions(
21
+ options?: Partial<JsonWriteStringOptions>
22
+ ): Readonly<JsonWriteStringOptions>;
23
+ /**
24
+ * Parse a message from JSON.
25
+ */
26
+ readMessage<T extends Message<T>>(
27
+ type: MessageType<T>,
28
+ jsonValue: JsonValue,
29
+ options: JsonReadOptions,
30
+ message?: T
31
+ ): T;
32
+ /**
33
+ * Serialize a message to JSON.
34
+ */
35
+ writeMessage(message: Message, options: JsonWriteOptions): JsonValue;
36
+ /**
37
+ * Parse a single scalar value from JSON.
38
+ * This method may throw an error, but it may have a blank error message.
39
+ * Callers are expected to provide context.
40
+ */
41
+ readScalar(type: ScalarType, json: JsonValue): any;
42
+ /**
43
+ * Serialize a single scalar value to JSON.
44
+ */
45
+ writeScalar(
46
+ type: ScalarType,
47
+ value: any,
48
+ emitDefaultValues: boolean
49
+ ): JsonValue | undefined;
50
+ /**
51
+ * Returns a short string representation of a JSON value, suitable for error messages.
52
+ */
53
+ debug(json: JsonValue): string;
54
+ }
55
+ /**
56
+ * Options for parsing JSON data.
57
+ */
58
+ export interface JsonReadOptions {
59
+ /**
60
+ * Ignore unknown fields: Proto3 JSON parser should reject unknown fields
61
+ * by default. This option ignores unknown fields in parsing, as well as
62
+ * unrecognized enum string representations.
63
+ */
64
+ ignoreUnknownFields: boolean;
65
+ /**
66
+ * This option is required to read `google.protobuf.Any`
67
+ * from JSON format.
68
+ */
69
+ typeRegistry?: IMessageTypeRegistry;
70
+ }
71
+ /**
72
+ * Options for serializing to JSON.
73
+ */
74
+ export interface JsonWriteOptions {
75
+ /**
76
+ * Emit fields with default values: Fields with default values are omitted
77
+ * by default in proto3 JSON output. This option overrides this behavior
78
+ * and outputs fields with their default values.
79
+ */
80
+ emitDefaultValues: boolean;
81
+ /**
82
+ * Emit enum values as integers instead of strings: The name of an enum
83
+ * value is used by default in JSON output. An option may be provided to
84
+ * use the numeric value of the enum value instead.
85
+ */
86
+ enumAsInteger: boolean;
87
+ /**
88
+ * Use proto field name instead of lowerCamelCase name: By default proto3
89
+ * JSON printer should convert the field name to lowerCamelCase and use
90
+ * that as the JSON name. An implementation may provide an option to use
91
+ * proto field name as the JSON name instead. Proto3 JSON parsers are
92
+ * required to accept both the converted lowerCamelCase name and the proto
93
+ * field name.
94
+ */
95
+ useProtoFieldName: boolean;
96
+ /**
97
+ * This option is required to write `google.protobuf.Any`
98
+ * to JSON format.
99
+ */
100
+ typeRegistry?: IMessageTypeRegistry;
101
+ }
102
+ /**
103
+ * Options for serializing to JSON.
104
+ */
105
+ export interface JsonWriteStringOptions extends JsonWriteOptions {
106
+ prettySpaces: number;
107
+ }
108
+ /**
109
+ * Represents any possible JSON value:
110
+ * - number
111
+ * - string
112
+ * - boolean
113
+ * - null
114
+ * - object (with any JSON value as property)
115
+ * - array (with any JSON value as element)
116
+ */
117
+ export declare type JsonValue =
118
+ | number
119
+ | string
120
+ | boolean
121
+ | null
122
+ | JsonObject
123
+ | JsonValue[];
124
+ /**
125
+ * Represents a JSON object.
126
+ */
127
+ export declare type JsonObject = {
128
+ [k: string]: JsonValue;
129
+ };
@@ -0,0 +1,58 @@
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 {
6
+ AnyMessage,
7
+ Message,
8
+ PartialMessage,
9
+ PlainMessage,
10
+ } from "./message.js";
11
+ import type { FieldWrapper } from "./private/field-wrapper.js";
12
+ /**
13
+ * MessageType represents a protobuf message. It provides:
14
+ * - a constructor that produces an instance of the message
15
+ * - metadata for reflection-based operations
16
+ * - common functionality like serialization
17
+ */
18
+ export interface MessageType<T extends Message<T> = AnyMessage> {
19
+ /**
20
+ * Create a new instance of this type.
21
+ */
22
+ new (data?: PartialMessage<T>): T;
23
+ /**
24
+ * The fully qualified name of the message.
25
+ */
26
+ readonly typeName: string;
27
+ /**
28
+ * Field metadata.
29
+ */
30
+ readonly fields: FieldList;
31
+ /**
32
+ * Provides serialization and other functionality.
33
+ */
34
+ readonly runtime: ProtoRuntime;
35
+ /**
36
+ * When used as a field, unwrap this message to a simple value.
37
+ */
38
+ readonly fieldWrapper?: FieldWrapper<T>;
39
+ /**
40
+ * Parse serialized binary data.
41
+ */
42
+ fromBinary(data: Uint8Array, options?: Partial<BinaryReadOptions>): T;
43
+ /**
44
+ * Parse a JSON object.
45
+ */
46
+ fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): T;
47
+ /**
48
+ * Parse a JSON string.
49
+ */
50
+ fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): T;
51
+ /**
52
+ * Returns true if the given arguments have equal field values, recursively.
53
+ */
54
+ equals(
55
+ a: T | PlainMessage<T> | undefined,
56
+ b: T | PlainMessage<T> | undefined
57
+ ): boolean;
58
+ }