UNPKG

@mysten/sui

Version:
1 lines 14.7 kB
{"version":3,"file":"struct.mjs","names":[],"sources":["../../../../../src/grpc/proto/google/protobuf/struct.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// @generated by protobuf-ts 2.9.6 with parameter force_server_none,optimize_code_size,ts_nocheck\n// @generated from protobuf file \"google/protobuf/struct.proto\" (package \"google.protobuf\", syntax proto3)\n// tslint:disable\n// @ts-nocheck\n//\n// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc. All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n// * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\nimport { isJsonObject } from '@protobuf-ts/runtime';\nimport { typeofJsonValue } from '@protobuf-ts/runtime';\nimport type { JsonValue } from '@protobuf-ts/runtime';\nimport type { JsonReadOptions } from '@protobuf-ts/runtime';\nimport type { JsonWriteOptions } from '@protobuf-ts/runtime';\nimport type { JsonObject } from '@protobuf-ts/runtime';\nimport { MessageType } from '@protobuf-ts/runtime';\n/**\n * `Struct` represents a structured data value, consisting of fields\n * which map to dynamically typed values. In some languages, `Struct`\n * might be supported by a native representation. For example, in\n * scripting languages like JS a struct is represented as an\n * object. The details of that representation are described together\n * with the proto support for the language.\n *\n * The JSON representation for `Struct` is JSON object.\n *\n * @generated from protobuf message google.protobuf.Struct\n */\nexport interface Struct {\n\t/**\n\t * Unordered map of dynamically typed values.\n\t *\n\t * @generated from protobuf field: map<string, google.protobuf.Value> fields = 1;\n\t */\n\tfields: {\n\t\t[key: string]: Value;\n\t};\n}\n/**\n * `Value` represents a dynamically typed value which can be either\n * null, a number, a string, a boolean, a recursive struct value, or a\n * list of values. A producer of value is expected to set one of these\n * variants. Absence of any variant indicates an error.\n *\n * The JSON representation for `Value` is JSON value.\n *\n * @generated from protobuf message google.protobuf.Value\n */\nexport interface Value {\n\t/**\n\t * @generated from protobuf oneof: kind\n\t */\n\tkind:\n\t\t| {\n\t\t\t\toneofKind: 'nullValue';\n\t\t\t\t/**\n\t\t\t\t * Represents a null value.\n\t\t\t\t *\n\t\t\t\t * @generated from protobuf field: google.protobuf.NullValue null_value = 1;\n\t\t\t\t */\n\t\t\t\tnullValue: NullValue;\n\t\t }\n\t\t| {\n\t\t\t\toneofKind: 'numberValue';\n\t\t\t\t/**\n\t\t\t\t * Represents a double value.\n\t\t\t\t *\n\t\t\t\t * @generated from protobuf field: double number_value = 2;\n\t\t\t\t */\n\t\t\t\tnumberValue: number;\n\t\t }\n\t\t| {\n\t\t\t\toneofKind: 'stringValue';\n\t\t\t\t/**\n\t\t\t\t * Represents a string value.\n\t\t\t\t *\n\t\t\t\t * @generated from protobuf field: string string_value = 3;\n\t\t\t\t */\n\t\t\t\tstringValue: string;\n\t\t }\n\t\t| {\n\t\t\t\toneofKind: 'boolValue';\n\t\t\t\t/**\n\t\t\t\t * Represents a boolean value.\n\t\t\t\t *\n\t\t\t\t * @generated from protobuf field: bool bool_value = 4;\n\t\t\t\t */\n\t\t\t\tboolValue: boolean;\n\t\t }\n\t\t| {\n\t\t\t\toneofKind: 'structValue';\n\t\t\t\t/**\n\t\t\t\t * Represents a structured value.\n\t\t\t\t *\n\t\t\t\t * @generated from protobuf field: google.protobuf.Struct struct_value = 5;\n\t\t\t\t */\n\t\t\t\tstructValue: Struct;\n\t\t }\n\t\t| {\n\t\t\t\toneofKind: 'listValue';\n\t\t\t\t/**\n\t\t\t\t * Represents a repeated `Value`.\n\t\t\t\t *\n\t\t\t\t * @generated from protobuf field: google.protobuf.ListValue list_value = 6;\n\t\t\t\t */\n\t\t\t\tlistValue: ListValue;\n\t\t }\n\t\t| {\n\t\t\t\toneofKind: undefined;\n\t\t };\n}\n/**\n * `ListValue` is a wrapper around a repeated field of values.\n *\n * The JSON representation for `ListValue` is JSON array.\n *\n * @generated from protobuf message google.protobuf.ListValue\n */\nexport interface ListValue {\n\t/**\n\t * Repeated field of dynamically typed values.\n\t *\n\t * @generated from protobuf field: repeated google.protobuf.Value values = 1;\n\t */\n\tvalues: Value[];\n}\n/**\n * `NullValue` is a singleton enumeration to represent the null value for the\n * `Value` type union.\n *\n * The JSON representation for `NullValue` is JSON `null`.\n *\n * @generated from protobuf enum google.protobuf.NullValue\n */\nexport enum NullValue {\n\t/**\n\t * Null value.\n\t *\n\t * @generated from protobuf enum value: NULL_VALUE = 0;\n\t */\n\tNULL_VALUE = 0,\n}\n// @generated message type with reflection information, may provide speed optimized methods\nclass Struct$Type extends MessageType<Struct> {\n\tconstructor() {\n\t\tsuper('google.protobuf.Struct', [\n\t\t\t{\n\t\t\t\tno: 1,\n\t\t\t\tname: 'fields',\n\t\t\t\tkind: 'map',\n\t\t\t\tK: 9 /*ScalarType.STRING*/,\n\t\t\t\tV: { kind: 'message', T: () => Value },\n\t\t\t},\n\t\t]);\n\t}\n\t/**\n\t * Encode `Struct` to JSON object.\n\t */\n\tinternalJsonWrite(message: Struct, options: JsonWriteOptions): JsonValue {\n\t\tlet json: JsonObject = {};\n\t\tfor (let [k, v] of Object.entries(message.fields)) {\n\t\t\tjson[k] = Value.toJson(v);\n\t\t}\n\t\treturn json;\n\t}\n\t/**\n\t * Decode `Struct` from JSON object.\n\t */\n\tinternalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Struct): Struct {\n\t\tif (!isJsonObject(json))\n\t\t\tthrow new globalThis.Error(\n\t\t\t\t'Unable to parse message ' + this.typeName + ' from JSON ' + typeofJsonValue(json) + '.',\n\t\t\t);\n\t\tif (!target) target = this.create();\n\t\tfor (let [k, v] of globalThis.Object.entries(json)) {\n\t\t\ttarget.fields[k] = Value.fromJson(v);\n\t\t}\n\t\treturn target;\n\t}\n}\n/**\n * @generated MessageType for protobuf message google.protobuf.Struct\n */\nexport const Struct = new Struct$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass Value$Type extends MessageType<Value> {\n\tconstructor() {\n\t\tsuper('google.protobuf.Value', [\n\t\t\t{\n\t\t\t\tno: 1,\n\t\t\t\tname: 'null_value',\n\t\t\t\tkind: 'enum',\n\t\t\t\toneof: 'kind',\n\t\t\t\tT: () => ['google.protobuf.NullValue', NullValue],\n\t\t\t},\n\t\t\t{ no: 2, name: 'number_value', kind: 'scalar', oneof: 'kind', T: 1 /*ScalarType.DOUBLE*/ },\n\t\t\t{ no: 3, name: 'string_value', kind: 'scalar', oneof: 'kind', T: 9 /*ScalarType.STRING*/ },\n\t\t\t{ no: 4, name: 'bool_value', kind: 'scalar', oneof: 'kind', T: 8 /*ScalarType.BOOL*/ },\n\t\t\t{ no: 5, name: 'struct_value', kind: 'message', oneof: 'kind', T: () => Struct },\n\t\t\t{ no: 6, name: 'list_value', kind: 'message', oneof: 'kind', T: () => ListValue },\n\t\t]);\n\t}\n\t/**\n\t * Encode `Value` to JSON value.\n\t */\n\tinternalJsonWrite(message: Value, options: JsonWriteOptions): JsonValue {\n\t\tif (message.kind.oneofKind === undefined) throw new globalThis.Error();\n\t\tswitch (message.kind.oneofKind) {\n\t\t\tcase undefined:\n\t\t\t\tthrow new globalThis.Error();\n\t\t\tcase 'boolValue':\n\t\t\t\treturn message.kind.boolValue;\n\t\t\tcase 'nullValue':\n\t\t\t\treturn null;\n\t\t\tcase 'numberValue':\n\t\t\t\tlet numberValue = message.kind.numberValue;\n\t\t\t\tif (typeof numberValue == 'number' && !Number.isFinite(numberValue))\n\t\t\t\t\tthrow new globalThis.Error();\n\t\t\t\treturn numberValue;\n\t\t\tcase 'stringValue':\n\t\t\t\treturn message.kind.stringValue;\n\t\t\tcase 'listValue':\n\t\t\t\tlet listValueField = this.fields.find((f) => f.no === 6);\n\t\t\t\tif (listValueField?.kind !== 'message') throw new globalThis.Error();\n\t\t\t\treturn listValueField.T().toJson(message.kind.listValue);\n\t\t\tcase 'structValue':\n\t\t\t\tlet structValueField = this.fields.find((f) => f.no === 5);\n\t\t\t\tif (structValueField?.kind !== 'message') throw new globalThis.Error();\n\t\t\t\treturn structValueField.T().toJson(message.kind.structValue);\n\t\t}\n\t}\n\t/**\n\t * Decode `Value` from JSON value.\n\t */\n\tinternalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Value): Value {\n\t\tif (!target) target = this.create();\n\t\tswitch (typeof json) {\n\t\t\tcase 'number':\n\t\t\t\ttarget.kind = { oneofKind: 'numberValue', numberValue: json };\n\t\t\t\tbreak;\n\t\t\tcase 'string':\n\t\t\t\ttarget.kind = { oneofKind: 'stringValue', stringValue: json };\n\t\t\t\tbreak;\n\t\t\tcase 'boolean':\n\t\t\t\ttarget.kind = { oneofKind: 'boolValue', boolValue: json };\n\t\t\t\tbreak;\n\t\t\tcase 'object':\n\t\t\t\tif (json === null) {\n\t\t\t\t\ttarget.kind = { oneofKind: 'nullValue', nullValue: NullValue.NULL_VALUE };\n\t\t\t\t} else if (globalThis.Array.isArray(json)) {\n\t\t\t\t\ttarget.kind = { oneofKind: 'listValue', listValue: ListValue.fromJson(json) };\n\t\t\t\t} else {\n\t\t\t\t\ttarget.kind = { oneofKind: 'structValue', structValue: Struct.fromJson(json) };\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new globalThis.Error(\n\t\t\t\t\t'Unable to parse ' + this.typeName + ' from JSON ' + typeofJsonValue(json),\n\t\t\t\t);\n\t\t}\n\t\treturn target;\n\t}\n}\n/**\n * @generated MessageType for protobuf message google.protobuf.Value\n */\nexport const Value = new Value$Type();\n// @generated message type with reflection information, may provide speed optimized methods\nclass ListValue$Type extends MessageType<ListValue> {\n\tconstructor() {\n\t\tsuper('google.protobuf.ListValue', [\n\t\t\t{ no: 1, name: 'values', kind: 'message', repeat: 1 /*RepeatType.PACKED*/, T: () => Value },\n\t\t]);\n\t}\n\t/**\n\t * Encode `ListValue` to JSON array.\n\t */\n\tinternalJsonWrite(message: ListValue, options: JsonWriteOptions): JsonValue {\n\t\treturn message.values.map((v) => Value.toJson(v));\n\t}\n\t/**\n\t * Decode `ListValue` from JSON array.\n\t */\n\tinternalJsonRead(json: JsonValue, options: JsonReadOptions, target?: ListValue): ListValue {\n\t\tif (!globalThis.Array.isArray(json))\n\t\t\tthrow new globalThis.Error(\n\t\t\t\t'Unable to parse ' + this.typeName + ' from JSON ' + typeofJsonValue(json),\n\t\t\t);\n\t\tif (!target) target = this.create();\n\t\tlet values = json.map((v) => Value.fromJson(v));\n\t\ttarget.values.push(...values);\n\t\treturn target;\n\t}\n}\n/**\n * @generated MessageType for protobuf message google.protobuf.ListValue\n */\nexport const ListValue = new ListValue$Type();\n"],"mappings":";;;;;;;;;;;AAmKA,IAAY,kDAAL;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