@bufbuild/protobuf 1.3.2 → 1.4.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/dist/cjs/codegen-info.d.ts +1 -1
- package/dist/cjs/codegen-info.js +1 -0
- package/dist/cjs/create-descriptor-set.js +10 -4
- package/dist/cjs/create-registry-from-desc.js +7 -7
- package/dist/cjs/descriptor-set.d.ts +21 -1
- package/dist/cjs/field.d.ts +52 -1
- package/dist/cjs/field.js +29 -1
- package/dist/cjs/google/protobuf/any_pb.d.ts +2 -1
- package/dist/cjs/google/protobuf/any_pb.js +2 -1
- package/dist/cjs/google/protobuf/compiler/plugin_pb.d.ts +18 -1
- package/dist/cjs/google/protobuf/compiler/plugin_pb.js +19 -0
- package/dist/cjs/google/protobuf/descriptor_pb.d.ts +250 -16
- package/dist/cjs/google/protobuf/descriptor_pb.js +241 -7
- package/dist/cjs/google/protobuf/duration_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/json-format.d.ts +3 -1
- package/dist/cjs/private/binary-format-common.d.ts +4 -4
- package/dist/cjs/private/binary-format-common.js +18 -6
- package/dist/cjs/private/json-format-common.d.ts +1 -1
- package/dist/cjs/private/json-format-common.js +11 -7
- package/dist/cjs/private/scalars.d.ts +2 -2
- package/dist/cjs/private/scalars.js +6 -5
- package/dist/cjs/proto2.js +6 -2
- package/dist/cjs/proto3.js +6 -3
- package/dist/cjs/to-plain-message.d.ts +5 -2
- package/dist/cjs/to-plain-message.js +7 -1
- package/dist/esm/codegen-info.d.ts +1 -1
- package/dist/esm/codegen-info.js +1 -0
- package/dist/esm/create-descriptor-set.js +13 -7
- package/dist/esm/create-registry-from-desc.js +7 -7
- package/dist/esm/descriptor-set.d.ts +21 -1
- package/dist/esm/field.d.ts +52 -1
- package/dist/esm/field.js +28 -0
- package/dist/esm/google/protobuf/any_pb.d.ts +2 -1
- package/dist/esm/google/protobuf/any_pb.js +2 -1
- package/dist/esm/google/protobuf/compiler/plugin_pb.d.ts +18 -1
- package/dist/esm/google/protobuf/compiler/plugin_pb.js +19 -0
- package/dist/esm/google/protobuf/descriptor_pb.d.ts +250 -16
- package/dist/esm/google/protobuf/descriptor_pb.js +238 -6
- package/dist/esm/google/protobuf/duration_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/json-format.d.ts +3 -1
- package/dist/esm/json-format.js +1 -1
- package/dist/esm/private/binary-format-common.d.ts +4 -4
- package/dist/esm/private/binary-format-common.js +17 -6
- package/dist/esm/private/json-format-common.d.ts +1 -1
- package/dist/esm/private/json-format-common.js +12 -8
- package/dist/esm/private/scalars.d.ts +2 -2
- package/dist/esm/private/scalars.js +7 -6
- package/dist/esm/proto2.js +6 -2
- package/dist/esm/proto3.js +7 -4
- package/dist/esm/to-plain-message.d.ts +5 -2
- package/dist/esm/to-plain-message.js +7 -1
- package/dist/proxy/index.d.ts +1 -0
- package/dist/proxy/index.js +1 -0
- package/package.json +17 -12
package/dist/cjs/proto2.js
CHANGED
|
@@ -21,6 +21,7 @@ const field_list_js_1 = require("./private/field-list.js");
|
|
|
21
21
|
const field_js_1 = require("./private/field.js");
|
|
22
22
|
const names_js_1 = require("./private/names.js");
|
|
23
23
|
const json_format_proto2_js_1 = require("./private/json-format-proto2.js");
|
|
24
|
+
const field_js_2 = require("./field.js");
|
|
24
25
|
/**
|
|
25
26
|
* Provides functionality for messages defined with the proto2 syntax.
|
|
26
27
|
*/
|
|
@@ -56,7 +57,7 @@ exports.proto2 = (0, proto_runtime_js_1.makeProtoRuntime)("proto2", (0, json_for
|
|
|
56
57
|
} }));
|
|
57
58
|
/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument */
|
|
58
59
|
function normalizeFieldInfosProto2(fieldInfos) {
|
|
59
|
-
var _a, _b, _c;
|
|
60
|
+
var _a, _b, _c, _d;
|
|
60
61
|
const r = [];
|
|
61
62
|
let o;
|
|
62
63
|
for (const field of typeof fieldInfos == "function"
|
|
@@ -66,8 +67,11 @@ function normalizeFieldInfosProto2(fieldInfos) {
|
|
|
66
67
|
f.localName = (0, names_js_1.localFieldName)(field.name, field.oneof !== undefined);
|
|
67
68
|
f.jsonName = (_a = field.jsonName) !== null && _a !== void 0 ? _a : (0, names_js_1.fieldJsonName)(field.name);
|
|
68
69
|
f.repeated = (_b = field.repeated) !== null && _b !== void 0 ? _b : false;
|
|
70
|
+
if (field.kind == "scalar") {
|
|
71
|
+
f.L = (_c = field.L) !== null && _c !== void 0 ? _c : field_js_2.LongType.BIGINT;
|
|
72
|
+
}
|
|
69
73
|
// In contrast to proto3, repeated fields are unpacked except when explicitly specified.
|
|
70
|
-
f.packed = (
|
|
74
|
+
f.packed = (_d = field.packed) !== null && _d !== void 0 ? _d : false;
|
|
71
75
|
// We do not surface options at this time
|
|
72
76
|
// f.options = field.options ?? emptyReadonlyObject;
|
|
73
77
|
if (field.oneof !== undefined) {
|
package/dist/cjs/proto3.js
CHANGED
|
@@ -50,7 +50,7 @@ exports.proto3 = (0, proto_runtime_js_1.makeProtoRuntime)("proto3", (0, json_for
|
|
|
50
50
|
t[name] = {};
|
|
51
51
|
break;
|
|
52
52
|
case "scalar":
|
|
53
|
-
t[name] = (0, scalars_js_1.scalarDefaultValue)(member.T); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
|
53
|
+
t[name] = (0, scalars_js_1.scalarDefaultValue)(member.T, member.L); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
|
54
54
|
break;
|
|
55
55
|
case "message":
|
|
56
56
|
// message fields are always optional in proto3
|
|
@@ -60,7 +60,7 @@ exports.proto3 = (0, proto_runtime_js_1.makeProtoRuntime)("proto3", (0, json_for
|
|
|
60
60
|
} }));
|
|
61
61
|
/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument */
|
|
62
62
|
function normalizeFieldInfosProto3(fieldInfos) {
|
|
63
|
-
var _a, _b, _c;
|
|
63
|
+
var _a, _b, _c, _d;
|
|
64
64
|
const r = [];
|
|
65
65
|
let o;
|
|
66
66
|
for (const field of typeof fieldInfos == "function"
|
|
@@ -70,13 +70,16 @@ function normalizeFieldInfosProto3(fieldInfos) {
|
|
|
70
70
|
f.localName = (0, names_js_1.localFieldName)(field.name, field.oneof !== undefined);
|
|
71
71
|
f.jsonName = (_a = field.jsonName) !== null && _a !== void 0 ? _a : (0, names_js_1.fieldJsonName)(field.name);
|
|
72
72
|
f.repeated = (_b = field.repeated) !== null && _b !== void 0 ? _b : false;
|
|
73
|
+
if (field.kind == "scalar") {
|
|
74
|
+
f.L = (_c = field.L) !== null && _c !== void 0 ? _c : field_js_1.LongType.BIGINT;
|
|
75
|
+
}
|
|
73
76
|
// From the proto3 language guide:
|
|
74
77
|
// > In proto3, repeated fields of scalar numeric types are packed by default.
|
|
75
78
|
// This information is incomplete - according to the conformance tests, BOOL
|
|
76
79
|
// and ENUM are packed by default as well. This means only STRING and BYTES
|
|
77
80
|
// are not packed by default, which makes sense because they are length-delimited.
|
|
78
81
|
f.packed =
|
|
79
|
-
(
|
|
82
|
+
(_d = field.packed) !== null && _d !== void 0 ? _d : (field.kind == "enum" ||
|
|
80
83
|
(field.kind == "scalar" &&
|
|
81
84
|
field.T != field_js_1.ScalarType.BYTES &&
|
|
82
85
|
field.T != field_js_1.ScalarType.STRING));
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Message } from "./message.js";
|
|
2
2
|
import type { PlainMessage } from "./message.js";
|
|
3
3
|
/**
|
|
4
|
-
* toPlainMessage returns a new object by
|
|
4
|
+
* toPlainMessage returns a new object by stripping
|
|
5
5
|
* all methods from a message, leaving only fields and
|
|
6
6
|
* oneof groups. It is recursive, meaning it applies this
|
|
7
7
|
* same logic to all nested message fields as well.
|
|
8
|
+
*
|
|
9
|
+
* If the argument is already a plain message, it is
|
|
10
|
+
* returned as-is.
|
|
8
11
|
*/
|
|
9
|
-
export declare function toPlainMessage<T extends Message<T>>(message: T): PlainMessage<T>;
|
|
12
|
+
export declare function toPlainMessage<T extends Message<T>>(message: T | PlainMessage<T>): PlainMessage<T>;
|
|
@@ -17,12 +17,18 @@ exports.toPlainMessage = void 0;
|
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-argument,no-case-declarations */
|
|
18
18
|
const message_js_1 = require("./message.js");
|
|
19
19
|
/**
|
|
20
|
-
* toPlainMessage returns a new object by
|
|
20
|
+
* toPlainMessage returns a new object by stripping
|
|
21
21
|
* all methods from a message, leaving only fields and
|
|
22
22
|
* oneof groups. It is recursive, meaning it applies this
|
|
23
23
|
* same logic to all nested message fields as well.
|
|
24
|
+
*
|
|
25
|
+
* If the argument is already a plain message, it is
|
|
26
|
+
* returned as-is.
|
|
24
27
|
*/
|
|
25
28
|
function toPlainMessage(message) {
|
|
29
|
+
if (!(message instanceof message_js_1.Message)) {
|
|
30
|
+
return message;
|
|
31
|
+
}
|
|
26
32
|
const type = message.getType();
|
|
27
33
|
const target = {};
|
|
28
34
|
for (const member of type.fields.byMember()) {
|
|
@@ -13,7 +13,7 @@ interface CodegenInfo {
|
|
|
13
13
|
readonly safeIdentifier: typeof safeIdentifier;
|
|
14
14
|
readonly safeObjectProperty: typeof safeObjectProperty;
|
|
15
15
|
}
|
|
16
|
-
type RuntimeSymbolName = "proto2" | "proto3" | "Message" | "PartialMessage" | "PlainMessage" | "FieldList" | "MessageType" | "BinaryReadOptions" | "BinaryWriteOptions" | "JsonReadOptions" | "JsonWriteOptions" | "JsonValue" | "JsonObject" | "protoDouble" | "protoInt64" | "ScalarType" | "MethodKind" | "MethodIdempotency" | "IMessageTypeRegistry";
|
|
16
|
+
type RuntimeSymbolName = "proto2" | "proto3" | "Message" | "PartialMessage" | "PlainMessage" | "FieldList" | "MessageType" | "BinaryReadOptions" | "BinaryWriteOptions" | "JsonReadOptions" | "JsonWriteOptions" | "JsonValue" | "JsonObject" | "protoDouble" | "protoInt64" | "ScalarType" | "LongType" | "MethodKind" | "MethodIdempotency" | "IMessageTypeRegistry";
|
|
17
17
|
type RuntimeSymbolInfo = {
|
|
18
18
|
typeOnly: boolean;
|
|
19
19
|
publicImportPath: string;
|
package/dist/esm/codegen-info.js
CHANGED
|
@@ -42,6 +42,7 @@ export const codegenInfo = {
|
|
|
42
42
|
protoDouble: { typeOnly: false, privateImportPath: "./proto-double.js", publicImportPath: packageName },
|
|
43
43
|
protoInt64: { typeOnly: false, privateImportPath: "./proto-int64.js", publicImportPath: packageName },
|
|
44
44
|
ScalarType: { typeOnly: false, privateImportPath: "./field.js", publicImportPath: packageName },
|
|
45
|
+
LongType: { typeOnly: false, privateImportPath: "./field.js", publicImportPath: packageName },
|
|
45
46
|
MethodKind: { typeOnly: false, privateImportPath: "./service-type.js", publicImportPath: packageName },
|
|
46
47
|
MethodIdempotency: { typeOnly: false, privateImportPath: "./service-type.js", publicImportPath: packageName },
|
|
47
48
|
IMessageTypeRegistry: { typeOnly: true, privateImportPath: "./type-registry.js", publicImportPath: packageName },
|
|
@@ -11,11 +11,11 @@
|
|
|
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
|
-
import { FieldDescriptorProto_Label, FieldDescriptorProto_Type, FileDescriptorProto, FileDescriptorSet, MethodDescriptorProto, MethodOptions_IdempotencyLevel, ServiceDescriptorProto, SourceCodeInfo, } from "./google/protobuf/descriptor_pb.js";
|
|
14
|
+
import { FieldDescriptorProto_Label, FieldDescriptorProto_Type, FieldOptions_JSType, FileDescriptorProto, FileDescriptorSet, MethodDescriptorProto, MethodOptions_IdempotencyLevel, ServiceDescriptorProto, SourceCodeInfo, } from "./google/protobuf/descriptor_pb.js";
|
|
15
15
|
import { assert } from "./private/assert.js";
|
|
16
|
-
import { ScalarType } from "./field.js";
|
|
16
|
+
import { LongType, ScalarType } from "./field.js";
|
|
17
17
|
import { MethodIdempotency, MethodKind } from "./service-type.js";
|
|
18
|
-
import {
|
|
18
|
+
import { fieldJsonName, findEnumSharedPrefix } from "./private/names.js";
|
|
19
19
|
import { protoInt64 } from "./proto-int64.js";
|
|
20
20
|
/**
|
|
21
21
|
* Create a DescriptorSet, a convenient interface for working with a set of
|
|
@@ -393,7 +393,7 @@ function newOneof(proto, parent) {
|
|
|
393
393
|
* Create a descriptor for a field.
|
|
394
394
|
*/
|
|
395
395
|
function newField(proto, file, parent, oneof, cart) {
|
|
396
|
-
var _a, _b, _c, _d;
|
|
396
|
+
var _a, _b, _c, _d, _e;
|
|
397
397
|
assert(proto.name, `invalid FieldDescriptorProto: missing name`);
|
|
398
398
|
assert(proto.number, `invalid FieldDescriptorProto: missing number`);
|
|
399
399
|
assert(proto.type, `invalid FieldDescriptorProto: missing type`);
|
|
@@ -410,6 +410,7 @@ function newField(proto, file, parent, oneof, cart) {
|
|
|
410
410
|
packedByDefault,
|
|
411
411
|
jsonName: proto.jsonName === fieldJsonName(proto.name) ? undefined : proto.jsonName,
|
|
412
412
|
scalar: undefined,
|
|
413
|
+
longType: undefined,
|
|
413
414
|
message: undefined,
|
|
414
415
|
enum: undefined,
|
|
415
416
|
mapKey: undefined,
|
|
@@ -455,7 +456,9 @@ function newField(proto, file, parent, oneof, cart) {
|
|
|
455
456
|
assert(scalar, `invalid FieldDescriptorProto: unknown type ${proto.type}`);
|
|
456
457
|
return Object.assign(Object.assign({}, common), { kind: "field", fieldKind: "scalar", getDefaultValue,
|
|
457
458
|
repeated,
|
|
458
|
-
scalar
|
|
459
|
+
scalar, longType: ((_e = proto.options) === null || _e === void 0 ? void 0 : _e.jstype) == FieldOptions_JSType.JS_STRING
|
|
460
|
+
? LongType.STRING
|
|
461
|
+
: LongType.BIGINT });
|
|
459
462
|
}
|
|
460
463
|
}
|
|
461
464
|
}
|
|
@@ -698,7 +701,7 @@ var FieldNumber;
|
|
|
698
701
|
* source. Does not take custom options into account.
|
|
699
702
|
*/
|
|
700
703
|
function declarationString() {
|
|
701
|
-
var _a, _b;
|
|
704
|
+
var _a, _b, _c;
|
|
702
705
|
const parts = [];
|
|
703
706
|
if (this.repeated) {
|
|
704
707
|
parts.push("repeated");
|
|
@@ -756,7 +759,10 @@ function declarationString() {
|
|
|
756
759
|
if (this.jsonName !== undefined) {
|
|
757
760
|
options.push(`json_name = "${this.jsonName}"`);
|
|
758
761
|
}
|
|
759
|
-
if (((_b = this.proto.options) === null || _b === void 0 ? void 0 : _b.
|
|
762
|
+
if (((_b = this.proto.options) === null || _b === void 0 ? void 0 : _b.jstype) !== undefined) {
|
|
763
|
+
options.push(`jstype = ${FieldOptions_JSType[this.proto.options.jstype]}`);
|
|
764
|
+
}
|
|
765
|
+
if (((_c = this.proto.options) === null || _c === void 0 ? void 0 : _c.deprecated) === true) {
|
|
760
766
|
options.push(`deprecated = true`);
|
|
761
767
|
}
|
|
762
768
|
if (options.length > 0) {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { assert } from "./private/assert.js";
|
|
15
15
|
import { proto3 } from "./proto3.js";
|
|
16
16
|
import { proto2 } from "./proto2.js";
|
|
17
|
+
import { LongType } from "./field.js";
|
|
17
18
|
import { localName } from "./private/names.js";
|
|
18
19
|
import { Timestamp } from "./google/protobuf/timestamp_pb.js";
|
|
19
20
|
import { Duration } from "./google/protobuf/duration_pb.js";
|
|
@@ -203,13 +204,12 @@ function makeMapFieldInfo(field, resolver) {
|
|
|
203
204
|
} });
|
|
204
205
|
}
|
|
205
206
|
function makeScalarFieldInfo(field) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
};
|
|
207
|
+
// We are creating _partial_ field info here, so we omit long type bigint,
|
|
208
|
+
// which is the default.
|
|
209
|
+
const longType = field.longType == LongType.STRING
|
|
210
|
+
? { L: LongType.STRING }
|
|
211
|
+
: {};
|
|
212
|
+
const base = Object.assign({ kind: "scalar", no: field.number, name: field.name, jsonName: field.jsonName, T: field.scalar }, longType);
|
|
213
213
|
if (field.repeated) {
|
|
214
214
|
return Object.assign(Object.assign({}, base), { repeated: true, packed: field.packed, oneof: undefined, T: field.scalar });
|
|
215
215
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DescriptorProto, EnumDescriptorProto, EnumValueDescriptorProto, FieldDescriptorProto, FileDescriptorProto, MethodDescriptorProto, OneofDescriptorProto, ServiceDescriptorProto } from "./google/protobuf/descriptor_pb.js";
|
|
2
|
-
import type { ScalarType } from "./field.js";
|
|
2
|
+
import type { ScalarType, LongType } from "./field.js";
|
|
3
3
|
import type { MethodIdempotency, MethodKind } from "./service-type.js";
|
|
4
4
|
/**
|
|
5
5
|
* DescriptorSet provides a convenient interface for working with a set
|
|
@@ -330,6 +330,11 @@ interface DescFieldScalar {
|
|
|
330
330
|
* Scalar type, if it is a scalar field.
|
|
331
331
|
*/
|
|
332
332
|
readonly scalar: ScalarType;
|
|
333
|
+
/**
|
|
334
|
+
* JavaScript type for 64 bit integral types (int64, uint64,
|
|
335
|
+
* sint64, fixed64, sfixed64).
|
|
336
|
+
*/
|
|
337
|
+
readonly longType: LongType;
|
|
333
338
|
/**
|
|
334
339
|
* The message type, if it is a message field.
|
|
335
340
|
*/
|
|
@@ -362,6 +367,11 @@ interface DescFieldMessage {
|
|
|
362
367
|
* Scalar type, if it is a scalar field.
|
|
363
368
|
*/
|
|
364
369
|
readonly scalar: undefined;
|
|
370
|
+
/**
|
|
371
|
+
* JavaScript type for 64 bit integral types (int64, uint64,
|
|
372
|
+
* sint64, fixed64, sfixed64).
|
|
373
|
+
*/
|
|
374
|
+
readonly longType: undefined;
|
|
365
375
|
/**
|
|
366
376
|
* The message type, if it is a message field.
|
|
367
377
|
*/
|
|
@@ -389,6 +399,11 @@ interface DescFieldEnum {
|
|
|
389
399
|
* Scalar type, if it is a scalar field.
|
|
390
400
|
*/
|
|
391
401
|
readonly scalar: undefined;
|
|
402
|
+
/**
|
|
403
|
+
* JavaScript type for 64 bit integral types (int64, uint64,
|
|
404
|
+
* sint64, fixed64, sfixed64).
|
|
405
|
+
*/
|
|
406
|
+
readonly longType: undefined;
|
|
392
407
|
/**
|
|
393
408
|
* The message type, if it is a message field.
|
|
394
409
|
*/
|
|
@@ -421,6 +436,11 @@ interface DescFieldMap {
|
|
|
421
436
|
* Scalar type, if it is a scalar field.
|
|
422
437
|
*/
|
|
423
438
|
readonly scalar: undefined;
|
|
439
|
+
/**
|
|
440
|
+
* JavaScript type for 64 bit integral types (int64, uint64,
|
|
441
|
+
* sint64, fixed64, sfixed64).
|
|
442
|
+
*/
|
|
443
|
+
readonly longType: undefined;
|
|
424
444
|
/**
|
|
425
445
|
* The message type, if it is a message field.
|
|
426
446
|
*/
|
package/dist/esm/field.d.ts
CHANGED
|
@@ -80,6 +80,26 @@ interface fiScalar extends fiShared {
|
|
|
80
80
|
* Scalar type of the field.
|
|
81
81
|
*/
|
|
82
82
|
readonly T: ScalarType;
|
|
83
|
+
/**
|
|
84
|
+
* JavaScript representation of 64 bit integral types (int64, uint64,
|
|
85
|
+
* sint64, fixed64, sfixed64).
|
|
86
|
+
*
|
|
87
|
+
* By default, this is LongType.BIGINT. Generated code will use the BigInt
|
|
88
|
+
* primitive.
|
|
89
|
+
*
|
|
90
|
+
* With LongType.STRING, generated code will use the String primitive instead.
|
|
91
|
+
* This can be specified per field with the option `[jstype = JS_STRING]`:
|
|
92
|
+
*
|
|
93
|
+
* ```protobuf
|
|
94
|
+
* uint64 field_a = 1; // BigInt
|
|
95
|
+
* uint64 field_b = 2 [jstype = JS_NORMAL]; // BigInt
|
|
96
|
+
* uint64 field_b = 2 [jstype = JS_NUMBER]; // BigInt
|
|
97
|
+
* uint64 field_b = 2 [jstype = JS_STRING]; // String
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* This property is ignored for other scalar types.
|
|
101
|
+
*/
|
|
102
|
+
readonly L: LongType;
|
|
83
103
|
/**
|
|
84
104
|
* Is the field repeated?
|
|
85
105
|
*/
|
|
@@ -201,13 +221,14 @@ type fiRules<T> = Omit<T, "oneof" | "repeat" | "repeated" | "packed" | "opt"> &
|
|
|
201
221
|
readonly opt: false;
|
|
202
222
|
readonly oneof: OneofInfo;
|
|
203
223
|
});
|
|
204
|
-
type fiPartialRules<T extends fiScalar | fiMap | fiEnum | fiMessage> = Omit<T, "jsonName" | "localName" | "oneof" | "repeat" | "repeated" | "packed" | "opt" | "default"> & ({
|
|
224
|
+
type fiPartialRules<T extends fiScalar | fiMap | fiEnum | fiMessage> = Omit<T, "jsonName" | "localName" | "oneof" | "repeat" | "repeated" | "packed" | "opt" | "default" | "L"> & ({
|
|
205
225
|
readonly jsonName?: string;
|
|
206
226
|
readonly repeated?: false;
|
|
207
227
|
readonly packed?: false;
|
|
208
228
|
readonly opt?: false;
|
|
209
229
|
readonly oneof?: undefined;
|
|
210
230
|
default?: T["default"];
|
|
231
|
+
L?: LongType;
|
|
211
232
|
} | {
|
|
212
233
|
readonly jsonName?: string;
|
|
213
234
|
readonly repeated?: false;
|
|
@@ -215,6 +236,7 @@ type fiPartialRules<T extends fiScalar | fiMap | fiEnum | fiMessage> = Omit<T, "
|
|
|
215
236
|
readonly opt: true;
|
|
216
237
|
readonly oneof?: undefined;
|
|
217
238
|
default?: T["default"];
|
|
239
|
+
L?: LongType;
|
|
218
240
|
} | {
|
|
219
241
|
readonly jsonName?: string;
|
|
220
242
|
readonly repeated?: boolean;
|
|
@@ -222,6 +244,7 @@ type fiPartialRules<T extends fiScalar | fiMap | fiEnum | fiMessage> = Omit<T, "
|
|
|
222
244
|
readonly opt?: false;
|
|
223
245
|
readonly oneof?: undefined;
|
|
224
246
|
default?: T["default"];
|
|
247
|
+
L?: LongType;
|
|
225
248
|
} | {
|
|
226
249
|
readonly jsonName?: string;
|
|
227
250
|
readonly repeated?: false;
|
|
@@ -229,6 +252,7 @@ type fiPartialRules<T extends fiScalar | fiMap | fiEnum | fiMessage> = Omit<T, "
|
|
|
229
252
|
readonly opt?: false;
|
|
230
253
|
readonly oneof: string;
|
|
231
254
|
default?: T["default"];
|
|
255
|
+
L?: LongType;
|
|
232
256
|
});
|
|
233
257
|
/**
|
|
234
258
|
* Scalar value types. This is a subset of field types declared by protobuf
|
|
@@ -252,4 +276,31 @@ export declare enum ScalarType {
|
|
|
252
276
|
SINT32 = 17,
|
|
253
277
|
SINT64 = 18
|
|
254
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* JavaScript representation of fields with 64 bit integral types (int64, uint64,
|
|
281
|
+
* sint64, fixed64, sfixed64).
|
|
282
|
+
*
|
|
283
|
+
* This is a subset of google.protobuf.FieldOptions.JSType, which defines JS_NORMAL,
|
|
284
|
+
* JS_STRING, and JS_NUMBER. Protobuf-ES uses BigInt by default, but will use
|
|
285
|
+
* String if `[jstype = JS_STRING]` is specified.
|
|
286
|
+
*
|
|
287
|
+
* ```protobuf
|
|
288
|
+
* uint64 field_a = 1; // BigInt
|
|
289
|
+
* uint64 field_b = 2 [jstype = JS_NORMAL]; // BigInt
|
|
290
|
+
* uint64 field_b = 2 [jstype = JS_NUMBER]; // BigInt
|
|
291
|
+
* uint64 field_b = 2 [jstype = JS_STRING]; // String
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
export declare enum LongType {
|
|
295
|
+
/**
|
|
296
|
+
* Use JavaScript BigInt.
|
|
297
|
+
*/
|
|
298
|
+
BIGINT = 0,
|
|
299
|
+
/**
|
|
300
|
+
* Use JavaScript String.
|
|
301
|
+
*
|
|
302
|
+
* Field option `[jstype = JS_STRING]`.
|
|
303
|
+
*/
|
|
304
|
+
STRING = 1
|
|
305
|
+
}
|
|
255
306
|
export {};
|
package/dist/esm/field.js
CHANGED
|
@@ -48,3 +48,31 @@ export var ScalarType;
|
|
|
48
48
|
ScalarType[ScalarType["SINT32"] = 17] = "SINT32";
|
|
49
49
|
ScalarType[ScalarType["SINT64"] = 18] = "SINT64";
|
|
50
50
|
})(ScalarType || (ScalarType = {}));
|
|
51
|
+
/**
|
|
52
|
+
* JavaScript representation of fields with 64 bit integral types (int64, uint64,
|
|
53
|
+
* sint64, fixed64, sfixed64).
|
|
54
|
+
*
|
|
55
|
+
* This is a subset of google.protobuf.FieldOptions.JSType, which defines JS_NORMAL,
|
|
56
|
+
* JS_STRING, and JS_NUMBER. Protobuf-ES uses BigInt by default, but will use
|
|
57
|
+
* String if `[jstype = JS_STRING]` is specified.
|
|
58
|
+
*
|
|
59
|
+
* ```protobuf
|
|
60
|
+
* uint64 field_a = 1; // BigInt
|
|
61
|
+
* uint64 field_b = 2 [jstype = JS_NORMAL]; // BigInt
|
|
62
|
+
* uint64 field_b = 2 [jstype = JS_NUMBER]; // BigInt
|
|
63
|
+
* uint64 field_b = 2 [jstype = JS_STRING]; // String
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export var LongType;
|
|
67
|
+
(function (LongType) {
|
|
68
|
+
/**
|
|
69
|
+
* Use JavaScript BigInt.
|
|
70
|
+
*/
|
|
71
|
+
LongType[LongType["BIGINT"] = 0] = "BIGINT";
|
|
72
|
+
/**
|
|
73
|
+
* Use JavaScript String.
|
|
74
|
+
*
|
|
75
|
+
* Field option `[jstype = JS_STRING]`.
|
|
76
|
+
*/
|
|
77
|
+
LongType[LongType["STRING"] = 1] = "STRING";
|
|
78
|
+
})(LongType || (LongType = {}));
|
|
@@ -121,7 +121,8 @@ export declare class Any extends Message<Any> {
|
|
|
121
121
|
*
|
|
122
122
|
* Note: this functionality is not currently available in the official
|
|
123
123
|
* protobuf release, and it is not used for type URLs beginning with
|
|
124
|
-
* type.googleapis.com.
|
|
124
|
+
* type.googleapis.com. As of May 2023, there are no widely used type server
|
|
125
|
+
* implementations and no plans to implement one.
|
|
125
126
|
*
|
|
126
127
|
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
127
128
|
* used with implementation specific semantics.
|
|
@@ -130,7 +130,8 @@ export class Any extends Message {
|
|
|
130
130
|
*
|
|
131
131
|
* Note: this functionality is not currently available in the official
|
|
132
132
|
* protobuf release, and it is not used for type URLs beginning with
|
|
133
|
-
* type.googleapis.com.
|
|
133
|
+
* type.googleapis.com. As of May 2023, there are no widely used type server
|
|
134
|
+
* implementations and no plans to implement one.
|
|
134
135
|
*
|
|
135
136
|
* Schemes other than `http`, `https` (or the empty scheme) might be
|
|
136
137
|
* used with implementation specific semantics.
|
|
@@ -64,6 +64,11 @@ export declare class CodeGeneratorRequest extends Message<CodeGeneratorRequest>
|
|
|
64
64
|
* they import. The files will appear in topological order, so each file
|
|
65
65
|
* appears before any file that imports it.
|
|
66
66
|
*
|
|
67
|
+
* Note: the files listed in files_to_generate will include runtime-retention
|
|
68
|
+
* options only, but all other files will include source-retention options.
|
|
69
|
+
* The source_file_descriptors field below is available in case you need
|
|
70
|
+
* source-retention options for files_to_generate.
|
|
71
|
+
*
|
|
67
72
|
* protoc guarantees that all proto_files will be written after
|
|
68
73
|
* the fields above, even though this is not technically guaranteed by the
|
|
69
74
|
* protobuf wire format. This theoretically could allow a plugin to stream
|
|
@@ -78,6 +83,14 @@ export declare class CodeGeneratorRequest extends Message<CodeGeneratorRequest>
|
|
|
78
83
|
* @generated from field: repeated google.protobuf.FileDescriptorProto proto_file = 15;
|
|
79
84
|
*/
|
|
80
85
|
protoFile: FileDescriptorProto[];
|
|
86
|
+
/**
|
|
87
|
+
* File descriptors with all options, including source-retention options.
|
|
88
|
+
* These descriptors are only provided for the files listed in
|
|
89
|
+
* files_to_generate.
|
|
90
|
+
*
|
|
91
|
+
* @generated from field: repeated google.protobuf.FileDescriptorProto source_file_descriptors = 17;
|
|
92
|
+
*/
|
|
93
|
+
sourceFileDescriptors: FileDescriptorProto[];
|
|
81
94
|
/**
|
|
82
95
|
* The version number of protocol compiler.
|
|
83
96
|
*
|
|
@@ -145,7 +158,11 @@ export declare enum CodeGeneratorResponse_Feature {
|
|
|
145
158
|
/**
|
|
146
159
|
* @generated from enum value: FEATURE_PROTO3_OPTIONAL = 1;
|
|
147
160
|
*/
|
|
148
|
-
PROTO3_OPTIONAL = 1
|
|
161
|
+
PROTO3_OPTIONAL = 1,
|
|
162
|
+
/**
|
|
163
|
+
* @generated from enum value: FEATURE_SUPPORTS_EDITIONS = 2;
|
|
164
|
+
*/
|
|
165
|
+
SUPPORTS_EDITIONS = 2
|
|
149
166
|
}
|
|
150
167
|
/**
|
|
151
168
|
* Represents a single generated file.
|
|
@@ -66,6 +66,11 @@ export class CodeGeneratorRequest extends Message {
|
|
|
66
66
|
* they import. The files will appear in topological order, so each file
|
|
67
67
|
* appears before any file that imports it.
|
|
68
68
|
*
|
|
69
|
+
* Note: the files listed in files_to_generate will include runtime-retention
|
|
70
|
+
* options only, but all other files will include source-retention options.
|
|
71
|
+
* The source_file_descriptors field below is available in case you need
|
|
72
|
+
* source-retention options for files_to_generate.
|
|
73
|
+
*
|
|
69
74
|
* protoc guarantees that all proto_files will be written after
|
|
70
75
|
* the fields above, even though this is not technically guaranteed by the
|
|
71
76
|
* protobuf wire format. This theoretically could allow a plugin to stream
|
|
@@ -80,6 +85,14 @@ export class CodeGeneratorRequest extends Message {
|
|
|
80
85
|
* @generated from field: repeated google.protobuf.FileDescriptorProto proto_file = 15;
|
|
81
86
|
*/
|
|
82
87
|
this.protoFile = [];
|
|
88
|
+
/**
|
|
89
|
+
* File descriptors with all options, including source-retention options.
|
|
90
|
+
* These descriptors are only provided for the files listed in
|
|
91
|
+
* files_to_generate.
|
|
92
|
+
*
|
|
93
|
+
* @generated from field: repeated google.protobuf.FileDescriptorProto source_file_descriptors = 17;
|
|
94
|
+
*/
|
|
95
|
+
this.sourceFileDescriptors = [];
|
|
83
96
|
proto2.util.initPartial(data, this);
|
|
84
97
|
}
|
|
85
98
|
static fromBinary(bytes, options) {
|
|
@@ -101,6 +114,7 @@ CodeGeneratorRequest.fields = proto2.util.newFieldList(() => [
|
|
|
101
114
|
{ no: 1, name: "file_to_generate", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
|
|
102
115
|
{ no: 2, name: "parameter", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
103
116
|
{ no: 15, name: "proto_file", kind: "message", T: FileDescriptorProto, repeated: true },
|
|
117
|
+
{ no: 17, name: "source_file_descriptors", kind: "message", T: FileDescriptorProto, repeated: true },
|
|
104
118
|
{ no: 3, name: "compiler_version", kind: "message", T: Version, opt: true },
|
|
105
119
|
]);
|
|
106
120
|
/**
|
|
@@ -152,11 +166,16 @@ export var CodeGeneratorResponse_Feature;
|
|
|
152
166
|
* @generated from enum value: FEATURE_PROTO3_OPTIONAL = 1;
|
|
153
167
|
*/
|
|
154
168
|
CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["PROTO3_OPTIONAL"] = 1] = "PROTO3_OPTIONAL";
|
|
169
|
+
/**
|
|
170
|
+
* @generated from enum value: FEATURE_SUPPORTS_EDITIONS = 2;
|
|
171
|
+
*/
|
|
172
|
+
CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["SUPPORTS_EDITIONS"] = 2] = "SUPPORTS_EDITIONS";
|
|
155
173
|
})(CodeGeneratorResponse_Feature || (CodeGeneratorResponse_Feature = {}));
|
|
156
174
|
// Retrieve enum metadata with: proto2.getEnumType(CodeGeneratorResponse_Feature)
|
|
157
175
|
proto2.util.setEnumType(CodeGeneratorResponse_Feature, "google.protobuf.compiler.CodeGeneratorResponse.Feature", [
|
|
158
176
|
{ no: 0, name: "FEATURE_NONE" },
|
|
159
177
|
{ no: 1, name: "FEATURE_PROTO3_OPTIONAL" },
|
|
178
|
+
{ no: 2, name: "FEATURE_SUPPORTS_EDITIONS" },
|
|
160
179
|
]);
|
|
161
180
|
/**
|
|
162
181
|
* Represents a single generated file.
|