@bufbuild/protobuf
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.clone = void 0; | ||
exports.clone = clone; | ||
const descriptors_js_1 = require("./descriptors.js"); | ||
@@ -27,3 +27,2 @@ const reflect_js_1 = require("./reflect/reflect.js"); | ||
} | ||
exports.clone = clone; | ||
function cloneReflect(i) { | ||
@@ -30,0 +29,0 @@ const o = (0, reflect_js_1.reflect)(i.desc); |
@@ -16,3 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.bootFileDescriptorProto = exports.boot = void 0; | ||
exports.boot = boot; | ||
exports.bootFileDescriptorProto = bootFileDescriptorProto; | ||
const restore_json_names_js_1 = require("./restore-json-names.js"); | ||
@@ -35,3 +36,2 @@ const registry_js_1 = require("../registry.js"); | ||
} | ||
exports.boot = boot; | ||
/** | ||
@@ -51,3 +51,2 @@ * Creates the message google.protobuf.FileDescriptorProto from an object literal. | ||
} | ||
exports.bootFileDescriptorProto = bootFileDescriptorProto; | ||
function bootDescriptorProto(init) { | ||
@@ -54,0 +53,0 @@ var _a, _b, _c, _d, _e, _f, _g, _h; |
@@ -16,3 +16,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createFileDescriptorProtoBoot = exports.pathInFileDesc = exports.embedFileDesc = void 0; | ||
exports.embedFileDesc = embedFileDesc; | ||
exports.pathInFileDesc = pathInFileDesc; | ||
exports.createFileDescriptorProtoBoot = createFileDescriptorProtoBoot; | ||
const names_js_1 = require("../reflect/names.js"); | ||
@@ -50,3 +52,2 @@ const fields_js_1 = require("../fields.js"); | ||
} | ||
exports.embedFileDesc = embedFileDesc; | ||
function stripJsonNames(d) { | ||
@@ -104,3 +105,2 @@ for (const f of d.field) { | ||
} | ||
exports.pathInFileDesc = pathInFileDesc; | ||
/** | ||
@@ -141,3 +141,2 @@ * The file descriptor for google/protobuf/descriptor.proto cannot be embedded | ||
} | ||
exports.createFileDescriptorProtoBoot = createFileDescriptorProtoBoot; | ||
function createDescriptorBoot(proto) { | ||
@@ -144,0 +143,0 @@ assert(proto.extension.length == 0); |
import type { DescEnum, DescFile } from "../descriptors.js"; | ||
import type { GenDescEnum } from "./types.js"; | ||
import type { GenEnum } from "./types.js"; | ||
import type { JsonValue } from "../json-value.js"; | ||
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
export declare function enumDesc<Shape, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenDescEnum<Shape, JsonType>; | ||
export declare function enumDesc<Shape extends number, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenEnum<Shape, JsonType>; | ||
/** | ||
@@ -12,0 +12,0 @@ * Construct a TypeScript enum object at runtime from a descriptor. |
@@ -16,3 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.tsEnum = exports.enumDesc = void 0; | ||
exports.enumDesc = enumDesc; | ||
exports.tsEnum = tsEnum; | ||
/** | ||
@@ -30,3 +31,2 @@ * Hydrate an enum descriptor. | ||
} | ||
exports.enumDesc = enumDesc; | ||
/** | ||
@@ -43,2 +43,1 @@ * Construct a TypeScript enum object at runtime from a descriptor. | ||
} | ||
exports.tsEnum = tsEnum; |
import type { Message } from "../types.js"; | ||
import type { DescFile } from "../descriptors.js"; | ||
import type { GenDescExtension } from "./types.js"; | ||
import type { GenExtension } from "./types.js"; | ||
/** | ||
@@ -9,2 +9,2 @@ * Hydrate an extension descriptor. | ||
*/ | ||
export declare function extDesc<Extendee extends Message, Value>(file: DescFile, path: number, ...paths: number[]): GenDescExtension<Extendee, Value>; | ||
export declare function extDesc<Extendee extends Message, Value>(file: DescFile, path: number, ...paths: number[]): GenExtension<Extendee, Value>; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.extDesc = void 0; | ||
exports.extDesc = extDesc; | ||
/** | ||
@@ -30,2 +30,1 @@ * Hydrate an extension descriptor. | ||
} | ||
exports.extDesc = extDesc; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fileDesc = void 0; | ||
exports.fileDesc = fileDesc; | ||
const base64_encoding_js_1 = require("../wire/base64-encoding.js"); | ||
@@ -37,2 +37,1 @@ const descriptor_pb_js_1 = require("../wkt/gen/google/protobuf/descriptor_pb.js"); | ||
} | ||
exports.fileDesc = fileDesc; |
import type { Message } from "../types.js"; | ||
import type { DescFile } from "../descriptors.js"; | ||
import type { GenDescMessage } from "./types.js"; | ||
import type { GenMessage } from "./types.js"; | ||
import type { JsonValue } from "../json-value.js"; | ||
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export declare function messageDesc<Shape extends Message, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenDescMessage<Shape, JsonType>; | ||
export declare function messageDesc<Shape extends Message, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenMessage<Shape, JsonType>; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.messageDesc = void 0; | ||
exports.messageDesc = messageDesc; | ||
/** | ||
@@ -26,2 +26,1 @@ * Hydrate a message descriptor. | ||
} | ||
exports.messageDesc = messageDesc; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.restoreJsonNames = void 0; | ||
exports.restoreJsonNames = restoreJsonNames; | ||
const names_js_1 = require("../reflect/names.js"); | ||
@@ -31,2 +31,1 @@ const unsafe_js_1 = require("../reflect/unsafe.js"); | ||
} | ||
exports.restoreJsonNames = restoreJsonNames; |
@@ -16,3 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.scalarJsonType = exports.scalarTypeScriptType = void 0; | ||
exports.scalarTypeScriptType = scalarTypeScriptType; | ||
exports.scalarJsonType = scalarJsonType; | ||
const descriptors_js_1 = require("../descriptors.js"); | ||
@@ -40,3 +41,2 @@ /** | ||
} | ||
exports.scalarTypeScriptType = scalarTypeScriptType; | ||
/** | ||
@@ -70,2 +70,1 @@ * Return the JSON type (as a string) for the given scalar type. | ||
} | ||
exports.scalarJsonType = scalarJsonType; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescService, GenDescServiceMethods } from "./types.js"; | ||
import type { GenService, GenServiceMethods } from "./types.js"; | ||
import type { DescFile } from "../descriptors.js"; | ||
@@ -8,2 +8,2 @@ /** | ||
*/ | ||
export declare function serviceDesc<T extends GenDescServiceMethods>(file: DescFile, path: number, ...paths: number[]): GenDescService<T>; | ||
export declare function serviceDesc<T extends GenServiceMethods>(file: DescFile, path: number, ...paths: number[]): GenService<T>; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.serviceDesc = void 0; | ||
exports.serviceDesc = serviceDesc; | ||
/** | ||
@@ -29,2 +29,1 @@ * Hydrate a service descriptor. | ||
} | ||
exports.serviceDesc = serviceDesc; |
@@ -109,3 +109,3 @@ /** | ||
}; | ||
readonly GenDescFile: { | ||
readonly GenFile: { | ||
readonly typeOnly: true; | ||
@@ -115,3 +115,3 @@ readonly bootstrapWktFrom: "../../codegenv1/types.js"; | ||
}; | ||
readonly GenDescEnum: { | ||
readonly GenEnum: { | ||
readonly typeOnly: true; | ||
@@ -121,3 +121,3 @@ readonly bootstrapWktFrom: "../../codegenv1/types.js"; | ||
}; | ||
readonly GenDescExtension: { | ||
readonly GenExtension: { | ||
readonly typeOnly: true; | ||
@@ -127,3 +127,3 @@ readonly bootstrapWktFrom: "../../codegenv1/types.js"; | ||
}; | ||
readonly GenDescMessage: { | ||
readonly GenMessage: { | ||
readonly typeOnly: true; | ||
@@ -133,3 +133,3 @@ readonly bootstrapWktFrom: "../../codegenv1/types.js"; | ||
}; | ||
readonly GenDescService: { | ||
readonly GenService: { | ||
readonly typeOnly: true; | ||
@@ -136,0 +136,0 @@ readonly bootstrapWktFrom: "../../codegenv1/types.js"; |
@@ -63,8 +63,8 @@ "use strict"; | ||
tsEnum: { typeOnly: false, bootstrapWktFrom: "../../codegenv1/enum.js", from: exports.packageName + "/codegenv1" }, | ||
GenDescFile: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" }, | ||
GenDescEnum: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" }, | ||
GenDescExtension: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" }, | ||
GenDescMessage: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" }, | ||
GenDescService: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" }, | ||
GenFile: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" }, | ||
GenEnum: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" }, | ||
GenExtension: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" }, | ||
GenMessage: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" }, | ||
GenService: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: exports.packageName + "/codegenv1" }, | ||
}, | ||
}; |
import type { Message } from "../types.js"; | ||
import type { DescEnum, DescExtension, DescField, DescFile, DescMessage, DescMethod, DescService } from "../descriptors.js"; | ||
import type { DescEnum, DescEnumValue, DescExtension, DescField, DescFile, DescMessage, DescMethod, DescService } from "../descriptors.js"; | ||
import type { JsonValue } from "../json-value.js"; | ||
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
export type GenDescFile = DescFile; | ||
export type GenFile = DescFile; | ||
/** | ||
@@ -19,3 +19,3 @@ * Describes a message declaration in a protobuf source file. | ||
*/ | ||
export type GenDescMessage<RuntimeShape extends Message, JsonType = JsonValue> = Omit<DescMessage, "field"> & { | ||
export type GenMessage<RuntimeShape extends Message, JsonType = JsonValue> = Omit<DescMessage, "field"> & { | ||
field: Record<MessageFieldNames<RuntimeShape>, DescField>; | ||
@@ -31,3 +31,5 @@ } & brandv1<RuntimeShape, JsonType>; | ||
*/ | ||
export type GenDescEnum<RuntimeShape, JsonType extends JsonValue = JsonValue> = DescEnum & brandv1<RuntimeShape, JsonType>; | ||
export type GenEnum<RuntimeShape extends number, JsonType extends JsonValue = JsonValue> = Omit<DescEnum, "value"> & { | ||
value: Record<RuntimeShape, DescEnumValue>; | ||
} & brandv1<RuntimeShape, JsonType>; | ||
/** | ||
@@ -41,3 +43,3 @@ * Describes an extension in a protobuf source file. | ||
*/ | ||
export type GenDescExtension<Extendee extends Message = Message, RuntimeShape = unknown> = DescExtension & brandv1<Extendee, RuntimeShape>; | ||
export type GenExtension<Extendee extends Message = Message, RuntimeShape = unknown> = DescExtension & brandv1<Extendee, RuntimeShape>; | ||
/** | ||
@@ -51,3 +53,3 @@ * Describes a service declaration in a protobuf source file. | ||
*/ | ||
export type GenDescService<RuntimeShape extends GenDescServiceMethods> = Omit<DescService, "method"> & { | ||
export type GenService<RuntimeShape extends GenServiceMethods> = Omit<DescService, "method"> & { | ||
method: { | ||
@@ -60,3 +62,3 @@ [K in keyof RuntimeShape]: RuntimeShape[K] & DescMethod; | ||
*/ | ||
export type GenDescServiceMethods = Record<string, Pick<DescMethod, "input" | "output" | "methodKind">>; | ||
export type GenServiceMethods = Record<string, Pick<DescMethod, "input" | "output" | "methodKind">>; | ||
declare class brandv1<A, B = unknown> { | ||
@@ -63,0 +65,0 @@ protected v: "codegenv1"; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.create = void 0; | ||
exports.create = create; | ||
const is_message_js_1 = require("./is-message.js"); | ||
@@ -46,3 +46,2 @@ const descriptors_js_1 = require("./descriptors.js"); | ||
} | ||
exports.create = create; | ||
/** | ||
@@ -157,3 +156,5 @@ * Sets field values from a MessageInitShape on a zero message. | ||
if (!needsPrototypeChain(desc)) { | ||
msg = {}; | ||
msg = { | ||
$typeName: desc.typeName, | ||
}; | ||
for (const member of desc.members) { | ||
@@ -198,2 +199,3 @@ if (member.kind == "oneof" || member.presence == IMPLICIT) { | ||
msg = Object.create(prototype); | ||
msg.$typeName = desc.typeName; | ||
for (const member of desc.members) { | ||
@@ -216,3 +218,2 @@ if (members.has(member)) { | ||
} | ||
msg.$typeName = desc.typeName; | ||
return msg; | ||
@@ -219,0 +220,0 @@ } |
@@ -110,2 +110,6 @@ import type { DescriptorProto, Edition, EnumDescriptorProto, EnumValueDescriptorProto, FeatureSet_FieldPresence, FieldDescriptorProto, FileDescriptorProto, MethodDescriptorProto, MethodOptions_IdempotencyLevel, OneofDescriptorProto, ServiceDescriptorProto } from "./wkt/gen/google/protobuf/descriptor_pb.js"; | ||
/** | ||
* All values of this enum by their number. | ||
*/ | ||
readonly value: Record<number, DescEnumValue>; | ||
/** | ||
* A prefix shared by all enum values. | ||
@@ -112,0 +116,0 @@ * For example, `my_enum_` for `enum MyEnum {MY_ENUM_A=0; MY_ENUM_B=1;}` |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.equals = void 0; | ||
exports.equals = equals; | ||
const scalar_js_1 = require("./reflect/scalar.js"); | ||
@@ -35,3 +35,2 @@ const reflect_js_1 = require("./reflect/reflect.js"); | ||
} | ||
exports.equals = equals; | ||
function reflectEquals(a, b) { | ||
@@ -38,0 +37,0 @@ for (const f of a.fields) { |
@@ -16,3 +16,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createExtensionContainer = exports.getOption = exports.hasOption = exports.hasExtension = exports.clearExtension = exports.setExtension = exports.getExtension = void 0; | ||
exports.getExtension = getExtension; | ||
exports.setExtension = setExtension; | ||
exports.clearExtension = clearExtension; | ||
exports.hasExtension = hasExtension; | ||
exports.hasOption = hasOption; | ||
exports.getOption = getOption; | ||
exports.createExtensionContainer = createExtensionContainer; | ||
const create_js_1 = require("./create.js"); | ||
@@ -50,3 +56,2 @@ const from_binary_js_1 = require("./from-binary.js"); | ||
} | ||
exports.getExtension = getExtension; | ||
/** | ||
@@ -73,3 +78,2 @@ * Set an extension value on a message. If the message already has a value for | ||
} | ||
exports.setExtension = setExtension; | ||
/** | ||
@@ -87,3 +91,2 @@ * Remove an extension value from a message. | ||
} | ||
exports.clearExtension = clearExtension; | ||
/** | ||
@@ -97,3 +100,2 @@ * Check whether an extension is set on a message. | ||
} | ||
exports.hasExtension = hasExtension; | ||
/** | ||
@@ -113,3 +115,2 @@ * Check whether an option is set on a descriptor. | ||
} | ||
exports.hasOption = hasOption; | ||
/** | ||
@@ -131,3 +132,2 @@ * Retrieve an option value from a descriptor. | ||
} | ||
exports.getOption = getOption; | ||
function filterUnknownFields(unknownFields, extension) { | ||
@@ -172,3 +172,2 @@ if (unknownFields === undefined) | ||
} | ||
exports.createExtensionContainer = createExtensionContainer; | ||
function assertExtendee(extension, message) { | ||
@@ -175,0 +174,0 @@ if (extension.extendee.typeName != message.$typeName) { |
@@ -16,3 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.clearField = exports.isFieldSet = void 0; | ||
exports.isFieldSet = isFieldSet; | ||
exports.clearField = clearField; | ||
const unsafe_js_1 = require("./reflect/unsafe.js"); | ||
@@ -38,3 +39,2 @@ /** | ||
} | ||
exports.isFieldSet = isFieldSet; | ||
/** | ||
@@ -48,2 +48,1 @@ * Resets the field, so that isFieldSet() will return false. | ||
} | ||
exports.clearField = clearField; |
@@ -16,3 +16,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.readField = exports.mergeFromBinary = exports.fromBinary = void 0; | ||
exports.fromBinary = fromBinary; | ||
exports.mergeFromBinary = mergeFromBinary; | ||
exports.readField = readField; | ||
const descriptors_js_1 = require("./descriptors.js"); | ||
@@ -37,3 +39,2 @@ const scalar_js_1 = require("./reflect/scalar.js"); | ||
} | ||
exports.fromBinary = fromBinary; | ||
/** | ||
@@ -52,3 +53,2 @@ * Parse from binary data, merging fields. | ||
} | ||
exports.mergeFromBinary = mergeFromBinary; | ||
/** | ||
@@ -113,3 +113,2 @@ * If `delimited` is false, read the length given in `lengthOrDelimitedFieldNo`. | ||
} | ||
exports.readField = readField; | ||
// Read a map field, expecting key field = 1, value field = 2 | ||
@@ -116,0 +115,0 @@ function readMapEntry(reader, map, options) { |
@@ -16,3 +16,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isEnumJson = exports.enumFromJson = exports.mergeFromJson = exports.fromJson = exports.mergeFromJsonString = exports.fromJsonString = void 0; | ||
exports.fromJsonString = fromJsonString; | ||
exports.mergeFromJsonString = mergeFromJsonString; | ||
exports.fromJson = fromJson; | ||
exports.mergeFromJson = mergeFromJson; | ||
exports.enumFromJson = enumFromJson; | ||
exports.isEnumJson = isEnumJson; | ||
/* eslint-disable no-case-declarations,@typescript-eslint/restrict-template-expressions */ | ||
@@ -42,3 +47,2 @@ const descriptors_js_1 = require("./descriptors.js"); | ||
} | ||
exports.fromJsonString = fromJsonString; | ||
/** | ||
@@ -56,3 +60,2 @@ * Parse a message from a JSON string, merging fields. | ||
} | ||
exports.mergeFromJsonString = mergeFromJsonString; | ||
/** | ||
@@ -77,3 +80,2 @@ * Parse a message from a JSON value. | ||
} | ||
exports.fromJson = fromJson; | ||
/** | ||
@@ -103,3 +105,2 @@ * Parse a message from a JSON value, merging fields. | ||
} | ||
exports.mergeFromJson = mergeFromJson; | ||
/** | ||
@@ -115,3 +116,2 @@ * Parses an enum value from JSON. | ||
} | ||
exports.enumFromJson = enumFromJson; | ||
/** | ||
@@ -123,3 +123,2 @@ * Is the given value a JSON enum value? | ||
} | ||
exports.isEnumJson = isEnumJson; | ||
function readMessage(msg, json, opts) { | ||
@@ -126,0 +125,0 @@ var _a; |
@@ -16,3 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isMessage = void 0; | ||
exports.isMessage = isMessage; | ||
/** | ||
@@ -35,2 +35,1 @@ * Determine whether the given `arg` is a message. | ||
} | ||
exports.isMessage = isMessage; |
@@ -16,3 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isFieldError = exports.FieldError = void 0; | ||
exports.FieldError = void 0; | ||
exports.isFieldError = isFieldError; | ||
const errorNames = [ | ||
@@ -37,2 +38,1 @@ "FieldValueInvalidError", | ||
} | ||
exports.isFieldError = isFieldError; |
@@ -16,3 +16,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isReflectMessage = exports.isReflectMap = exports.isReflectList = exports.isOneofADT = exports.isObject = void 0; | ||
exports.isObject = isObject; | ||
exports.isOneofADT = isOneofADT; | ||
exports.isReflectList = isReflectList; | ||
exports.isReflectMap = isReflectMap; | ||
exports.isReflectMessage = isReflectMessage; | ||
const unsafe_js_1 = require("./unsafe.js"); | ||
@@ -22,3 +26,2 @@ function isObject(arg) { | ||
} | ||
exports.isObject = isObject; | ||
function isOneofADT(arg) { | ||
@@ -32,3 +35,2 @@ return (arg !== null && | ||
} | ||
exports.isOneofADT = isOneofADT; | ||
function isReflectList(arg, field) { | ||
@@ -52,3 +54,2 @@ var _a, _b, _c, _d; | ||
} | ||
exports.isReflectList = isReflectList; | ||
function isReflectMap(arg, field) { | ||
@@ -73,3 +74,2 @@ var _a, _b, _c, _d; | ||
} | ||
exports.isReflectMap = isReflectMap; | ||
function isReflectMessage(arg, messageDesc) { | ||
@@ -83,2 +83,1 @@ return (isObject(arg) && | ||
} | ||
exports.isReflectMessage = isReflectMessage; |
@@ -16,3 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.safeObjectProperty = exports.protoCamelCase = void 0; | ||
exports.protoCamelCase = protoCamelCase; | ||
exports.safeObjectProperty = safeObjectProperty; | ||
/** | ||
@@ -55,3 +56,2 @@ * Converts snake_case to protoCamelCase according to the convention | ||
} | ||
exports.protoCamelCase = protoCamelCase; | ||
/** | ||
@@ -76,2 +76,1 @@ * Names that cannot be used for object properties because they are reserved | ||
} | ||
exports.safeObjectProperty = safeObjectProperty; |
@@ -16,3 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parentTypes = exports.nestedTypes = void 0; | ||
exports.nestedTypes = nestedTypes; | ||
exports.parentTypes = parentTypes; | ||
/** | ||
@@ -43,3 +44,2 @@ * Iterate over all types - enumerations, extensions, services, messages - | ||
} | ||
exports.nestedTypes = nestedTypes; | ||
/** | ||
@@ -57,3 +57,2 @@ * Returns the ancestors of a given Protobuf element, up to the file. | ||
} | ||
exports.parentTypes = parentTypes; | ||
function parent(desc) { | ||
@@ -60,0 +59,0 @@ var _a; |
@@ -16,3 +16,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.formatVal = exports.checkMapEntry = exports.checkListItem = exports.checkField = void 0; | ||
exports.checkField = checkField; | ||
exports.checkListItem = checkListItem; | ||
exports.checkMapEntry = checkMapEntry; | ||
exports.formatVal = formatVal; | ||
const descriptors_js_1 = require("../descriptors.js"); | ||
@@ -51,3 +54,2 @@ const is_message_js_1 = require("../is-message.js"); | ||
} | ||
exports.checkField = checkField; | ||
/** | ||
@@ -63,3 +65,2 @@ * Check whether the given list item is valid for the reflect API. | ||
} | ||
exports.checkListItem = checkListItem; | ||
/** | ||
@@ -79,3 +80,2 @@ * Check whether the given map key and value are valid for the reflect API. | ||
} | ||
exports.checkMapEntry = checkMapEntry; | ||
function checkSingular(field, value) { | ||
@@ -220,3 +220,2 @@ if (field.scalar !== undefined) { | ||
} | ||
exports.formatVal = formatVal; | ||
function formatReflectMessage(desc) { | ||
@@ -223,0 +222,0 @@ return `ReflectMessage (${desc.typeName})`; |
@@ -16,3 +16,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.reflectMap = exports.reflectList = exports.reflect = void 0; | ||
exports.reflect = reflect; | ||
exports.reflectList = reflectList; | ||
exports.reflectMap = reflectMap; | ||
const descriptors_js_1 = require("../descriptors.js"); | ||
@@ -41,3 +43,2 @@ const reflect_check_js_1 = require("./reflect-check.js"); | ||
} | ||
exports.reflect = reflect; | ||
class ReflectMessageImpl { | ||
@@ -152,3 +153,2 @@ get sortedFields() { | ||
} | ||
exports.reflectList = reflectList; | ||
class ReflectListImpl { | ||
@@ -228,3 +228,2 @@ field() { | ||
} | ||
exports.reflectMap = reflectMap; | ||
class ReflectMapImpl { | ||
@@ -231,0 +230,0 @@ constructor(field, unsafeInput, check = true) { |
@@ -16,3 +16,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isScalarZeroValue = exports.scalarZeroValue = exports.scalarEquals = void 0; | ||
exports.scalarEquals = scalarEquals; | ||
exports.scalarZeroValue = scalarZeroValue; | ||
exports.isScalarZeroValue = isScalarZeroValue; | ||
const proto_int64_js_1 = require("../proto-int64.js"); | ||
@@ -58,3 +60,2 @@ const descriptors_js_1 = require("../descriptors.js"); | ||
} | ||
exports.scalarEquals = scalarEquals; | ||
/** | ||
@@ -86,3 +87,2 @@ * Returns the zero value for the given scalar type. | ||
} | ||
exports.scalarZeroValue = scalarZeroValue; | ||
/** | ||
@@ -107,2 +107,1 @@ * Returns true for a zero-value. For example, an integer has the zero-value `0`, | ||
} | ||
exports.isScalarZeroValue = isScalarZeroValue; |
@@ -16,3 +16,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.unsafeClear = exports.unsafeSet = exports.unsafeGet = exports.unsafeIsSetExplicit = exports.unsafeIsSet = exports.unsafeOneofCase = exports.unsafeLocal = void 0; | ||
exports.unsafeLocal = void 0; | ||
exports.unsafeOneofCase = unsafeOneofCase; | ||
exports.unsafeIsSet = unsafeIsSet; | ||
exports.unsafeIsSetExplicit = unsafeIsSetExplicit; | ||
exports.unsafeGet = unsafeGet; | ||
exports.unsafeSet = unsafeSet; | ||
exports.unsafeClear = unsafeClear; | ||
const scalar_js_1 = require("./scalar.js"); | ||
@@ -35,3 +41,2 @@ // bootstrap-inject google.protobuf.FeatureSet.FieldPresence.IMPLICIT: const $name: FeatureSet_FieldPresence.$localName = $number; | ||
} | ||
exports.unsafeOneofCase = unsafeOneofCase; | ||
/** | ||
@@ -67,3 +72,2 @@ * Returns true if the field is set. | ||
} | ||
exports.unsafeIsSet = unsafeIsSet; | ||
/** | ||
@@ -79,3 +83,2 @@ * Returns true if the field is set, but only for singular fields with explicit | ||
} | ||
exports.unsafeIsSetExplicit = unsafeIsSetExplicit; | ||
/** | ||
@@ -96,3 +99,2 @@ * Return a field value, respecting oneof groups. | ||
} | ||
exports.unsafeGet = unsafeGet; | ||
/** | ||
@@ -114,3 +116,2 @@ * Set a field value, respecting oneof groups. | ||
} | ||
exports.unsafeSet = unsafeSet; | ||
/** | ||
@@ -154,2 +155,1 @@ * Resets the field, so that unsafeIsSet() will return false. | ||
} | ||
exports.unsafeClear = unsafeClear; |
@@ -16,3 +16,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.maximumEdition = exports.minimumEdition = exports.createFileRegistry = exports.createMutableRegistry = exports.createRegistry = void 0; | ||
exports.maximumEdition = exports.minimumEdition = void 0; | ||
exports.createRegistry = createRegistry; | ||
exports.createMutableRegistry = createMutableRegistry; | ||
exports.createFileRegistry = createFileRegistry; | ||
const descriptors_js_1 = require("./descriptors.js"); | ||
@@ -37,3 +40,2 @@ const text_format_js_1 = require("./wire/text-format.js"); | ||
} | ||
exports.createRegistry = createRegistry; | ||
/** | ||
@@ -52,5 +54,7 @@ * Create a registry that allows adding and removing descriptors. | ||
} | ||
exports.createMutableRegistry = createMutableRegistry; | ||
function createFileRegistry(...args) { | ||
const registry = createBaseRegistry(); | ||
if (!args.length) { | ||
return registry; | ||
} | ||
if ("$typeName" in args[0] && | ||
@@ -104,3 +108,2 @@ args[0].$typeName == "google.protobuf.FileDescriptorSet") { | ||
} | ||
exports.createFileRegistry = createFileRegistry; | ||
/** | ||
@@ -389,2 +392,3 @@ * @private | ||
typeName: makeTypeName(proto, parent, file), | ||
value: {}, | ||
values: [], | ||
@@ -401,3 +405,3 @@ sharedPrefix, | ||
const name = proto.name; | ||
desc.values.push({ | ||
desc.values.push((desc.value[proto.number] = { | ||
kind: "enum_value", | ||
@@ -407,9 +411,11 @@ proto, | ||
parent: desc, | ||
name: proto.name, | ||
localName: (0, names_js_1.safeObjectProperty)(sharedPrefix == undefined ? name : name.substring(sharedPrefix.length)), | ||
name, | ||
localName: (0, names_js_1.safeObjectProperty)(sharedPrefix == undefined | ||
? name | ||
: name.substring(sharedPrefix.length)), | ||
number: proto.number, | ||
toString() { | ||
return `enum value ${desc.typeName}.${this.name}`; | ||
return `enum value ${desc.typeName}.${name}`; | ||
}, | ||
}); | ||
})); | ||
}); | ||
@@ -416,0 +422,0 @@ ((_c = parent === null || parent === void 0 ? void 0 : parent.nestedEnums) !== null && _c !== void 0 ? _c : file.enums).push(desc); |
@@ -16,3 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.writeField = exports.toBinary = void 0; | ||
exports.toBinary = toBinary; | ||
exports.writeField = writeField; | ||
const reflect_js_1 = require("./reflect/reflect.js"); | ||
@@ -33,3 +34,2 @@ const binary_encoding_js_1 = require("./wire/binary-encoding.js"); | ||
} | ||
exports.toBinary = toBinary; | ||
function writeFields(writer, opts, msg) { | ||
@@ -76,3 +76,2 @@ var _a; | ||
} | ||
exports.writeField = writeField; | ||
function writeScalar(writer, scalarType, fieldNo, value) { | ||
@@ -79,0 +78,0 @@ writeScalarValue(writer.tag(fieldNo, writeTypeOfScalar(scalarType)), scalarType, value); |
@@ -16,3 +16,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.enumToJson = exports.toJsonString = exports.toJson = void 0; | ||
exports.toJson = toJson; | ||
exports.toJsonString = toJsonString; | ||
exports.enumToJson = enumToJson; | ||
const descriptors_js_1 = require("./descriptors.js"); | ||
@@ -47,3 +49,2 @@ const names_js_1 = require("./reflect/names.js"); | ||
} | ||
exports.toJson = toJson; | ||
/** | ||
@@ -57,3 +58,2 @@ * Serialize the message to a JSON string. | ||
} | ||
exports.toJsonString = toJsonString; | ||
/** | ||
@@ -67,3 +67,3 @@ * Serialize a single enum value to JSON. | ||
} | ||
const name = (_a = descEnum.values.find((v) => v.number === value)) === null || _a === void 0 ? void 0 : _a.name; | ||
const name = (_a = descEnum.value[value]) === null || _a === void 0 ? void 0 : _a.name; | ||
if (name === undefined) { | ||
@@ -74,3 +74,2 @@ throw new Error(`${String(value)} is not a value in ${descEnum.toString()}`); | ||
} | ||
exports.enumToJson = enumToJson; | ||
function reflectToJson(msg, opts) { | ||
@@ -188,3 +187,3 @@ var _a; | ||
} | ||
const val = desc.values.find((v) => v.number == value); | ||
const val = desc.value[value]; | ||
return (_a = val === null || val === void 0 ? void 0 : val.name) !== null && _a !== void 0 ? _a : value; // if we don't know the enum value, just return the number | ||
@@ -191,0 +190,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { GenDescEnum, GenDescExtension, GenDescMessage } from "./codegenv1/types.js"; | ||
import type { GenEnum, GenExtension, GenMessage } from "./codegenv1/types.js"; | ||
import type { DescEnum, DescExtension, DescMessage } from "./descriptors.js"; | ||
@@ -22,7 +22,7 @@ import type { OneofADT } from "./reflect/guard.js"; | ||
*/ | ||
export type MessageShape<Desc extends DescMessage> = Desc extends GenDescMessage<infer RuntimeShape> ? RuntimeShape : Message; | ||
export type MessageShape<Desc extends DescMessage> = Desc extends GenMessage<infer RuntimeShape> ? RuntimeShape : Message; | ||
/** | ||
* Extract the message JSON type from a message descriptor. | ||
*/ | ||
export type MessageJsonType<Desc extends DescMessage> = Desc extends GenDescMessage<Message, infer JsonType> ? JsonType : JsonValue; | ||
export type MessageJsonType<Desc extends DescMessage> = Desc extends GenMessage<Message, infer JsonType> ? JsonType : JsonValue; | ||
/** | ||
@@ -32,19 +32,19 @@ * Extract the init type from a message descriptor. | ||
*/ | ||
export type MessageInitShape<Desc extends DescMessage> = Desc extends GenDescMessage<infer RuntimeShape> ? RuntimeShape | MessageInit<RuntimeShape> : Record<string, unknown>; | ||
export type MessageInitShape<Desc extends DescMessage> = Desc extends GenMessage<infer RuntimeShape> ? RuntimeShape | MessageInit<RuntimeShape> : Record<string, unknown>; | ||
/** | ||
* Extract the enum type of from an enum descriptor. | ||
*/ | ||
export type EnumShape<Desc extends DescEnum> = Desc extends GenDescEnum<infer RuntimeShape> ? RuntimeShape : number; | ||
export type EnumShape<Desc extends DescEnum> = Desc extends GenEnum<infer RuntimeShape> ? RuntimeShape : number; | ||
/** | ||
* Extract the enum JSON type from a enum descriptor. | ||
*/ | ||
export type EnumJsonType<Desc extends DescEnum> = Desc extends GenDescEnum<unknown, infer JsonType> ? JsonType : string | null; | ||
export type EnumJsonType<Desc extends DescEnum> = Desc extends GenEnum<number, infer JsonType> ? JsonType : string | null; | ||
/** | ||
* Extract the value type from an extension descriptor. | ||
*/ | ||
export type ExtensionValueShape<Desc extends DescExtension> = Desc extends GenDescExtension<Message, infer RuntimeShape> ? RuntimeShape : unknown; | ||
export type ExtensionValueShape<Desc extends DescExtension> = Desc extends GenExtension<Message, infer RuntimeShape> ? RuntimeShape : unknown; | ||
/** | ||
* Extract the type of the extended message from an extension descriptor. | ||
*/ | ||
export type Extendee<Desc extends DescExtension> = Desc extends GenDescExtension<infer Extendee> ? Extendee : Message; | ||
export type Extendee<Desc extends DescExtension> = Desc extends GenExtension<infer Extendee> ? Extendee : Message; | ||
/** | ||
@@ -51,0 +51,0 @@ * Unknown fields are fields that were not recognized during parsing, or |
@@ -16,3 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.base64Encode = exports.base64Decode = void 0; | ||
exports.base64Decode = base64Decode; | ||
exports.base64Encode = base64Encode; | ||
/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unnecessary-condition, prefer-const */ | ||
@@ -84,3 +85,2 @@ /** | ||
} | ||
exports.base64Decode = base64Decode; | ||
/** | ||
@@ -133,3 +133,2 @@ * Encode a byte array to a base64 string. | ||
} | ||
exports.base64Encode = base64Encode; | ||
// lookup table from base64 character to byte | ||
@@ -136,0 +135,0 @@ let encodeTableStd; |
@@ -36,3 +36,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sizeDelimitedPeek = exports.sizeDelimitedDecodeStream = exports.sizeDelimitedEncode = void 0; | ||
exports.sizeDelimitedEncode = sizeDelimitedEncode; | ||
exports.sizeDelimitedDecodeStream = sizeDelimitedDecodeStream; | ||
exports.sizeDelimitedPeek = sizeDelimitedPeek; | ||
const to_binary_js_1 = require("../to-binary.js"); | ||
@@ -55,3 +57,2 @@ const binary_encoding_js_1 = require("./binary-encoding.js"); | ||
} | ||
exports.sizeDelimitedEncode = sizeDelimitedEncode; | ||
/** | ||
@@ -110,3 +111,2 @@ * Parse a stream of size-delimited messages. | ||
} | ||
exports.sizeDelimitedDecodeStream = sizeDelimitedDecodeStream; | ||
/** | ||
@@ -157,2 +157,1 @@ * Decodes the size from the given size-delimited message, which may be | ||
} | ||
exports.sizeDelimitedPeek = sizeDelimitedPeek; |
@@ -16,3 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getTextEncoding = exports.configureTextEncoding = void 0; | ||
exports.configureTextEncoding = configureTextEncoding; | ||
exports.getTextEncoding = getTextEncoding; | ||
const symbol = Symbol.for("@bufbuild/protobuf/text-encoding"); | ||
@@ -31,3 +32,2 @@ /** | ||
} | ||
exports.configureTextEncoding = configureTextEncoding; | ||
function getTextEncoding() { | ||
@@ -57,2 +57,1 @@ if (globalThis[symbol] == undefined) { | ||
} | ||
exports.getTextEncoding = getTextEncoding; |
@@ -16,3 +16,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseTextFormatScalarValue = exports.parseTextFormatEnumValue = void 0; | ||
exports.parseTextFormatEnumValue = parseTextFormatEnumValue; | ||
exports.parseTextFormatScalarValue = parseTextFormatScalarValue; | ||
const descriptors_js_1 = require("../descriptors.js"); | ||
@@ -33,3 +34,2 @@ const proto_int64_js_1 = require("../proto-int64.js"); | ||
} | ||
exports.parseTextFormatEnumValue = parseTextFormatEnumValue; | ||
/** | ||
@@ -80,3 +80,2 @@ * Parse a scalar value from the Protobuf text format. | ||
} | ||
exports.parseTextFormatScalarValue = parseTextFormatScalarValue; | ||
/** | ||
@@ -83,0 +82,0 @@ * Parses a text-encoded default value (proto2) of a BYTES field. |
@@ -35,3 +35,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.varint32read = exports.varint32write = exports.uInt64ToString = exports.int64ToString = exports.int64FromString = exports.varint64write = exports.varint64read = void 0; | ||
exports.varint64read = varint64read; | ||
exports.varint64write = varint64write; | ||
exports.int64FromString = int64FromString; | ||
exports.int64ToString = int64ToString; | ||
exports.uInt64ToString = uInt64ToString; | ||
exports.varint32write = varint32write; | ||
exports.varint32read = varint32read; | ||
/* eslint-disable prefer-const,@typescript-eslint/restrict-plus-operands */ | ||
@@ -79,3 +85,2 @@ /** | ||
} | ||
exports.varint64read = varint64read; | ||
/** | ||
@@ -115,3 +120,2 @@ * Write a 64 bit varint, given as two JS numbers, to the given bytes array. | ||
} | ||
exports.varint64write = varint64write; | ||
// constants for binary math | ||
@@ -155,3 +159,2 @@ const TWO_PWR_32_DBL = 0x100000000; | ||
} | ||
exports.int64FromString = int64FromString; | ||
/** | ||
@@ -176,3 +179,2 @@ * Losslessly converts a 64-bit signed integer in 32:32 split representation | ||
} | ||
exports.int64ToString = int64ToString; | ||
/** | ||
@@ -232,3 +234,2 @@ * Losslessly converts a 64-bit unsigned integer in 32:32 split representation | ||
} | ||
exports.uInt64ToString = uInt64ToString; | ||
function toUnsigned(lo, hi) { | ||
@@ -288,3 +289,2 @@ return { lo: lo >>> 0, hi: hi >>> 0 }; | ||
} | ||
exports.varint32write = varint32write; | ||
/** | ||
@@ -331,2 +331,1 @@ * Read an unsigned 32 bit varint. | ||
} | ||
exports.varint32read = varint32read; |
@@ -16,3 +16,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.anyUnpackTo = exports.anyUnpack = exports.anyIs = exports.anyPack = void 0; | ||
exports.anyPack = anyPack; | ||
exports.anyIs = anyIs; | ||
exports.anyUnpack = anyUnpack; | ||
exports.anyUnpackTo = anyUnpackTo; | ||
const any_pb_js_1 = require("./gen/google/protobuf/any_pb.js"); | ||
@@ -32,3 +35,2 @@ const create_js_1 = require("../create.js"); | ||
} | ||
exports.anyPack = anyPack; | ||
function anyIs(any, descOrTypeName) { | ||
@@ -44,3 +46,2 @@ if (any.typeUrl === "") { | ||
} | ||
exports.anyIs = anyIs; | ||
function anyUnpack(any, registryOrMessageDesc) { | ||
@@ -58,3 +59,2 @@ if (any.typeUrl === "") { | ||
} | ||
exports.anyUnpack = anyUnpack; | ||
/** | ||
@@ -69,3 +69,2 @@ * Same as anyUnpack but unpacks into the target message. | ||
} | ||
exports.anyUnpackTo = anyUnpackTo; | ||
function typeNameToUrl(name) { | ||
@@ -72,0 +71,0 @@ return `type.googleapis.com/${name}`; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_any: GenDescFile; | ||
export declare const file_google_protobuf_any: GenFile; | ||
/** | ||
@@ -150,2 +150,2 @@ * `Any` contains an arbitrary serialized protocol buffer message along with a | ||
*/ | ||
export declare const AnySchema: GenDescMessage<Any, AnyJson>; | ||
export declare const AnySchema: GenMessage<Any, AnyJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { SourceContext, SourceContextJson } from "./source_context_pb.js"; | ||
@@ -8,3 +8,3 @@ import type { Option, OptionJson, Syntax, SyntaxJson } from "./type_pb.js"; | ||
*/ | ||
export declare const file_google_protobuf_api: GenDescFile; | ||
export declare const file_google_protobuf_api: GenFile; | ||
/** | ||
@@ -125,3 +125,3 @@ * Api is a light-weight descriptor for an API Interface. | ||
*/ | ||
export declare const ApiSchema: GenDescMessage<Api, ApiJson>; | ||
export declare const ApiSchema: GenMessage<Api, ApiJson>; | ||
/** | ||
@@ -213,3 +213,3 @@ * Method represents a method of an API interface. | ||
*/ | ||
export declare const MethodSchema: GenDescMessage<Method, MethodJson>; | ||
export declare const MethodSchema: GenMessage<Method, MethodJson>; | ||
/** | ||
@@ -329,2 +329,2 @@ * Declares an API Interface to be included in this interface. The including | ||
*/ | ||
export declare const MixinSchema: GenDescMessage<Mixin, MixinJson>; | ||
export declare const MixinSchema: GenMessage<Mixin, MixinJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescEnum, GenDescFile, GenDescMessage } from "../../../../../codegenv1/types.js"; | ||
import type { GenEnum, GenFile, GenMessage } from "../../../../../codegenv1/types.js"; | ||
import type { FileDescriptorProto, FileDescriptorProtoJson, GeneratedCodeInfo, GeneratedCodeInfoJson } from "../descriptor_pb.js"; | ||
@@ -7,3 +7,3 @@ import type { Message } from "../../../../../types.js"; | ||
*/ | ||
export declare const file_google_protobuf_compiler_plugin: GenDescFile; | ||
export declare const file_google_protobuf_compiler_plugin: GenFile; | ||
/** | ||
@@ -60,3 +60,3 @@ * The version number of protocol compiler. | ||
*/ | ||
export declare const VersionSchema: GenDescMessage<Version, VersionJson>; | ||
export declare const VersionSchema: GenMessage<Version, VersionJson>; | ||
/** | ||
@@ -150,3 +150,3 @@ * An encoded CodeGeneratorRequest is written to the plugin's stdin. | ||
*/ | ||
export declare const CodeGeneratorRequestSchema: GenDescMessage<CodeGeneratorRequest, CodeGeneratorRequestJson>; | ||
export declare const CodeGeneratorRequestSchema: GenMessage<CodeGeneratorRequest, CodeGeneratorRequestJson>; | ||
/** | ||
@@ -230,3 +230,3 @@ * The plugin writes an encoded CodeGeneratorResponse to stdout. | ||
*/ | ||
export declare const CodeGeneratorResponseSchema: GenDescMessage<CodeGeneratorResponse, CodeGeneratorResponseJson>; | ||
export declare const CodeGeneratorResponseSchema: GenMessage<CodeGeneratorResponse, CodeGeneratorResponseJson>; | ||
/** | ||
@@ -336,3 +336,3 @@ * Represents a single generated file. | ||
*/ | ||
export declare const CodeGeneratorResponse_FileSchema: GenDescMessage<CodeGeneratorResponse_File, CodeGeneratorResponse_FileJson>; | ||
export declare const CodeGeneratorResponse_FileSchema: GenMessage<CodeGeneratorResponse_File, CodeGeneratorResponse_FileJson>; | ||
/** | ||
@@ -364,2 +364,2 @@ * Sync with code_generator.h. | ||
*/ | ||
export declare const CodeGeneratorResponse_FeatureSchema: GenDescEnum<CodeGeneratorResponse_Feature, CodeGeneratorResponse_FeatureJson>; | ||
export declare const CodeGeneratorResponse_FeatureSchema: GenEnum<CodeGeneratorResponse_Feature, CodeGeneratorResponse_FeatureJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_duration: GenDescFile; | ||
export declare const file_google_protobuf_duration: GenFile; | ||
/** | ||
@@ -100,2 +100,2 @@ * A Duration represents a signed, fixed-length span of time represented | ||
*/ | ||
export declare const DurationSchema: GenDescMessage<Duration, DurationJson>; | ||
export declare const DurationSchema: GenMessage<Duration, DurationJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_empty: GenDescFile; | ||
export declare const file_google_protobuf_empty: GenFile; | ||
/** | ||
@@ -29,2 +29,2 @@ * A generic empty message that you can re-use to avoid defining duplicated | ||
*/ | ||
export declare const EmptySchema: GenDescMessage<Empty, EmptyJson>; | ||
export declare const EmptySchema: GenMessage<Empty, EmptyJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_field_mask: GenDescFile; | ||
export declare const file_google_protobuf_field_mask: GenFile; | ||
/** | ||
@@ -227,2 +227,2 @@ * `FieldMask` represents a set of symbolic field paths, for example: | ||
*/ | ||
export declare const FieldMaskSchema: GenDescMessage<FieldMask, FieldMaskJson>; | ||
export declare const FieldMaskSchema: GenMessage<FieldMask, FieldMaskJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_source_context: GenDescFile; | ||
export declare const file_google_protobuf_source_context: GenFile; | ||
/** | ||
@@ -36,2 +36,2 @@ * `SourceContext` represents information about the source of a | ||
*/ | ||
export declare const SourceContextSchema: GenDescMessage<SourceContext, SourceContextJson>; | ||
export declare const SourceContextSchema: GenMessage<SourceContext, SourceContextJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescEnum, GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenEnum, GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -7,3 +7,3 @@ import type { JsonObject, JsonValue } from "../../../../json-value.js"; | ||
*/ | ||
export declare const file_google_protobuf_struct: GenDescFile; | ||
export declare const file_google_protobuf_struct: GenFile; | ||
/** | ||
@@ -39,3 +39,3 @@ * `Struct` represents a structured data value, consisting of fields | ||
*/ | ||
export declare const StructSchema: GenDescMessage<Struct, StructJson>; | ||
export declare const StructSchema: GenMessage<Struct, StructJson>; | ||
/** | ||
@@ -118,3 +118,3 @@ * `Value` represents a dynamically typed value which can be either | ||
*/ | ||
export declare const ValueSchema: GenDescMessage<Value, ValueJson>; | ||
export declare const ValueSchema: GenMessage<Value, ValueJson>; | ||
/** | ||
@@ -143,3 +143,3 @@ * `ListValue` is a wrapper around a repeated field of values. | ||
*/ | ||
export declare const ListValueSchema: GenDescMessage<ListValue, ListValueJson>; | ||
export declare const ListValueSchema: GenMessage<ListValue, ListValueJson>; | ||
/** | ||
@@ -168,2 +168,2 @@ * `NullValue` is a singleton enumeration to represent the null value for the | ||
*/ | ||
export declare const NullValueSchema: GenDescEnum<NullValue, NullValueJson>; | ||
export declare const NullValueSchema: GenEnum<NullValue, NullValueJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_timestamp: GenDescFile; | ||
export declare const file_google_protobuf_timestamp: GenFile; | ||
/** | ||
@@ -129,2 +129,2 @@ * A Timestamp represents a point in time independent of any time zone or local | ||
*/ | ||
export declare const TimestampSchema: GenDescMessage<Timestamp, TimestampJson>; | ||
export declare const TimestampSchema: GenMessage<Timestamp, TimestampJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescEnum, GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenEnum, GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Any, AnyJson } from "./any_pb.js"; | ||
@@ -8,3 +8,3 @@ import type { SourceContext, SourceContextJson } from "./source_context_pb.js"; | ||
*/ | ||
export declare const file_google_protobuf_type: GenDescFile; | ||
export declare const file_google_protobuf_type: GenFile; | ||
/** | ||
@@ -96,3 +96,3 @@ * A protocol buffer message type. | ||
*/ | ||
export declare const TypeSchema: GenDescMessage<Type, TypeJson>; | ||
export declare const TypeSchema: GenMessage<Type, TypeJson>; | ||
/** | ||
@@ -216,3 +216,3 @@ * A single field of a message type. | ||
*/ | ||
export declare const FieldSchema: GenDescMessage<Field, FieldJson>; | ||
export declare const FieldSchema: GenMessage<Field, FieldJson>; | ||
/** | ||
@@ -346,3 +346,3 @@ * Basic field types. | ||
*/ | ||
export declare const Field_KindSchema: GenDescEnum<Field_Kind, Field_KindJson>; | ||
export declare const Field_KindSchema: GenEnum<Field_Kind, Field_KindJson>; | ||
/** | ||
@@ -386,3 +386,3 @@ * Whether a field is optional, required, or repeated. | ||
*/ | ||
export declare const Field_CardinalitySchema: GenDescEnum<Field_Cardinality, Field_CardinalityJson>; | ||
export declare const Field_CardinalitySchema: GenEnum<Field_Cardinality, Field_CardinalityJson>; | ||
/** | ||
@@ -464,3 +464,3 @@ * Enum type definition. | ||
*/ | ||
export declare const EnumSchema: GenDescMessage<Enum, EnumJson>; | ||
export declare const EnumSchema: GenMessage<Enum, EnumJson>; | ||
/** | ||
@@ -512,3 +512,3 @@ * Enum value definition. | ||
*/ | ||
export declare const EnumValueSchema: GenDescMessage<EnumValue, EnumValueJson>; | ||
export declare const EnumValueSchema: GenMessage<EnumValue, EnumValueJson>; | ||
/** | ||
@@ -557,3 +557,3 @@ * A protocol buffer option, which can be attached to a message, field, | ||
*/ | ||
export declare const OptionSchema: GenDescMessage<Option, OptionJson>; | ||
export declare const OptionSchema: GenMessage<Option, OptionJson>; | ||
/** | ||
@@ -591,2 +591,2 @@ * The syntax in which a protocol buffer element is defined. | ||
*/ | ||
export declare const SyntaxSchema: GenDescEnum<Syntax, SyntaxJson>; | ||
export declare const SyntaxSchema: GenEnum<Syntax, SyntaxJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_wrappers: GenDescFile; | ||
export declare const file_google_protobuf_wrappers: GenFile; | ||
/** | ||
@@ -31,3 +31,3 @@ * Wrapper message for `double`. | ||
*/ | ||
export declare const DoubleValueSchema: GenDescMessage<DoubleValue, DoubleValueJson>; | ||
export declare const DoubleValueSchema: GenMessage<DoubleValue, DoubleValueJson>; | ||
/** | ||
@@ -56,3 +56,3 @@ * Wrapper message for `float`. | ||
*/ | ||
export declare const FloatValueSchema: GenDescMessage<FloatValue, FloatValueJson>; | ||
export declare const FloatValueSchema: GenMessage<FloatValue, FloatValueJson>; | ||
/** | ||
@@ -81,3 +81,3 @@ * Wrapper message for `int64`. | ||
*/ | ||
export declare const Int64ValueSchema: GenDescMessage<Int64Value, Int64ValueJson>; | ||
export declare const Int64ValueSchema: GenMessage<Int64Value, Int64ValueJson>; | ||
/** | ||
@@ -106,3 +106,3 @@ * Wrapper message for `uint64`. | ||
*/ | ||
export declare const UInt64ValueSchema: GenDescMessage<UInt64Value, UInt64ValueJson>; | ||
export declare const UInt64ValueSchema: GenMessage<UInt64Value, UInt64ValueJson>; | ||
/** | ||
@@ -131,3 +131,3 @@ * Wrapper message for `int32`. | ||
*/ | ||
export declare const Int32ValueSchema: GenDescMessage<Int32Value, Int32ValueJson>; | ||
export declare const Int32ValueSchema: GenMessage<Int32Value, Int32ValueJson>; | ||
/** | ||
@@ -156,3 +156,3 @@ * Wrapper message for `uint32`. | ||
*/ | ||
export declare const UInt32ValueSchema: GenDescMessage<UInt32Value, UInt32ValueJson>; | ||
export declare const UInt32ValueSchema: GenMessage<UInt32Value, UInt32ValueJson>; | ||
/** | ||
@@ -181,3 +181,3 @@ * Wrapper message for `bool`. | ||
*/ | ||
export declare const BoolValueSchema: GenDescMessage<BoolValue, BoolValueJson>; | ||
export declare const BoolValueSchema: GenMessage<BoolValue, BoolValueJson>; | ||
/** | ||
@@ -206,3 +206,3 @@ * Wrapper message for `string`. | ||
*/ | ||
export declare const StringValueSchema: GenDescMessage<StringValue, StringValueJson>; | ||
export declare const StringValueSchema: GenMessage<StringValue, StringValueJson>; | ||
/** | ||
@@ -231,2 +231,2 @@ * Wrapper message for `bytes`. | ||
*/ | ||
export declare const BytesValueSchema: GenDescMessage<BytesValue, BytesValueJson>; | ||
export declare const BytesValueSchema: GenMessage<BytesValue, BytesValueJson>; |
@@ -16,3 +16,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.timestampMs = exports.timestampFromMs = exports.timestampDate = exports.timestampFromDate = exports.timestampNow = void 0; | ||
exports.timestampNow = timestampNow; | ||
exports.timestampFromDate = timestampFromDate; | ||
exports.timestampDate = timestampDate; | ||
exports.timestampFromMs = timestampFromMs; | ||
exports.timestampMs = timestampMs; | ||
const timestamp_pb_js_1 = require("./gen/google/protobuf/timestamp_pb.js"); | ||
@@ -27,3 +31,2 @@ const create_js_1 = require("../create.js"); | ||
} | ||
exports.timestampNow = timestampNow; | ||
/** | ||
@@ -35,3 +38,2 @@ * Create a google.protobuf.Timestamp message from an ECMAScript Date. | ||
} | ||
exports.timestampFromDate = timestampFromDate; | ||
/** | ||
@@ -43,3 +45,2 @@ * Convert a google.protobuf.Timestamp message to an ECMAScript Date. | ||
} | ||
exports.timestampDate = timestampDate; | ||
/** | ||
@@ -54,3 +55,2 @@ * Create a google.protobuf.Timestamp message from a Unix timestamp in milliseconds. | ||
} | ||
exports.timestampFromMs = timestampFromMs; | ||
/** | ||
@@ -62,2 +62,1 @@ * Convert a google.protobuf.Timestamp to a Unix timestamp in milliseconds. | ||
} | ||
exports.timestampMs = timestampMs; |
@@ -16,7 +16,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isWrapperDesc = exports.isWrapper = void 0; | ||
exports.isWrapper = isWrapper; | ||
exports.isWrapperDesc = isWrapperDesc; | ||
function isWrapper(arg) { | ||
return isWrapperTypeName(arg.$typeName); | ||
} | ||
exports.isWrapper = isWrapper; | ||
function isWrapperDesc(messageDesc) { | ||
@@ -30,3 +30,2 @@ const f = messageDesc.fields[0]; | ||
} | ||
exports.isWrapperDesc = isWrapperDesc; | ||
function isWrapperTypeName(name) { | ||
@@ -33,0 +32,0 @@ return (name.startsWith("google.protobuf.") && |
import type { DescEnum, DescFile } from "../descriptors.js"; | ||
import type { GenDescEnum } from "./types.js"; | ||
import type { GenEnum } from "./types.js"; | ||
import type { JsonValue } from "../json-value.js"; | ||
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
export declare function enumDesc<Shape, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenDescEnum<Shape, JsonType>; | ||
export declare function enumDesc<Shape extends number, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenEnum<Shape, JsonType>; | ||
/** | ||
@@ -12,0 +12,0 @@ * Construct a TypeScript enum object at runtime from a descriptor. |
import type { Message } from "../types.js"; | ||
import type { DescFile } from "../descriptors.js"; | ||
import type { GenDescExtension } from "./types.js"; | ||
import type { GenExtension } from "./types.js"; | ||
/** | ||
@@ -9,2 +9,2 @@ * Hydrate an extension descriptor. | ||
*/ | ||
export declare function extDesc<Extendee extends Message, Value>(file: DescFile, path: number, ...paths: number[]): GenDescExtension<Extendee, Value>; | ||
export declare function extDesc<Extendee extends Message, Value>(file: DescFile, path: number, ...paths: number[]): GenExtension<Extendee, Value>; |
import type { Message } from "../types.js"; | ||
import type { DescFile } from "../descriptors.js"; | ||
import type { GenDescMessage } from "./types.js"; | ||
import type { GenMessage } from "./types.js"; | ||
import type { JsonValue } from "../json-value.js"; | ||
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export declare function messageDesc<Shape extends Message, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenDescMessage<Shape, JsonType>; | ||
export declare function messageDesc<Shape extends Message, JsonType extends JsonValue = JsonValue>(file: DescFile, path: number, ...paths: number[]): GenMessage<Shape, JsonType>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescService, GenDescServiceMethods } from "./types.js"; | ||
import type { GenService, GenServiceMethods } from "./types.js"; | ||
import type { DescFile } from "../descriptors.js"; | ||
@@ -8,2 +8,2 @@ /** | ||
*/ | ||
export declare function serviceDesc<T extends GenDescServiceMethods>(file: DescFile, path: number, ...paths: number[]): GenDescService<T>; | ||
export declare function serviceDesc<T extends GenServiceMethods>(file: DescFile, path: number, ...paths: number[]): GenService<T>; |
@@ -109,3 +109,3 @@ /** | ||
}; | ||
readonly GenDescFile: { | ||
readonly GenFile: { | ||
readonly typeOnly: true; | ||
@@ -115,3 +115,3 @@ readonly bootstrapWktFrom: "../../codegenv1/types.js"; | ||
}; | ||
readonly GenDescEnum: { | ||
readonly GenEnum: { | ||
readonly typeOnly: true; | ||
@@ -121,3 +121,3 @@ readonly bootstrapWktFrom: "../../codegenv1/types.js"; | ||
}; | ||
readonly GenDescExtension: { | ||
readonly GenExtension: { | ||
readonly typeOnly: true; | ||
@@ -127,3 +127,3 @@ readonly bootstrapWktFrom: "../../codegenv1/types.js"; | ||
}; | ||
readonly GenDescMessage: { | ||
readonly GenMessage: { | ||
readonly typeOnly: true; | ||
@@ -133,3 +133,3 @@ readonly bootstrapWktFrom: "../../codegenv1/types.js"; | ||
}; | ||
readonly GenDescService: { | ||
readonly GenService: { | ||
readonly typeOnly: true; | ||
@@ -136,0 +136,0 @@ readonly bootstrapWktFrom: "../../codegenv1/types.js"; |
@@ -60,8 +60,8 @@ // Copyright 2021-2024 Buf Technologies, Inc. | ||
tsEnum: { typeOnly: false, bootstrapWktFrom: "../../codegenv1/enum.js", from: packageName + "/codegenv1" }, | ||
GenDescFile: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: packageName + "/codegenv1" }, | ||
GenDescEnum: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: packageName + "/codegenv1" }, | ||
GenDescExtension: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: packageName + "/codegenv1" }, | ||
GenDescMessage: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: packageName + "/codegenv1" }, | ||
GenDescService: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: packageName + "/codegenv1" }, | ||
GenFile: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: packageName + "/codegenv1" }, | ||
GenEnum: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: packageName + "/codegenv1" }, | ||
GenExtension: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: packageName + "/codegenv1" }, | ||
GenMessage: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: packageName + "/codegenv1" }, | ||
GenService: { typeOnly: true, bootstrapWktFrom: "../../codegenv1/types.js", from: packageName + "/codegenv1" }, | ||
}, | ||
}; |
import type { Message } from "../types.js"; | ||
import type { DescEnum, DescExtension, DescField, DescFile, DescMessage, DescMethod, DescService } from "../descriptors.js"; | ||
import type { DescEnum, DescEnumValue, DescExtension, DescField, DescFile, DescMessage, DescMethod, DescService } from "../descriptors.js"; | ||
import type { JsonValue } from "../json-value.js"; | ||
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
export type GenDescFile = DescFile; | ||
export type GenFile = DescFile; | ||
/** | ||
@@ -19,3 +19,3 @@ * Describes a message declaration in a protobuf source file. | ||
*/ | ||
export type GenDescMessage<RuntimeShape extends Message, JsonType = JsonValue> = Omit<DescMessage, "field"> & { | ||
export type GenMessage<RuntimeShape extends Message, JsonType = JsonValue> = Omit<DescMessage, "field"> & { | ||
field: Record<MessageFieldNames<RuntimeShape>, DescField>; | ||
@@ -31,3 +31,5 @@ } & brandv1<RuntimeShape, JsonType>; | ||
*/ | ||
export type GenDescEnum<RuntimeShape, JsonType extends JsonValue = JsonValue> = DescEnum & brandv1<RuntimeShape, JsonType>; | ||
export type GenEnum<RuntimeShape extends number, JsonType extends JsonValue = JsonValue> = Omit<DescEnum, "value"> & { | ||
value: Record<RuntimeShape, DescEnumValue>; | ||
} & brandv1<RuntimeShape, JsonType>; | ||
/** | ||
@@ -41,3 +43,3 @@ * Describes an extension in a protobuf source file. | ||
*/ | ||
export type GenDescExtension<Extendee extends Message = Message, RuntimeShape = unknown> = DescExtension & brandv1<Extendee, RuntimeShape>; | ||
export type GenExtension<Extendee extends Message = Message, RuntimeShape = unknown> = DescExtension & brandv1<Extendee, RuntimeShape>; | ||
/** | ||
@@ -51,3 +53,3 @@ * Describes a service declaration in a protobuf source file. | ||
*/ | ||
export type GenDescService<RuntimeShape extends GenDescServiceMethods> = Omit<DescService, "method"> & { | ||
export type GenService<RuntimeShape extends GenServiceMethods> = Omit<DescService, "method"> & { | ||
method: { | ||
@@ -60,3 +62,3 @@ [K in keyof RuntimeShape]: RuntimeShape[K] & DescMethod; | ||
*/ | ||
export type GenDescServiceMethods = Record<string, Pick<DescMethod, "input" | "output" | "methodKind">>; | ||
export type GenServiceMethods = Record<string, Pick<DescMethod, "input" | "output" | "methodKind">>; | ||
declare class brandv1<A, B = unknown> { | ||
@@ -63,0 +65,0 @@ protected v: "codegenv1"; |
@@ -152,3 +152,5 @@ // Copyright 2021-2024 Buf Technologies, Inc. | ||
if (!needsPrototypeChain(desc)) { | ||
msg = {}; | ||
msg = { | ||
$typeName: desc.typeName, | ||
}; | ||
for (const member of desc.members) { | ||
@@ -193,2 +195,3 @@ if (member.kind == "oneof" || member.presence == IMPLICIT) { | ||
msg = Object.create(prototype); | ||
msg.$typeName = desc.typeName; | ||
for (const member of desc.members) { | ||
@@ -211,3 +214,2 @@ if (members.has(member)) { | ||
} | ||
msg.$typeName = desc.typeName; | ||
return msg; | ||
@@ -214,0 +216,0 @@ } |
@@ -110,2 +110,6 @@ import type { DescriptorProto, Edition, EnumDescriptorProto, EnumValueDescriptorProto, FeatureSet_FieldPresence, FieldDescriptorProto, FileDescriptorProto, MethodDescriptorProto, MethodOptions_IdempotencyLevel, OneofDescriptorProto, ServiceDescriptorProto } from "./wkt/gen/google/protobuf/descriptor_pb.js"; | ||
/** | ||
* All values of this enum by their number. | ||
*/ | ||
readonly value: Record<number, DescEnumValue>; | ||
/** | ||
* A prefix shared by all enum values. | ||
@@ -112,0 +116,0 @@ * For example, `my_enum_` for `enum MyEnum {MY_ENUM_A=0; MY_ENUM_B=1;}` |
@@ -48,2 +48,5 @@ // Copyright 2021-2024 Buf Technologies, Inc. | ||
const registry = createBaseRegistry(); | ||
if (!args.length) { | ||
return registry; | ||
} | ||
if ("$typeName" in args[0] && | ||
@@ -380,2 +383,3 @@ args[0].$typeName == "google.protobuf.FileDescriptorSet") { | ||
typeName: makeTypeName(proto, parent, file), | ||
value: {}, | ||
values: [], | ||
@@ -392,3 +396,3 @@ sharedPrefix, | ||
const name = proto.name; | ||
desc.values.push({ | ||
desc.values.push((desc.value[proto.number] = { | ||
kind: "enum_value", | ||
@@ -398,9 +402,11 @@ proto, | ||
parent: desc, | ||
name: proto.name, | ||
localName: safeObjectProperty(sharedPrefix == undefined ? name : name.substring(sharedPrefix.length)), | ||
name, | ||
localName: safeObjectProperty(sharedPrefix == undefined | ||
? name | ||
: name.substring(sharedPrefix.length)), | ||
number: proto.number, | ||
toString() { | ||
return `enum value ${desc.typeName}.${this.name}`; | ||
return `enum value ${desc.typeName}.${name}`; | ||
}, | ||
}); | ||
})); | ||
}); | ||
@@ -407,0 +413,0 @@ ((_c = parent === null || parent === void 0 ? void 0 : parent.nestedEnums) !== null && _c !== void 0 ? _c : file.enums).push(desc); |
@@ -59,3 +59,3 @@ // Copyright 2021-2024 Buf Technologies, Inc. | ||
} | ||
const name = (_a = descEnum.values.find((v) => v.number === value)) === null || _a === void 0 ? void 0 : _a.name; | ||
const name = (_a = descEnum.value[value]) === null || _a === void 0 ? void 0 : _a.name; | ||
if (name === undefined) { | ||
@@ -178,3 +178,3 @@ throw new Error(`${String(value)} is not a value in ${descEnum.toString()}`); | ||
} | ||
const val = desc.values.find((v) => v.number == value); | ||
const val = desc.value[value]; | ||
return (_a = val === null || val === void 0 ? void 0 : val.name) !== null && _a !== void 0 ? _a : value; // if we don't know the enum value, just return the number | ||
@@ -181,0 +181,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { GenDescEnum, GenDescExtension, GenDescMessage } from "./codegenv1/types.js"; | ||
import type { GenEnum, GenExtension, GenMessage } from "./codegenv1/types.js"; | ||
import type { DescEnum, DescExtension, DescMessage } from "./descriptors.js"; | ||
@@ -22,7 +22,7 @@ import type { OneofADT } from "./reflect/guard.js"; | ||
*/ | ||
export type MessageShape<Desc extends DescMessage> = Desc extends GenDescMessage<infer RuntimeShape> ? RuntimeShape : Message; | ||
export type MessageShape<Desc extends DescMessage> = Desc extends GenMessage<infer RuntimeShape> ? RuntimeShape : Message; | ||
/** | ||
* Extract the message JSON type from a message descriptor. | ||
*/ | ||
export type MessageJsonType<Desc extends DescMessage> = Desc extends GenDescMessage<Message, infer JsonType> ? JsonType : JsonValue; | ||
export type MessageJsonType<Desc extends DescMessage> = Desc extends GenMessage<Message, infer JsonType> ? JsonType : JsonValue; | ||
/** | ||
@@ -32,19 +32,19 @@ * Extract the init type from a message descriptor. | ||
*/ | ||
export type MessageInitShape<Desc extends DescMessage> = Desc extends GenDescMessage<infer RuntimeShape> ? RuntimeShape | MessageInit<RuntimeShape> : Record<string, unknown>; | ||
export type MessageInitShape<Desc extends DescMessage> = Desc extends GenMessage<infer RuntimeShape> ? RuntimeShape | MessageInit<RuntimeShape> : Record<string, unknown>; | ||
/** | ||
* Extract the enum type of from an enum descriptor. | ||
*/ | ||
export type EnumShape<Desc extends DescEnum> = Desc extends GenDescEnum<infer RuntimeShape> ? RuntimeShape : number; | ||
export type EnumShape<Desc extends DescEnum> = Desc extends GenEnum<infer RuntimeShape> ? RuntimeShape : number; | ||
/** | ||
* Extract the enum JSON type from a enum descriptor. | ||
*/ | ||
export type EnumJsonType<Desc extends DescEnum> = Desc extends GenDescEnum<unknown, infer JsonType> ? JsonType : string | null; | ||
export type EnumJsonType<Desc extends DescEnum> = Desc extends GenEnum<number, infer JsonType> ? JsonType : string | null; | ||
/** | ||
* Extract the value type from an extension descriptor. | ||
*/ | ||
export type ExtensionValueShape<Desc extends DescExtension> = Desc extends GenDescExtension<Message, infer RuntimeShape> ? RuntimeShape : unknown; | ||
export type ExtensionValueShape<Desc extends DescExtension> = Desc extends GenExtension<Message, infer RuntimeShape> ? RuntimeShape : unknown; | ||
/** | ||
* Extract the type of the extended message from an extension descriptor. | ||
*/ | ||
export type Extendee<Desc extends DescExtension> = Desc extends GenDescExtension<infer Extendee> ? Extendee : Message; | ||
export type Extendee<Desc extends DescExtension> = Desc extends GenExtension<infer Extendee> ? Extendee : Message; | ||
/** | ||
@@ -51,0 +51,0 @@ * Unknown fields are fields that were not recognized during parsing, or |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_any: GenDescFile; | ||
export declare const file_google_protobuf_any: GenFile; | ||
/** | ||
@@ -150,2 +150,2 @@ * `Any` contains an arbitrary serialized protocol buffer message along with a | ||
*/ | ||
export declare const AnySchema: GenDescMessage<Any, AnyJson>; | ||
export declare const AnySchema: GenMessage<Any, AnyJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { SourceContext, SourceContextJson } from "./source_context_pb.js"; | ||
@@ -8,3 +8,3 @@ import type { Option, OptionJson, Syntax, SyntaxJson } from "./type_pb.js"; | ||
*/ | ||
export declare const file_google_protobuf_api: GenDescFile; | ||
export declare const file_google_protobuf_api: GenFile; | ||
/** | ||
@@ -125,3 +125,3 @@ * Api is a light-weight descriptor for an API Interface. | ||
*/ | ||
export declare const ApiSchema: GenDescMessage<Api, ApiJson>; | ||
export declare const ApiSchema: GenMessage<Api, ApiJson>; | ||
/** | ||
@@ -213,3 +213,3 @@ * Method represents a method of an API interface. | ||
*/ | ||
export declare const MethodSchema: GenDescMessage<Method, MethodJson>; | ||
export declare const MethodSchema: GenMessage<Method, MethodJson>; | ||
/** | ||
@@ -329,2 +329,2 @@ * Declares an API Interface to be included in this interface. The including | ||
*/ | ||
export declare const MixinSchema: GenDescMessage<Mixin, MixinJson>; | ||
export declare const MixinSchema: GenMessage<Mixin, MixinJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescEnum, GenDescFile, GenDescMessage } from "../../../../../codegenv1/types.js"; | ||
import type { GenEnum, GenFile, GenMessage } from "../../../../../codegenv1/types.js"; | ||
import type { FileDescriptorProto, FileDescriptorProtoJson, GeneratedCodeInfo, GeneratedCodeInfoJson } from "../descriptor_pb.js"; | ||
@@ -7,3 +7,3 @@ import type { Message } from "../../../../../types.js"; | ||
*/ | ||
export declare const file_google_protobuf_compiler_plugin: GenDescFile; | ||
export declare const file_google_protobuf_compiler_plugin: GenFile; | ||
/** | ||
@@ -60,3 +60,3 @@ * The version number of protocol compiler. | ||
*/ | ||
export declare const VersionSchema: GenDescMessage<Version, VersionJson>; | ||
export declare const VersionSchema: GenMessage<Version, VersionJson>; | ||
/** | ||
@@ -150,3 +150,3 @@ * An encoded CodeGeneratorRequest is written to the plugin's stdin. | ||
*/ | ||
export declare const CodeGeneratorRequestSchema: GenDescMessage<CodeGeneratorRequest, CodeGeneratorRequestJson>; | ||
export declare const CodeGeneratorRequestSchema: GenMessage<CodeGeneratorRequest, CodeGeneratorRequestJson>; | ||
/** | ||
@@ -230,3 +230,3 @@ * The plugin writes an encoded CodeGeneratorResponse to stdout. | ||
*/ | ||
export declare const CodeGeneratorResponseSchema: GenDescMessage<CodeGeneratorResponse, CodeGeneratorResponseJson>; | ||
export declare const CodeGeneratorResponseSchema: GenMessage<CodeGeneratorResponse, CodeGeneratorResponseJson>; | ||
/** | ||
@@ -336,3 +336,3 @@ * Represents a single generated file. | ||
*/ | ||
export declare const CodeGeneratorResponse_FileSchema: GenDescMessage<CodeGeneratorResponse_File, CodeGeneratorResponse_FileJson>; | ||
export declare const CodeGeneratorResponse_FileSchema: GenMessage<CodeGeneratorResponse_File, CodeGeneratorResponse_FileJson>; | ||
/** | ||
@@ -364,2 +364,2 @@ * Sync with code_generator.h. | ||
*/ | ||
export declare const CodeGeneratorResponse_FeatureSchema: GenDescEnum<CodeGeneratorResponse_Feature, CodeGeneratorResponse_FeatureJson>; | ||
export declare const CodeGeneratorResponse_FeatureSchema: GenEnum<CodeGeneratorResponse_Feature, CodeGeneratorResponse_FeatureJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_duration: GenDescFile; | ||
export declare const file_google_protobuf_duration: GenFile; | ||
/** | ||
@@ -100,2 +100,2 @@ * A Duration represents a signed, fixed-length span of time represented | ||
*/ | ||
export declare const DurationSchema: GenDescMessage<Duration, DurationJson>; | ||
export declare const DurationSchema: GenMessage<Duration, DurationJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_empty: GenDescFile; | ||
export declare const file_google_protobuf_empty: GenFile; | ||
/** | ||
@@ -29,2 +29,2 @@ * A generic empty message that you can re-use to avoid defining duplicated | ||
*/ | ||
export declare const EmptySchema: GenDescMessage<Empty, EmptyJson>; | ||
export declare const EmptySchema: GenMessage<Empty, EmptyJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_field_mask: GenDescFile; | ||
export declare const file_google_protobuf_field_mask: GenFile; | ||
/** | ||
@@ -227,2 +227,2 @@ * `FieldMask` represents a set of symbolic field paths, for example: | ||
*/ | ||
export declare const FieldMaskSchema: GenDescMessage<FieldMask, FieldMaskJson>; | ||
export declare const FieldMaskSchema: GenMessage<FieldMask, FieldMaskJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_source_context: GenDescFile; | ||
export declare const file_google_protobuf_source_context: GenFile; | ||
/** | ||
@@ -36,2 +36,2 @@ * `SourceContext` represents information about the source of a | ||
*/ | ||
export declare const SourceContextSchema: GenDescMessage<SourceContext, SourceContextJson>; | ||
export declare const SourceContextSchema: GenMessage<SourceContext, SourceContextJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescEnum, GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenEnum, GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -7,3 +7,3 @@ import type { JsonObject, JsonValue } from "../../../../json-value.js"; | ||
*/ | ||
export declare const file_google_protobuf_struct: GenDescFile; | ||
export declare const file_google_protobuf_struct: GenFile; | ||
/** | ||
@@ -39,3 +39,3 @@ * `Struct` represents a structured data value, consisting of fields | ||
*/ | ||
export declare const StructSchema: GenDescMessage<Struct, StructJson>; | ||
export declare const StructSchema: GenMessage<Struct, StructJson>; | ||
/** | ||
@@ -118,3 +118,3 @@ * `Value` represents a dynamically typed value which can be either | ||
*/ | ||
export declare const ValueSchema: GenDescMessage<Value, ValueJson>; | ||
export declare const ValueSchema: GenMessage<Value, ValueJson>; | ||
/** | ||
@@ -143,3 +143,3 @@ * `ListValue` is a wrapper around a repeated field of values. | ||
*/ | ||
export declare const ListValueSchema: GenDescMessage<ListValue, ListValueJson>; | ||
export declare const ListValueSchema: GenMessage<ListValue, ListValueJson>; | ||
/** | ||
@@ -168,2 +168,2 @@ * `NullValue` is a singleton enumeration to represent the null value for the | ||
*/ | ||
export declare const NullValueSchema: GenDescEnum<NullValue, NullValueJson>; | ||
export declare const NullValueSchema: GenEnum<NullValue, NullValueJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_timestamp: GenDescFile; | ||
export declare const file_google_protobuf_timestamp: GenFile; | ||
/** | ||
@@ -129,2 +129,2 @@ * A Timestamp represents a point in time independent of any time zone or local | ||
*/ | ||
export declare const TimestampSchema: GenDescMessage<Timestamp, TimestampJson>; | ||
export declare const TimestampSchema: GenMessage<Timestamp, TimestampJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescEnum, GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenEnum, GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Any, AnyJson } from "./any_pb.js"; | ||
@@ -8,3 +8,3 @@ import type { SourceContext, SourceContextJson } from "./source_context_pb.js"; | ||
*/ | ||
export declare const file_google_protobuf_type: GenDescFile; | ||
export declare const file_google_protobuf_type: GenFile; | ||
/** | ||
@@ -96,3 +96,3 @@ * A protocol buffer message type. | ||
*/ | ||
export declare const TypeSchema: GenDescMessage<Type, TypeJson>; | ||
export declare const TypeSchema: GenMessage<Type, TypeJson>; | ||
/** | ||
@@ -216,3 +216,3 @@ * A single field of a message type. | ||
*/ | ||
export declare const FieldSchema: GenDescMessage<Field, FieldJson>; | ||
export declare const FieldSchema: GenMessage<Field, FieldJson>; | ||
/** | ||
@@ -346,3 +346,3 @@ * Basic field types. | ||
*/ | ||
export declare const Field_KindSchema: GenDescEnum<Field_Kind, Field_KindJson>; | ||
export declare const Field_KindSchema: GenEnum<Field_Kind, Field_KindJson>; | ||
/** | ||
@@ -386,3 +386,3 @@ * Whether a field is optional, required, or repeated. | ||
*/ | ||
export declare const Field_CardinalitySchema: GenDescEnum<Field_Cardinality, Field_CardinalityJson>; | ||
export declare const Field_CardinalitySchema: GenEnum<Field_Cardinality, Field_CardinalityJson>; | ||
/** | ||
@@ -464,3 +464,3 @@ * Enum type definition. | ||
*/ | ||
export declare const EnumSchema: GenDescMessage<Enum, EnumJson>; | ||
export declare const EnumSchema: GenMessage<Enum, EnumJson>; | ||
/** | ||
@@ -512,3 +512,3 @@ * Enum value definition. | ||
*/ | ||
export declare const EnumValueSchema: GenDescMessage<EnumValue, EnumValueJson>; | ||
export declare const EnumValueSchema: GenMessage<EnumValue, EnumValueJson>; | ||
/** | ||
@@ -557,3 +557,3 @@ * A protocol buffer option, which can be attached to a message, field, | ||
*/ | ||
export declare const OptionSchema: GenDescMessage<Option, OptionJson>; | ||
export declare const OptionSchema: GenMessage<Option, OptionJson>; | ||
/** | ||
@@ -591,2 +591,2 @@ * The syntax in which a protocol buffer element is defined. | ||
*/ | ||
export declare const SyntaxSchema: GenDescEnum<Syntax, SyntaxJson>; | ||
export declare const SyntaxSchema: GenEnum<Syntax, SyntaxJson>; |
@@ -1,2 +0,2 @@ | ||
import type { GenDescFile, GenDescMessage } from "../../../../codegenv1/types.js"; | ||
import type { GenFile, GenMessage } from "../../../../codegenv1/types.js"; | ||
import type { Message } from "../../../../types.js"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare const file_google_protobuf_wrappers: GenDescFile; | ||
export declare const file_google_protobuf_wrappers: GenFile; | ||
/** | ||
@@ -31,3 +31,3 @@ * Wrapper message for `double`. | ||
*/ | ||
export declare const DoubleValueSchema: GenDescMessage<DoubleValue, DoubleValueJson>; | ||
export declare const DoubleValueSchema: GenMessage<DoubleValue, DoubleValueJson>; | ||
/** | ||
@@ -56,3 +56,3 @@ * Wrapper message for `float`. | ||
*/ | ||
export declare const FloatValueSchema: GenDescMessage<FloatValue, FloatValueJson>; | ||
export declare const FloatValueSchema: GenMessage<FloatValue, FloatValueJson>; | ||
/** | ||
@@ -81,3 +81,3 @@ * Wrapper message for `int64`. | ||
*/ | ||
export declare const Int64ValueSchema: GenDescMessage<Int64Value, Int64ValueJson>; | ||
export declare const Int64ValueSchema: GenMessage<Int64Value, Int64ValueJson>; | ||
/** | ||
@@ -106,3 +106,3 @@ * Wrapper message for `uint64`. | ||
*/ | ||
export declare const UInt64ValueSchema: GenDescMessage<UInt64Value, UInt64ValueJson>; | ||
export declare const UInt64ValueSchema: GenMessage<UInt64Value, UInt64ValueJson>; | ||
/** | ||
@@ -131,3 +131,3 @@ * Wrapper message for `int32`. | ||
*/ | ||
export declare const Int32ValueSchema: GenDescMessage<Int32Value, Int32ValueJson>; | ||
export declare const Int32ValueSchema: GenMessage<Int32Value, Int32ValueJson>; | ||
/** | ||
@@ -156,3 +156,3 @@ * Wrapper message for `uint32`. | ||
*/ | ||
export declare const UInt32ValueSchema: GenDescMessage<UInt32Value, UInt32ValueJson>; | ||
export declare const UInt32ValueSchema: GenMessage<UInt32Value, UInt32ValueJson>; | ||
/** | ||
@@ -181,3 +181,3 @@ * Wrapper message for `bool`. | ||
*/ | ||
export declare const BoolValueSchema: GenDescMessage<BoolValue, BoolValueJson>; | ||
export declare const BoolValueSchema: GenMessage<BoolValue, BoolValueJson>; | ||
/** | ||
@@ -206,3 +206,3 @@ * Wrapper message for `string`. | ||
*/ | ||
export declare const StringValueSchema: GenDescMessage<StringValue, StringValueJson>; | ||
export declare const StringValueSchema: GenMessage<StringValue, StringValueJson>; | ||
/** | ||
@@ -231,2 +231,2 @@ * Wrapper message for `bytes`. | ||
*/ | ||
export declare const BytesValueSchema: GenDescMessage<BytesValue, BytesValueJson>; | ||
export declare const BytesValueSchema: GenMessage<BytesValue, BytesValueJson>; |
{ | ||
"name": "@bufbuild/protobuf", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"license": "(Apache-2.0 AND BSD-3-Clause)", | ||
"description": "A complete implementation of Protocol Buffers in TypeScript, suitable for web browsers and Node.js.", | ||
"keywords": [ | ||
"protobuf", | ||
"schema", | ||
"typescript", | ||
"ecmascript" | ||
], | ||
"repository": { | ||
@@ -17,5 +23,3 @@ "type": "git", | ||
"bootstrap:inject": "node scripts/bootstrap-inject.mjs src", | ||
"prebootstrap:wkt": "rm -rf .tmp && mkdir -p .tmp && cp -rp src/wkt/gen/* .tmp", | ||
"bootstrap:wkt": "protoc --es_out=src/wkt/gen --es_opt=bootstrap_wkt=true,target=ts,import_extension=.js,json_types=true --proto_path $(upstream-include wkt) $(upstream-files wkt) && license-header src/wkt/gen", | ||
"postbootstrap:wkt": "diff >/dev/null -r .tmp src/wkt/gen && cp -rp .tmp/* src/wkt/gen || true", | ||
"bootstrap:wkt": "protoc --es_out=src/wkt/gen --es_opt=bootstrap_wkt=true,target=ts,import_extension=js,json_types=true --proto_path $(upstream-include wkt) $(upstream-files wkt) && license-header src/wkt/gen", | ||
"format": "prettier --write --ignore-unknown '.' '!dist' '!src/wkt/gen'", | ||
@@ -22,0 +26,0 @@ "license-header": "license-header --ignore 'src/wire/varint.ts'", |
# @bufbuild/protobuf | ||
This package provides the runtime library for the code generator plugin | ||
[protoc-gen-es](https://www.npmjs.com/package/@bufbuild/protoc-gen-es). | ||
This package provides the runtime library for the [protoc-gen-es](https://www.npmjs.com/package/@bufbuild/protoc-gen-es) | ||
code generator plugin. | ||
## Protocol Buffers for ECMAScript | ||
A complete implementation of [Protocol Buffers](https://developers.google.com/protocol-buffers) in TypeScript, | ||
suitable for web browsers and Node.js. | ||
A complete implementation of [Protocol Buffers](https://protobuf.dev/) in TypeScript, | ||
suitable for web browsers and Node.js, created by [Buf](https://buf.build). | ||
**Protobuf-ES** is intended to be a solid, modern alternative to existing Protobuf implementations for the JavaScript ecosystem. It is the first project in this space to provide a comprehensive plugin framework and decouple the base types from RPC functionality. | ||
**Protobuf-ES** is a solid, modern alternative to existing Protobuf implementations for the JavaScript ecosystem. It's | ||
the first project in this space to provide a comprehensive plugin framework and decouple the base types from RPC | ||
functionality. | ||
@@ -17,8 +19,8 @@ Some additional features that set it apart from the others: | ||
- First-class TypeScript support | ||
- Generation of idiomatic JavaScript and TypeScript code. | ||
- Generation of [much smaller bundles](https://github.com/bufbuild/protobuf-es/blob/main/packages/bundle-size) | ||
- Implementation of all proto3 features, including the [canonical JSON format](https://developers.google.com/protocol-buffers/docs/proto3#json). | ||
- Implementation of all proto2 features, except for extensions and the text format. | ||
- Generation of idiomatic JavaScript and TypeScript code | ||
- Generation of [much smaller bundles](https://github.com/bufbuild/protobuf-es/tree/main/packages/bundle-size/) | ||
- Implementation of all proto3 features, including the [canonical JSON format](https://protobuf.dev/programming-guides/proto3/#json) | ||
- Implementation of all proto2 features, except for extensions and the text format | ||
- Usage of standard JavaScript APIs instead of the [Closure Library](http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html) | ||
- Compatibility is covered by the protocol buffers [conformance tests](https://github.com/bufbuild/protobuf-es/blob/main/packages/protobuf-conformance). | ||
- Compatibility is covered by the Protocol Buffers [conformance tests](https://github.com/bufbuild/protobuf-es/tree/main/packages/protobuf-conformance/) | ||
- Descriptor and reflection support | ||
@@ -34,8 +36,8 @@ | ||
To learn how to work with `@bufbuild/protobuf` check out the docs for the [Runtime API](https://github.com/bufbuild/protobuf-es/blob/main/docs/runtime_api.md) | ||
and the [generated code](https://github.com/bufbuild/protobuf-es/blob/main/docs/generated_code.md). | ||
To learn how to work with `@bufbuild/protobuf`, check out the docs for the [Runtime API](https://github.com/bufbuild/protobuf-es/tree/main/MANUAL.md#working-with-messages) | ||
and the [generated code](https://github.com/bufbuild/protobuf-es/tree/main/MANUAL.md#generated-code). | ||
Official documentation for the Protobuf-ES project can be found at [github.com/bufbuild/protobuf-es](https://github.com/bufbuild/protobuf-es). | ||
For more information on Buf, check out the official [Buf documentation](https://docs.buf.build/introduction). | ||
For more information on Buf, check out the official [Buf documentation](https://buf.build/docs/). | ||
@@ -42,0 +44,0 @@ ## Examples |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45
1249102
32895