/
var
/
www
/
qr4y.kz
/
server
/
delivery
/
node_modules
/
proto3-json-serializer
/
build
/
src
/
/var/www/qr4y.kz/server/delivery/node_modules/proto3-json-serializer/build/src
mkdir
upload
Name
Size
Mode
Actions
any.d.ts
481
0644
edit
dl
rm
any.js
3945
0644
edit
dl
rm
any.js.map
2421
0644
edit
dl
rm
bytes.d.ts
175
0644
edit
dl
rm
bytes.js
1148
0644
edit
dl
rm
bytes.js.map
653
0644
edit
dl
rm
duration.d.ts
373
0644
edit
dl
rm
duration.js
2195
0644
edit
dl
rm
duration.js.map
1513
0644
edit
dl
rm
enum.d.ts
191
0644
edit
dl
rm
enum.js
1535
0644
edit
dl
rm
enum.js.map
691
0644
edit
dl
rm
fieldmask.d.ts
299
0644
edit
dl
rm
fieldmask.js
1168
0644
edit
dl
rm
fieldmask.js.map
510
0644
edit
dl
rm
fromproto3json.d.ts
345
0644
edit
dl
rm
fromproto3json.js
7612
0644
edit
dl
rm
fromproto3json.js.map
4803
0644
edit
dl
rm
index.d.ts
147
0644
edit
dl
rm
index.js
1115
0644
edit
dl
rm
index.js.map
347
0644
edit
dl
rm
timestamp.d.ts
377
0644
edit
dl
rm
timestamp.js
2692
0644
edit
dl
rm
timestamp.js.map
1650
0644
edit
dl
rm
toproto3json.d.ts
149
0644
edit
dl
rm
toproto3json.js
5238
0644
edit
dl
rm
toproto3json.js.map
3470
0644
edit
dl
rm
types.d.ts
423
0644
edit
dl
rm
types.js
697
0644
edit
dl
rm
types.js.map
275
0644
edit
dl
rm
util.d.ts
240
0644
edit
dl
rm
util.js
1645
0644
edit
dl
rm
util.js.map
827
0644
edit
dl
rm
value.d.ts
975
0644
edit
dl
rm
value.js
4254
0644
edit
dl
rm
value.js.map
2938
0644
edit
dl
rm
wrappers.d.ts
612
0644
edit
dl
rm
wrappers.js
2192
0644
edit
dl
rm
wrappers.js.map
1395
0644
edit
dl
rm
Edit:
/var/www/qr4y.kz/server/delivery/node_modules/proto3-json-serializer/build/src/fromproto3json.js
(7612B)
"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.fromProto3JSON = exports.fromProto3JSONToInternalRepresentation = void 0; const any_1 = require("./any"); const bytes_1 = require("./bytes"); const enum_1 = require("./enum"); const value_1 = require("./value"); const util_1 = require("./util"); const duration_1 = require("./duration"); const timestamp_1 = require("./timestamp"); const wrappers_1 = require("./wrappers"); const fieldmask_1 = require("./fieldmask"); function fromProto3JSONToInternalRepresentation(type, json) { const fullyQualifiedTypeName = typeof type === 'string' ? type : (0, util_1.getFullyQualifiedTypeName)(type); if (typeof type !== 'string' && 'values' in type) { // type is an Enum if (fullyQualifiedTypeName === '.google.protobuf.NullValue') { return 'NULL_VALUE'; } return (0, enum_1.resolveEnumValueToString)(type, json); } if (typeof type !== 'string') { type.resolveAll(); } if (typeof type === 'string') { return json; } // Types that require special handling according to // https://developers.google.com/protocol-buffers/docs/proto3#json // Types that can have meaningful "null" value if (fullyQualifiedTypeName === '.google.protobuf.Value') { return (0, value_1.googleProtobufValueFromProto3JSON)(json); } if (util_1.wrapperTypes.has(fullyQualifiedTypeName)) { if ((json !== null && typeof json === 'object') || Array.isArray(json)) { throw new Error(`fromProto3JSONToInternalRepresentation: JSON representation for ${fullyQualifiedTypeName} expects a string, a number, or a boolean, but got ${typeof json}`); } return (0, wrappers_1.wrapperFromProto3JSON)(fullyQualifiedTypeName, json); } if (json === null) { return null; } // Types that cannot be "null" if (fullyQualifiedTypeName === '.google.protobuf.Any') { return (0, any_1.googleProtobufAnyFromProto3JSON)(type.root, json); } if (fullyQualifiedTypeName === '.google.protobuf.Struct') { if (typeof json !== 'object') { throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.Struct must be an object but got ${typeof json}`); } if (Array.isArray(json)) { throw new Error('fromProto3JSONToInternalRepresentation: google.protobuf.Struct must be an object but got an array'); } return (0, value_1.googleProtobufStructFromProto3JSON)(json); } if (fullyQualifiedTypeName === '.google.protobuf.ListValue') { if (!Array.isArray(json)) { throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.ListValue must be an array but got ${typeof json}`); } return (0, value_1.googleProtobufListValueFromProto3JSON)(json); } if (fullyQualifiedTypeName === '.google.protobuf.Duration') { if (typeof json !== 'string') { throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.Duration must be a string but got ${typeof json}`); } return (0, duration_1.googleProtobufDurationFromProto3JSON)(json); } if (fullyQualifiedTypeName === '.google.protobuf.Timestamp') { if (typeof json !== 'string') { throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.Timestamp must be a string but got ${typeof json}`); } return (0, timestamp_1.googleProtobufTimestampFromProto3JSON)(json); } if (fullyQualifiedTypeName === '.google.protobuf.FieldMask') { if (typeof json !== 'string') { throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.FieldMask must be a string but got ${typeof json}`); } return (0, fieldmask_1.googleProtobufFieldMaskFromProto3JSON)(json); } const result = {}; for (const [key, value] of Object.entries(json)) { const field = type.fields[key]; if (!field) { continue; } const resolvedType = field.resolvedType; const fieldType = field.type; if (field.repeated) { if (!Array.isArray(value)) { throw new Error(`fromProto3JSONToInternalRepresentation: expected an array for field ${key}`); } result[key] = value.map(element => fromProto3JSONToInternalRepresentation(resolvedType || fieldType, element)); } else if (field.map) { const map = {}; for (const [mapKey, mapValue] of Object.entries(value)) { map[mapKey] = fromProto3JSONToInternalRepresentation(resolvedType || fieldType, mapValue); } result[key] = map; } else if (fieldType.match(/^(?:(?:(?:u?int|fixed)(?:32|64))|float|double)$/)) { if (typeof value !== 'number' && typeof value !== 'string') { throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`); } result[key] = value; } else if (fieldType === 'string') { if (typeof value !== 'string') { throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`); } result[key] = value; } else if (fieldType === 'bool') { if (typeof value !== 'boolean') { throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`); } result[key] = value; } else if (fieldType === 'bytes') { if (typeof value !== 'string') { throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`); } result[key] = (0, bytes_1.bytesFromProto3JSON)(value); } else { // Message type (0, util_1.assert)(resolvedType !== null, `Expected to be able to resolve type for field ${field.name}`); const deserializedValue = fromProto3JSONToInternalRepresentation(resolvedType, value); result[key] = deserializedValue; } } return result; } exports.fromProto3JSONToInternalRepresentation = fromProto3JSONToInternalRepresentation; function fromProto3JSON(type, json) { const internalRepr = fromProto3JSONToInternalRepresentation(type, json); if (internalRepr === null) { return null; } // We only expect a real object here sine all special cases should be already resolved. Everything else is an internal error (0, util_1.assert)(typeof internalRepr === 'object' && !Array.isArray(internalRepr), `fromProto3JSON: expected an object, not ${json}`); return type.fromObject(internalRepr); } exports.fromProto3JSON = fromProto3JSON; //# sourceMappingURL=fromproto3json.js.map
Save
cmd:
run