Erster Commit

This commit is contained in:
2026-08-22 08:40:29 +02:00
commit 875477d425
1961 changed files with 930336 additions and 0 deletions
+157
View File
@@ -0,0 +1,157 @@
import type { PartialMessage, PlainMessage } from "../../message.js";
import { Message } from "../../message.js";
import { proto3 } from "../../proto3.js";
import type { JsonReadOptions, JsonValue, JsonWriteOptions } from "../../json-format.js";
import type { IMessageTypeRegistry } from "../../type-registry.js";
import type { MessageType } from "../../message-type.js";
import type { FieldList } from "../../field-list.js";
import type { BinaryReadOptions } from "../../binary-format.js";
/**
* `Any` contains an arbitrary serialized protocol buffer message along with a
* URL that describes the type of the serialized message.
*
* Protobuf library provides support to pack/unpack Any values in the form
* of utility functions or additional generated methods of the Any type.
*
* Example 1: Pack and unpack a message in C++.
*
* Foo foo = ...;
* Any any;
* any.PackFrom(foo);
* ...
* if (any.UnpackTo(&foo)) {
* ...
* }
*
* Example 2: Pack and unpack a message in Java.
*
* Foo foo = ...;
* Any any = Any.pack(foo);
* ...
* if (any.is(Foo.class)) {
* foo = any.unpack(Foo.class);
* }
* // or ...
* if (any.isSameTypeAs(Foo.getDefaultInstance())) {
* foo = any.unpack(Foo.getDefaultInstance());
* }
*
* Example 3: Pack and unpack a message in Python.
*
* foo = Foo(...)
* any = Any()
* any.Pack(foo)
* ...
* if any.Is(Foo.DESCRIPTOR):
* any.Unpack(foo)
* ...
*
* Example 4: Pack and unpack a message in Go
*
* foo := &pb.Foo{...}
* any, err := anypb.New(foo)
* if err != nil {
* ...
* }
* ...
* foo := &pb.Foo{}
* if err := any.UnmarshalTo(foo); err != nil {
* ...
* }
*
* The pack methods provided by protobuf library will by default use
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
* methods only use the fully qualified type name after the last '/'
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
* name "y.z".
*
* JSON
* ====
* The JSON representation of an `Any` value uses the regular
* representation of the deserialized, embedded message, with an
* additional field `@type` which contains the type URL. Example:
*
* package google.profile;
* message Person {
* string first_name = 1;
* string last_name = 2;
* }
*
* {
* "@type": "type.googleapis.com/google.profile.Person",
* "firstName": <string>,
* "lastName": <string>
* }
*
* If the embedded message type is well-known and has a custom JSON
* representation, that representation will be embedded adding a field
* `value` which holds the custom JSON in addition to the `@type`
* field. Example (for message [google.protobuf.Duration][]):
*
* {
* "@type": "type.googleapis.com/google.protobuf.Duration",
* "value": "1.212s"
* }
*
*
* @generated from message google.protobuf.Any
*/
export declare class Any extends Message<Any> {
/**
* A URL/resource name that uniquely identifies the type of the serialized
* protocol buffer message. This string must contain at least
* one "/" character. The last segment of the URL's path must represent
* the fully qualified name of the type (as in
* `path/google.protobuf.Duration`). The name should be in a canonical form
* (e.g., leading "." is not accepted).
*
* In practice, teams usually precompile into the binary all types that they
* expect it to use in the context of Any. However, for URLs which use the
* scheme `http`, `https`, or no scheme, one can optionally set up a type
* server that maps type URLs to message definitions as follows:
*
* * If no scheme is provided, `https` is assumed.
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
* URL, or have them precompiled into a binary to avoid any
* lookup. Therefore, binary compatibility needs to be preserved
* on changes to types. (Use versioned type names to manage
* breaking changes.)
*
* Note: this functionality is not currently available in the official
* protobuf release, and it is not used for type URLs beginning with
* type.googleapis.com. As of May 2023, there are no widely used type server
* implementations and no plans to implement one.
*
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*
*
* @generated from field: string type_url = 1;
*/
typeUrl: string;
/**
* Must be a valid serialized protocol buffer of the above specified type.
*
* @generated from field: bytes value = 2;
*/
value: Uint8Array;
constructor(data?: PartialMessage<Any>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
packFrom(message: Message): void;
unpackTo(target: Message): boolean;
unpack(registry: IMessageTypeRegistry): Message | undefined;
is(type: MessageType | string): boolean;
private typeNameToUrl;
private typeUrlToName;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Any";
static readonly fields: FieldList;
static pack(message: Message): Any;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Any;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Any;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Any;
static equals(a: Any | PlainMessage<Any> | undefined, b: Any | PlainMessage<Any> | undefined): boolean;
}
+273
View File
@@ -0,0 +1,273 @@
"use strict";
// Copyright 2021-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Any = void 0;
const message_js_1 = require("../../message.js");
const proto3_js_1 = require("../../proto3.js");
/**
* `Any` contains an arbitrary serialized protocol buffer message along with a
* URL that describes the type of the serialized message.
*
* Protobuf library provides support to pack/unpack Any values in the form
* of utility functions or additional generated methods of the Any type.
*
* Example 1: Pack and unpack a message in C++.
*
* Foo foo = ...;
* Any any;
* any.PackFrom(foo);
* ...
* if (any.UnpackTo(&foo)) {
* ...
* }
*
* Example 2: Pack and unpack a message in Java.
*
* Foo foo = ...;
* Any any = Any.pack(foo);
* ...
* if (any.is(Foo.class)) {
* foo = any.unpack(Foo.class);
* }
* // or ...
* if (any.isSameTypeAs(Foo.getDefaultInstance())) {
* foo = any.unpack(Foo.getDefaultInstance());
* }
*
* Example 3: Pack and unpack a message in Python.
*
* foo = Foo(...)
* any = Any()
* any.Pack(foo)
* ...
* if any.Is(Foo.DESCRIPTOR):
* any.Unpack(foo)
* ...
*
* Example 4: Pack and unpack a message in Go
*
* foo := &pb.Foo{...}
* any, err := anypb.New(foo)
* if err != nil {
* ...
* }
* ...
* foo := &pb.Foo{}
* if err := any.UnmarshalTo(foo); err != nil {
* ...
* }
*
* The pack methods provided by protobuf library will by default use
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
* methods only use the fully qualified type name after the last '/'
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
* name "y.z".
*
* JSON
* ====
* The JSON representation of an `Any` value uses the regular
* representation of the deserialized, embedded message, with an
* additional field `@type` which contains the type URL. Example:
*
* package google.profile;
* message Person {
* string first_name = 1;
* string last_name = 2;
* }
*
* {
* "@type": "type.googleapis.com/google.profile.Person",
* "firstName": <string>,
* "lastName": <string>
* }
*
* If the embedded message type is well-known and has a custom JSON
* representation, that representation will be embedded adding a field
* `value` which holds the custom JSON in addition to the `@type`
* field. Example (for message [google.protobuf.Duration][]):
*
* {
* "@type": "type.googleapis.com/google.protobuf.Duration",
* "value": "1.212s"
* }
*
*
* @generated from message google.protobuf.Any
*/
class Any extends message_js_1.Message {
constructor(data) {
super();
/**
* A URL/resource name that uniquely identifies the type of the serialized
* protocol buffer message. This string must contain at least
* one "/" character. The last segment of the URL's path must represent
* the fully qualified name of the type (as in
* `path/google.protobuf.Duration`). The name should be in a canonical form
* (e.g., leading "." is not accepted).
*
* In practice, teams usually precompile into the binary all types that they
* expect it to use in the context of Any. However, for URLs which use the
* scheme `http`, `https`, or no scheme, one can optionally set up a type
* server that maps type URLs to message definitions as follows:
*
* * If no scheme is provided, `https` is assumed.
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
* URL, or have them precompiled into a binary to avoid any
* lookup. Therefore, binary compatibility needs to be preserved
* on changes to types. (Use versioned type names to manage
* breaking changes.)
*
* Note: this functionality is not currently available in the official
* protobuf release, and it is not used for type URLs beginning with
* type.googleapis.com. As of May 2023, there are no widely used type server
* implementations and no plans to implement one.
*
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*
*
* @generated from field: string type_url = 1;
*/
this.typeUrl = "";
/**
* Must be a valid serialized protocol buffer of the above specified type.
*
* @generated from field: bytes value = 2;
*/
this.value = new Uint8Array(0);
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
var _a;
if (this.typeUrl === "") {
return {};
}
const typeName = this.typeUrlToName(this.typeUrl);
const messageType = (_a = options === null || options === void 0 ? void 0 : options.typeRegistry) === null || _a === void 0 ? void 0 : _a.findMessage(typeName);
if (!messageType) {
throw new Error(`cannot encode message google.protobuf.Any to JSON: "${this.typeUrl}" is not in the type registry`);
}
const message = messageType.fromBinary(this.value);
let json = message.toJson(options);
if (typeName.startsWith("google.protobuf.") || (json === null || Array.isArray(json) || typeof json !== "object")) {
json = { value: json };
}
json["@type"] = this.typeUrl;
return json;
}
fromJson(json, options) {
var _a;
if (json === null || Array.isArray(json) || typeof json != "object") {
throw new Error(`cannot decode message google.protobuf.Any from JSON: expected object but got ${json === null ? "null" : Array.isArray(json) ? "array" : typeof json}`);
}
if (Object.keys(json).length == 0) {
return this;
}
const typeUrl = json["@type"];
if (typeof typeUrl != "string" || typeUrl == "") {
throw new Error(`cannot decode message google.protobuf.Any from JSON: "@type" is empty`);
}
const typeName = this.typeUrlToName(typeUrl), messageType = (_a = options === null || options === void 0 ? void 0 : options.typeRegistry) === null || _a === void 0 ? void 0 : _a.findMessage(typeName);
if (!messageType) {
throw new Error(`cannot decode message google.protobuf.Any from JSON: ${typeUrl} is not in the type registry`);
}
let message;
if (typeName.startsWith("google.protobuf.") && Object.prototype.hasOwnProperty.call(json, "value")) {
message = messageType.fromJson(json["value"], options);
}
else {
const copy = Object.assign({}, json);
delete copy["@type"];
message = messageType.fromJson(copy, options);
}
this.packFrom(message);
return this;
}
packFrom(message) {
this.value = message.toBinary();
this.typeUrl = this.typeNameToUrl(message.getType().typeName);
}
unpackTo(target) {
if (!this.is(target.getType())) {
return false;
}
target.fromBinary(this.value);
return true;
}
unpack(registry) {
if (this.typeUrl === "") {
return undefined;
}
const messageType = registry.findMessage(this.typeUrlToName(this.typeUrl));
if (!messageType) {
return undefined;
}
return messageType.fromBinary(this.value);
}
is(type) {
if (this.typeUrl === '') {
return false;
}
const name = this.typeUrlToName(this.typeUrl);
let typeName = '';
if (typeof type === 'string') {
typeName = type;
}
else {
typeName = type.typeName;
}
return name === typeName;
}
typeNameToUrl(name) {
return `type.googleapis.com/${name}`;
}
typeUrlToName(url) {
if (!url.length) {
throw new Error(`invalid type url: ${url}`);
}
const slash = url.lastIndexOf("/");
const name = slash >= 0 ? url.substring(slash + 1) : url;
if (!name.length) {
throw new Error(`invalid type url: ${url}`);
}
return name;
}
static pack(message) {
const any = new Any();
any.packFrom(message);
return any;
}
static fromBinary(bytes, options) {
return new Any().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Any().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Any().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Any, a, b);
}
}
exports.Any = Any;
Any.runtime = proto3_js_1.proto3;
Any.typeName = "google.protobuf.Any";
Any.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
]);
+256
View File
@@ -0,0 +1,256 @@
import type { PartialMessage, PlainMessage } from "../../message.js";
import { Message } from "../../message.js";
import { Option, Syntax } from "./type_pb.js";
import { SourceContext } from "./source_context_pb.js";
import { proto3 } from "../../proto3.js";
import type { FieldList } from "../../field-list.js";
import type { BinaryReadOptions } from "../../binary-format.js";
import type { JsonReadOptions, JsonValue } from "../../json-format.js";
/**
* Api is a light-weight descriptor for an API Interface.
*
* Interfaces are also described as "protocol buffer services" in some contexts,
* such as by the "service" keyword in a .proto file, but they are different
* from API Services, which represent a concrete implementation of an interface
* as opposed to simply a description of methods and bindings. They are also
* sometimes simply referred to as "APIs" in other contexts, such as the name of
* this message itself. See https://cloud.google.com/apis/design/glossary for
* detailed terminology.
*
* @generated from message google.protobuf.Api
*/
export declare class Api extends Message<Api> {
/**
* The fully qualified name of this interface, including package name
* followed by the interface's simple name.
*
* @generated from field: string name = 1;
*/
name: string;
/**
* The methods of this interface, in unspecified order.
*
* @generated from field: repeated google.protobuf.Method methods = 2;
*/
methods: Method[];
/**
* Any metadata attached to the interface.
*
* @generated from field: repeated google.protobuf.Option options = 3;
*/
options: Option[];
/**
* A version string for this interface. If specified, must have the form
* `major-version.minor-version`, as in `1.10`. If the minor version is
* omitted, it defaults to zero. If the entire version field is empty, the
* major version is derived from the package name, as outlined below. If the
* field is not empty, the version in the package name will be verified to be
* consistent with what is provided here.
*
* The versioning schema uses [semantic
* versioning](http://semver.org) where the major version number
* indicates a breaking change and the minor version an additive,
* non-breaking change. Both version numbers are signals to users
* what to expect from different versions, and should be carefully
* chosen based on the product plan.
*
* The major version is also reflected in the package name of the
* interface, which must end in `v<major-version>`, as in
* `google.feature.v1`. For major versions 0 and 1, the suffix can
* be omitted. Zero major versions must only be used for
* experimental, non-GA interfaces.
*
*
* @generated from field: string version = 4;
*/
version: string;
/**
* Source context for the protocol buffer service represented by this
* message.
*
* @generated from field: google.protobuf.SourceContext source_context = 5;
*/
sourceContext?: SourceContext;
/**
* Included interfaces. See [Mixin][].
*
* @generated from field: repeated google.protobuf.Mixin mixins = 6;
*/
mixins: Mixin[];
/**
* The source syntax of the service.
*
* @generated from field: google.protobuf.Syntax syntax = 7;
*/
syntax: Syntax;
constructor(data?: PartialMessage<Api>);
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Api";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Api;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Api;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Api;
static equals(a: Api | PlainMessage<Api> | undefined, b: Api | PlainMessage<Api> | undefined): boolean;
}
/**
* Method represents a method of an API interface.
*
* @generated from message google.protobuf.Method
*/
export declare class Method extends Message<Method> {
/**
* The simple name of this method.
*
* @generated from field: string name = 1;
*/
name: string;
/**
* A URL of the input message type.
*
* @generated from field: string request_type_url = 2;
*/
requestTypeUrl: string;
/**
* If true, the request is streamed.
*
* @generated from field: bool request_streaming = 3;
*/
requestStreaming: boolean;
/**
* The URL of the output message type.
*
* @generated from field: string response_type_url = 4;
*/
responseTypeUrl: string;
/**
* If true, the response is streamed.
*
* @generated from field: bool response_streaming = 5;
*/
responseStreaming: boolean;
/**
* Any metadata attached to the method.
*
* @generated from field: repeated google.protobuf.Option options = 6;
*/
options: Option[];
/**
* The source syntax of this method.
*
* @generated from field: google.protobuf.Syntax syntax = 7;
*/
syntax: Syntax;
constructor(data?: PartialMessage<Method>);
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Method";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Method;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Method;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Method;
static equals(a: Method | PlainMessage<Method> | undefined, b: Method | PlainMessage<Method> | undefined): boolean;
}
/**
* Declares an API Interface to be included in this interface. The including
* interface must redeclare all the methods from the included interface, but
* documentation and options are inherited as follows:
*
* - If after comment and whitespace stripping, the documentation
* string of the redeclared method is empty, it will be inherited
* from the original method.
*
* - Each annotation belonging to the service config (http,
* visibility) which is not set in the redeclared method will be
* inherited.
*
* - If an http annotation is inherited, the path pattern will be
* modified as follows. Any version prefix will be replaced by the
* version of the including interface plus the [root][] path if
* specified.
*
* Example of a simple mixin:
*
* package google.acl.v1;
* service AccessControl {
* // Get the underlying ACL object.
* rpc GetAcl(GetAclRequest) returns (Acl) {
* option (google.api.http).get = "/v1/{resource=**}:getAcl";
* }
* }
*
* package google.storage.v2;
* service Storage {
* rpc GetAcl(GetAclRequest) returns (Acl);
*
* // Get a data record.
* rpc GetData(GetDataRequest) returns (Data) {
* option (google.api.http).get = "/v2/{resource=**}";
* }
* }
*
* Example of a mixin configuration:
*
* apis:
* - name: google.storage.v2.Storage
* mixins:
* - name: google.acl.v1.AccessControl
*
* The mixin construct implies that all methods in `AccessControl` are
* also declared with same name and request/response types in
* `Storage`. A documentation generator or annotation processor will
* see the effective `Storage.GetAcl` method after inherting
* documentation and annotations as follows:
*
* service Storage {
* // Get the underlying ACL object.
* rpc GetAcl(GetAclRequest) returns (Acl) {
* option (google.api.http).get = "/v2/{resource=**}:getAcl";
* }
* ...
* }
*
* Note how the version in the path pattern changed from `v1` to `v2`.
*
* If the `root` field in the mixin is specified, it should be a
* relative path under which inherited HTTP paths are placed. Example:
*
* apis:
* - name: google.storage.v2.Storage
* mixins:
* - name: google.acl.v1.AccessControl
* root: acls
*
* This implies the following inherited HTTP annotation:
*
* service Storage {
* // Get the underlying ACL object.
* rpc GetAcl(GetAclRequest) returns (Acl) {
* option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
* }
* ...
* }
*
* @generated from message google.protobuf.Mixin
*/
export declare class Mixin extends Message<Mixin> {
/**
* The fully qualified name of the interface which is included.
*
* @generated from field: string name = 1;
*/
name: string;
/**
* If non-empty specifies a path under which inherited HTTP paths
* are rooted.
*
* @generated from field: string root = 2;
*/
root: string;
constructor(data?: PartialMessage<Mixin>);
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Mixin";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Mixin;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Mixin;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Mixin;
static equals(a: Mixin | PlainMessage<Mixin> | undefined, b: Mixin | PlainMessage<Mixin> | undefined): boolean;
}
+316
View File
@@ -0,0 +1,316 @@
"use strict";
// Copyright 2021-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Mixin = exports.Method = exports.Api = void 0;
const message_js_1 = require("../../message.js");
const type_pb_js_1 = require("./type_pb.js");
const source_context_pb_js_1 = require("./source_context_pb.js");
const proto3_js_1 = require("../../proto3.js");
/**
* Api is a light-weight descriptor for an API Interface.
*
* Interfaces are also described as "protocol buffer services" in some contexts,
* such as by the "service" keyword in a .proto file, but they are different
* from API Services, which represent a concrete implementation of an interface
* as opposed to simply a description of methods and bindings. They are also
* sometimes simply referred to as "APIs" in other contexts, such as the name of
* this message itself. See https://cloud.google.com/apis/design/glossary for
* detailed terminology.
*
* @generated from message google.protobuf.Api
*/
class Api extends message_js_1.Message {
constructor(data) {
super();
/**
* The fully qualified name of this interface, including package name
* followed by the interface's simple name.
*
* @generated from field: string name = 1;
*/
this.name = "";
/**
* The methods of this interface, in unspecified order.
*
* @generated from field: repeated google.protobuf.Method methods = 2;
*/
this.methods = [];
/**
* Any metadata attached to the interface.
*
* @generated from field: repeated google.protobuf.Option options = 3;
*/
this.options = [];
/**
* A version string for this interface. If specified, must have the form
* `major-version.minor-version`, as in `1.10`. If the minor version is
* omitted, it defaults to zero. If the entire version field is empty, the
* major version is derived from the package name, as outlined below. If the
* field is not empty, the version in the package name will be verified to be
* consistent with what is provided here.
*
* The versioning schema uses [semantic
* versioning](http://semver.org) where the major version number
* indicates a breaking change and the minor version an additive,
* non-breaking change. Both version numbers are signals to users
* what to expect from different versions, and should be carefully
* chosen based on the product plan.
*
* The major version is also reflected in the package name of the
* interface, which must end in `v<major-version>`, as in
* `google.feature.v1`. For major versions 0 and 1, the suffix can
* be omitted. Zero major versions must only be used for
* experimental, non-GA interfaces.
*
*
* @generated from field: string version = 4;
*/
this.version = "";
/**
* Included interfaces. See [Mixin][].
*
* @generated from field: repeated google.protobuf.Mixin mixins = 6;
*/
this.mixins = [];
/**
* The source syntax of the service.
*
* @generated from field: google.protobuf.Syntax syntax = 7;
*/
this.syntax = type_pb_js_1.Syntax.PROTO2;
proto3_js_1.proto3.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new Api().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Api().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Api().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Api, a, b);
}
}
exports.Api = Api;
Api.runtime = proto3_js_1.proto3;
Api.typeName = "google.protobuf.Api";
Api.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "methods", kind: "message", T: Method, repeated: true },
{ no: 3, name: "options", kind: "message", T: type_pb_js_1.Option, repeated: true },
{ no: 4, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 5, name: "source_context", kind: "message", T: source_context_pb_js_1.SourceContext },
{ no: 6, name: "mixins", kind: "message", T: Mixin, repeated: true },
{ no: 7, name: "syntax", kind: "enum", T: proto3_js_1.proto3.getEnumType(type_pb_js_1.Syntax) },
]);
/**
* Method represents a method of an API interface.
*
* @generated from message google.protobuf.Method
*/
class Method extends message_js_1.Message {
constructor(data) {
super();
/**
* The simple name of this method.
*
* @generated from field: string name = 1;
*/
this.name = "";
/**
* A URL of the input message type.
*
* @generated from field: string request_type_url = 2;
*/
this.requestTypeUrl = "";
/**
* If true, the request is streamed.
*
* @generated from field: bool request_streaming = 3;
*/
this.requestStreaming = false;
/**
* The URL of the output message type.
*
* @generated from field: string response_type_url = 4;
*/
this.responseTypeUrl = "";
/**
* If true, the response is streamed.
*
* @generated from field: bool response_streaming = 5;
*/
this.responseStreaming = false;
/**
* Any metadata attached to the method.
*
* @generated from field: repeated google.protobuf.Option options = 6;
*/
this.options = [];
/**
* The source syntax of this method.
*
* @generated from field: google.protobuf.Syntax syntax = 7;
*/
this.syntax = type_pb_js_1.Syntax.PROTO2;
proto3_js_1.proto3.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new Method().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Method().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Method().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Method, a, b);
}
}
exports.Method = Method;
Method.runtime = proto3_js_1.proto3;
Method.typeName = "google.protobuf.Method";
Method.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "request_type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "request_streaming", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 4, name: "response_type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 5, name: "response_streaming", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 6, name: "options", kind: "message", T: type_pb_js_1.Option, repeated: true },
{ no: 7, name: "syntax", kind: "enum", T: proto3_js_1.proto3.getEnumType(type_pb_js_1.Syntax) },
]);
/**
* Declares an API Interface to be included in this interface. The including
* interface must redeclare all the methods from the included interface, but
* documentation and options are inherited as follows:
*
* - If after comment and whitespace stripping, the documentation
* string of the redeclared method is empty, it will be inherited
* from the original method.
*
* - Each annotation belonging to the service config (http,
* visibility) which is not set in the redeclared method will be
* inherited.
*
* - If an http annotation is inherited, the path pattern will be
* modified as follows. Any version prefix will be replaced by the
* version of the including interface plus the [root][] path if
* specified.
*
* Example of a simple mixin:
*
* package google.acl.v1;
* service AccessControl {
* // Get the underlying ACL object.
* rpc GetAcl(GetAclRequest) returns (Acl) {
* option (google.api.http).get = "/v1/{resource=**}:getAcl";
* }
* }
*
* package google.storage.v2;
* service Storage {
* rpc GetAcl(GetAclRequest) returns (Acl);
*
* // Get a data record.
* rpc GetData(GetDataRequest) returns (Data) {
* option (google.api.http).get = "/v2/{resource=**}";
* }
* }
*
* Example of a mixin configuration:
*
* apis:
* - name: google.storage.v2.Storage
* mixins:
* - name: google.acl.v1.AccessControl
*
* The mixin construct implies that all methods in `AccessControl` are
* also declared with same name and request/response types in
* `Storage`. A documentation generator or annotation processor will
* see the effective `Storage.GetAcl` method after inherting
* documentation and annotations as follows:
*
* service Storage {
* // Get the underlying ACL object.
* rpc GetAcl(GetAclRequest) returns (Acl) {
* option (google.api.http).get = "/v2/{resource=**}:getAcl";
* }
* ...
* }
*
* Note how the version in the path pattern changed from `v1` to `v2`.
*
* If the `root` field in the mixin is specified, it should be a
* relative path under which inherited HTTP paths are placed. Example:
*
* apis:
* - name: google.storage.v2.Storage
* mixins:
* - name: google.acl.v1.AccessControl
* root: acls
*
* This implies the following inherited HTTP annotation:
*
* service Storage {
* // Get the underlying ACL object.
* rpc GetAcl(GetAclRequest) returns (Acl) {
* option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
* }
* ...
* }
*
* @generated from message google.protobuf.Mixin
*/
class Mixin extends message_js_1.Message {
constructor(data) {
super();
/**
* The fully qualified name of the interface which is included.
*
* @generated from field: string name = 1;
*/
this.name = "";
/**
* If non-empty specifies a path under which inherited HTTP paths
* are rooted.
*
* @generated from field: string root = 2;
*/
this.root = "";
proto3_js_1.proto3.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new Mixin().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Mixin().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Mixin().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Mixin, a, b);
}
}
exports.Mixin = Mixin;
Mixin.runtime = proto3_js_1.proto3;
Mixin.typeName = "google.protobuf.Mixin";
Mixin.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "root", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
@@ -0,0 +1,271 @@
import type { PartialMessage, PlainMessage } from "../../../message.js";
import { Message } from "../../../message.js";
import { proto2 } from "../../../proto2.js";
import type { FieldList } from "../../../field-list.js";
import type { BinaryReadOptions } from "../../../binary-format.js";
import type { JsonReadOptions, JsonValue } from "../../../json-format.js";
import { FileDescriptorProto, GeneratedCodeInfo } from "../descriptor_pb.js";
/**
* The version number of protocol compiler.
*
* @generated from message google.protobuf.compiler.Version
*/
export declare class Version extends Message<Version> {
/**
* @generated from field: optional int32 major = 1;
*/
major?: number;
/**
* @generated from field: optional int32 minor = 2;
*/
minor?: number;
/**
* @generated from field: optional int32 patch = 3;
*/
patch?: number;
/**
* A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
* be empty for mainline stable releases.
*
* @generated from field: optional string suffix = 4;
*/
suffix?: string;
constructor(data?: PartialMessage<Version>);
static readonly runtime: typeof proto2;
static readonly typeName = "google.protobuf.compiler.Version";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Version;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Version;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Version;
static equals(a: Version | PlainMessage<Version> | undefined, b: Version | PlainMessage<Version> | undefined): boolean;
}
/**
* An encoded CodeGeneratorRequest is written to the plugin's stdin.
*
* @generated from message google.protobuf.compiler.CodeGeneratorRequest
*/
export declare class CodeGeneratorRequest extends Message<CodeGeneratorRequest> {
/**
* The .proto files that were explicitly listed on the command-line. The
* code generator should generate code only for these files. Each file's
* descriptor will be included in proto_file, below.
*
* @generated from field: repeated string file_to_generate = 1;
*/
fileToGenerate: string[];
/**
* The generator parameter passed on the command-line.
*
* @generated from field: optional string parameter = 2;
*/
parameter?: string;
/**
* FileDescriptorProtos for all files in files_to_generate and everything
* they import. The files will appear in topological order, so each file
* appears before any file that imports it.
*
* Note: the files listed in files_to_generate will include runtime-retention
* options only, but all other files will include source-retention options.
* The source_file_descriptors field below is available in case you need
* source-retention options for files_to_generate.
*
* protoc guarantees that all proto_files will be written after
* the fields above, even though this is not technically guaranteed by the
* protobuf wire format. This theoretically could allow a plugin to stream
* in the FileDescriptorProtos and handle them one by one rather than read
* the entire set into memory at once. However, as of this writing, this
* is not similarly optimized on protoc's end -- it will store all fields in
* memory at once before sending them to the plugin.
*
* Type names of fields and extensions in the FileDescriptorProto are always
* fully qualified.
*
* @generated from field: repeated google.protobuf.FileDescriptorProto proto_file = 15;
*/
protoFile: FileDescriptorProto[];
/**
* File descriptors with all options, including source-retention options.
* These descriptors are only provided for the files listed in
* files_to_generate.
*
* @generated from field: repeated google.protobuf.FileDescriptorProto source_file_descriptors = 17;
*/
sourceFileDescriptors: FileDescriptorProto[];
/**
* The version number of protocol compiler.
*
* @generated from field: optional google.protobuf.compiler.Version compiler_version = 3;
*/
compilerVersion?: Version;
constructor(data?: PartialMessage<CodeGeneratorRequest>);
static readonly runtime: typeof proto2;
static readonly typeName = "google.protobuf.compiler.CodeGeneratorRequest";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CodeGeneratorRequest;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CodeGeneratorRequest;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CodeGeneratorRequest;
static equals(a: CodeGeneratorRequest | PlainMessage<CodeGeneratorRequest> | undefined, b: CodeGeneratorRequest | PlainMessage<CodeGeneratorRequest> | undefined): boolean;
}
/**
* The plugin writes an encoded CodeGeneratorResponse to stdout.
*
* @generated from message google.protobuf.compiler.CodeGeneratorResponse
*/
export declare class CodeGeneratorResponse extends Message<CodeGeneratorResponse> {
/**
* Error message. If non-empty, code generation failed. The plugin process
* should exit with status code zero even if it reports an error in this way.
*
* This should be used to indicate errors in .proto files which prevent the
* code generator from generating correct code. Errors which indicate a
* problem in protoc itself -- such as the input CodeGeneratorRequest being
* unparseable -- should be reported by writing a message to stderr and
* exiting with a non-zero status code.
*
* @generated from field: optional string error = 1;
*/
error?: string;
/**
* A bitmask of supported features that the code generator supports.
* This is a bitwise "or" of values from the Feature enum.
*
* @generated from field: optional uint64 supported_features = 2;
*/
supportedFeatures?: bigint;
/**
* The minimum edition this plugin supports. This will be treated as an
* Edition enum, but we want to allow unknown values. It should be specified
* according the edition enum value, *not* the edition number. Only takes
* effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
*
* @generated from field: optional int32 minimum_edition = 3;
*/
minimumEdition?: number;
/**
* The maximum edition this plugin supports. This will be treated as an
* Edition enum, but we want to allow unknown values. It should be specified
* according the edition enum value, *not* the edition number. Only takes
* effect for plugins that have FEATURE_SUPPORTS_EDITIONS set.
*
* @generated from field: optional int32 maximum_edition = 4;
*/
maximumEdition?: number;
/**
* @generated from field: repeated google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
*/
file: CodeGeneratorResponse_File[];
constructor(data?: PartialMessage<CodeGeneratorResponse>);
static readonly runtime: typeof proto2;
static readonly typeName = "google.protobuf.compiler.CodeGeneratorResponse";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CodeGeneratorResponse;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CodeGeneratorResponse;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CodeGeneratorResponse;
static equals(a: CodeGeneratorResponse | PlainMessage<CodeGeneratorResponse> | undefined, b: CodeGeneratorResponse | PlainMessage<CodeGeneratorResponse> | undefined): boolean;
}
/**
* Sync with code_generator.h.
*
* @generated from enum google.protobuf.compiler.CodeGeneratorResponse.Feature
*/
export declare enum CodeGeneratorResponse_Feature {
/**
* @generated from enum value: FEATURE_NONE = 0;
*/
NONE = 0,
/**
* @generated from enum value: FEATURE_PROTO3_OPTIONAL = 1;
*/
PROTO3_OPTIONAL = 1,
/**
* @generated from enum value: FEATURE_SUPPORTS_EDITIONS = 2;
*/
SUPPORTS_EDITIONS = 2
}
/**
* Represents a single generated file.
*
* @generated from message google.protobuf.compiler.CodeGeneratorResponse.File
*/
export declare class CodeGeneratorResponse_File extends Message<CodeGeneratorResponse_File> {
/**
* The file name, relative to the output directory. The name must not
* contain "." or ".." components and must be relative, not be absolute (so,
* the file cannot lie outside the output directory). "/" must be used as
* the path separator, not "\".
*
* If the name is omitted, the content will be appended to the previous
* file. This allows the generator to break large files into small chunks,
* and allows the generated text to be streamed back to protoc so that large
* files need not reside completely in memory at one time. Note that as of
* this writing protoc does not optimize for this -- it will read the entire
* CodeGeneratorResponse before writing files to disk.
*
* @generated from field: optional string name = 1;
*/
name?: string;
/**
* If non-empty, indicates that the named file should already exist, and the
* content here is to be inserted into that file at a defined insertion
* point. This feature allows a code generator to extend the output
* produced by another code generator. The original generator may provide
* insertion points by placing special annotations in the file that look
* like:
* @@protoc_insertion_point(NAME)
* The annotation can have arbitrary text before and after it on the line,
* which allows it to be placed in a comment. NAME should be replaced with
* an identifier naming the point -- this is what other generators will use
* as the insertion_point. Code inserted at this point will be placed
* immediately above the line containing the insertion point (thus multiple
* insertions to the same point will come out in the order they were added).
* The double-@ is intended to make it unlikely that the generated code
* could contain things that look like insertion points by accident.
*
* For example, the C++ code generator places the following line in the
* .pb.h files that it generates:
* // @@protoc_insertion_point(namespace_scope)
* This line appears within the scope of the file's package namespace, but
* outside of any particular class. Another plugin can then specify the
* insertion_point "namespace_scope" to generate additional classes or
* other declarations that should be placed in this scope.
*
* Note that if the line containing the insertion point begins with
* whitespace, the same whitespace will be added to every line of the
* inserted text. This is useful for languages like Python, where
* indentation matters. In these languages, the insertion point comment
* should be indented the same amount as any inserted code will need to be
* in order to work correctly in that context.
*
* The code generator that generates the initial file and the one which
* inserts into it must both run as part of a single invocation of protoc.
* Code generators are executed in the order in which they appear on the
* command line.
*
* If |insertion_point| is present, |name| must also be present.
*
* @generated from field: optional string insertion_point = 2;
*/
insertionPoint?: string;
/**
* The file contents.
*
* @generated from field: optional string content = 15;
*/
content?: string;
/**
* Information describing the file content being inserted. If an insertion
* point is used, this information will be appropriately offset and inserted
* into the code generation metadata for the generated files.
*
* @generated from field: optional google.protobuf.GeneratedCodeInfo generated_code_info = 16;
*/
generatedCodeInfo?: GeneratedCodeInfo;
constructor(data?: PartialMessage<CodeGeneratorResponse_File>);
static readonly runtime: typeof proto2;
static readonly typeName = "google.protobuf.compiler.CodeGeneratorResponse.File";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): CodeGeneratorResponse_File;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): CodeGeneratorResponse_File;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): CodeGeneratorResponse_File;
static equals(a: CodeGeneratorResponse_File | PlainMessage<CodeGeneratorResponse_File> | undefined, b: CodeGeneratorResponse_File | PlainMessage<CodeGeneratorResponse_File> | undefined): boolean;
}
@@ -0,0 +1,219 @@
"use strict";
// Copyright 2021-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.CodeGeneratorResponse_File = exports.CodeGeneratorResponse_Feature = exports.CodeGeneratorResponse = exports.CodeGeneratorRequest = exports.Version = void 0;
const message_js_1 = require("../../../message.js");
const proto2_js_1 = require("../../../proto2.js");
const descriptor_pb_js_1 = require("../descriptor_pb.js");
/**
* The version number of protocol compiler.
*
* @generated from message google.protobuf.compiler.Version
*/
class Version extends message_js_1.Message {
constructor(data) {
super();
proto2_js_1.proto2.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new Version().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Version().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Version().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto2_js_1.proto2.util.equals(Version, a, b);
}
}
exports.Version = Version;
Version.runtime = proto2_js_1.proto2;
Version.typeName = "google.protobuf.compiler.Version";
Version.fields = proto2_js_1.proto2.util.newFieldList(() => [
{ no: 1, name: "major", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
{ no: 2, name: "minor", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
{ no: 3, name: "patch", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
{ no: 4, name: "suffix", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
]);
/**
* An encoded CodeGeneratorRequest is written to the plugin's stdin.
*
* @generated from message google.protobuf.compiler.CodeGeneratorRequest
*/
class CodeGeneratorRequest extends message_js_1.Message {
constructor(data) {
super();
/**
* The .proto files that were explicitly listed on the command-line. The
* code generator should generate code only for these files. Each file's
* descriptor will be included in proto_file, below.
*
* @generated from field: repeated string file_to_generate = 1;
*/
this.fileToGenerate = [];
/**
* FileDescriptorProtos for all files in files_to_generate and everything
* they import. The files will appear in topological order, so each file
* appears before any file that imports it.
*
* Note: the files listed in files_to_generate will include runtime-retention
* options only, but all other files will include source-retention options.
* The source_file_descriptors field below is available in case you need
* source-retention options for files_to_generate.
*
* protoc guarantees that all proto_files will be written after
* the fields above, even though this is not technically guaranteed by the
* protobuf wire format. This theoretically could allow a plugin to stream
* in the FileDescriptorProtos and handle them one by one rather than read
* the entire set into memory at once. However, as of this writing, this
* is not similarly optimized on protoc's end -- it will store all fields in
* memory at once before sending them to the plugin.
*
* Type names of fields and extensions in the FileDescriptorProto are always
* fully qualified.
*
* @generated from field: repeated google.protobuf.FileDescriptorProto proto_file = 15;
*/
this.protoFile = [];
/**
* File descriptors with all options, including source-retention options.
* These descriptors are only provided for the files listed in
* files_to_generate.
*
* @generated from field: repeated google.protobuf.FileDescriptorProto source_file_descriptors = 17;
*/
this.sourceFileDescriptors = [];
proto2_js_1.proto2.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new CodeGeneratorRequest().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new CodeGeneratorRequest().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new CodeGeneratorRequest().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto2_js_1.proto2.util.equals(CodeGeneratorRequest, a, b);
}
}
exports.CodeGeneratorRequest = CodeGeneratorRequest;
CodeGeneratorRequest.runtime = proto2_js_1.proto2;
CodeGeneratorRequest.typeName = "google.protobuf.compiler.CodeGeneratorRequest";
CodeGeneratorRequest.fields = proto2_js_1.proto2.util.newFieldList(() => [
{ no: 1, name: "file_to_generate", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
{ no: 2, name: "parameter", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
{ no: 15, name: "proto_file", kind: "message", T: descriptor_pb_js_1.FileDescriptorProto, repeated: true },
{ no: 17, name: "source_file_descriptors", kind: "message", T: descriptor_pb_js_1.FileDescriptorProto, repeated: true },
{ no: 3, name: "compiler_version", kind: "message", T: Version, opt: true },
]);
/**
* The plugin writes an encoded CodeGeneratorResponse to stdout.
*
* @generated from message google.protobuf.compiler.CodeGeneratorResponse
*/
class CodeGeneratorResponse extends message_js_1.Message {
constructor(data) {
super();
/**
* @generated from field: repeated google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
*/
this.file = [];
proto2_js_1.proto2.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new CodeGeneratorResponse().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new CodeGeneratorResponse().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new CodeGeneratorResponse().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto2_js_1.proto2.util.equals(CodeGeneratorResponse, a, b);
}
}
exports.CodeGeneratorResponse = CodeGeneratorResponse;
CodeGeneratorResponse.runtime = proto2_js_1.proto2;
CodeGeneratorResponse.typeName = "google.protobuf.compiler.CodeGeneratorResponse";
CodeGeneratorResponse.fields = proto2_js_1.proto2.util.newFieldList(() => [
{ no: 1, name: "error", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
{ no: 2, name: "supported_features", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true },
{ no: 3, name: "minimum_edition", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
{ no: 4, name: "maximum_edition", kind: "scalar", T: 5 /* ScalarType.INT32 */, opt: true },
{ no: 15, name: "file", kind: "message", T: CodeGeneratorResponse_File, repeated: true },
]);
/**
* Sync with code_generator.h.
*
* @generated from enum google.protobuf.compiler.CodeGeneratorResponse.Feature
*/
var CodeGeneratorResponse_Feature;
(function (CodeGeneratorResponse_Feature) {
/**
* @generated from enum value: FEATURE_NONE = 0;
*/
CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["NONE"] = 0] = "NONE";
/**
* @generated from enum value: FEATURE_PROTO3_OPTIONAL = 1;
*/
CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["PROTO3_OPTIONAL"] = 1] = "PROTO3_OPTIONAL";
/**
* @generated from enum value: FEATURE_SUPPORTS_EDITIONS = 2;
*/
CodeGeneratorResponse_Feature[CodeGeneratorResponse_Feature["SUPPORTS_EDITIONS"] = 2] = "SUPPORTS_EDITIONS";
})(CodeGeneratorResponse_Feature || (exports.CodeGeneratorResponse_Feature = CodeGeneratorResponse_Feature = {}));
// Retrieve enum metadata with: proto2.getEnumType(CodeGeneratorResponse_Feature)
proto2_js_1.proto2.util.setEnumType(CodeGeneratorResponse_Feature, "google.protobuf.compiler.CodeGeneratorResponse.Feature", [
{ no: 0, name: "FEATURE_NONE" },
{ no: 1, name: "FEATURE_PROTO3_OPTIONAL" },
{ no: 2, name: "FEATURE_SUPPORTS_EDITIONS" },
]);
/**
* Represents a single generated file.
*
* @generated from message google.protobuf.compiler.CodeGeneratorResponse.File
*/
class CodeGeneratorResponse_File extends message_js_1.Message {
constructor(data) {
super();
proto2_js_1.proto2.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new CodeGeneratorResponse_File().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new CodeGeneratorResponse_File().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new CodeGeneratorResponse_File().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto2_js_1.proto2.util.equals(CodeGeneratorResponse_File, a, b);
}
}
exports.CodeGeneratorResponse_File = CodeGeneratorResponse_File;
CodeGeneratorResponse_File.runtime = proto2_js_1.proto2;
CodeGeneratorResponse_File.typeName = "google.protobuf.compiler.CodeGeneratorResponse.File";
CodeGeneratorResponse_File.fields = proto2_js_1.proto2.util.newFieldList(() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
{ no: 2, name: "insertion_point", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
{ no: 15, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
{ no: 16, name: "generated_code_info", kind: "message", T: descriptor_pb_js_1.GeneratedCodeInfo, opt: true },
]);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,100 @@
import type { PartialMessage, PlainMessage } from "../../message.js";
import { Message } from "../../message.js";
import { proto3 } from "../../proto3.js";
import type { JsonReadOptions, JsonValue, JsonWriteOptions } from "../../json-format.js";
import type { FieldList } from "../../field-list.js";
import type { BinaryReadOptions } from "../../binary-format.js";
/**
* A Duration represents a signed, fixed-length span of time represented
* as a count of seconds and fractions of seconds at nanosecond
* resolution. It is independent of any calendar and concepts like "day"
* or "month". It is related to Timestamp in that the difference between
* two Timestamp values is a Duration and it can be added or subtracted
* from a Timestamp. Range is approximately +-10,000 years.
*
* # Examples
*
* Example 1: Compute Duration from two Timestamps in pseudo code.
*
* Timestamp start = ...;
* Timestamp end = ...;
* Duration duration = ...;
*
* duration.seconds = end.seconds - start.seconds;
* duration.nanos = end.nanos - start.nanos;
*
* if (duration.seconds < 0 && duration.nanos > 0) {
* duration.seconds += 1;
* duration.nanos -= 1000000000;
* } else if (duration.seconds > 0 && duration.nanos < 0) {
* duration.seconds -= 1;
* duration.nanos += 1000000000;
* }
*
* Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
*
* Timestamp start = ...;
* Duration duration = ...;
* Timestamp end = ...;
*
* end.seconds = start.seconds + duration.seconds;
* end.nanos = start.nanos + duration.nanos;
*
* if (end.nanos < 0) {
* end.seconds -= 1;
* end.nanos += 1000000000;
* } else if (end.nanos >= 1000000000) {
* end.seconds += 1;
* end.nanos -= 1000000000;
* }
*
* Example 3: Compute Duration from datetime.timedelta in Python.
*
* td = datetime.timedelta(days=3, minutes=10)
* duration = Duration()
* duration.FromTimedelta(td)
*
* # JSON Mapping
*
* In JSON format, the Duration type is encoded as a string rather than an
* object, where the string ends in the suffix "s" (indicating seconds) and
* is preceded by the number of seconds, with nanoseconds expressed as
* fractional seconds. For example, 3 seconds with 0 nanoseconds should be
* encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
* be expressed in JSON format as "3.000000001s", and 3 seconds and 1
* microsecond should be expressed in JSON format as "3.000001s".
*
*
* @generated from message google.protobuf.Duration
*/
export declare class Duration extends Message<Duration> {
/**
* Signed seconds of the span of time. Must be from -315,576,000,000
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
*
* @generated from field: int64 seconds = 1;
*/
seconds: bigint;
/**
* Signed fractions of a second at nanosecond resolution of the span
* of time. Durations less than one second are represented with a 0
* `seconds` field and a positive or negative `nanos` field. For durations
* of one second or more, a non-zero value for the `nanos` field must be
* of the same sign as the `seconds` field. Must be from -999,999,999
* to +999,999,999 inclusive.
*
* @generated from field: int32 nanos = 2;
*/
nanos: number;
constructor(data?: PartialMessage<Duration>);
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Duration";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Duration;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Duration;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Duration;
static equals(a: Duration | PlainMessage<Duration> | undefined, b: Duration | PlainMessage<Duration> | undefined): boolean;
}
+169
View File
@@ -0,0 +1,169 @@
"use strict";
// Copyright 2021-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Duration = void 0;
const message_js_1 = require("../../message.js");
const proto_int64_js_1 = require("../../proto-int64.js");
const proto3_js_1 = require("../../proto3.js");
/**
* A Duration represents a signed, fixed-length span of time represented
* as a count of seconds and fractions of seconds at nanosecond
* resolution. It is independent of any calendar and concepts like "day"
* or "month". It is related to Timestamp in that the difference between
* two Timestamp values is a Duration and it can be added or subtracted
* from a Timestamp. Range is approximately +-10,000 years.
*
* # Examples
*
* Example 1: Compute Duration from two Timestamps in pseudo code.
*
* Timestamp start = ...;
* Timestamp end = ...;
* Duration duration = ...;
*
* duration.seconds = end.seconds - start.seconds;
* duration.nanos = end.nanos - start.nanos;
*
* if (duration.seconds < 0 && duration.nanos > 0) {
* duration.seconds += 1;
* duration.nanos -= 1000000000;
* } else if (duration.seconds > 0 && duration.nanos < 0) {
* duration.seconds -= 1;
* duration.nanos += 1000000000;
* }
*
* Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
*
* Timestamp start = ...;
* Duration duration = ...;
* Timestamp end = ...;
*
* end.seconds = start.seconds + duration.seconds;
* end.nanos = start.nanos + duration.nanos;
*
* if (end.nanos < 0) {
* end.seconds -= 1;
* end.nanos += 1000000000;
* } else if (end.nanos >= 1000000000) {
* end.seconds += 1;
* end.nanos -= 1000000000;
* }
*
* Example 3: Compute Duration from datetime.timedelta in Python.
*
* td = datetime.timedelta(days=3, minutes=10)
* duration = Duration()
* duration.FromTimedelta(td)
*
* # JSON Mapping
*
* In JSON format, the Duration type is encoded as a string rather than an
* object, where the string ends in the suffix "s" (indicating seconds) and
* is preceded by the number of seconds, with nanoseconds expressed as
* fractional seconds. For example, 3 seconds with 0 nanoseconds should be
* encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
* be expressed in JSON format as "3.000000001s", and 3 seconds and 1
* microsecond should be expressed in JSON format as "3.000001s".
*
*
* @generated from message google.protobuf.Duration
*/
class Duration extends message_js_1.Message {
constructor(data) {
super();
/**
* Signed seconds of the span of time. Must be from -315,576,000,000
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
*
* @generated from field: int64 seconds = 1;
*/
this.seconds = proto_int64_js_1.protoInt64.zero;
/**
* Signed fractions of a second at nanosecond resolution of the span
* of time. Durations less than one second are represented with a 0
* `seconds` field and a positive or negative `nanos` field. For durations
* of one second or more, a non-zero value for the `nanos` field must be
* of the same sign as the `seconds` field. Must be from -999,999,999
* to +999,999,999 inclusive.
*
* @generated from field: int32 nanos = 2;
*/
this.nanos = 0;
proto3_js_1.proto3.util.initPartial(data, this);
}
fromJson(json, options) {
if (typeof json !== "string") {
throw new Error(`cannot decode google.protobuf.Duration from JSON: ${proto3_js_1.proto3.json.debug(json)}`);
}
const match = json.match(/^(-?[0-9]+)(?:\.([0-9]+))?s/);
if (match === null) {
throw new Error(`cannot decode google.protobuf.Duration from JSON: ${proto3_js_1.proto3.json.debug(json)}`);
}
const longSeconds = Number(match[1]);
if (longSeconds > 315576000000 || longSeconds < -315576000000) {
throw new Error(`cannot decode google.protobuf.Duration from JSON: ${proto3_js_1.proto3.json.debug(json)}`);
}
this.seconds = proto_int64_js_1.protoInt64.parse(longSeconds);
if (typeof match[2] == "string") {
const nanosStr = match[2] + "0".repeat(9 - match[2].length);
this.nanos = parseInt(nanosStr);
if (longSeconds < 0 || Object.is(longSeconds, -0)) {
this.nanos = -this.nanos;
}
}
return this;
}
toJson(options) {
if (Number(this.seconds) > 315576000000 || Number(this.seconds) < -315576000000) {
throw new Error(`cannot encode google.protobuf.Duration to JSON: value out of range`);
}
let text = this.seconds.toString();
if (this.nanos !== 0) {
let nanosStr = Math.abs(this.nanos).toString();
nanosStr = "0".repeat(9 - nanosStr.length) + nanosStr;
if (nanosStr.substring(3) === "000000") {
nanosStr = nanosStr.substring(0, 3);
}
else if (nanosStr.substring(6) === "000") {
nanosStr = nanosStr.substring(0, 6);
}
text += "." + nanosStr;
if (this.nanos < 0 && Number(this.seconds) == 0) {
text = "-" + text;
}
}
return text + "s";
}
static fromBinary(bytes, options) {
return new Duration().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Duration().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Duration().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Duration, a, b);
}
}
exports.Duration = Duration;
Duration.runtime = proto3_js_1.proto3;
Duration.typeName = "google.protobuf.Duration";
Duration.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "seconds", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 2, name: "nanos", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
]);
+28
View File
@@ -0,0 +1,28 @@
import type { PartialMessage, PlainMessage } from "../../message.js";
import { Message } from "../../message.js";
import { proto3 } from "../../proto3.js";
import type { FieldList } from "../../field-list.js";
import type { BinaryReadOptions } from "../../binary-format.js";
import type { JsonReadOptions, JsonValue } from "../../json-format.js";
/**
* A generic empty message that you can re-use to avoid defining duplicated
* empty messages in your APIs. A typical example is to use it as the request
* or the response type of an API method. For instance:
*
* service Foo {
* rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
* }
*
*
* @generated from message google.protobuf.Empty
*/
export declare class Empty extends Message<Empty> {
constructor(data?: PartialMessage<Empty>);
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Empty";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Empty;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Empty;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Empty;
static equals(a: Empty | PlainMessage<Empty> | undefined, b: Empty | PlainMessage<Empty> | undefined): boolean;
}
+52
View File
@@ -0,0 +1,52 @@
"use strict";
// Copyright 2021-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Empty = void 0;
const message_js_1 = require("../../message.js");
const proto3_js_1 = require("../../proto3.js");
/**
* A generic empty message that you can re-use to avoid defining duplicated
* empty messages in your APIs. A typical example is to use it as the request
* or the response type of an API method. For instance:
*
* service Foo {
* rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
* }
*
*
* @generated from message google.protobuf.Empty
*/
class Empty extends message_js_1.Message {
constructor(data) {
super();
proto3_js_1.proto3.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new Empty().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Empty().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Empty().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Empty, a, b);
}
}
exports.Empty = Empty;
Empty.runtime = proto3_js_1.proto3;
Empty.typeName = "google.protobuf.Empty";
Empty.fields = proto3_js_1.proto3.util.newFieldList(() => []);
@@ -0,0 +1,227 @@
import type { PartialMessage, PlainMessage } from "../../message.js";
import { Message } from "../../message.js";
import { proto3 } from "../../proto3.js";
import type { JsonReadOptions, JsonValue, JsonWriteOptions } from "../../json-format.js";
import type { FieldList } from "../../field-list.js";
import type { BinaryReadOptions } from "../../binary-format.js";
/**
* `FieldMask` represents a set of symbolic field paths, for example:
*
* paths: "f.a"
* paths: "f.b.d"
*
* Here `f` represents a field in some root message, `a` and `b`
* fields in the message found in `f`, and `d` a field found in the
* message in `f.b`.
*
* Field masks are used to specify a subset of fields that should be
* returned by a get operation or modified by an update operation.
* Field masks also have a custom JSON encoding (see below).
*
* # Field Masks in Projections
*
* When used in the context of a projection, a response message or
* sub-message is filtered by the API to only contain those fields as
* specified in the mask. For example, if the mask in the previous
* example is applied to a response message as follows:
*
* f {
* a : 22
* b {
* d : 1
* x : 2
* }
* y : 13
* }
* z: 8
*
* The result will not contain specific values for fields x,y and z
* (their value will be set to the default, and omitted in proto text
* output):
*
*
* f {
* a : 22
* b {
* d : 1
* }
* }
*
* A repeated field is not allowed except at the last position of a
* paths string.
*
* If a FieldMask object is not present in a get operation, the
* operation applies to all fields (as if a FieldMask of all fields
* had been specified).
*
* Note that a field mask does not necessarily apply to the
* top-level response message. In case of a REST get operation, the
* field mask applies directly to the response, but in case of a REST
* list operation, the mask instead applies to each individual message
* in the returned resource list. In case of a REST custom method,
* other definitions may be used. Where the mask applies will be
* clearly documented together with its declaration in the API. In
* any case, the effect on the returned resource/resources is required
* behavior for APIs.
*
* # Field Masks in Update Operations
*
* A field mask in update operations specifies which fields of the
* targeted resource are going to be updated. The API is required
* to only change the values of the fields as specified in the mask
* and leave the others untouched. If a resource is passed in to
* describe the updated values, the API ignores the values of all
* fields not covered by the mask.
*
* If a repeated field is specified for an update operation, new values will
* be appended to the existing repeated field in the target resource. Note that
* a repeated field is only allowed in the last position of a `paths` string.
*
* If a sub-message is specified in the last position of the field mask for an
* update operation, then new value will be merged into the existing sub-message
* in the target resource.
*
* For example, given the target message:
*
* f {
* b {
* d: 1
* x: 2
* }
* c: [1]
* }
*
* And an update message:
*
* f {
* b {
* d: 10
* }
* c: [2]
* }
*
* then if the field mask is:
*
* paths: ["f.b", "f.c"]
*
* then the result will be:
*
* f {
* b {
* d: 10
* x: 2
* }
* c: [1, 2]
* }
*
* An implementation may provide options to override this default behavior for
* repeated and message fields.
*
* In order to reset a field's value to the default, the field must
* be in the mask and set to the default value in the provided resource.
* Hence, in order to reset all fields of a resource, provide a default
* instance of the resource and set all fields in the mask, or do
* not provide a mask as described below.
*
* If a field mask is not present on update, the operation applies to
* all fields (as if a field mask of all fields has been specified).
* Note that in the presence of schema evolution, this may mean that
* fields the client does not know and has therefore not filled into
* the request will be reset to their default. If this is unwanted
* behavior, a specific service may require a client to always specify
* a field mask, producing an error if not.
*
* As with get operations, the location of the resource which
* describes the updated values in the request message depends on the
* operation kind. In any case, the effect of the field mask is
* required to be honored by the API.
*
* ## Considerations for HTTP REST
*
* The HTTP kind of an update operation which uses a field mask must
* be set to PATCH instead of PUT in order to satisfy HTTP semantics
* (PUT must only be used for full updates).
*
* # JSON Encoding of Field Masks
*
* In JSON, a field mask is encoded as a single string where paths are
* separated by a comma. Fields name in each path are converted
* to/from lower-camel naming conventions.
*
* As an example, consider the following message declarations:
*
* message Profile {
* User user = 1;
* Photo photo = 2;
* }
* message User {
* string display_name = 1;
* string address = 2;
* }
*
* In proto a field mask for `Profile` may look as such:
*
* mask {
* paths: "user.display_name"
* paths: "photo"
* }
*
* In JSON, the same mask is represented as below:
*
* {
* mask: "user.displayName,photo"
* }
*
* # Field Masks and Oneof Fields
*
* Field masks treat fields in oneofs just as regular fields. Consider the
* following message:
*
* message SampleMessage {
* oneof test_oneof {
* string name = 4;
* SubMessage sub_message = 9;
* }
* }
*
* The field mask can be:
*
* mask {
* paths: "name"
* }
*
* Or:
*
* mask {
* paths: "sub_message"
* }
*
* Note that oneof type names ("test_oneof" in this case) cannot be used in
* paths.
*
* ## Field Mask Verification
*
* The implementation of any API method which has a FieldMask type field in the
* request should verify the included field paths, and return an
* `INVALID_ARGUMENT` error if any path is unmappable.
*
* @generated from message google.protobuf.FieldMask
*/
export declare class FieldMask extends Message<FieldMask> {
/**
* The set of field mask paths.
*
* @generated from field: repeated string paths = 1;
*/
paths: string[];
constructor(data?: PartialMessage<FieldMask>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.FieldMask";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FieldMask;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): FieldMask;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): FieldMask;
static equals(a: FieldMask | PlainMessage<FieldMask> | undefined, b: FieldMask | PlainMessage<FieldMask> | undefined): boolean;
}
@@ -0,0 +1,311 @@
"use strict";
// Copyright 2021-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldMask = void 0;
const message_js_1 = require("../../message.js");
const proto3_js_1 = require("../../proto3.js");
/**
* `FieldMask` represents a set of symbolic field paths, for example:
*
* paths: "f.a"
* paths: "f.b.d"
*
* Here `f` represents a field in some root message, `a` and `b`
* fields in the message found in `f`, and `d` a field found in the
* message in `f.b`.
*
* Field masks are used to specify a subset of fields that should be
* returned by a get operation or modified by an update operation.
* Field masks also have a custom JSON encoding (see below).
*
* # Field Masks in Projections
*
* When used in the context of a projection, a response message or
* sub-message is filtered by the API to only contain those fields as
* specified in the mask. For example, if the mask in the previous
* example is applied to a response message as follows:
*
* f {
* a : 22
* b {
* d : 1
* x : 2
* }
* y : 13
* }
* z: 8
*
* The result will not contain specific values for fields x,y and z
* (their value will be set to the default, and omitted in proto text
* output):
*
*
* f {
* a : 22
* b {
* d : 1
* }
* }
*
* A repeated field is not allowed except at the last position of a
* paths string.
*
* If a FieldMask object is not present in a get operation, the
* operation applies to all fields (as if a FieldMask of all fields
* had been specified).
*
* Note that a field mask does not necessarily apply to the
* top-level response message. In case of a REST get operation, the
* field mask applies directly to the response, but in case of a REST
* list operation, the mask instead applies to each individual message
* in the returned resource list. In case of a REST custom method,
* other definitions may be used. Where the mask applies will be
* clearly documented together with its declaration in the API. In
* any case, the effect on the returned resource/resources is required
* behavior for APIs.
*
* # Field Masks in Update Operations
*
* A field mask in update operations specifies which fields of the
* targeted resource are going to be updated. The API is required
* to only change the values of the fields as specified in the mask
* and leave the others untouched. If a resource is passed in to
* describe the updated values, the API ignores the values of all
* fields not covered by the mask.
*
* If a repeated field is specified for an update operation, new values will
* be appended to the existing repeated field in the target resource. Note that
* a repeated field is only allowed in the last position of a `paths` string.
*
* If a sub-message is specified in the last position of the field mask for an
* update operation, then new value will be merged into the existing sub-message
* in the target resource.
*
* For example, given the target message:
*
* f {
* b {
* d: 1
* x: 2
* }
* c: [1]
* }
*
* And an update message:
*
* f {
* b {
* d: 10
* }
* c: [2]
* }
*
* then if the field mask is:
*
* paths: ["f.b", "f.c"]
*
* then the result will be:
*
* f {
* b {
* d: 10
* x: 2
* }
* c: [1, 2]
* }
*
* An implementation may provide options to override this default behavior for
* repeated and message fields.
*
* In order to reset a field's value to the default, the field must
* be in the mask and set to the default value in the provided resource.
* Hence, in order to reset all fields of a resource, provide a default
* instance of the resource and set all fields in the mask, or do
* not provide a mask as described below.
*
* If a field mask is not present on update, the operation applies to
* all fields (as if a field mask of all fields has been specified).
* Note that in the presence of schema evolution, this may mean that
* fields the client does not know and has therefore not filled into
* the request will be reset to their default. If this is unwanted
* behavior, a specific service may require a client to always specify
* a field mask, producing an error if not.
*
* As with get operations, the location of the resource which
* describes the updated values in the request message depends on the
* operation kind. In any case, the effect of the field mask is
* required to be honored by the API.
*
* ## Considerations for HTTP REST
*
* The HTTP kind of an update operation which uses a field mask must
* be set to PATCH instead of PUT in order to satisfy HTTP semantics
* (PUT must only be used for full updates).
*
* # JSON Encoding of Field Masks
*
* In JSON, a field mask is encoded as a single string where paths are
* separated by a comma. Fields name in each path are converted
* to/from lower-camel naming conventions.
*
* As an example, consider the following message declarations:
*
* message Profile {
* User user = 1;
* Photo photo = 2;
* }
* message User {
* string display_name = 1;
* string address = 2;
* }
*
* In proto a field mask for `Profile` may look as such:
*
* mask {
* paths: "user.display_name"
* paths: "photo"
* }
*
* In JSON, the same mask is represented as below:
*
* {
* mask: "user.displayName,photo"
* }
*
* # Field Masks and Oneof Fields
*
* Field masks treat fields in oneofs just as regular fields. Consider the
* following message:
*
* message SampleMessage {
* oneof test_oneof {
* string name = 4;
* SubMessage sub_message = 9;
* }
* }
*
* The field mask can be:
*
* mask {
* paths: "name"
* }
*
* Or:
*
* mask {
* paths: "sub_message"
* }
*
* Note that oneof type names ("test_oneof" in this case) cannot be used in
* paths.
*
* ## Field Mask Verification
*
* The implementation of any API method which has a FieldMask type field in the
* request should verify the included field paths, and return an
* `INVALID_ARGUMENT` error if any path is unmappable.
*
* @generated from message google.protobuf.FieldMask
*/
class FieldMask extends message_js_1.Message {
constructor(data) {
super();
/**
* The set of field mask paths.
*
* @generated from field: repeated string paths = 1;
*/
this.paths = [];
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
// Converts snake_case to protoCamelCase according to the convention
// used by protoc to convert a field name to a JSON name.
function protoCamelCase(snakeCase) {
let capNext = false;
const b = [];
for (let i = 0; i < snakeCase.length; i++) {
let c = snakeCase.charAt(i);
switch (c) {
case '_':
capNext = true;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
b.push(c);
capNext = false;
break;
default:
if (capNext) {
capNext = false;
c = c.toUpperCase();
}
b.push(c);
break;
}
}
return b.join('');
}
return this.paths.map(p => {
if (p.match(/_[0-9]?_/g) || p.match(/[A-Z]/g)) {
throw new Error("cannot encode google.protobuf.FieldMask to JSON: lowerCamelCase of path name \"" + p + "\" is irreversible");
}
return protoCamelCase(p);
}).join(",");
}
fromJson(json, options) {
if (typeof json !== "string") {
throw new Error("cannot decode google.protobuf.FieldMask from JSON: " + proto3_js_1.proto3.json.debug(json));
}
if (json === "") {
return this;
}
function camelToSnake(str) {
if (str.includes("_")) {
throw new Error("cannot decode google.protobuf.FieldMask from JSON: path names must be lowerCamelCase");
}
const sc = str.replace(/[A-Z]/g, letter => "_" + letter.toLowerCase());
return (sc[0] === "_") ? sc.substring(1) : sc;
}
this.paths = json.split(",").map(camelToSnake);
return this;
}
static fromBinary(bytes, options) {
return new FieldMask().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new FieldMask().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new FieldMask().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(FieldMask, a, b);
}
}
exports.FieldMask = FieldMask;
FieldMask.runtime = proto3_js_1.proto3;
FieldMask.typeName = "google.protobuf.FieldMask";
FieldMask.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "paths", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
]);
@@ -0,0 +1,29 @@
import type { PartialMessage, PlainMessage } from "../../message.js";
import { Message } from "../../message.js";
import { proto3 } from "../../proto3.js";
import type { FieldList } from "../../field-list.js";
import type { BinaryReadOptions } from "../../binary-format.js";
import type { JsonReadOptions, JsonValue } from "../../json-format.js";
/**
* `SourceContext` represents information about the source of a
* protobuf element, like the file in which it is defined.
*
* @generated from message google.protobuf.SourceContext
*/
export declare class SourceContext extends Message<SourceContext> {
/**
* The path-qualified name of the .proto file that contained the associated
* protobuf element. For example: `"google/protobuf/source_context.proto"`.
*
* @generated from field: string file_name = 1;
*/
fileName: string;
constructor(data?: PartialMessage<SourceContext>);
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.SourceContext";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): SourceContext;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): SourceContext;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): SourceContext;
static equals(a: SourceContext | PlainMessage<SourceContext> | undefined, b: SourceContext | PlainMessage<SourceContext> | undefined): boolean;
}
@@ -0,0 +1,55 @@
"use strict";
// Copyright 2021-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.SourceContext = void 0;
const message_js_1 = require("../../message.js");
const proto3_js_1 = require("../../proto3.js");
/**
* `SourceContext` represents information about the source of a
* protobuf element, like the file in which it is defined.
*
* @generated from message google.protobuf.SourceContext
*/
class SourceContext extends message_js_1.Message {
constructor(data) {
super();
/**
* The path-qualified name of the .proto file that contained the associated
* protobuf element. For example: `"google/protobuf/source_context.proto"`.
*
* @generated from field: string file_name = 1;
*/
this.fileName = "";
proto3_js_1.proto3.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new SourceContext().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new SourceContext().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new SourceContext().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(SourceContext, a, b);
}
}
exports.SourceContext = SourceContext;
SourceContext.runtime = proto3_js_1.proto3;
SourceContext.typeName = "google.protobuf.SourceContext";
SourceContext.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "file_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
+158
View File
@@ -0,0 +1,158 @@
import { proto3 } from "../../proto3.js";
import type { PartialMessage, PlainMessage } from "../../message.js";
import { Message } from "../../message.js";
import type { JsonReadOptions, JsonValue, JsonWriteOptions } from "../../json-format.js";
import type { FieldList } from "../../field-list.js";
import type { BinaryReadOptions } from "../../binary-format.js";
/**
* `NullValue` is a singleton enumeration to represent the null value for the
* `Value` type union.
*
* The JSON representation for `NullValue` is JSON `null`.
*
* @generated from enum google.protobuf.NullValue
*/
export declare enum NullValue {
/**
* Null value.
*
* @generated from enum value: NULL_VALUE = 0;
*/
NULL_VALUE = 0
}
/**
* `Struct` represents a structured data value, consisting of fields
* which map to dynamically typed values. In some languages, `Struct`
* might be supported by a native representation. For example, in
* scripting languages like JS a struct is represented as an
* object. The details of that representation are described together
* with the proto support for the language.
*
* The JSON representation for `Struct` is JSON object.
*
* @generated from message google.protobuf.Struct
*/
export declare class Struct extends Message<Struct> {
/**
* Unordered map of dynamically typed values.
*
* @generated from field: map<string, google.protobuf.Value> fields = 1;
*/
fields: {
[key: string]: Value;
};
constructor(data?: PartialMessage<Struct>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Struct";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Struct;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Struct;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Struct;
static equals(a: Struct | PlainMessage<Struct> | undefined, b: Struct | PlainMessage<Struct> | undefined): boolean;
}
/**
* `Value` represents a dynamically typed value which can be either
* null, a number, a string, a boolean, a recursive struct value, or a
* list of values. A producer of value is expected to set one of these
* variants. Absence of any variant indicates an error.
*
* The JSON representation for `Value` is JSON value.
*
* @generated from message google.protobuf.Value
*/
export declare class Value extends Message<Value> {
/**
* The kind of value.
*
* @generated from oneof google.protobuf.Value.kind
*/
kind: {
/**
* Represents a null value.
*
* @generated from field: google.protobuf.NullValue null_value = 1;
*/
value: NullValue;
case: "nullValue";
} | {
/**
* Represents a double value.
*
* @generated from field: double number_value = 2;
*/
value: number;
case: "numberValue";
} | {
/**
* Represents a string value.
*
* @generated from field: string string_value = 3;
*/
value: string;
case: "stringValue";
} | {
/**
* Represents a boolean value.
*
* @generated from field: bool bool_value = 4;
*/
value: boolean;
case: "boolValue";
} | {
/**
* Represents a structured value.
*
* @generated from field: google.protobuf.Struct struct_value = 5;
*/
value: Struct;
case: "structValue";
} | {
/**
* Represents a repeated `Value`.
*
* @generated from field: google.protobuf.ListValue list_value = 6;
*/
value: ListValue;
case: "listValue";
} | {
case: undefined;
value?: undefined;
};
constructor(data?: PartialMessage<Value>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Value";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Value;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Value;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Value;
static equals(a: Value | PlainMessage<Value> | undefined, b: Value | PlainMessage<Value> | undefined): boolean;
}
/**
* `ListValue` is a wrapper around a repeated field of values.
*
* The JSON representation for `ListValue` is JSON array.
*
* @generated from message google.protobuf.ListValue
*/
export declare class ListValue extends Message<ListValue> {
/**
* Repeated field of dynamically typed values.
*
* @generated from field: repeated google.protobuf.Value values = 1;
*/
values: Value[];
constructor(data?: PartialMessage<ListValue>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.ListValue";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListValue;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ListValue;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ListValue;
static equals(a: ListValue | PlainMessage<ListValue> | undefined, b: ListValue | PlainMessage<ListValue> | undefined): boolean;
}
+240
View File
@@ -0,0 +1,240 @@
"use strict";
// Copyright 2021-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ListValue = exports.Value = exports.Struct = exports.NullValue = void 0;
// @generated by protoc-gen-es v1.10.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
// @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
/* eslint-disable */
const proto3_js_1 = require("../../proto3.js");
const message_js_1 = require("../../message.js");
/**
* `NullValue` is a singleton enumeration to represent the null value for the
* `Value` type union.
*
* The JSON representation for `NullValue` is JSON `null`.
*
* @generated from enum google.protobuf.NullValue
*/
var NullValue;
(function (NullValue) {
/**
* Null value.
*
* @generated from enum value: NULL_VALUE = 0;
*/
NullValue[NullValue["NULL_VALUE"] = 0] = "NULL_VALUE";
})(NullValue || (exports.NullValue = NullValue = {}));
// Retrieve enum metadata with: proto3.getEnumType(NullValue)
proto3_js_1.proto3.util.setEnumType(NullValue, "google.protobuf.NullValue", [
{ no: 0, name: "NULL_VALUE" },
]);
/**
* `Struct` represents a structured data value, consisting of fields
* which map to dynamically typed values. In some languages, `Struct`
* might be supported by a native representation. For example, in
* scripting languages like JS a struct is represented as an
* object. The details of that representation are described together
* with the proto support for the language.
*
* The JSON representation for `Struct` is JSON object.
*
* @generated from message google.protobuf.Struct
*/
class Struct extends message_js_1.Message {
constructor(data) {
super();
/**
* Unordered map of dynamically typed values.
*
* @generated from field: map<string, google.protobuf.Value> fields = 1;
*/
this.fields = {};
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
const json = {};
for (const [k, v] of Object.entries(this.fields)) {
json[k] = v.toJson(options);
}
return json;
}
fromJson(json, options) {
if (typeof json != "object" || json == null || Array.isArray(json)) {
throw new Error("cannot decode google.protobuf.Struct from JSON " + proto3_js_1.proto3.json.debug(json));
}
for (const [k, v] of Object.entries(json)) {
this.fields[k] = Value.fromJson(v);
}
return this;
}
static fromBinary(bytes, options) {
return new Struct().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Struct().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Struct().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Struct, a, b);
}
}
exports.Struct = Struct;
Struct.runtime = proto3_js_1.proto3;
Struct.typeName = "google.protobuf.Struct";
Struct.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "fields", kind: "map", K: 9 /* ScalarType.STRING */, V: { kind: "message", T: Value } },
]);
/**
* `Value` represents a dynamically typed value which can be either
* null, a number, a string, a boolean, a recursive struct value, or a
* list of values. A producer of value is expected to set one of these
* variants. Absence of any variant indicates an error.
*
* The JSON representation for `Value` is JSON value.
*
* @generated from message google.protobuf.Value
*/
class Value extends message_js_1.Message {
constructor(data) {
super();
/**
* The kind of value.
*
* @generated from oneof google.protobuf.Value.kind
*/
this.kind = { case: undefined };
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
switch (this.kind.case) {
case "nullValue":
return null;
case "numberValue":
if (!Number.isFinite(this.kind.value)) {
throw new Error("google.protobuf.Value cannot be NaN or Infinity");
}
return this.kind.value;
case "boolValue":
return this.kind.value;
case "stringValue":
return this.kind.value;
case "structValue":
case "listValue":
return this.kind.value.toJson(Object.assign(Object.assign({}, options), { emitDefaultValues: true }));
}
throw new Error("google.protobuf.Value must have a value");
}
fromJson(json, options) {
switch (typeof json) {
case "number":
this.kind = { case: "numberValue", value: json };
break;
case "string":
this.kind = { case: "stringValue", value: json };
break;
case "boolean":
this.kind = { case: "boolValue", value: json };
break;
case "object":
if (json === null) {
this.kind = { case: "nullValue", value: NullValue.NULL_VALUE };
}
else if (Array.isArray(json)) {
this.kind = { case: "listValue", value: ListValue.fromJson(json) };
}
else {
this.kind = { case: "structValue", value: Struct.fromJson(json) };
}
break;
default:
throw new Error("cannot decode google.protobuf.Value from JSON " + proto3_js_1.proto3.json.debug(json));
}
return this;
}
static fromBinary(bytes, options) {
return new Value().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Value().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Value().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Value, a, b);
}
}
exports.Value = Value;
Value.runtime = proto3_js_1.proto3;
Value.typeName = "google.protobuf.Value";
Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "null_value", kind: "enum", T: proto3_js_1.proto3.getEnumType(NullValue), oneof: "kind" },
{ no: 2, name: "number_value", kind: "scalar", T: 1 /* ScalarType.DOUBLE */, oneof: "kind" },
{ no: 3, name: "string_value", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "kind" },
{ no: 4, name: "bool_value", kind: "scalar", T: 8 /* ScalarType.BOOL */, oneof: "kind" },
{ no: 5, name: "struct_value", kind: "message", T: Struct, oneof: "kind" },
{ no: 6, name: "list_value", kind: "message", T: ListValue, oneof: "kind" },
]);
/**
* `ListValue` is a wrapper around a repeated field of values.
*
* The JSON representation for `ListValue` is JSON array.
*
* @generated from message google.protobuf.ListValue
*/
class ListValue extends message_js_1.Message {
constructor(data) {
super();
/**
* Repeated field of dynamically typed values.
*
* @generated from field: repeated google.protobuf.Value values = 1;
*/
this.values = [];
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
return this.values.map(v => v.toJson());
}
fromJson(json, options) {
if (!Array.isArray(json)) {
throw new Error("cannot decode google.protobuf.ListValue from JSON " + proto3_js_1.proto3.json.debug(json));
}
for (let e of json) {
this.values.push(Value.fromJson(e));
}
return this;
}
static fromBinary(bytes, options) {
return new ListValue().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new ListValue().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new ListValue().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(ListValue, a, b);
}
}
exports.ListValue = ListValue;
ListValue.runtime = proto3_js_1.proto3;
ListValue.typeName = "google.protobuf.ListValue";
ListValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "values", kind: "message", T: Value, repeated: true },
]);
@@ -0,0 +1,132 @@
import type { PartialMessage, PlainMessage } from "../../message.js";
import { Message } from "../../message.js";
import { proto3 } from "../../proto3.js";
import type { JsonReadOptions, JsonValue, JsonWriteOptions } from "../../json-format.js";
import type { FieldList } from "../../field-list.js";
import type { BinaryReadOptions } from "../../binary-format.js";
/**
* A Timestamp represents a point in time independent of any time zone or local
* calendar, encoded as a count of seconds and fractions of seconds at
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
* January 1, 1970, in the proleptic Gregorian calendar which extends the
* Gregorian calendar backwards to year one.
*
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
* second table is needed for interpretation, using a [24-hour linear
* smear](https://developers.google.com/time/smear).
*
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
* restricting to that range, we ensure that we can convert to and from [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
*
* # Examples
*
* Example 1: Compute Timestamp from POSIX `time()`.
*
* Timestamp timestamp;
* timestamp.set_seconds(time(NULL));
* timestamp.set_nanos(0);
*
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
*
* struct timeval tv;
* gettimeofday(&tv, NULL);
*
* Timestamp timestamp;
* timestamp.set_seconds(tv.tv_sec);
* timestamp.set_nanos(tv.tv_usec * 1000);
*
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
*
* FILETIME ft;
* GetSystemTimeAsFileTime(&ft);
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
*
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
* Timestamp timestamp;
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
*
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
*
* long millis = System.currentTimeMillis();
*
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
* .setNanos((int) ((millis % 1000) * 1000000)).build();
*
* Example 5: Compute Timestamp from Java `Instant.now()`.
*
* Instant now = Instant.now();
*
* Timestamp timestamp =
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
* .setNanos(now.getNano()).build();
*
* Example 6: Compute Timestamp from current time in Python.
*
* timestamp = Timestamp()
* timestamp.GetCurrentTime()
*
* # JSON Mapping
*
* In JSON format, the Timestamp type is encoded as a string in the
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
* where {year} is always expressed using four digits while {month}, {day},
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
* is required. A proto3 JSON serializer should always use UTC (as indicated by
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
* able to accept both UTC and other timezones (as indicated by an offset).
*
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
* 01:30 UTC on January 15, 2017.
*
* In JavaScript, one can convert a Date object to this format using the
* standard
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
* method. In Python, a standard `datetime.datetime` object can be converted
* to this format using
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
* ) to obtain a formatter capable of generating timestamps in this format.
*
*
* @generated from message google.protobuf.Timestamp
*/
export declare class Timestamp extends Message<Timestamp> {
/**
* Represents seconds of UTC time since Unix epoch
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
* 9999-12-31T23:59:59Z inclusive.
*
* @generated from field: int64 seconds = 1;
*/
seconds: bigint;
/**
* Non-negative fractions of a second at nanosecond resolution. Negative
* second values with fractions must still have non-negative nanos values
* that count forward in time. Must be from 0 to 999,999,999
* inclusive.
*
* @generated from field: int32 nanos = 2;
*/
nanos: number;
constructor(data?: PartialMessage<Timestamp>);
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
toDate(): Date;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Timestamp";
static readonly fields: FieldList;
static now(): Timestamp;
static fromDate(date: Date): Timestamp;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Timestamp;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Timestamp;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Timestamp;
static equals(a: Timestamp | PlainMessage<Timestamp> | undefined, b: Timestamp | PlainMessage<Timestamp> | undefined): boolean;
}
@@ -0,0 +1,213 @@
"use strict";
// Copyright 2021-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Timestamp = void 0;
const message_js_1 = require("../../message.js");
const proto_int64_js_1 = require("../../proto-int64.js");
const proto3_js_1 = require("../../proto3.js");
/**
* A Timestamp represents a point in time independent of any time zone or local
* calendar, encoded as a count of seconds and fractions of seconds at
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
* January 1, 1970, in the proleptic Gregorian calendar which extends the
* Gregorian calendar backwards to year one.
*
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
* second table is needed for interpretation, using a [24-hour linear
* smear](https://developers.google.com/time/smear).
*
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
* restricting to that range, we ensure that we can convert to and from [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
*
* # Examples
*
* Example 1: Compute Timestamp from POSIX `time()`.
*
* Timestamp timestamp;
* timestamp.set_seconds(time(NULL));
* timestamp.set_nanos(0);
*
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
*
* struct timeval tv;
* gettimeofday(&tv, NULL);
*
* Timestamp timestamp;
* timestamp.set_seconds(tv.tv_sec);
* timestamp.set_nanos(tv.tv_usec * 1000);
*
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
*
* FILETIME ft;
* GetSystemTimeAsFileTime(&ft);
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
*
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
* Timestamp timestamp;
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
*
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
*
* long millis = System.currentTimeMillis();
*
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
* .setNanos((int) ((millis % 1000) * 1000000)).build();
*
* Example 5: Compute Timestamp from Java `Instant.now()`.
*
* Instant now = Instant.now();
*
* Timestamp timestamp =
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
* .setNanos(now.getNano()).build();
*
* Example 6: Compute Timestamp from current time in Python.
*
* timestamp = Timestamp()
* timestamp.GetCurrentTime()
*
* # JSON Mapping
*
* In JSON format, the Timestamp type is encoded as a string in the
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
* where {year} is always expressed using four digits while {month}, {day},
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
* is required. A proto3 JSON serializer should always use UTC (as indicated by
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
* able to accept both UTC and other timezones (as indicated by an offset).
*
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
* 01:30 UTC on January 15, 2017.
*
* In JavaScript, one can convert a Date object to this format using the
* standard
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
* method. In Python, a standard `datetime.datetime` object can be converted
* to this format using
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
* ) to obtain a formatter capable of generating timestamps in this format.
*
*
* @generated from message google.protobuf.Timestamp
*/
class Timestamp extends message_js_1.Message {
constructor(data) {
super();
/**
* Represents seconds of UTC time since Unix epoch
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
* 9999-12-31T23:59:59Z inclusive.
*
* @generated from field: int64 seconds = 1;
*/
this.seconds = proto_int64_js_1.protoInt64.zero;
/**
* Non-negative fractions of a second at nanosecond resolution. Negative
* second values with fractions must still have non-negative nanos values
* that count forward in time. Must be from 0 to 999,999,999
* inclusive.
*
* @generated from field: int32 nanos = 2;
*/
this.nanos = 0;
proto3_js_1.proto3.util.initPartial(data, this);
}
fromJson(json, options) {
if (typeof json !== "string") {
throw new Error(`cannot decode google.protobuf.Timestamp from JSON: ${proto3_js_1.proto3.json.debug(json)}`);
}
const matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
if (!matches) {
throw new Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);
}
const ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
if (Number.isNaN(ms)) {
throw new Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);
}
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) {
throw new Error(`cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);
}
this.seconds = proto_int64_js_1.protoInt64.parse(ms / 1000);
this.nanos = 0;
if (matches[7]) {
this.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
}
return this;
}
toJson(options) {
const ms = Number(this.seconds) * 1000;
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) {
throw new Error(`cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);
}
if (this.nanos < 0) {
throw new Error(`cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative`);
}
let z = "Z";
if (this.nanos > 0) {
const nanosStr = (this.nanos + 1000000000).toString().substring(1);
if (nanosStr.substring(3) === "000000") {
z = "." + nanosStr.substring(0, 3) + "Z";
}
else if (nanosStr.substring(6) === "000") {
z = "." + nanosStr.substring(0, 6) + "Z";
}
else {
z = "." + nanosStr + "Z";
}
}
return new Date(ms).toISOString().replace(".000Z", z);
}
toDate() {
return new Date(Number(this.seconds) * 1000 + Math.ceil(this.nanos / 1000000));
}
static now() {
return Timestamp.fromDate(new Date());
}
static fromDate(date) {
const ms = date.getTime();
return new Timestamp({
seconds: proto_int64_js_1.protoInt64.parse(Math.floor(ms / 1000)),
nanos: (ms % 1000) * 1000000,
});
}
static fromBinary(bytes, options) {
return new Timestamp().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Timestamp().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Timestamp().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Timestamp, a, b);
}
}
exports.Timestamp = Timestamp;
Timestamp.runtime = proto3_js_1.proto3;
Timestamp.typeName = "google.protobuf.Timestamp";
Timestamp.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "seconds", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 2, name: "nanos", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
]);
+437
View File
@@ -0,0 +1,437 @@
import { proto3 } from "../../proto3.js";
import type { PartialMessage, PlainMessage } from "../../message.js";
import { Message } from "../../message.js";
import { SourceContext } from "./source_context_pb.js";
import type { FieldList } from "../../field-list.js";
import type { BinaryReadOptions } from "../../binary-format.js";
import type { JsonReadOptions, JsonValue } from "../../json-format.js";
import { Any } from "./any_pb.js";
/**
* The syntax in which a protocol buffer element is defined.
*
* @generated from enum google.protobuf.Syntax
*/
export declare enum Syntax {
/**
* Syntax `proto2`.
*
* @generated from enum value: SYNTAX_PROTO2 = 0;
*/
PROTO2 = 0,
/**
* Syntax `proto3`.
*
* @generated from enum value: SYNTAX_PROTO3 = 1;
*/
PROTO3 = 1,
/**
* Syntax `editions`.
*
* @generated from enum value: SYNTAX_EDITIONS = 2;
*/
EDITIONS = 2
}
/**
* A protocol buffer message type.
*
* @generated from message google.protobuf.Type
*/
export declare class Type extends Message<Type> {
/**
* The fully qualified message name.
*
* @generated from field: string name = 1;
*/
name: string;
/**
* The list of fields.
*
* @generated from field: repeated google.protobuf.Field fields = 2;
*/
fields: Field[];
/**
* The list of types appearing in `oneof` definitions in this type.
*
* @generated from field: repeated string oneofs = 3;
*/
oneofs: string[];
/**
* The protocol buffer options.
*
* @generated from field: repeated google.protobuf.Option options = 4;
*/
options: Option[];
/**
* The source context.
*
* @generated from field: google.protobuf.SourceContext source_context = 5;
*/
sourceContext?: SourceContext;
/**
* The source syntax.
*
* @generated from field: google.protobuf.Syntax syntax = 6;
*/
syntax: Syntax;
/**
* The source edition string, only valid when syntax is SYNTAX_EDITIONS.
*
* @generated from field: string edition = 7;
*/
edition: string;
constructor(data?: PartialMessage<Type>);
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Type";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Type;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Type;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Type;
static equals(a: Type | PlainMessage<Type> | undefined, b: Type | PlainMessage<Type> | undefined): boolean;
}
/**
* A single field of a message type.
*
* @generated from message google.protobuf.Field
*/
export declare class Field extends Message<Field> {
/**
* The field type.
*
* @generated from field: google.protobuf.Field.Kind kind = 1;
*/
kind: Field_Kind;
/**
* The field cardinality.
*
* @generated from field: google.protobuf.Field.Cardinality cardinality = 2;
*/
cardinality: Field_Cardinality;
/**
* The field number.
*
* @generated from field: int32 number = 3;
*/
number: number;
/**
* The field name.
*
* @generated from field: string name = 4;
*/
name: string;
/**
* The field type URL, without the scheme, for message or enumeration
* types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
*
* @generated from field: string type_url = 6;
*/
typeUrl: string;
/**
* The index of the field type in `Type.oneofs`, for message or enumeration
* types. The first type has index 1; zero means the type is not in the list.
*
* @generated from field: int32 oneof_index = 7;
*/
oneofIndex: number;
/**
* Whether to use alternative packed wire representation.
*
* @generated from field: bool packed = 8;
*/
packed: boolean;
/**
* The protocol buffer options.
*
* @generated from field: repeated google.protobuf.Option options = 9;
*/
options: Option[];
/**
* The field JSON name.
*
* @generated from field: string json_name = 10;
*/
jsonName: string;
/**
* The string value of the default value of this field. Proto2 syntax only.
*
* @generated from field: string default_value = 11;
*/
defaultValue: string;
constructor(data?: PartialMessage<Field>);
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Field";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Field;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Field;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Field;
static equals(a: Field | PlainMessage<Field> | undefined, b: Field | PlainMessage<Field> | undefined): boolean;
}
/**
* Basic field types.
*
* @generated from enum google.protobuf.Field.Kind
*/
export declare enum Field_Kind {
/**
* Field type unknown.
*
* @generated from enum value: TYPE_UNKNOWN = 0;
*/
TYPE_UNKNOWN = 0,
/**
* Field type double.
*
* @generated from enum value: TYPE_DOUBLE = 1;
*/
TYPE_DOUBLE = 1,
/**
* Field type float.
*
* @generated from enum value: TYPE_FLOAT = 2;
*/
TYPE_FLOAT = 2,
/**
* Field type int64.
*
* @generated from enum value: TYPE_INT64 = 3;
*/
TYPE_INT64 = 3,
/**
* Field type uint64.
*
* @generated from enum value: TYPE_UINT64 = 4;
*/
TYPE_UINT64 = 4,
/**
* Field type int32.
*
* @generated from enum value: TYPE_INT32 = 5;
*/
TYPE_INT32 = 5,
/**
* Field type fixed64.
*
* @generated from enum value: TYPE_FIXED64 = 6;
*/
TYPE_FIXED64 = 6,
/**
* Field type fixed32.
*
* @generated from enum value: TYPE_FIXED32 = 7;
*/
TYPE_FIXED32 = 7,
/**
* Field type bool.
*
* @generated from enum value: TYPE_BOOL = 8;
*/
TYPE_BOOL = 8,
/**
* Field type string.
*
* @generated from enum value: TYPE_STRING = 9;
*/
TYPE_STRING = 9,
/**
* Field type group. Proto2 syntax only, and deprecated.
*
* @generated from enum value: TYPE_GROUP = 10;
*/
TYPE_GROUP = 10,
/**
* Field type message.
*
* @generated from enum value: TYPE_MESSAGE = 11;
*/
TYPE_MESSAGE = 11,
/**
* Field type bytes.
*
* @generated from enum value: TYPE_BYTES = 12;
*/
TYPE_BYTES = 12,
/**
* Field type uint32.
*
* @generated from enum value: TYPE_UINT32 = 13;
*/
TYPE_UINT32 = 13,
/**
* Field type enum.
*
* @generated from enum value: TYPE_ENUM = 14;
*/
TYPE_ENUM = 14,
/**
* Field type sfixed32.
*
* @generated from enum value: TYPE_SFIXED32 = 15;
*/
TYPE_SFIXED32 = 15,
/**
* Field type sfixed64.
*
* @generated from enum value: TYPE_SFIXED64 = 16;
*/
TYPE_SFIXED64 = 16,
/**
* Field type sint32.
*
* @generated from enum value: TYPE_SINT32 = 17;
*/
TYPE_SINT32 = 17,
/**
* Field type sint64.
*
* @generated from enum value: TYPE_SINT64 = 18;
*/
TYPE_SINT64 = 18
}
/**
* Whether a field is optional, required, or repeated.
*
* @generated from enum google.protobuf.Field.Cardinality
*/
export declare enum Field_Cardinality {
/**
* For fields with unknown cardinality.
*
* @generated from enum value: CARDINALITY_UNKNOWN = 0;
*/
UNKNOWN = 0,
/**
* For optional fields.
*
* @generated from enum value: CARDINALITY_OPTIONAL = 1;
*/
OPTIONAL = 1,
/**
* For required fields. Proto2 syntax only.
*
* @generated from enum value: CARDINALITY_REQUIRED = 2;
*/
REQUIRED = 2,
/**
* For repeated fields.
*
* @generated from enum value: CARDINALITY_REPEATED = 3;
*/
REPEATED = 3
}
/**
* Enum type definition.
*
* @generated from message google.protobuf.Enum
*/
export declare class Enum extends Message<Enum> {
/**
* Enum type name.
*
* @generated from field: string name = 1;
*/
name: string;
/**
* Enum value definitions.
*
* @generated from field: repeated google.protobuf.EnumValue enumvalue = 2;
*/
enumvalue: EnumValue[];
/**
* Protocol buffer options.
*
* @generated from field: repeated google.protobuf.Option options = 3;
*/
options: Option[];
/**
* The source context.
*
* @generated from field: google.protobuf.SourceContext source_context = 4;
*/
sourceContext?: SourceContext;
/**
* The source syntax.
*
* @generated from field: google.protobuf.Syntax syntax = 5;
*/
syntax: Syntax;
/**
* The source edition string, only valid when syntax is SYNTAX_EDITIONS.
*
* @generated from field: string edition = 6;
*/
edition: string;
constructor(data?: PartialMessage<Enum>);
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Enum";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Enum;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Enum;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Enum;
static equals(a: Enum | PlainMessage<Enum> | undefined, b: Enum | PlainMessage<Enum> | undefined): boolean;
}
/**
* Enum value definition.
*
* @generated from message google.protobuf.EnumValue
*/
export declare class EnumValue extends Message<EnumValue> {
/**
* Enum value name.
*
* @generated from field: string name = 1;
*/
name: string;
/**
* Enum value number.
*
* @generated from field: int32 number = 2;
*/
number: number;
/**
* Protocol buffer options.
*
* @generated from field: repeated google.protobuf.Option options = 3;
*/
options: Option[];
constructor(data?: PartialMessage<EnumValue>);
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.EnumValue";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): EnumValue;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): EnumValue;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): EnumValue;
static equals(a: EnumValue | PlainMessage<EnumValue> | undefined, b: EnumValue | PlainMessage<EnumValue> | undefined): boolean;
}
/**
* A protocol buffer option, which can be attached to a message, field,
* enumeration, etc.
*
* @generated from message google.protobuf.Option
*/
export declare class Option extends Message<Option> {
/**
* The option's name. For protobuf built-in options (options defined in
* descriptor.proto), this is the short name. For example, `"map_entry"`.
* For custom options, it should be the fully-qualified name. For example,
* `"google.api.http"`.
*
* @generated from field: string name = 1;
*/
name: string;
/**
* The option's value packed in an Any message. If the value is a primitive,
* the corresponding wrapper type defined in google/protobuf/wrappers.proto
* should be used. If the value is an enum, it should be stored as an int32
* value using the google.protobuf.Int32Value type.
*
* @generated from field: google.protobuf.Any value = 2;
*/
value?: Any;
constructor(data?: PartialMessage<Option>);
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Option";
static readonly fields: FieldList;
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Option;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Option;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Option;
static equals(a: Option | PlainMessage<Option> | undefined, b: Option | PlainMessage<Option> | undefined): boolean;
}
+562
View File
@@ -0,0 +1,562 @@
"use strict";
// Copyright 2021-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Option = exports.EnumValue = exports.Enum = exports.Field_Cardinality = exports.Field_Kind = exports.Field = exports.Type = exports.Syntax = void 0;
// @generated by protoc-gen-es v1.10.1 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
// @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
/* eslint-disable */
const proto3_js_1 = require("../../proto3.js");
const message_js_1 = require("../../message.js");
const source_context_pb_js_1 = require("./source_context_pb.js");
const any_pb_js_1 = require("./any_pb.js");
/**
* The syntax in which a protocol buffer element is defined.
*
* @generated from enum google.protobuf.Syntax
*/
var Syntax;
(function (Syntax) {
/**
* Syntax `proto2`.
*
* @generated from enum value: SYNTAX_PROTO2 = 0;
*/
Syntax[Syntax["PROTO2"] = 0] = "PROTO2";
/**
* Syntax `proto3`.
*
* @generated from enum value: SYNTAX_PROTO3 = 1;
*/
Syntax[Syntax["PROTO3"] = 1] = "PROTO3";
/**
* Syntax `editions`.
*
* @generated from enum value: SYNTAX_EDITIONS = 2;
*/
Syntax[Syntax["EDITIONS"] = 2] = "EDITIONS";
})(Syntax || (exports.Syntax = Syntax = {}));
// Retrieve enum metadata with: proto3.getEnumType(Syntax)
proto3_js_1.proto3.util.setEnumType(Syntax, "google.protobuf.Syntax", [
{ no: 0, name: "SYNTAX_PROTO2" },
{ no: 1, name: "SYNTAX_PROTO3" },
{ no: 2, name: "SYNTAX_EDITIONS" },
]);
/**
* A protocol buffer message type.
*
* @generated from message google.protobuf.Type
*/
class Type extends message_js_1.Message {
constructor(data) {
super();
/**
* The fully qualified message name.
*
* @generated from field: string name = 1;
*/
this.name = "";
/**
* The list of fields.
*
* @generated from field: repeated google.protobuf.Field fields = 2;
*/
this.fields = [];
/**
* The list of types appearing in `oneof` definitions in this type.
*
* @generated from field: repeated string oneofs = 3;
*/
this.oneofs = [];
/**
* The protocol buffer options.
*
* @generated from field: repeated google.protobuf.Option options = 4;
*/
this.options = [];
/**
* The source syntax.
*
* @generated from field: google.protobuf.Syntax syntax = 6;
*/
this.syntax = Syntax.PROTO2;
/**
* The source edition string, only valid when syntax is SYNTAX_EDITIONS.
*
* @generated from field: string edition = 7;
*/
this.edition = "";
proto3_js_1.proto3.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new Type().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Type().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Type().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Type, a, b);
}
}
exports.Type = Type;
Type.runtime = proto3_js_1.proto3;
Type.typeName = "google.protobuf.Type";
Type.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "fields", kind: "message", T: Field, repeated: true },
{ no: 3, name: "oneofs", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },
{ no: 4, name: "options", kind: "message", T: Option, repeated: true },
{ no: 5, name: "source_context", kind: "message", T: source_context_pb_js_1.SourceContext },
{ no: 6, name: "syntax", kind: "enum", T: proto3_js_1.proto3.getEnumType(Syntax) },
{ no: 7, name: "edition", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
/**
* A single field of a message type.
*
* @generated from message google.protobuf.Field
*/
class Field extends message_js_1.Message {
constructor(data) {
super();
/**
* The field type.
*
* @generated from field: google.protobuf.Field.Kind kind = 1;
*/
this.kind = Field_Kind.TYPE_UNKNOWN;
/**
* The field cardinality.
*
* @generated from field: google.protobuf.Field.Cardinality cardinality = 2;
*/
this.cardinality = Field_Cardinality.UNKNOWN;
/**
* The field number.
*
* @generated from field: int32 number = 3;
*/
this.number = 0;
/**
* The field name.
*
* @generated from field: string name = 4;
*/
this.name = "";
/**
* The field type URL, without the scheme, for message or enumeration
* types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
*
* @generated from field: string type_url = 6;
*/
this.typeUrl = "";
/**
* The index of the field type in `Type.oneofs`, for message or enumeration
* types. The first type has index 1; zero means the type is not in the list.
*
* @generated from field: int32 oneof_index = 7;
*/
this.oneofIndex = 0;
/**
* Whether to use alternative packed wire representation.
*
* @generated from field: bool packed = 8;
*/
this.packed = false;
/**
* The protocol buffer options.
*
* @generated from field: repeated google.protobuf.Option options = 9;
*/
this.options = [];
/**
* The field JSON name.
*
* @generated from field: string json_name = 10;
*/
this.jsonName = "";
/**
* The string value of the default value of this field. Proto2 syntax only.
*
* @generated from field: string default_value = 11;
*/
this.defaultValue = "";
proto3_js_1.proto3.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new Field().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Field().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Field().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Field, a, b);
}
}
exports.Field = Field;
Field.runtime = proto3_js_1.proto3;
Field.typeName = "google.protobuf.Field";
Field.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "kind", kind: "enum", T: proto3_js_1.proto3.getEnumType(Field_Kind) },
{ no: 2, name: "cardinality", kind: "enum", T: proto3_js_1.proto3.getEnumType(Field_Cardinality) },
{ no: 3, name: "number", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 4, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 6, name: "type_url", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 7, name: "oneof_index", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 8, name: "packed", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 9, name: "options", kind: "message", T: Option, repeated: true },
{ no: 10, name: "json_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 11, name: "default_value", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
/**
* Basic field types.
*
* @generated from enum google.protobuf.Field.Kind
*/
var Field_Kind;
(function (Field_Kind) {
/**
* Field type unknown.
*
* @generated from enum value: TYPE_UNKNOWN = 0;
*/
Field_Kind[Field_Kind["TYPE_UNKNOWN"] = 0] = "TYPE_UNKNOWN";
/**
* Field type double.
*
* @generated from enum value: TYPE_DOUBLE = 1;
*/
Field_Kind[Field_Kind["TYPE_DOUBLE"] = 1] = "TYPE_DOUBLE";
/**
* Field type float.
*
* @generated from enum value: TYPE_FLOAT = 2;
*/
Field_Kind[Field_Kind["TYPE_FLOAT"] = 2] = "TYPE_FLOAT";
/**
* Field type int64.
*
* @generated from enum value: TYPE_INT64 = 3;
*/
Field_Kind[Field_Kind["TYPE_INT64"] = 3] = "TYPE_INT64";
/**
* Field type uint64.
*
* @generated from enum value: TYPE_UINT64 = 4;
*/
Field_Kind[Field_Kind["TYPE_UINT64"] = 4] = "TYPE_UINT64";
/**
* Field type int32.
*
* @generated from enum value: TYPE_INT32 = 5;
*/
Field_Kind[Field_Kind["TYPE_INT32"] = 5] = "TYPE_INT32";
/**
* Field type fixed64.
*
* @generated from enum value: TYPE_FIXED64 = 6;
*/
Field_Kind[Field_Kind["TYPE_FIXED64"] = 6] = "TYPE_FIXED64";
/**
* Field type fixed32.
*
* @generated from enum value: TYPE_FIXED32 = 7;
*/
Field_Kind[Field_Kind["TYPE_FIXED32"] = 7] = "TYPE_FIXED32";
/**
* Field type bool.
*
* @generated from enum value: TYPE_BOOL = 8;
*/
Field_Kind[Field_Kind["TYPE_BOOL"] = 8] = "TYPE_BOOL";
/**
* Field type string.
*
* @generated from enum value: TYPE_STRING = 9;
*/
Field_Kind[Field_Kind["TYPE_STRING"] = 9] = "TYPE_STRING";
/**
* Field type group. Proto2 syntax only, and deprecated.
*
* @generated from enum value: TYPE_GROUP = 10;
*/
Field_Kind[Field_Kind["TYPE_GROUP"] = 10] = "TYPE_GROUP";
/**
* Field type message.
*
* @generated from enum value: TYPE_MESSAGE = 11;
*/
Field_Kind[Field_Kind["TYPE_MESSAGE"] = 11] = "TYPE_MESSAGE";
/**
* Field type bytes.
*
* @generated from enum value: TYPE_BYTES = 12;
*/
Field_Kind[Field_Kind["TYPE_BYTES"] = 12] = "TYPE_BYTES";
/**
* Field type uint32.
*
* @generated from enum value: TYPE_UINT32 = 13;
*/
Field_Kind[Field_Kind["TYPE_UINT32"] = 13] = "TYPE_UINT32";
/**
* Field type enum.
*
* @generated from enum value: TYPE_ENUM = 14;
*/
Field_Kind[Field_Kind["TYPE_ENUM"] = 14] = "TYPE_ENUM";
/**
* Field type sfixed32.
*
* @generated from enum value: TYPE_SFIXED32 = 15;
*/
Field_Kind[Field_Kind["TYPE_SFIXED32"] = 15] = "TYPE_SFIXED32";
/**
* Field type sfixed64.
*
* @generated from enum value: TYPE_SFIXED64 = 16;
*/
Field_Kind[Field_Kind["TYPE_SFIXED64"] = 16] = "TYPE_SFIXED64";
/**
* Field type sint32.
*
* @generated from enum value: TYPE_SINT32 = 17;
*/
Field_Kind[Field_Kind["TYPE_SINT32"] = 17] = "TYPE_SINT32";
/**
* Field type sint64.
*
* @generated from enum value: TYPE_SINT64 = 18;
*/
Field_Kind[Field_Kind["TYPE_SINT64"] = 18] = "TYPE_SINT64";
})(Field_Kind || (exports.Field_Kind = Field_Kind = {}));
// Retrieve enum metadata with: proto3.getEnumType(Field_Kind)
proto3_js_1.proto3.util.setEnumType(Field_Kind, "google.protobuf.Field.Kind", [
{ no: 0, name: "TYPE_UNKNOWN" },
{ no: 1, name: "TYPE_DOUBLE" },
{ no: 2, name: "TYPE_FLOAT" },
{ no: 3, name: "TYPE_INT64" },
{ no: 4, name: "TYPE_UINT64" },
{ no: 5, name: "TYPE_INT32" },
{ no: 6, name: "TYPE_FIXED64" },
{ no: 7, name: "TYPE_FIXED32" },
{ no: 8, name: "TYPE_BOOL" },
{ no: 9, name: "TYPE_STRING" },
{ no: 10, name: "TYPE_GROUP" },
{ no: 11, name: "TYPE_MESSAGE" },
{ no: 12, name: "TYPE_BYTES" },
{ no: 13, name: "TYPE_UINT32" },
{ no: 14, name: "TYPE_ENUM" },
{ no: 15, name: "TYPE_SFIXED32" },
{ no: 16, name: "TYPE_SFIXED64" },
{ no: 17, name: "TYPE_SINT32" },
{ no: 18, name: "TYPE_SINT64" },
]);
/**
* Whether a field is optional, required, or repeated.
*
* @generated from enum google.protobuf.Field.Cardinality
*/
var Field_Cardinality;
(function (Field_Cardinality) {
/**
* For fields with unknown cardinality.
*
* @generated from enum value: CARDINALITY_UNKNOWN = 0;
*/
Field_Cardinality[Field_Cardinality["UNKNOWN"] = 0] = "UNKNOWN";
/**
* For optional fields.
*
* @generated from enum value: CARDINALITY_OPTIONAL = 1;
*/
Field_Cardinality[Field_Cardinality["OPTIONAL"] = 1] = "OPTIONAL";
/**
* For required fields. Proto2 syntax only.
*
* @generated from enum value: CARDINALITY_REQUIRED = 2;
*/
Field_Cardinality[Field_Cardinality["REQUIRED"] = 2] = "REQUIRED";
/**
* For repeated fields.
*
* @generated from enum value: CARDINALITY_REPEATED = 3;
*/
Field_Cardinality[Field_Cardinality["REPEATED"] = 3] = "REPEATED";
})(Field_Cardinality || (exports.Field_Cardinality = Field_Cardinality = {}));
// Retrieve enum metadata with: proto3.getEnumType(Field_Cardinality)
proto3_js_1.proto3.util.setEnumType(Field_Cardinality, "google.protobuf.Field.Cardinality", [
{ no: 0, name: "CARDINALITY_UNKNOWN" },
{ no: 1, name: "CARDINALITY_OPTIONAL" },
{ no: 2, name: "CARDINALITY_REQUIRED" },
{ no: 3, name: "CARDINALITY_REPEATED" },
]);
/**
* Enum type definition.
*
* @generated from message google.protobuf.Enum
*/
class Enum extends message_js_1.Message {
constructor(data) {
super();
/**
* Enum type name.
*
* @generated from field: string name = 1;
*/
this.name = "";
/**
* Enum value definitions.
*
* @generated from field: repeated google.protobuf.EnumValue enumvalue = 2;
*/
this.enumvalue = [];
/**
* Protocol buffer options.
*
* @generated from field: repeated google.protobuf.Option options = 3;
*/
this.options = [];
/**
* The source syntax.
*
* @generated from field: google.protobuf.Syntax syntax = 5;
*/
this.syntax = Syntax.PROTO2;
/**
* The source edition string, only valid when syntax is SYNTAX_EDITIONS.
*
* @generated from field: string edition = 6;
*/
this.edition = "";
proto3_js_1.proto3.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new Enum().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Enum().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Enum().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Enum, a, b);
}
}
exports.Enum = Enum;
Enum.runtime = proto3_js_1.proto3;
Enum.typeName = "google.protobuf.Enum";
Enum.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "enumvalue", kind: "message", T: EnumValue, repeated: true },
{ no: 3, name: "options", kind: "message", T: Option, repeated: true },
{ no: 4, name: "source_context", kind: "message", T: source_context_pb_js_1.SourceContext },
{ no: 5, name: "syntax", kind: "enum", T: proto3_js_1.proto3.getEnumType(Syntax) },
{ no: 6, name: "edition", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
/**
* Enum value definition.
*
* @generated from message google.protobuf.EnumValue
*/
class EnumValue extends message_js_1.Message {
constructor(data) {
super();
/**
* Enum value name.
*
* @generated from field: string name = 1;
*/
this.name = "";
/**
* Enum value number.
*
* @generated from field: int32 number = 2;
*/
this.number = 0;
/**
* Protocol buffer options.
*
* @generated from field: repeated google.protobuf.Option options = 3;
*/
this.options = [];
proto3_js_1.proto3.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new EnumValue().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new EnumValue().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new EnumValue().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(EnumValue, a, b);
}
}
exports.EnumValue = EnumValue;
EnumValue.runtime = proto3_js_1.proto3;
EnumValue.typeName = "google.protobuf.EnumValue";
EnumValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "number", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 3, name: "options", kind: "message", T: Option, repeated: true },
]);
/**
* A protocol buffer option, which can be attached to a message, field,
* enumeration, etc.
*
* @generated from message google.protobuf.Option
*/
class Option extends message_js_1.Message {
constructor(data) {
super();
/**
* The option's name. For protobuf built-in options (options defined in
* descriptor.proto), this is the short name. For example, `"map_entry"`.
* For custom options, it should be the fully-qualified name. For example,
* `"google.api.http"`.
*
* @generated from field: string name = 1;
*/
this.name = "";
proto3_js_1.proto3.util.initPartial(data, this);
}
static fromBinary(bytes, options) {
return new Option().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Option().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Option().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Option, a, b);
}
}
exports.Option = Option;
Option.runtime = proto3_js_1.proto3;
Option.typeName = "google.protobuf.Option";
Option.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "value", kind: "message", T: any_pb_js_1.Any },
]);
@@ -0,0 +1,267 @@
import type { PartialMessage, PlainMessage } from "../../message.js";
import { Message } from "../../message.js";
import { proto3 } from "../../proto3.js";
import type { JsonReadOptions, JsonValue, JsonWriteOptions } from "../../json-format.js";
import type { FieldList } from "../../field-list.js";
import type { BinaryReadOptions } from "../../binary-format.js";
/**
* Wrapper message for `double`.
*
* The JSON representation for `DoubleValue` is JSON number.
*
* @generated from message google.protobuf.DoubleValue
*/
export declare class DoubleValue extends Message<DoubleValue> {
/**
* The double value.
*
* @generated from field: double value = 1;
*/
value: number;
constructor(data?: PartialMessage<DoubleValue>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.DoubleValue";
static readonly fields: FieldList;
static readonly fieldWrapper: {
wrapField(value: number): DoubleValue;
unwrapField(value: DoubleValue): number;
};
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DoubleValue;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DoubleValue;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DoubleValue;
static equals(a: DoubleValue | PlainMessage<DoubleValue> | undefined, b: DoubleValue | PlainMessage<DoubleValue> | undefined): boolean;
}
/**
* Wrapper message for `float`.
*
* The JSON representation for `FloatValue` is JSON number.
*
* @generated from message google.protobuf.FloatValue
*/
export declare class FloatValue extends Message<FloatValue> {
/**
* The float value.
*
* @generated from field: float value = 1;
*/
value: number;
constructor(data?: PartialMessage<FloatValue>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.FloatValue";
static readonly fields: FieldList;
static readonly fieldWrapper: {
wrapField(value: number): FloatValue;
unwrapField(value: FloatValue): number;
};
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): FloatValue;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): FloatValue;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): FloatValue;
static equals(a: FloatValue | PlainMessage<FloatValue> | undefined, b: FloatValue | PlainMessage<FloatValue> | undefined): boolean;
}
/**
* Wrapper message for `int64`.
*
* The JSON representation for `Int64Value` is JSON string.
*
* @generated from message google.protobuf.Int64Value
*/
export declare class Int64Value extends Message<Int64Value> {
/**
* The int64 value.
*
* @generated from field: int64 value = 1;
*/
value: bigint;
constructor(data?: PartialMessage<Int64Value>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Int64Value";
static readonly fields: FieldList;
static readonly fieldWrapper: {
wrapField(value: bigint): Int64Value;
unwrapField(value: Int64Value): bigint;
};
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Int64Value;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Int64Value;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Int64Value;
static equals(a: Int64Value | PlainMessage<Int64Value> | undefined, b: Int64Value | PlainMessage<Int64Value> | undefined): boolean;
}
/**
* Wrapper message for `uint64`.
*
* The JSON representation for `UInt64Value` is JSON string.
*
* @generated from message google.protobuf.UInt64Value
*/
export declare class UInt64Value extends Message<UInt64Value> {
/**
* The uint64 value.
*
* @generated from field: uint64 value = 1;
*/
value: bigint;
constructor(data?: PartialMessage<UInt64Value>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.UInt64Value";
static readonly fields: FieldList;
static readonly fieldWrapper: {
wrapField(value: bigint): UInt64Value;
unwrapField(value: UInt64Value): bigint;
};
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UInt64Value;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UInt64Value;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UInt64Value;
static equals(a: UInt64Value | PlainMessage<UInt64Value> | undefined, b: UInt64Value | PlainMessage<UInt64Value> | undefined): boolean;
}
/**
* Wrapper message for `int32`.
*
* The JSON representation for `Int32Value` is JSON number.
*
* @generated from message google.protobuf.Int32Value
*/
export declare class Int32Value extends Message<Int32Value> {
/**
* The int32 value.
*
* @generated from field: int32 value = 1;
*/
value: number;
constructor(data?: PartialMessage<Int32Value>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.Int32Value";
static readonly fields: FieldList;
static readonly fieldWrapper: {
wrapField(value: number): Int32Value;
unwrapField(value: Int32Value): number;
};
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Int32Value;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Int32Value;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Int32Value;
static equals(a: Int32Value | PlainMessage<Int32Value> | undefined, b: Int32Value | PlainMessage<Int32Value> | undefined): boolean;
}
/**
* Wrapper message for `uint32`.
*
* The JSON representation for `UInt32Value` is JSON number.
*
* @generated from message google.protobuf.UInt32Value
*/
export declare class UInt32Value extends Message<UInt32Value> {
/**
* The uint32 value.
*
* @generated from field: uint32 value = 1;
*/
value: number;
constructor(data?: PartialMessage<UInt32Value>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.UInt32Value";
static readonly fields: FieldList;
static readonly fieldWrapper: {
wrapField(value: number): UInt32Value;
unwrapField(value: UInt32Value): number;
};
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UInt32Value;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UInt32Value;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UInt32Value;
static equals(a: UInt32Value | PlainMessage<UInt32Value> | undefined, b: UInt32Value | PlainMessage<UInt32Value> | undefined): boolean;
}
/**
* Wrapper message for `bool`.
*
* The JSON representation for `BoolValue` is JSON `true` and `false`.
*
* @generated from message google.protobuf.BoolValue
*/
export declare class BoolValue extends Message<BoolValue> {
/**
* The bool value.
*
* @generated from field: bool value = 1;
*/
value: boolean;
constructor(data?: PartialMessage<BoolValue>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.BoolValue";
static readonly fields: FieldList;
static readonly fieldWrapper: {
wrapField(value: boolean): BoolValue;
unwrapField(value: BoolValue): boolean;
};
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): BoolValue;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): BoolValue;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): BoolValue;
static equals(a: BoolValue | PlainMessage<BoolValue> | undefined, b: BoolValue | PlainMessage<BoolValue> | undefined): boolean;
}
/**
* Wrapper message for `string`.
*
* The JSON representation for `StringValue` is JSON string.
*
* @generated from message google.protobuf.StringValue
*/
export declare class StringValue extends Message<StringValue> {
/**
* The string value.
*
* @generated from field: string value = 1;
*/
value: string;
constructor(data?: PartialMessage<StringValue>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.StringValue";
static readonly fields: FieldList;
static readonly fieldWrapper: {
wrapField(value: string): StringValue;
unwrapField(value: StringValue): string;
};
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): StringValue;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): StringValue;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): StringValue;
static equals(a: StringValue | PlainMessage<StringValue> | undefined, b: StringValue | PlainMessage<StringValue> | undefined): boolean;
}
/**
* Wrapper message for `bytes`.
*
* The JSON representation for `BytesValue` is JSON string.
*
* @generated from message google.protobuf.BytesValue
*/
export declare class BytesValue extends Message<BytesValue> {
/**
* The bytes value.
*
* @generated from field: bytes value = 1;
*/
value: Uint8Array;
constructor(data?: PartialMessage<BytesValue>);
toJson(options?: Partial<JsonWriteOptions>): JsonValue;
fromJson(json: JsonValue, options?: Partial<JsonReadOptions>): this;
static readonly runtime: typeof proto3;
static readonly typeName = "google.protobuf.BytesValue";
static readonly fields: FieldList;
static readonly fieldWrapper: {
wrapField(value: Uint8Array): BytesValue;
unwrapField(value: BytesValue): Uint8Array;
};
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): BytesValue;
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): BytesValue;
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): BytesValue;
static equals(a: BytesValue | PlainMessage<BytesValue> | undefined, b: BytesValue | PlainMessage<BytesValue> | undefined): boolean;
}
+569
View File
@@ -0,0 +1,569 @@
"use strict";
// Copyright 2021-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.BytesValue = exports.StringValue = exports.BoolValue = exports.UInt32Value = exports.Int32Value = exports.UInt64Value = exports.Int64Value = exports.FloatValue = exports.DoubleValue = void 0;
const message_js_1 = require("../../message.js");
const proto3_js_1 = require("../../proto3.js");
const scalar_js_1 = require("../../scalar.js");
const proto_int64_js_1 = require("../../proto-int64.js");
/**
* Wrapper message for `double`.
*
* The JSON representation for `DoubleValue` is JSON number.
*
* @generated from message google.protobuf.DoubleValue
*/
class DoubleValue extends message_js_1.Message {
constructor(data) {
super();
/**
* The double value.
*
* @generated from field: double value = 1;
*/
this.value = 0;
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
return proto3_js_1.proto3.json.writeScalar(scalar_js_1.ScalarType.DOUBLE, this.value, true);
}
fromJson(json, options) {
try {
this.value = proto3_js_1.proto3.json.readScalar(scalar_js_1.ScalarType.DOUBLE, json);
}
catch (e) {
let m = `cannot decode message google.protobuf.DoubleValue from JSON"`;
if (e instanceof Error && e.message.length > 0) {
m += `: ${e.message}`;
}
throw new Error(m);
}
return this;
}
static fromBinary(bytes, options) {
return new DoubleValue().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new DoubleValue().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new DoubleValue().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(DoubleValue, a, b);
}
}
exports.DoubleValue = DoubleValue;
DoubleValue.runtime = proto3_js_1.proto3;
DoubleValue.typeName = "google.protobuf.DoubleValue";
DoubleValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "value", kind: "scalar", T: 1 /* ScalarType.DOUBLE */ },
]);
DoubleValue.fieldWrapper = {
wrapField(value) {
return new DoubleValue({ value });
},
unwrapField(value) {
return value.value;
}
};
/**
* Wrapper message for `float`.
*
* The JSON representation for `FloatValue` is JSON number.
*
* @generated from message google.protobuf.FloatValue
*/
class FloatValue extends message_js_1.Message {
constructor(data) {
super();
/**
* The float value.
*
* @generated from field: float value = 1;
*/
this.value = 0;
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
return proto3_js_1.proto3.json.writeScalar(scalar_js_1.ScalarType.FLOAT, this.value, true);
}
fromJson(json, options) {
try {
this.value = proto3_js_1.proto3.json.readScalar(scalar_js_1.ScalarType.FLOAT, json);
}
catch (e) {
let m = `cannot decode message google.protobuf.FloatValue from JSON"`;
if (e instanceof Error && e.message.length > 0) {
m += `: ${e.message}`;
}
throw new Error(m);
}
return this;
}
static fromBinary(bytes, options) {
return new FloatValue().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new FloatValue().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new FloatValue().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(FloatValue, a, b);
}
}
exports.FloatValue = FloatValue;
FloatValue.runtime = proto3_js_1.proto3;
FloatValue.typeName = "google.protobuf.FloatValue";
FloatValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "value", kind: "scalar", T: 2 /* ScalarType.FLOAT */ },
]);
FloatValue.fieldWrapper = {
wrapField(value) {
return new FloatValue({ value });
},
unwrapField(value) {
return value.value;
}
};
/**
* Wrapper message for `int64`.
*
* The JSON representation for `Int64Value` is JSON string.
*
* @generated from message google.protobuf.Int64Value
*/
class Int64Value extends message_js_1.Message {
constructor(data) {
super();
/**
* The int64 value.
*
* @generated from field: int64 value = 1;
*/
this.value = proto_int64_js_1.protoInt64.zero;
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
return proto3_js_1.proto3.json.writeScalar(scalar_js_1.ScalarType.INT64, this.value, true);
}
fromJson(json, options) {
try {
this.value = proto3_js_1.proto3.json.readScalar(scalar_js_1.ScalarType.INT64, json);
}
catch (e) {
let m = `cannot decode message google.protobuf.Int64Value from JSON"`;
if (e instanceof Error && e.message.length > 0) {
m += `: ${e.message}`;
}
throw new Error(m);
}
return this;
}
static fromBinary(bytes, options) {
return new Int64Value().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Int64Value().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Int64Value().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Int64Value, a, b);
}
}
exports.Int64Value = Int64Value;
Int64Value.runtime = proto3_js_1.proto3;
Int64Value.typeName = "google.protobuf.Int64Value";
Int64Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "value", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
]);
Int64Value.fieldWrapper = {
wrapField(value) {
return new Int64Value({ value });
},
unwrapField(value) {
return value.value;
}
};
/**
* Wrapper message for `uint64`.
*
* The JSON representation for `UInt64Value` is JSON string.
*
* @generated from message google.protobuf.UInt64Value
*/
class UInt64Value extends message_js_1.Message {
constructor(data) {
super();
/**
* The uint64 value.
*
* @generated from field: uint64 value = 1;
*/
this.value = proto_int64_js_1.protoInt64.zero;
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
return proto3_js_1.proto3.json.writeScalar(scalar_js_1.ScalarType.UINT64, this.value, true);
}
fromJson(json, options) {
try {
this.value = proto3_js_1.proto3.json.readScalar(scalar_js_1.ScalarType.UINT64, json);
}
catch (e) {
let m = `cannot decode message google.protobuf.UInt64Value from JSON"`;
if (e instanceof Error && e.message.length > 0) {
m += `: ${e.message}`;
}
throw new Error(m);
}
return this;
}
static fromBinary(bytes, options) {
return new UInt64Value().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new UInt64Value().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new UInt64Value().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(UInt64Value, a, b);
}
}
exports.UInt64Value = UInt64Value;
UInt64Value.runtime = proto3_js_1.proto3;
UInt64Value.typeName = "google.protobuf.UInt64Value";
UInt64Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "value", kind: "scalar", T: 4 /* ScalarType.UINT64 */ },
]);
UInt64Value.fieldWrapper = {
wrapField(value) {
return new UInt64Value({ value });
},
unwrapField(value) {
return value.value;
}
};
/**
* Wrapper message for `int32`.
*
* The JSON representation for `Int32Value` is JSON number.
*
* @generated from message google.protobuf.Int32Value
*/
class Int32Value extends message_js_1.Message {
constructor(data) {
super();
/**
* The int32 value.
*
* @generated from field: int32 value = 1;
*/
this.value = 0;
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
return proto3_js_1.proto3.json.writeScalar(scalar_js_1.ScalarType.INT32, this.value, true);
}
fromJson(json, options) {
try {
this.value = proto3_js_1.proto3.json.readScalar(scalar_js_1.ScalarType.INT32, json);
}
catch (e) {
let m = `cannot decode message google.protobuf.Int32Value from JSON"`;
if (e instanceof Error && e.message.length > 0) {
m += `: ${e.message}`;
}
throw new Error(m);
}
return this;
}
static fromBinary(bytes, options) {
return new Int32Value().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new Int32Value().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new Int32Value().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(Int32Value, a, b);
}
}
exports.Int32Value = Int32Value;
Int32Value.runtime = proto3_js_1.proto3;
Int32Value.typeName = "google.protobuf.Int32Value";
Int32Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "value", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
]);
Int32Value.fieldWrapper = {
wrapField(value) {
return new Int32Value({ value });
},
unwrapField(value) {
return value.value;
}
};
/**
* Wrapper message for `uint32`.
*
* The JSON representation for `UInt32Value` is JSON number.
*
* @generated from message google.protobuf.UInt32Value
*/
class UInt32Value extends message_js_1.Message {
constructor(data) {
super();
/**
* The uint32 value.
*
* @generated from field: uint32 value = 1;
*/
this.value = 0;
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
return proto3_js_1.proto3.json.writeScalar(scalar_js_1.ScalarType.UINT32, this.value, true);
}
fromJson(json, options) {
try {
this.value = proto3_js_1.proto3.json.readScalar(scalar_js_1.ScalarType.UINT32, json);
}
catch (e) {
let m = `cannot decode message google.protobuf.UInt32Value from JSON"`;
if (e instanceof Error && e.message.length > 0) {
m += `: ${e.message}`;
}
throw new Error(m);
}
return this;
}
static fromBinary(bytes, options) {
return new UInt32Value().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new UInt32Value().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new UInt32Value().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(UInt32Value, a, b);
}
}
exports.UInt32Value = UInt32Value;
UInt32Value.runtime = proto3_js_1.proto3;
UInt32Value.typeName = "google.protobuf.UInt32Value";
UInt32Value.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "value", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
]);
UInt32Value.fieldWrapper = {
wrapField(value) {
return new UInt32Value({ value });
},
unwrapField(value) {
return value.value;
}
};
/**
* Wrapper message for `bool`.
*
* The JSON representation for `BoolValue` is JSON `true` and `false`.
*
* @generated from message google.protobuf.BoolValue
*/
class BoolValue extends message_js_1.Message {
constructor(data) {
super();
/**
* The bool value.
*
* @generated from field: bool value = 1;
*/
this.value = false;
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
return proto3_js_1.proto3.json.writeScalar(scalar_js_1.ScalarType.BOOL, this.value, true);
}
fromJson(json, options) {
try {
this.value = proto3_js_1.proto3.json.readScalar(scalar_js_1.ScalarType.BOOL, json);
}
catch (e) {
let m = `cannot decode message google.protobuf.BoolValue from JSON"`;
if (e instanceof Error && e.message.length > 0) {
m += `: ${e.message}`;
}
throw new Error(m);
}
return this;
}
static fromBinary(bytes, options) {
return new BoolValue().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new BoolValue().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new BoolValue().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(BoolValue, a, b);
}
}
exports.BoolValue = BoolValue;
BoolValue.runtime = proto3_js_1.proto3;
BoolValue.typeName = "google.protobuf.BoolValue";
BoolValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "value", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
]);
BoolValue.fieldWrapper = {
wrapField(value) {
return new BoolValue({ value });
},
unwrapField(value) {
return value.value;
}
};
/**
* Wrapper message for `string`.
*
* The JSON representation for `StringValue` is JSON string.
*
* @generated from message google.protobuf.StringValue
*/
class StringValue extends message_js_1.Message {
constructor(data) {
super();
/**
* The string value.
*
* @generated from field: string value = 1;
*/
this.value = "";
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
return proto3_js_1.proto3.json.writeScalar(scalar_js_1.ScalarType.STRING, this.value, true);
}
fromJson(json, options) {
try {
this.value = proto3_js_1.proto3.json.readScalar(scalar_js_1.ScalarType.STRING, json);
}
catch (e) {
let m = `cannot decode message google.protobuf.StringValue from JSON"`;
if (e instanceof Error && e.message.length > 0) {
m += `: ${e.message}`;
}
throw new Error(m);
}
return this;
}
static fromBinary(bytes, options) {
return new StringValue().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new StringValue().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new StringValue().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(StringValue, a, b);
}
}
exports.StringValue = StringValue;
StringValue.runtime = proto3_js_1.proto3;
StringValue.typeName = "google.protobuf.StringValue";
StringValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]);
StringValue.fieldWrapper = {
wrapField(value) {
return new StringValue({ value });
},
unwrapField(value) {
return value.value;
}
};
/**
* Wrapper message for `bytes`.
*
* The JSON representation for `BytesValue` is JSON string.
*
* @generated from message google.protobuf.BytesValue
*/
class BytesValue extends message_js_1.Message {
constructor(data) {
super();
/**
* The bytes value.
*
* @generated from field: bytes value = 1;
*/
this.value = new Uint8Array(0);
proto3_js_1.proto3.util.initPartial(data, this);
}
toJson(options) {
return proto3_js_1.proto3.json.writeScalar(scalar_js_1.ScalarType.BYTES, this.value, true);
}
fromJson(json, options) {
try {
this.value = proto3_js_1.proto3.json.readScalar(scalar_js_1.ScalarType.BYTES, json);
}
catch (e) {
let m = `cannot decode message google.protobuf.BytesValue from JSON"`;
if (e instanceof Error && e.message.length > 0) {
m += `: ${e.message}`;
}
throw new Error(m);
}
return this;
}
static fromBinary(bytes, options) {
return new BytesValue().fromBinary(bytes, options);
}
static fromJson(jsonValue, options) {
return new BytesValue().fromJson(jsonValue, options);
}
static fromJsonString(jsonString, options) {
return new BytesValue().fromJsonString(jsonString, options);
}
static equals(a, b) {
return proto3_js_1.proto3.util.equals(BytesValue, a, b);
}
}
exports.BytesValue = BytesValue;
BytesValue.runtime = proto3_js_1.proto3;
BytesValue.typeName = "google.protobuf.BytesValue";
BytesValue.fields = proto3_js_1.proto3.util.newFieldList(() => [
{ no: 1, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ },
]);
BytesValue.fieldWrapper = {
wrapField(value) {
return new BytesValue({ value });
},
unwrapField(value) {
return value.value;
}
};
+70
View File
@@ -0,0 +1,70 @@
/**
* Read a 64 bit varint as two JS numbers.
*
* Returns tuple:
* [0]: low bits
* [1]: high bits
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175
*/
export declare function varint64read(this: ReaderLike): [number, number];
/**
* Write a 64 bit varint, given as two JS numbers, to the given bytes array.
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344
*/
export declare function varint64write(lo: number, hi: number, bytes: number[]): void;
/**
* Parse decimal string of 64 bit integer value as two JS numbers.
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
*/
export declare function int64FromString(dec: string): {
lo: number;
hi: number;
};
/**
* Losslessly converts a 64-bit signed integer in 32:32 split representation
* into a decimal string.
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
*/
export declare function int64ToString(lo: number, hi: number): string;
/**
* Losslessly converts a 64-bit unsigned integer in 32:32 split representation
* into a decimal string.
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
*/
export declare function uInt64ToString(lo: number, hi: number): string;
/**
* Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144
*/
export declare function varint32write(value: number, bytes: number[]): void;
/**
* Read an unsigned 32 bit varint.
*
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220
*/
export declare function varint32read(this: ReaderLike): number;
type ReaderLike = {
buf: Uint8Array;
pos: number;
len: number;
assertBounds(): void;
};
export {};
+323
View File
@@ -0,0 +1,323 @@
"use strict";
// Copyright 2008 Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Code generated by the Protocol Buffer compiler is owned by the owner
// of the input file used when generating it. This code is not
// standalone and requires a support library to be linked with it. This
// support library is itself covered by the above license.
Object.defineProperty(exports, "__esModule", { value: true });
exports.varint32read = exports.varint32write = exports.uInt64ToString = exports.int64ToString = exports.int64FromString = exports.varint64write = exports.varint64read = void 0;
/* eslint-disable prefer-const,@typescript-eslint/restrict-plus-operands */
/**
* Read a 64 bit varint as two JS numbers.
*
* Returns tuple:
* [0]: low bits
* [1]: high bits
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175
*/
function varint64read() {
let lowBits = 0;
let highBits = 0;
for (let shift = 0; shift < 28; shift += 7) {
let b = this.buf[this.pos++];
lowBits |= (b & 0x7f) << shift;
if ((b & 0x80) == 0) {
this.assertBounds();
return [lowBits, highBits];
}
}
let middleByte = this.buf[this.pos++];
// last four bits of the first 32 bit number
lowBits |= (middleByte & 0x0f) << 28;
// 3 upper bits are part of the next 32 bit number
highBits = (middleByte & 0x70) >> 4;
if ((middleByte & 0x80) == 0) {
this.assertBounds();
return [lowBits, highBits];
}
for (let shift = 3; shift <= 31; shift += 7) {
let b = this.buf[this.pos++];
highBits |= (b & 0x7f) << shift;
if ((b & 0x80) == 0) {
this.assertBounds();
return [lowBits, highBits];
}
}
throw new Error("invalid varint");
}
exports.varint64read = varint64read;
/**
* Write a 64 bit varint, given as two JS numbers, to the given bytes array.
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344
*/
function varint64write(lo, hi, bytes) {
for (let i = 0; i < 28; i = i + 7) {
const shift = lo >>> i;
const hasNext = !(shift >>> 7 == 0 && hi == 0);
const byte = (hasNext ? shift | 0x80 : shift) & 0xff;
bytes.push(byte);
if (!hasNext) {
return;
}
}
const splitBits = ((lo >>> 28) & 0x0f) | ((hi & 0x07) << 4);
const hasMoreBits = !(hi >> 3 == 0);
bytes.push((hasMoreBits ? splitBits | 0x80 : splitBits) & 0xff);
if (!hasMoreBits) {
return;
}
for (let i = 3; i < 31; i = i + 7) {
const shift = hi >>> i;
const hasNext = !(shift >>> 7 == 0);
const byte = (hasNext ? shift | 0x80 : shift) & 0xff;
bytes.push(byte);
if (!hasNext) {
return;
}
}
bytes.push((hi >>> 31) & 0x01);
}
exports.varint64write = varint64write;
// constants for binary math
const TWO_PWR_32_DBL = 0x100000000;
/**
* Parse decimal string of 64 bit integer value as two JS numbers.
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
*/
function int64FromString(dec) {
// Check for minus sign.
const minus = dec[0] === "-";
if (minus) {
dec = dec.slice(1);
}
// Work 6 decimal digits at a time, acting like we're converting base 1e6
// digits to binary. This is safe to do with floating point math because
// Number.isSafeInteger(ALL_32_BITS * 1e6) == true.
const base = 1e6;
let lowBits = 0;
let highBits = 0;
function add1e6digit(begin, end) {
// Note: Number('') is 0.
const digit1e6 = Number(dec.slice(begin, end));
highBits *= base;
lowBits = lowBits * base + digit1e6;
// Carry bits from lowBits to
if (lowBits >= TWO_PWR_32_DBL) {
highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0);
lowBits = lowBits % TWO_PWR_32_DBL;
}
}
add1e6digit(-24, -18);
add1e6digit(-18, -12);
add1e6digit(-12, -6);
add1e6digit(-6);
return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits);
}
exports.int64FromString = int64FromString;
/**
* Losslessly converts a 64-bit signed integer in 32:32 split representation
* into a decimal string.
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
*/
function int64ToString(lo, hi) {
let bits = newBits(lo, hi);
// If we're treating the input as a signed value and the high bit is set, do
// a manual two's complement conversion before the decimal conversion.
const negative = (bits.hi & 0x80000000);
if (negative) {
bits = negate(bits.lo, bits.hi);
}
const result = uInt64ToString(bits.lo, bits.hi);
return negative ? "-" + result : result;
}
exports.int64ToString = int64ToString;
/**
* Losslessly converts a 64-bit unsigned integer in 32:32 split representation
* into a decimal string.
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10
*/
function uInt64ToString(lo, hi) {
({ lo, hi } = toUnsigned(lo, hi));
// Skip the expensive conversion if the number is small enough to use the
// built-in conversions.
// Number.MAX_SAFE_INTEGER = 0x001FFFFF FFFFFFFF, thus any number with
// highBits <= 0x1FFFFF can be safely expressed with a double and retain
// integer precision.
// Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true.
if (hi <= 0x1FFFFF) {
return String(TWO_PWR_32_DBL * hi + lo);
}
// What this code is doing is essentially converting the input number from
// base-2 to base-1e7, which allows us to represent the 64-bit range with
// only 3 (very large) digits. Those digits are then trivial to convert to
// a base-10 string.
// The magic numbers used here are -
// 2^24 = 16777216 = (1,6777216) in base-1e7.
// 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7.
// Split 32:32 representation into 16:24:24 representation so our
// intermediate digits don't overflow.
const low = lo & 0xFFFFFF;
const mid = ((lo >>> 24) | (hi << 8)) & 0xFFFFFF;
const high = (hi >> 16) & 0xFFFF;
// Assemble our three base-1e7 digits, ignoring carries. The maximum
// value in a digit at this step is representable as a 48-bit integer, which
// can be stored in a 64-bit floating point number.
let digitA = low + (mid * 6777216) + (high * 6710656);
let digitB = mid + (high * 8147497);
let digitC = (high * 2);
// Apply carries from A to B and from B to C.
const base = 10000000;
if (digitA >= base) {
digitB += Math.floor(digitA / base);
digitA %= base;
}
if (digitB >= base) {
digitC += Math.floor(digitB / base);
digitB %= base;
}
// If digitC is 0, then we should have returned in the trivial code path
// at the top for non-safe integers. Given this, we can assume both digitB
// and digitA need leading zeros.
return digitC.toString() + decimalFrom1e7WithLeadingZeros(digitB) +
decimalFrom1e7WithLeadingZeros(digitA);
}
exports.uInt64ToString = uInt64ToString;
function toUnsigned(lo, hi) {
return { lo: lo >>> 0, hi: hi >>> 0 };
}
function newBits(lo, hi) {
return { lo: lo | 0, hi: hi | 0 };
}
/**
* Returns two's compliment negation of input.
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Signed_32-bit_integers
*/
function negate(lowBits, highBits) {
highBits = ~highBits;
if (lowBits) {
lowBits = ~lowBits + 1;
}
else {
// If lowBits is 0, then bitwise-not is 0xFFFFFFFF,
// adding 1 to that, results in 0x100000000, which leaves
// the low bits 0x0 and simply adds one to the high bits.
highBits += 1;
}
return newBits(lowBits, highBits);
}
/**
* Returns decimal representation of digit1e7 with leading zeros.
*/
const decimalFrom1e7WithLeadingZeros = (digit1e7) => {
const partial = String(digit1e7);
return "0000000".slice(partial.length) + partial;
};
/**
* Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`
*
* Copyright 2008 Google Inc. All rights reserved.
*
* See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144
*/
function varint32write(value, bytes) {
if (value >= 0) {
// write value as varint 32
while (value > 0x7f) {
bytes.push((value & 0x7f) | 0x80);
value = value >>> 7;
}
bytes.push(value);
}
else {
for (let i = 0; i < 9; i++) {
bytes.push((value & 127) | 128);
value = value >> 7;
}
bytes.push(1);
}
}
exports.varint32write = varint32write;
/**
* Read an unsigned 32 bit varint.
*
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220
*/
function varint32read() {
let b = this.buf[this.pos++];
let result = b & 0x7f;
if ((b & 0x80) == 0) {
this.assertBounds();
return result;
}
b = this.buf[this.pos++];
result |= (b & 0x7f) << 7;
if ((b & 0x80) == 0) {
this.assertBounds();
return result;
}
b = this.buf[this.pos++];
result |= (b & 0x7f) << 14;
if ((b & 0x80) == 0) {
this.assertBounds();
return result;
}
b = this.buf[this.pos++];
result |= (b & 0x7f) << 21;
if ((b & 0x80) == 0) {
this.assertBounds();
return result;
}
// Extract only last 4 bits
b = this.buf[this.pos++];
result |= (b & 0x0f) << 28;
for (let readBytes = 5; (b & 0x80) !== 0 && readBytes < 10; readBytes++)
b = this.buf[this.pos++];
if ((b & 0x80) != 0)
throw new Error("invalid varint");
this.assertBounds();
// Result can have 32 bits, convert it to unsigned
return result >>> 0;
}
exports.varint32read = varint32read;