@bufbuild/protobuf 1.10.0 → 1.10.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.
- package/dist/cjs/create-registry.d.ts +5 -1
- package/dist/cjs/create-registry.js +44 -35
- package/dist/cjs/google/protobuf/descriptor_pb.js +1 -1
- package/dist/cjs/google/protobuf/struct_pb.js +1 -1
- package/dist/cjs/google/protobuf/type_pb.js +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/private/util-common.js +11 -1
- package/dist/cjs/type-registry.d.ts +9 -0
- package/dist/esm/create-registry.d.ts +5 -1
- package/dist/esm/create-registry.js +41 -33
- package/dist/esm/google/protobuf/descriptor_pb.js +1 -1
- package/dist/esm/google/protobuf/struct_pb.js +1 -1
- package/dist/esm/google/protobuf/type_pb.js +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/private/util-common.js +11 -1
- package/dist/esm/type-registry.d.ts +9 -0
- package/package.json +7 -1
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { MessageType } from "./message-type.js";
|
|
2
2
|
import type { EnumType } from "./enum.js";
|
|
3
3
|
import type { ServiceType } from "./service-type.js";
|
|
4
|
-
import type { IEnumTypeRegistry, IExtensionRegistry, IMessageTypeRegistry, IServiceTypeRegistry } from "./type-registry.js";
|
|
4
|
+
import type { IEnumTypeRegistry, IExtensionRegistry, IMessageTypeRegistry, IMutableRegistry, IServiceTypeRegistry } from "./type-registry.js";
|
|
5
5
|
import type { Extension } from "./extension.js";
|
|
6
6
|
/**
|
|
7
7
|
* Create a new registry from the given types.
|
|
8
8
|
*/
|
|
9
9
|
export declare function createRegistry(...types: Array<MessageType | EnumType | ServiceType | Extension>): IMessageTypeRegistry & IEnumTypeRegistry & IExtensionRegistry & IServiceTypeRegistry;
|
|
10
|
+
/**
|
|
11
|
+
* Create a mutable registry from the given types.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createMutableRegistry(...types: Array<MessageType | EnumType | ServiceType | Extension>): IMutableRegistry;
|
|
@@ -13,11 +13,20 @@
|
|
|
13
13
|
// See the License for the specific language governing permissions and
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.createRegistry = void 0;
|
|
16
|
+
exports.createMutableRegistry = exports.createRegistry = void 0;
|
|
17
17
|
/**
|
|
18
18
|
* Create a new registry from the given types.
|
|
19
19
|
*/
|
|
20
20
|
function createRegistry(...types) {
|
|
21
|
+
const mutable = createMutableRegistry(...types);
|
|
22
|
+
delete mutable.add;
|
|
23
|
+
return mutable;
|
|
24
|
+
}
|
|
25
|
+
exports.createRegistry = createRegistry;
|
|
26
|
+
/**
|
|
27
|
+
* Create a mutable registry from the given types.
|
|
28
|
+
*/
|
|
29
|
+
function createMutableRegistry(...types) {
|
|
21
30
|
const messages = {};
|
|
22
31
|
const enums = {};
|
|
23
32
|
const services = {};
|
|
@@ -41,54 +50,54 @@ function createRegistry(...types) {
|
|
|
41
50
|
var _a;
|
|
42
51
|
return (_a = extensionsByName.get(typeName)) !== null && _a !== void 0 ? _a : undefined;
|
|
43
52
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
add(type) {
|
|
54
|
+
var _a;
|
|
55
|
+
if ("fields" in type) {
|
|
56
|
+
if (!this.findMessage(type.typeName)) {
|
|
57
|
+
messages[type.typeName] = type;
|
|
58
|
+
type.fields.list().forEach(addField);
|
|
59
|
+
}
|
|
51
60
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
else if ("methods" in type) {
|
|
62
|
+
if (!this.findService(type.typeName)) {
|
|
63
|
+
services[type.typeName] = type;
|
|
64
|
+
for (const method of Object.values(type.methods)) {
|
|
65
|
+
this.add(method.I);
|
|
66
|
+
this.add(method.O);
|
|
67
|
+
}
|
|
59
68
|
}
|
|
60
69
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
else if ("extendee" in type) {
|
|
71
|
+
if (!extensionsByName.has(type.typeName)) {
|
|
72
|
+
extensionsByName.set(type.typeName, type);
|
|
73
|
+
const extendeeName = type.extendee.typeName;
|
|
74
|
+
if (!extensionsByExtendee.has(extendeeName)) {
|
|
75
|
+
extensionsByExtendee.set(extendeeName, new Map());
|
|
76
|
+
}
|
|
77
|
+
(_a = extensionsByExtendee.get(extendeeName)) === null || _a === void 0 ? void 0 : _a.set(type.field.no, type);
|
|
78
|
+
this.add(type.extendee);
|
|
79
|
+
addField(type.field);
|
|
68
80
|
}
|
|
69
|
-
(_a = extensionsByExtendee.get(extendeeName)) === null || _a === void 0 ? void 0 : _a.set(type.field.no, type);
|
|
70
|
-
addType(type.extendee);
|
|
71
|
-
addField(type.field);
|
|
72
81
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
}
|
|
82
|
+
else {
|
|
83
|
+
enums[type.typeName] = type;
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
};
|
|
78
87
|
function addField(field) {
|
|
79
88
|
if (field.kind == "message") {
|
|
80
|
-
|
|
89
|
+
registry.add(field.T);
|
|
81
90
|
}
|
|
82
91
|
else if (field.kind == "map" && field.V.kind == "message") {
|
|
83
|
-
|
|
92
|
+
registry.add(field.V.T);
|
|
84
93
|
}
|
|
85
94
|
else if (field.kind == "enum") {
|
|
86
|
-
|
|
95
|
+
registry.add(field.T);
|
|
87
96
|
}
|
|
88
97
|
}
|
|
89
98
|
for (const type of types) {
|
|
90
|
-
|
|
99
|
+
registry.add(type);
|
|
91
100
|
}
|
|
92
101
|
return registry;
|
|
93
102
|
}
|
|
94
|
-
exports.
|
|
103
|
+
exports.createMutableRegistry = createMutableRegistry;
|
|
@@ -21,7 +21,7 @@ exports.GeneratedCodeInfo_Annotation_Semantic = exports.GeneratedCodeInfo_Annota
|
|
|
21
21
|
// The messages in this file describe the definitions found in .proto files.
|
|
22
22
|
// A valid .proto file can be translated directly to a FileDescriptorProto
|
|
23
23
|
// without any other information (e.g. without reading its imports).
|
|
24
|
-
// @generated by protoc-gen-es v1.10.
|
|
24
|
+
// @generated by protoc-gen-es v1.10.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
25
25
|
// @generated from file google/protobuf/descriptor.proto (package google.protobuf, syntax proto2)
|
|
26
26
|
/* eslint-disable */
|
|
27
27
|
const proto2_js_1 = require("../../proto2.js");
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.ListValue = exports.Value = exports.Struct = exports.NullValue = void 0;
|
|
17
|
-
// @generated by protoc-gen-es v1.10.
|
|
17
|
+
// @generated by protoc-gen-es v1.10.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
18
18
|
// @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
|
|
19
19
|
/* eslint-disable */
|
|
20
20
|
const proto3_js_1 = require("../../proto3.js");
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.Option = exports.EnumValue = exports.Enum = exports.Field_Cardinality = exports.Field_Kind = exports.Field = exports.Type = exports.Syntax = void 0;
|
|
17
|
-
// @generated by protoc-gen-es v1.10.
|
|
17
|
+
// @generated by protoc-gen-es v1.10.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
18
18
|
// @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
|
|
19
19
|
/* eslint-disable */
|
|
20
20
|
const proto3_js_1 = require("../../proto3.js");
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type { JsonFormat, JsonObject, JsonValue, JsonReadOptions, JsonWriteOptio
|
|
|
25
25
|
export type { DescriptorSet, AnyDesc, DescFile, DescEnum, DescEnumValue, DescMessage, DescOneof, DescField, DescService, DescMethod, DescExtension, DescComments, } from "./descriptor-set.js";
|
|
26
26
|
export { createDescriptorSet } from "./create-descriptor-set.js";
|
|
27
27
|
export type { IMessageTypeRegistry, IExtensionRegistry, } from "./type-registry.js";
|
|
28
|
-
export { createRegistry } from "./create-registry.js";
|
|
28
|
+
export { createRegistry, createMutableRegistry } from "./create-registry.js";
|
|
29
29
|
export { createRegistryFromDescriptors } from "./create-registry-from-desc.js";
|
|
30
30
|
export { toPlainMessage } from "./to-plain-message.js";
|
|
31
31
|
export * from "./google/protobuf/compiler/plugin_pb.js";
|
package/dist/cjs/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
27
27
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.toPlainMessage = exports.createRegistryFromDescriptors = exports.createRegistry = exports.createDescriptorSet = exports.BinaryReader = exports.BinaryWriter = exports.WireType = exports.MethodIdempotency = exports.MethodKind = exports.clearExtension = exports.hasExtension = exports.setExtension = exports.getExtension = exports.ScalarType = exports.LongType = exports.isMessage = exports.Message = exports.codegenInfo = exports.protoDelimited = exports.protoBase64 = exports.protoInt64 = exports.protoDouble = exports.proto2 = exports.proto3 = void 0;
|
|
30
|
+
exports.toPlainMessage = exports.createRegistryFromDescriptors = exports.createMutableRegistry = exports.createRegistry = exports.createDescriptorSet = exports.BinaryReader = exports.BinaryWriter = exports.WireType = exports.MethodIdempotency = exports.MethodKind = exports.clearExtension = exports.hasExtension = exports.setExtension = exports.getExtension = exports.ScalarType = exports.LongType = exports.isMessage = exports.Message = exports.codegenInfo = exports.protoDelimited = exports.protoBase64 = exports.protoInt64 = exports.protoDouble = exports.proto2 = exports.proto3 = void 0;
|
|
31
31
|
var proto3_js_1 = require("./proto3.js");
|
|
32
32
|
Object.defineProperty(exports, "proto3", { enumerable: true, get: function () { return proto3_js_1.proto3; } });
|
|
33
33
|
var proto2_js_1 = require("./proto2.js");
|
|
@@ -65,6 +65,7 @@ var create_descriptor_set_js_1 = require("./create-descriptor-set.js");
|
|
|
65
65
|
Object.defineProperty(exports, "createDescriptorSet", { enumerable: true, get: function () { return create_descriptor_set_js_1.createDescriptorSet; } });
|
|
66
66
|
var create_registry_js_1 = require("./create-registry.js");
|
|
67
67
|
Object.defineProperty(exports, "createRegistry", { enumerable: true, get: function () { return create_registry_js_1.createRegistry; } });
|
|
68
|
+
Object.defineProperty(exports, "createMutableRegistry", { enumerable: true, get: function () { return create_registry_js_1.createMutableRegistry; } });
|
|
68
69
|
var create_registry_from_desc_js_1 = require("./create-registry-from-desc.js");
|
|
69
70
|
Object.defineProperty(exports, "createRegistryFromDescriptors", { enumerable: true, get: function () { return create_registry_from_desc_js_1.createRegistryFromDescriptors; } });
|
|
70
71
|
var to_plain_message_js_1 = require("./to-plain-message.js");
|
|
@@ -143,7 +143,17 @@ function makeUtilCommon() {
|
|
|
143
143
|
}
|
|
144
144
|
switch (m.kind) {
|
|
145
145
|
case "message":
|
|
146
|
-
|
|
146
|
+
let a = va;
|
|
147
|
+
let b = vb;
|
|
148
|
+
if (m.T.fieldWrapper) {
|
|
149
|
+
if (a !== undefined && !(0, is_message_js_1.isMessage)(a)) {
|
|
150
|
+
a = m.T.fieldWrapper.wrapField(a);
|
|
151
|
+
}
|
|
152
|
+
if (b !== undefined && !(0, is_message_js_1.isMessage)(b)) {
|
|
153
|
+
b = m.T.fieldWrapper.wrapField(b);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return m.T.equals(a, b);
|
|
147
157
|
case "enum":
|
|
148
158
|
return (0, scalars_js_1.scalarEquals)(scalar_js_1.ScalarType.INT32, va, vb);
|
|
149
159
|
case "scalar":
|
|
@@ -55,3 +55,12 @@ export interface IExtensionRegistry {
|
|
|
55
55
|
*/
|
|
56
56
|
findExtension(typeName: string): Extension | undefined;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* A registry that allows
|
|
60
|
+
*/
|
|
61
|
+
export interface IMutableRegistry extends IMessageTypeRegistry, IEnumTypeRegistry, IServiceTypeRegistry, IExtensionRegistry {
|
|
62
|
+
/**
|
|
63
|
+
* Adds the type to the registry.
|
|
64
|
+
*/
|
|
65
|
+
add(type: MessageType | EnumType | ServiceType | Extension): void;
|
|
66
|
+
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { MessageType } from "./message-type.js";
|
|
2
2
|
import type { EnumType } from "./enum.js";
|
|
3
3
|
import type { ServiceType } from "./service-type.js";
|
|
4
|
-
import type { IEnumTypeRegistry, IExtensionRegistry, IMessageTypeRegistry, IServiceTypeRegistry } from "./type-registry.js";
|
|
4
|
+
import type { IEnumTypeRegistry, IExtensionRegistry, IMessageTypeRegistry, IMutableRegistry, IServiceTypeRegistry } from "./type-registry.js";
|
|
5
5
|
import type { Extension } from "./extension.js";
|
|
6
6
|
/**
|
|
7
7
|
* Create a new registry from the given types.
|
|
8
8
|
*/
|
|
9
9
|
export declare function createRegistry(...types: Array<MessageType | EnumType | ServiceType | Extension>): IMessageTypeRegistry & IEnumTypeRegistry & IExtensionRegistry & IServiceTypeRegistry;
|
|
10
|
+
/**
|
|
11
|
+
* Create a mutable registry from the given types.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createMutableRegistry(...types: Array<MessageType | EnumType | ServiceType | Extension>): IMutableRegistry;
|
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
* Create a new registry from the given types.
|
|
16
16
|
*/
|
|
17
17
|
export function createRegistry(...types) {
|
|
18
|
+
const mutable = createMutableRegistry(...types);
|
|
19
|
+
delete mutable.add;
|
|
20
|
+
return mutable;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create a mutable registry from the given types.
|
|
24
|
+
*/
|
|
25
|
+
export function createMutableRegistry(...types) {
|
|
18
26
|
const messages = {};
|
|
19
27
|
const enums = {};
|
|
20
28
|
const services = {};
|
|
@@ -38,53 +46,53 @@ export function createRegistry(...types) {
|
|
|
38
46
|
var _a;
|
|
39
47
|
return (_a = extensionsByName.get(typeName)) !== null && _a !== void 0 ? _a : undefined;
|
|
40
48
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
add(type) {
|
|
50
|
+
var _a;
|
|
51
|
+
if ("fields" in type) {
|
|
52
|
+
if (!this.findMessage(type.typeName)) {
|
|
53
|
+
messages[type.typeName] = type;
|
|
54
|
+
type.fields.list().forEach(addField);
|
|
55
|
+
}
|
|
48
56
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
else if ("methods" in type) {
|
|
58
|
+
if (!this.findService(type.typeName)) {
|
|
59
|
+
services[type.typeName] = type;
|
|
60
|
+
for (const method of Object.values(type.methods)) {
|
|
61
|
+
this.add(method.I);
|
|
62
|
+
this.add(method.O);
|
|
63
|
+
}
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
else if ("extendee" in type) {
|
|
67
|
+
if (!extensionsByName.has(type.typeName)) {
|
|
68
|
+
extensionsByName.set(type.typeName, type);
|
|
69
|
+
const extendeeName = type.extendee.typeName;
|
|
70
|
+
if (!extensionsByExtendee.has(extendeeName)) {
|
|
71
|
+
extensionsByExtendee.set(extendeeName, new Map());
|
|
72
|
+
}
|
|
73
|
+
(_a = extensionsByExtendee.get(extendeeName)) === null || _a === void 0 ? void 0 : _a.set(type.field.no, type);
|
|
74
|
+
this.add(type.extendee);
|
|
75
|
+
addField(type.field);
|
|
65
76
|
}
|
|
66
|
-
(_a = extensionsByExtendee.get(extendeeName)) === null || _a === void 0 ? void 0 : _a.set(type.field.no, type);
|
|
67
|
-
addType(type.extendee);
|
|
68
|
-
addField(type.field);
|
|
69
77
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}
|
|
78
|
+
else {
|
|
79
|
+
enums[type.typeName] = type;
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
};
|
|
75
83
|
function addField(field) {
|
|
76
84
|
if (field.kind == "message") {
|
|
77
|
-
|
|
85
|
+
registry.add(field.T);
|
|
78
86
|
}
|
|
79
87
|
else if (field.kind == "map" && field.V.kind == "message") {
|
|
80
|
-
|
|
88
|
+
registry.add(field.V.T);
|
|
81
89
|
}
|
|
82
90
|
else if (field.kind == "enum") {
|
|
83
|
-
|
|
91
|
+
registry.add(field.T);
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
for (const type of types) {
|
|
87
|
-
|
|
95
|
+
registry.add(type);
|
|
88
96
|
}
|
|
89
97
|
return registry;
|
|
90
98
|
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// The messages in this file describe the definitions found in .proto files.
|
|
19
19
|
// A valid .proto file can be translated directly to a FileDescriptorProto
|
|
20
20
|
// without any other information (e.g. without reading its imports).
|
|
21
|
-
// @generated by protoc-gen-es v1.10.
|
|
21
|
+
// @generated by protoc-gen-es v1.10.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
22
22
|
// @generated from file google/protobuf/descriptor.proto (package google.protobuf, syntax proto2)
|
|
23
23
|
/* eslint-disable */
|
|
24
24
|
import { proto2 } from "../../proto2.js";
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
// @generated by protoc-gen-es v1.10.
|
|
14
|
+
// @generated by protoc-gen-es v1.10.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
15
15
|
// @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
|
|
16
16
|
/* eslint-disable */
|
|
17
17
|
import { proto3 } from "../../proto3.js";
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
// @generated by protoc-gen-es v1.10.
|
|
14
|
+
// @generated by protoc-gen-es v1.10.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
15
15
|
// @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
|
|
16
16
|
/* eslint-disable */
|
|
17
17
|
import { proto3 } from "../../proto3.js";
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type { JsonFormat, JsonObject, JsonValue, JsonReadOptions, JsonWriteOptio
|
|
|
25
25
|
export type { DescriptorSet, AnyDesc, DescFile, DescEnum, DescEnumValue, DescMessage, DescOneof, DescField, DescService, DescMethod, DescExtension, DescComments, } from "./descriptor-set.js";
|
|
26
26
|
export { createDescriptorSet } from "./create-descriptor-set.js";
|
|
27
27
|
export type { IMessageTypeRegistry, IExtensionRegistry, } from "./type-registry.js";
|
|
28
|
-
export { createRegistry } from "./create-registry.js";
|
|
28
|
+
export { createRegistry, createMutableRegistry } from "./create-registry.js";
|
|
29
29
|
export { createRegistryFromDescriptors } from "./create-registry-from-desc.js";
|
|
30
30
|
export { toPlainMessage } from "./to-plain-message.js";
|
|
31
31
|
export * from "./google/protobuf/compiler/plugin_pb.js";
|
package/dist/esm/index.js
CHANGED
|
@@ -25,7 +25,7 @@ export { getExtension, setExtension, hasExtension, clearExtension, } from "./ext
|
|
|
25
25
|
export { MethodKind, MethodIdempotency } from "./service-type.js";
|
|
26
26
|
export { WireType, BinaryWriter, BinaryReader } from "./binary-encoding.js";
|
|
27
27
|
export { createDescriptorSet } from "./create-descriptor-set.js";
|
|
28
|
-
export { createRegistry } from "./create-registry.js";
|
|
28
|
+
export { createRegistry, createMutableRegistry } from "./create-registry.js";
|
|
29
29
|
export { createRegistryFromDescriptors } from "./create-registry-from-desc.js";
|
|
30
30
|
export { toPlainMessage } from "./to-plain-message.js";
|
|
31
31
|
// ideally, we would export these types with sub-path exports:
|
|
@@ -141,7 +141,17 @@ export function makeUtilCommon() {
|
|
|
141
141
|
}
|
|
142
142
|
switch (m.kind) {
|
|
143
143
|
case "message":
|
|
144
|
-
|
|
144
|
+
let a = va;
|
|
145
|
+
let b = vb;
|
|
146
|
+
if (m.T.fieldWrapper) {
|
|
147
|
+
if (a !== undefined && !isMessage(a)) {
|
|
148
|
+
a = m.T.fieldWrapper.wrapField(a);
|
|
149
|
+
}
|
|
150
|
+
if (b !== undefined && !isMessage(b)) {
|
|
151
|
+
b = m.T.fieldWrapper.wrapField(b);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return m.T.equals(a, b);
|
|
145
155
|
case "enum":
|
|
146
156
|
return scalarEquals(ScalarType.INT32, va, vb);
|
|
147
157
|
case "scalar":
|
|
@@ -55,3 +55,12 @@ export interface IExtensionRegistry {
|
|
|
55
55
|
*/
|
|
56
56
|
findExtension(typeName: string): Extension | undefined;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* A registry that allows
|
|
60
|
+
*/
|
|
61
|
+
export interface IMutableRegistry extends IMessageTypeRegistry, IEnumTypeRegistry, IServiceTypeRegistry, IExtensionRegistry {
|
|
62
|
+
/**
|
|
63
|
+
* Adds the type to the registry.
|
|
64
|
+
*/
|
|
65
|
+
add(type: MessageType | EnumType | ServiceType | Extension): void;
|
|
66
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bufbuild/protobuf",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.1",
|
|
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
|
+
"keywords": [
|
|
7
|
+
"protobuf",
|
|
8
|
+
"schema",
|
|
9
|
+
"typescript",
|
|
10
|
+
"ecmascript"
|
|
11
|
+
],
|
|
6
12
|
"repository": {
|
|
7
13
|
"type": "git",
|
|
8
14
|
"url": "https://github.com/bufbuild/protobuf-es.git",
|