@bufbuild/protobuf 0.0.1-alpha.1 → 0.0.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/binary-encoding.js +414 -409
- package/dist/cjs/binary-format.js +13 -0
- package/dist/cjs/descriptor-registry.js +420 -449
- package/dist/cjs/descriptor-set.js +429 -513
- package/dist/cjs/enum.js +13 -0
- package/dist/cjs/field-list.js +13 -0
- package/dist/cjs/field.js +43 -30
- package/dist/cjs/google/protobuf/any_pb.js +122 -140
- package/dist/cjs/google/protobuf/api_pb.js +177 -224
- package/dist/cjs/google/protobuf/compiler/plugin_pb.js +125 -227
- package/dist/cjs/google/protobuf/descriptor_pb.js +1029 -1888
- package/dist/cjs/google/protobuf/duration_pb.js +72 -88
- package/dist/cjs/google/protobuf/empty_pb.js +17 -17
- package/dist/cjs/google/protobuf/field_mask_pb.js +77 -94
- package/dist/cjs/google/protobuf/source_context_pb.js +25 -25
- package/dist/cjs/google/protobuf/struct_pb.js +144 -181
- package/dist/cjs/google/protobuf/timestamp_pb.js +86 -123
- package/dist/cjs/google/protobuf/type_pb.js +406 -462
- package/dist/cjs/google/protobuf/wrappers_pb.js +407 -470
- package/dist/cjs/google/varint.js +166 -171
- package/dist/cjs/index.js +41 -122
- package/dist/cjs/json-format.js +13 -0
- package/dist/cjs/message-type.js +13 -0
- package/dist/cjs/message.js +89 -85
- package/dist/cjs/private/assert.js +33 -26
- package/dist/cjs/private/base64.js +93 -79
- package/dist/cjs/private/binary-format-common.js +208 -208
- package/dist/cjs/private/binary-format-proto2.js +88 -109
- package/dist/cjs/private/binary-format-proto3.js +70 -90
- package/dist/cjs/private/enum.js +77 -44
- package/dist/cjs/private/field-list.js +64 -50
- package/dist/cjs/private/field-wrapper.js +21 -10
- package/dist/cjs/private/field.js +35 -25
- package/dist/cjs/private/json-format-common.js +427 -440
- package/dist/cjs/private/json-format-proto2.js +91 -89
- package/dist/cjs/private/json-format-proto3.js +82 -93
- package/dist/cjs/private/message-type.js +39 -27
- package/dist/cjs/private/names.js +71 -62
- package/dist/cjs/private/options-map.js +13 -0
- package/dist/cjs/private/proto-runtime.js +25 -16
- package/dist/cjs/private/scalars.js +113 -103
- package/dist/cjs/private/util-common.js +193 -210
- package/dist/cjs/private/util.js +13 -0
- package/dist/cjs/proto-int64.js +123 -111
- package/dist/cjs/proto2.js +63 -63
- package/dist/cjs/proto3.js +74 -74
- package/dist/cjs/service-type.js +27 -17
- package/dist/cjs/type-registry.js +46 -31
- package/dist/esm/binary-encoding.js +414 -414
- package/dist/esm/binary-format.js +13 -0
- package/dist/esm/descriptor-registry.js +422 -458
- package/dist/esm/descriptor-set.js +430 -478
- package/dist/esm/enum.js +13 -0
- package/dist/esm/field-list.js +13 -0
- package/dist/esm/field.js +42 -29
- package/dist/esm/google/protobuf/any_pb.js +122 -140
- package/dist/esm/google/protobuf/api_pb.js +177 -197
- package/dist/esm/google/protobuf/compiler/plugin_pb.js +123 -216
- package/dist/esm/google/protobuf/descriptor_pb.js +1013 -1804
- package/dist/esm/google/protobuf/duration_pb.js +72 -88
- package/dist/esm/google/protobuf/empty_pb.js +17 -17
- package/dist/esm/google/protobuf/field_mask_pb.js +77 -94
- package/dist/esm/google/protobuf/source_context_pb.js +25 -25
- package/dist/esm/google/protobuf/struct_pb.js +143 -180
- package/dist/esm/google/protobuf/timestamp_pb.js +86 -123
- package/dist/esm/google/protobuf/type_pb.js +401 -421
- package/dist/esm/google/protobuf/wrappers_pb.js +406 -397
- package/dist/esm/google/varint.js +165 -164
- package/dist/esm/index.js +14 -1
- package/dist/esm/json-format.js +13 -0
- package/dist/esm/message-type.js +13 -0
- package/dist/esm/message.js +89 -85
- package/dist/esm/private/assert.js +32 -21
- package/dist/esm/private/base64.js +92 -78
- package/dist/esm/private/binary-format-common.js +209 -207
- package/dist/esm/private/binary-format-proto2.js +89 -81
- package/dist/esm/private/binary-format-proto3.js +71 -67
- package/dist/esm/private/enum.js +75 -43
- package/dist/esm/private/field-list.js +64 -50
- package/dist/esm/private/field-wrapper.js +21 -10
- package/dist/esm/private/field.js +35 -22
- package/dist/esm/private/json-format-common.js +427 -435
- package/dist/esm/private/json-format-proto2.js +89 -81
- package/dist/esm/private/json-format-proto3.js +79 -80
- package/dist/esm/private/message-type.js +40 -28
- package/dist/esm/private/names.js +70 -57
- package/dist/esm/private/options-map.js +13 -0
- package/dist/esm/private/proto-runtime.js +26 -12
- package/dist/esm/private/scalars.js +112 -99
- package/dist/esm/private/util-common.js +193 -192
- package/dist/esm/private/util.js +13 -0
- package/dist/esm/proto-int64.js +123 -111
- package/dist/esm/proto2.js +63 -57
- package/dist/esm/proto3.js +74 -68
- package/dist/esm/service-type.js +25 -12
- package/dist/esm/type-registry.js +46 -31
- package/dist/types/binary-encoding.d.ts +398 -398
- package/dist/types/binary-format.d.ts +69 -91
- package/dist/types/descriptor-registry.d.ts +23 -29
- package/dist/types/descriptor-set.d.ts +107 -128
- package/dist/types/enum.d.ts +21 -21
- package/dist/types/field-list.d.ts +21 -21
- package/dist/types/field.d.ts +191 -231
- package/dist/types/google/protobuf/any_pb.d.ts +56 -77
- package/dist/types/google/protobuf/api_pb.d.ts +144 -187
- package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +195 -257
- package/dist/types/google/protobuf/descriptor_pb.d.ts +1360 -1737
- package/dist/types/google/protobuf/duration_pb.d.ts +30 -50
- package/dist/types/google/protobuf/empty_pb.d.ts +9 -28
- package/dist/types/google/protobuf/field_mask_pb.d.ts +17 -37
- package/dist/types/google/protobuf/source_context_pb.d.ts +16 -35
- package/dist/types/google/protobuf/struct_pb.d.ts +64 -115
- package/dist/types/google/protobuf/timestamp_pb.d.ts +31 -51
- package/dist/types/google/protobuf/type_pb.d.ts +355 -422
- package/dist/types/google/protobuf/wrappers_pb.d.ts +181 -297
- package/dist/types/google/varint.d.ts +6 -13
- package/dist/types/index.d.ts +4 -27
- package/dist/types/json-format.d.ts +70 -89
- package/dist/types/message-type.d.ts +37 -45
- package/dist/types/message.d.ts +62 -87
- package/dist/types/private/assert.d.ts +1 -4
- package/dist/types/private/binary-format-common.d.ts +6 -32
- package/dist/types/private/enum.d.ts +13 -11
- package/dist/types/private/field-list.d.ts +14 -21
- package/dist/types/private/field-wrapper.d.ts +4 -10
- package/dist/types/private/field.d.ts +12 -12
- package/dist/types/private/json-format-common.d.ts +5 -27
- package/dist/types/private/message-type.d.ts +12 -7
- package/dist/types/private/names.d.ts +1 -4
- package/dist/types/private/options-map.d.ts +1 -1
- package/dist/types/private/proto-runtime.d.ts +34 -42
- package/dist/types/private/scalars.d.ts +5 -12
- package/dist/types/private/util-common.d.ts +1 -4
- package/dist/types/private/util.d.ts +29 -41
- package/dist/types/proto-int64.d.ts +42 -42
- package/dist/types/service-type.d.ts +36 -56
- package/dist/types/type-registry.d.ts +13 -15
- package/package.json +2 -3
package/dist/cjs/enum.js
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Copyright 2021-2022 Buf Technologies, Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
2
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/cjs/field-list.js
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Copyright 2021-2022 Buf Technologies, Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
2
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/cjs/field.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Copyright 2021-2022 Buf Technologies, Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
2
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
16
|
exports.ScalarType = void 0;
|
|
4
17
|
/**
|
|
@@ -8,33 +21,33 @@ exports.ScalarType = void 0;
|
|
|
8
21
|
*/
|
|
9
22
|
var ScalarType;
|
|
10
23
|
(function (ScalarType) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})(
|
|
24
|
+
// 0 is reserved for errors.
|
|
25
|
+
// Order is weird for historical reasons.
|
|
26
|
+
ScalarType[ScalarType["DOUBLE"] = 1] = "DOUBLE";
|
|
27
|
+
ScalarType[ScalarType["FLOAT"] = 2] = "FLOAT";
|
|
28
|
+
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
|
|
29
|
+
// negative values are likely.
|
|
30
|
+
ScalarType[ScalarType["INT64"] = 3] = "INT64";
|
|
31
|
+
ScalarType[ScalarType["UINT64"] = 4] = "UINT64";
|
|
32
|
+
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
|
|
33
|
+
// negative values are likely.
|
|
34
|
+
ScalarType[ScalarType["INT32"] = 5] = "INT32";
|
|
35
|
+
ScalarType[ScalarType["FIXED64"] = 6] = "FIXED64";
|
|
36
|
+
ScalarType[ScalarType["FIXED32"] = 7] = "FIXED32";
|
|
37
|
+
ScalarType[ScalarType["BOOL"] = 8] = "BOOL";
|
|
38
|
+
ScalarType[ScalarType["STRING"] = 9] = "STRING";
|
|
39
|
+
// Tag-delimited aggregate.
|
|
40
|
+
// Group type is deprecated and not supported in proto3. However, Proto3
|
|
41
|
+
// implementations should still be able to parse the group wire format and
|
|
42
|
+
// treat group fields as unknown fields.
|
|
43
|
+
// TYPE_GROUP = 10,
|
|
44
|
+
// TYPE_MESSAGE = 11, // Length-delimited aggregate.
|
|
45
|
+
// New in version 2.
|
|
46
|
+
ScalarType[ScalarType["BYTES"] = 12] = "BYTES";
|
|
47
|
+
ScalarType[ScalarType["UINT32"] = 13] = "UINT32";
|
|
48
|
+
// TYPE_ENUM = 14,
|
|
49
|
+
ScalarType[ScalarType["SFIXED32"] = 15] = "SFIXED32";
|
|
50
|
+
ScalarType[ScalarType["SFIXED64"] = 16] = "SFIXED64";
|
|
51
|
+
ScalarType[ScalarType["SINT32"] = 17] = "SINT32";
|
|
52
|
+
ScalarType[ScalarType["SINT64"] = 18] = "SINT64";
|
|
53
|
+
})(ScalarType = exports.ScalarType || (exports.ScalarType = {}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
// @generated by protoc-gen-es v0.0.
|
|
3
|
+
// @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
4
4
|
// @generated from file google/protobuf/any.proto (package google.protobuf, syntax proto3)
|
|
5
5
|
//
|
|
6
6
|
// Protocol Buffers - Google's data interchange format
|
|
@@ -123,158 +123,140 @@ const index_js_1 = require("../../index.js");
|
|
|
123
123
|
* @generated from message google.protobuf.Any
|
|
124
124
|
*/
|
|
125
125
|
class Any extends index_js_1.Message {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
toJson(options) {
|
|
170
|
-
if (this.typeUrl === "") {
|
|
171
|
-
return {};
|
|
126
|
+
constructor(data) {
|
|
127
|
+
super();
|
|
128
|
+
/**
|
|
129
|
+
* A URL/resource name that uniquely identifies the type of the serialized
|
|
130
|
+
* protocol buffer message. This string must contain at least
|
|
131
|
+
* one "/" character. The last segment of the URL's path must represent
|
|
132
|
+
* the fully qualified name of the type (as in
|
|
133
|
+
* `path/google.protobuf.Duration`). The name should be in a canonical form
|
|
134
|
+
* (e.g., leading "." is not accepted).
|
|
135
|
+
*
|
|
136
|
+
* In practice, teams usually precompile into the binary all types that they
|
|
137
|
+
* expect it to use in the context of Any. However, for URLs which use the
|
|
138
|
+
* scheme `http`, `https`, or no scheme, one can optionally set up a type
|
|
139
|
+
* server that maps type URLs to message definitions as follows:
|
|
140
|
+
*
|
|
141
|
+
* * If no scheme is provided, `https` is assumed.
|
|
142
|
+
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
|
143
|
+
* value in binary format, or produce an error.
|
|
144
|
+
* * Applications are allowed to cache lookup results based on the
|
|
145
|
+
* URL, or have them precompiled into a binary to avoid any
|
|
146
|
+
* lookup. Therefore, binary compatibility needs to be preserved
|
|
147
|
+
* on changes to types. (Use versioned type names to manage
|
|
148
|
+
* breaking changes.)
|
|
149
|
+
*
|
|
150
|
+
* Note: this functionality is not currently available in the official
|
|
151
|
+
* protobuf release, and it is not used for type URLs beginning with
|
|
152
|
+
* type.googleapis.com.
|
|
153
|
+
*
|
|
154
|
+
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
155
|
+
* used with implementation specific semantics.
|
|
156
|
+
*
|
|
157
|
+
*
|
|
158
|
+
* @generated from field: string type_url = 1;
|
|
159
|
+
*/
|
|
160
|
+
this.typeUrl = "";
|
|
161
|
+
/**
|
|
162
|
+
* Must be a valid serialized protocol buffer of the above specified type.
|
|
163
|
+
*
|
|
164
|
+
* @generated from field: bytes value = 2;
|
|
165
|
+
*/
|
|
166
|
+
this.value = new Uint8Array(0);
|
|
167
|
+
index_js_1.proto3.util.initPartial(data, this);
|
|
172
168
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
169
|
+
toJson(options) {
|
|
170
|
+
if (this.typeUrl === "") {
|
|
171
|
+
return {};
|
|
172
|
+
}
|
|
173
|
+
const typeName = this.typeUrlToName(this.typeUrl);
|
|
174
|
+
const messageType = options?.typeRegistry?.findMessage(typeName);
|
|
175
|
+
if (!messageType) {
|
|
176
|
+
throw new Error(`cannot encode message google.protobuf.Any to JSON: "${this.typeUrl}" is not in the type registry`);
|
|
177
|
+
}
|
|
178
|
+
const message = messageType.fromBinary(this.value);
|
|
179
|
+
let json = message.toJson(options);
|
|
180
|
+
if (typeName.startsWith("google.protobuf.") || (json === null || Array.isArray(json) || typeof json !== "object")) {
|
|
181
|
+
json = { value: json };
|
|
182
|
+
}
|
|
183
|
+
json["@type"] = this.typeUrl;
|
|
184
|
+
return json;
|
|
179
185
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
fromJson(json, options) {
|
|
187
|
+
if (json === null || Array.isArray(json) || typeof json != "object") {
|
|
188
|
+
throw new Error(`cannot decode message google.protobuf.Any from JSON: expected object but got ${json === null ? "null" : Array.isArray(json) ? "array" : typeof json}`);
|
|
189
|
+
}
|
|
190
|
+
const typeUrl = json["@type"];
|
|
191
|
+
if (typeof typeUrl != "string" || typeUrl == "") {
|
|
192
|
+
throw new Error(`cannot decode message google.protobuf.Any from JSON: "@type" is empty`);
|
|
193
|
+
}
|
|
194
|
+
const typeName = this.typeUrlToName(typeUrl), messageType = options?.typeRegistry?.findMessage(typeName);
|
|
195
|
+
if (!messageType) {
|
|
196
|
+
throw new Error(`cannot decode message google.protobuf.Any from JSON: ${typeUrl} is not in the type registry`);
|
|
197
|
+
}
|
|
198
|
+
let message;
|
|
199
|
+
if (typeName.startsWith("google.protobuf.") && Object.prototype.hasOwnProperty.call(json, "value")) {
|
|
200
|
+
message = messageType.fromJson(json["value"], options);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
const copy = Object.assign({}, json);
|
|
204
|
+
delete copy["@type"];
|
|
205
|
+
message = messageType.fromJson(copy, options);
|
|
206
|
+
}
|
|
207
|
+
this.packFrom(message);
|
|
208
|
+
return this;
|
|
189
209
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
fromJson(json, options) {
|
|
194
|
-
if (json === null || Array.isArray(json) || typeof json != "object") {
|
|
195
|
-
throw new Error(
|
|
196
|
-
`cannot decode message google.protobuf.Any from JSON: expected object but got ${
|
|
197
|
-
json === null ? "null" : Array.isArray(json) ? "array" : typeof json
|
|
198
|
-
}`
|
|
199
|
-
);
|
|
210
|
+
packFrom(message) {
|
|
211
|
+
this.value = message.toBinary();
|
|
212
|
+
this.typeUrl = this.typeNameToUrl(message.getType().typeName);
|
|
200
213
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
214
|
+
unpackTo(target) {
|
|
215
|
+
if (!this.is(target.getType())) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
target.fromBinary(this.value);
|
|
219
|
+
return true;
|
|
206
220
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (!messageType) {
|
|
210
|
-
throw new Error(
|
|
211
|
-
`cannot decode message google.protobuf.Any from JSON: ${typeUrl} is not in the type registry`
|
|
212
|
-
);
|
|
221
|
+
is(type) {
|
|
222
|
+
return this.typeUrl === this.typeNameToUrl(type.typeName);
|
|
213
223
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
typeName.startsWith("google.protobuf.") &&
|
|
217
|
-
Object.prototype.hasOwnProperty.call(json, "value")
|
|
218
|
-
) {
|
|
219
|
-
message = messageType.fromJson(json["value"], options);
|
|
220
|
-
} else {
|
|
221
|
-
const copy = Object.assign({}, json);
|
|
222
|
-
delete copy["@type"];
|
|
223
|
-
message = messageType.fromJson(copy, options);
|
|
224
|
+
typeNameToUrl(name) {
|
|
225
|
+
return `type.googleapis.com/${name}`;
|
|
224
226
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
227
|
+
typeUrlToName(url) {
|
|
228
|
+
if (!url.length) {
|
|
229
|
+
throw new Error(`invalid type url: ${url}`);
|
|
230
|
+
}
|
|
231
|
+
const slash = url.lastIndexOf("/");
|
|
232
|
+
const name = slash > 0 ? url.substring(slash + 1) : url;
|
|
233
|
+
if (!name.length) {
|
|
234
|
+
throw new Error(`invalid type url: ${url}`);
|
|
235
|
+
}
|
|
236
|
+
return name;
|
|
235
237
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return this.typeUrl === this.typeNameToUrl(type.typeName);
|
|
241
|
-
}
|
|
242
|
-
typeNameToUrl(name) {
|
|
243
|
-
return `type.googleapis.com/${name}`;
|
|
244
|
-
}
|
|
245
|
-
typeUrlToName(url) {
|
|
246
|
-
if (!url.length) {
|
|
247
|
-
throw new Error(`invalid type url: ${url}`);
|
|
238
|
+
static pack(message) {
|
|
239
|
+
const any = new Any();
|
|
240
|
+
any.packFrom(message);
|
|
241
|
+
return any;
|
|
248
242
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
243
|
+
static fromBinary(bytes, options) {
|
|
244
|
+
return new Any().fromBinary(bytes, options);
|
|
245
|
+
}
|
|
246
|
+
static fromJson(jsonValue, options) {
|
|
247
|
+
return new Any().fromJson(jsonValue, options);
|
|
248
|
+
}
|
|
249
|
+
static fromJsonString(jsonString, options) {
|
|
250
|
+
return new Any().fromJsonString(jsonString, options);
|
|
251
|
+
}
|
|
252
|
+
static equals(a, b) {
|
|
253
|
+
return index_js_1.proto3.util.equals(Any, a, b);
|
|
253
254
|
}
|
|
254
|
-
return name;
|
|
255
|
-
}
|
|
256
|
-
static pack(message) {
|
|
257
|
-
const any = new Any();
|
|
258
|
-
any.packFrom(message);
|
|
259
|
-
return any;
|
|
260
|
-
}
|
|
261
|
-
static fromBinary(bytes, options) {
|
|
262
|
-
return new Any().fromBinary(bytes, options);
|
|
263
|
-
}
|
|
264
|
-
static fromJson(jsonValue, options) {
|
|
265
|
-
return new Any().fromJson(jsonValue, options);
|
|
266
|
-
}
|
|
267
|
-
static fromJsonString(jsonString, options) {
|
|
268
|
-
return new Any().fromJsonString(jsonString, options);
|
|
269
|
-
}
|
|
270
|
-
static equals(a, b) {
|
|
271
|
-
return index_js_1.proto3.util.equals(Any, a, b);
|
|
272
|
-
}
|
|
273
255
|
}
|
|
274
256
|
exports.Any = Any;
|
|
275
257
|
Any.runtime = index_js_1.proto3;
|
|
276
258
|
Any.typeName = "google.protobuf.Any";
|
|
277
259
|
Any.fields = index_js_1.proto3.util.newFieldList(() => [
|
|
278
|
-
|
|
279
|
-
|
|
260
|
+
{ no: 1, name: "type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
261
|
+
{ no: 2, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
|
|
280
262
|
]);
|