/var/www/qr4y.com/server/delivery/node_modules/proto3-json-serializer/build/src
NameSizeModeActions
any.d.ts4810644editdlrm
any.js39450644editdlrm
any.js.map24210644editdlrm
bytes.d.ts1750644editdlrm
bytes.js11480644editdlrm
bytes.js.map6530644editdlrm
duration.d.ts3730644editdlrm
duration.js21950644editdlrm
duration.js.map15130644editdlrm
enum.d.ts1910644editdlrm
enum.js15350644editdlrm
enum.js.map6910644editdlrm
fieldmask.d.ts2990644editdlrm
fieldmask.js11680644editdlrm
fieldmask.js.map5100644editdlrm
fromproto3json.d.ts3450644editdlrm
fromproto3json.js76120644editdlrm
fromproto3json.js.map48030644editdlrm
index.d.ts1470644editdlrm
index.js11150644editdlrm
index.js.map3470644editdlrm
timestamp.d.ts3770644editdlrm
timestamp.js26920644editdlrm
timestamp.js.map16500644editdlrm
toproto3json.d.ts1490644editdlrm
toproto3json.js52380644editdlrm
toproto3json.js.map34700644editdlrm
types.d.ts4230644editdlrm
types.js6970644editdlrm
types.js.map2750644editdlrm
util.d.ts2400644editdlrm
util.js16450644editdlrm
util.js.map8270644editdlrm
value.d.ts9750644editdlrm
value.js42540644editdlrm
value.js.map29380644editdlrm
wrappers.d.ts6120644editdlrm
wrappers.js21920644editdlrm
wrappers.js.map13950644editdlrm
Edit: /var/www/qr4y.com/server/delivery/node_modules/proto3-json-serializer/build/src/any.js (3945B)
"use strict"; // Copyright 2021 Google LLC // // 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.googleProtobufAnyFromProto3JSON = exports.googleProtobufAnyToProto3JSON = void 0; const fromproto3json_1 = require("./fromproto3json"); const toproto3json_1 = require("./toproto3json"); // https://github.com/protocolbuffers/protobuf/blob/ba3836703b4a9e98e474aea2bac8c5b49b6d3b5c/python/google/protobuf/json_format.py#L850 const specialJSON = new Set([ 'google.protobuf.Any', 'google.protobuf.Duration', 'google.protobuf.FieldMask', 'google.protobuf.ListValue', 'google.protobuf.Struct', 'google.protobuf.Timestamp', 'google.protobuf.Value', ]); function googleProtobufAnyToProto3JSON(obj) { // https://developers.google.com/protocol-buffers/docs/proto3#json // If the Any contains a value that has a special JSON mapping, it will be converted as follows: // {"@type": xxx, "value": yyy}. // Otherwise, the value will be converted into a JSON object, and the "@type" field will be inserted // to indicate the actual data type. const typeName = obj.type_url.replace(/^.*\//, ''); let type; try { type = obj.$type.root.lookupType(typeName); } catch (err) { throw new Error(`googleProtobufAnyToProto3JSON: cannot find type ${typeName}: ${err}`); } const valueMessage = type.decode(obj.value); const valueProto3JSON = (0, toproto3json_1.toProto3JSON)(valueMessage); if (specialJSON.has(typeName)) { return { '@type': obj.type_url, value: valueProto3JSON, }; } valueProto3JSON['@type'] = obj.type_url; return valueProto3JSON; } exports.googleProtobufAnyToProto3JSON = googleProtobufAnyToProto3JSON; function googleProtobufAnyFromProto3JSON(root, json) { // Not all possible JSON values can hold Any, only real objects. if (json === null || typeof json !== 'object' || Array.isArray(json)) { throw new Error('googleProtobufAnyFromProto3JSON: must be an object to decode google.protobuf.Any'); } const typeUrl = json['@type']; if (!typeUrl || typeof typeUrl !== 'string') { throw new Error('googleProtobufAnyFromProto3JSON: JSON serialization of google.protobuf.Any must contain @type field'); } const typeName = typeUrl.replace(/^.*\//, ''); let type; try { type = root.lookupType(typeName); } catch (err) { throw new Error(`googleProtobufAnyFromProto3JSON: cannot find type ${typeName}: ${err}`); } let value = json; if (specialJSON.has(typeName)) { if (!('value' in json)) { throw new Error(`googleProtobufAnyFromProto3JSON: JSON representation of google.protobuf.Any with type ${typeName} must contain the value field`); } value = json.value; } const valueMessage = (0, fromproto3json_1.fromProto3JSON)(type, value); if (valueMessage === null) { return { type_url: typeUrl, value: null, }; } const uint8array = type.encode(valueMessage).finish(); const buffer = Buffer.from(uint8array, 0, uint8array.byteLength); const base64 = buffer.toString('base64'); return { type_url: typeUrl, value: base64, }; } exports.googleProtobufAnyFromProto3JSON = googleProtobufAnyFromProto3JSON; //# sourceMappingURL=any.js.map