@bufbuild/protobuf 0.5.0 → 1.1.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.
- package/README.md +2 -2
- package/dist/cjs/binary-encoding.js +1 -1
- package/dist/cjs/binary-format.js +1 -1
- package/dist/cjs/codegen-info.js +1 -1
- package/dist/cjs/create-descriptor-set.js +1 -1
- package/dist/cjs/create-registry-from-desc.js +1 -1
- package/dist/cjs/create-registry.js +1 -1
- package/dist/cjs/descriptor-set.js +1 -1
- package/dist/cjs/enum.js +1 -1
- package/dist/cjs/field-list.js +1 -1
- package/dist/cjs/field.js +1 -1
- package/dist/cjs/google/protobuf/any_pb.js +5 -2
- package/dist/cjs/google/protobuf/api_pb.js +1 -2
- package/dist/cjs/google/protobuf/compiler/plugin_pb.js +1 -1
- package/dist/cjs/google/protobuf/descriptor_pb.js +134 -2
- package/dist/cjs/google/protobuf/duration_pb.js +5 -3
- package/dist/cjs/google/protobuf/empty_pb.js +1 -1
- package/dist/cjs/google/protobuf/field_mask_pb.js +1 -1
- package/dist/cjs/google/protobuf/source_context_pb.js +1 -1
- package/dist/cjs/google/protobuf/struct_pb.js +8 -3
- package/dist/cjs/google/protobuf/timestamp_pb.js +1 -4
- package/dist/cjs/google/protobuf/type_pb.js +2 -2
- package/dist/cjs/google/protobuf/wrappers_pb.js +1 -1
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/json-format.js +1 -1
- package/dist/cjs/message-type.js +1 -1
- package/dist/cjs/message.js +5 -3
- package/dist/cjs/private/assert.js +1 -1
- package/dist/cjs/private/binary-format-common.js +1 -1
- package/dist/cjs/private/binary-format-proto2.js +1 -1
- package/dist/cjs/private/binary-format-proto3.js +1 -1
- package/dist/cjs/private/enum.js +1 -1
- package/dist/cjs/private/field-list.js +1 -1
- package/dist/cjs/private/field-wrapper.js +1 -1
- package/dist/cjs/private/field.js +1 -1
- package/dist/cjs/private/json-format-common.js +1 -1
- package/dist/cjs/private/json-format-proto2.js +1 -1
- package/dist/cjs/private/json-format-proto3.js +1 -1
- package/dist/cjs/private/message-type.js +1 -1
- package/dist/cjs/private/names.js +1 -1
- package/dist/cjs/private/options-map.js +1 -1
- package/dist/cjs/private/proto-runtime.js +1 -1
- package/dist/cjs/private/reify-wkt.js +1 -1
- package/dist/cjs/private/scalars.js +1 -1
- package/dist/cjs/private/util-common.js +1 -1
- package/dist/cjs/private/util.js +1 -1
- package/dist/cjs/proto-base64.js +1 -1
- package/dist/cjs/proto-delimited.js +160 -0
- package/dist/cjs/proto-int64.js +1 -1
- package/dist/cjs/proto2.js +1 -1
- package/dist/cjs/proto3.js +1 -1
- package/dist/cjs/service-type.js +1 -1
- package/dist/cjs/type-registry.js +1 -1
- package/dist/esm/binary-encoding.js +1 -1
- package/dist/esm/binary-format.js +1 -1
- package/dist/esm/codegen-info.js +1 -1
- package/dist/esm/create-descriptor-set.js +1 -1
- package/dist/esm/create-registry-from-desc.js +1 -1
- package/dist/esm/create-registry.js +1 -1
- package/dist/esm/descriptor-set.js +1 -1
- package/dist/esm/enum.js +1 -1
- package/dist/esm/field-list.js +1 -1
- package/dist/esm/field.js +1 -1
- package/dist/esm/google/protobuf/any_pb.js +5 -2
- package/dist/esm/google/protobuf/api_pb.js +1 -2
- package/dist/esm/google/protobuf/compiler/plugin_pb.js +1 -1
- package/dist/esm/google/protobuf/descriptor_pb.js +133 -1
- package/dist/esm/google/protobuf/duration_pb.js +5 -3
- package/dist/esm/google/protobuf/empty_pb.js +1 -1
- package/dist/esm/google/protobuf/field_mask_pb.js +1 -1
- package/dist/esm/google/protobuf/source_context_pb.js +1 -1
- package/dist/esm/google/protobuf/struct_pb.js +8 -3
- package/dist/esm/google/protobuf/timestamp_pb.js +1 -4
- package/dist/esm/google/protobuf/type_pb.js +2 -2
- package/dist/esm/google/protobuf/wrappers_pb.js +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/json-format.js +1 -1
- package/dist/esm/message-type.js +1 -1
- package/dist/esm/message.js +5 -3
- package/dist/esm/private/assert.js +1 -1
- package/dist/esm/private/binary-format-common.js +1 -1
- package/dist/esm/private/binary-format-proto2.js +1 -1
- package/dist/esm/private/binary-format-proto3.js +1 -1
- package/dist/esm/private/enum.js +1 -1
- package/dist/esm/private/field-list.js +1 -1
- package/dist/esm/private/field-wrapper.js +1 -1
- package/dist/esm/private/field.js +1 -1
- package/dist/esm/private/json-format-common.js +1 -1
- package/dist/esm/private/json-format-proto2.js +1 -1
- package/dist/esm/private/json-format-proto3.js +1 -1
- package/dist/esm/private/message-type.js +1 -1
- package/dist/esm/private/names.js +1 -1
- package/dist/esm/private/options-map.js +1 -1
- package/dist/esm/private/proto-runtime.js +1 -1
- package/dist/esm/private/reify-wkt.js +1 -1
- package/dist/esm/private/scalars.js +1 -1
- package/dist/esm/private/util-common.js +1 -1
- package/dist/esm/private/util.js +1 -1
- package/dist/esm/proto-base64.js +1 -1
- package/dist/esm/proto-delimited.js +157 -0
- package/dist/esm/proto-int64.js +1 -1
- package/dist/esm/proto2.js +1 -1
- package/dist/esm/proto3.js +1 -1
- package/dist/esm/service-type.js +1 -1
- package/dist/esm/type-registry.js +1 -1
- package/dist/types/google/protobuf/any_pb.d.ts +6 -2
- package/dist/types/google/protobuf/api_pb.d.ts +4 -4
- package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +5 -4
- package/dist/types/google/protobuf/descriptor_pb.d.ts +188 -39
- package/dist/types/google/protobuf/duration_pb.d.ts +2 -2
- package/dist/types/google/protobuf/empty_pb.d.ts +2 -1
- package/dist/types/google/protobuf/field_mask_pb.d.ts +2 -1
- package/dist/types/google/protobuf/source_context_pb.d.ts +2 -1
- package/dist/types/google/protobuf/struct_pb.d.ts +4 -3
- package/dist/types/google/protobuf/timestamp_pb.d.ts +2 -4
- package/dist/types/google/protobuf/type_pb.d.ts +6 -5
- package/dist/types/google/protobuf/wrappers_pb.d.ts +10 -9
- package/dist/types/index.d.ts +1 -0
- package/dist/types/message.d.ts +4 -2
- package/dist/types/proto-delimited.d.ts +54 -0
- package/package.json +1 -1
package/dist/cjs/private/util.js
CHANGED
package/dist/cjs/proto-base64.js
CHANGED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2021-2023 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.
|
|
15
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
16
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
17
|
+
var m = o[Symbol.asyncIterator], i;
|
|
18
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
19
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
20
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
21
|
+
};
|
|
22
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
23
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
24
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
25
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
26
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
27
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
28
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
29
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
30
|
+
function fulfill(value) { resume("next", value); }
|
|
31
|
+
function reject(value) { resume("throw", value); }
|
|
32
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.protoDelimited = void 0;
|
|
36
|
+
const binary_format_common_js_1 = require("./private/binary-format-common.js");
|
|
37
|
+
const binary_encoding_js_1 = require("./binary-encoding.js");
|
|
38
|
+
/**
|
|
39
|
+
* protoDelimited provides functions to serialize and parse size-delimited
|
|
40
|
+
* messages.
|
|
41
|
+
*
|
|
42
|
+
* A size-delimited message is a varint size in bytes, followed by exactly
|
|
43
|
+
* that many bytes of a message serialized with the binary format.
|
|
44
|
+
*
|
|
45
|
+
* This size-delimited format is compatible with other implementations.
|
|
46
|
+
* For details, see https://github.com/protocolbuffers/protobuf/issues/10229
|
|
47
|
+
*/
|
|
48
|
+
exports.protoDelimited = {
|
|
49
|
+
/**
|
|
50
|
+
* Serialize a message, prefixing it with its size.
|
|
51
|
+
*/
|
|
52
|
+
enc(message, options) {
|
|
53
|
+
const opt = (0, binary_format_common_js_1.makeBinaryFormatCommon)().makeWriteOptions(options);
|
|
54
|
+
return opt.writerFactory().bytes(message.toBinary(opt)).finish();
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Parse a size-delimited message, ignoring extra bytes.
|
|
58
|
+
*/
|
|
59
|
+
dec(type, bytes, options) {
|
|
60
|
+
const opt = (0, binary_format_common_js_1.makeBinaryFormatCommon)().makeReadOptions(options);
|
|
61
|
+
return type.fromBinary(opt.readerFactory(bytes).bytes(), opt);
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Parse a stream of size-delimited messages.
|
|
65
|
+
*/
|
|
66
|
+
decStream(type, iterable) {
|
|
67
|
+
return __asyncGenerator(this, arguments, function* decStream_1() {
|
|
68
|
+
var _a, e_1, _b, _c;
|
|
69
|
+
// append chunk to buffer, returning updated buffer
|
|
70
|
+
function append(buffer, chunk) {
|
|
71
|
+
const n = new Uint8Array(buffer.byteLength + chunk.byteLength);
|
|
72
|
+
n.set(buffer);
|
|
73
|
+
n.set(chunk, buffer.length);
|
|
74
|
+
return n;
|
|
75
|
+
}
|
|
76
|
+
let buffer = new Uint8Array(0);
|
|
77
|
+
try {
|
|
78
|
+
for (var _d = true, iterable_1 = __asyncValues(iterable), iterable_1_1; iterable_1_1 = yield __await(iterable_1.next()), _a = iterable_1_1.done, !_a;) {
|
|
79
|
+
_c = iterable_1_1.value;
|
|
80
|
+
_d = false;
|
|
81
|
+
try {
|
|
82
|
+
const chunk = _c;
|
|
83
|
+
buffer = append(buffer, chunk);
|
|
84
|
+
for (;;) {
|
|
85
|
+
const size = exports.protoDelimited.peekSize(buffer);
|
|
86
|
+
if (size.eof) {
|
|
87
|
+
// size is incomplete, buffer more data
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (size.offset + size.size > buffer.byteLength) {
|
|
91
|
+
// message is incomplete, buffer more data
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
yield yield __await(exports.protoDelimited.dec(type, buffer));
|
|
95
|
+
buffer = buffer.subarray(size.offset + size.size);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
_d = true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
104
|
+
finally {
|
|
105
|
+
try {
|
|
106
|
+
if (!_d && !_a && (_b = iterable_1.return)) yield __await(_b.call(iterable_1));
|
|
107
|
+
}
|
|
108
|
+
finally { if (e_1) throw e_1.error; }
|
|
109
|
+
}
|
|
110
|
+
if (buffer.byteLength > 0) {
|
|
111
|
+
throw new Error("incomplete data");
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
/**
|
|
116
|
+
* Decodes the size from the given size-delimited message, which may be
|
|
117
|
+
* incomplete.
|
|
118
|
+
*
|
|
119
|
+
* Returns an object with the following properties:
|
|
120
|
+
* - size: The size of the delimited message in bytes
|
|
121
|
+
* - offset: The offset in the given byte array where the message starts
|
|
122
|
+
* - eof: true
|
|
123
|
+
*
|
|
124
|
+
* If the size-delimited data does not include all bytes of the varint size,
|
|
125
|
+
* the following object is returned:
|
|
126
|
+
* - size: null
|
|
127
|
+
* - offset: null
|
|
128
|
+
* - eof: false
|
|
129
|
+
*
|
|
130
|
+
* This function can be used to implement parsing of size-delimited messages
|
|
131
|
+
* from a stream.
|
|
132
|
+
*/
|
|
133
|
+
peekSize(data) {
|
|
134
|
+
const sizeEof = { eof: true, size: null, offset: null };
|
|
135
|
+
for (let i = 0; i < 10; i++) {
|
|
136
|
+
if (i > data.byteLength) {
|
|
137
|
+
return sizeEof;
|
|
138
|
+
}
|
|
139
|
+
if ((data[i] & 0x80) == 0) {
|
|
140
|
+
const reader = new binary_encoding_js_1.BinaryReader(data);
|
|
141
|
+
let size;
|
|
142
|
+
try {
|
|
143
|
+
size = reader.uint32();
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
if (e instanceof RangeError) {
|
|
147
|
+
return sizeEof;
|
|
148
|
+
}
|
|
149
|
+
throw e;
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
eof: false,
|
|
153
|
+
size,
|
|
154
|
+
offset: reader.pos,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
throw new Error("invalid varint");
|
|
159
|
+
},
|
|
160
|
+
};
|
package/dist/cjs/proto-int64.js
CHANGED
package/dist/cjs/proto2.js
CHANGED
package/dist/cjs/proto3.js
CHANGED
package/dist/cjs/service-type.js
CHANGED
package/dist/esm/codegen-info.js
CHANGED
package/dist/esm/enum.js
CHANGED
package/dist/esm/field-list.js
CHANGED
package/dist/esm/field.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2021-
|
|
1
|
+
// Copyright 2021-2023 Buf Technologies, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -38,6 +38,10 @@ import { proto3 } from "../../proto3.js";
|
|
|
38
38
|
* if (any.is(Foo.class)) {
|
|
39
39
|
* foo = any.unpack(Foo.class);
|
|
40
40
|
* }
|
|
41
|
+
* // or ...
|
|
42
|
+
* if (any.isSameTypeAs(Foo.getDefaultInstance())) {
|
|
43
|
+
* foo = any.unpack(Foo.getDefaultInstance());
|
|
44
|
+
* }
|
|
41
45
|
*
|
|
42
46
|
* Example 3: Pack and unpack a message in Python.
|
|
43
47
|
*
|
|
@@ -68,7 +72,6 @@ import { proto3 } from "../../proto3.js";
|
|
|
68
72
|
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
69
73
|
* name "y.z".
|
|
70
74
|
*
|
|
71
|
-
*
|
|
72
75
|
* JSON
|
|
73
76
|
*
|
|
74
77
|
* The JSON representation of an `Any` value uses the regular
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2021-
|
|
1
|
+
// Copyright 2021-2023 Buf Technologies, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -72,7 +72,6 @@ export class Api extends Message {
|
|
|
72
72
|
* experimental, non-GA interfaces.
|
|
73
73
|
*
|
|
74
74
|
*
|
|
75
|
-
*
|
|
76
75
|
* @generated from field: string version = 4;
|
|
77
76
|
*/
|
|
78
77
|
this.version = "";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2021-
|
|
1
|
+
// Copyright 2021-2023 Buf Technologies, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -121,6 +121,7 @@ FileDescriptorProto.fields = proto2.util.newFieldList(() => [
|
|
|
121
121
|
{ no: 8, name: "options", kind: "message", T: FileOptions, opt: true },
|
|
122
122
|
{ no: 9, name: "source_code_info", kind: "message", T: SourceCodeInfo, opt: true },
|
|
123
123
|
{ no: 12, name: "syntax", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
124
|
+
{ no: 13, name: "edition", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
124
125
|
]);
|
|
125
126
|
/**
|
|
126
127
|
* Describes a message type.
|
|
@@ -802,6 +803,7 @@ MessageOptions.fields = proto2.util.newFieldList(() => [
|
|
|
802
803
|
{ no: 2, name: "no_standard_descriptor_accessor", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true, default: false },
|
|
803
804
|
{ no: 3, name: "deprecated", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true, default: false },
|
|
804
805
|
{ no: 7, name: "map_entry", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true },
|
|
806
|
+
{ no: 11, name: "deprecated_legacy_json_field_conflicts", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true },
|
|
805
807
|
{ no: 999, name: "uninterpreted_option", kind: "message", T: UninterpretedOption, repeated: true },
|
|
806
808
|
]);
|
|
807
809
|
/**
|
|
@@ -841,6 +843,9 @@ FieldOptions.fields = proto2.util.newFieldList(() => [
|
|
|
841
843
|
{ no: 15, name: "unverified_lazy", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true, default: false },
|
|
842
844
|
{ no: 3, name: "deprecated", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true, default: false },
|
|
843
845
|
{ no: 10, name: "weak", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true, default: false },
|
|
846
|
+
{ no: 16, name: "debug_redact", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true, default: false },
|
|
847
|
+
{ no: 17, name: "retention", kind: "enum", T: proto2.getEnumType(FieldOptions_OptionRetention), opt: true },
|
|
848
|
+
{ no: 18, name: "target", kind: "enum", T: proto2.getEnumType(FieldOptions_OptionTargetType), opt: true },
|
|
844
849
|
{ no: 999, name: "uninterpreted_option", kind: "message", T: UninterpretedOption, repeated: true },
|
|
845
850
|
]);
|
|
846
851
|
/**
|
|
@@ -899,6 +904,98 @@ proto2.util.setEnumType(FieldOptions_JSType, "google.protobuf.FieldOptions.JSTyp
|
|
|
899
904
|
{ no: 1, name: "JS_STRING" },
|
|
900
905
|
{ no: 2, name: "JS_NUMBER" },
|
|
901
906
|
]);
|
|
907
|
+
/**
|
|
908
|
+
* If set to RETENTION_SOURCE, the option will be omitted from the binary.
|
|
909
|
+
* Note: as of January 2023, support for this is in progress and does not yet
|
|
910
|
+
* have an effect (b/264593489).
|
|
911
|
+
*
|
|
912
|
+
* @generated from enum google.protobuf.FieldOptions.OptionRetention
|
|
913
|
+
*/
|
|
914
|
+
export var FieldOptions_OptionRetention;
|
|
915
|
+
(function (FieldOptions_OptionRetention) {
|
|
916
|
+
/**
|
|
917
|
+
* @generated from enum value: RETENTION_UNKNOWN = 0;
|
|
918
|
+
*/
|
|
919
|
+
FieldOptions_OptionRetention[FieldOptions_OptionRetention["RETENTION_UNKNOWN"] = 0] = "RETENTION_UNKNOWN";
|
|
920
|
+
/**
|
|
921
|
+
* @generated from enum value: RETENTION_RUNTIME = 1;
|
|
922
|
+
*/
|
|
923
|
+
FieldOptions_OptionRetention[FieldOptions_OptionRetention["RETENTION_RUNTIME"] = 1] = "RETENTION_RUNTIME";
|
|
924
|
+
/**
|
|
925
|
+
* @generated from enum value: RETENTION_SOURCE = 2;
|
|
926
|
+
*/
|
|
927
|
+
FieldOptions_OptionRetention[FieldOptions_OptionRetention["RETENTION_SOURCE"] = 2] = "RETENTION_SOURCE";
|
|
928
|
+
})(FieldOptions_OptionRetention || (FieldOptions_OptionRetention = {}));
|
|
929
|
+
// Retrieve enum metadata with: proto2.getEnumType(FieldOptions_OptionRetention)
|
|
930
|
+
proto2.util.setEnumType(FieldOptions_OptionRetention, "google.protobuf.FieldOptions.OptionRetention", [
|
|
931
|
+
{ no: 0, name: "RETENTION_UNKNOWN" },
|
|
932
|
+
{ no: 1, name: "RETENTION_RUNTIME" },
|
|
933
|
+
{ no: 2, name: "RETENTION_SOURCE" },
|
|
934
|
+
]);
|
|
935
|
+
/**
|
|
936
|
+
* This indicates the types of entities that the field may apply to when used
|
|
937
|
+
* as an option. If it is unset, then the field may be freely used as an
|
|
938
|
+
* option on any kind of entity. Note: as of January 2023, support for this is
|
|
939
|
+
* in progress and does not yet have an effect (b/264593489).
|
|
940
|
+
*
|
|
941
|
+
* @generated from enum google.protobuf.FieldOptions.OptionTargetType
|
|
942
|
+
*/
|
|
943
|
+
export var FieldOptions_OptionTargetType;
|
|
944
|
+
(function (FieldOptions_OptionTargetType) {
|
|
945
|
+
/**
|
|
946
|
+
* @generated from enum value: TARGET_TYPE_UNKNOWN = 0;
|
|
947
|
+
*/
|
|
948
|
+
FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_UNKNOWN"] = 0] = "TARGET_TYPE_UNKNOWN";
|
|
949
|
+
/**
|
|
950
|
+
* @generated from enum value: TARGET_TYPE_FILE = 1;
|
|
951
|
+
*/
|
|
952
|
+
FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_FILE"] = 1] = "TARGET_TYPE_FILE";
|
|
953
|
+
/**
|
|
954
|
+
* @generated from enum value: TARGET_TYPE_EXTENSION_RANGE = 2;
|
|
955
|
+
*/
|
|
956
|
+
FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_EXTENSION_RANGE"] = 2] = "TARGET_TYPE_EXTENSION_RANGE";
|
|
957
|
+
/**
|
|
958
|
+
* @generated from enum value: TARGET_TYPE_MESSAGE = 3;
|
|
959
|
+
*/
|
|
960
|
+
FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_MESSAGE"] = 3] = "TARGET_TYPE_MESSAGE";
|
|
961
|
+
/**
|
|
962
|
+
* @generated from enum value: TARGET_TYPE_FIELD = 4;
|
|
963
|
+
*/
|
|
964
|
+
FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_FIELD"] = 4] = "TARGET_TYPE_FIELD";
|
|
965
|
+
/**
|
|
966
|
+
* @generated from enum value: TARGET_TYPE_ONEOF = 5;
|
|
967
|
+
*/
|
|
968
|
+
FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_ONEOF"] = 5] = "TARGET_TYPE_ONEOF";
|
|
969
|
+
/**
|
|
970
|
+
* @generated from enum value: TARGET_TYPE_ENUM = 6;
|
|
971
|
+
*/
|
|
972
|
+
FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_ENUM"] = 6] = "TARGET_TYPE_ENUM";
|
|
973
|
+
/**
|
|
974
|
+
* @generated from enum value: TARGET_TYPE_ENUM_ENTRY = 7;
|
|
975
|
+
*/
|
|
976
|
+
FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_ENUM_ENTRY"] = 7] = "TARGET_TYPE_ENUM_ENTRY";
|
|
977
|
+
/**
|
|
978
|
+
* @generated from enum value: TARGET_TYPE_SERVICE = 8;
|
|
979
|
+
*/
|
|
980
|
+
FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_SERVICE"] = 8] = "TARGET_TYPE_SERVICE";
|
|
981
|
+
/**
|
|
982
|
+
* @generated from enum value: TARGET_TYPE_METHOD = 9;
|
|
983
|
+
*/
|
|
984
|
+
FieldOptions_OptionTargetType[FieldOptions_OptionTargetType["TARGET_TYPE_METHOD"] = 9] = "TARGET_TYPE_METHOD";
|
|
985
|
+
})(FieldOptions_OptionTargetType || (FieldOptions_OptionTargetType = {}));
|
|
986
|
+
// Retrieve enum metadata with: proto2.getEnumType(FieldOptions_OptionTargetType)
|
|
987
|
+
proto2.util.setEnumType(FieldOptions_OptionTargetType, "google.protobuf.FieldOptions.OptionTargetType", [
|
|
988
|
+
{ no: 0, name: "TARGET_TYPE_UNKNOWN" },
|
|
989
|
+
{ no: 1, name: "TARGET_TYPE_FILE" },
|
|
990
|
+
{ no: 2, name: "TARGET_TYPE_EXTENSION_RANGE" },
|
|
991
|
+
{ no: 3, name: "TARGET_TYPE_MESSAGE" },
|
|
992
|
+
{ no: 4, name: "TARGET_TYPE_FIELD" },
|
|
993
|
+
{ no: 5, name: "TARGET_TYPE_ONEOF" },
|
|
994
|
+
{ no: 6, name: "TARGET_TYPE_ENUM" },
|
|
995
|
+
{ no: 7, name: "TARGET_TYPE_ENUM_ENTRY" },
|
|
996
|
+
{ no: 8, name: "TARGET_TYPE_SERVICE" },
|
|
997
|
+
{ no: 9, name: "TARGET_TYPE_METHOD" },
|
|
998
|
+
]);
|
|
902
999
|
/**
|
|
903
1000
|
* @generated from message google.protobuf.OneofOptions
|
|
904
1001
|
*/
|
|
@@ -963,6 +1060,7 @@ EnumOptions.typeName = "google.protobuf.EnumOptions";
|
|
|
963
1060
|
EnumOptions.fields = proto2.util.newFieldList(() => [
|
|
964
1061
|
{ no: 2, name: "allow_alias", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true },
|
|
965
1062
|
{ no: 3, name: "deprecated", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true, default: false },
|
|
1063
|
+
{ no: 6, name: "deprecated_legacy_json_field_conflicts", kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true },
|
|
966
1064
|
{ no: 999, name: "uninterpreted_option", kind: "message", T: UninterpretedOption, repeated: true },
|
|
967
1065
|
]);
|
|
968
1066
|
/**
|
|
@@ -1394,4 +1492,38 @@ GeneratedCodeInfo_Annotation.fields = proto2.util.newFieldList(() => [
|
|
|
1394
1492
|
{ no: 2, name: "source_file", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
1395
1493
|
{ no: 3, name: "begin", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
|
|
1396
1494
|
{ no: 4, name: "end", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
|
|
1495
|
+
{ no: 5, name: "semantic", kind: "enum", T: proto2.getEnumType(GeneratedCodeInfo_Annotation_Semantic), opt: true },
|
|
1496
|
+
]);
|
|
1497
|
+
/**
|
|
1498
|
+
* Represents the identified object's effect on the element in the original
|
|
1499
|
+
* .proto file.
|
|
1500
|
+
*
|
|
1501
|
+
* @generated from enum google.protobuf.GeneratedCodeInfo.Annotation.Semantic
|
|
1502
|
+
*/
|
|
1503
|
+
export var GeneratedCodeInfo_Annotation_Semantic;
|
|
1504
|
+
(function (GeneratedCodeInfo_Annotation_Semantic) {
|
|
1505
|
+
/**
|
|
1506
|
+
* There is no effect or the effect is indescribable.
|
|
1507
|
+
*
|
|
1508
|
+
* @generated from enum value: NONE = 0;
|
|
1509
|
+
*/
|
|
1510
|
+
GeneratedCodeInfo_Annotation_Semantic[GeneratedCodeInfo_Annotation_Semantic["NONE"] = 0] = "NONE";
|
|
1511
|
+
/**
|
|
1512
|
+
* The element is set or otherwise mutated.
|
|
1513
|
+
*
|
|
1514
|
+
* @generated from enum value: SET = 1;
|
|
1515
|
+
*/
|
|
1516
|
+
GeneratedCodeInfo_Annotation_Semantic[GeneratedCodeInfo_Annotation_Semantic["SET"] = 1] = "SET";
|
|
1517
|
+
/**
|
|
1518
|
+
* An alias to the element is returned.
|
|
1519
|
+
*
|
|
1520
|
+
* @generated from enum value: ALIAS = 2;
|
|
1521
|
+
*/
|
|
1522
|
+
GeneratedCodeInfo_Annotation_Semantic[GeneratedCodeInfo_Annotation_Semantic["ALIAS"] = 2] = "ALIAS";
|
|
1523
|
+
})(GeneratedCodeInfo_Annotation_Semantic || (GeneratedCodeInfo_Annotation_Semantic = {}));
|
|
1524
|
+
// Retrieve enum metadata with: proto2.getEnumType(GeneratedCodeInfo_Annotation_Semantic)
|
|
1525
|
+
proto2.util.setEnumType(GeneratedCodeInfo_Annotation_Semantic, "google.protobuf.GeneratedCodeInfo.Annotation.Semantic", [
|
|
1526
|
+
{ no: 0, name: "NONE" },
|
|
1527
|
+
{ no: 1, name: "SET" },
|
|
1528
|
+
{ no: 2, name: "ALIAS" },
|
|
1397
1529
|
]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2021-
|
|
1
|
+
// Copyright 2021-2023 Buf Technologies, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -75,7 +75,6 @@ import { proto3 } from "../../proto3.js";
|
|
|
75
75
|
* microsecond should be expressed in JSON format as "3.000001s".
|
|
76
76
|
*
|
|
77
77
|
*
|
|
78
|
-
*
|
|
79
78
|
* @generated from message google.protobuf.Duration
|
|
80
79
|
*/
|
|
81
80
|
export class Duration extends Message {
|
|
@@ -118,7 +117,7 @@ export class Duration extends Message {
|
|
|
118
117
|
if (typeof match[2] == "string") {
|
|
119
118
|
const nanosStr = match[2] + "0".repeat(9 - match[2].length);
|
|
120
119
|
this.nanos = parseInt(nanosStr);
|
|
121
|
-
if (longSeconds <
|
|
120
|
+
if (longSeconds < 0 || Object.is(longSeconds, -0)) {
|
|
122
121
|
this.nanos = -this.nanos;
|
|
123
122
|
}
|
|
124
123
|
}
|
|
@@ -139,6 +138,9 @@ export class Duration extends Message {
|
|
|
139
138
|
nanosStr = nanosStr.substring(0, 6);
|
|
140
139
|
}
|
|
141
140
|
text += "." + nanosStr;
|
|
141
|
+
if (this.nanos < 0 && this.seconds === protoInt64.zero) {
|
|
142
|
+
text = "-" + text;
|
|
143
|
+
}
|
|
142
144
|
}
|
|
143
145
|
return text + "s";
|
|
144
146
|
}
|