From 12c5c863d5a40117d888879825ec30a131f90ada Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Sat, 3 Sep 2022 13:26:08 -0500 Subject: [PATCH 1/2] feat: Bump ts-poet for dprint perf increase. --- integration/codegen.ts | 10 ++-------- package.json | 2 +- src/options.ts | 1 + src/plugin.ts | 8 ++++---- tests/types-test.ts | 2 +- yarn.lock | 33 +++++++++++++++++---------------- 6 files changed, 26 insertions(+), 30 deletions(-) diff --git a/integration/codegen.ts b/integration/codegen.ts index 16e77a21c..c3015e5a2 100644 --- a/integration/codegen.ts +++ b/integration/codegen.ts @@ -39,10 +39,7 @@ async function generate(binFile: string, baseDir: string, parameter: string) { const filePath = `${baseDir}/${path}`; const dirPath = parse(filePath).dir; await promisify(mkdir)(dirPath, { recursive: true }).catch(() => {}); - await promisify(writeFile)( - filePath, - prefixDisableLinter(await code.toStringWithImports({ ...getTsPoetOpts(options), path })) - ); + await promisify(writeFile)(filePath, code.toString({ ...getTsPoetOpts(options), path })); } if (options.outputTypeRegistry) { @@ -54,10 +51,7 @@ async function generate(binFile: string, baseDir: string, parameter: string) { const filePath = `${baseDir}/${path}`; - await promisify(writeFile)( - filePath, - prefixDisableLinter(await code.toStringWithImports({ ...getTsPoetOpts(options), path })) - ); + await promisify(writeFile)(filePath, code.toString({ ...getTsPoetOpts(options), path })); } } diff --git a/package.json b/package.json index 3cd2e0fa2..9378e0e0e 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "dataloader": "^1.4.0", "object-hash": "^1.3.1", "protobufjs": "^6.11.3", - "ts-poet": "^5.1.0", + "ts-poet": "^6.1.0", "ts-proto-descriptors": "1.7.1" } } diff --git a/src/options.ts b/src/options.ts index 68e2b63b5..80373202c 100644 --- a/src/options.ts +++ b/src/options.ts @@ -214,6 +214,7 @@ function parseParameter(parameter: string): Options { export function getTsPoetOpts(_options: Options): ToStringOpts { const imports = ["protobufjs/minimal" + _options.importSuffix]; return { + prefix: `/* eslint-disable */`, dprintOptions: { preferSingleLine: true, lineWidth: 120 }, ...(_options.esModuleInterop ? { forceDefaultImport: imports } : { forceModuleImport: imports }), }; diff --git a/src/plugin.ts b/src/plugin.ts index 81264bb74..c9e1ed181 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -28,8 +28,8 @@ async function main() { const files = await Promise.all( filesToGenerate.map(async (file) => { const [path, code] = generateFile(ctx, file); - const spec = await code.toStringWithImports({ ...getTsPoetOpts(options), path }); - return { name: path, content: prefixDisableLinter(spec) }; + const content = code.toString({ ...getTsPoetOpts(options), path }); + return { name: path, content }; }) ); @@ -40,8 +40,8 @@ async function main() { const path = "typeRegistry.ts"; const code = generateTypeRegistry(ctx); - const spec = await code.toStringWithImports({ ...getTsPoetOpts(options), path }); - files.push({ name: path, content: prefixDisableLinter(spec) }); + const content = code.toString({ ...getTsPoetOpts(options), path }); + files.push({ name: path, content }); } const response = CodeGeneratorResponse.fromPartial({ diff --git a/tests/types-test.ts b/tests/types-test.ts index 18038af30..9d37b2185 100644 --- a/tests/types-test.ts +++ b/tests/types-test.ts @@ -59,7 +59,7 @@ describe("types", () => { it(t.descr, async () => { const ctx = { options: defaultOptions(), utils: undefined as any as Utils, ...t }; const got = messageToTypeName(ctx, t.protoType); - expect(await got.toStringWithImports()).toEqual(await t.expected.toStringWithImports()); + expect(got.toString()).toEqual(t.expected.toString()); }) ); }); diff --git a/yarn.lock b/yarn.lock index 14e457b66..427fc41b0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -338,16 +338,6 @@ resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== -"@dprint/formatter@^0.2.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@dprint/formatter/-/formatter-0.2.0.tgz#5eb044e0969ef5b918b26db42eb9d75e7c6661ee" - integrity sha512-E1q1JaOPeEUBhG//IUayqJQvNpqprZ0OCF8B/bIhUqSsMIp0Y74PgF8JPvDCrOdq43qiGUYAavVO8iCBHOoU/A== - -"@dprint/typescript@^0.71.2": - version "0.71.2" - resolved "https://registry.yarnpkg.com/@dprint/typescript/-/typescript-0.71.2.tgz#07cba75950be8aee753d6983d1f6144cba65db49" - integrity sha512-QpQJiJMxSMhqqOgVk1zrh+2ueQnZmBQ6aCtVgXKd3zxyVOEIj5CLarfDmza/9KFOU+5lKsprbGAQBskC+xODkw== - "@esbuild-kit/cjs-loader@^2.3.3": version "2.3.3" resolved "https://registry.yarnpkg.com/@esbuild-kit/cjs-loader/-/cjs-loader-2.3.3.tgz#d65a8cc099d88ac58a571403428d82d1a791aefa" @@ -2574,6 +2564,11 @@ deprecation@^2.0.0, deprecation@^2.3.1: resolved "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz" integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== +detect-libc@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg== + detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz" @@ -2616,6 +2611,13 @@ dot-prop@^5.1.0: dependencies: is-obj "^2.0.0" +dprint-node@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/dprint-node/-/dprint-node-1.0.7.tgz#f571eaf61affb3a696cff1bdde78a021875ba540" + integrity sha512-NTZOW9A7ipb0n7z7nC3wftvsbceircwVHSgzobJsEQa+7RnOMbhrfX5IflA6CtC4GA63DSAiHYXa4JKEy9F7cA== + dependencies: + detect-libc "^1.0.3" + duplexer2@~0.1.0: version "0.1.4" resolved "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz" @@ -6733,13 +6735,12 @@ ts-jest@^28.0.5: semver "7.x" yargs-parser "^21.0.1" -ts-poet@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/ts-poet/-/ts-poet-5.1.0.tgz#7f27bbef5c6ca43df066b405e89a5d8b3598c0bc" - integrity sha512-OaqL9852TaBgZtgOPlQw/Ab5KAdsZbZfNKz22prb8vsl4Iu9XMOv1V3DiFuaT3dnhhrhdFUe1SiXY3RaeYBiSw== +ts-poet@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/ts-poet/-/ts-poet-6.1.0.tgz#c5c3d679dfce1fe39acb5f5415275c5d6a598cb7" + integrity sha512-PFwbNJjGrb44wzHUGQicG2/nhjR+3+k7zYLDTa8D61NVUitl7K/JgIc9/P+8oMNenntKzLc8tjLDOkPrxIhm6A== dependencies: - "@dprint/formatter" "^0.2.0" - "@dprint/typescript" "^0.71.2" + dprint-node "^1.0.7" ts-proto-descriptors@1.7.1: version "1.7.1" From fa3c99b8c339597576b686b911f9c6743fc17e41 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Sat, 3 Sep 2022 13:31:31 -0500 Subject: [PATCH 2/2] Re-codegen. --- integration/async-iterable-services/simple.ts | 4 +- .../simple2.ts | 1 + integration/avoid-import-conflicts/simple.ts | 6 +-- integration/batching-with-context/batching.ts | 20 ++++----- integration/batching/batching.ts | 14 +++--- integration/bytes-as-base64/message.ts | 5 ++- .../bytes-node/google/protobuf/wrappers.ts | 4 +- integration/bytes-node/point.ts | 4 +- integration/generic-metadata/hero.ts | 8 ++-- integration/grpc-js/google/protobuf/struct.ts | 10 ++--- .../grpc-js/google/protobuf/wrappers.ts | 4 +- integration/grpc-js/simple.ts | 2 +- integration/grpc-web-go-server/example.ts | 16 +++---- .../example.ts | 8 ++-- integration/grpc-web-no-streaming/example.ts | 8 ++-- integration/grpc-web/example.ts | 10 ++--- integration/lower-case-svc-methods/math.ts | 10 ++--- .../meta-typings/google/protobuf/timestamp.ts | 2 +- integration/meta-typings/simple.ts | 2 +- integration/nestjs-metadata-grpc-js/hero.ts | 2 +- .../nestjs-metadata-observables/hero.ts | 2 +- .../nestjs-metadata-restparameters/hero.ts | 2 +- integration/nestjs-metadata/hero.ts | 2 +- integration/nestjs-restparameters/hero.ts | 2 +- integration/nestjs-simple-observables/hero.ts | 2 +- .../google/protobuf/empty.ts | 1 + .../nestjs-simple-restparameters/hero.ts | 2 +- .../nestjs-simple/google/protobuf/empty.ts | 1 + .../google/protobuf/timestamp.ts | 1 + integration/nestjs-simple/hero.ts | 2 +- .../nice-grpc/google/protobuf/struct.ts | 10 ++--- .../nice-grpc/google/protobuf/wrappers.ts | 4 +- .../no-proto-package/no-proto-package.ts | 2 +- integration/oneof-properties/oneof.ts | 12 ++--- .../google/protobuf/struct.ts | 29 ++++++------ .../oneof-unions/google/protobuf/struct.ts | 28 ++++++------ integration/oneof-unions/oneof.ts | 22 +++++----- integration/only-types/google/protobuf/any.ts | 1 + .../only-types/google/protobuf/timestamp.ts | 1 + .../options/google/protobuf/descriptor.ts | 22 +++++----- integration/options/options.ts | 2 +- integration/simple-json-name/simple.ts | 2 +- .../google/protobuf/wrappers.ts | 4 +- .../simple-long/google/protobuf/wrappers.ts | 4 +- integration/simple-long/simple.ts | 6 +-- .../google/protobuf/wrappers.ts | 4 +- integration/simple-optionals/simple.ts | 22 +++++----- .../google/protobuf/wrappers.ts | 4 +- .../simple-prototype-defaults/simple.ts | 44 +++++++++---------- .../simple-snake/google/protobuf/struct.ts | 10 ++--- .../simple-snake/google/protobuf/wrappers.ts | 4 +- integration/simple-snake/simple.ts | 22 +++++----- .../google/protobuf/struct.ts | 10 ++--- integration/simple-string-enums/simple.ts | 2 +- .../google/protobuf/wrappers.ts | 4 +- .../simple-unrecognized-enum/simple.ts | 22 +++++----- .../simple/google/protobuf/wrappers.ts | 4 +- integration/simple/simple.ts | 44 +++++++++---------- integration/struct/google/protobuf/struct.ts | 10 ++--- .../type-registry/google/protobuf/struct.ts | 10 ++--- integration/unknown-fields/options.ts | 2 +- .../use-date-string/use-date-string.ts | 2 +- integration/use-date-true/use-date-true.ts | 4 +- .../google/protobuf/duration.ts | 1 + .../google/protobuf/field_mask.ts | 1 + .../google/protobuf/timestamp.ts | 1 + .../use-json-wire-format.ts | 1 + .../google/protobuf/struct.ts | 10 ++--- integration/use-numeric-enum-json/simple.ts | 2 +- .../use-objectid-true.ts | 2 +- integration/use-optionals-all/test.ts | 26 +++++------ integration/value/google/protobuf/struct.ts | 10 ++--- integration/value/google/protobuf/wrappers.ts | 4 +- integration/value/value.ts | 4 +- integration/vector-tile/vector_tile.ts | 12 ++--- 75 files changed, 306 insertions(+), 298 deletions(-) diff --git a/integration/async-iterable-services/simple.ts b/integration/async-iterable-services/simple.ts index 6a089103b..6b478bce1 100644 --- a/integration/async-iterable-services/simple.ts +++ b/integration/async-iterable-services/simple.ts @@ -111,7 +111,7 @@ export class EchoerClientImpl implements Echoer { Echo(request: EchoMsg): Promise { const data = EchoMsg.encode(request).finish(); const promise = this.rpc.request("simple.Echoer", "Echo", data); - return promise.then(data => EchoMsg.decode(new _m0.Reader(data))); + return promise.then((data) => EchoMsg.decode(new _m0.Reader(data))); } EchoServerStream(request: EchoMsg): AsyncIterable { @@ -123,7 +123,7 @@ export class EchoerClientImpl implements Echoer { EchoClientStream(request: AsyncIterable): Promise { const data = EchoMsg.encodeTransform(request); const promise = this.rpc.clientStreamingRequest("simple.Echoer", "EchoClientStream", data); - return promise.then(data => EchoMsg.decode(new _m0.Reader(data))); + return promise.then((data) => EchoMsg.decode(new _m0.Reader(data))); } EchoBidiStream(request: AsyncIterable): AsyncIterable { diff --git a/integration/avoid-import-conflicts-types-only/simple2.ts b/integration/avoid-import-conflicts-types-only/simple2.ts index 3a1f32737..8c35f3697 100644 --- a/integration/avoid-import-conflicts-types-only/simple2.ts +++ b/integration/avoid-import-conflicts-types-only/simple2.ts @@ -1,4 +1,5 @@ /* eslint-disable */ + export const protobufPackage = "simple2"; export enum SimpleEnum { diff --git a/integration/avoid-import-conflicts/simple.ts b/integration/avoid-import-conflicts/simple.ts index 92e3e638f..aace713cf 100644 --- a/integration/avoid-import-conflicts/simple.ts +++ b/integration/avoid-import-conflicts/simple.ts @@ -115,8 +115,8 @@ export const Simple = { toJSON(message: Simple): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); - message.otherSimple !== undefined - && (obj.otherSimple = message.otherSimple ? Simple3.toJSON(message.otherSimple) : undefined); + message.otherSimple !== undefined && + (obj.otherSimple = message.otherSimple ? Simple3.toJSON(message.otherSimple) : undefined); return obj; }, @@ -295,7 +295,7 @@ export class FooServiceClientImpl implements FooService { Create(request: FooServiceCreateRequest): Promise { const data = FooServiceCreateRequest.encode(request).finish(); const promise = this.rpc.request("simple.FooService", "Create", data); - return promise.then(data => FooServiceCreateResponse.decode(new _m0.Reader(data))); + return promise.then((data) => FooServiceCreateResponse.decode(new _m0.Reader(data))); } } diff --git a/integration/batching-with-context/batching.ts b/integration/batching-with-context/batching.ts index 206e90383..348ebbe2d 100644 --- a/integration/batching-with-context/batching.ts +++ b/integration/batching-with-context/batching.ts @@ -83,7 +83,7 @@ export const BatchQueryRequest = { toJSON(message: BatchQueryRequest): unknown { const obj: any = {}; if (message.ids) { - obj.ids = message.ids.map(e => e); + obj.ids = message.ids.map((e) => e); } else { obj.ids = []; } @@ -134,7 +134,7 @@ export const BatchQueryResponse = { toJSON(message: BatchQueryResponse): unknown { const obj: any = {}; if (message.entities) { - obj.entities = message.entities.map(e => e ? Entity.toJSON(e) : undefined); + obj.entities = message.entities.map((e) => e ? Entity.toJSON(e) : undefined); } else { obj.entities = []; } @@ -185,7 +185,7 @@ export const BatchMapQueryRequest = { toJSON(message: BatchMapQueryRequest): unknown { const obj: any = {}; if (message.ids) { - obj.ids = message.ids.map(e => e); + obj.ids = message.ids.map((e) => e); } else { obj.ids = []; } @@ -589,7 +589,7 @@ export class EntityServiceClientImpl implements Ent const dl = ctx.getDataLoader("batching.EntityService.BatchQuery", () => { return new DataLoader((ids) => { const request = { ids }; - return this.BatchQuery(ctx, request).then(res => res.entities); + return this.BatchQuery(ctx, request).then((res) => res.entities); }, { cacheKeyFn: hash, ...ctx.rpcDataLoaderOptions }); }); return dl.load(id); @@ -598,15 +598,15 @@ export class EntityServiceClientImpl implements Ent BatchQuery(ctx: Context, request: BatchQueryRequest): Promise { const data = BatchQueryRequest.encode(request).finish(); const promise = this.rpc.request(ctx, "batching.EntityService", "BatchQuery", data); - return promise.then(data => BatchQueryResponse.decode(new _m0.Reader(data))); + return promise.then((data) => BatchQueryResponse.decode(new _m0.Reader(data))); } GetMapQuery(ctx: Context, id: string): Promise { const dl = ctx.getDataLoader("batching.EntityService.BatchMapQuery", () => { return new DataLoader((ids) => { const request = { ids }; - return this.BatchMapQuery(ctx, request).then(res => { - return ids.map(key => res.entities[key]); + return this.BatchMapQuery(ctx, request).then((res) => { + return ids.map((key) => res.entities[key]); }); }, { cacheKeyFn: hash, ...ctx.rpcDataLoaderOptions }); }); @@ -616,13 +616,13 @@ export class EntityServiceClientImpl implements Ent BatchMapQuery(ctx: Context, request: BatchMapQueryRequest): Promise { const data = BatchMapQueryRequest.encode(request).finish(); const promise = this.rpc.request(ctx, "batching.EntityService", "BatchMapQuery", data); - return promise.then(data => BatchMapQueryResponse.decode(new _m0.Reader(data))); + return promise.then((data) => BatchMapQueryResponse.decode(new _m0.Reader(data))); } GetOnlyMethod(ctx: Context, request: GetOnlyMethodRequest): Promise { const dl = ctx.getDataLoader("batching.EntityService.GetOnlyMethod", () => { return new DataLoader((requests) => { - const responses = requests.map(async request => { + const responses = requests.map(async (request) => { const data = GetOnlyMethodRequest.encode(request).finish(); const response = await this.rpc.request(ctx, "batching.EntityService", "GetOnlyMethod", data); return GetOnlyMethodResponse.decode(new _m0.Reader(response)); @@ -636,7 +636,7 @@ export class EntityServiceClientImpl implements Ent WriteMethod(ctx: Context, request: WriteMethodRequest): Promise { const data = WriteMethodRequest.encode(request).finish(); const promise = this.rpc.request(ctx, "batching.EntityService", "WriteMethod", data); - return promise.then(data => WriteMethodResponse.decode(new _m0.Reader(data))); + return promise.then((data) => WriteMethodResponse.decode(new _m0.Reader(data))); } } diff --git a/integration/batching/batching.ts b/integration/batching/batching.ts index 5fc240c0f..e7e3a3070 100644 --- a/integration/batching/batching.ts +++ b/integration/batching/batching.ts @@ -81,7 +81,7 @@ export const BatchQueryRequest = { toJSON(message: BatchQueryRequest): unknown { const obj: any = {}; if (message.ids) { - obj.ids = message.ids.map(e => e); + obj.ids = message.ids.map((e) => e); } else { obj.ids = []; } @@ -132,7 +132,7 @@ export const BatchQueryResponse = { toJSON(message: BatchQueryResponse): unknown { const obj: any = {}; if (message.entities) { - obj.entities = message.entities.map(e => e ? Entity.toJSON(e) : undefined); + obj.entities = message.entities.map((e) => e ? Entity.toJSON(e) : undefined); } else { obj.entities = []; } @@ -183,7 +183,7 @@ export const BatchMapQueryRequest = { toJSON(message: BatchMapQueryRequest): unknown { const obj: any = {}; if (message.ids) { - obj.ids = message.ids.map(e => e); + obj.ids = message.ids.map((e) => e); } else { obj.ids = []; } @@ -584,25 +584,25 @@ export class EntityServiceClientImpl implements EntityService { BatchQuery(request: BatchQueryRequest): Promise { const data = BatchQueryRequest.encode(request).finish(); const promise = this.rpc.request("batching.EntityService", "BatchQuery", data); - return promise.then(data => BatchQueryResponse.decode(new _m0.Reader(data))); + return promise.then((data) => BatchQueryResponse.decode(new _m0.Reader(data))); } BatchMapQuery(request: BatchMapQueryRequest): Promise { const data = BatchMapQueryRequest.encode(request).finish(); const promise = this.rpc.request("batching.EntityService", "BatchMapQuery", data); - return promise.then(data => BatchMapQueryResponse.decode(new _m0.Reader(data))); + return promise.then((data) => BatchMapQueryResponse.decode(new _m0.Reader(data))); } GetOnlyMethod(request: GetOnlyMethodRequest): Promise { const data = GetOnlyMethodRequest.encode(request).finish(); const promise = this.rpc.request("batching.EntityService", "GetOnlyMethod", data); - return promise.then(data => GetOnlyMethodResponse.decode(new _m0.Reader(data))); + return promise.then((data) => GetOnlyMethodResponse.decode(new _m0.Reader(data))); } WriteMethod(request: WriteMethodRequest): Promise { const data = WriteMethodRequest.encode(request).finish(); const promise = this.rpc.request("batching.EntityService", "WriteMethod", data); - return promise.then(data => WriteMethodResponse.decode(new _m0.Reader(data))); + return promise.then((data) => WriteMethodResponse.decode(new _m0.Reader(data))); } } diff --git a/integration/bytes-as-base64/message.ts b/integration/bytes-as-base64/message.ts index f26c8ade2..11eda8f8d 100644 --- a/integration/bytes-as-base64/message.ts +++ b/integration/bytes-as-base64/message.ts @@ -1,4 +1,5 @@ /* eslint-disable */ + export const protobufPackage = ""; export interface Message { @@ -16,8 +17,8 @@ export const Message = { toJSON(message: Message): unknown { const obj: any = {}; - message.data !== undefined - && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); return obj; }, diff --git a/integration/bytes-node/google/protobuf/wrappers.ts b/integration/bytes-node/google/protobuf/wrappers.ts index 04ef29722..d1b77e648 100644 --- a/integration/bytes-node/google/protobuf/wrappers.ts +++ b/integration/bytes-node/google/protobuf/wrappers.ts @@ -506,8 +506,8 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : Buffer.alloc(0))); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : Buffer.alloc(0))); return obj; }, diff --git a/integration/bytes-node/point.ts b/integration/bytes-node/point.ts index 95b71cb56..ee299e099 100644 --- a/integration/bytes-node/point.ts +++ b/integration/bytes-node/point.ts @@ -54,8 +54,8 @@ export const Point = { toJSON(message: Point): unknown { const obj: any = {}; - message.data !== undefined - && (obj.data = base64FromBytes(message.data !== undefined ? message.data : Buffer.alloc(0))); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : Buffer.alloc(0))); message.dataWrapped !== undefined && (obj.dataWrapped = message.dataWrapped); return obj; }, diff --git a/integration/generic-metadata/hero.ts b/integration/generic-metadata/hero.ts index dfcff6f54..d73fdc795 100644 --- a/integration/generic-metadata/hero.ts +++ b/integration/generic-metadata/hero.ts @@ -245,19 +245,19 @@ export class HeroServiceClientImpl implements HeroService { FindOneHero(request: HeroById): Promise { const data = HeroById.encode(request).finish(); const promise = this.rpc.request("hero.HeroService", "FindOneHero", data); - return promise.then(data => Hero.decode(new _m0.Reader(data))); + return promise.then((data) => Hero.decode(new _m0.Reader(data))); } FindOneVillain(request: VillainById): Promise { const data = VillainById.encode(request).finish(); const promise = this.rpc.request("hero.HeroService", "FindOneVillain", data); - return promise.then(data => Villain.decode(new _m0.Reader(data))); + return promise.then((data) => Villain.decode(new _m0.Reader(data))); } FindManyVillain(request: Observable): Observable { - const data = request.pipe(map(request => VillainById.encode(request).finish())); + const data = request.pipe(map((request) => VillainById.encode(request).finish())); const result = this.rpc.bidirectionalStreamingRequest("hero.HeroService", "FindManyVillain", data); - return result.pipe(map(data => Villain.decode(new _m0.Reader(data)))); + return result.pipe(map((data) => Villain.decode(new _m0.Reader(data)))); } } diff --git a/integration/grpc-js/google/protobuf/struct.ts b/integration/grpc-js/google/protobuf/struct.ts index 8c712529b..80a98258e 100644 --- a/integration/grpc-js/google/protobuf/struct.ts +++ b/integration/grpc-js/google/protobuf/struct.ts @@ -174,7 +174,7 @@ export const Struct = { wrap(object: { [key: string]: any } | undefined): Struct { const struct = createBaseStruct(); if (object !== undefined) { - Object.keys(object).forEach(key => { + Object.keys(object).forEach((key) => { struct.fields[key] = object[key]; }); } @@ -183,7 +183,7 @@ export const Struct = { unwrap(message: Struct): { [key: string]: any } { const object: { [key: string]: any } = {}; - Object.keys(message.fields).forEach(key => { + Object.keys(message.fields).forEach((key) => { object[key] = message.fields[key]; }); return object; @@ -325,8 +325,8 @@ export const Value = { toJSON(message: Value): unknown { const obj: any = {}; - message.nullValue !== undefined - && (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); + message.nullValue !== undefined && + (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); message.numberValue !== undefined && (obj.numberValue = message.numberValue); message.stringValue !== undefined && (obj.stringValue = message.stringValue); message.boolValue !== undefined && (obj.boolValue = message.boolValue); @@ -423,7 +423,7 @@ export const ListValue = { toJSON(message: ListValue): unknown { const obj: any = {}; if (message.values) { - obj.values = message.values.map(e => e); + obj.values = message.values.map((e) => e); } else { obj.values = []; } diff --git a/integration/grpc-js/google/protobuf/wrappers.ts b/integration/grpc-js/google/protobuf/wrappers.ts index 22e0e03e4..3145298cb 100644 --- a/integration/grpc-js/google/protobuf/wrappers.ts +++ b/integration/grpc-js/google/protobuf/wrappers.ts @@ -506,8 +506,8 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, diff --git a/integration/grpc-js/simple.ts b/integration/grpc-js/simple.ts index 167ac710b..d0dae3ae0 100644 --- a/integration/grpc-js/simple.ts +++ b/integration/grpc-js/simple.ts @@ -617,7 +617,7 @@ export interface TestClient extends Client { } export const TestClient = makeGenericClientConstructor(TestService, "simple.Test") as unknown as { - new(address: string, credentials: ChannelCredentials, options?: Partial): TestClient; + new (address: string, credentials: ChannelCredentials, options?: Partial): TestClient; service: typeof TestService; }; diff --git a/integration/grpc-web-go-server/example.ts b/integration/grpc-web-go-server/example.ts index 20e616ead..d0254516d 100644 --- a/integration/grpc-web-go-server/example.ts +++ b/integration/grpc-web-go-server/example.ts @@ -204,10 +204,10 @@ export const DashUserSettingsState = { toJSON(message: DashUserSettingsState): unknown { const obj: any = {}; message.email !== undefined && (obj.email = message.email); - message.urls !== undefined - && (obj.urls = message.urls ? DashUserSettingsState_URLs.toJSON(message.urls) : undefined); + message.urls !== undefined && + (obj.urls = message.urls ? DashUserSettingsState_URLs.toJSON(message.urls) : undefined); if (message.flashes) { - obj.flashes = message.flashes.map(e => e ? DashFlash.toJSON(e) : undefined); + obj.flashes = message.flashes.map((e) => e ? DashFlash.toJSON(e) : undefined); } else { obj.flashes = []; } @@ -605,13 +605,13 @@ export class DashStateClientImpl implements DashState { UserSettings(request: Empty): Promise { const data = Empty.encode(request).finish(); const promise = this.rpc.request("rpx.DashState", "UserSettings", data); - return promise.then(data => DashUserSettingsState.decode(new _m0.Reader(data))); + return promise.then((data) => DashUserSettingsState.decode(new _m0.Reader(data))); } ActiveUserSettingsStream(request: Empty): Observable { const data = Empty.encode(request).finish(); const result = this.rpc.serverStreamingRequest("rpx.DashState", "ActiveUserSettingsStream", data); - return result.pipe(map(data => DashUserSettingsState.decode(new _m0.Reader(data)))); + return result.pipe(map((data) => DashUserSettingsState.decode(new _m0.Reader(data)))); } } @@ -637,19 +637,19 @@ export class DashAPICredsClientImpl implements DashAPICreds { Create(request: DashAPICredsCreateReq): Promise { const data = DashAPICredsCreateReq.encode(request).finish(); const promise = this.rpc.request("rpx.DashAPICreds", "Create", data); - return promise.then(data => DashCred.decode(new _m0.Reader(data))); + return promise.then((data) => DashCred.decode(new _m0.Reader(data))); } Update(request: DashAPICredsUpdateReq): Promise { const data = DashAPICredsUpdateReq.encode(request).finish(); const promise = this.rpc.request("rpx.DashAPICreds", "Update", data); - return promise.then(data => DashCred.decode(new _m0.Reader(data))); + return promise.then((data) => DashCred.decode(new _m0.Reader(data))); } Delete(request: DashAPICredsDeleteReq): Promise { const data = DashAPICredsDeleteReq.encode(request).finish(); const promise = this.rpc.request("rpx.DashAPICreds", "Delete", data); - return promise.then(data => DashCred.decode(new _m0.Reader(data))); + return promise.then((data) => DashCred.decode(new _m0.Reader(data))); } } diff --git a/integration/grpc-web-no-streaming-observable/example.ts b/integration/grpc-web-no-streaming-observable/example.ts index 9ff392207..3c2bdc5f2 100644 --- a/integration/grpc-web-no-streaming-observable/example.ts +++ b/integration/grpc-web-no-streaming-observable/example.ts @@ -182,10 +182,10 @@ export const DashUserSettingsState = { toJSON(message: DashUserSettingsState): unknown { const obj: any = {}; message.email !== undefined && (obj.email = message.email); - message.urls !== undefined - && (obj.urls = message.urls ? DashUserSettingsState_URLs.toJSON(message.urls) : undefined); + message.urls !== undefined && + (obj.urls = message.urls ? DashUserSettingsState_URLs.toJSON(message.urls) : undefined); if (message.flashes) { - obj.flashes = message.flashes.map(e => e ? DashFlash.toJSON(e) : undefined); + obj.flashes = message.flashes.map((e) => e ? DashFlash.toJSON(e) : undefined); } else { obj.flashes = []; } @@ -393,7 +393,7 @@ export class GrpcWebImpl { const maybeCombinedMetadata = metadata && this.options.metadata ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap }) : metadata || this.options.metadata; - return new Observable(observer => { + return new Observable((observer) => { grpc.unary(methodDesc, { request, host: this.host, diff --git a/integration/grpc-web-no-streaming/example.ts b/integration/grpc-web-no-streaming/example.ts index 4c41e3cfa..bbf9663cd 100644 --- a/integration/grpc-web-no-streaming/example.ts +++ b/integration/grpc-web-no-streaming/example.ts @@ -180,10 +180,10 @@ export const DashUserSettingsState = { toJSON(message: DashUserSettingsState): unknown { const obj: any = {}; message.email !== undefined && (obj.email = message.email); - message.urls !== undefined - && (obj.urls = message.urls ? DashUserSettingsState_URLs.toJSON(message.urls) : undefined); + message.urls !== undefined && + (obj.urls = message.urls ? DashUserSettingsState_URLs.toJSON(message.urls) : undefined); if (message.flashes) { - obj.flashes = message.flashes.map(e => e ? DashFlash.toJSON(e) : undefined); + obj.flashes = message.flashes.map((e) => e ? DashFlash.toJSON(e) : undefined); } else { obj.flashes = []; } @@ -398,7 +398,7 @@ export class GrpcWebImpl { metadata: maybeCombinedMetadata, transport: this.options.transport, debug: this.options.debug, - onEnd: function(response) { + onEnd: function (response) { if (response.status === grpc.Code.OK) { resolve(response.message); } else { diff --git a/integration/grpc-web/example.ts b/integration/grpc-web/example.ts index 3d5482797..52a451c85 100644 --- a/integration/grpc-web/example.ts +++ b/integration/grpc-web/example.ts @@ -206,10 +206,10 @@ export const DashUserSettingsState = { toJSON(message: DashUserSettingsState): unknown { const obj: any = {}; message.email !== undefined && (obj.email = message.email); - message.urls !== undefined - && (obj.urls = message.urls ? DashUserSettingsState_URLs.toJSON(message.urls) : undefined); + message.urls !== undefined && + (obj.urls = message.urls ? DashUserSettingsState_URLs.toJSON(message.urls) : undefined); if (message.flashes) { - obj.flashes = message.flashes.map(e => e ? DashFlash.toJSON(e) : undefined); + obj.flashes = message.flashes.map((e) => e ? DashFlash.toJSON(e) : undefined); } else { obj.flashes = []; } @@ -836,7 +836,7 @@ export class GrpcWebImpl { metadata: maybeCombinedMetadata, transport: this.options.transport, debug: this.options.debug, - onEnd: function(response) { + onEnd: function (response) { if (response.status === grpc.Code.OK) { resolve(response.message); } else { @@ -859,7 +859,7 @@ export class GrpcWebImpl { const maybeCombinedMetadata = metadata && this.options.metadata ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap }) : metadata || this.options.metadata; - return new Observable(observer => { + return new Observable((observer) => { const upStream = (() => { const client = grpc.invoke(methodDesc, { host: this.host, diff --git a/integration/lower-case-svc-methods/math.ts b/integration/lower-case-svc-methods/math.ts index 7d432d1ee..a54bcd803 100644 --- a/integration/lower-case-svc-methods/math.ts +++ b/integration/lower-case-svc-methods/math.ts @@ -166,7 +166,7 @@ export const Numbers = { toJSON(message: Numbers): unknown { const obj: any = {}; if (message.num) { - obj.num = message.num.map(e => e); + obj.num = message.num.map((e) => e); } else { obj.num = []; } @@ -198,20 +198,20 @@ export class MathServiceClientImpl implements MathS add(ctx: Context, request: NumPair): Promise { const data = NumPair.encode(request).finish(); const promise = this.rpc.request(ctx, "MathService", "Add", data); - return promise.then(data => NumSingle.decode(new _m0.Reader(data))); + return promise.then((data) => NumSingle.decode(new _m0.Reader(data))); } absoluteValue(ctx: Context, request: NumSingle): Promise { const data = NumSingle.encode(request).finish(); const promise = this.rpc.request(ctx, "MathService", "AbsoluteValue", data); - return promise.then(data => NumSingle.decode(new _m0.Reader(data))); + return promise.then((data) => NumSingle.decode(new _m0.Reader(data))); } getDouble(ctx: Context, nu: number): Promise { const dl = ctx.getDataLoader("MathService.BatchDouble", () => { return new DataLoader((num) => { const request = { num }; - return this.batchDouble(ctx, request).then(res => res.num); + return this.batchDouble(ctx, request).then((res) => res.num); }, { cacheKeyFn: hash, ...ctx.rpcDataLoaderOptions }); }); return dl.load(nu); @@ -220,7 +220,7 @@ export class MathServiceClientImpl implements MathS batchDouble(ctx: Context, request: Numbers): Promise { const data = Numbers.encode(request).finish(); const promise = this.rpc.request(ctx, "MathService", "BatchDouble", data); - return promise.then(data => Numbers.decode(new _m0.Reader(data))); + return promise.then((data) => Numbers.decode(new _m0.Reader(data))); } } diff --git a/integration/meta-typings/google/protobuf/timestamp.ts b/integration/meta-typings/google/protobuf/timestamp.ts index 56147a575..7a575724e 100644 --- a/integration/meta-typings/google/protobuf/timestamp.ts +++ b/integration/meta-typings/google/protobuf/timestamp.ts @@ -244,7 +244,7 @@ export const protoMetadata: ProtoMetadata = { "path": [4, 0], "span": [135, 0, 146, 1], "leadingComments": - " A Timestamp represents a point in time independent of any time zone or local\n calendar, encoded as a count of seconds and fractions of seconds at\n nanosecond resolution. The count is relative to an epoch at UTC midnight on\n January 1, 1970, in the proleptic Gregorian calendar which extends the\n Gregorian calendar backwards to year one.\n\n All minutes are 60 seconds long. Leap seconds are \"smeared\" so that no leap\n second table is needed for interpretation, using a [24-hour linear\n smear](https://developers.google.com/time/smear).\n\n The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By\n restricting to that range, we ensure that we can convert to and from [RFC\n 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.\n\n # Examples\n\n Example 1: Compute Timestamp from POSIX `time()`.\n\n Timestamp timestamp;\n timestamp.set_seconds(time(NULL));\n timestamp.set_nanos(0);\n\n Example 2: Compute Timestamp from POSIX `gettimeofday()`.\n\n struct timeval tv;\n gettimeofday(&tv, NULL);\n\n Timestamp timestamp;\n timestamp.set_seconds(tv.tv_sec);\n timestamp.set_nanos(tv.tv_usec * 1000);\n\n Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.\n\n FILETIME ft;\n GetSystemTimeAsFileTime(&ft);\n UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;\n\n // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z\n // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.\n Timestamp timestamp;\n timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));\n timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));\n\n Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.\n\n long millis = System.currentTimeMillis();\n\n Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)\n .setNanos((int) ((millis % 1000) * 1000000)).build();\n\n\n Example 5: Compute Timestamp from Java `Instant.now()`.\n\n Instant now = Instant.now();\n\n Timestamp timestamp =\n Timestamp.newBuilder().setSeconds(now.getEpochSecond())\n .setNanos(now.getNano()).build();\n\n\n Example 6: Compute Timestamp from current time in Python.\n\n timestamp = Timestamp()\n timestamp.GetCurrentTime()\n\n # JSON Mapping\n\n In JSON format, the Timestamp type is encoded as a string in the\n [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the\n format is \"{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z\"\n where {year} is always expressed using four digits while {month}, {day},\n {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional\n seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),\n are optional. The \"Z\" suffix indicates the timezone (\"UTC\"); the timezone\n is required. A proto3 JSON serializer should always use UTC (as indicated by\n \"Z\") when printing the Timestamp type and a proto3 JSON parser should be\n able to accept both UTC and other timezones (as indicated by an offset).\n\n For example, \"2017-01-15T01:30:15.01Z\" encodes 15.01 seconds past\n 01:30 UTC on January 15, 2017.\n\n In JavaScript, one can convert a Date object to this format using the\n standard\n [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)\n method. In Python, a standard `datetime.datetime` object can be converted\n to this format using\n [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with\n the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use\n the Joda Time's [`ISODateTimeFormat.dateTime()`](\n http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D\n ) to obtain a formatter capable of generating timestamps in this format.\n\n\n", + ' A Timestamp represents a point in time independent of any time zone or local\n calendar, encoded as a count of seconds and fractions of seconds at\n nanosecond resolution. The count is relative to an epoch at UTC midnight on\n January 1, 1970, in the proleptic Gregorian calendar which extends the\n Gregorian calendar backwards to year one.\n\n All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap\n second table is needed for interpretation, using a [24-hour linear\n smear](https://developers.google.com/time/smear).\n\n The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By\n restricting to that range, we ensure that we can convert to and from [RFC\n 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.\n\n # Examples\n\n Example 1: Compute Timestamp from POSIX `time()`.\n\n Timestamp timestamp;\n timestamp.set_seconds(time(NULL));\n timestamp.set_nanos(0);\n\n Example 2: Compute Timestamp from POSIX `gettimeofday()`.\n\n struct timeval tv;\n gettimeofday(&tv, NULL);\n\n Timestamp timestamp;\n timestamp.set_seconds(tv.tv_sec);\n timestamp.set_nanos(tv.tv_usec * 1000);\n\n Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.\n\n FILETIME ft;\n GetSystemTimeAsFileTime(&ft);\n UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;\n\n // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z\n // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.\n Timestamp timestamp;\n timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));\n timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));\n\n Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.\n\n long millis = System.currentTimeMillis();\n\n Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)\n .setNanos((int) ((millis % 1000) * 1000000)).build();\n\n\n Example 5: Compute Timestamp from Java `Instant.now()`.\n\n Instant now = Instant.now();\n\n Timestamp timestamp =\n Timestamp.newBuilder().setSeconds(now.getEpochSecond())\n .setNanos(now.getNano()).build();\n\n\n Example 6: Compute Timestamp from current time in Python.\n\n timestamp = Timestamp()\n timestamp.GetCurrentTime()\n\n # JSON Mapping\n\n In JSON format, the Timestamp type is encoded as a string in the\n [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the\n format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"\n where {year} is always expressed using four digits while {month}, {day},\n {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional\n seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),\n are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone\n is required. A proto3 JSON serializer should always use UTC (as indicated by\n "Z") when printing the Timestamp type and a proto3 JSON parser should be\n able to accept both UTC and other timezones (as indicated by an offset).\n\n For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past\n 01:30 UTC on January 15, 2017.\n\n In JavaScript, one can convert a Date object to this format using the\n standard\n [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)\n method. In Python, a standard `datetime.datetime` object can be converted\n to this format using\n [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with\n the time format spec \'%Y-%m-%dT%H:%M:%S.%fZ\'. Likewise, in Java, one can use\n the Joda Time\'s [`ISODateTimeFormat.dateTime()`](\n http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D\n ) to obtain a formatter capable of generating timestamps in this format.\n\n\n', "trailingComments": "", "leadingDetachedComments": [], }, { diff --git a/integration/meta-typings/simple.ts b/integration/meta-typings/simple.ts index 9668d2c4d..9ee737594 100644 --- a/integration/meta-typings/simple.ts +++ b/integration/meta-typings/simple.ts @@ -1280,7 +1280,7 @@ export class PingServiceClientImpl implements PingService { ping(request: PingRequest): Promise { const data = PingRequest.encode(request).finish(); const promise = this.rpc.request("simple.PingService", "ping", data); - return promise.then(data => PingResponse.decode(new _m0.Reader(data))); + return promise.then((data) => PingResponse.decode(new _m0.Reader(data))); } } diff --git a/integration/nestjs-metadata-grpc-js/hero.ts b/integration/nestjs-metadata-grpc-js/hero.ts index 7c15715df..54483ffd9 100644 --- a/integration/nestjs-metadata-grpc-js/hero.ts +++ b/integration/nestjs-metadata-grpc-js/hero.ts @@ -42,7 +42,7 @@ export interface HeroServiceController { } export function HeroServiceControllerMethods() { - return function(constructor: Function) { + return function (constructor: Function) { const grpcMethods: string[] = ["findOneHero", "findOneVillain"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); diff --git a/integration/nestjs-metadata-observables/hero.ts b/integration/nestjs-metadata-observables/hero.ts index 30b036463..197aa85d4 100644 --- a/integration/nestjs-metadata-observables/hero.ts +++ b/integration/nestjs-metadata-observables/hero.ts @@ -42,7 +42,7 @@ export interface HeroServiceController { } export function HeroServiceControllerMethods() { - return function(constructor: Function) { + return function (constructor: Function) { const grpcMethods: string[] = ["findOneHero", "findOneVillain"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); diff --git a/integration/nestjs-metadata-restparameters/hero.ts b/integration/nestjs-metadata-restparameters/hero.ts index 23eb632ff..6ef287bac 100644 --- a/integration/nestjs-metadata-restparameters/hero.ts +++ b/integration/nestjs-metadata-restparameters/hero.ts @@ -46,7 +46,7 @@ export interface HeroServiceController { } export function HeroServiceControllerMethods() { - return function(constructor: Function) { + return function (constructor: Function) { const grpcMethods: string[] = ["findOneHero", "findOneVillain"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); diff --git a/integration/nestjs-metadata/hero.ts b/integration/nestjs-metadata/hero.ts index 7c15715df..54483ffd9 100644 --- a/integration/nestjs-metadata/hero.ts +++ b/integration/nestjs-metadata/hero.ts @@ -42,7 +42,7 @@ export interface HeroServiceController { } export function HeroServiceControllerMethods() { - return function(constructor: Function) { + return function (constructor: Function) { const grpcMethods: string[] = ["findOneHero", "findOneVillain"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); diff --git a/integration/nestjs-restparameters/hero.ts b/integration/nestjs-restparameters/hero.ts index 412833bfe..abf56feb9 100644 --- a/integration/nestjs-restparameters/hero.ts +++ b/integration/nestjs-restparameters/hero.ts @@ -41,7 +41,7 @@ export interface HeroServiceController { } export function HeroServiceControllerMethods() { - return function(constructor: Function) { + return function (constructor: Function) { const grpcMethods: string[] = ["findOneHero", "findOneVillain"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); diff --git a/integration/nestjs-simple-observables/hero.ts b/integration/nestjs-simple-observables/hero.ts index 4ab8b0806..7c884baf4 100644 --- a/integration/nestjs-simple-observables/hero.ts +++ b/integration/nestjs-simple-observables/hero.ts @@ -41,7 +41,7 @@ export interface HeroServiceController { } export function HeroServiceControllerMethods() { - return function(constructor: Function) { + return function (constructor: Function) { const grpcMethods: string[] = ["findOneHero", "findOneVillain"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); diff --git a/integration/nestjs-simple-restparameters/google/protobuf/empty.ts b/integration/nestjs-simple-restparameters/google/protobuf/empty.ts index bc4e6ef7b..642a965dc 100644 --- a/integration/nestjs-simple-restparameters/google/protobuf/empty.ts +++ b/integration/nestjs-simple-restparameters/google/protobuf/empty.ts @@ -1,4 +1,5 @@ /* eslint-disable */ + export const protobufPackage = "google.protobuf"; /** diff --git a/integration/nestjs-simple-restparameters/hero.ts b/integration/nestjs-simple-restparameters/hero.ts index 52299e421..b7bb522a5 100644 --- a/integration/nestjs-simple-restparameters/hero.ts +++ b/integration/nestjs-simple-restparameters/hero.ts @@ -21,7 +21,7 @@ export interface HeroServiceController { } export function HeroServiceControllerMethods() { - return function(constructor: Function) { + return function (constructor: Function) { const grpcMethods: string[] = ["findCurrentUser"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); diff --git a/integration/nestjs-simple/google/protobuf/empty.ts b/integration/nestjs-simple/google/protobuf/empty.ts index bc4e6ef7b..642a965dc 100644 --- a/integration/nestjs-simple/google/protobuf/empty.ts +++ b/integration/nestjs-simple/google/protobuf/empty.ts @@ -1,4 +1,5 @@ /* eslint-disable */ + export const protobufPackage = "google.protobuf"; /** diff --git a/integration/nestjs-simple/google/protobuf/timestamp.ts b/integration/nestjs-simple/google/protobuf/timestamp.ts index c2775e434..229cba608 100644 --- a/integration/nestjs-simple/google/protobuf/timestamp.ts +++ b/integration/nestjs-simple/google/protobuf/timestamp.ts @@ -1,4 +1,5 @@ /* eslint-disable */ + export const protobufPackage = "google.protobuf"; /** diff --git a/integration/nestjs-simple/hero.ts b/integration/nestjs-simple/hero.ts index 0e3797697..02e2fe522 100644 --- a/integration/nestjs-simple/hero.ts +++ b/integration/nestjs-simple/hero.ts @@ -56,7 +56,7 @@ export interface HeroServiceController { } export function HeroServiceControllerMethods() { - return function(constructor: Function) { + return function (constructor: Function) { const grpcMethods: string[] = ["addOneHero", "findOneHero", "findOneVillain", "findManyVillainStreamOut"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); diff --git a/integration/nice-grpc/google/protobuf/struct.ts b/integration/nice-grpc/google/protobuf/struct.ts index e655c71e0..41ef5d717 100644 --- a/integration/nice-grpc/google/protobuf/struct.ts +++ b/integration/nice-grpc/google/protobuf/struct.ts @@ -174,7 +174,7 @@ export const Struct = { wrap(object: { [key: string]: any } | undefined): Struct { const struct = createBaseStruct(); if (object !== undefined) { - Object.keys(object).forEach(key => { + Object.keys(object).forEach((key) => { struct.fields[key] = object[key]; }); } @@ -183,7 +183,7 @@ export const Struct = { unwrap(message: Struct): { [key: string]: any } { const object: { [key: string]: any } = {}; - Object.keys(message.fields).forEach(key => { + Object.keys(message.fields).forEach((key) => { object[key] = message.fields[key]; }); return object; @@ -325,8 +325,8 @@ export const Value = { toJSON(message: Value): unknown { const obj: any = {}; - message.nullValue !== undefined - && (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); + message.nullValue !== undefined && + (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); message.numberValue !== undefined && (obj.numberValue = message.numberValue); message.stringValue !== undefined && (obj.stringValue = message.stringValue); message.boolValue !== undefined && (obj.boolValue = message.boolValue); @@ -423,7 +423,7 @@ export const ListValue = { toJSON(message: ListValue): unknown { const obj: any = {}; if (message.values) { - obj.values = message.values.map(e => e); + obj.values = message.values.map((e) => e); } else { obj.values = []; } diff --git a/integration/nice-grpc/google/protobuf/wrappers.ts b/integration/nice-grpc/google/protobuf/wrappers.ts index f6ad2a219..21a0c1424 100644 --- a/integration/nice-grpc/google/protobuf/wrappers.ts +++ b/integration/nice-grpc/google/protobuf/wrappers.ts @@ -506,8 +506,8 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, diff --git a/integration/no-proto-package/no-proto-package.ts b/integration/no-proto-package/no-proto-package.ts index ce4cff10c..53f2ca8fb 100644 --- a/integration/no-proto-package/no-proto-package.ts +++ b/integration/no-proto-package/no-proto-package.ts @@ -111,7 +111,7 @@ export class UserStateClientImpl implements UserState { GetUsers(request: Empty): Observable { const data = Empty.encode(request).finish(); const result = this.rpc.serverStreamingRequest("UserState", "GetUsers", data); - return result.pipe(map(data => User.decode(new _m0.Reader(data)))); + return result.pipe(map((data) => User.decode(new _m0.Reader(data)))); } } diff --git a/integration/oneof-properties/oneof.ts b/integration/oneof-properties/oneof.ts index f48ecdc5a..a80318c1d 100644 --- a/integration/oneof-properties/oneof.ts +++ b/integration/oneof-properties/oneof.ts @@ -199,13 +199,13 @@ export const PleaseChoose = { message.name !== undefined && (obj.name = message.name); message.aNumber !== undefined && (obj.aNumber = message.aNumber); message.aString !== undefined && (obj.aString = message.aString); - message.aMessage !== undefined - && (obj.aMessage = message.aMessage ? PleaseChoose_Submessage.toJSON(message.aMessage) : undefined); + message.aMessage !== undefined && + (obj.aMessage = message.aMessage ? PleaseChoose_Submessage.toJSON(message.aMessage) : undefined); message.aBool !== undefined && (obj.aBool = message.aBool); - message.bunchaBytes !== undefined - && (obj.bunchaBytes = message.bunchaBytes !== undefined ? base64FromBytes(message.bunchaBytes) : undefined); - message.anEnum !== undefined - && (obj.anEnum = message.anEnum !== undefined ? pleaseChoose_StateEnumToJSON(message.anEnum) : undefined); + message.bunchaBytes !== undefined && + (obj.bunchaBytes = message.bunchaBytes !== undefined ? base64FromBytes(message.bunchaBytes) : undefined); + message.anEnum !== undefined && + (obj.anEnum = message.anEnum !== undefined ? pleaseChoose_StateEnumToJSON(message.anEnum) : undefined); message.age !== undefined && (obj.age = Math.round(message.age)); message.either !== undefined && (obj.either = message.either); message.or !== undefined && (obj.or = message.or); diff --git a/integration/oneof-unions-snake/google/protobuf/struct.ts b/integration/oneof-unions-snake/google/protobuf/struct.ts index 4c0bc6b6b..fdf3803b1 100644 --- a/integration/oneof-unions-snake/google/protobuf/struct.ts +++ b/integration/oneof-unions-snake/google/protobuf/struct.ts @@ -159,7 +159,7 @@ export const Struct = { wrap(object: { [key: string]: any } | undefined): Struct { const struct = createBaseStruct(); if (object !== undefined) { - Object.keys(object).forEach(key => { + Object.keys(object).forEach((key) => { struct.fields[key] = object[key]; }); } @@ -168,7 +168,7 @@ export const Struct = { unwrap(message: Struct): { [key: string]: any } { const object: { [key: string]: any } = {}; - Object.keys(message.fields).forEach(key => { + Object.keys(message.fields).forEach((key) => { object[key] = message.fields[key]; }); return object; @@ -313,9 +313,8 @@ export const Value = { toJSON(message: Value): unknown { const obj: any = {}; - message.kind?.$case === "null_value" && (obj.null_value = message.kind?.null_value !== undefined - ? nullValueToJSON(message.kind?.null_value) - : undefined); + message.kind?.$case === "null_value" && + (obj.null_value = message.kind?.null_value !== undefined ? nullValueToJSON(message.kind?.null_value) : undefined); message.kind?.$case === "number_value" && (obj.number_value = message.kind?.number_value); message.kind?.$case === "string_value" && (obj.string_value = message.kind?.string_value); message.kind?.$case === "bool_value" && (obj.bool_value = message.kind?.bool_value); @@ -332,16 +331,16 @@ export const Value = { message.kind = { $case: "null_value", null_value: object.kind.null_value }; } if ( - object.kind?.$case === "number_value" - && object.kind?.number_value !== undefined - && object.kind?.number_value !== null + object.kind?.$case === "number_value" && + object.kind?.number_value !== undefined && + object.kind?.number_value !== null ) { message.kind = { $case: "number_value", number_value: object.kind.number_value }; } if ( - object.kind?.$case === "string_value" - && object.kind?.string_value !== undefined - && object.kind?.string_value !== null + object.kind?.$case === "string_value" && + object.kind?.string_value !== undefined && + object.kind?.string_value !== null ) { message.kind = { $case: "string_value", string_value: object.kind.string_value }; } @@ -351,9 +350,9 @@ export const Value = { message.kind = { $case: "bool_value", bool_value: object.kind.bool_value }; } if ( - object.kind?.$case === "struct_value" - && object.kind?.struct_value !== undefined - && object.kind?.struct_value !== null + object.kind?.$case === "struct_value" && + object.kind?.struct_value !== undefined && + object.kind?.struct_value !== null ) { message.kind = { $case: "struct_value", struct_value: object.kind.struct_value }; } @@ -443,7 +442,7 @@ export const ListValue = { toJSON(message: ListValue): unknown { const obj: any = {}; if (message.values) { - obj.values = message.values.map(e => e); + obj.values = message.values.map((e) => e); } else { obj.values = []; } diff --git a/integration/oneof-unions/google/protobuf/struct.ts b/integration/oneof-unions/google/protobuf/struct.ts index 0a7fec23f..4a5c792f7 100644 --- a/integration/oneof-unions/google/protobuf/struct.ts +++ b/integration/oneof-unions/google/protobuf/struct.ts @@ -159,7 +159,7 @@ export const Struct = { wrap(object: { [key: string]: any } | undefined): Struct { const struct = createBaseStruct(); if (object !== undefined) { - Object.keys(object).forEach(key => { + Object.keys(object).forEach((key) => { struct.fields[key] = object[key]; }); } @@ -168,7 +168,7 @@ export const Struct = { unwrap(message: Struct): { [key: string]: any } { const object: { [key: string]: any } = {}; - Object.keys(message.fields).forEach(key => { + Object.keys(message.fields).forEach((key) => { object[key] = message.fields[key]; }); return object; @@ -310,8 +310,8 @@ export const Value = { toJSON(message: Value): unknown { const obj: any = {}; - message.kind?.$case === "nullValue" - && (obj.nullValue = message.kind?.nullValue !== undefined ? nullValueToJSON(message.kind?.nullValue) : undefined); + message.kind?.$case === "nullValue" && + (obj.nullValue = message.kind?.nullValue !== undefined ? nullValueToJSON(message.kind?.nullValue) : undefined); message.kind?.$case === "numberValue" && (obj.numberValue = message.kind?.numberValue); message.kind?.$case === "stringValue" && (obj.stringValue = message.kind?.stringValue); message.kind?.$case === "boolValue" && (obj.boolValue = message.kind?.boolValue); @@ -326,16 +326,16 @@ export const Value = { message.kind = { $case: "nullValue", nullValue: object.kind.nullValue }; } if ( - object.kind?.$case === "numberValue" - && object.kind?.numberValue !== undefined - && object.kind?.numberValue !== null + object.kind?.$case === "numberValue" && + object.kind?.numberValue !== undefined && + object.kind?.numberValue !== null ) { message.kind = { $case: "numberValue", numberValue: object.kind.numberValue }; } if ( - object.kind?.$case === "stringValue" - && object.kind?.stringValue !== undefined - && object.kind?.stringValue !== null + object.kind?.$case === "stringValue" && + object.kind?.stringValue !== undefined && + object.kind?.stringValue !== null ) { message.kind = { $case: "stringValue", stringValue: object.kind.stringValue }; } @@ -343,9 +343,9 @@ export const Value = { message.kind = { $case: "boolValue", boolValue: object.kind.boolValue }; } if ( - object.kind?.$case === "structValue" - && object.kind?.structValue !== undefined - && object.kind?.structValue !== null + object.kind?.$case === "structValue" && + object.kind?.structValue !== undefined && + object.kind?.structValue !== null ) { message.kind = { $case: "structValue", structValue: object.kind.structValue }; } @@ -433,7 +433,7 @@ export const ListValue = { toJSON(message: ListValue): unknown { const obj: any = {}; if (message.values) { - obj.values = message.values.map(e => e); + obj.values = message.values.map((e) => e); } else { obj.values = []; } diff --git a/integration/oneof-unions/oneof.ts b/integration/oneof-unions/oneof.ts index 43799f69e..e89ecca74 100644 --- a/integration/oneof-unions/oneof.ts +++ b/integration/oneof-unions/oneof.ts @@ -207,10 +207,8 @@ export const PleaseChoose = { message.name !== undefined && (obj.name = message.name); message.choice?.$case === "aNumber" && (obj.aNumber = message.choice?.aNumber); message.choice?.$case === "aString" && (obj.aString = message.choice?.aString); - message.choice?.$case === "aMessage" - && (obj.aMessage = message.choice?.aMessage - ? PleaseChoose_Submessage.toJSON(message.choice?.aMessage) - : undefined); + message.choice?.$case === "aMessage" && + (obj.aMessage = message.choice?.aMessage ? PleaseChoose_Submessage.toJSON(message.choice?.aMessage) : undefined); message.choice?.$case === "aBool" && (obj.aBool = message.choice?.aBool); message.choice?.$case === "bunchaBytes" && (obj.bunchaBytes = message.choice?.bunchaBytes !== undefined ? base64FromBytes(message.choice?.bunchaBytes) @@ -222,8 +220,8 @@ export const PleaseChoose = { message.eitherOr?.$case === "either" && (obj.either = message.eitherOr?.either); message.eitherOr?.$case === "or" && (obj.or = message.eitherOr?.or); message.eitherOr?.$case === "thirdOption" && (obj.thirdOption = message.eitherOr?.thirdOption); - message.signature !== undefined - && (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); + message.signature !== undefined && + (obj.signature = base64FromBytes(message.signature !== undefined ? message.signature : new Uint8Array())); message.value !== undefined && (obj.value = message.value); return obj; }, @@ -246,9 +244,9 @@ export const PleaseChoose = { message.choice = { $case: "aBool", aBool: object.choice.aBool }; } if ( - object.choice?.$case === "bunchaBytes" - && object.choice?.bunchaBytes !== undefined - && object.choice?.bunchaBytes !== null + object.choice?.$case === "bunchaBytes" && + object.choice?.bunchaBytes !== undefined && + object.choice?.bunchaBytes !== null ) { message.choice = { $case: "bunchaBytes", bunchaBytes: object.choice.bunchaBytes }; } @@ -265,9 +263,9 @@ export const PleaseChoose = { message.eitherOr = { $case: "or", or: object.eitherOr.or }; } if ( - object.eitherOr?.$case === "thirdOption" - && object.eitherOr?.thirdOption !== undefined - && object.eitherOr?.thirdOption !== null + object.eitherOr?.$case === "thirdOption" && + object.eitherOr?.thirdOption !== undefined && + object.eitherOr?.thirdOption !== null ) { message.eitherOr = { $case: "thirdOption", thirdOption: object.eitherOr.thirdOption }; } diff --git a/integration/only-types/google/protobuf/any.ts b/integration/only-types/google/protobuf/any.ts index a2064bff7..d762aac64 100644 --- a/integration/only-types/google/protobuf/any.ts +++ b/integration/only-types/google/protobuf/any.ts @@ -1,4 +1,5 @@ /* eslint-disable */ + export const protobufPackage = "google.protobuf"; /** diff --git a/integration/only-types/google/protobuf/timestamp.ts b/integration/only-types/google/protobuf/timestamp.ts index 254ed2939..814fb7fa0 100644 --- a/integration/only-types/google/protobuf/timestamp.ts +++ b/integration/only-types/google/protobuf/timestamp.ts @@ -1,4 +1,5 @@ /* eslint-disable */ + export const protobufPackage = "google.protobuf"; /** diff --git a/integration/options/google/protobuf/descriptor.ts b/integration/options/google/protobuf/descriptor.ts index b2bd9100d..919f4e5b9 100644 --- a/integration/options/google/protobuf/descriptor.ts +++ b/integration/options/google/protobuf/descriptor.ts @@ -4403,7 +4403,7 @@ export const protoMetadata: ProtoMetadata = { "path": [4, 1, 2, 1], "span": [63, 2, 30], "leadingComments": "", - "trailingComments": " e.g. \"foo\", \"foo.bar\", etc.\n", + "trailingComments": ' e.g. "foo", "foo.bar", etc.\n', "leadingDetachedComments": [], }, { "path": [4, 1, 2, 2], @@ -4440,7 +4440,7 @@ export const protoMetadata: ProtoMetadata = { }, { "path": [4, 1, 2, 11], "span": [89, 2, 30], - "leadingComments": " The syntax of the proto file.\n The supported values are \"proto2\" and \"proto3\".\n", + "leadingComments": ' The syntax of the proto file.\n The supported values are "proto2" and "proto3".\n', "trailingComments": "", "leadingDetachedComments": [], }, { @@ -4587,7 +4587,7 @@ export const protoMetadata: ProtoMetadata = { "path": [4, 4, 2, 6], "span": [202, 2, 36], "leadingComments": - " For numeric types, contains the original text representation of the value.\n For booleans, \"true\" or \"false\".\n For strings, contains the default text contents (not escaped in any way).\n For bytes, contains the C escaped value. All bytes >= 128 are escaped.\n TODO(kenton): Base-64 encode?\n", + ' For numeric types, contains the original text representation of the value.\n For booleans, "true" or "false".\n For strings, contains the default text contents (not escaped in any way).\n For bytes, contains the C escaped value. All bytes >= 128 are escaped.\n TODO(kenton): Base-64 encode?\n', "trailingComments": "", "leadingDetachedComments": [], }, { @@ -4608,7 +4608,7 @@ export const protoMetadata: ProtoMetadata = { "path": [4, 4, 2, 10], "span": [237, 2, 37], "leadingComments": - " If true, this is a proto3 \"optional\". When a proto3 field is optional, it\n tracks presence regardless of field type.\n\n When proto3_optional is true, this field must be belong to a oneof to\n signal to old proto3 clients that presence is tracked for this field. This\n oneof is known as a \"synthetic\" oneof, and this field must be its sole\n member (each proto3 optional field gets its own synthetic oneof). Synthetic\n oneofs exist in the descriptor only, and do not generate any API. Synthetic\n oneofs must be ordered after all \"real\" oneofs.\n\n For message fields, proto3_optional doesn't create any semantic change,\n since non-repeated message fields always track presence. However it still\n indicates the semantic detail of whether the user wrote \"optional\" or not.\n This can be useful for round-tripping the .proto file. For consistency we\n give message fields a synthetic oneof also, even though it is not required\n to track presence. This is especially important because the parser can't\n tell if a field is a message or an enum, so it must always create a\n synthetic oneof.\n\n Proto2 optional fields do not set this flag, because they already indicate\n optional with `LABEL_OPTIONAL`.\n", + ' If true, this is a proto3 "optional". When a proto3 field is optional, it\n tracks presence regardless of field type.\n\n When proto3_optional is true, this field must be belong to a oneof to\n signal to old proto3 clients that presence is tracked for this field. This\n oneof is known as a "synthetic" oneof, and this field must be its sole\n member (each proto3 optional field gets its own synthetic oneof). Synthetic\n oneofs exist in the descriptor only, and do not generate any API. Synthetic\n oneofs must be ordered after all "real" oneofs.\n\n For message fields, proto3_optional doesn\'t create any semantic change,\n since non-repeated message fields always track presence. However it still\n indicates the semantic detail of whether the user wrote "optional" or not.\n This can be useful for round-tripping the .proto file. For consistency we\n give message fields a synthetic oneof also, even though it is not required\n to track presence. This is especially important because the parser can\'t\n tell if a field is a message or an enum, so it must always create a\n synthetic oneof.\n\n Proto2 optional fields do not set this flag, because they already indicate\n optional with `LABEL_OPTIONAL`.\n', "trailingComments": "", "leadingDetachedComments": [], }, { @@ -4762,7 +4762,7 @@ export const protoMetadata: ProtoMetadata = { "path": [4, 10, 2, 7], "span": [406, 2, 59], "leadingComments": - " Should generic services be generated in each language? \"Generic\" services\n are not specific to any particular RPC system. They are generated by the\n main code generators in each language (without additional plugins).\n Generic services were the only kind of service generation supported by\n early versions of google.protobuf.\n\n Generic services are now considered deprecated in favor of using plugins\n that generate code specific to your particular RPC system. Therefore,\n these default to false. Old code which depends on generic services should\n explicitly set them to true.\n", + ' Should generic services be generated in each language? "Generic" services\n are not specific to any particular RPC system. They are generated by the\n main code generators in each language (without additional plugins).\n Generic services were the only kind of service generation supported by\n early versions of google.protobuf.\n\n Generic services are now considered deprecated in favor of using plugins\n that generate code specific to your particular RPC system. Therefore,\n these default to false. Old code which depends on generic services should\n explicitly set them to true.\n', "trailingComments": "", "leadingDetachedComments": [], }, { @@ -4831,14 +4831,14 @@ export const protoMetadata: ProtoMetadata = { "path": [4, 10, 2, 20], "span": [457, 2, 58], "leadingComments": - " The parser stores options it doesn't recognize here.\n See the documentation for the \"Options\" section above.\n", + ' The parser stores options it doesn\'t recognize here.\n See the documentation for the "Options" section above.\n', "trailingComments": "", "leadingDetachedComments": [], }, { "path": [4, 10, 5], "span": [461, 2, 25], "leadingComments": - " Clients can define custom options in extensions of this message.\n See the documentation for the \"Options\" section above.\n", + ' Clients can define custom options in extensions of this message.\n See the documentation for the "Options" section above.\n', "trailingComments": "", "leadingDetachedComments": [], }, { @@ -4852,7 +4852,7 @@ export const protoMetadata: ProtoMetadata = { "path": [4, 11, 2, 1], "span": [490, 2, 70], "leadingComments": - " Disables the generation of the standard \"descriptor()\" accessor, which can\n conflict with a field of the same name. This is meant to make migration\n from proto1 easier; new code should avoid fields named \"descriptor\".\n", + ' Disables the generation of the standard "descriptor()" accessor, which can\n conflict with a field of the same name. This is meant to make migration\n from proto1 easier; new code should avoid fields named "descriptor".\n', "trailingComments": "", "leadingDetachedComments": [], }, { @@ -4917,7 +4917,7 @@ export const protoMetadata: ProtoMetadata = { "path": [4, 12, 2, 2], "span": [566, 2, 51], "leadingComments": - " The jstype option determines the JavaScript type used for values of the\n field. The option is permitted only for 64 bit integral and fixed types\n (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING\n is represented as JavaScript string, which avoids loss of precision that\n can happen when a large value is converted to a floating point JavaScript.\n Specifying JS_NUMBER for the jstype causes the generated JavaScript code to\n use the JavaScript \"number\" type. The behavior of the default option\n JS_NORMAL is implementation dependent.\n\n This option is an enum to permit additional types to be added, e.g.\n goog.math.Integer.\n", + ' The jstype option determines the JavaScript type used for values of the\n field. The option is permitted only for 64 bit integral and fixed types\n (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING\n is represented as JavaScript string, which avoids loss of precision that\n can happen when a large value is converted to a floating point JavaScript.\n Specifying JS_NUMBER for the jstype causes the generated JavaScript code to\n use the JavaScript "number" type. The behavior of the default option\n JS_NORMAL is implementation dependent.\n\n This option is an enum to permit additional types to be added, e.g.\n goog.math.Integer.\n', "trailingComments": "", "leadingDetachedComments": [], }, { @@ -5110,7 +5110,7 @@ export const protoMetadata: ProtoMetadata = { "path": [4, 18, 3, 0], "span": [734, 2, 737, 3], "leadingComments": - " The name of the uninterpreted option. Each string represents a segment in\n a dot-separated name. is_extension is true iff a segment represents an\n extension (denoted with parentheses in options specs in .proto files).\n E.g.,{ [\"foo\", false], [\"bar.baz\", true], [\"qux\", false] } represents\n \"foo.(bar.baz).qux\".\n", + ' The name of the uninterpreted option. Each string represents a segment in\n a dot-separated name. is_extension is true iff a segment represents an\n extension (denoted with parentheses in options specs in .proto files).\n E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents\n "foo.(bar.baz).qux".\n', "trailingComments": "", "leadingDetachedComments": [], }, { @@ -5133,7 +5133,7 @@ export const protoMetadata: ProtoMetadata = { "path": [4, 19, 2, 0], "span": [799, 2, 33], "leadingComments": - " A Location identifies a piece of source code in a .proto file which\n corresponds to a particular definition. This information is intended\n to be useful to IDEs, code indexers, documentation generators, and similar\n tools.\n\n For example, say we have a file like:\n message Foo {\n optional string foo = 1;\n }\n Let's look at just the field definition:\n optional string foo = 1;\n ^ ^^ ^^ ^ ^^^\n a bc de f ghi\n We have the following locations:\n span path represents\n [a,i) [ 4, 0, 2, 0 ] The whole field definition.\n [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).\n [c,d) [ 4, 0, 2, 0, 5 ] The type (string).\n [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).\n [g,h) [ 4, 0, 2, 0, 3 ] The number (1).\n\n Notes:\n - A location may refer to a repeated field itself (i.e. not to any\n particular index within it). This is used whenever a set of elements are\n logically enclosed in a single code segment. For example, an entire\n extend block (possibly containing multiple extension definitions) will\n have an outer location whose path refers to the \"extensions\" repeated\n field without an index.\n - Multiple locations may have the same path. This happens when a single\n logical declaration is spread out across multiple places. The most\n obvious example is the \"extend\" block again -- there may be multiple\n extend blocks in the same scope, each of which will have the same path.\n - A location's span is not always a subset of its parent's span. For\n example, the \"extendee\" of an extension declaration appears at the\n beginning of the \"extend\" block and is shared by all extensions within\n the block.\n - Just because a location's span is a subset of some other location's span\n does not mean that it is a descendant. For example, a \"group\" defines\n both a type and a field in a single declaration. Thus, the locations\n corresponding to the type and field and their components will overlap.\n - Code which tries to interpret locations should probably be designed to\n ignore those that it doesn't understand, as more types of locations could\n be recorded in the future.\n", + ' A Location identifies a piece of source code in a .proto file which\n corresponds to a particular definition. This information is intended\n to be useful to IDEs, code indexers, documentation generators, and similar\n tools.\n\n For example, say we have a file like:\n message Foo {\n optional string foo = 1;\n }\n Let\'s look at just the field definition:\n optional string foo = 1;\n ^ ^^ ^^ ^ ^^^\n a bc de f ghi\n We have the following locations:\n span path represents\n [a,i) [ 4, 0, 2, 0 ] The whole field definition.\n [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).\n [c,d) [ 4, 0, 2, 0, 5 ] The type (string).\n [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).\n [g,h) [ 4, 0, 2, 0, 3 ] The number (1).\n\n Notes:\n - A location may refer to a repeated field itself (i.e. not to any\n particular index within it). This is used whenever a set of elements are\n logically enclosed in a single code segment. For example, an entire\n extend block (possibly containing multiple extension definitions) will\n have an outer location whose path refers to the "extensions" repeated\n field without an index.\n - Multiple locations may have the same path. This happens when a single\n logical declaration is spread out across multiple places. The most\n obvious example is the "extend" block again -- there may be multiple\n extend blocks in the same scope, each of which will have the same path.\n - A location\'s span is not always a subset of its parent\'s span. For\n example, the "extendee" of an extension declaration appears at the\n beginning of the "extend" block and is shared by all extensions within\n the block.\n - Just because a location\'s span is a subset of some other location\'s span\n does not mean that it is a descendant. For example, a "group" defines\n both a type and a field in a single declaration. Thus, the locations\n corresponding to the type and field and their components will overlap.\n - Code which tries to interpret locations should probably be designed to\n ignore those that it doesn\'t understand, as more types of locations could\n be recorded in the future.\n', "trailingComments": "", "leadingDetachedComments": [], }, { diff --git a/integration/options/options.ts b/integration/options/options.ts index 3438825d9..cba335eac 100644 --- a/integration/options/options.ts +++ b/integration/options/options.ts @@ -137,7 +137,7 @@ export class MyServiceClientImpl implements MyService { MyMethod(request: RequestType): Promise { const data = RequestType.encode(request).finish(); const promise = this.rpc.request("MyService", "MyMethod", data); - return promise.then(data => ResponseType.decode(new _m0.Reader(data))); + return promise.then((data) => ResponseType.decode(new _m0.Reader(data))); } } diff --git a/integration/simple-json-name/simple.ts b/integration/simple-json-name/simple.ts index 06981e8bc..5cc5a6bd6 100644 --- a/integration/simple-json-name/simple.ts +++ b/integration/simple-json-name/simple.ts @@ -119,7 +119,7 @@ export const Simple = { message.dollarStart !== undefined && (obj.$dollar = message.dollarStart); message.dollarEnd !== undefined && (obj.dollar$ = message.dollarEnd); if (message.hyphenList) { - obj["hyphen-list"] = message.hyphenList.map(e => e); + obj["hyphen-list"] = message.hyphenList.map((e) => e); } else { obj["hyphen-list"] = []; } diff --git a/integration/simple-long-string/google/protobuf/wrappers.ts b/integration/simple-long-string/google/protobuf/wrappers.ts index 73e97573e..9deb01d20 100644 --- a/integration/simple-long-string/google/protobuf/wrappers.ts +++ b/integration/simple-long-string/google/protobuf/wrappers.ts @@ -506,8 +506,8 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, diff --git a/integration/simple-long/google/protobuf/wrappers.ts b/integration/simple-long/google/protobuf/wrappers.ts index e3f6f5cb5..c7b5789ab 100644 --- a/integration/simple-long/google/protobuf/wrappers.ts +++ b/integration/simple-long/google/protobuf/wrappers.ts @@ -506,8 +506,8 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, diff --git a/integration/simple-long/simple.ts b/integration/simple-long/simple.ts index 4ed2360d5..453afe1ab 100644 --- a/integration/simple-long/simple.ts +++ b/integration/simple-long/simple.ts @@ -131,12 +131,12 @@ export const SimpleWithWrappers = { message.enabled !== undefined && (obj.enabled = message.enabled); message.bananas !== undefined && (obj.bananas = message.bananas); if (message.coins) { - obj.coins = message.coins.map(e => e); + obj.coins = message.coins.map((e) => e); } else { obj.coins = []; } if (message.snacks) { - obj.snacks = message.snacks.map(e => e); + obj.snacks = message.snacks.map((e) => e); } else { obj.snacks = []; } @@ -617,7 +617,7 @@ export const Numbers = { message.sfixed32 !== undefined && (obj.sfixed32 = Math.round(message.sfixed32)); message.sfixed64 !== undefined && (obj.sfixed64 = (message.sfixed64 || Long.ZERO).toString()); if (message.manyUint64) { - obj.manyUint64 = message.manyUint64.map(e => (e || Long.UZERO).toString()); + obj.manyUint64 = message.manyUint64.map((e) => (e || Long.UZERO).toString()); } else { obj.manyUint64 = []; } diff --git a/integration/simple-optionals/google/protobuf/wrappers.ts b/integration/simple-optionals/google/protobuf/wrappers.ts index 22e0e03e4..3145298cb 100644 --- a/integration/simple-optionals/google/protobuf/wrappers.ts +++ b/integration/simple-optionals/google/protobuf/wrappers.ts @@ -506,8 +506,8 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, diff --git a/integration/simple-optionals/simple.ts b/integration/simple-optionals/simple.ts index e1b053eed..2e7125799 100644 --- a/integration/simple-optionals/simple.ts +++ b/integration/simple-optionals/simple.ts @@ -376,22 +376,22 @@ export const Simple = { message.child !== undefined && (obj.child = message.child ? Child.toJSON(message.child) : undefined); message.state !== undefined && (obj.state = stateEnumToJSON(message.state)); if (message.grandChildren) { - obj.grandChildren = message.grandChildren.map(e => e ? Child.toJSON(e) : undefined); + obj.grandChildren = message.grandChildren.map((e) => e ? Child.toJSON(e) : undefined); } else { obj.grandChildren = []; } if (message.coins) { - obj.coins = message.coins.map(e => Math.round(e)); + obj.coins = message.coins.map((e) => Math.round(e)); } else { obj.coins = []; } if (message.snacks) { - obj.snacks = message.snacks.map(e => e); + obj.snacks = message.snacks.map((e) => e); } else { obj.snacks = []; } if (message.oldStates) { - obj.oldStates = message.oldStates.map(e => stateEnumToJSON(e)); + obj.oldStates = message.oldStates.map((e) => stateEnumToJSON(e)); } else { obj.oldStates = []; } @@ -528,8 +528,8 @@ export const Nested = { toJSON(message: Nested): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); - message.message !== undefined - && (obj.message = message.message ? Nested_InnerMessage.toJSON(message.message) : undefined); + message.message !== undefined && + (obj.message = message.message ? Nested_InnerMessage.toJSON(message.message) : undefined); message.state !== undefined && (obj.state = nested_InnerEnumToJSON(message.state)); return obj; }, @@ -591,8 +591,8 @@ export const Nested_InnerMessage = { toJSON(message: Nested_InnerMessage): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); - message.deep !== undefined - && (obj.deep = message.deep ? Nested_InnerMessage_DeepMessage.toJSON(message.deep) : undefined); + message.deep !== undefined && + (obj.deep = message.deep ? Nested_InnerMessage_DeepMessage.toJSON(message.deep) : undefined); return obj; }, @@ -783,12 +783,12 @@ export const SimpleWithWrappers = { message.age !== undefined && (obj.age = message.age); message.enabled !== undefined && (obj.enabled = message.enabled); if (message.coins) { - obj.coins = message.coins.map(e => e); + obj.coins = message.coins.map((e) => e); } else { obj.coins = []; } if (message.snacks) { - obj.snacks = message.snacks.map(e => e); + obj.snacks = message.snacks.map((e) => e); } else { obj.snacks = []; } @@ -1557,7 +1557,7 @@ export class PingServiceClientImpl implements PingService { ping(request: PingRequest): Promise { const data = PingRequest.encode(request).finish(); const promise = this.rpc.request("simple.PingService", "ping", data); - return promise.then(data => PingResponse.decode(new _m0.Reader(data))); + return promise.then((data) => PingResponse.decode(new _m0.Reader(data))); } } diff --git a/integration/simple-prototype-defaults/google/protobuf/wrappers.ts b/integration/simple-prototype-defaults/google/protobuf/wrappers.ts index b1ae2efa6..e6fb1977d 100644 --- a/integration/simple-prototype-defaults/google/protobuf/wrappers.ts +++ b/integration/simple-prototype-defaults/google/protobuf/wrappers.ts @@ -506,8 +506,8 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, diff --git a/integration/simple-prototype-defaults/simple.ts b/integration/simple-prototype-defaults/simple.ts index cc3cfb2bb..328d96db0 100644 --- a/integration/simple-prototype-defaults/simple.ts +++ b/integration/simple-prototype-defaults/simple.ts @@ -462,35 +462,35 @@ export const Simple = { message.child !== undefined && (obj.child = message.child ? Child.toJSON(message.child) : undefined); message.state !== undefined && (obj.state = stateEnumToJSON(message.state)); if (message.grandChildren) { - obj.grandChildren = message.grandChildren.map(e => e ? Child.toJSON(e) : undefined); + obj.grandChildren = message.grandChildren.map((e) => e ? Child.toJSON(e) : undefined); } else { obj.grandChildren = []; } if (message.coins) { - obj.coins = message.coins.map(e => Math.round(e)); + obj.coins = message.coins.map((e) => Math.round(e)); } else { obj.coins = []; } if (message.snacks) { - obj.snacks = message.snacks.map(e => e); + obj.snacks = message.snacks.map((e) => e); } else { obj.snacks = []; } if (message.oldStates) { - obj.oldStates = message.oldStates.map(e => stateEnumToJSON(e)); + obj.oldStates = message.oldStates.map((e) => stateEnumToJSON(e)); } else { obj.oldStates = []; } message.thing !== undefined && (obj.thing = message.thing ? ImportedThing.toJSON(message.thing) : undefined); if (message.blobs) { - obj.blobs = message.blobs.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + obj.blobs = message.blobs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); } else { obj.blobs = []; } - message.birthday !== undefined - && (obj.birthday = message.birthday ? DateMessage.toJSON(message.birthday) : undefined); - message.blob !== undefined - && (obj.blob = base64FromBytes(message.blob !== undefined ? message.blob : new Uint8Array())); + message.birthday !== undefined && + (obj.birthday = message.birthday ? DateMessage.toJSON(message.birthday) : undefined); + message.blob !== undefined && + (obj.blob = base64FromBytes(message.blob !== undefined ? message.blob : new Uint8Array())); return obj; }, @@ -628,8 +628,8 @@ export const Nested = { toJSON(message: Nested): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); - message.message !== undefined - && (obj.message = message.message ? Nested_InnerMessage.toJSON(message.message) : undefined); + message.message !== undefined && + (obj.message = message.message ? Nested_InnerMessage.toJSON(message.message) : undefined); message.state !== undefined && (obj.state = nested_InnerEnumToJSON(message.state)); return obj; }, @@ -691,8 +691,8 @@ export const Nested_InnerMessage = { toJSON(message: Nested_InnerMessage): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); - message.deep !== undefined - && (obj.deep = message.deep ? Nested_InnerMessage_DeepMessage.toJSON(message.deep) : undefined); + message.deep !== undefined && + (obj.deep = message.deep ? Nested_InnerMessage_DeepMessage.toJSON(message.deep) : undefined); return obj; }, @@ -890,12 +890,12 @@ export const SimpleWithWrappers = { message.age !== undefined && (obj.age = message.age); message.enabled !== undefined && (obj.enabled = message.enabled); if (message.coins) { - obj.coins = message.coins.map(e => e); + obj.coins = message.coins.map((e) => e); } else { obj.coins = []; } if (message.snacks) { - obj.snacks = message.snacks.map(e => e); + obj.snacks = message.snacks.map((e) => e); } else { obj.snacks = []; } @@ -1504,8 +1504,8 @@ export const SimpleWithMap_MapOfBytesEntry = { toJSON(message: SimpleWithMap_MapOfBytesEntry): unknown { const obj: any = {}; message.key !== undefined && (obj.key = message.key); - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, @@ -2257,11 +2257,11 @@ export const SimpleButOptional = { message.age !== undefined && (obj.age = Math.round(message.age)); message.createdAt !== undefined && (obj.createdAt = message.createdAt.toISOString()); message.child !== undefined && (obj.child = message.child ? Child.toJSON(message.child) : undefined); - message.state !== undefined - && (obj.state = message.state !== undefined ? stateEnumToJSON(message.state) : undefined); + message.state !== undefined && + (obj.state = message.state !== undefined ? stateEnumToJSON(message.state) : undefined); message.thing !== undefined && (obj.thing = message.thing ? ImportedThing.toJSON(message.thing) : undefined); - message.birthday !== undefined - && (obj.birthday = message.birthday ? DateMessage.toJSON(message.birthday) : undefined); + message.birthday !== undefined && + (obj.birthday = message.birthday ? DateMessage.toJSON(message.birthday) : undefined); return obj; }, @@ -2334,7 +2334,7 @@ export class PingServiceClientImpl implements PingService { ping(request: PingRequest): Promise { const data = PingRequest.encode(request).finish(); const promise = this.rpc.request("simple.PingService", "ping", data); - return promise.then(data => PingResponse.decode(new _m0.Reader(data))); + return promise.then((data) => PingResponse.decode(new _m0.Reader(data))); } } diff --git a/integration/simple-snake/google/protobuf/struct.ts b/integration/simple-snake/google/protobuf/struct.ts index b6a054d84..802676863 100644 --- a/integration/simple-snake/google/protobuf/struct.ts +++ b/integration/simple-snake/google/protobuf/struct.ts @@ -174,7 +174,7 @@ export const Struct = { wrap(object: { [key: string]: any } | undefined): Struct { const struct = createBaseStruct(); if (object !== undefined) { - Object.keys(object).forEach(key => { + Object.keys(object).forEach((key) => { struct.fields[key] = object[key]; }); } @@ -183,7 +183,7 @@ export const Struct = { unwrap(message: Struct): { [key: string]: any } { const object: { [key: string]: any } = {}; - Object.keys(message.fields).forEach(key => { + Object.keys(message.fields).forEach((key) => { object[key] = message.fields[key]; }); return object; @@ -325,8 +325,8 @@ export const Value = { toJSON(message: Value): unknown { const obj: any = {}; - message.null_value !== undefined - && (obj.null_value = message.null_value !== undefined ? nullValueToJSON(message.null_value) : undefined); + message.null_value !== undefined && + (obj.null_value = message.null_value !== undefined ? nullValueToJSON(message.null_value) : undefined); message.number_value !== undefined && (obj.number_value = message.number_value); message.string_value !== undefined && (obj.string_value = message.string_value); message.bool_value !== undefined && (obj.bool_value = message.bool_value); @@ -423,7 +423,7 @@ export const ListValue = { toJSON(message: ListValue): unknown { const obj: any = {}; if (message.values) { - obj.values = message.values.map(e => e); + obj.values = message.values.map((e) => e); } else { obj.values = []; } diff --git a/integration/simple-snake/google/protobuf/wrappers.ts b/integration/simple-snake/google/protobuf/wrappers.ts index 22e0e03e4..3145298cb 100644 --- a/integration/simple-snake/google/protobuf/wrappers.ts +++ b/integration/simple-snake/google/protobuf/wrappers.ts @@ -506,8 +506,8 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, diff --git a/integration/simple-snake/simple.ts b/integration/simple-snake/simple.ts index 8f16da79c..55f6ebbda 100644 --- a/integration/simple-snake/simple.ts +++ b/integration/simple-snake/simple.ts @@ -381,22 +381,22 @@ export const Simple = { message.child !== undefined && (obj.child = message.child ? Child.toJSON(message.child) : undefined); message.state !== undefined && (obj.state = stateEnumToJSON(message.state)); if (message.grand_children) { - obj.grand_children = message.grand_children.map(e => e ? Child.toJSON(e) : undefined); + obj.grand_children = message.grand_children.map((e) => e ? Child.toJSON(e) : undefined); } else { obj.grand_children = []; } if (message.coins) { - obj.coins = message.coins.map(e => Math.round(e)); + obj.coins = message.coins.map((e) => Math.round(e)); } else { obj.coins = []; } if (message.snacks) { - obj.snacks = message.snacks.map(e => e); + obj.snacks = message.snacks.map((e) => e); } else { obj.snacks = []; } if (message.old_states) { - obj.old_states = message.old_states.map(e => stateEnumToJSON(e)); + obj.old_states = message.old_states.map((e) => stateEnumToJSON(e)); } else { obj.old_states = []; } @@ -533,8 +533,8 @@ export const Nested = { toJSON(message: Nested): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); - message.message !== undefined - && (obj.message = message.message ? Nested_InnerMessage.toJSON(message.message) : undefined); + message.message !== undefined && + (obj.message = message.message ? Nested_InnerMessage.toJSON(message.message) : undefined); message.state !== undefined && (obj.state = nested_InnerEnumToJSON(message.state)); return obj; }, @@ -596,8 +596,8 @@ export const Nested_InnerMessage = { toJSON(message: Nested_InnerMessage): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); - message.deep !== undefined - && (obj.deep = message.deep ? Nested_InnerMessage_DeepMessage.toJSON(message.deep) : undefined); + message.deep !== undefined && + (obj.deep = message.deep ? Nested_InnerMessage_DeepMessage.toJSON(message.deep) : undefined); return obj; }, @@ -788,12 +788,12 @@ export const SimpleWithWrappers = { message.age !== undefined && (obj.age = message.age); message.enabled !== undefined && (obj.enabled = message.enabled); if (message.coins) { - obj.coins = message.coins.map(e => e); + obj.coins = message.coins.map((e) => e); } else { obj.coins = []; } if (message.snacks) { - obj.snacks = message.snacks.map(e => e); + obj.snacks = message.snacks.map((e) => e); } else { obj.snacks = []; } @@ -1609,7 +1609,7 @@ export class PingServiceClientImpl implements PingService { ping(request: PingRequest): Promise { const data = PingRequest.encode(request).finish(); const promise = this.rpc.request("simple.PingService", "ping", data); - return promise.then(data => PingResponse.decode(new _m0.Reader(data))); + return promise.then((data) => PingResponse.decode(new _m0.Reader(data))); } } diff --git a/integration/simple-string-enums/google/protobuf/struct.ts b/integration/simple-string-enums/google/protobuf/struct.ts index 21c510586..4e88bc237 100644 --- a/integration/simple-string-enums/google/protobuf/struct.ts +++ b/integration/simple-string-enums/google/protobuf/struct.ts @@ -184,7 +184,7 @@ export const Struct = { wrap(object: { [key: string]: any } | undefined): Struct { const struct = createBaseStruct(); if (object !== undefined) { - Object.keys(object).forEach(key => { + Object.keys(object).forEach((key) => { struct.fields[key] = object[key]; }); } @@ -193,7 +193,7 @@ export const Struct = { unwrap(message: Struct): { [key: string]: any } { const object: { [key: string]: any } = {}; - Object.keys(message.fields).forEach(key => { + Object.keys(message.fields).forEach((key) => { object[key] = message.fields[key]; }); return object; @@ -335,8 +335,8 @@ export const Value = { toJSON(message: Value): unknown { const obj: any = {}; - message.nullValue !== undefined - && (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); + message.nullValue !== undefined && + (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); message.numberValue !== undefined && (obj.numberValue = message.numberValue); message.stringValue !== undefined && (obj.stringValue = message.stringValue); message.boolValue !== undefined && (obj.boolValue = message.boolValue); @@ -433,7 +433,7 @@ export const ListValue = { toJSON(message: ListValue): unknown { const obj: any = {}; if (message.values) { - obj.values = message.values.map(e => e); + obj.values = message.values.map((e) => e); } else { obj.values = []; } diff --git a/integration/simple-string-enums/simple.ts b/integration/simple-string-enums/simple.ts index 1accd574c..267ee22cd 100644 --- a/integration/simple-string-enums/simple.ts +++ b/integration/simple-string-enums/simple.ts @@ -156,7 +156,7 @@ export const Simple = { message.name !== undefined && (obj.name = message.name); message.state !== undefined && (obj.state = stateEnumToJSON(message.state)); if (message.states) { - obj.states = message.states.map(e => stateEnumToJSON(e)); + obj.states = message.states.map((e) => stateEnumToJSON(e)); } else { obj.states = []; } diff --git a/integration/simple-unrecognized-enum/google/protobuf/wrappers.ts b/integration/simple-unrecognized-enum/google/protobuf/wrappers.ts index 22e0e03e4..3145298cb 100644 --- a/integration/simple-unrecognized-enum/google/protobuf/wrappers.ts +++ b/integration/simple-unrecognized-enum/google/protobuf/wrappers.ts @@ -506,8 +506,8 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, diff --git a/integration/simple-unrecognized-enum/simple.ts b/integration/simple-unrecognized-enum/simple.ts index 045ff7f86..e868a9a03 100644 --- a/integration/simple-unrecognized-enum/simple.ts +++ b/integration/simple-unrecognized-enum/simple.ts @@ -364,22 +364,22 @@ export const Simple = { message.child !== undefined && (obj.child = message.child ? Child.toJSON(message.child) : undefined); message.state !== undefined && (obj.state = stateEnumToJSON(message.state)); if (message.grandChildren) { - obj.grandChildren = message.grandChildren.map(e => e ? Child.toJSON(e) : undefined); + obj.grandChildren = message.grandChildren.map((e) => e ? Child.toJSON(e) : undefined); } else { obj.grandChildren = []; } if (message.coins) { - obj.coins = message.coins.map(e => Math.round(e)); + obj.coins = message.coins.map((e) => Math.round(e)); } else { obj.coins = []; } if (message.snacks) { - obj.snacks = message.snacks.map(e => e); + obj.snacks = message.snacks.map((e) => e); } else { obj.snacks = []; } if (message.oldStates) { - obj.oldStates = message.oldStates.map(e => stateEnumToJSON(e)); + obj.oldStates = message.oldStates.map((e) => stateEnumToJSON(e)); } else { obj.oldStates = []; } @@ -516,8 +516,8 @@ export const Nested = { toJSON(message: Nested): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); - message.message !== undefined - && (obj.message = message.message ? Nested_InnerMessage.toJSON(message.message) : undefined); + message.message !== undefined && + (obj.message = message.message ? Nested_InnerMessage.toJSON(message.message) : undefined); message.state !== undefined && (obj.state = nested_InnerEnumToJSON(message.state)); return obj; }, @@ -579,8 +579,8 @@ export const Nested_InnerMessage = { toJSON(message: Nested_InnerMessage): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); - message.deep !== undefined - && (obj.deep = message.deep ? Nested_InnerMessage_DeepMessage.toJSON(message.deep) : undefined); + message.deep !== undefined && + (obj.deep = message.deep ? Nested_InnerMessage_DeepMessage.toJSON(message.deep) : undefined); return obj; }, @@ -771,12 +771,12 @@ export const SimpleWithWrappers = { message.age !== undefined && (obj.age = message.age); message.enabled !== undefined && (obj.enabled = message.enabled); if (message.coins) { - obj.coins = message.coins.map(e => e); + obj.coins = message.coins.map((e) => e); } else { obj.coins = []; } if (message.snacks) { - obj.snacks = message.snacks.map(e => e); + obj.snacks = message.snacks.map((e) => e); } else { obj.snacks = []; } @@ -1545,7 +1545,7 @@ export class PingServiceClientImpl implements PingService { ping(request: PingRequest): Promise { const data = PingRequest.encode(request).finish(); const promise = this.rpc.request("simple.PingService", "ping", data); - return promise.then(data => PingResponse.decode(new _m0.Reader(data))); + return promise.then((data) => PingResponse.decode(new _m0.Reader(data))); } } diff --git a/integration/simple/google/protobuf/wrappers.ts b/integration/simple/google/protobuf/wrappers.ts index 22e0e03e4..3145298cb 100644 --- a/integration/simple/google/protobuf/wrappers.ts +++ b/integration/simple/google/protobuf/wrappers.ts @@ -506,8 +506,8 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, diff --git a/integration/simple/simple.ts b/integration/simple/simple.ts index ecfc52714..0321fc7c6 100644 --- a/integration/simple/simple.ts +++ b/integration/simple/simple.ts @@ -471,35 +471,35 @@ export const Simple = { message.child !== undefined && (obj.child = message.child ? Child.toJSON(message.child) : undefined); message.state !== undefined && (obj.state = stateEnumToJSON(message.state)); if (message.grandChildren) { - obj.grandChildren = message.grandChildren.map(e => e ? Child.toJSON(e) : undefined); + obj.grandChildren = message.grandChildren.map((e) => e ? Child.toJSON(e) : undefined); } else { obj.grandChildren = []; } if (message.coins) { - obj.coins = message.coins.map(e => Math.round(e)); + obj.coins = message.coins.map((e) => Math.round(e)); } else { obj.coins = []; } if (message.snacks) { - obj.snacks = message.snacks.map(e => e); + obj.snacks = message.snacks.map((e) => e); } else { obj.snacks = []; } if (message.oldStates) { - obj.oldStates = message.oldStates.map(e => stateEnumToJSON(e)); + obj.oldStates = message.oldStates.map((e) => stateEnumToJSON(e)); } else { obj.oldStates = []; } message.thing !== undefined && (obj.thing = message.thing ? ImportedThing.toJSON(message.thing) : undefined); if (message.blobs) { - obj.blobs = message.blobs.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + obj.blobs = message.blobs.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); } else { obj.blobs = []; } - message.birthday !== undefined - && (obj.birthday = message.birthday ? DateMessage.toJSON(message.birthday) : undefined); - message.blob !== undefined - && (obj.blob = base64FromBytes(message.blob !== undefined ? message.blob : new Uint8Array())); + message.birthday !== undefined && + (obj.birthday = message.birthday ? DateMessage.toJSON(message.birthday) : undefined); + message.blob !== undefined && + (obj.blob = base64FromBytes(message.blob !== undefined ? message.blob : new Uint8Array())); message.enabled !== undefined && (obj.enabled = message.enabled); return obj; }, @@ -639,8 +639,8 @@ export const Nested = { toJSON(message: Nested): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); - message.message !== undefined - && (obj.message = message.message ? Nested_InnerMessage.toJSON(message.message) : undefined); + message.message !== undefined && + (obj.message = message.message ? Nested_InnerMessage.toJSON(message.message) : undefined); message.state !== undefined && (obj.state = nested_InnerEnumToJSON(message.state)); return obj; }, @@ -702,8 +702,8 @@ export const Nested_InnerMessage = { toJSON(message: Nested_InnerMessage): unknown { const obj: any = {}; message.name !== undefined && (obj.name = message.name); - message.deep !== undefined - && (obj.deep = message.deep ? Nested_InnerMessage_DeepMessage.toJSON(message.deep) : undefined); + message.deep !== undefined && + (obj.deep = message.deep ? Nested_InnerMessage_DeepMessage.toJSON(message.deep) : undefined); return obj; }, @@ -901,12 +901,12 @@ export const SimpleWithWrappers = { message.age !== undefined && (obj.age = message.age); message.enabled !== undefined && (obj.enabled = message.enabled); if (message.coins) { - obj.coins = message.coins.map(e => e); + obj.coins = message.coins.map((e) => e); } else { obj.coins = []; } if (message.snacks) { - obj.snacks = message.snacks.map(e => e); + obj.snacks = message.snacks.map((e) => e); } else { obj.snacks = []; } @@ -1515,8 +1515,8 @@ export const SimpleWithMap_MapOfBytesEntry = { toJSON(message: SimpleWithMap_MapOfBytesEntry): unknown { const obj: any = {}; message.key !== undefined && (obj.key = message.key); - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, @@ -2256,11 +2256,11 @@ export const SimpleButOptional = { message.age !== undefined && (obj.age = Math.round(message.age)); message.createdAt !== undefined && (obj.createdAt = message.createdAt.toISOString()); message.child !== undefined && (obj.child = message.child ? Child.toJSON(message.child) : undefined); - message.state !== undefined - && (obj.state = message.state !== undefined ? stateEnumToJSON(message.state) : undefined); + message.state !== undefined && + (obj.state = message.state !== undefined ? stateEnumToJSON(message.state) : undefined); message.thing !== undefined && (obj.thing = message.thing ? ImportedThing.toJSON(message.thing) : undefined); - message.birthday !== undefined - && (obj.birthday = message.birthday ? DateMessage.toJSON(message.birthday) : undefined); + message.birthday !== undefined && + (obj.birthday = message.birthday ? DateMessage.toJSON(message.birthday) : undefined); return obj; }, @@ -2333,7 +2333,7 @@ export class PingServiceClientImpl implements PingService { ping(request: PingRequest): Promise { const data = PingRequest.encode(request).finish(); const promise = this.rpc.request("simple.PingService", "ping", data); - return promise.then(data => PingResponse.decode(new _m0.Reader(data))); + return promise.then((data) => PingResponse.decode(new _m0.Reader(data))); } } diff --git a/integration/struct/google/protobuf/struct.ts b/integration/struct/google/protobuf/struct.ts index 8c712529b..80a98258e 100644 --- a/integration/struct/google/protobuf/struct.ts +++ b/integration/struct/google/protobuf/struct.ts @@ -174,7 +174,7 @@ export const Struct = { wrap(object: { [key: string]: any } | undefined): Struct { const struct = createBaseStruct(); if (object !== undefined) { - Object.keys(object).forEach(key => { + Object.keys(object).forEach((key) => { struct.fields[key] = object[key]; }); } @@ -183,7 +183,7 @@ export const Struct = { unwrap(message: Struct): { [key: string]: any } { const object: { [key: string]: any } = {}; - Object.keys(message.fields).forEach(key => { + Object.keys(message.fields).forEach((key) => { object[key] = message.fields[key]; }); return object; @@ -325,8 +325,8 @@ export const Value = { toJSON(message: Value): unknown { const obj: any = {}; - message.nullValue !== undefined - && (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); + message.nullValue !== undefined && + (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); message.numberValue !== undefined && (obj.numberValue = message.numberValue); message.stringValue !== undefined && (obj.stringValue = message.stringValue); message.boolValue !== undefined && (obj.boolValue = message.boolValue); @@ -423,7 +423,7 @@ export const ListValue = { toJSON(message: ListValue): unknown { const obj: any = {}; if (message.values) { - obj.values = message.values.map(e => e); + obj.values = message.values.map((e) => e); } else { obj.values = []; } diff --git a/integration/type-registry/google/protobuf/struct.ts b/integration/type-registry/google/protobuf/struct.ts index bf6468692..6f035c984 100644 --- a/integration/type-registry/google/protobuf/struct.ts +++ b/integration/type-registry/google/protobuf/struct.ts @@ -185,7 +185,7 @@ export const Struct = { wrap(object: { [key: string]: any } | undefined): Struct { const struct = createBaseStruct(); if (object !== undefined) { - Object.keys(object).forEach(key => { + Object.keys(object).forEach((key) => { struct.fields[key] = object[key]; }); } @@ -194,7 +194,7 @@ export const Struct = { unwrap(message: Struct): { [key: string]: any } { const object: { [key: string]: any } = {}; - Object.keys(message.fields).forEach(key => { + Object.keys(message.fields).forEach((key) => { object[key] = message.fields[key]; }); return object; @@ -350,8 +350,8 @@ export const Value = { toJSON(message: Value): unknown { const obj: any = {}; - message.nullValue !== undefined - && (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); + message.nullValue !== undefined && + (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); message.numberValue !== undefined && (obj.numberValue = message.numberValue); message.stringValue !== undefined && (obj.stringValue = message.stringValue); message.boolValue !== undefined && (obj.boolValue = message.boolValue); @@ -452,7 +452,7 @@ export const ListValue = { toJSON(message: ListValue): unknown { const obj: any = {}; if (message.values) { - obj.values = message.values.map(e => e); + obj.values = message.values.map((e) => e); } else { obj.values = []; } diff --git a/integration/unknown-fields/options.ts b/integration/unknown-fields/options.ts index cd06fbfff..fb0869ba5 100644 --- a/integration/unknown-fields/options.ts +++ b/integration/unknown-fields/options.ts @@ -194,7 +194,7 @@ export class MyServiceClientImpl implements MyService { MyMethod(request: RequestType): Promise { const data = RequestType.encode(request).finish(); const promise = this.rpc.request("MyService", "MyMethod", data); - return promise.then(data => ResponseType.decode(new _m0.Reader(data))); + return promise.then((data) => ResponseType.decode(new _m0.Reader(data))); } } diff --git a/integration/use-date-string/use-date-string.ts b/integration/use-date-string/use-date-string.ts index c3a37b140..9ecfb4fa9 100644 --- a/integration/use-date-string/use-date-string.ts +++ b/integration/use-date-string/use-date-string.ts @@ -96,7 +96,7 @@ export const Todo = { message.id !== undefined && (obj.id = message.id); message.timestamp !== undefined && (obj.timestamp = message.timestamp); if (message.repeatedTimestamp) { - obj.repeatedTimestamp = message.repeatedTimestamp.map(e => e); + obj.repeatedTimestamp = message.repeatedTimestamp.map((e) => e); } else { obj.repeatedTimestamp = []; } diff --git a/integration/use-date-true/use-date-true.ts b/integration/use-date-true/use-date-true.ts index 1214f6b2b..5d081c234 100644 --- a/integration/use-date-true/use-date-true.ts +++ b/integration/use-date-true/use-date-true.ts @@ -97,7 +97,7 @@ export const Todo = { message.id !== undefined && (obj.id = message.id); message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString()); if (message.repeatedTimestamp) { - obj.repeatedTimestamp = message.repeatedTimestamp.map(e => e.toISOString()); + obj.repeatedTimestamp = message.repeatedTimestamp.map((e) => e.toISOString()); } else { obj.repeatedTimestamp = []; } @@ -201,7 +201,7 @@ export class ClockClientImpl implements Clock { Now(request: Empty): Promise { const data = Empty.encode(request).finish(); const promise = this.rpc.request("Clock", "Now", data); - return promise.then(data => fromTimestamp(Timestamp.decode(new _m0.Reader(data)))); + return promise.then((data) => fromTimestamp(Timestamp.decode(new _m0.Reader(data)))); } } diff --git a/integration/use-json-wire-format/google/protobuf/duration.ts b/integration/use-json-wire-format/google/protobuf/duration.ts index 7a003b5e8..2ec402df3 100644 --- a/integration/use-json-wire-format/google/protobuf/duration.ts +++ b/integration/use-json-wire-format/google/protobuf/duration.ts @@ -1,4 +1,5 @@ /* eslint-disable */ + export const protobufPackage = "google.protobuf"; /** diff --git a/integration/use-json-wire-format/google/protobuf/field_mask.ts b/integration/use-json-wire-format/google/protobuf/field_mask.ts index bbb342d8d..a97d90299 100644 --- a/integration/use-json-wire-format/google/protobuf/field_mask.ts +++ b/integration/use-json-wire-format/google/protobuf/field_mask.ts @@ -1,4 +1,5 @@ /* eslint-disable */ + export const protobufPackage = "google.protobuf"; /** diff --git a/integration/use-json-wire-format/google/protobuf/timestamp.ts b/integration/use-json-wire-format/google/protobuf/timestamp.ts index 98330174a..5f1887960 100644 --- a/integration/use-json-wire-format/google/protobuf/timestamp.ts +++ b/integration/use-json-wire-format/google/protobuf/timestamp.ts @@ -1,4 +1,5 @@ /* eslint-disable */ + export const protobufPackage = "google.protobuf"; /** diff --git a/integration/use-json-wire-format/use-json-wire-format.ts b/integration/use-json-wire-format/use-json-wire-format.ts index e8ca4cdfe..8f9d401ea 100644 --- a/integration/use-json-wire-format/use-json-wire-format.ts +++ b/integration/use-json-wire-format/use-json-wire-format.ts @@ -1,4 +1,5 @@ /* eslint-disable */ + export const protobufPackage = ""; export interface Todo { diff --git a/integration/use-numeric-enum-json/google/protobuf/struct.ts b/integration/use-numeric-enum-json/google/protobuf/struct.ts index 5caffc650..d17382273 100644 --- a/integration/use-numeric-enum-json/google/protobuf/struct.ts +++ b/integration/use-numeric-enum-json/google/protobuf/struct.ts @@ -174,7 +174,7 @@ export const Struct = { wrap(object: { [key: string]: any } | undefined): Struct { const struct = createBaseStruct(); if (object !== undefined) { - Object.keys(object).forEach(key => { + Object.keys(object).forEach((key) => { struct.fields[key] = object[key]; }); } @@ -183,7 +183,7 @@ export const Struct = { unwrap(message: Struct): { [key: string]: any } { const object: { [key: string]: any } = {}; - Object.keys(message.fields).forEach(key => { + Object.keys(message.fields).forEach((key) => { object[key] = message.fields[key]; }); return object; @@ -325,8 +325,8 @@ export const Value = { toJSON(message: Value): unknown { const obj: any = {}; - message.nullValue !== undefined - && (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); + message.nullValue !== undefined && + (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); message.numberValue !== undefined && (obj.numberValue = message.numberValue); message.stringValue !== undefined && (obj.stringValue = message.stringValue); message.boolValue !== undefined && (obj.boolValue = message.boolValue); @@ -423,7 +423,7 @@ export const ListValue = { toJSON(message: ListValue): unknown { const obj: any = {}; if (message.values) { - obj.values = message.values.map(e => e); + obj.values = message.values.map((e) => e); } else { obj.values = []; } diff --git a/integration/use-numeric-enum-json/simple.ts b/integration/use-numeric-enum-json/simple.ts index 38cba06af..12504b29f 100644 --- a/integration/use-numeric-enum-json/simple.ts +++ b/integration/use-numeric-enum-json/simple.ts @@ -142,7 +142,7 @@ export const Simple = { message.name !== undefined && (obj.name = message.name); message.state !== undefined && (obj.state = stateEnumToJSON(message.state)); if (message.states) { - obj.states = message.states.map(e => stateEnumToJSON(e)); + obj.states = message.states.map((e) => stateEnumToJSON(e)); } else { obj.states = []; } diff --git a/integration/use-objectid-true-external-import/use-objectid-true.ts b/integration/use-objectid-true-external-import/use-objectid-true.ts index c59a7d1b1..83d4db1fc 100644 --- a/integration/use-objectid-true-external-import/use-objectid-true.ts +++ b/integration/use-objectid-true-external-import/use-objectid-true.ts @@ -95,7 +95,7 @@ export const Todo = { message.id !== undefined && (obj.id = message.id); message.oid !== undefined && (obj.oid = message.oid.toString()); if (message.repeatedOid) { - obj.repeatedOid = message.repeatedOid.map(e => e.toString()); + obj.repeatedOid = message.repeatedOid.map((e) => e.toString()); } else { obj.repeatedOid = []; } diff --git a/integration/use-optionals-all/test.ts b/integration/use-optionals-all/test.ts index f100ba013..3cf686dd6 100644 --- a/integration/use-optionals-all/test.ts +++ b/integration/use-optionals-all/test.ts @@ -348,52 +348,52 @@ export const OptionalsTest = { message.long !== undefined && (obj.long = Math.round(message.long)); message.truth !== undefined && (obj.truth = message.truth); message.description !== undefined && (obj.description = message.description); - message.data !== undefined - && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); if (message.repId) { - obj.repId = message.repId.map(e => Math.round(e)); + obj.repId = message.repId.map((e) => Math.round(e)); } else { obj.repId = []; } if (message.repChild) { - obj.repChild = message.repChild.map(e => e ? Child.toJSON(e) : undefined); + obj.repChild = message.repChild.map((e) => e ? Child.toJSON(e) : undefined); } else { obj.repChild = []; } if (message.repState) { - obj.repState = message.repState.map(e => stateEnumToJSON(e)); + obj.repState = message.repState.map((e) => stateEnumToJSON(e)); } else { obj.repState = []; } if (message.repLong) { - obj.repLong = message.repLong.map(e => Math.round(e)); + obj.repLong = message.repLong.map((e) => Math.round(e)); } else { obj.repLong = []; } if (message.repTruth) { - obj.repTruth = message.repTruth.map(e => e); + obj.repTruth = message.repTruth.map((e) => e); } else { obj.repTruth = []; } if (message.repDescription) { - obj.repDescription = message.repDescription.map(e => e); + obj.repDescription = message.repDescription.map((e) => e); } else { obj.repDescription = []; } if (message.repData) { - obj.repData = message.repData.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + obj.repData = message.repData.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); } else { obj.repData = []; } message.optId !== undefined && (obj.optId = Math.round(message.optId)); message.optChild !== undefined && (obj.optChild = message.optChild ? Child.toJSON(message.optChild) : undefined); - message.optState !== undefined - && (obj.optState = message.optState !== undefined ? stateEnumToJSON(message.optState) : undefined); + message.optState !== undefined && + (obj.optState = message.optState !== undefined ? stateEnumToJSON(message.optState) : undefined); message.optLong !== undefined && (obj.optLong = Math.round(message.optLong)); message.optTruth !== undefined && (obj.optTruth = message.optTruth); message.optDescription !== undefined && (obj.optDescription = message.optDescription); - message.optData !== undefined - && (obj.optData = message.optData !== undefined ? base64FromBytes(message.optData) : undefined); + message.optData !== undefined && + (obj.optData = message.optData !== undefined ? base64FromBytes(message.optData) : undefined); obj.translations = {}; if (message.translations) { Object.entries(message.translations).forEach(([k, v]) => { diff --git a/integration/value/google/protobuf/struct.ts b/integration/value/google/protobuf/struct.ts index 8c712529b..80a98258e 100644 --- a/integration/value/google/protobuf/struct.ts +++ b/integration/value/google/protobuf/struct.ts @@ -174,7 +174,7 @@ export const Struct = { wrap(object: { [key: string]: any } | undefined): Struct { const struct = createBaseStruct(); if (object !== undefined) { - Object.keys(object).forEach(key => { + Object.keys(object).forEach((key) => { struct.fields[key] = object[key]; }); } @@ -183,7 +183,7 @@ export const Struct = { unwrap(message: Struct): { [key: string]: any } { const object: { [key: string]: any } = {}; - Object.keys(message.fields).forEach(key => { + Object.keys(message.fields).forEach((key) => { object[key] = message.fields[key]; }); return object; @@ -325,8 +325,8 @@ export const Value = { toJSON(message: Value): unknown { const obj: any = {}; - message.nullValue !== undefined - && (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); + message.nullValue !== undefined && + (obj.nullValue = message.nullValue !== undefined ? nullValueToJSON(message.nullValue) : undefined); message.numberValue !== undefined && (obj.numberValue = message.numberValue); message.stringValue !== undefined && (obj.stringValue = message.stringValue); message.boolValue !== undefined && (obj.boolValue = message.boolValue); @@ -423,7 +423,7 @@ export const ListValue = { toJSON(message: ListValue): unknown { const obj: any = {}; if (message.values) { - obj.values = message.values.map(e => e); + obj.values = message.values.map((e) => e); } else { obj.values = []; } diff --git a/integration/value/google/protobuf/wrappers.ts b/integration/value/google/protobuf/wrappers.ts index 22e0e03e4..3145298cb 100644 --- a/integration/value/google/protobuf/wrappers.ts +++ b/integration/value/google/protobuf/wrappers.ts @@ -506,8 +506,8 @@ export const BytesValue = { toJSON(message: BytesValue): unknown { const obj: any = {}; - message.value !== undefined - && (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); + message.value !== undefined && + (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); return obj; }, diff --git a/integration/value/value.ts b/integration/value/value.ts index 2e28d2619..b89dd4536 100644 --- a/integration/value/value.ts +++ b/integration/value/value.ts @@ -82,12 +82,12 @@ export const ValueMessage = { message.value !== undefined && (obj.value = message.value); message.anyList !== undefined && (obj.anyList = message.anyList); if (message.repeatedAny) { - obj.repeatedAny = message.repeatedAny.map(e => e); + obj.repeatedAny = message.repeatedAny.map((e) => e); } else { obj.repeatedAny = []; } if (message.repeatedStrings) { - obj.repeatedStrings = message.repeatedStrings.map(e => e); + obj.repeatedStrings = message.repeatedStrings.map((e) => e); } else { obj.repeatedStrings = []; } diff --git a/integration/vector-tile/vector_tile.ts b/integration/vector-tile/vector_tile.ts index b07615a6d..d8b628bb4 100644 --- a/integration/vector-tile/vector_tile.ts +++ b/integration/vector-tile/vector_tile.ts @@ -116,7 +116,7 @@ export const Tile = { toJSON(message: Tile): unknown { const obj: any = {}; if (message.layers) { - obj.layers = message.layers.map(e => e ? Tile_Layer.toJSON(e) : undefined); + obj.layers = message.layers.map((e) => e ? Tile_Layer.toJSON(e) : undefined); } else { obj.layers = []; } @@ -312,13 +312,13 @@ export const Tile_Feature = { const obj: any = {}; message.id !== undefined && (obj.id = Math.round(message.id)); if (message.tags) { - obj.tags = message.tags.map(e => Math.round(e)); + obj.tags = message.tags.map((e) => Math.round(e)); } else { obj.tags = []; } message.type !== undefined && (obj.type = tile_GeomTypeToJSON(message.type)); if (message.geometry) { - obj.geometry = message.geometry.map(e => Math.round(e)); + obj.geometry = message.geometry.map((e) => Math.round(e)); } else { obj.geometry = []; } @@ -411,17 +411,17 @@ export const Tile_Layer = { message.version !== undefined && (obj.version = Math.round(message.version)); message.name !== undefined && (obj.name = message.name); if (message.features) { - obj.features = message.features.map(e => e ? Tile_Feature.toJSON(e) : undefined); + obj.features = message.features.map((e) => e ? Tile_Feature.toJSON(e) : undefined); } else { obj.features = []; } if (message.keys) { - obj.keys = message.keys.map(e => e); + obj.keys = message.keys.map((e) => e); } else { obj.keys = []; } if (message.values) { - obj.values = message.values.map(e => e ? Tile_Value.toJSON(e) : undefined); + obj.values = message.values.map((e) => e ? Tile_Value.toJSON(e) : undefined); } else { obj.values = []; }