@bufbuild/protobuf 0.0.8 → 0.0.9

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 (61) hide show
  1. package/README.md +34 -4
  2. package/dist/cjs/codegen-info.js +60 -0
  3. package/dist/cjs/create-descriptor-set.js +952 -0
  4. package/dist/cjs/create-registry-from-desc.js +376 -0
  5. package/dist/cjs/create-registry.js +75 -0
  6. package/dist/cjs/descriptor-set.js +0 -436
  7. package/dist/cjs/google/protobuf/struct_pb.js +1 -1
  8. package/dist/cjs/google/protobuf/type_pb.js +1 -1
  9. package/dist/cjs/index.js +17 -7
  10. package/dist/cjs/{descriptor-registry.js → legacy-descriptor-registry.js} +18 -10
  11. package/dist/cjs/legacy-descriptor-set.js +453 -0
  12. package/dist/cjs/legacy-type-registry.js +104 -0
  13. package/dist/cjs/private/enum.js +22 -31
  14. package/dist/cjs/private/field-wrapper.js +30 -1
  15. package/dist/cjs/private/field.js +1 -1
  16. package/dist/cjs/private/names.js +168 -29
  17. package/dist/cjs/proto2.js +2 -2
  18. package/dist/cjs/proto3.js +2 -2
  19. package/dist/cjs/type-registry.js +0 -87
  20. package/dist/esm/codegen-info.js +57 -0
  21. package/dist/esm/create-descriptor-set.js +947 -0
  22. package/dist/esm/create-registry-from-desc.js +371 -0
  23. package/dist/esm/create-registry.js +71 -0
  24. package/dist/esm/descriptor-set.js +1 -434
  25. package/dist/esm/google/protobuf/struct_pb.js +1 -1
  26. package/dist/esm/google/protobuf/type_pb.js +1 -1
  27. package/dist/esm/index.js +9 -3
  28. package/dist/esm/{descriptor-registry.js → legacy-descriptor-registry.js} +16 -8
  29. package/dist/esm/legacy-descriptor-set.js +449 -0
  30. package/dist/esm/legacy-type-registry.js +100 -0
  31. package/dist/esm/private/enum.js +22 -31
  32. package/dist/esm/private/field-wrapper.js +28 -0
  33. package/dist/esm/private/field.js +2 -2
  34. package/dist/esm/private/names.js +163 -24
  35. package/dist/esm/proto2.js +3 -3
  36. package/dist/esm/proto3.js +3 -3
  37. package/dist/esm/type-registry.js +1 -85
  38. package/dist/types/codegen-info.d.ts +19 -0
  39. package/dist/types/create-descriptor-set.d.ts +16 -0
  40. package/dist/types/create-registry-from-desc.d.ts +49 -0
  41. package/dist/types/create-registry.d.ts +8 -0
  42. package/dist/types/descriptor-set.d.ts +554 -108
  43. package/dist/types/enum.d.ts +9 -5
  44. package/dist/types/index.d.ts +9 -3
  45. package/dist/types/{descriptor-registry.d.ts → legacy-descriptor-registry.d.ts} +8 -6
  46. package/dist/types/legacy-descriptor-set.d.ts +152 -0
  47. package/dist/types/legacy-type-registry.d.ts +44 -0
  48. package/dist/types/private/enum.d.ts +4 -8
  49. package/dist/types/private/field-wrapper.d.ts +7 -0
  50. package/dist/types/private/message-type.d.ts +1 -4
  51. package/dist/types/private/names.d.ts +26 -8
  52. package/dist/types/private/proto-runtime.d.ts +2 -2
  53. package/dist/types/private/util.d.ts +1 -6
  54. package/dist/types/type-registry.d.ts +0 -38
  55. package/package.json +2 -2
  56. package/dist/protobuf.cjs +0 -2
  57. package/dist/protobuf.cjs.map +0 -1
  58. package/dist/protobuf.esm.js +0 -2
  59. package/dist/protobuf.esm.js.map +0 -1
  60. package/dist/protobuf.modern.js +0 -2
  61. package/dist/protobuf.modern.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Reflection information for a protobuf enum.
2
+ * Reflection information for a protobuf enumeration.
3
3
  */
4
4
  export interface EnumType {
5
5
  /**
6
- * The fully qualified name of the enum.
6
+ * The fully qualified name of the enumeration.
7
7
  */
8
8
  readonly typeName: string;
9
9
  readonly values: readonly EnumValueInfo[];
@@ -17,15 +17,19 @@ export interface EnumType {
17
17
  findNumber(no: number): EnumValueInfo | undefined;
18
18
  }
19
19
  /**
20
- * Reflection information for a protobuf enum value.
20
+ * Reflection information for a protobuf enumeration value.
21
21
  */
22
22
  export interface EnumValueInfo {
23
23
  /**
24
- * The number of the value as specified in proto.
24
+ * The numeric enumeration value, as specified in the protobuf source.
25
25
  */
26
26
  readonly no: number;
27
27
  /**
28
- * The name of the value as specified in proto.
28
+ * The name of the enumeration value, as specified in the protobuf source.
29
29
  */
30
30
  readonly name: string;
31
+ /**
32
+ * The name of the enumeration value in generated code.
33
+ */
34
+ readonly localName: string;
31
35
  }
@@ -2,6 +2,7 @@ export { proto3 } from "./proto3.js";
2
2
  export { proto2 } from "./proto2.js";
3
3
  export { protoInt64 } from "./proto-int64.js";
4
4
  export { protoBase64 } from "./proto-base64.js";
5
+ export { codegenInfo } from "./codegen-info.js";
5
6
  export { Message, AnyMessage, PartialMessage, PlainMessage, } from "./message.js";
6
7
  export type { FieldInfo } from "./field.js";
7
8
  export type { FieldList } from "./field-list.js";
@@ -10,13 +11,18 @@ export type { MessageType } from "./message-type.js";
10
11
  export type { EnumType, EnumValueInfo } from "./enum.js";
11
12
  export type { ServiceType, MethodInfo, MethodInfoUnary, MethodInfoServerStreaming, MethodInfoClientStreaming, MethodInfoBiDiStreaming, } from "./service-type.js";
12
13
  export { MethodKind, MethodIdempotency } from "./service-type.js";
13
- export { TypeRegistry, IMessageTypeRegistry } from "./type-registry.js";
14
- export { DescriptorRegistry } from "./descriptor-registry.js";
15
- export { DescriptorSet } from "./descriptor-set.js";
16
14
  export { WireType, BinaryWriter, BinaryReader } from "./binary-encoding.js";
17
15
  export type { IBinaryReader, IBinaryWriter } from "./binary-encoding.js";
18
16
  export type { BinaryFormat, BinaryWriteOptions, BinaryReadOptions, } from "./binary-format.js";
19
17
  export { JsonFormat, JsonObject, JsonValue, JsonReadOptions, JsonWriteOptions, JsonWriteStringOptions, } from "./json-format.js";
18
+ export { DescriptorSet, DescFile, DescEnum, DescEnumValue, DescMessage, DescOneof, DescField, DescService, DescMethod, DescExtension, DescComments, } from "./descriptor-set.js";
19
+ export { createDescriptorSet } from "./create-descriptor-set.js";
20
+ export { IMessageTypeRegistry } from "./type-registry.js";
21
+ export { createRegistry } from "./create-registry.js";
22
+ export { createRegistryFromDescriptors } from "./create-registry-from-desc.js";
23
+ export { LegacyDescriptorRegistry } from "./legacy-descriptor-registry.js";
24
+ export { LegacyDescriptorSet } from "./legacy-descriptor-set.js";
25
+ export { TypeRegistry } from "./legacy-type-registry.js";
20
26
  export * from "./google/protobuf/compiler/plugin_pb.js";
21
27
  export * from "./google/protobuf/api_pb.js";
22
28
  export * from "./google/protobuf/any_pb.js";
@@ -1,29 +1,31 @@
1
1
  import type { FileDescriptorProto } from "./google/protobuf/descriptor_pb.js";
2
+ import { FileDescriptorSet } from "./google/protobuf/descriptor_pb.js";
2
3
  import type { MessageType } from "./message-type.js";
3
4
  import type { EnumType } from "./enum.js";
4
- import { DescriptorSet } from "./descriptor-set.js";
5
+ import { LegacyDescriptorSet } from "./legacy-descriptor-set.js";
5
6
  import type { IEnumTypeRegistry, IMessageTypeRegistry, IServiceTypeRegistry } from "./type-registry.js";
6
7
  import type { ServiceType } from "./service-type.js";
7
- import { FileDescriptorSet } from "./google/protobuf/descriptor_pb.js";
8
8
  import type { PartialMessage } from "./message.js";
9
9
  /**
10
- * DescriptorRegistry is a type registry that dynamically creates types
10
+ * LegacyDescriptorRegistry is a type registry that dynamically creates types
11
11
  * from a set of google.protobuf.FileDescriptorProto.
12
12
  *
13
13
  * By default, all well-known types with a specialized JSON representation
14
14
  * are replaced with their generated counterpart in this package.
15
+ *
16
+ * @deprecated
15
17
  */
16
- export declare class DescriptorRegistry implements IMessageTypeRegistry, IEnumTypeRegistry, IServiceTypeRegistry {
18
+ export declare class LegacyDescriptorRegistry implements IMessageTypeRegistry, IEnumTypeRegistry, IServiceTypeRegistry {
17
19
  private readonly ds;
18
20
  private readonly enums;
19
21
  private readonly messages;
20
22
  private readonly services;
21
- constructor(descriptorSet?: DescriptorSet, replaceWkt?: boolean);
23
+ constructor(descriptorSet?: LegacyDescriptorSet, replaceWkt?: boolean);
22
24
  /**
23
25
  * Conveniently create a DescriptorRegistry from a FileDescriptorSet
24
26
  * instance or a FileDescriptorSet in binary format.
25
27
  */
26
- static fromFileDescriptorSet(bytesOrSet: Uint8Array | FileDescriptorSet | PartialMessage<FileDescriptorSet>): DescriptorRegistry;
28
+ static fromFileDescriptorSet(bytesOrSet: Uint8Array | FileDescriptorSet | PartialMessage<FileDescriptorSet>): LegacyDescriptorRegistry;
27
29
  /**
28
30
  * May raise an error on invalid descriptors.
29
31
  */
@@ -0,0 +1,152 @@
1
+ import type { DescriptorProto, EnumDescriptorProto, EnumValueDescriptorProto, FieldDescriptorProto, OneofDescriptorProto } from "./google/protobuf/descriptor_pb.js";
2
+ import { FieldDescriptorProto_Type, FileDescriptorProto, MethodDescriptorProto, ServiceDescriptorProto } from "./google/protobuf/descriptor_pb.js";
3
+ import { ScalarType } from "./field.js";
4
+ import { MethodIdempotency, MethodKind } from "./service-type.js";
5
+ /**
6
+ * LegacyDescriptorSet wraps a set of google.protobuf.FileDescriptorProto,
7
+ * asserting basic expectations and providing hierarchical information.
8
+ *
9
+ * Note that all types are kept by their fully qualified type name
10
+ * with a leading dot.
11
+ *
12
+ * @deprecated
13
+ */
14
+ export declare class LegacyDescriptorSet implements UnresolvedSet {
15
+ readonly enums: Record<string, UnresolvedEnum | undefined>;
16
+ readonly messages: Record<string, UnresolvedMessage | undefined>;
17
+ readonly services: Record<string, UnresolvedService | undefined>;
18
+ /**
19
+ * May raise an error on invalid descriptors.
20
+ */
21
+ add(...files: FileDescriptorProto[]): void;
22
+ listEnums(): UnresolvedEnum[];
23
+ listMessages(): UnresolvedMessage[];
24
+ listServices(): UnresolvedService[];
25
+ }
26
+ interface UnresolvedSet {
27
+ readonly enums: Record<string, UnresolvedEnum | undefined>;
28
+ readonly messages: Record<string, UnresolvedMessage | undefined>;
29
+ readonly services: Record<string, UnresolvedService | undefined>;
30
+ }
31
+ interface File {
32
+ readonly proto: FileDescriptorProto;
33
+ readonly syntax: "proto3" | "proto2";
34
+ readonly name: string;
35
+ toString(): string;
36
+ }
37
+ interface UnresolvedEnum {
38
+ readonly proto: EnumDescriptorProto;
39
+ readonly file: File;
40
+ readonly parent: UnresolvedMessage | undefined;
41
+ readonly name: string;
42
+ readonly typeName: string;
43
+ readonly protoTypeName: string;
44
+ readonly values: UnresolvedEnumValue[];
45
+ toString(): string;
46
+ }
47
+ interface UnresolvedEnumValue {
48
+ readonly proto: EnumValueDescriptorProto;
49
+ readonly parent: UnresolvedEnum;
50
+ readonly name: string;
51
+ readonly number: number;
52
+ toString(): string;
53
+ }
54
+ interface UnresolvedMessage {
55
+ readonly proto: DescriptorProto;
56
+ readonly file: File;
57
+ readonly parent: UnresolvedMessage | undefined;
58
+ readonly name: string;
59
+ readonly typeName: string;
60
+ readonly protoTypeName: string;
61
+ readonly fields: UnresolvedField[];
62
+ readonly oneofs: UnresolvedOneof[];
63
+ readonly nestedEnums: UnresolvedEnum[];
64
+ readonly nestedMessages: UnresolvedMessage[];
65
+ readonly nestedExtensions: UnresolvedExtension[];
66
+ toString(): string;
67
+ }
68
+ interface UnresolvedField {
69
+ readonly proto: FieldDescriptorProto;
70
+ readonly number: number;
71
+ readonly name: string;
72
+ readonly type: FieldDescriptorProto_Type;
73
+ readonly parent: UnresolvedMessage;
74
+ readonly oneof: UnresolvedOneof | undefined;
75
+ readonly optional: boolean;
76
+ readonly packed: boolean;
77
+ toString(): string;
78
+ resolve(us: UnresolvedSet): ResolvedField;
79
+ }
80
+ declare type ResolvedField = (UnresolvedField & {
81
+ repeated: boolean;
82
+ readonly scalarType: ScalarType;
83
+ readonly message: undefined;
84
+ readonly enum: undefined;
85
+ readonly map: undefined;
86
+ }) | (UnresolvedField & {
87
+ repeated: boolean;
88
+ readonly scalarType: undefined;
89
+ readonly message: UnresolvedMessage;
90
+ readonly enum: undefined;
91
+ readonly map: undefined;
92
+ }) | (UnresolvedField & {
93
+ repeated: boolean;
94
+ readonly scalarType: undefined;
95
+ readonly message: undefined;
96
+ readonly enum: UnresolvedEnum;
97
+ readonly map: undefined;
98
+ }) | (UnresolvedField & {
99
+ repeated: false;
100
+ readonly scalarType: undefined;
101
+ readonly message: undefined;
102
+ readonly enum: undefined;
103
+ readonly map: Map;
104
+ });
105
+ declare type Map = {
106
+ key: Exclude<ScalarType, ScalarType.FLOAT | ScalarType.DOUBLE | ScalarType.BYTES>;
107
+ value: {
108
+ enum: UnresolvedEnum;
109
+ message: undefined;
110
+ scalar: undefined;
111
+ } | {
112
+ enum: undefined;
113
+ message: UnresolvedMessage;
114
+ scalar: undefined;
115
+ } | {
116
+ enum: undefined;
117
+ message: undefined;
118
+ scalarType: ScalarType;
119
+ };
120
+ };
121
+ interface UnresolvedOneof {
122
+ readonly proto: OneofDescriptorProto;
123
+ readonly name: string;
124
+ readonly parent: UnresolvedMessage;
125
+ readonly file: File;
126
+ readonly fields: UnresolvedField[];
127
+ toString(): string;
128
+ }
129
+ interface UnresolvedExtension {
130
+ readonly proto: FieldDescriptorProto;
131
+ readonly parent: UnresolvedMessage | undefined;
132
+ readonly file: File;
133
+ }
134
+ interface UnresolvedService {
135
+ readonly proto: ServiceDescriptorProto;
136
+ readonly file: File;
137
+ readonly methods: UnresolvedMethod[];
138
+ readonly typeName: string;
139
+ readonly protoTypeName: string;
140
+ toString(): string;
141
+ }
142
+ interface UnresolvedMethod {
143
+ readonly proto: MethodDescriptorProto;
144
+ readonly parent: UnresolvedService;
145
+ readonly name: string;
146
+ readonly kind: MethodKind;
147
+ readonly inputTypeName: string;
148
+ readonly outputTypeName: string;
149
+ readonly idempotency?: MethodIdempotency;
150
+ toString(): string;
151
+ }
152
+ export {};
@@ -0,0 +1,44 @@
1
+ import type { MessageType } from "./message-type.js";
2
+ import type { EnumType } from "./enum.js";
3
+ import type { ServiceType } from "./service-type.js";
4
+ import type { IEnumTypeRegistry, IMessageTypeRegistry, IServiceTypeRegistry } from "./type-registry.js";
5
+ /**
6
+ * @deprecated use createRegistry() instead
7
+ *
8
+ * TypeRegistry is a simple registry for all message, enum, or service types.
9
+ */
10
+ export declare class TypeRegistry implements IMessageTypeRegistry, IEnumTypeRegistry, IServiceTypeRegistry {
11
+ private readonly messages;
12
+ private readonly enums;
13
+ private readonly services;
14
+ /**
15
+ * Find a message type by its protobuf type name.
16
+ */
17
+ findMessage(typeName: string): MessageType | undefined;
18
+ /**
19
+ * Find an enum type by its protobuf type name.
20
+ */
21
+ findEnum(typeName: string): EnumType | undefined;
22
+ /**
23
+ * Find a service type by its protobuf type name.
24
+ */
25
+ findService(typeName: string): ServiceType | undefined;
26
+ /**
27
+ * Create a new TypeRegistry from the given types.
28
+ */
29
+ static from(...types: Array<MessageType | EnumType | ServiceType>): TypeRegistry;
30
+ /**
31
+ * @deprecated use TypeRegistry.from()
32
+ */
33
+ static fromIterable(types: Iterable<MessageType>): TypeRegistry;
34
+ /**
35
+ * @deprecated use TypeRegistry.from()
36
+ */
37
+ static fromTypes(...types: MessageType[]): TypeRegistry;
38
+ /**
39
+ * Add a type to the registry. For messages, the types used in message
40
+ * fields are added recursively. For services, the message types used
41
+ * for requests and responses are added recursively.
42
+ */
43
+ add(type: MessageType | EnumType | ServiceType): void;
44
+ }
@@ -15,17 +15,13 @@ export declare function getEnumType(enumObject: EnumObject): EnumType;
15
15
  /**
16
16
  * Sets reflection information on a generated enum.
17
17
  */
18
- export declare function setEnumType(enumObject: EnumObject, typeName: string, values: EnumValueInfo[]): void;
18
+ export declare function setEnumType(enumObject: EnumObject, typeName: string, values: Omit<EnumValueInfo, "localName">[], opt?: {}): void;
19
19
  /**
20
20
  * Create a new EnumType with the given values.
21
21
  */
22
- export declare function makeEnumType(typeName: string, values: EnumValueInfo[]): EnumType;
22
+ export declare function makeEnumType(typeName: string, values: (EnumValueInfo | Omit<EnumValueInfo, "localName">)[], _opt?: {}): EnumType;
23
23
  /**
24
24
  * Create a new enum object with the given values.
25
+ * Sets reflection information.
25
26
  */
26
- export declare function makeEnum(typeName: string, values: EnumValueInfo[], opt?: {
27
- /**
28
- * MY_ENUM_ for `enum MyEnum {MY_ENUM_A=0; MY_ENUM_B=1;}`, or blank string
29
- */
30
- sharedPrefix?: string;
31
- }): EnumObject;
27
+ export declare function makeEnum(typeName: string, values: (EnumValueInfo | Omit<EnumValueInfo, "localName">)[], opt?: {}): EnumObject;
@@ -1,5 +1,7 @@
1
1
  import type { Message } from "../message.js";
2
2
  import type { MessageType } from "../message-type.js";
3
+ import type { DescField } from "../descriptor-set.js";
4
+ import { ScalarType } from "../field.js";
3
5
  /**
4
6
  * A field wrapper unwraps a message to a primitive value that is more
5
7
  * ergonomic for use as a message field.
@@ -19,3 +21,8 @@ export declare function wrapField<T extends Message<T>>(type: MessageType<T>, va
19
21
  * Unwrap field values whose message type has a wrapper.
20
22
  */
21
23
  export declare function unwrapField<T extends Message<T>>(type: MessageType<T>, value: T): any;
24
+ /**
25
+ * If the given field uses one of the well-known wrapper types, return
26
+ * the base type it wraps.
27
+ */
28
+ export declare function getUnwrappedFieldType(field: DescField): ScalarType | undefined;
@@ -11,10 +11,7 @@ export declare function makeMessageType<T extends Message<T> = AnyMessage>(runti
11
11
  * It is useful in stack traces, debuggers and test frameworks,
12
12
  * but has no other implications.
13
13
  *
14
- * This property is optional because by default, the last part
15
- * from the given typeName is used. Since this does not take
16
- * reserved words into account, we provide this property so that
17
- * an escaped name can be given.
14
+ * If omitted, the last part of the typeName is used.
18
15
  */
19
16
  localName?: string;
20
17
  }): MessageType<T>;
@@ -1,16 +1,34 @@
1
+ import type { DescEnum, DescEnumValue, DescField, DescMessage, DescService } from "../descriptor-set.js";
2
+ import type { DescMethod, DescOneof } from "../descriptor-set.js";
1
3
  /**
2
- * Returns the JSON name for a protobuf field, exactly like protoc does.
4
+ * Returns the name of a protobuf element in generated code.
5
+ *
6
+ * Field names - including oneofs - are converted to lowerCamelCase. For
7
+ * messages, enumerations and services, the package name is stripped from
8
+ * the type name. For nested messages and enumerations, the names are joined
9
+ * with an underscore. For methods, the first character is made lowercase.
10
+ */
11
+ export declare function localName(desc: DescEnum | DescEnumValue | DescMessage | DescOneof | DescField | DescService | DescMethod): string;
12
+ /**
13
+ * Returns the name of a field in generated code.
3
14
  */
4
- export declare function makeJsonName(protoName: string): string;
15
+ export declare function localFieldName(protoName: string, inOneof: boolean): string;
5
16
  /**
6
- * Returns the local name of a field, exactly like protoc-gen-es does.
17
+ * Returns the name of a oneof group in generated code.
18
+ */
19
+ export declare function localOneofName(protoName: string): string;
20
+ /**
21
+ * Returns the JSON name for a protobuf field, exactly like protoc does.
7
22
  */
8
- export declare function makeFieldName(protoName: string, inOneof: boolean): string;
23
+ export declare const fieldJsonName: typeof protoCamelCase;
9
24
  /**
10
- * Returns the local name of a oneof group, exactly like protoc-gen-es does.
25
+ * Finds a prefix shared by enum values, for example `MY_ENUM_` for
26
+ * `enum MyEnum {MY_ENUM_A=0; MY_ENUM_B=1;}`.
11
27
  */
12
- export declare function makeOneofName(protoName: string): string;
28
+ export declare function findEnumSharedPrefix(enumName: string, valueNames: string[]): string | undefined;
13
29
  /**
14
- * Returns the local name of a rpc, exactly like protoc-gen-es does.
30
+ * Converts snake_case to protoCamelCase according to the convention
31
+ * used by protoc to convert a field name to a JSON name.
15
32
  */
16
- export declare function makeMethodName(protoName: string): string;
33
+ declare function protoCamelCase(snakeCase: string): string;
34
+ export {};
@@ -30,13 +30,13 @@ export interface ProtoRuntime {
30
30
  * The type name and other reflection information is accessible
31
31
  * via getEnumType().
32
32
  */
33
- makeEnum(typeName: string, values: EnumValueInfo[], opt?: {}): EnumObject;
33
+ makeEnum(typeName: string, values: (EnumValueInfo | Omit<EnumValueInfo, "localName">)[], opt?: {}): EnumObject;
34
34
  /**
35
35
  * Create an enum type at runtime, without generating code.
36
36
  * Note that this only creates the reflection information, not an
37
37
  * actual enum object.
38
38
  */
39
- makeEnumType(typeName: string, values: EnumValueInfo[], opt?: {}): EnumType;
39
+ makeEnumType(typeName: string, values: (EnumValueInfo | Omit<EnumValueInfo, "localName">)[], opt?: {}): EnumType;
40
40
  /**
41
41
  * Get reflection information - the EnumType - from an enum object.
42
42
  * If this function is called on something other than a generated
@@ -1,7 +1,6 @@
1
1
  import type { FieldListSource } from "./field-list.js";
2
2
  import type { FieldList } from "../field-list.js";
3
3
  import type { EnumObject } from "./enum.js";
4
- import type { JsonValue } from "../json-format.js";
5
4
  import type { Message, PartialMessage, PlainMessage } from "../message.js";
6
5
  import type { MessageType } from "../message-type.js";
7
6
  import type { EnumValueInfo } from "../enum.js";
@@ -18,11 +17,7 @@ export interface Util {
18
17
  /**
19
18
  * Sets reflection information on a generated enum.
20
19
  */
21
- setEnumType(enumObject: EnumObject, typeName: string, values: EnumValueInfo[], opt?: {
22
- options?: {
23
- readonly [extensionName: string]: JsonValue;
24
- };
25
- }): void;
20
+ setEnumType(enumObject: EnumObject, typeName: string, values: Omit<EnumValueInfo, "localName">[], opt?: {}): void;
26
21
  /**
27
22
  * Set default field values on the target message.
28
23
  */
@@ -28,41 +28,3 @@ export interface IServiceTypeRegistry {
28
28
  */
29
29
  findService(typeName: string): ServiceType | undefined;
30
30
  }
31
- /**
32
- * TypeRegistry is a simple registry for all message, enum, or service types.
33
- */
34
- export declare class TypeRegistry implements IMessageTypeRegistry, IEnumTypeRegistry, IServiceTypeRegistry {
35
- private readonly messages;
36
- private readonly enums;
37
- private readonly services;
38
- /**
39
- * Find a message type by its protobuf type name.
40
- */
41
- findMessage(typeName: string): MessageType | undefined;
42
- /**
43
- * Find an enum type by its protobuf type name.
44
- */
45
- findEnum(typeName: string): EnumType | undefined;
46
- /**
47
- * Find a service type by its protobuf type name.
48
- */
49
- findService(typeName: string): ServiceType | undefined;
50
- /**
51
- * Create a new TypeRegistry from the given types.
52
- */
53
- static from(...types: Array<MessageType | EnumType | ServiceType>): TypeRegistry;
54
- /**
55
- * @deprecated use TypeRegistry.from()
56
- */
57
- static fromIterable(types: Iterable<MessageType>): TypeRegistry;
58
- /**
59
- * @deprecated use TypeRegistry.from()
60
- */
61
- static fromTypes(...types: MessageType[]): TypeRegistry;
62
- /**
63
- * Add a type to the registry. For messages, the types used in message
64
- * fields are added recursively. For services, the message types used
65
- * for requests and responses are added recursively.
66
- */
67
- add(type: MessageType | EnumType | ServiceType): void;
68
- }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@bufbuild/protobuf",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "license": "(Apache-2.0 AND BSD-3-Clause)",
5
- "description": "A complete implementation of protocol buffers in TypeScript, suitable for web browsers and Node.js.",
5
+ "description": "A complete implementation of Protocol Buffers in TypeScript, suitable for web browsers and Node.js.",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/bufbuild/protobuf-es.git",