diff --git a/integration/options-types-only/options.ts b/integration/options-types-only/options.ts index 81ab5b340..ca678a715 100644 --- a/integration/options-types-only/options.ts +++ b/integration/options-types-only/options.ts @@ -301,7 +301,7 @@ export const protoMetadata: ProtoMetadata = { "pyGenericServices": false, "phpGenericServices": false, "deprecated": false, - "ccEnableArenas": false, + "ccEnableArenas": true, "objcClassPrefix": "", "csharpNamespace": "", "swiftPrefix": "", diff --git a/integration/options/__snapshots__/options-test.ts.snap b/integration/options/__snapshots__/options-test.ts.snap index 95c4470ae..1ba211067 100644 --- a/integration/options/__snapshots__/options-test.ts.snap +++ b/integration/options/__snapshots__/options-test.ts.snap @@ -10566,7 +10566,7 @@ exports[`options generates types correctly 1`] = ` ], "name": "options.proto", "options": { - "ccEnableArenas": false, + "ccEnableArenas": true, "ccGenericServices": false, "csharpNamespace": "", "deprecated": false, diff --git a/integration/options/options.ts b/integration/options/options.ts index e9d412a90..22fbfa095 100644 --- a/integration/options/options.ts +++ b/integration/options/options.ts @@ -440,7 +440,7 @@ export const protoMetadata: ProtoMetadata = { "pyGenericServices": false, "phpGenericServices": false, "deprecated": false, - "ccEnableArenas": false, + "ccEnableArenas": true, "objcClassPrefix": "", "csharpNamespace": "", "swiftPrefix": "", diff --git a/package.json b/package.json index 25c9923d3..6af933a71 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "case-anything": "^2.1.13", "protobufjs": "^7.2.4", "ts-poet": "^6.7.0", - "ts-proto-descriptors": "1.15.0" + "ts-proto-descriptors": "1.16.0" }, "packageManager": "yarn@3.6.0" } diff --git a/protos/google/protobuf/compiler/plugin.ts b/protos/google/protobuf/compiler/plugin.ts index 2b53409a5..aed0b6eaf 100644 --- a/protos/google/protobuf/compiler/plugin.ts +++ b/protos/google/protobuf/compiler/plugin.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.175.1 +// protoc v3.21.12 +// source: google/protobuf/compiler/plugin.proto + /* eslint-disable */ import Long from "long"; import _m0 from "protobufjs/minimal"; @@ -265,10 +271,10 @@ export const Version = { fromJSON(object: any): Version { return { - major: isSet(object.major) ? Number(object.major) : 0, - minor: isSet(object.minor) ? Number(object.minor) : 0, - patch: isSet(object.patch) ? Number(object.patch) : 0, - suffix: isSet(object.suffix) ? String(object.suffix) : "", + major: isSet(object.major) ? globalThis.Number(object.major) : 0, + minor: isSet(object.minor) ? globalThis.Number(object.minor) : 0, + patch: isSet(object.patch) ? globalThis.Number(object.patch) : 0, + suffix: isSet(object.suffix) ? globalThis.String(object.suffix) : "", }; }, @@ -292,7 +298,6 @@ export const Version = { create(base?: DeepPartial): Version { return Version.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): Version { const message = Object.create(createBaseVersion()) as Version; message.major = object.major ?? 0; @@ -397,9 +402,11 @@ export const CodeGeneratorRequest = { fromJSON(object: any): CodeGeneratorRequest { return { - fileToGenerate: Array.isArray(object?.fileToGenerate) ? object.fileToGenerate.map((e: any) => String(e)) : [], - parameter: isSet(object.parameter) ? String(object.parameter) : "", - protoFile: Array.isArray(object?.protoFile) + fileToGenerate: globalThis.Array.isArray(object?.fileToGenerate) + ? object.fileToGenerate.map((e: any) => globalThis.String(e)) + : [], + parameter: isSet(object.parameter) ? globalThis.String(object.parameter) : "", + protoFile: globalThis.Array.isArray(object?.protoFile) ? object.protoFile.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], compilerVersion: isSet(object.compilerVersion) ? Version.fromJSON(object.compilerVersion) : undefined, @@ -426,7 +433,6 @@ export const CodeGeneratorRequest = { create(base?: DeepPartial): CodeGeneratorRequest { return CodeGeneratorRequest.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): CodeGeneratorRequest { const message = Object.create(createBaseCodeGeneratorRequest()) as CodeGeneratorRequest; message.fileToGenerate = object.fileToGenerate?.map((e) => e) || []; @@ -523,9 +529,11 @@ export const CodeGeneratorResponse = { fromJSON(object: any): CodeGeneratorResponse { return { - error: isSet(object.error) ? String(object.error) : "", - supportedFeatures: isSet(object.supportedFeatures) ? Number(object.supportedFeatures) : 0, - file: Array.isArray(object?.file) ? object.file.map((e: any) => CodeGeneratorResponse_File.fromJSON(e)) : [], + error: isSet(object.error) ? globalThis.String(object.error) : "", + supportedFeatures: isSet(object.supportedFeatures) ? globalThis.Number(object.supportedFeatures) : 0, + file: globalThis.Array.isArray(object?.file) + ? object.file.map((e: any) => CodeGeneratorResponse_File.fromJSON(e)) + : [], }; }, @@ -546,7 +554,6 @@ export const CodeGeneratorResponse = { create(base?: DeepPartial): CodeGeneratorResponse { return CodeGeneratorResponse.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): CodeGeneratorResponse { const message = Object.create(createBaseCodeGeneratorResponse()) as CodeGeneratorResponse; message.error = object.error ?? ""; @@ -650,9 +657,9 @@ export const CodeGeneratorResponse_File = { fromJSON(object: any): CodeGeneratorResponse_File { return { - name: isSet(object.name) ? String(object.name) : "", - insertionPoint: isSet(object.insertionPoint) ? String(object.insertionPoint) : "", - content: isSet(object.content) ? String(object.content) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + insertionPoint: isSet(object.insertionPoint) ? globalThis.String(object.insertionPoint) : "", + content: isSet(object.content) ? globalThis.String(object.content) : "", generatedCodeInfo: isSet(object.generatedCodeInfo) ? GeneratedCodeInfo.fromJSON(object.generatedCodeInfo) : undefined, @@ -679,7 +686,6 @@ export const CodeGeneratorResponse_File = { create(base?: DeepPartial): CodeGeneratorResponse_File { return CodeGeneratorResponse_File.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): CodeGeneratorResponse_File { const message = Object.create(createBaseCodeGeneratorResponse_File()) as CodeGeneratorResponse_File; message.name = object.name ?? ""; @@ -692,35 +698,17 @@ export const CodeGeneratorResponse_File = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } return long.toNumber(); } diff --git a/protos/google/protobuf/descriptor.ts b/protos/google/protobuf/descriptor.ts index 700731c80..5795cf7b0 100644 --- a/protos/google/protobuf/descriptor.ts +++ b/protos/google/protobuf/descriptor.ts @@ -1,3 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v1.175.1 +// protoc v3.21.12 +// source: google/protobuf/descriptor.proto + /* eslint-disable */ import Long from "long"; import _m0 from "protobufjs/minimal"; @@ -1215,7 +1221,9 @@ export const FileDescriptorSet = { }, fromJSON(object: any): FileDescriptorSet { - return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; }, toJSON(message: FileDescriptorSet): unknown { @@ -1229,7 +1237,6 @@ export const FileDescriptorSet = { create(base?: DeepPartial): FileDescriptorSet { return FileDescriptorSet.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): FileDescriptorSet { const message = Object.create(createBaseFileDescriptorSet()) as FileDescriptorSet; message.file = object.file?.map((e) => FileDescriptorProto.fromPartial(e)) || []; @@ -1448,24 +1455,32 @@ export const FileDescriptorProto = { fromJSON(object: any): FileDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - package: isSet(object.package) ? String(object.package) : "", - dependency: Array.isArray(object?.dependency) ? object.dependency.map((e: any) => String(e)) : [], - publicDependency: Array.isArray(object?.publicDependency) - ? object.publicDependency.map((e: any) => Number(e)) + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => globalThis.String(e)) : [], - weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], - messageType: Array.isArray(object?.messageType) + publicDependency: globalThis.Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => globalThis.Number(e)) + : [], + weakDependency: globalThis.Array.isArray(object?.weakDependency) + ? object.weakDependency.map((e: any) => globalThis.Number(e)) + : [], + messageType: globalThis.Array.isArray(object?.messageType) ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + service: globalThis.Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, - syntax: isSet(object.syntax) ? String(object.syntax) : "", + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", }; }, @@ -1513,7 +1528,6 @@ export const FileDescriptorProto = { create(base?: DeepPartial): FileDescriptorProto { return FileDescriptorProto.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): FileDescriptorProto { const message = Object.create(createBaseFileDescriptorProto()) as FileDescriptorProto; message.name = object.name ?? ""; @@ -1701,26 +1715,32 @@ export const DescriptorProto = { fromJSON(object: any): DescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - field: Array.isArray(object?.field) ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - extension: Array.isArray(object?.extension) + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], - nestedType: Array.isArray(object?.nestedType) + nestedType: globalThis.Array.isArray(object?.nestedType) ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) : [], - enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], - extensionRange: Array.isArray(object?.extensionRange) + enumType: globalThis.Array.isArray(object?.enumType) + ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) + : [], + extensionRange: globalThis.Array.isArray(object?.extensionRange) ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) : [], - oneofDecl: Array.isArray(object?.oneofDecl) + oneofDecl: globalThis.Array.isArray(object?.oneofDecl) ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, @@ -1762,7 +1782,6 @@ export const DescriptorProto = { create(base?: DeepPartial): DescriptorProto { return DescriptorProto.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): DescriptorProto { const message = Object.create(createBaseDescriptorProto()) as DescriptorProto; message.name = object.name ?? ""; @@ -1865,8 +1884,8 @@ export const DescriptorProto_ExtensionRange = { fromJSON(object: any): DescriptorProto_ExtensionRange { return { - start: isSet(object.start) ? Number(object.start) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, }; }, @@ -1888,7 +1907,6 @@ export const DescriptorProto_ExtensionRange = { create(base?: DeepPartial): DescriptorProto_ExtensionRange { return DescriptorProto_ExtensionRange.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): DescriptorProto_ExtensionRange { const message = Object.create(createBaseDescriptorProto_ExtensionRange()) as DescriptorProto_ExtensionRange; message.start = object.start ?? 0; @@ -1973,7 +1991,10 @@ export const DescriptorProto_ReservedRange = { }, fromJSON(object: any): DescriptorProto_ReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: DescriptorProto_ReservedRange): unknown { @@ -1990,7 +2011,6 @@ export const DescriptorProto_ReservedRange = { create(base?: DeepPartial): DescriptorProto_ReservedRange { return DescriptorProto_ReservedRange.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): DescriptorProto_ReservedRange { const message = Object.create(createBaseDescriptorProto_ReservedRange()) as DescriptorProto_ReservedRange; message.start = object.start ?? 0; @@ -2115,7 +2135,7 @@ export const ExtensionRangeOptions = { fromJSON(object: any): ExtensionRangeOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -2132,7 +2152,6 @@ export const ExtensionRangeOptions = { create(base?: DeepPartial): ExtensionRangeOptions { return ExtensionRangeOptions.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): ExtensionRangeOptions { const message = Object.create(createBaseExtensionRangeOptions()) as ExtensionRangeOptions; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; @@ -2188,7 +2207,7 @@ export const FieldDescriptorProto = { if (message.options !== undefined) { FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== false) { writer.uint32(136).bool(message.proto3Optional); } if (message._unknownFields !== undefined) { @@ -2316,17 +2335,17 @@ export const FieldDescriptorProto = { fromJSON(object: any): FieldDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, - typeName: isSet(object.typeName) ? String(object.typeName) : "", - extendee: isSet(object.extendee) ? String(object.extendee) : "", - defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", - oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, - jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + typeName: isSet(object.typeName) ? globalThis.String(object.typeName) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? globalThis.String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? globalThis.Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? globalThis.String(object.jsonName) : "", options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, - proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + proto3Optional: isSet(object.proto3Optional) ? globalThis.Boolean(object.proto3Optional) : false, }; }, @@ -2362,7 +2381,7 @@ export const FieldDescriptorProto = { if (message.options !== undefined) { obj.options = FieldOptions.toJSON(message.options); } - if (message.proto3Optional === true) { + if (message.proto3Optional !== false) { obj.proto3Optional = message.proto3Optional; } return obj; @@ -2371,7 +2390,6 @@ export const FieldDescriptorProto = { create(base?: DeepPartial): FieldDescriptorProto { return FieldDescriptorProto.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): FieldDescriptorProto { const message = Object.create(createBaseFieldDescriptorProto()) as FieldDescriptorProto; message.name = object.name ?? ""; @@ -2465,7 +2483,7 @@ export const OneofDescriptorProto = { fromJSON(object: any): OneofDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, }; }, @@ -2484,7 +2502,6 @@ export const OneofDescriptorProto = { create(base?: DeepPartial): OneofDescriptorProto { return OneofDescriptorProto.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): OneofDescriptorProto { const message = Object.create(createBaseOneofDescriptorProto()) as OneofDescriptorProto; message.name = object.name ?? ""; @@ -2599,13 +2616,17 @@ export const EnumDescriptorProto = { fromJSON(object: any): EnumDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - value: Array.isArray(object?.value) ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, - reservedRange: Array.isArray(object?.reservedRange) + reservedRange: globalThis.Array.isArray(object?.reservedRange) ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) : [], - reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + reservedName: globalThis.Array.isArray(object?.reservedName) + ? object.reservedName.map((e: any) => globalThis.String(e)) + : [], }; }, @@ -2632,7 +2653,6 @@ export const EnumDescriptorProto = { create(base?: DeepPartial): EnumDescriptorProto { return EnumDescriptorProto.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): EnumDescriptorProto { const message = Object.create(createBaseEnumDescriptorProto()) as EnumDescriptorProto; message.name = object.name ?? ""; @@ -2722,7 +2742,10 @@ export const EnumDescriptorProto_EnumReservedRange = { }, fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { - return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; }, toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { @@ -2739,7 +2762,6 @@ export const EnumDescriptorProto_EnumReservedRange = { create(base?: DeepPartial): EnumDescriptorProto_EnumReservedRange { return EnumDescriptorProto_EnumReservedRange.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): EnumDescriptorProto_EnumReservedRange { const message = Object.create( createBaseEnumDescriptorProto_EnumReservedRange(), @@ -2834,8 +2856,8 @@ export const EnumValueDescriptorProto = { fromJSON(object: any): EnumValueDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - number: isSet(object.number) ? Number(object.number) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, }; }, @@ -2857,7 +2879,6 @@ export const EnumValueDescriptorProto = { create(base?: DeepPartial): EnumValueDescriptorProto { return EnumValueDescriptorProto.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): EnumValueDescriptorProto { const message = Object.create(createBaseEnumValueDescriptorProto()) as EnumValueDescriptorProto; message.name = object.name ?? ""; @@ -2953,8 +2974,10 @@ export const ServiceDescriptorProto = { fromJSON(object: any): ServiceDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - method: Array.isArray(object?.method) ? object.method.map((e: any) => MethodDescriptorProto.fromJSON(e)) : [], + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.Array.isArray(object?.method) + ? object.method.map((e: any) => MethodDescriptorProto.fromJSON(e)) + : [], options: isSet(object.options) ? ServiceOptions.fromJSON(object.options) : undefined, }; }, @@ -2976,7 +2999,6 @@ export const ServiceDescriptorProto = { create(base?: DeepPartial): ServiceDescriptorProto { return ServiceDescriptorProto.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): ServiceDescriptorProto { const message = Object.create(createBaseServiceDescriptorProto()) as ServiceDescriptorProto; message.name = object.name ?? ""; @@ -3013,10 +3035,10 @@ export const MethodDescriptorProto = { if (message.options !== undefined) { MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== false) { writer.uint32(40).bool(message.clientStreaming); } - if (message.serverStreaming === true) { + if (message.serverStreaming !== false) { writer.uint32(48).bool(message.serverStreaming); } if (message._unknownFields !== undefined) { @@ -3109,12 +3131,12 @@ export const MethodDescriptorProto = { fromJSON(object: any): MethodDescriptorProto { return { - name: isSet(object.name) ? String(object.name) : "", - inputType: isSet(object.inputType) ? String(object.inputType) : "", - outputType: isSet(object.outputType) ? String(object.outputType) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + inputType: isSet(object.inputType) ? globalThis.String(object.inputType) : "", + outputType: isSet(object.outputType) ? globalThis.String(object.outputType) : "", options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, - clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, - serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + clientStreaming: isSet(object.clientStreaming) ? globalThis.Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? globalThis.Boolean(object.serverStreaming) : false, }; }, @@ -3132,10 +3154,10 @@ export const MethodDescriptorProto = { if (message.options !== undefined) { obj.options = MethodOptions.toJSON(message.options); } - if (message.clientStreaming === true) { + if (message.clientStreaming !== false) { obj.clientStreaming = message.clientStreaming; } - if (message.serverStreaming === true) { + if (message.serverStreaming !== false) { obj.serverStreaming = message.serverStreaming; } return obj; @@ -3144,7 +3166,6 @@ export const MethodDescriptorProto = { create(base?: DeepPartial): MethodDescriptorProto { return MethodDescriptorProto.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): MethodDescriptorProto { const message = Object.create(createBaseMethodDescriptorProto()) as MethodDescriptorProto; message.name = object.name ?? ""; @@ -3173,7 +3194,7 @@ function createBaseFileOptions(): FileOptions { pyGenericServices: false, phpGenericServices: false, deprecated: false, - ccEnableArenas: false, + ccEnableArenas: true, objcClassPrefix: "", csharpNamespace: "", swiftPrefix: "", @@ -3193,13 +3214,13 @@ export const FileOptions = { if (message.javaOuterClassname !== "") { writer.uint32(66).string(message.javaOuterClassname); } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== false) { writer.uint32(80).bool(message.javaMultipleFiles); } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== false) { writer.uint32(160).bool(message.javaGenerateEqualsAndHash); } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== false) { writer.uint32(216).bool(message.javaStringCheckUtf8); } if (message.optimizeFor !== 1) { @@ -3208,22 +3229,22 @@ export const FileOptions = { if (message.goPackage !== "") { writer.uint32(90).string(message.goPackage); } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== false) { writer.uint32(128).bool(message.ccGenericServices); } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== false) { writer.uint32(136).bool(message.javaGenericServices); } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== false) { writer.uint32(144).bool(message.pyGenericServices); } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== false) { writer.uint32(336).bool(message.phpGenericServices); } - if (message.deprecated === true) { + if (message.deprecated !== false) { writer.uint32(184).bool(message.deprecated); } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== true) { writer.uint32(248).bool(message.ccEnableArenas); } if (message.objcClassPrefix !== "") { @@ -3497,29 +3518,29 @@ export const FileOptions = { fromJSON(object: any): FileOptions { return { - javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", - javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", - javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaPackage: isSet(object.javaPackage) ? globalThis.String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? globalThis.String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? globalThis.Boolean(object.javaMultipleFiles) : false, javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) - ? Boolean(object.javaGenerateEqualsAndHash) + ? globalThis.Boolean(object.javaGenerateEqualsAndHash) : false, - javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? globalThis.Boolean(object.javaStringCheckUtf8) : false, optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, - goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", - ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, - javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, - pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, - phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, - objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", - csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", - swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", - phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", - phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", - phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", - rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + goPackage: isSet(object.goPackage) ? globalThis.String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? globalThis.Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? globalThis.Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? globalThis.Boolean(object.pyGenericServices) : false, + phpGenericServices: isSet(object.phpGenericServices) ? globalThis.Boolean(object.phpGenericServices) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? globalThis.Boolean(object.ccEnableArenas) : true, + objcClassPrefix: isSet(object.objcClassPrefix) ? globalThis.String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? globalThis.String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? globalThis.String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? globalThis.String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3533,13 +3554,13 @@ export const FileOptions = { if (message.javaOuterClassname !== "") { obj.javaOuterClassname = message.javaOuterClassname; } - if (message.javaMultipleFiles === true) { + if (message.javaMultipleFiles !== false) { obj.javaMultipleFiles = message.javaMultipleFiles; } - if (message.javaGenerateEqualsAndHash === true) { + if (message.javaGenerateEqualsAndHash !== false) { obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; } - if (message.javaStringCheckUtf8 === true) { + if (message.javaStringCheckUtf8 !== false) { obj.javaStringCheckUtf8 = message.javaStringCheckUtf8; } if (message.optimizeFor !== 1) { @@ -3548,22 +3569,22 @@ export const FileOptions = { if (message.goPackage !== "") { obj.goPackage = message.goPackage; } - if (message.ccGenericServices === true) { + if (message.ccGenericServices !== false) { obj.ccGenericServices = message.ccGenericServices; } - if (message.javaGenericServices === true) { + if (message.javaGenericServices !== false) { obj.javaGenericServices = message.javaGenericServices; } - if (message.pyGenericServices === true) { + if (message.pyGenericServices !== false) { obj.pyGenericServices = message.pyGenericServices; } - if (message.phpGenericServices === true) { + if (message.phpGenericServices !== false) { obj.phpGenericServices = message.phpGenericServices; } - if (message.deprecated === true) { + if (message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.ccEnableArenas === true) { + if (message.ccEnableArenas !== true) { obj.ccEnableArenas = message.ccEnableArenas; } if (message.objcClassPrefix !== "") { @@ -3596,7 +3617,6 @@ export const FileOptions = { create(base?: DeepPartial): FileOptions { return FileOptions.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): FileOptions { const message = Object.create(createBaseFileOptions()) as FileOptions; message.javaPackage = object.javaPackage ?? ""; @@ -3611,7 +3631,7 @@ export const FileOptions = { message.pyGenericServices = object.pyGenericServices ?? false; message.phpGenericServices = object.phpGenericServices ?? false; message.deprecated = object.deprecated ?? false; - message.ccEnableArenas = object.ccEnableArenas ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; message.objcClassPrefix = object.objcClassPrefix ?? ""; message.csharpNamespace = object.csharpNamespace ?? ""; message.swiftPrefix = object.swiftPrefix ?? ""; @@ -3636,16 +3656,16 @@ function createBaseMessageOptions(): MessageOptions { export const MessageOptions = { encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== false) { writer.uint32(8).bool(message.messageSetWireFormat); } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== false) { writer.uint32(16).bool(message.noStandardDescriptorAccessor); } - if (message.deprecated === true) { + if (message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.mapEntry === true) { + if (message.mapEntry !== false) { writer.uint32(56).bool(message.mapEntry); } for (const v of message.uninterpretedOption) { @@ -3786,13 +3806,15 @@ export const MessageOptions = { fromJSON(object: any): MessageOptions { return { - messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + messageSetWireFormat: isSet(object.messageSetWireFormat) + ? globalThis.Boolean(object.messageSetWireFormat) + : false, noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) - ? Boolean(object.noStandardDescriptorAccessor) + ? globalThis.Boolean(object.noStandardDescriptorAccessor) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? globalThis.Boolean(object.mapEntry) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -3800,16 +3822,16 @@ export const MessageOptions = { toJSON(message: MessageOptions): unknown { const obj: any = {}; - if (message.messageSetWireFormat === true) { + if (message.messageSetWireFormat !== false) { obj.messageSetWireFormat = message.messageSetWireFormat; } - if (message.noStandardDescriptorAccessor === true) { + if (message.noStandardDescriptorAccessor !== false) { obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; } - if (message.deprecated === true) { + if (message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.mapEntry === true) { + if (message.mapEntry !== false) { obj.mapEntry = message.mapEntry; } if (message.uninterpretedOption?.length) { @@ -3821,7 +3843,6 @@ export const MessageOptions = { create(base?: DeepPartial): MessageOptions { return MessageOptions.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): MessageOptions { const message = Object.create(createBaseMessageOptions()) as MessageOptions; message.messageSetWireFormat = object.messageSetWireFormat ?? false; @@ -3842,19 +3863,19 @@ export const FieldOptions = { if (message.ctype !== 0) { writer.uint32(8).int32(message.ctype); } - if (message.packed === true) { + if (message.packed !== false) { writer.uint32(16).bool(message.packed); } if (message.jstype !== 0) { writer.uint32(48).int32(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== false) { writer.uint32(40).bool(message.lazy); } - if (message.deprecated === true) { + if (message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } - if (message.weak === true) { + if (message.weak !== false) { writer.uint32(80).bool(message.weak); } for (const v of message.uninterpretedOption) { @@ -4010,12 +4031,12 @@ export const FieldOptions = { fromJSON(object: any): FieldOptions { return { ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, - packed: isSet(object.packed) ? Boolean(object.packed) : false, + packed: isSet(object.packed) ? globalThis.Boolean(object.packed) : false, jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, - lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - weak: isSet(object.weak) ? Boolean(object.weak) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -4026,19 +4047,19 @@ export const FieldOptions = { if (message.ctype !== 0) { obj.ctype = fieldOptions_CTypeToJSON(message.ctype); } - if (message.packed === true) { + if (message.packed !== false) { obj.packed = message.packed; } if (message.jstype !== 0) { obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); } - if (message.lazy === true) { + if (message.lazy !== false) { obj.lazy = message.lazy; } - if (message.deprecated === true) { + if (message.deprecated !== false) { obj.deprecated = message.deprecated; } - if (message.weak === true) { + if (message.weak !== false) { obj.weak = message.weak; } if (message.uninterpretedOption?.length) { @@ -4050,7 +4071,6 @@ export const FieldOptions = { create(base?: DeepPartial): FieldOptions { return FieldOptions.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): FieldOptions { const message = Object.create(createBaseFieldOptions()) as FieldOptions; message.ctype = object.ctype ?? 0; @@ -4180,7 +4200,7 @@ export const OneofOptions = { fromJSON(object: any): OneofOptions { return { - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -4197,7 +4217,6 @@ export const OneofOptions = { create(base?: DeepPartial): OneofOptions { return OneofOptions.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): OneofOptions { const message = Object.create(createBaseOneofOptions()) as OneofOptions; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; @@ -4211,10 +4230,10 @@ function createBaseEnumOptions(): EnumOptions { export const EnumOptions = { encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowAlias === true) { + if (message.allowAlias !== false) { writer.uint32(16).bool(message.allowAlias); } - if (message.deprecated === true) { + if (message.deprecated !== false) { writer.uint32(24).bool(message.deprecated); } for (const v of message.uninterpretedOption) { @@ -4341,9 +4360,9 @@ export const EnumOptions = { fromJSON(object: any): EnumOptions { return { - allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + allowAlias: isSet(object.allowAlias) ? globalThis.Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -4351,10 +4370,10 @@ export const EnumOptions = { toJSON(message: EnumOptions): unknown { const obj: any = {}; - if (message.allowAlias === true) { + if (message.allowAlias !== false) { obj.allowAlias = message.allowAlias; } - if (message.deprecated === true) { + if (message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -4366,7 +4385,6 @@ export const EnumOptions = { create(base?: DeepPartial): EnumOptions { return EnumOptions.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): EnumOptions { const message = Object.create(createBaseEnumOptions()) as EnumOptions; message.allowAlias = object.allowAlias ?? false; @@ -4382,7 +4400,7 @@ function createBaseEnumValueOptions(): EnumValueOptions { export const EnumValueOptions = { encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { + if (message.deprecated !== false) { writer.uint32(8).bool(message.deprecated); } for (const v of message.uninterpretedOption) { @@ -4502,8 +4520,8 @@ export const EnumValueOptions = { fromJSON(object: any): EnumValueOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -4511,7 +4529,7 @@ export const EnumValueOptions = { toJSON(message: EnumValueOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -4523,7 +4541,6 @@ export const EnumValueOptions = { create(base?: DeepPartial): EnumValueOptions { return EnumValueOptions.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): EnumValueOptions { const message = Object.create(createBaseEnumValueOptions()) as EnumValueOptions; message.deprecated = object.deprecated ?? false; @@ -4538,7 +4555,7 @@ function createBaseServiceOptions(): ServiceOptions { export const ServiceOptions = { encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { + if (message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } for (const v of message.uninterpretedOption) { @@ -4658,8 +4675,8 @@ export const ServiceOptions = { fromJSON(object: any): ServiceOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -4667,7 +4684,7 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.uninterpretedOption?.length) { @@ -4679,7 +4696,6 @@ export const ServiceOptions = { create(base?: DeepPartial): ServiceOptions { return ServiceOptions.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): ServiceOptions { const message = Object.create(createBaseServiceOptions()) as ServiceOptions; message.deprecated = object.deprecated ?? false; @@ -4694,7 +4710,7 @@ function createBaseMethodOptions(): MethodOptions { export const MethodOptions = { encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.deprecated === true) { + if (message.deprecated !== false) { writer.uint32(264).bool(message.deprecated); } if (message.idempotencyLevel !== 0) { @@ -4824,11 +4840,11 @@ export const MethodOptions = { fromJSON(object: any): MethodOptions { return { - deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - uninterpretedOption: Array.isArray(object?.uninterpretedOption) + uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], }; @@ -4836,7 +4852,7 @@ export const MethodOptions = { toJSON(message: MethodOptions): unknown { const obj: any = {}; - if (message.deprecated === true) { + if (message.deprecated !== false) { obj.deprecated = message.deprecated; } if (message.idempotencyLevel !== 0) { @@ -4851,7 +4867,6 @@ export const MethodOptions = { create(base?: DeepPartial): MethodOptions { return MethodOptions.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): MethodOptions { const message = Object.create(createBaseMethodOptions()) as MethodOptions; message.deprecated = object.deprecated ?? false; @@ -4993,13 +5008,15 @@ export const UninterpretedOption = { fromJSON(object: any): UninterpretedOption { return { - name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], - identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", - positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, - negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, - doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + name: globalThis.Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) + : [], + identifierValue: isSet(object.identifierValue) ? globalThis.String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? globalThis.Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? globalThis.Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? globalThis.Number(object.doubleValue) : 0, stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), - aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + aggregateValue: isSet(object.aggregateValue) ? globalThis.String(object.aggregateValue) : "", }; }, @@ -5032,7 +5049,6 @@ export const UninterpretedOption = { create(base?: DeepPartial): UninterpretedOption { return UninterpretedOption.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): UninterpretedOption { const message = Object.create(createBaseUninterpretedOption()) as UninterpretedOption; message.name = object.name?.map((e) => UninterpretedOption_NamePart.fromPartial(e)) || []; @@ -5055,7 +5071,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { writer.uint32(10).string(message.namePart); } - if (message.isExtension === true) { + if (message.isExtension !== false) { writer.uint32(16).bool(message.isExtension); } if (message._unknownFields !== undefined) { @@ -5120,8 +5136,8 @@ export const UninterpretedOption_NamePart = { fromJSON(object: any): UninterpretedOption_NamePart { return { - namePart: isSet(object.namePart) ? String(object.namePart) : "", - isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + namePart: isSet(object.namePart) ? globalThis.String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? globalThis.Boolean(object.isExtension) : false, }; }, @@ -5130,7 +5146,7 @@ export const UninterpretedOption_NamePart = { if (message.namePart !== "") { obj.namePart = message.namePart; } - if (message.isExtension === true) { + if (message.isExtension !== false) { obj.isExtension = message.isExtension; } return obj; @@ -5139,7 +5155,6 @@ export const UninterpretedOption_NamePart = { create(base?: DeepPartial): UninterpretedOption_NamePart { return UninterpretedOption_NamePart.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): UninterpretedOption_NamePart { const message = Object.create(createBaseUninterpretedOption_NamePart()) as UninterpretedOption_NamePart; message.namePart = object.namePart ?? ""; @@ -5212,7 +5227,7 @@ export const SourceCodeInfo = { fromJSON(object: any): SourceCodeInfo { return { - location: Array.isArray(object?.location) + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) : [], }; @@ -5229,7 +5244,6 @@ export const SourceCodeInfo = { create(base?: DeepPartial): SourceCodeInfo { return SourceCodeInfo.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): SourceCodeInfo { const message = Object.create(createBaseSourceCodeInfo()) as SourceCodeInfo; message.location = object.location?.map((e) => SourceCodeInfo_Location.fromPartial(e)) || []; @@ -5365,12 +5379,12 @@ export const SourceCodeInfo_Location = { fromJSON(object: any): SourceCodeInfo_Location { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - span: Array.isArray(object?.span) ? object.span.map((e: any) => Number(e)) : [], - leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", - trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", - leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) - ? object.leadingDetachedComments.map((e: any) => String(e)) + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? globalThis.String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? globalThis.String(object.trailingComments) : "", + leadingDetachedComments: globalThis.Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => globalThis.String(e)) : [], }; }, @@ -5398,7 +5412,6 @@ export const SourceCodeInfo_Location = { create(base?: DeepPartial): SourceCodeInfo_Location { return SourceCodeInfo_Location.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): SourceCodeInfo_Location { const message = Object.create(createBaseSourceCodeInfo_Location()) as SourceCodeInfo_Location; message.path = object.path?.map((e) => e) || []; @@ -5474,7 +5487,7 @@ export const GeneratedCodeInfo = { fromJSON(object: any): GeneratedCodeInfo { return { - annotation: Array.isArray(object?.annotation) + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) : [], }; @@ -5491,7 +5504,6 @@ export const GeneratedCodeInfo = { create(base?: DeepPartial): GeneratedCodeInfo { return GeneratedCodeInfo.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): GeneratedCodeInfo { const message = Object.create(createBaseGeneratedCodeInfo()) as GeneratedCodeInfo; message.annotation = object.annotation?.map((e) => GeneratedCodeInfo_Annotation.fromPartial(e)) || []; @@ -5605,10 +5617,10 @@ export const GeneratedCodeInfo_Annotation = { fromJSON(object: any): GeneratedCodeInfo_Annotation { return { - path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], - sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", - begin: isSet(object.begin) ? Number(object.begin) : 0, - end: isSet(object.end) ? Number(object.end) : 0, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? globalThis.String(object.sourceFile) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, }; }, @@ -5632,7 +5644,6 @@ export const GeneratedCodeInfo_Annotation = { create(base?: DeepPartial): GeneratedCodeInfo_Annotation { return GeneratedCodeInfo_Annotation.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): GeneratedCodeInfo_Annotation { const message = Object.create(createBaseGeneratedCodeInfo_Annotation()) as GeneratedCodeInfo_Annotation; message.path = object.path?.map((e) => e) || []; @@ -5643,30 +5654,11 @@ export const GeneratedCodeInfo_Annotation = { }, }; -declare const self: any | undefined; -declare const window: any | undefined; -declare const global: any | undefined; -const tsProtoGlobalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - function bytesFromBase64(b64: string): Uint8Array { - if (tsProtoGlobalThis.Buffer) { - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); } else { - const bin = tsProtoGlobalThis.atob(b64); + const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); @@ -5676,27 +5668,28 @@ function bytesFromBase64(b64: string): Uint8Array { } function base64FromBytes(arr: Uint8Array): string { - if (tsProtoGlobalThis.Buffer) { - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); + bin.push(globalThis.String.fromCharCode(byte)); }); - return tsProtoGlobalThis.btoa(bin.join("")); + return globalThis.btoa(bin.join("")); } } type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); } return long.toNumber(); } diff --git a/protos/package.json b/protos/package.json index b1737badb..0c333a836 100644 --- a/protos/package.json +++ b/protos/package.json @@ -1,6 +1,6 @@ { "name": "ts-proto-descriptors", - "version": "1.15.0", + "version": "1.16.0", "description": "", "repository": "github:stephenh/ts-proto", "keywords": [], @@ -16,7 +16,7 @@ "protobufjs": "^7.2.4" }, "devDependencies": { - "ts-proto": "^1.155.0", + "ts-proto": "^1.175.1", "typescript": "^5.1.3" } } diff --git a/protos/yarn.lock b/protos/yarn.lock index a73460ed8..b94768430 100644 --- a/protos/yarn.lock +++ b/protos/yarn.lock @@ -101,12 +101,12 @@ __metadata: languageName: node linkType: hard -"dprint-node@npm:^1.0.7": - version: 1.0.7 - resolution: "dprint-node@npm:1.0.7" +"dprint-node@npm:^1.0.8": + version: 1.0.8 + resolution: "dprint-node@npm:1.0.8" dependencies: detect-libc: ^1.0.3 - checksum: cd29f8e2b7de334273b4f53d24072718139635408b015963bcc80829cc785a84591462585b5b569791c8b1420c5672bec7499bda70d7298c58c8a3f43796e659 + checksum: ac53b71296d155664319877f0e8c9fe94e084457ce9aae68081b9dd7165916f2829222923c59b1399d95680362f18a8da5994e7f76a8f52035e02bbd14ba76bc languageName: node linkType: hard @@ -137,47 +137,37 @@ __metadata: languageName: node linkType: hard -"ts-poet@npm:^6.5.0": - version: 6.5.0 - resolution: "ts-poet@npm:6.5.0" +"ts-poet@npm:^6.7.0": + version: 6.9.0 + resolution: "ts-poet@npm:6.9.0" dependencies: - dprint-node: ^1.0.7 - checksum: 1a3705c7864cb0dc6f9305884a91a6582fdd93257977324cda8ea7e3e5dbd7525cbc3fb4d5753a088356a4b8b3fb9245d83c244740f52881725a79ab36d0d168 + dprint-node: ^1.0.8 + checksum: 04ee64e2e04614d13646fe08679e2e28993fdd14f4dd822d6993d7d8a93a9e77448f4e31d1b47d42d95f40b04b8adbbe187140be2b9a2027d0fcf151bffffac8 languageName: node linkType: hard -"ts-proto-descriptors@npm:1.13.0": - version: 1.13.0 - resolution: "ts-proto-descriptors@npm:1.13.0" - dependencies: - long: ^5.0.0 - protobufjs: ^7.2.4 - checksum: 5979d706d91cf3868a6a41ad182c679adc4ec79094d5f679a98c7e710c905f602cfe1d5d225140b98f70deaa4e920dfa3a7b259c1849e8fa1f2fde2b2ce2eb10 - languageName: node - linkType: hard - -"ts-proto-descriptors@workspace:.": +"ts-proto-descriptors@1.15.0, ts-proto-descriptors@workspace:.": version: 0.0.0-use.local resolution: "ts-proto-descriptors@workspace:." dependencies: long: ^5.2.3 protobufjs: ^7.2.4 - ts-proto: ^1.155.0 + ts-proto: ^1.175.1 typescript: ^5.1.3 languageName: unknown linkType: soft -"ts-proto@npm:^1.155.0": - version: 1.155.0 - resolution: "ts-proto@npm:1.155.0" +"ts-proto@npm:^1.175.1": + version: 1.175.1 + resolution: "ts-proto@npm:1.175.1" dependencies: case-anything: ^2.1.13 protobufjs: ^7.2.4 - ts-poet: ^6.5.0 - ts-proto-descriptors: 1.13.0 + ts-poet: ^6.7.0 + ts-proto-descriptors: 1.15.0 bin: protoc-gen-ts_proto: protoc-gen-ts_proto - checksum: e159bd3e7539c98e362fc3ab10a8bb96fabf1f9c10d80ace794608910f9ac98102f2dbcaeb075b825951dac8d0c642d69ea1bdcc7841cce79520eb7e55983ae1 + checksum: 08b1736dab4bbeaeed59df8ff64feb5184970058a830469876b39ef8d9f4d1ce3c408c601ed33ebff0867059ce32a23a97f9284cb1c2cf6ad5c665504ed865e3 languageName: node linkType: hard diff --git a/yarn.lock b/yarn.lock index 14c41226d..14d083364 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7836,13 +7836,13 @@ __metadata: languageName: node linkType: hard -"ts-proto-descriptors@npm:1.15.0": - version: 1.15.0 - resolution: "ts-proto-descriptors@npm:1.15.0" +"ts-proto-descriptors@npm:1.16.0": + version: 1.16.0 + resolution: "ts-proto-descriptors@npm:1.16.0" dependencies: long: ^5.2.3 protobufjs: ^7.2.4 - checksum: 50e77d7c89dc52e9e74ee859e3232cece527d59ddcce515852059df70b4d80b49e73eb65166ec87f6f9238cadc2c77eb05695724f82aa4501bc2378fb2457643 + checksum: f1b29955f3ee7e2a8e7ac237dd9e7d7443ab4bb72b666c753381be0296c1cf8a002e419b3844c3226fcaa945cf9755e88b5adee6d3596803484366436470b3c7 languageName: node linkType: hard @@ -7885,7 +7885,7 @@ __metadata: semantic-release: ^21.0.7 ts-jest: ^29.1.1 ts-poet: ^6.7.0 - ts-proto-descriptors: 1.15.0 + ts-proto-descriptors: 1.16.0 tsx: ^3.14.0 typescript: ^5.1.6 uglify-js: ^3.17.4