You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@bufbuild/protobuf

Package Overview
Dependencies
Maintainers
5
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bufbuild/protobuf - npm Package Compare versions

Comparing version
2.10.2
to
2.11.0
+1
-1
dist/cjs/clone.js
"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -28,3 +28,3 @@ // Licensed under the Apache License, Version 2.0 (the "License");

const reflect_check_js_1 = require("./reflect/reflect-check.js");
const scalar_js_1 = require("./reflect/scalar.js");
const names_js_1 = require("./reflect/names.js");
const base64_encoding_js_1 = require("./wire/base64-encoding.js");

@@ -105,7 +105,3 @@ const index_js_1 = require("./wkt/index.js");

function enumFromJson(descEnum, json) {
const val = readEnum(descEnum, json, false, false);
if (val === tokenIgnoredUnknownEnum) {
throw new Error(`cannot decode ${descEnum} from JSON: ${(0, reflect_check_js_1.formatVal)(json)}`);
}
return val;
return readEnum(descEnum, json, false);
}

@@ -118,2 +114,14 @@ /**

}
const messageJsonFields = new WeakMap();
function getJsonField(desc, jsonKey) {
var _a;
if (!messageJsonFields.has(desc)) {
const jsonNames = new Map();
for (const field of desc.fields) {
jsonNames.set(field.name, field).set(field.jsonName, field);
}
messageJsonFields.set(desc, jsonNames);
}
return (_a = messageJsonFields.get(desc)) === null || _a === void 0 ? void 0 : _a.get(jsonKey);
}
function readMessage(msg, json, opts) {

@@ -128,8 +136,4 @@ var _a;

const oneofSeen = new Map();
const jsonNames = new Map();
for (const field of msg.desc.fields) {
jsonNames.set(field.name, field).set(field.jsonName, field);
}
for (const [jsonKey, jsonValue] of Object.entries(json)) {
const field = jsonNames.get(jsonKey);
const field = getJsonField(msg.desc, jsonKey);
if (field) {

@@ -185,2 +189,16 @@ if (field.oneof) {

}
function readListOrMapItem(field, json, opts) {
if (field.scalar && json !== null) {
return scalarFromJson(field, json);
}
if (field.message && !isResetSentinelNullValue(field, json)) {
const msgValue = (0, reflect_js_1.reflect)(field.message);
readMessage(msgValue, json, opts);
return msgValue;
}
if (field.enum && !isResetSentinelNullValue(field, json)) {
return readEnum(field.enum, json, opts.ignoreUnknownFields);
}
throw new error_js_1.FieldError(field, `${field.fieldKind === "list" ? "list item" : "map value"} must not be null`);
}
function readMapField(map, json, opts) {

@@ -195,24 +213,7 @@ if (json === null) {

for (const [jsonMapKey, jsonMapValue] of Object.entries(json)) {
if (jsonMapValue === null && !isSafeNullValueInListOrMap(field)) {
throw new error_js_1.FieldError(field, "map value must not be null");
const key = mapKeyFromJson(field.mapKey, jsonMapKey);
const value = readListOrMapItem(field, jsonMapValue, opts);
if (value !== tokenIgnoredUnknownEnum) {
map.set(key, value);
}
let value;
switch (field.mapKind) {
case "message":
const msgValue = (0, reflect_js_1.reflect)(field.message);
readMessage(msgValue, jsonMapValue, opts);
value = msgValue;
break;
case "enum":
value = readEnum(field.enum, jsonMapValue, opts.ignoreUnknownFields, true);
if (value === tokenIgnoredUnknownEnum) {
return;
}
break;
case "scalar":
value = scalarFromJson(field, jsonMapValue, true);
break;
}
const key = mapKeyFromJson(field.mapKey, jsonMapKey);
map.set(key, value);
}

@@ -229,30 +230,10 @@ }

for (const jsonItem of json) {
if (jsonItem === null && !isSafeNullValueInListOrMap(field)) {
throw new error_js_1.FieldError(field, "list item must not be null");
const value = readListOrMapItem(field, jsonItem, opts);
if (value !== tokenIgnoredUnknownEnum) {
list.add(value);
}
switch (field.listKind) {
case "message":
const msgValue = (0, reflect_js_1.reflect)(field.message);
readMessage(msgValue, jsonItem, opts);
list.add(msgValue);
break;
case "enum":
const enumValue = readEnum(field.enum, jsonItem, opts.ignoreUnknownFields, true);
if (enumValue !== tokenIgnoredUnknownEnum) {
list.add(enumValue);
}
break;
case "scalar":
list.add(scalarFromJson(field, jsonItem, true));
break;
}
}
}
function isSafeNullValueInListOrMap(field) {
var _a, _b;
return (((_a = field.message) === null || _a === void 0 ? void 0 : _a.typeName) == "google.protobuf.Value" ||
((_b = field.enum) === null || _b === void 0 ? void 0 : _b.typeName) == "google.protobuf.NullValue");
}
function readMessageField(msg, field, json, opts) {
if (json === null && field.message.typeName != "google.protobuf.Value") {
if (isResetSentinelNullValue(field, json)) {
msg.clear(field);

@@ -266,7 +247,8 @@ return;

function readEnumField(msg, field, json, opts) {
const enumValue = readEnum(field.enum, json, opts.ignoreUnknownFields, false);
if (enumValue === tokenNull) {
if (isResetSentinelNullValue(field, json)) {
msg.clear(field);
return;
}
else if (enumValue !== tokenIgnoredUnknownEnum) {
const enumValue = readEnum(field.enum, json, opts.ignoreUnknownFields);
if (enumValue !== tokenIgnoredUnknownEnum) {
msg.set(field, enumValue);

@@ -276,17 +258,30 @@ }

function readScalarField(msg, field, json) {
const scalarValue = scalarFromJson(field, json, false);
if (scalarValue === tokenNull) {
if (json === null) {
msg.clear(field);
}
else {
msg.set(field, scalarValue);
msg.set(field, scalarFromJson(field, json));
}
}
/**
* Indicates whether a value is a sentinel for reseting a field.
*
* For this to be true, the value must be a JSON null and the field must not
* permit a present, Protobuf-serializable null.
*
* Only message google.protobuf.Value and enum google.protobuf.NullValue fields
* permit Protobuf-serializable nulls.
*
* Note that field-resetting sentinel nulls are not permitted in lists and maps.
*/
function isResetSentinelNullValue(field, json) {
var _a, _b;
return (json === null &&
((_a = field.message) === null || _a === void 0 ? void 0 : _a.typeName) != "google.protobuf.Value" &&
((_b = field.enum) === null || _b === void 0 ? void 0 : _b.typeName) != "google.protobuf.NullValue");
}
const tokenIgnoredUnknownEnum = Symbol();
function readEnum(desc, json, ignoreUnknownFields, nullAsZeroValue) {
function readEnum(desc, json, ignoreUnknownFields) {
if (json === null) {
if (desc.typeName == "google.protobuf.NullValue") {
return 0; // google.protobuf.NullValue.NULL_VALUE = 0
}
return nullAsZeroValue ? desc.values[0].number : tokenNull;
return desc.values[0].number;
}

@@ -311,10 +306,9 @@ switch (typeof json) {

}
const tokenNull = Symbol();
function scalarFromJson(field, json, nullAsZeroValue) {
if (json === null) {
if (nullAsZeroValue) {
return (0, scalar_js_1.scalarZeroValue)(field.scalar, false);
}
return tokenNull;
}
/**
* Try to parse a JSON value to a scalar value for the reflect API.
*
* Returns the input if the JSON value cannot be converted. Raises a FieldError
* if conversion would be ambiguous.
*/
function scalarFromJson(field, json) {
// int64, sfixed64, sint64, fixed64, uint64: Reflect supports string and number.

@@ -392,6 +386,6 @@ // string, bool: Supported by reflect.

*/
function mapKeyFromJson(type, json) {
function mapKeyFromJson(type, jsonString) {
switch (type) {
case descriptors_js_1.ScalarType.BOOL:
switch (json) {
switch (jsonString) {
case "true":

@@ -402,3 +396,3 @@ return true;

}
return json;
return jsonString;
case descriptors_js_1.ScalarType.INT32:

@@ -409,5 +403,5 @@ case descriptors_js_1.ScalarType.FIXED32:

case descriptors_js_1.ScalarType.SINT32:
return int32FromJson(json);
return int32FromJson(jsonString);
default:
return json;
return jsonString;
}

@@ -483,3 +477,3 @@ }

else {
msg.set(valueField, scalarFromJson(valueField, jsonValue, true));
msg.set(valueField, scalarFromJson(valueField, jsonValue));
}

@@ -582,10 +576,8 @@ return true;

}
function camelToSnake(str) {
if (str.includes("_")) {
fieldMask.paths = json.split(",").map((path) => {
if (path.includes("_")) {
throw new Error(`cannot decode message ${fieldMask.$typeName} from JSON: path names must be lowerCamelCase`);
}
const sc = str.replace(/[A-Z]/g, (letter) => "_" + letter.toLowerCase());
return sc[0] === "_" ? sc.substring(1) : sc;
}
fieldMask.paths = json.split(",").map(camelToSnake);
return (0, names_js_1.protoSnakeCase)(path);
});
}

@@ -592,0 +584,0 @@ function structFromJson(struct, json) {

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -12,5 +12,16 @@ import type { AnyDesc } from "../descriptors.js";

* used by protoc to convert a field name to a JSON name.
*
* See https://protobuf.com/docs/language-spec#default-json-names
*
* The function protoSnakeCase provides the reverse.
*/
export declare function protoCamelCase(snakeCase: string): string;
/**
* Converts protoCamelCase to snake_case.
*
* This function is the reverse of function protoCamelCase. Note that some names
* are not reversible - for example, "foo__bar" -> "fooBar" -> "foo_bar".
*/
export declare function protoSnakeCase(lowerCamelCase: string): string;
/**
* Escapes names that are reserved for ECMAScript built-in object properties.

@@ -17,0 +28,0 @@ *

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -18,2 +18,3 @@ // Licensed under the Apache License, Version 2.0 (the "License");

exports.protoCamelCase = protoCamelCase;
exports.protoSnakeCase = protoSnakeCase;
exports.safeObjectProperty = safeObjectProperty;

@@ -50,2 +51,6 @@ /**

* used by protoc to convert a field name to a JSON name.
*
* See https://protobuf.com/docs/language-spec#default-json-names
*
* The function protoSnakeCase provides the reverse.
*/

@@ -86,2 +91,11 @@ function protoCamelCase(snakeCase) {

/**
* Converts protoCamelCase to snake_case.
*
* This function is the reverse of function protoCamelCase. Note that some names
* are not reversible - for example, "foo__bar" -> "fooBar" -> "foo_bar".
*/
function protoSnakeCase(lowerCamelCase) {
return lowerCamelCase.replace(/[A-Z]/g, (letter) => "_" + letter.toLowerCase());
}
/**
* Names that cannot be used for object properties because they are reserved

@@ -88,0 +102,0 @@ * by built-in JavaScript properties.

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -328,6 +328,4 @@ // Licensed under the Apache License, Version 2.0 (the "License");

.map((p) => {
if (p.match(/_[0-9]?_/g) || p.match(/[A-Z]/g)) {
throw new Error(`cannot encode message ${val.$typeName} to JSON: lowerCamelCase of path name "` +
p +
'" is irreversible');
if ((0, names_js_1.protoSnakeCase)((0, names_js_1.protoCamelCase)(p)) !== p) {
throw new Error(`cannot encode message ${val.$typeName} to JSON: lowerCamelCase of path name "${p}" is irreversible`);
}

@@ -334,0 +332,0 @@ return (0, names_js_1.protoCamelCase)(p);

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

"use strict";
// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -4,0 +4,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -20,3 +20,3 @@ // Licensed under the Apache License, Version 2.0 (the "License");

import { formatVal } from "./reflect/reflect-check.js";
import { scalarZeroValue } from "./reflect/scalar.js";
import { protoSnakeCase } from "./reflect/names.js";
import { base64Decode } from "./wire/base64-encoding.js";

@@ -97,7 +97,3 @@ import { isWrapperDesc, anyPack, ListValueSchema, NullValue, StructSchema, ValueSchema, } from "./wkt/index.js";

export function enumFromJson(descEnum, json) {
const val = readEnum(descEnum, json, false, false);
if (val === tokenIgnoredUnknownEnum) {
throw new Error(`cannot decode ${descEnum} from JSON: ${formatVal(json)}`);
}
return val;
return readEnum(descEnum, json, false);
}

@@ -110,2 +106,14 @@ /**

}
const messageJsonFields = new WeakMap();
function getJsonField(desc, jsonKey) {
var _a;
if (!messageJsonFields.has(desc)) {
const jsonNames = new Map();
for (const field of desc.fields) {
jsonNames.set(field.name, field).set(field.jsonName, field);
}
messageJsonFields.set(desc, jsonNames);
}
return (_a = messageJsonFields.get(desc)) === null || _a === void 0 ? void 0 : _a.get(jsonKey);
}
function readMessage(msg, json, opts) {

@@ -120,8 +128,4 @@ var _a;

const oneofSeen = new Map();
const jsonNames = new Map();
for (const field of msg.desc.fields) {
jsonNames.set(field.name, field).set(field.jsonName, field);
}
for (const [jsonKey, jsonValue] of Object.entries(json)) {
const field = jsonNames.get(jsonKey);
const field = getJsonField(msg.desc, jsonKey);
if (field) {

@@ -177,2 +181,16 @@ if (field.oneof) {

}
function readListOrMapItem(field, json, opts) {
if (field.scalar && json !== null) {
return scalarFromJson(field, json);
}
if (field.message && !isResetSentinelNullValue(field, json)) {
const msgValue = reflect(field.message);
readMessage(msgValue, json, opts);
return msgValue;
}
if (field.enum && !isResetSentinelNullValue(field, json)) {
return readEnum(field.enum, json, opts.ignoreUnknownFields);
}
throw new FieldError(field, `${field.fieldKind === "list" ? "list item" : "map value"} must not be null`);
}
function readMapField(map, json, opts) {

@@ -187,24 +205,7 @@ if (json === null) {

for (const [jsonMapKey, jsonMapValue] of Object.entries(json)) {
if (jsonMapValue === null && !isSafeNullValueInListOrMap(field)) {
throw new FieldError(field, "map value must not be null");
const key = mapKeyFromJson(field.mapKey, jsonMapKey);
const value = readListOrMapItem(field, jsonMapValue, opts);
if (value !== tokenIgnoredUnknownEnum) {
map.set(key, value);
}
let value;
switch (field.mapKind) {
case "message":
const msgValue = reflect(field.message);
readMessage(msgValue, jsonMapValue, opts);
value = msgValue;
break;
case "enum":
value = readEnum(field.enum, jsonMapValue, opts.ignoreUnknownFields, true);
if (value === tokenIgnoredUnknownEnum) {
return;
}
break;
case "scalar":
value = scalarFromJson(field, jsonMapValue, true);
break;
}
const key = mapKeyFromJson(field.mapKey, jsonMapKey);
map.set(key, value);
}

@@ -221,30 +222,10 @@ }

for (const jsonItem of json) {
if (jsonItem === null && !isSafeNullValueInListOrMap(field)) {
throw new FieldError(field, "list item must not be null");
const value = readListOrMapItem(field, jsonItem, opts);
if (value !== tokenIgnoredUnknownEnum) {
list.add(value);
}
switch (field.listKind) {
case "message":
const msgValue = reflect(field.message);
readMessage(msgValue, jsonItem, opts);
list.add(msgValue);
break;
case "enum":
const enumValue = readEnum(field.enum, jsonItem, opts.ignoreUnknownFields, true);
if (enumValue !== tokenIgnoredUnknownEnum) {
list.add(enumValue);
}
break;
case "scalar":
list.add(scalarFromJson(field, jsonItem, true));
break;
}
}
}
function isSafeNullValueInListOrMap(field) {
var _a, _b;
return (((_a = field.message) === null || _a === void 0 ? void 0 : _a.typeName) == "google.protobuf.Value" ||
((_b = field.enum) === null || _b === void 0 ? void 0 : _b.typeName) == "google.protobuf.NullValue");
}
function readMessageField(msg, field, json, opts) {
if (json === null && field.message.typeName != "google.protobuf.Value") {
if (isResetSentinelNullValue(field, json)) {
msg.clear(field);

@@ -258,7 +239,8 @@ return;

function readEnumField(msg, field, json, opts) {
const enumValue = readEnum(field.enum, json, opts.ignoreUnknownFields, false);
if (enumValue === tokenNull) {
if (isResetSentinelNullValue(field, json)) {
msg.clear(field);
return;
}
else if (enumValue !== tokenIgnoredUnknownEnum) {
const enumValue = readEnum(field.enum, json, opts.ignoreUnknownFields);
if (enumValue !== tokenIgnoredUnknownEnum) {
msg.set(field, enumValue);

@@ -268,17 +250,30 @@ }

function readScalarField(msg, field, json) {
const scalarValue = scalarFromJson(field, json, false);
if (scalarValue === tokenNull) {
if (json === null) {
msg.clear(field);
}
else {
msg.set(field, scalarValue);
msg.set(field, scalarFromJson(field, json));
}
}
/**
* Indicates whether a value is a sentinel for reseting a field.
*
* For this to be true, the value must be a JSON null and the field must not
* permit a present, Protobuf-serializable null.
*
* Only message google.protobuf.Value and enum google.protobuf.NullValue fields
* permit Protobuf-serializable nulls.
*
* Note that field-resetting sentinel nulls are not permitted in lists and maps.
*/
function isResetSentinelNullValue(field, json) {
var _a, _b;
return (json === null &&
((_a = field.message) === null || _a === void 0 ? void 0 : _a.typeName) != "google.protobuf.Value" &&
((_b = field.enum) === null || _b === void 0 ? void 0 : _b.typeName) != "google.protobuf.NullValue");
}
const tokenIgnoredUnknownEnum = Symbol();
function readEnum(desc, json, ignoreUnknownFields, nullAsZeroValue) {
function readEnum(desc, json, ignoreUnknownFields) {
if (json === null) {
if (desc.typeName == "google.protobuf.NullValue") {
return 0; // google.protobuf.NullValue.NULL_VALUE = 0
}
return nullAsZeroValue ? desc.values[0].number : tokenNull;
return desc.values[0].number;
}

@@ -303,10 +298,9 @@ switch (typeof json) {

}
const tokenNull = Symbol();
function scalarFromJson(field, json, nullAsZeroValue) {
if (json === null) {
if (nullAsZeroValue) {
return scalarZeroValue(field.scalar, false);
}
return tokenNull;
}
/**
* Try to parse a JSON value to a scalar value for the reflect API.
*
* Returns the input if the JSON value cannot be converted. Raises a FieldError
* if conversion would be ambiguous.
*/
function scalarFromJson(field, json) {
// int64, sfixed64, sint64, fixed64, uint64: Reflect supports string and number.

@@ -384,6 +378,6 @@ // string, bool: Supported by reflect.

*/
function mapKeyFromJson(type, json) {
function mapKeyFromJson(type, jsonString) {
switch (type) {
case ScalarType.BOOL:
switch (json) {
switch (jsonString) {
case "true":

@@ -394,3 +388,3 @@ return true;

}
return json;
return jsonString;
case ScalarType.INT32:

@@ -401,5 +395,5 @@ case ScalarType.FIXED32:

case ScalarType.SINT32:
return int32FromJson(json);
return int32FromJson(jsonString);
default:
return json;
return jsonString;
}

@@ -475,3 +469,3 @@ }

else {
msg.set(valueField, scalarFromJson(valueField, jsonValue, true));
msg.set(valueField, scalarFromJson(valueField, jsonValue));
}

@@ -574,10 +568,8 @@ return true;

}
function camelToSnake(str) {
if (str.includes("_")) {
fieldMask.paths = json.split(",").map((path) => {
if (path.includes("_")) {
throw new Error(`cannot decode message ${fieldMask.$typeName} from JSON: path names must be lowerCamelCase`);
}
const sc = str.replace(/[A-Z]/g, (letter) => "_" + letter.toLowerCase());
return sc[0] === "_" ? sc.substring(1) : sc;
}
fieldMask.paths = json.split(",").map(camelToSnake);
return protoSnakeCase(path);
});
}

@@ -584,0 +576,0 @@ function structFromJson(struct, json) {

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -12,5 +12,16 @@ import type { AnyDesc } from "../descriptors.js";

* used by protoc to convert a field name to a JSON name.
*
* See https://protobuf.com/docs/language-spec#default-json-names
*
* The function protoSnakeCase provides the reverse.
*/
export declare function protoCamelCase(snakeCase: string): string;
/**
* Converts protoCamelCase to snake_case.
*
* This function is the reverse of function protoCamelCase. Note that some names
* are not reversible - for example, "foo__bar" -> "fooBar" -> "foo_bar".
*/
export declare function protoSnakeCase(lowerCamelCase: string): string;
/**
* Escapes names that are reserved for ECMAScript built-in object properties.

@@ -17,0 +28,0 @@ *

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -44,2 +44,6 @@ // Licensed under the Apache License, Version 2.0 (the "License");

* used by protoc to convert a field name to a JSON name.
*
* See https://protobuf.com/docs/language-spec#default-json-names
*
* The function protoSnakeCase provides the reverse.
*/

@@ -80,2 +84,11 @@ export function protoCamelCase(snakeCase) {

/**
* Converts protoCamelCase to snake_case.
*
* This function is the reverse of function protoCamelCase. Note that some names
* are not reversible - for example, "foo__bar" -> "fooBar" -> "foo_bar".
*/
export function protoSnakeCase(lowerCamelCase) {
return lowerCamelCase.replace(/[A-Z]/g, (letter) => "_" + letter.toLowerCase());
}
/**
* Names that cannot be used for object properties because they are reserved

@@ -82,0 +95,0 @@ * by built-in JavaScript properties.

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -15,3 +15,3 @@ // Licensed under the Apache License, Version 2.0 (the "License");

import { ScalarType, } from "./descriptors.js";
import { protoCamelCase } from "./reflect/names.js";
import { protoCamelCase, protoSnakeCase } from "./reflect/names.js";
import { reflect } from "./reflect/reflect.js";

@@ -324,6 +324,4 @@ import { anyUnpack } from "./wkt/index.js";

.map((p) => {
if (p.match(/_[0-9]?_/g) || p.match(/[A-Z]/g)) {
throw new Error(`cannot encode message ${val.$typeName} to JSON: lowerCamelCase of path name "` +
p +
'" is irreversible');
if (protoSnakeCase(protoCamelCase(p)) !== p) {
throw new Error(`cannot encode message ${val.$typeName} to JSON: lowerCamelCase of path name "${p}" is irreversible`);
}

@@ -330,0 +328,0 @@ return protoCamelCase(p);

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

@@ -1,2 +0,2 @@

// Copyright 2021-2025 Buf Technologies, Inc.
// Copyright 2021-2026 Buf Technologies, Inc.
//

@@ -3,0 +3,0 @@ // Licensed under the Apache License, Version 2.0 (the "License");

{
"name": "@bufbuild/protobuf",
"version": "2.10.2",
"version": "2.11.0",
"license": "(Apache-2.0 AND BSD-3-Clause)",

@@ -5,0 +5,0 @@ "description": "A complete implementation of Protocol Buffers in TypeScript, suitable for web browsers and Node.js.",

Sorry, the diff of this file is too big to display