protoscript
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -130,3 +130,4 @@ import { spawnSync } from "child_process"; | ||
const created = protosAfterCompile.filter((file) => !protosBeforeCompile[file[0]]); | ||
const updated = protosAfterCompile.filter((file) => protosBeforeCompile[file[0]] && protosBeforeCompile[file[0]] !== file[1]); | ||
const updated = protosAfterCompile.filter((file) => protosBeforeCompile[file[0]] && | ||
protosBeforeCompile[file[0]] !== file[1]); | ||
const unchanged = protosAfterCompile.filter((file) => protosBeforeCompile[file[0]] === file[1]); | ||
@@ -133,0 +134,0 @@ logger.info("\n"); |
@@ -75,7 +75,7 @@ import { cycleDetected, processTypes, uniqueBy, } from "../utils.js"; | ||
if (isEmpty) { | ||
result += `encode: function(_msg${printIfTypescript(`?: Partial<${node.content.namespacedName}>`)})${printIfTypescript(`: Uint8Array`)} { | ||
result += `encode: function(_msg${printIfTypescript(`?: PartialDeep<${node.content.namespacedName}>`)})${printIfTypescript(`: Uint8Array`)} { | ||
return new Uint8Array();`; | ||
} | ||
else { | ||
result += `encode: function(msg${printIfTypescript(`: Partial<${node.content.namespacedName}>`)})${printIfTypescript(`: Uint8Array`)} { | ||
result += `encode: function(msg${printIfTypescript(`: PartialDeep<${node.content.namespacedName}>`)})${printIfTypescript(`: Uint8Array`)} { | ||
return ${node.content.namespacedName}._writeMessage(msg, new BinaryWriter()).getResultBuffer();`; | ||
@@ -138,3 +138,3 @@ } | ||
*/ | ||
_writeMessage: function(${printIf(isEmpty, "_")}msg${printIfTypescript(`: ${`Partial<${node.content.namespacedName}>`}`)}, writer${printIfTypescript(`: BinaryWriter`)})${printIfTypescript(`: BinaryWriter`)} { | ||
_writeMessage: function(${printIf(isEmpty, "_")}msg${printIfTypescript(`: ${`PartialDeep<${node.content.namespacedName}>`}`)}, writer${printIfTypescript(`: BinaryWriter`)})${printIfTypescript(`: BinaryWriter`)} { | ||
${node.content.fields | ||
@@ -225,3 +225,8 @@ .map((field) => { | ||
else { | ||
if (field.optional || node.content.isMap) { | ||
if (field.optional || | ||
node.content.isMap || | ||
cycleDetected(field.tsType, [ | ||
...parents, | ||
node.content.name, | ||
])) { | ||
res += `msg.${field.name} = ${field.tsType}.initialize();`; | ||
@@ -362,7 +367,7 @@ } | ||
if (isEmpty) { | ||
result += `encode: function(_msg${printIfTypescript(`?: Partial<${node.content.namespacedName}>`)})${printIfTypescript(`: string`)} { | ||
result += `encode: function(_msg${printIfTypescript(`?: PartialDeep<${node.content.namespacedName}>`)})${printIfTypescript(`: string`)} { | ||
return "{}";`; | ||
} | ||
else { | ||
result += `encode: function(msg${printIfTypescript(`: Partial<${node.content.namespacedName}>`)})${printIfTypescript(`: string`)} { | ||
result += `encode: function(msg${printIfTypescript(`: PartialDeep<${node.content.namespacedName}>`)})${printIfTypescript(`: string`)} { | ||
return JSON.stringify(${node.content.namespacedNameJSON}._writeMessage(msg));`; | ||
@@ -427,3 +432,3 @@ } | ||
if (isEmpty) { | ||
result += `_writeMessage: function(_msg${printIfTypescript(`: ${`Partial<${node.content.namespacedName}>`}`)})${printIfTypescript(`: Record<string, unknown>`)} { | ||
result += `_writeMessage: function(_msg${printIfTypescript(`: ${`PartialDeep<${node.content.namespacedName}>`}`)})${printIfTypescript(`: Record<string, unknown>`)} { | ||
return {}; | ||
@@ -433,3 +438,3 @@ `; | ||
else { | ||
result += `_writeMessage: function(msg${printIfTypescript(`: ${`Partial<${node.content.namespacedName}>`}`)})${printIfTypescript(`: Record<string, unknown>`)} { | ||
result += `_writeMessage: function(msg${printIfTypescript(`: ${`PartialDeep<${node.content.namespacedName}>`}`)})${printIfTypescript(`: Record<string, unknown>`)} { | ||
const json${printIfTypescript(": Record<string, unknown>")} = {}; | ||
@@ -538,5 +543,7 @@ ${node.content.fields | ||
else { | ||
res += `const m = ${field.tsTypeJSON}.initialize();`; | ||
res += `${field.tsTypeJSON}._readMessage(m, ${name});`; | ||
res += `msg.${field.name} = m;`; | ||
if (field.optional || | ||
cycleDetected(field.tsType, [...parents, node.content.name])) { | ||
res += `msg.${field.name} = ${field.tsTypeJSON}.initialize();`; | ||
} | ||
res += `${field.tsTypeJSON}._readMessage(msg.${field.name}, ${name});`; | ||
} | ||
@@ -698,3 +705,3 @@ } | ||
${printIf(config.isTS && hasSerializer, `import type { ByteSource } from 'protoscript';`)} | ||
${printIf(config.isTS && hasSerializer, `import type { ByteSource, PartialDeep } from 'protoscript';`)} | ||
${printIf(hasSerializer, `import { | ||
@@ -701,0 +708,0 @@ ${printIf(hasSerializer, "BinaryReader,\nBinaryWriter,\n")} |
import type { CodeGeneratorResponse as CodeGeneratorResponseType } from "google-protobuf/google/protobuf/compiler/plugin_pb.js"; | ||
import { type Plugin } from "../plugin.js"; | ||
export declare function compile(input: Uint8Array, plugins?: Plugin[]): CodeGeneratorResponseType; | ||
export declare function compile(input: Uint8Array, plugins?: Plugin[]): Promise<CodeGeneratorResponseType>; | ||
export declare function compiler(protocompile: typeof compile): Promise<void>; |
@@ -7,3 +7,3 @@ import PluginPb from "google-protobuf/google/protobuf/compiler/plugin_pb.js"; | ||
const { CodeGeneratorRequest, CodeGeneratorResponse } = PluginPb; | ||
export function compile(input, plugins = []) { | ||
export async function compile(input, plugins = []) { | ||
const request = CodeGeneratorRequest.deserializeBinary(input); | ||
@@ -15,19 +15,19 @@ const options = deserializeConfig(request.getParameter() ?? ""); | ||
const identifierTable = buildIdentifierTable(request); | ||
function writeFile(name, content) { | ||
async function writeFile(name, content) { | ||
const file = new CodeGeneratorResponse.File(); | ||
file.setName(name); | ||
file.setContent(format(content, { parser: isTypescript ? "typescript" : "babel" })); | ||
file.setContent(await format(content, { parser: isTypescript ? "typescript" : "babel" })); | ||
response.addFile(file); | ||
} | ||
request.getProtoFileList().forEach((fileDescriptorProto) => { | ||
for (const fileDescriptorProto of request.getProtoFileList()) { | ||
const name = fileDescriptorProto.getName(); | ||
if (!name) { | ||
return; | ||
continue; | ||
} | ||
if (!process.env.GENERATE_KNOWN_TYPES && KNOWN_TYPES.includes(name)) { | ||
return; | ||
continue; | ||
} | ||
const protobufTs = generate(fileDescriptorProto, identifierTable, options, plugins); | ||
writeFile(isTypescript ? getProtobufTSFileName(name) : getProtobufJSFileName(name), protobufTs); | ||
}); | ||
await writeFile(isTypescript ? getProtobufTSFileName(name) : getProtobufJSFileName(name), protobufTs); | ||
} | ||
return response; | ||
@@ -52,4 +52,4 @@ } | ||
const input = await readStream(process.stdin); | ||
const response = protocompile(input); | ||
const response = await protocompile(input); | ||
process.stdout.write(response.serializeBinary()); | ||
} |
{ | ||
"name": "protoscript", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "A Protobuf runtime and code generation tool for JavaScript and TypeScript", | ||
@@ -20,4 +20,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"google-protobuf": "^3.21.0", | ||
"prettier": "^2.7.1" | ||
"google-protobuf": "^3.21.2", | ||
"prettier": "^3.0.0" | ||
}, | ||
@@ -24,0 +24,0 @@ "keywords": ["protobuf", "protocol buffers", "typescript"], |
@@ -28,21 +28,26 @@ # ProtoScript | ||
ProtoScript is a [protocol buffers](https://developers.google.com/protocol-buffers/) runtime and code generation tool for JavaScript, written in TypeScript. | ||
ProtoScript is a [protocol buffers](https://developers.google.com/protocol-buffers/) runtime and code generation tool for JavaScript and TypeScript. | ||
ProtoScript consists of two parts: | ||
1. Runtime. This is nearly identical to [google-protobuf](https://www.npmjs.com/package/google-protobuf), but significantly smaller (9.6KB vs 46KB gzipped) and written in ESM to enable dead-code elimination. | ||
1. A runtime. The interface is nearly identical to [google-protobuf](https://www.npmjs.com/package/google-protobuf), but under the hood it is significantly smaller (9.6KB vs 46KB gzipped) and written in ESM to enable dead-code elimination. If you only use the generated JSON serializers, the protobuf runtime will be eliminated from the final build, resulting in an even smaller runtime (less than 1 KB). | ||
2. Code generation. This is a replacement of `protoc`'s JavaScript generation that generates idiomatic JavaScript code, JSON serializers/deserializers, and includes TSDoc comments. | ||
2. A code generator. This is a replacement of `protoc`'s JavaScript generation that generates idiomatic JavaScript code, JSON serializers/deserializers, and includes [TSDoc](https://tsdoc.org/) comments. | ||
If you're looking for an RPC framework, you may be interested in [TwirpScript](https://github.com/tatethurston/TwirpScript). | ||
If you're looking for an RPC framework, you may be interested in [TwirpScript](https://github.com/tatethurston/TwirpScript), which uses ProtoScript under the hood to implement [Twirp](https://blog.twitch.tv/en/2018/01/16/twirp-a-sweet-new-rpc-framework-for-go-5f2febbf35f/). | ||
## Use cases | ||
- Network communication: Protobuf can be used to define APIs and data contracts in a language-independent manner. This makes it easier to share and maintain APIs among different services and platforms. Services written in various programming languages can be autogenerated and exchange data in a language-agnostic manner, using `protobuf` or `JSON` as the wire format. | ||
- Data storage: store and retrieve structured data in a compact binary format. protobuf's binary format is more space-efficient than JSON, XML and other formats. | ||
## Highlights 🛠 | ||
1. Idiomatic JavaScript / TypeScript code. None of the Java idioms that `protoc --js_out` generates such as the `List` suffix naming for repeated fields, `Map` suffix for maps, or the various getter and setter methods. ProtoScript generates and consumes plain JavaScript objects over classes. Compare the [TypeScript example](https://github.com/tatethurston/ProtoScript/blob/main/examples/typescript/src/haberdasher.pb.ts) to the [protoc example](https://github.com/tatethurston/ProtoScript/blob/main/examples/protoc/src/haberdasher_pb.js). | ||
1. Idiomatic JavaScript and TypeScript code. ProtoScript generates and consumes plain JavaScript objects over classes. It does not generate any of Java idioms from `protoc --js_out` such as the `List` suffix naming for repeated fields, `Map` suffix for maps, or the various getter and setter methods. Compare the generated code from ProtoScript's [TypeScript example](https://github.com/tatethurston/ProtoScript/blob/main/examples/typescript/src/haberdasher.pb.ts) to the [protoc example](https://github.com/tatethurston/ProtoScript/blob/main/examples/protoc/src/haberdasher_pb.js). | ||
2. In-editor API documentation. Comments in your `.proto` files become [TSDoc](https://github.com/microsoft/tsdoc) comments in the generated code and will show inline documentation in supported editors. | ||
3. JSON Serialization/Deserialization. Unlike `protoc`, ProtoScript's code generation generates JSON serialization and deserialization methods. | ||
3. JSON Serialization/Deserialization. Unlike `protoc`, ProtoScript's code generation also generates JSON serialization and deserialization methods. | ||
4. Small. ProtoScript's runtime and generated code are built with [tree shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking) to minimize bundle sizes. This results in a significantly smaller bundle size than [google-protobuf](https://www.npmjs.com/package/google-protobuf). ProtoScript's runtime is 67KB (9.6KB gzipped) compared to google-protobuf's 231KB (46KB gzipped). | ||
4. Small. ProtoScript's runtime and generated code are built to support [tree shaking](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking) to minimize bundle sizes. This results in a significantly smaller bundle size than [google-protobuf](https://www.npmjs.com/package/google-protobuf). ProtoScript's runtime is 67KB (9.6KB gzipped) compared to google-protobuf's 231KB (46KB gzipped). If you only use the generated JSON serializers, the protobuf runtime will be eliminated from the final build, resulting in a substantially smaller runtime (less than 1 KB). | ||
@@ -53,2 +58,64 @@ 5. Isomorphic. ProtoScript's generated serializers/deserializers can be consumed in the browser or Node.js runtimes. | ||
## Example | ||
If you have the following protobuf defined in `user.proto`: | ||
```protobuf | ||
syntax = "proto3"; | ||
message User { | ||
string first_name = 1; | ||
string last_name = 2; | ||
bool active = 3; | ||
User manager = 4; | ||
repeated string locations = 5; | ||
map<string, string> projects = 6; | ||
} | ||
``` | ||
Using the `User` generated by ProtoScript will look like this: | ||
```typescript | ||
import { User, UserJSON } from "./user.pb.js"; | ||
// protocol buffers | ||
const bytes = User.encode({ | ||
firstName: "Homer", | ||
lastName: "Simpson", | ||
active: true, | ||
locations: ["Springfield"], | ||
projects: { SPP: "Springfield Power Plant" }, | ||
manager: { | ||
firstName: "Montgomery", | ||
lastName: "Burns", | ||
}, | ||
}); | ||
console.log(bytes); | ||
const userFromBytes = User.decode(bytes); | ||
console.log(userFromBytes); | ||
// json | ||
const json = UserJSON.encode({ | ||
firstName: "Homer", | ||
lastName: "Simpson", | ||
active: true, | ||
locations: ["Springfield"], | ||
projects: { SPP: "Springfield Power Plant" }, | ||
manager: { | ||
firstName: "Montgomery", | ||
lastName: "Burns", | ||
}, | ||
}); | ||
console.log(json); | ||
const userFromJSON = UserJSON.decode(json); | ||
console.log(userFromJSON); | ||
// ProtoScript generates and consumes plain JavaScript objects (POJOs) over classes. If you want to generate a full message | ||
// with default fields, you can use the #initialize method on the generated message class: | ||
const user = User.initialize(); | ||
console.log(user); | ||
``` | ||
## Installation 📦 | ||
@@ -321,3 +388,3 @@ | ||
ProtoScript's JSON serialization/deserialization implements the [proto3 specification](https://developers.google.com/protocol-buffers/docs/proto3#json). This is nearly complete, but still in progress. | ||
ProtoScript's JSON serialization/deserialization implements the [proto3 specification](https://developers.google.com/protocol-buffers/docs/proto3#json). If you find a discrepancy, please open an issue. | ||
@@ -324,0 +391,0 @@ ProtoScript will serialize JSON keys as `lowerCamelCase` versions of the proto field. Per the proto3 spec, the runtime will accept both `lowerCamelCase` and the original proto field name when deserializing. You can provide the `json_name` field option to specify an alternate key name. When doing so, the runtime will encode JSON messages using the the `json_name` as the key, and will decode JSON messages using the `json_name` if present, otherwise falling back to the `lowerCamelCase` name and finally to the original proto field name. |
@@ -88,3 +88,3 @@ import { assert, fail } from "./goog/asserts.js"; | ||
this.bytes_ = byteSourceToUint8Array(data); | ||
this.start_ = opt_start !== undefined ? opt_start : 0; | ||
this.start_ = opt_start ?? 0; | ||
this.end_ = | ||
@@ -91,0 +91,0 @@ opt_length !== undefined ? this.start_ + opt_length : this.bytes_.length; |
@@ -5,1 +5,4 @@ export { BinaryReader } from "./reader.js"; | ||
export type ByteSource = ArrayBuffer | Uint8Array | number[] | string; | ||
export type PartialDeep<T> = { | ||
[P in keyof T]?: T[P] extends any[] ? T[P] : T[P] extends Record<any, any> ? T[P] : T[P] extends object | null | undefined ? PartialDeep<T[P]> : T[P]; | ||
}; |
@@ -1,2 +0,2 @@ | ||
import type { ByteSource } from "protoscript"; | ||
import type { ByteSource, PartialDeep } from "protoscript"; | ||
import { BinaryReader, BinaryWriter } from "protoscript"; | ||
@@ -28,4 +28,8 @@ /** | ||
* } | ||
* // or ... | ||
* if (any.isSameTypeAs(Foo.getDefaultInstance())) { | ||
* foo = any.unpack(Foo.getDefaultInstance()); | ||
* } | ||
* | ||
* Example 3: Pack and unpack a message in Python. | ||
* Example 3: Pack and unpack a message in Python. | ||
* | ||
@@ -40,3 +44,3 @@ * foo = Foo(...) | ||
* | ||
* Example 4: Pack and unpack a message in Go | ||
* Example 4: Pack and unpack a message in Go | ||
* | ||
@@ -60,5 +64,4 @@ * foo := &pb.Foo{...} | ||
* | ||
* | ||
* JSON | ||
* | ||
* ==== | ||
* The JSON representation of an `Any` value uses the regular | ||
@@ -132,3 +135,3 @@ * representation of the deserialized, embedded message, with an | ||
*/ | ||
encode: (msg: Partial<Any>) => Uint8Array; | ||
encode: (msg: PartialDeep<Any>) => Uint8Array; | ||
/** | ||
@@ -145,3 +148,3 @@ * Deserializes Any from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Any>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Any>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -156,3 +159,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Any>) => string; | ||
encode: (msg: PartialDeep<Any>) => string; | ||
/** | ||
@@ -169,3 +172,3 @@ * Deserializes Any from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Any>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Any>) => Record<string, unknown>; | ||
/** | ||
@@ -172,0 +175,0 @@ * @private |
@@ -1,2 +0,2 @@ | ||
import type { ByteSource } from "protoscript"; | ||
import type { ByteSource, PartialDeep } from "protoscript"; | ||
import { BinaryReader, BinaryWriter } from "protoscript"; | ||
@@ -50,3 +50,2 @@ import * as protoscript from "protoscript"; | ||
* | ||
* | ||
*/ | ||
@@ -149,3 +148,3 @@ version: string; | ||
* `Storage`. A documentation generator or annotation processor will | ||
* see the effective `Storage.GetAcl` method after inheriting | ||
* see the effective `Storage.GetAcl` method after inherting | ||
* documentation and annotations as follows: | ||
@@ -197,3 +196,3 @@ * | ||
*/ | ||
encode: (msg: Partial<Api>) => Uint8Array; | ||
encode: (msg: PartialDeep<Api>) => Uint8Array; | ||
/** | ||
@@ -210,3 +209,3 @@ * Deserializes Api from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Api>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Api>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -221,3 +220,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Method>) => Uint8Array; | ||
encode: (msg: PartialDeep<Method>) => Uint8Array; | ||
/** | ||
@@ -234,3 +233,3 @@ * Deserializes Method from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Method>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Method>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -245,3 +244,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Mixin>) => Uint8Array; | ||
encode: (msg: PartialDeep<Mixin>) => Uint8Array; | ||
/** | ||
@@ -258,3 +257,3 @@ * Deserializes Mixin from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Mixin>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Mixin>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -269,3 +268,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Api>) => string; | ||
encode: (msg: PartialDeep<Api>) => string; | ||
/** | ||
@@ -282,3 +281,3 @@ * Deserializes Api from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Api>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Api>) => Record<string, unknown>; | ||
/** | ||
@@ -293,3 +292,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Method>) => string; | ||
encode: (msg: PartialDeep<Method>) => string; | ||
/** | ||
@@ -306,3 +305,3 @@ * Deserializes Method from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Method>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Method>) => Record<string, unknown>; | ||
/** | ||
@@ -317,3 +316,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Mixin>) => string; | ||
encode: (msg: PartialDeep<Mixin>) => string; | ||
/** | ||
@@ -330,3 +329,3 @@ * Deserializes Mixin from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Mixin>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Mixin>) => Record<string, unknown>; | ||
/** | ||
@@ -333,0 +332,0 @@ * @private |
@@ -362,5 +362,3 @@ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
if (_sourceContext_) { | ||
const m = protoscript.SourceContextJSON.initialize(); | ||
protoscript.SourceContextJSON._readMessage(m, _sourceContext_); | ||
msg.sourceContext = m; | ||
protoscript.SourceContextJSON._readMessage(msg.sourceContext, _sourceContext_); | ||
} | ||
@@ -367,0 +365,0 @@ const _mixins_ = json["mixins"]; |
@@ -1,2 +0,2 @@ | ||
import type { ByteSource } from "protoscript"; | ||
import type { ByteSource, PartialDeep } from "protoscript"; | ||
import { BinaryReader, BinaryWriter } from "protoscript"; | ||
@@ -63,3 +63,2 @@ /** | ||
* | ||
* | ||
*/ | ||
@@ -87,3 +86,3 @@ export interface Duration { | ||
*/ | ||
encode: (msg: Partial<Duration>) => Uint8Array; | ||
encode: (msg: PartialDeep<Duration>) => Uint8Array; | ||
/** | ||
@@ -100,3 +99,3 @@ * Deserializes Duration from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Duration>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Duration>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -111,3 +110,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Duration>) => string; | ||
encode: (msg: PartialDeep<Duration>) => string; | ||
/** | ||
@@ -124,3 +123,3 @@ * Deserializes Duration from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Duration>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Duration>) => Record<string, unknown>; | ||
/** | ||
@@ -127,0 +126,0 @@ * @private |
@@ -1,2 +0,2 @@ | ||
import type { ByteSource } from "protoscript"; | ||
import type { ByteSource, PartialDeep } from "protoscript"; | ||
import { BinaryReader, BinaryWriter } from "protoscript"; | ||
@@ -19,3 +19,3 @@ /** | ||
*/ | ||
encode: (_msg?: Partial<Empty>) => Uint8Array; | ||
encode: (_msg?: PartialDeep<Empty>) => Uint8Array; | ||
/** | ||
@@ -32,3 +32,3 @@ * Deserializes Empty from protobuf. | ||
*/ | ||
_writeMessage: (_msg: Partial<Empty>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (_msg: PartialDeep<Empty>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -43,3 +43,3 @@ * @private | ||
*/ | ||
encode: (_msg?: Partial<Empty>) => string; | ||
encode: (_msg?: PartialDeep<Empty>) => string; | ||
/** | ||
@@ -56,3 +56,3 @@ * Deserializes Empty from JSON. | ||
*/ | ||
_writeMessage: (_msg: Partial<Empty>) => Record<string, unknown>; | ||
_writeMessage: (_msg: PartialDeep<Empty>) => Record<string, unknown>; | ||
/** | ||
@@ -59,0 +59,0 @@ * @private |
@@ -1,2 +0,2 @@ | ||
import type { ByteSource } from "protoscript"; | ||
import type { ByteSource, PartialDeep } from "protoscript"; | ||
import { BinaryReader, BinaryWriter } from "protoscript"; | ||
@@ -214,3 +214,3 @@ /** | ||
*/ | ||
encode: (msg: Partial<FieldMask>) => Uint8Array; | ||
encode: (msg: PartialDeep<FieldMask>) => Uint8Array; | ||
/** | ||
@@ -227,3 +227,3 @@ * Deserializes FieldMask from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<FieldMask>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<FieldMask>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -238,3 +238,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<FieldMask>) => string; | ||
encode: (msg: PartialDeep<FieldMask>) => string; | ||
/** | ||
@@ -251,3 +251,3 @@ * Deserializes FieldMask from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<FieldMask>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<FieldMask>) => Record<string, unknown>; | ||
/** | ||
@@ -254,0 +254,0 @@ * @private |
@@ -1,2 +0,2 @@ | ||
import type { ByteSource } from "protoscript"; | ||
import type { ByteSource, PartialDeep } from "protoscript"; | ||
import { BinaryReader, BinaryWriter } from "protoscript"; | ||
@@ -18,3 +18,3 @@ /** | ||
*/ | ||
encode: (msg: Partial<SourceContext>) => Uint8Array; | ||
encode: (msg: PartialDeep<SourceContext>) => Uint8Array; | ||
/** | ||
@@ -31,3 +31,3 @@ * Deserializes SourceContext from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<SourceContext>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<SourceContext>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -42,3 +42,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<SourceContext>) => string; | ||
encode: (msg: PartialDeep<SourceContext>) => string; | ||
/** | ||
@@ -55,3 +55,3 @@ * Deserializes SourceContext from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<SourceContext>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<SourceContext>) => Record<string, unknown>; | ||
/** | ||
@@ -58,0 +58,0 @@ * @private |
@@ -1,2 +0,2 @@ | ||
import type { ByteSource } from "protoscript"; | ||
import type { ByteSource, PartialDeep } from "protoscript"; | ||
import { BinaryReader, BinaryWriter } from "protoscript"; | ||
@@ -7,3 +7,3 @@ /** | ||
* | ||
* The JSON representation for `NullValue` is JSON `null`. | ||
* The JSON representation for `NullValue` is JSON `null`. | ||
*/ | ||
@@ -96,3 +96,3 @@ export type NullValue = "NULL_VALUE"; | ||
*/ | ||
encode: (msg: Partial<Struct>) => Uint8Array; | ||
encode: (msg: PartialDeep<Struct>) => Uint8Array; | ||
/** | ||
@@ -109,3 +109,3 @@ * Deserializes Struct from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Struct>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Struct>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -119,3 +119,3 @@ * @private | ||
*/ | ||
_writeMessage: (msg: Partial<Struct.Fields>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Struct.Fields>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -131,3 +131,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Value>) => Uint8Array; | ||
encode: (msg: PartialDeep<Value>) => Uint8Array; | ||
/** | ||
@@ -144,3 +144,3 @@ * Deserializes Value from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Value>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Value>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -155,3 +155,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<ListValue>) => Uint8Array; | ||
encode: (msg: PartialDeep<ListValue>) => Uint8Array; | ||
/** | ||
@@ -168,3 +168,3 @@ * Deserializes ListValue from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<ListValue>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<ListValue>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -193,3 +193,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Struct>) => string; | ||
encode: (msg: PartialDeep<Struct>) => string; | ||
/** | ||
@@ -206,3 +206,3 @@ * Deserializes Struct from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Struct>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Struct>) => Record<string, unknown>; | ||
/** | ||
@@ -216,3 +216,3 @@ * @private | ||
*/ | ||
_writeMessage: (msg: Partial<Struct.Fields>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Struct.Fields>) => Record<string, unknown>; | ||
/** | ||
@@ -228,3 +228,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Value>) => string; | ||
encode: (msg: PartialDeep<Value>) => string; | ||
/** | ||
@@ -241,3 +241,3 @@ * Deserializes Value from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Value>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Value>) => Record<string, unknown>; | ||
/** | ||
@@ -252,3 +252,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<ListValue>) => string; | ||
encode: (msg: PartialDeep<ListValue>) => string; | ||
/** | ||
@@ -265,3 +265,3 @@ * Deserializes ListValue from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<ListValue>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<ListValue>) => Record<string, unknown>; | ||
/** | ||
@@ -268,0 +268,0 @@ * @private |
@@ -393,5 +393,3 @@ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
if (_value_) { | ||
const m = ValueJSON.initialize(); | ||
ValueJSON._readMessage(m, _value_); | ||
msg.value = m; | ||
ValueJSON._readMessage(msg.value, _value_); | ||
} | ||
@@ -477,11 +475,9 @@ return msg; | ||
if (_structValue_) { | ||
const m = StructJSON.initialize(); | ||
StructJSON._readMessage(m, _structValue_); | ||
msg.structValue = m; | ||
msg.structValue = StructJSON.initialize(); | ||
StructJSON._readMessage(msg.structValue, _structValue_); | ||
} | ||
const _listValue_ = json["listValue"] ?? json["list_value"]; | ||
if (_listValue_) { | ||
const m = ListValueJSON.initialize(); | ||
ListValueJSON._readMessage(m, _listValue_); | ||
msg.listValue = m; | ||
msg.listValue = ListValueJSON.initialize(); | ||
ListValueJSON._readMessage(msg.listValue, _listValue_); | ||
} | ||
@@ -488,0 +484,0 @@ return msg; |
@@ -1,2 +0,2 @@ | ||
import type { ByteSource } from "protoscript"; | ||
import type { ByteSource, PartialDeep } from "protoscript"; | ||
import { BinaryReader, BinaryWriter } from "protoscript"; | ||
@@ -54,3 +54,2 @@ /** | ||
* | ||
* | ||
* Example 5: Compute Timestamp from Java `Instant.now()`. | ||
@@ -64,3 +63,2 @@ * | ||
* | ||
* | ||
* Example 6: Compute Timestamp from current time in Python. | ||
@@ -95,6 +93,5 @@ * | ||
* the Joda Time's [`ISODateTimeFormat.dateTime()`]( | ||
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D | ||
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() | ||
* ) to obtain a formatter capable of generating timestamps in this format. | ||
* | ||
* | ||
*/ | ||
@@ -120,3 +117,3 @@ export interface Timestamp { | ||
*/ | ||
encode: (msg: Partial<Timestamp>) => Uint8Array; | ||
encode: (msg: PartialDeep<Timestamp>) => Uint8Array; | ||
/** | ||
@@ -133,3 +130,3 @@ * Deserializes Timestamp from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Timestamp>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Timestamp>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -144,3 +141,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Timestamp>) => string; | ||
encode: (msg: PartialDeep<Timestamp>) => string; | ||
/** | ||
@@ -157,3 +154,3 @@ * Deserializes Timestamp from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Timestamp>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Timestamp>) => Record<string, unknown>; | ||
/** | ||
@@ -160,0 +157,0 @@ * @private |
@@ -1,2 +0,2 @@ | ||
import type { ByteSource } from "protoscript"; | ||
import type { ByteSource, PartialDeep } from "protoscript"; | ||
import { BinaryReader, BinaryWriter } from "protoscript"; | ||
@@ -7,3 +7,3 @@ import * as protoscript from "protoscript"; | ||
*/ | ||
export type Syntax = "SYNTAX_PROTO2" | "SYNTAX_PROTO3"; | ||
export type Syntax = "SYNTAX_PROTO2" | "SYNTAX_PROTO3" | "SYNTAX_EDITIONS"; | ||
/** | ||
@@ -37,2 +37,6 @@ * A protocol buffer message type. | ||
syntax: Syntax; | ||
/** | ||
* The source edition string, only valid when syntax is SYNTAX_EDITIONS. | ||
*/ | ||
edition: string; | ||
} | ||
@@ -120,2 +124,6 @@ /** | ||
syntax: Syntax; | ||
/** | ||
* The source edition string, only valid when syntax is SYNTAX_EDITIONS. | ||
*/ | ||
edition: string; | ||
} | ||
@@ -169,2 +177,6 @@ /** | ||
/** | ||
* Syntax `editions`. | ||
*/ | ||
readonly SYNTAX_EDITIONS: "SYNTAX_EDITIONS"; | ||
/** | ||
* @private | ||
@@ -182,3 +194,3 @@ */ | ||
*/ | ||
encode: (msg: Partial<Type>) => Uint8Array; | ||
encode: (msg: PartialDeep<Type>) => Uint8Array; | ||
/** | ||
@@ -195,3 +207,3 @@ * Deserializes Type from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Type>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Type>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -206,3 +218,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Field>) => Uint8Array; | ||
encode: (msg: PartialDeep<Field>) => Uint8Array; | ||
/** | ||
@@ -219,3 +231,3 @@ * Deserializes Field from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Field>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Field>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -342,3 +354,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Enum>) => Uint8Array; | ||
encode: (msg: PartialDeep<Enum>) => Uint8Array; | ||
/** | ||
@@ -355,3 +367,3 @@ * Deserializes Enum from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Enum>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Enum>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -366,3 +378,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<EnumValue>) => Uint8Array; | ||
encode: (msg: PartialDeep<EnumValue>) => Uint8Array; | ||
/** | ||
@@ -379,3 +391,3 @@ * Deserializes EnumValue from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<EnumValue>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<EnumValue>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -390,3 +402,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Option>) => Uint8Array; | ||
encode: (msg: PartialDeep<Option>) => Uint8Array; | ||
/** | ||
@@ -403,3 +415,3 @@ * Deserializes Option from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Option>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Option>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -420,2 +432,6 @@ * @private | ||
/** | ||
* Syntax `editions`. | ||
*/ | ||
readonly SYNTAX_EDITIONS: "SYNTAX_EDITIONS"; | ||
/** | ||
* @private | ||
@@ -433,3 +449,3 @@ */ | ||
*/ | ||
encode: (msg: Partial<Type>) => string; | ||
encode: (msg: PartialDeep<Type>) => string; | ||
/** | ||
@@ -446,3 +462,3 @@ * Deserializes Type from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Type>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Type>) => Record<string, unknown>; | ||
/** | ||
@@ -457,3 +473,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Field>) => string; | ||
encode: (msg: PartialDeep<Field>) => string; | ||
/** | ||
@@ -470,3 +486,3 @@ * Deserializes Field from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Field>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Field>) => Record<string, unknown>; | ||
/** | ||
@@ -593,3 +609,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Enum>) => string; | ||
encode: (msg: PartialDeep<Enum>) => string; | ||
/** | ||
@@ -606,3 +622,3 @@ * Deserializes Enum from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Enum>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Enum>) => Record<string, unknown>; | ||
/** | ||
@@ -617,3 +633,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<EnumValue>) => string; | ||
encode: (msg: PartialDeep<EnumValue>) => string; | ||
/** | ||
@@ -630,3 +646,3 @@ * Deserializes EnumValue from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<EnumValue>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<EnumValue>) => Record<string, unknown>; | ||
/** | ||
@@ -641,3 +657,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Option>) => string; | ||
encode: (msg: PartialDeep<Option>) => string; | ||
/** | ||
@@ -654,3 +670,3 @@ * Deserializes Option from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Option>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Option>) => Record<string, unknown>; | ||
/** | ||
@@ -657,0 +673,0 @@ * @private |
@@ -19,2 +19,6 @@ // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
/** | ||
* Syntax `editions`. | ||
*/ | ||
SYNTAX_EDITIONS: "SYNTAX_EDITIONS", | ||
/** | ||
* @private | ||
@@ -30,2 +34,5 @@ */ | ||
} | ||
case 2: { | ||
return "SYNTAX_EDITIONS"; | ||
} | ||
// unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date. | ||
@@ -48,2 +55,5 @@ default: { | ||
} | ||
case "SYNTAX_EDITIONS": { | ||
return 2; | ||
} | ||
// unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date. | ||
@@ -80,2 +90,3 @@ default: { | ||
syntax: Syntax._fromInt(0), | ||
edition: "", | ||
}; | ||
@@ -105,2 +116,5 @@ }, | ||
} | ||
if (msg.edition) { | ||
writer.writeString(7, msg.edition); | ||
} | ||
return writer; | ||
@@ -143,2 +157,6 @@ }, | ||
} | ||
case 7: { | ||
msg.edition = reader.readString(); | ||
break; | ||
} | ||
default: { | ||
@@ -578,2 +596,3 @@ reader.skipField(); | ||
syntax: Syntax._fromInt(0), | ||
edition: "", | ||
}; | ||
@@ -600,2 +619,5 @@ }, | ||
} | ||
if (msg.edition) { | ||
writer.writeString(6, msg.edition); | ||
} | ||
return writer; | ||
@@ -634,2 +656,6 @@ }, | ||
} | ||
case 6: { | ||
msg.edition = reader.readString(); | ||
break; | ||
} | ||
default: { | ||
@@ -783,2 +809,6 @@ reader.skipField(); | ||
/** | ||
* Syntax `editions`. | ||
*/ | ||
SYNTAX_EDITIONS: "SYNTAX_EDITIONS", | ||
/** | ||
* @private | ||
@@ -794,2 +824,5 @@ */ | ||
} | ||
case 2: { | ||
return "SYNTAX_EDITIONS"; | ||
} | ||
// unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date. | ||
@@ -812,2 +845,5 @@ default: { | ||
} | ||
case "SYNTAX_EDITIONS": { | ||
return 2; | ||
} | ||
// unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date. | ||
@@ -844,2 +880,3 @@ default: { | ||
syntax: Syntax._fromInt(0), | ||
edition: "", | ||
}; | ||
@@ -873,2 +910,5 @@ }, | ||
} | ||
if (msg.edition) { | ||
json["edition"] = msg.edition; | ||
} | ||
return json; | ||
@@ -906,5 +946,3 @@ }, | ||
if (_sourceContext_) { | ||
const m = protoscript.SourceContextJSON.initialize(); | ||
protoscript.SourceContextJSON._readMessage(m, _sourceContext_); | ||
msg.sourceContext = m; | ||
protoscript.SourceContextJSON._readMessage(msg.sourceContext, _sourceContext_); | ||
} | ||
@@ -915,2 +953,6 @@ const _syntax_ = json["syntax"]; | ||
} | ||
const _edition_ = json["edition"]; | ||
if (_edition_) { | ||
msg.edition = _edition_; | ||
} | ||
return msg; | ||
@@ -1338,2 +1380,3 @@ }, | ||
syntax: Syntax._fromInt(0), | ||
edition: "", | ||
}; | ||
@@ -1364,2 +1407,5 @@ }, | ||
} | ||
if (msg.edition) { | ||
json["edition"] = msg.edition; | ||
} | ||
return json; | ||
@@ -1393,5 +1439,3 @@ }, | ||
if (_sourceContext_) { | ||
const m = protoscript.SourceContextJSON.initialize(); | ||
protoscript.SourceContextJSON._readMessage(m, _sourceContext_); | ||
msg.sourceContext = m; | ||
protoscript.SourceContextJSON._readMessage(msg.sourceContext, _sourceContext_); | ||
} | ||
@@ -1402,2 +1446,6 @@ const _syntax_ = json["syntax"]; | ||
} | ||
const _edition_ = json["edition"]; | ||
if (_edition_) { | ||
msg.edition = _edition_; | ||
} | ||
return msg; | ||
@@ -1516,5 +1564,3 @@ }, | ||
if (_value_) { | ||
const m = protoscript.AnyJSON.initialize(); | ||
protoscript.AnyJSON._readMessage(m, _value_); | ||
msg.value = m; | ||
protoscript.AnyJSON._readMessage(msg.value, _value_); | ||
} | ||
@@ -1521,0 +1567,0 @@ return msg; |
@@ -1,2 +0,2 @@ | ||
import type { ByteSource } from "protoscript"; | ||
import type { ByteSource, PartialDeep } from "protoscript"; | ||
import { BinaryReader, BinaryWriter } from "protoscript"; | ||
@@ -106,3 +106,3 @@ /** | ||
*/ | ||
encode: (msg: Partial<DoubleValue>) => Uint8Array; | ||
encode: (msg: PartialDeep<DoubleValue>) => Uint8Array; | ||
/** | ||
@@ -119,3 +119,3 @@ * Deserializes DoubleValue from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<DoubleValue>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<DoubleValue>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -130,3 +130,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<FloatValue>) => Uint8Array; | ||
encode: (msg: PartialDeep<FloatValue>) => Uint8Array; | ||
/** | ||
@@ -143,3 +143,3 @@ * Deserializes FloatValue from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<FloatValue>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<FloatValue>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -154,3 +154,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Int64Value>) => Uint8Array; | ||
encode: (msg: PartialDeep<Int64Value>) => Uint8Array; | ||
/** | ||
@@ -167,3 +167,3 @@ * Deserializes Int64Value from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Int64Value>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Int64Value>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -178,3 +178,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<UInt64Value>) => Uint8Array; | ||
encode: (msg: PartialDeep<UInt64Value>) => Uint8Array; | ||
/** | ||
@@ -191,3 +191,3 @@ * Deserializes UInt64Value from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<UInt64Value>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<UInt64Value>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -202,3 +202,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Int32Value>) => Uint8Array; | ||
encode: (msg: PartialDeep<Int32Value>) => Uint8Array; | ||
/** | ||
@@ -215,3 +215,3 @@ * Deserializes Int32Value from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<Int32Value>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<Int32Value>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -226,3 +226,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<UInt32Value>) => Uint8Array; | ||
encode: (msg: PartialDeep<UInt32Value>) => Uint8Array; | ||
/** | ||
@@ -239,3 +239,3 @@ * Deserializes UInt32Value from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<UInt32Value>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<UInt32Value>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -250,3 +250,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<BoolValue>) => Uint8Array; | ||
encode: (msg: PartialDeep<BoolValue>) => Uint8Array; | ||
/** | ||
@@ -263,3 +263,3 @@ * Deserializes BoolValue from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<BoolValue>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<BoolValue>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -274,3 +274,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<StringValue>) => Uint8Array; | ||
encode: (msg: PartialDeep<StringValue>) => Uint8Array; | ||
/** | ||
@@ -287,3 +287,3 @@ * Deserializes StringValue from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<StringValue>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<StringValue>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -298,3 +298,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<BytesValue>) => Uint8Array; | ||
encode: (msg: PartialDeep<BytesValue>) => Uint8Array; | ||
/** | ||
@@ -311,3 +311,3 @@ * Deserializes BytesValue from protobuf. | ||
*/ | ||
_writeMessage: (msg: Partial<BytesValue>, writer: BinaryWriter) => BinaryWriter; | ||
_writeMessage: (msg: PartialDeep<BytesValue>, writer: BinaryWriter) => BinaryWriter; | ||
/** | ||
@@ -322,3 +322,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<DoubleValue>) => string; | ||
encode: (msg: PartialDeep<DoubleValue>) => string; | ||
/** | ||
@@ -335,3 +335,3 @@ * Deserializes DoubleValue from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<DoubleValue>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<DoubleValue>) => Record<string, unknown>; | ||
/** | ||
@@ -346,3 +346,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<FloatValue>) => string; | ||
encode: (msg: PartialDeep<FloatValue>) => string; | ||
/** | ||
@@ -359,3 +359,3 @@ * Deserializes FloatValue from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<FloatValue>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<FloatValue>) => Record<string, unknown>; | ||
/** | ||
@@ -370,3 +370,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Int64Value>) => string; | ||
encode: (msg: PartialDeep<Int64Value>) => string; | ||
/** | ||
@@ -383,3 +383,3 @@ * Deserializes Int64Value from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Int64Value>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Int64Value>) => Record<string, unknown>; | ||
/** | ||
@@ -394,3 +394,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<UInt64Value>) => string; | ||
encode: (msg: PartialDeep<UInt64Value>) => string; | ||
/** | ||
@@ -407,3 +407,3 @@ * Deserializes UInt64Value from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<UInt64Value>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<UInt64Value>) => Record<string, unknown>; | ||
/** | ||
@@ -418,3 +418,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<Int32Value>) => string; | ||
encode: (msg: PartialDeep<Int32Value>) => string; | ||
/** | ||
@@ -431,3 +431,3 @@ * Deserializes Int32Value from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<Int32Value>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<Int32Value>) => Record<string, unknown>; | ||
/** | ||
@@ -442,3 +442,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<UInt32Value>) => string; | ||
encode: (msg: PartialDeep<UInt32Value>) => string; | ||
/** | ||
@@ -455,3 +455,3 @@ * Deserializes UInt32Value from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<UInt32Value>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<UInt32Value>) => Record<string, unknown>; | ||
/** | ||
@@ -466,3 +466,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<BoolValue>) => string; | ||
encode: (msg: PartialDeep<BoolValue>) => string; | ||
/** | ||
@@ -479,3 +479,3 @@ * Deserializes BoolValue from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<BoolValue>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<BoolValue>) => Record<string, unknown>; | ||
/** | ||
@@ -490,3 +490,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<StringValue>) => string; | ||
encode: (msg: PartialDeep<StringValue>) => string; | ||
/** | ||
@@ -503,3 +503,3 @@ * Deserializes StringValue from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<StringValue>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<StringValue>) => Record<string, unknown>; | ||
/** | ||
@@ -514,3 +514,3 @@ * @private | ||
*/ | ||
encode: (msg: Partial<BytesValue>) => string; | ||
encode: (msg: PartialDeep<BytesValue>) => string; | ||
/** | ||
@@ -527,3 +527,3 @@ * Deserializes BytesValue from JSON. | ||
*/ | ||
_writeMessage: (msg: Partial<BytesValue>) => Record<string, unknown>; | ||
_writeMessage: (msg: PartialDeep<BytesValue>) => Record<string, unknown>; | ||
/** | ||
@@ -530,0 +530,0 @@ * @private |
@@ -936,3 +936,3 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ | ||
writePackedInt32(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -950,3 +950,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedInt32String(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -963,3 +963,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedInt64(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1016,3 +1016,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedInt64String(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1030,3 +1030,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedUint32(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1044,3 +1044,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedUint32String(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1057,3 +1057,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedUint64(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1071,3 +1071,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedUint64String(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1085,3 +1085,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedSint32(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1098,3 +1098,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedSint64(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1112,3 +1112,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedSint64String(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1126,3 +1126,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedSintHash64(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1139,3 +1139,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedFixed32(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1152,3 +1152,3 @@ this.writeFieldHeader_(field, WireType.DELIMITED); | ||
writePackedFixed64(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1166,3 +1166,3 @@ this.writeFieldHeader_(field, WireType.DELIMITED); | ||
writePackedFixed64String(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1180,3 +1180,3 @@ this.writeFieldHeader_(field, WireType.DELIMITED); | ||
writePackedSfixed32(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1193,3 +1193,3 @@ this.writeFieldHeader_(field, WireType.DELIMITED); | ||
writePackedSfixed64(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1206,3 +1206,3 @@ this.writeFieldHeader_(field, WireType.DELIMITED); | ||
writePackedSfixed64String(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1219,3 +1219,3 @@ this.writeFieldHeader_(field, WireType.DELIMITED); | ||
writePackedFloat(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1232,3 +1232,3 @@ this.writeFieldHeader_(field, WireType.DELIMITED); | ||
writePackedDouble(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1245,3 +1245,3 @@ this.writeFieldHeader_(field, WireType.DELIMITED); | ||
writePackedBool(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1258,3 +1258,3 @@ this.writeFieldHeader_(field, WireType.DELIMITED); | ||
writePackedEnum(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1272,3 +1272,3 @@ const bookmark = this.beginDelimited_(field); | ||
writePackedFixedHash64(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1286,3 +1286,3 @@ this.writeFieldHeader_(field, WireType.DELIMITED); | ||
writePackedVarintHash64(field, value) { | ||
if (value == null || !value.length) | ||
if (!value?.length) | ||
return; | ||
@@ -1289,0 +1289,0 @@ const bookmark = this.beginDelimited_(field); |
Sorry, the diff of this file is not supported yet
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
659944
21639
397
+ Addedprettier@3.4.2(transitive)
- Removedprettier@2.8.8(transitive)
Updatedgoogle-protobuf@^3.21.2
Updatedprettier@^3.0.0