-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Repo: https://github.com/bufbuild/protobuf-es Release: https://buf.build/blog/protobuf-es-the-protocol-buffers-typescript-javascript-runtime-we-all-deserve --- Relates to bufbuild/protobuf-es#333 --------- Co-authored-by: Alex Potsides <alex@achingbrain.net>
- Loading branch information
1 parent
47359ee
commit 47a4dcb
Showing
4 changed files
with
267 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
243 changes: 243 additions & 0 deletions
243
packages/protons-benchmark/src/implementations/protobuf-es/bench_pb.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,243 @@ | ||
// @generated by protoc-gen-es v1.0.0 with parameter "target=ts" | ||
// @generated from file bench.proto (syntax proto3) | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; | ||
import { Message, proto3 } from "@bufbuild/protobuf"; | ||
|
||
/** | ||
* @generated from enum FOO | ||
*/ | ||
export enum FOO { | ||
/** | ||
* @generated from enum value: NONE = 0; | ||
*/ | ||
NONE = 0, | ||
|
||
/** | ||
* @generated from enum value: LOL = 1; | ||
*/ | ||
LOL = 1, | ||
|
||
/** | ||
* @generated from enum value: ABE = 3; | ||
*/ | ||
ABE = 3, | ||
} | ||
// Retrieve enum metadata with: proto3.getEnumType(FOO) | ||
proto3.util.setEnumType(FOO, "FOO", [ | ||
{ no: 0, name: "NONE" }, | ||
{ no: 1, name: "LOL" }, | ||
{ no: 3, name: "ABE" }, | ||
]); | ||
|
||
/** | ||
* @generated from message Foo | ||
*/ | ||
export class Foo extends Message<Foo> { | ||
/** | ||
* @generated from field: optional uint32 baz = 1; | ||
*/ | ||
baz?: number; | ||
|
||
constructor(data?: PartialMessage<Foo>) { | ||
super(); | ||
proto3.util.initPartial(data, this); | ||
} | ||
|
||
static readonly runtime = proto3; | ||
static readonly typeName = "Foo"; | ||
static readonly fields: FieldList = proto3.util.newFieldList(() => [ | ||
{ no: 1, name: "baz", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true }, | ||
]); | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Foo { | ||
return new Foo().fromBinary(bytes, options); | ||
} | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Foo { | ||
return new Foo().fromJson(jsonValue, options); | ||
} | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Foo { | ||
return new Foo().fromJsonString(jsonString, options); | ||
} | ||
|
||
static equals(a: Foo | PlainMessage<Foo> | undefined, b: Foo | PlainMessage<Foo> | undefined): boolean { | ||
return proto3.util.equals(Foo, a, b); | ||
} | ||
} | ||
|
||
/** | ||
* @generated from message Bar | ||
*/ | ||
export class Bar extends Message<Bar> { | ||
/** | ||
* @generated from field: optional Foo tmp = 1; | ||
*/ | ||
tmp?: Foo; | ||
|
||
constructor(data?: PartialMessage<Bar>) { | ||
super(); | ||
proto3.util.initPartial(data, this); | ||
} | ||
|
||
static readonly runtime = proto3; | ||
static readonly typeName = "Bar"; | ||
static readonly fields: FieldList = proto3.util.newFieldList(() => [ | ||
{ no: 1, name: "tmp", kind: "message", T: Foo, opt: true }, | ||
]); | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Bar { | ||
return new Bar().fromBinary(bytes, options); | ||
} | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Bar { | ||
return new Bar().fromJson(jsonValue, options); | ||
} | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Bar { | ||
return new Bar().fromJsonString(jsonString, options); | ||
} | ||
|
||
static equals(a: Bar | PlainMessage<Bar> | undefined, b: Bar | PlainMessage<Bar> | undefined): boolean { | ||
return proto3.util.equals(Bar, a, b); | ||
} | ||
} | ||
|
||
/** | ||
* @generated from message Yo | ||
*/ | ||
export class Yo extends Message<Yo> { | ||
/** | ||
* @generated from field: repeated FOO lol = 1; | ||
*/ | ||
lol: FOO[] = []; | ||
|
||
constructor(data?: PartialMessage<Yo>) { | ||
super(); | ||
proto3.util.initPartial(data, this); | ||
} | ||
|
||
static readonly runtime = proto3; | ||
static readonly typeName = "Yo"; | ||
static readonly fields: FieldList = proto3.util.newFieldList(() => [ | ||
{ no: 1, name: "lol", kind: "enum", T: proto3.getEnumType(FOO), repeated: true }, | ||
]); | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Yo { | ||
return new Yo().fromBinary(bytes, options); | ||
} | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Yo { | ||
return new Yo().fromJson(jsonValue, options); | ||
} | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Yo { | ||
return new Yo().fromJsonString(jsonString, options); | ||
} | ||
|
||
static equals(a: Yo | PlainMessage<Yo> | undefined, b: Yo | PlainMessage<Yo> | undefined): boolean { | ||
return proto3.util.equals(Yo, a, b); | ||
} | ||
} | ||
|
||
/** | ||
* @generated from message Lol | ||
*/ | ||
export class Lol extends Message<Lol> { | ||
/** | ||
* @generated from field: optional string lol = 1; | ||
*/ | ||
lol?: string; | ||
|
||
/** | ||
* @generated from field: Bar b = 2; | ||
*/ | ||
b?: Bar; | ||
|
||
constructor(data?: PartialMessage<Lol>) { | ||
super(); | ||
proto3.util.initPartial(data, this); | ||
} | ||
|
||
static readonly runtime = proto3; | ||
static readonly typeName = "Lol"; | ||
static readonly fields: FieldList = proto3.util.newFieldList(() => [ | ||
{ no: 1, name: "lol", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 2, name: "b", kind: "message", T: Bar }, | ||
]); | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Lol { | ||
return new Lol().fromBinary(bytes, options); | ||
} | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Lol { | ||
return new Lol().fromJson(jsonValue, options); | ||
} | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Lol { | ||
return new Lol().fromJsonString(jsonString, options); | ||
} | ||
|
||
static equals(a: Lol | PlainMessage<Lol> | undefined, b: Lol | PlainMessage<Lol> | undefined): boolean { | ||
return proto3.util.equals(Lol, a, b); | ||
} | ||
} | ||
|
||
/** | ||
* @generated from message Test | ||
*/ | ||
export class Test extends Message<Test> { | ||
/** | ||
* @generated from field: optional Lol meh = 6; | ||
*/ | ||
meh?: Lol; | ||
|
||
/** | ||
* @generated from field: optional uint32 hello = 3; | ||
*/ | ||
hello?: number; | ||
|
||
/** | ||
* @generated from field: optional string foo = 1; | ||
*/ | ||
foo?: string; | ||
|
||
/** | ||
* @generated from field: optional bytes payload = 7; | ||
*/ | ||
payload?: Uint8Array; | ||
|
||
constructor(data?: PartialMessage<Test>) { | ||
super(); | ||
proto3.util.initPartial(data, this); | ||
} | ||
|
||
static readonly runtime = proto3; | ||
static readonly typeName = "Test"; | ||
static readonly fields: FieldList = proto3.util.newFieldList(() => [ | ||
{ no: 6, name: "meh", kind: "message", T: Lol, opt: true }, | ||
{ no: 3, name: "hello", kind: "scalar", T: 13 /* ScalarType.UINT32 */, opt: true }, | ||
{ no: 1, name: "foo", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, | ||
{ no: 7, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */, opt: true }, | ||
]); | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Test { | ||
return new Test().fromBinary(bytes, options); | ||
} | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Test { | ||
return new Test().fromJson(jsonValue, options); | ||
} | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Test { | ||
return new Test().fromJsonString(jsonString, options); | ||
} | ||
|
||
static equals(a: Test | PlainMessage<Test> | undefined, b: Test | PlainMessage<Test> | undefined): boolean { | ||
return proto3.util.equals(Test, a, b); | ||
} | ||
} | ||
|