@bufbuild/protobuf 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cjs/binary-encoding.js +1 -1
  2. package/dist/cjs/codegen-info.js +1 -0
  3. package/dist/cjs/field.js +1 -1
  4. package/dist/cjs/google/protobuf/any_pb.js +3 -3
  5. package/dist/cjs/google/protobuf/api_pb.js +1 -1
  6. package/dist/cjs/google/protobuf/compiler/plugin_pb.js +1 -1
  7. package/dist/cjs/google/protobuf/descriptor_pb.js +88 -10
  8. package/dist/cjs/google/protobuf/field_mask_pb.js +1 -1
  9. package/dist/cjs/google/protobuf/struct_pb.js +3 -3
  10. package/dist/cjs/google/protobuf/timestamp_pb.js +1 -1
  11. package/dist/cjs/google/protobuf/type_pb.js +25 -4
  12. package/dist/cjs/index.js +5 -4
  13. package/dist/cjs/private/binary-format-common.js +44 -6
  14. package/dist/cjs/proto-base64.js +2 -10
  15. package/dist/cjs/proto-delimited.js +14 -19
  16. package/dist/cjs/proto-double.js +29 -0
  17. package/dist/cjs/proto-int64.js +1 -1
  18. package/dist/cjs/service-type.js +2 -2
  19. package/dist/cjs/to-plain-message.js +67 -0
  20. package/dist/esm/codegen-info.js +1 -0
  21. package/dist/esm/create-descriptor-set.js +1 -1
  22. package/dist/esm/google/protobuf/any_pb.js +3 -3
  23. package/dist/esm/google/protobuf/api_pb.js +1 -1
  24. package/dist/esm/google/protobuf/descriptor_pb.js +77 -0
  25. package/dist/esm/google/protobuf/field_mask_pb.js +1 -1
  26. package/dist/esm/google/protobuf/struct_pb.js +2 -2
  27. package/dist/esm/google/protobuf/timestamp_pb.js +1 -1
  28. package/dist/esm/google/protobuf/type_pb.js +22 -1
  29. package/dist/esm/index.js +3 -4
  30. package/dist/esm/private/binary-format-common.js +45 -7
  31. package/dist/esm/private/message-type.js +1 -1
  32. package/dist/esm/private/util-common.js +1 -1
  33. package/dist/esm/proto-base64.js +2 -10
  34. package/dist/esm/proto-delimited.js +14 -19
  35. package/dist/esm/proto-double.js +26 -0
  36. package/dist/esm/proto-int64.js +1 -1
  37. package/dist/esm/to-plain-message.js +63 -0
  38. package/dist/types/codegen-info.d.ts +1 -1
  39. package/dist/types/google/protobuf/any_pb.d.ts +3 -3
  40. package/dist/types/google/protobuf/api_pb.d.ts +1 -1
  41. package/dist/types/google/protobuf/descriptor_pb.d.ts +107 -3
  42. package/dist/types/google/protobuf/struct_pb.d.ts +1 -1
  43. package/dist/types/google/protobuf/timestamp_pb.d.ts +1 -1
  44. package/dist/types/google/protobuf/type_pb.d.ts +19 -1
  45. package/dist/types/index.d.ts +7 -4
  46. package/dist/types/private/binary-format-common.d.ts +3 -2
  47. package/dist/types/private/json-format-common.d.ts +2 -1
  48. package/dist/types/private/message-type.d.ts +2 -1
  49. package/dist/types/private/scalars.d.ts +2 -1
  50. package/dist/types/proto-base64.d.ts +1 -9
  51. package/dist/types/proto-double.d.ts +5 -0
  52. package/dist/types/to-plain-message.d.ts +9 -0
  53. package/package.json +2 -2
@@ -0,0 +1,63 @@
1
+ // Copyright 2021-2023 Buf Technologies, Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ /* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-argument,no-case-declarations */
15
+ import { Message } from "./message.js";
16
+ /**
17
+ * toPlainMessage returns a new object by striping
18
+ * all methods from a message, leaving only fields and
19
+ * oneof groups. It is recursive, meaning it applies this
20
+ * same logic to all nested message fields as well.
21
+ */
22
+ export function toPlainMessage(message) {
23
+ const type = message.getType();
24
+ const target = {};
25
+ for (const member of type.fields.byMember()) {
26
+ const source = message[member.localName];
27
+ let copy;
28
+ if (member.repeated) {
29
+ copy = source.map((e) => toPlainValue(e));
30
+ }
31
+ else if (member.kind == "map") {
32
+ copy = {};
33
+ for (const [key, v] of Object.entries(source)) {
34
+ copy[key] = toPlainValue(v);
35
+ }
36
+ }
37
+ else if (member.kind == "oneof") {
38
+ const f = member.findField(source.case);
39
+ copy = f
40
+ ? { case: source.case, value: toPlainValue(source.value) }
41
+ : { case: undefined };
42
+ }
43
+ else {
44
+ copy = toPlainValue(source);
45
+ }
46
+ target[member.localName] = copy;
47
+ }
48
+ return target;
49
+ }
50
+ function toPlainValue(value) {
51
+ if (value === undefined) {
52
+ return value;
53
+ }
54
+ if (value instanceof Message) {
55
+ return toPlainMessage(value);
56
+ }
57
+ if (value instanceof Uint8Array) {
58
+ const c = new Uint8Array(value.byteLength);
59
+ c.set(value);
60
+ return c;
61
+ }
62
+ return value;
63
+ }
@@ -13,7 +13,7 @@ interface CodegenInfo {
13
13
  readonly safeIdentifier: typeof safeIdentifier;
14
14
  readonly safeObjectProperty: typeof safeObjectProperty;
15
15
  }
16
- type RuntimeSymbolName = "proto2" | "proto3" | "Message" | "PartialMessage" | "PlainMessage" | "FieldList" | "MessageType" | "BinaryReadOptions" | "BinaryWriteOptions" | "JsonReadOptions" | "JsonWriteOptions" | "JsonValue" | "JsonObject" | "protoInt64" | "ScalarType" | "MethodKind" | "MethodIdempotency" | "IMessageTypeRegistry";
16
+ type RuntimeSymbolName = "proto2" | "proto3" | "Message" | "PartialMessage" | "PlainMessage" | "FieldList" | "MessageType" | "BinaryReadOptions" | "BinaryWriteOptions" | "JsonReadOptions" | "JsonWriteOptions" | "JsonValue" | "JsonObject" | "protoDouble" | "protoInt64" | "ScalarType" | "MethodKind" | "MethodIdempotency" | "IMessageTypeRegistry";
17
17
  type RuntimeSymbolInfo = {
18
18
  typeOnly: boolean;
19
19
  publicImportPath: string;
@@ -36,7 +36,7 @@ import type { BinaryReadOptions } from "../../binary-format.js";
36
36
  * foo = any.unpack(Foo.getDefaultInstance());
37
37
  * }
38
38
  *
39
- * Example 3: Pack and unpack a message in Python.
39
+ * Example 3: Pack and unpack a message in Python.
40
40
  *
41
41
  * foo = Foo(...)
42
42
  * any = Any()
@@ -46,7 +46,7 @@ import type { BinaryReadOptions } from "../../binary-format.js";
46
46
  * any.Unpack(foo)
47
47
  * ...
48
48
  *
49
- * Example 4: Pack and unpack a message in Go
49
+ * Example 4: Pack and unpack a message in Go
50
50
  *
51
51
  * foo := &pb.Foo{...}
52
52
  * any, err := anypb.New(foo)
@@ -66,7 +66,7 @@ import type { BinaryReadOptions } from "../../binary-format.js";
66
66
  * name "y.z".
67
67
  *
68
68
  * JSON
69
- *
69
+ * ====
70
70
  * The JSON representation of an `Any` value uses the regular
71
71
  * representation of the deserialized, embedded message, with an
72
72
  * additional field `@type` which contains the type URL. Example:
@@ -197,7 +197,7 @@ export declare class Method extends Message<Method> {
197
197
  * The mixin construct implies that all methods in `AccessControl` are
198
198
  * also declared with same name and request/response types in
199
199
  * `Storage`. A documentation generator or annotation processor will
200
- * see the effective `Storage.GetAcl` method after inheriting
200
+ * see the effective `Storage.GetAcl` method after inherting
201
201
  * documentation and annotations as follows:
202
202
  *
203
203
  * service Storage {
@@ -242,6 +242,23 @@ export declare class ExtensionRangeOptions extends Message<ExtensionRangeOptions
242
242
  * @generated from field: repeated google.protobuf.UninterpretedOption uninterpreted_option = 999;
243
243
  */
244
244
  uninterpretedOption: UninterpretedOption[];
245
+ /**
246
+ * go/protobuf-stripping-extension-declarations
247
+ * Like Metadata, but we use a repeated field to hold all extension
248
+ * declarations. This should avoid the size increases of transforming a large
249
+ * extension range into small ranges in generated binaries.
250
+ *
251
+ * @generated from field: repeated google.protobuf.ExtensionRangeOptions.Declaration declaration = 2;
252
+ */
253
+ declaration: ExtensionRangeOptions_Declaration[];
254
+ /**
255
+ * The verification state of the range.
256
+ * TODO(b/278783756): flip the default to DECLARATION once all empty ranges
257
+ * are marked as UNVERIFIED.
258
+ *
259
+ * @generated from field: optional google.protobuf.ExtensionRangeOptions.VerificationState verification = 3 [default = UNVERIFIED];
260
+ */
261
+ verification?: ExtensionRangeOptions_VerificationState;
245
262
  constructor(data?: PartialMessage<ExtensionRangeOptions>);
246
263
  static readonly runtime: typeof proto2;
247
264
  static readonly typeName = "google.protobuf.ExtensionRangeOptions";
@@ -251,6 +268,79 @@ export declare class ExtensionRangeOptions extends Message<ExtensionRangeOptions
251
268
  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ExtensionRangeOptions;
252
269
  static equals(a: ExtensionRangeOptions | PlainMessage<ExtensionRangeOptions> | undefined, b: ExtensionRangeOptions | PlainMessage<ExtensionRangeOptions> | undefined): boolean;
253
270
  }
271
+ /**
272
+ * The verification state of the extension range.
273
+ *
274
+ * @generated from enum google.protobuf.ExtensionRangeOptions.VerificationState
275
+ */
276
+ export declare enum ExtensionRangeOptions_VerificationState {
277
+ /**
278
+ * All the extensions of the range must be declared.
279
+ *
280
+ * @generated from enum value: DECLARATION = 0;
281
+ */
282
+ DECLARATION = 0,
283
+ /**
284
+ * @generated from enum value: UNVERIFIED = 1;
285
+ */
286
+ UNVERIFIED = 1
287
+ }
288
+ /**
289
+ * @generated from message google.protobuf.ExtensionRangeOptions.Declaration
290
+ */
291
+ export declare class ExtensionRangeOptions_Declaration extends Message<ExtensionRangeOptions_Declaration> {
292
+ /**
293
+ * The extension number declared within the extension range.
294
+ *
295
+ * @generated from field: optional int32 number = 1;
296
+ */
297
+ number?: number;
298
+ /**
299
+ * The fully-qualified name of the extension field. There must be a leading
300
+ * dot in front of the full name.
301
+ *
302
+ * @generated from field: optional string full_name = 2;
303
+ */
304
+ fullName?: string;
305
+ /**
306
+ * The fully-qualified type name of the extension field. Unlike
307
+ * Metadata.type, Declaration.type must have a leading dot for messages
308
+ * and enums.
309
+ *
310
+ * @generated from field: optional string type = 3;
311
+ */
312
+ type?: string;
313
+ /**
314
+ * Deprecated. Please use "repeated".
315
+ *
316
+ * @generated from field: optional bool is_repeated = 4 [deprecated = true];
317
+ * @deprecated
318
+ */
319
+ isRepeated?: boolean;
320
+ /**
321
+ * If true, indicates that the number is reserved in the extension range,
322
+ * and any extension field with the number will fail to compile. Set this
323
+ * when a declared extension field is deleted.
324
+ *
325
+ * @generated from field: optional bool reserved = 5;
326
+ */
327
+ reserved?: boolean;
328
+ /**
329
+ * If true, indicates that the extension must be defined as repeated.
330
+ * Otherwise the extension must be defined as optional.
331
+ *
332
+ * @generated from field: optional bool repeated = 6;
333
+ */
334
+ repeated?: boolean;
335
+ constructor(data?: PartialMessage<ExtensionRangeOptions_Declaration>);
336
+ static readonly runtime: typeof proto2;
337
+ static readonly typeName = "google.protobuf.ExtensionRangeOptions.Declaration";
338
+ static readonly fields: FieldList;
339
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ExtensionRangeOptions_Declaration;
340
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ExtensionRangeOptions_Declaration;
341
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ExtensionRangeOptions_Declaration;
342
+ static equals(a: ExtensionRangeOptions_Declaration | PlainMessage<ExtensionRangeOptions_Declaration> | undefined, b: ExtensionRangeOptions_Declaration | PlainMessage<ExtensionRangeOptions_Declaration> | undefined): boolean;
343
+ }
254
344
  /**
255
345
  * Describes a field within a message.
256
346
  *
@@ -985,8 +1075,10 @@ export declare class FieldOptions extends Message<FieldOptions> {
985
1075
  /**
986
1076
  * The ctype option instructs the C++ code generator to use a different
987
1077
  * representation of the field than it normally would. See the specific
988
- * options below. This option is not yet implemented in the open source
989
- * release -- sorry, we'll try to include it in a future version!
1078
+ * options below. This option is only implemented to support use of
1079
+ * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
1080
+ * type "bytes" in the open source release -- sorry, we'll try to include
1081
+ * other types in a future version!
990
1082
  *
991
1083
  * @generated from field: optional google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];
992
1084
  */
@@ -1087,9 +1179,14 @@ export declare class FieldOptions extends Message<FieldOptions> {
1087
1179
  */
1088
1180
  retention?: FieldOptions_OptionRetention;
1089
1181
  /**
1090
- * @generated from field: optional google.protobuf.FieldOptions.OptionTargetType target = 18;
1182
+ * @generated from field: optional google.protobuf.FieldOptions.OptionTargetType target = 18 [deprecated = true];
1183
+ * @deprecated
1091
1184
  */
1092
1185
  target?: FieldOptions_OptionTargetType;
1186
+ /**
1187
+ * @generated from field: repeated google.protobuf.FieldOptions.OptionTargetType targets = 19;
1188
+ */
1189
+ targets: FieldOptions_OptionTargetType[];
1093
1190
  /**
1094
1191
  * The parser stores options it doesn't recognize here. See above.
1095
1192
  *
@@ -1116,6 +1213,13 @@ export declare enum FieldOptions_CType {
1116
1213
  */
1117
1214
  STRING = 0,
1118
1215
  /**
1216
+ * The option [ctype=CORD] may be applied to a non-repeated field of type
1217
+ * "bytes". It indicates that in C++, the data should be stored in a Cord
1218
+ * instead of a string. For very large strings, this may reduce memory
1219
+ * fragmentation. It may also allow better performance when parsing from a
1220
+ * Cord, or when parsing with aliasing enabled, as the parsed Cord may then
1221
+ * alias the original buffer.
1222
+ *
1119
1223
  * @generated from enum value: CORD = 1;
1120
1224
  */
1121
1225
  CORD = 1,
@@ -8,7 +8,7 @@ import type { BinaryReadOptions } from "../../binary-format.js";
8
8
  * `NullValue` is a singleton enumeration to represent the null value for the
9
9
  * `Value` type union.
10
10
  *
11
- * The JSON representation for `NullValue` is JSON `null`.
11
+ * The JSON representation for `NullValue` is JSON `null`.
12
12
  *
13
13
  * @generated from enum google.protobuf.NullValue
14
14
  */
@@ -92,7 +92,7 @@ import type { BinaryReadOptions } from "../../binary-format.js";
92
92
  * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
93
93
  * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
94
94
  * the Joda Time's [`ISODateTimeFormat.dateTime()`](
95
- * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
95
+ * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
96
96
  * ) to obtain a formatter capable of generating timestamps in this format.
97
97
  *
98
98
  *
@@ -23,7 +23,13 @@ export declare enum Syntax {
23
23
  *
24
24
  * @generated from enum value: SYNTAX_PROTO3 = 1;
25
25
  */
26
- PROTO3 = 1
26
+ PROTO3 = 1,
27
+ /**
28
+ * Syntax `editions`.
29
+ *
30
+ * @generated from enum value: SYNTAX_EDITIONS = 2;
31
+ */
32
+ EDITIONS = 2
27
33
  }
28
34
  /**
29
35
  * A protocol buffer message type.
@@ -67,6 +73,12 @@ export declare class Type extends Message<Type> {
67
73
  * @generated from field: google.protobuf.Syntax syntax = 6;
68
74
  */
69
75
  syntax: Syntax;
76
+ /**
77
+ * The source edition string, only valid when syntax is SYNTAX_EDITIONS.
78
+ *
79
+ * @generated from field: string edition = 7;
80
+ */
81
+ edition: string;
70
82
  constructor(data?: PartialMessage<Type>);
71
83
  static readonly runtime: typeof proto3;
72
84
  static readonly typeName = "google.protobuf.Type";
@@ -341,6 +353,12 @@ export declare class Enum extends Message<Enum> {
341
353
  * @generated from field: google.protobuf.Syntax syntax = 5;
342
354
  */
343
355
  syntax: Syntax;
356
+ /**
357
+ * The source edition string, only valid when syntax is SYNTAX_EDITIONS.
358
+ *
359
+ * @generated from field: string edition = 6;
360
+ */
361
+ edition: string;
344
362
  constructor(data?: PartialMessage<Enum>);
345
363
  static readonly runtime: typeof proto3;
346
364
  static readonly typeName = "google.protobuf.Enum";
@@ -1,10 +1,12 @@
1
1
  export { proto3 } from "./proto3.js";
2
2
  export { proto2 } from "./proto2.js";
3
+ export { protoDouble } from "./proto-double.js";
3
4
  export { protoInt64 } from "./proto-int64.js";
4
5
  export { protoBase64 } from "./proto-base64.js";
5
6
  export { protoDelimited } from "./proto-delimited.js";
6
7
  export { codegenInfo } from "./codegen-info.js";
7
- export { Message, AnyMessage, PartialMessage, PlainMessage, } from "./message.js";
8
+ export { Message } from "./message.js";
9
+ export type { AnyMessage, PartialMessage, PlainMessage } from "./message.js";
8
10
  export type { FieldInfo } from "./field.js";
9
11
  export type { FieldList } from "./field-list.js";
10
12
  export { ScalarType } from "./field.js";
@@ -15,12 +17,13 @@ export { MethodKind, MethodIdempotency } from "./service-type.js";
15
17
  export { WireType, BinaryWriter, BinaryReader } from "./binary-encoding.js";
16
18
  export type { IBinaryReader, IBinaryWriter } from "./binary-encoding.js";
17
19
  export type { BinaryFormat, BinaryWriteOptions, BinaryReadOptions, } from "./binary-format.js";
18
- export { JsonFormat, JsonObject, JsonValue, JsonReadOptions, JsonWriteOptions, JsonWriteStringOptions, } from "./json-format.js";
19
- export { DescriptorSet, AnyDesc, DescFile, DescEnum, DescEnumValue, DescMessage, DescOneof, DescField, DescService, DescMethod, DescExtension, DescComments, } from "./descriptor-set.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";
20
22
  export { createDescriptorSet } from "./create-descriptor-set.js";
21
- export { IMessageTypeRegistry } from "./type-registry.js";
23
+ export type { IMessageTypeRegistry } from "./type-registry.js";
22
24
  export { createRegistry } from "./create-registry.js";
23
25
  export { createRegistryFromDescriptors } from "./create-registry-from-desc.js";
26
+ export { toPlainMessage } from "./to-plain-message.js";
24
27
  export * from "./google/protobuf/compiler/plugin_pb.js";
25
28
  export * from "./google/protobuf/api_pb.js";
26
29
  export * from "./google/protobuf/any_pb.js";
@@ -1,7 +1,8 @@
1
- import { IBinaryWriter } from "../binary-encoding.js";
1
+ import type { IBinaryWriter } from "../binary-encoding.js";
2
2
  import type { BinaryWriteOptions } from "../binary-format.js";
3
3
  import type { BinaryFormat } from "../binary-format.js";
4
- import { FieldInfo, ScalarType } from "../field.js";
4
+ import { ScalarType } from "../field.js";
5
+ import type { FieldInfo } from "../field.js";
5
6
  import type { MessageType } from "../message-type.js";
6
7
  export declare function makeBinaryFormatCommon(): Omit<BinaryFormat, "writeMessage">;
7
8
  export declare function writeMapEntry(writer: IBinaryWriter, options: BinaryWriteOptions, field: FieldInfo & {
@@ -1,5 +1,6 @@
1
1
  import type { JsonFormat, JsonValue, JsonWriteOptions } from "../json-format.js";
2
- import { FieldInfo, ScalarType } from "../field.js";
2
+ import { ScalarType } from "../field.js";
3
+ import type { FieldInfo } from "../field.js";
3
4
  import type { EnumType } from "../enum.js";
4
5
  type JsonFormatWriteFieldFn = (field: FieldInfo, value: any, options: JsonWriteOptions) => JsonValue | undefined;
5
6
  export declare function makeJsonFormatCommon(makeWriteField: (writeEnumFn: typeof writeEnum, writeScalarFn: typeof writeScalar) => JsonFormatWriteFieldFn): JsonFormat;
@@ -1,4 +1,5 @@
1
- import { AnyMessage, Message } from "../message.js";
1
+ import { Message } from "../message.js";
2
+ import type { AnyMessage } from "../message.js";
2
3
  import type { FieldListSource } from "./field-list.js";
3
4
  import type { MessageType } from "../message-type.js";
4
5
  import type { ProtoRuntime } from "./proto-runtime.js";
@@ -1,5 +1,6 @@
1
1
  import { ScalarType } from "../field.js";
2
- import { IBinaryWriter, WireType } from "../binary-encoding.js";
2
+ import type { IBinaryWriter } from "../binary-encoding.js";
3
+ import { WireType } from "../binary-encoding.js";
3
4
  /**
4
5
  * Returns true if both scalar values are equal.
5
6
  */
@@ -12,15 +12,7 @@ export declare const protoBase64: {
12
12
  */
13
13
  readonly dec: (base64Str: string) => Uint8Array;
14
14
  /**
15
- * Decodes a base64 string to a byte array.
16
- *
17
- * - ignores white-space, including line breaks and tabs
18
- * - allows inner padding (can decode concatenated base64 strings)
19
- * - does not require padding
20
- * - understands base64url encoding:
21
- * "-" instead of "+",
22
- * "_" instead of "/",
23
- * no padding
15
+ * Encode a byte array to a base64 string.
24
16
  */
25
17
  readonly enc: (bytes: Uint8Array) => string;
26
18
  };
@@ -0,0 +1,5 @@
1
+ export declare const protoDouble: {
2
+ readonly NaN: number;
3
+ readonly POSITIVE_INFINITY: number;
4
+ readonly NEGATIVE_INFINITY: number;
5
+ };
@@ -0,0 +1,9 @@
1
+ import { Message } from "./message.js";
2
+ import type { PlainMessage } from "./message.js";
3
+ /**
4
+ * toPlainMessage returns a new object by striping
5
+ * all methods from a message, leaving only fields and
6
+ * oneof groups. It is recursive, meaning it applies this
7
+ * same logic to all nested message fields as well.
8
+ */
9
+ export declare function toPlainMessage<T extends Message<T>>(message: T): PlainMessage<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bufbuild/protobuf",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "license": "(Apache-2.0 AND BSD-3-Clause)",
5
5
  "description": "A complete implementation of Protocol Buffers in TypeScript, suitable for web browsers and Node.js.",
6
6
  "repository": {
@@ -13,7 +13,7 @@
13
13
  "clean": "rm -rf ./dist/cjs/* ./dist/esm/* ./dist/types/*",
14
14
  "build": "npm run build:cjs && npm run build:esm+types",
15
15
  "build:cjs": "../../node_modules/typescript/bin/tsc --project tsconfig.json --module commonjs --outDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
16
- "build:esm+types": "../../node_modules/typescript/bin/tsc --project tsconfig.json --module ES2015 --outDir ./dist/esm --declaration --declarationDir ./dist/types"
16
+ "build:esm+types": "../../node_modules/typescript/bin/tsc --project tsconfig.json --module ES2015 --verbatimModuleSyntax --outDir ./dist/esm --declaration --declarationDir ./dist/types"
17
17
  },
18
18
  "main": "./dist/cjs/index.js",
19
19
  "type": "module",