@bufbuild/protobuf 0.0.1-alpha.1 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -1
- package/dist/cjs/binary-encoding.js +402 -410
- package/dist/cjs/descriptor-registry.js +407 -449
- package/dist/cjs/descriptor-set.js +416 -513
- package/dist/cjs/field.js +30 -30
- package/dist/cjs/google/protobuf/any_pb.js +122 -140
- package/dist/cjs/google/protobuf/api_pb.js +177 -224
- package/dist/cjs/google/protobuf/compiler/plugin_pb.js +125 -227
- package/dist/cjs/google/protobuf/descriptor_pb.js +1029 -1888
- package/dist/cjs/google/protobuf/duration_pb.js +72 -88
- package/dist/cjs/google/protobuf/empty_pb.js +17 -17
- package/dist/cjs/google/protobuf/field_mask_pb.js +77 -94
- package/dist/cjs/google/protobuf/source_context_pb.js +25 -25
- package/dist/cjs/google/protobuf/struct_pb.js +144 -181
- package/dist/cjs/google/protobuf/timestamp_pb.js +86 -123
- package/dist/cjs/google/protobuf/type_pb.js +406 -462
- package/dist/cjs/google/protobuf/wrappers_pb.js +407 -470
- package/dist/cjs/index.js +24 -122
- package/dist/cjs/message.js +81 -89
- package/dist/cjs/private/assert.js +20 -26
- package/dist/cjs/private/base64.js +79 -78
- package/dist/cjs/private/binary-format-common.js +195 -208
- package/dist/cjs/private/binary-format-proto2.js +75 -109
- package/dist/cjs/private/binary-format-proto3.js +57 -90
- package/dist/cjs/private/enum.js +38 -43
- package/dist/cjs/private/field-list.js +51 -50
- package/dist/cjs/private/field-wrapper.js +8 -10
- package/dist/cjs/private/field.js +22 -25
- package/dist/cjs/private/goog-varint.js +275 -0
- package/dist/cjs/private/json-format-common.js +414 -440
- package/dist/cjs/private/json-format-proto2.js +78 -89
- package/dist/cjs/private/json-format-proto3.js +69 -93
- package/dist/cjs/private/message-type.js +26 -27
- package/dist/cjs/private/names.js +58 -62
- package/dist/cjs/private/proto-runtime.js +11 -16
- package/dist/cjs/private/scalars.js +100 -103
- package/dist/cjs/private/util-common.js +180 -210
- package/dist/cjs/proto-int64.js +111 -112
- package/dist/cjs/proto2.js +50 -63
- package/dist/cjs/proto3.js +61 -74
- package/dist/cjs/service-type.js +14 -17
- package/dist/cjs/type-registry.js +33 -31
- package/dist/esm/binary-encoding.js +401 -414
- package/dist/esm/descriptor-registry.js +409 -458
- package/dist/esm/descriptor-set.js +417 -478
- package/dist/esm/field.js +29 -29
- package/dist/esm/google/protobuf/any_pb.js +122 -140
- package/dist/esm/google/protobuf/api_pb.js +177 -197
- package/dist/esm/google/protobuf/compiler/plugin_pb.js +123 -216
- package/dist/esm/google/protobuf/descriptor_pb.js +1013 -1804
- package/dist/esm/google/protobuf/duration_pb.js +72 -88
- package/dist/esm/google/protobuf/empty_pb.js +17 -17
- package/dist/esm/google/protobuf/field_mask_pb.js +77 -94
- package/dist/esm/google/protobuf/source_context_pb.js +25 -25
- package/dist/esm/google/protobuf/struct_pb.js +143 -180
- package/dist/esm/google/protobuf/timestamp_pb.js +86 -123
- package/dist/esm/google/protobuf/type_pb.js +401 -421
- package/dist/esm/google/protobuf/wrappers_pb.js +406 -397
- package/dist/esm/index.js +1 -1
- package/dist/esm/message.js +81 -89
- package/dist/esm/private/assert.js +19 -21
- package/dist/esm/private/base64.js +79 -78
- package/dist/esm/private/binary-format-common.js +196 -207
- package/dist/esm/private/binary-format-proto2.js +76 -81
- package/dist/esm/private/binary-format-proto3.js +58 -67
- package/dist/esm/private/enum.js +38 -43
- package/dist/esm/private/field-list.js +51 -50
- package/dist/esm/private/field-wrapper.js +8 -10
- package/dist/esm/private/field.js +22 -22
- package/dist/esm/private/goog-varint.js +266 -0
- package/dist/esm/private/json-format-common.js +414 -435
- package/dist/esm/private/json-format-proto2.js +76 -81
- package/dist/esm/private/json-format-proto3.js +66 -80
- package/dist/esm/private/message-type.js +27 -28
- package/dist/esm/private/names.js +57 -57
- package/dist/esm/private/proto-runtime.js +11 -11
- package/dist/esm/private/scalars.js +99 -99
- package/dist/esm/private/util-common.js +180 -192
- package/dist/esm/proto-int64.js +111 -112
- package/dist/esm/proto2.js +50 -57
- package/dist/esm/proto3.js +61 -68
- package/dist/esm/service-type.js +12 -12
- package/dist/esm/type-registry.js +33 -31
- package/dist/types/binary-encoding.d.ts +398 -398
- package/dist/types/binary-format.d.ts +69 -91
- package/dist/types/descriptor-registry.d.ts +23 -29
- package/dist/types/descriptor-set.d.ts +107 -128
- package/dist/types/enum.d.ts +21 -21
- package/dist/types/field-list.d.ts +21 -21
- package/dist/types/field.d.ts +191 -231
- package/dist/types/google/protobuf/any_pb.d.ts +56 -77
- package/dist/types/google/protobuf/api_pb.d.ts +144 -187
- package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +195 -257
- package/dist/types/google/protobuf/descriptor_pb.d.ts +1360 -1737
- package/dist/types/google/protobuf/duration_pb.d.ts +30 -50
- package/dist/types/google/protobuf/empty_pb.d.ts +9 -28
- package/dist/types/google/protobuf/field_mask_pb.d.ts +17 -37
- package/dist/types/google/protobuf/source_context_pb.d.ts +16 -35
- package/dist/types/google/protobuf/struct_pb.d.ts +64 -115
- package/dist/types/google/protobuf/timestamp_pb.d.ts +31 -51
- package/dist/types/google/protobuf/type_pb.d.ts +355 -422
- package/dist/types/google/protobuf/wrappers_pb.d.ts +181 -297
- package/dist/types/index.d.ts +4 -27
- package/dist/types/json-format.d.ts +70 -89
- package/dist/types/message-type.d.ts +38 -46
- package/dist/types/message.d.ts +73 -99
- package/dist/types/private/assert.d.ts +1 -4
- package/dist/types/private/binary-format-common.d.ts +6 -32
- package/dist/types/private/enum.d.ts +4 -11
- package/dist/types/private/field-list.d.ts +14 -21
- package/dist/types/private/field-wrapper.d.ts +5 -11
- package/dist/types/private/field.d.ts +12 -12
- package/dist/types/{google/varint.d.ts → private/goog-varint.d.ts} +6 -13
- package/dist/types/private/json-format-common.d.ts +5 -27
- package/dist/types/private/message-type.d.ts +3 -8
- package/dist/types/private/names.d.ts +1 -4
- package/dist/types/private/options-map.d.ts +1 -1
- package/dist/types/private/proto-runtime.d.ts +29 -42
- package/dist/types/private/scalars.d.ts +5 -12
- package/dist/types/private/util-common.d.ts +1 -4
- package/dist/types/private/util.d.ts +29 -41
- package/dist/types/proto-int64.d.ts +42 -42
- package/dist/types/service-type.d.ts +37 -57
- package/dist/types/type-registry.d.ts +13 -15
- package/package.json +2 -2
- package/dist/cjs/google/varint.js +0 -280
- package/dist/esm/google/varint.js +0 -265
|
@@ -17,11 +17,7 @@ export declare function varint64read(this: ReaderLike): [number, number];
|
|
|
17
17
|
*
|
|
18
18
|
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344
|
|
19
19
|
*/
|
|
20
|
-
export declare function varint64write(
|
|
21
|
-
lo: number,
|
|
22
|
-
hi: number,
|
|
23
|
-
bytes: number[]
|
|
24
|
-
): void;
|
|
20
|
+
export declare function varint64write(lo: number, hi: number, bytes: number[]): void;
|
|
25
21
|
/**
|
|
26
22
|
* Parse decimal string of 64 bit integer value as two JS numbers.
|
|
27
23
|
*
|
|
@@ -38,10 +34,7 @@ export declare function int64fromString(dec: string): [boolean, number, number];
|
|
|
38
34
|
*
|
|
39
35
|
* Copyright 2008 Google Inc.
|
|
40
36
|
*/
|
|
41
|
-
export declare function int64toString(
|
|
42
|
-
bitsLow: number,
|
|
43
|
-
bitsHigh: number
|
|
44
|
-
): string;
|
|
37
|
+
export declare function int64toString(bitsLow: number, bitsHigh: number): string;
|
|
45
38
|
/**
|
|
46
39
|
* Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`
|
|
47
40
|
*
|
|
@@ -57,9 +50,9 @@ export declare function varint32write(value: number, bytes: number[]): void;
|
|
|
57
50
|
*/
|
|
58
51
|
export declare function varint32read(this: ReaderLike): number;
|
|
59
52
|
declare type ReaderLike = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
buf: Uint8Array;
|
|
54
|
+
pos: number;
|
|
55
|
+
len: number;
|
|
56
|
+
assertBounds(): void;
|
|
64
57
|
};
|
|
65
58
|
export {};
|
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
JsonFormat,
|
|
3
|
-
JsonValue,
|
|
4
|
-
JsonWriteOptions,
|
|
5
|
-
} from "../json-format.js";
|
|
1
|
+
import type { JsonFormat, JsonValue, JsonWriteOptions } from "../json-format.js";
|
|
6
2
|
import { FieldInfo, ScalarType } from "../field.js";
|
|
7
3
|
import type { EnumType } from "../enum.js";
|
|
8
|
-
declare type JsonFormatWriteFieldFn = (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
) => JsonValue | undefined;
|
|
13
|
-
export declare function makeJsonFormatCommon(
|
|
14
|
-
makeWriteField: (
|
|
15
|
-
writeEnumFn: typeof writeEnum,
|
|
16
|
-
writeScalarFn: typeof writeScalar
|
|
17
|
-
) => JsonFormatWriteFieldFn
|
|
18
|
-
): JsonFormat;
|
|
19
|
-
declare function writeEnum(
|
|
20
|
-
type: EnumType,
|
|
21
|
-
value: number | undefined,
|
|
22
|
-
emitIntrinsicDefault: boolean,
|
|
23
|
-
enumAsInteger: boolean
|
|
24
|
-
): JsonValue | undefined;
|
|
25
|
-
declare function writeScalar(
|
|
26
|
-
type: ScalarType,
|
|
27
|
-
value: any,
|
|
28
|
-
emitIntrinsicDefault: boolean
|
|
29
|
-
): JsonValue | undefined;
|
|
4
|
+
declare type JsonFormatWriteFieldFn = (field: FieldInfo, value: any, options: JsonWriteOptions) => JsonValue | undefined;
|
|
5
|
+
export declare function makeJsonFormatCommon(makeWriteField: (writeEnumFn: typeof writeEnum, writeScalarFn: typeof writeScalar) => JsonFormatWriteFieldFn): JsonFormat;
|
|
6
|
+
declare function writeEnum(type: EnumType, value: number | undefined, emitIntrinsicDefault: boolean, enumAsInteger: boolean): JsonValue | undefined;
|
|
7
|
+
declare function writeScalar(type: ScalarType, value: any, emitIntrinsicDefault: boolean): JsonValue | undefined;
|
|
30
8
|
export {};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DynamicMessage, Message } from "../message.js";
|
|
2
2
|
import type { FieldListSource } from "./field-list.js";
|
|
3
3
|
import type { MessageType } from "../message-type.js";
|
|
4
4
|
import type { ProtoRuntime } from "./proto-runtime.js";
|
|
5
5
|
/**
|
|
6
6
|
* Create a new message type using the given runtime.
|
|
7
7
|
*/
|
|
8
|
-
export declare function makeMessageType<T extends Message
|
|
9
|
-
runtime: ProtoRuntime,
|
|
10
|
-
typeName: string,
|
|
11
|
-
fields: FieldListSource,
|
|
12
|
-
opt?: {
|
|
8
|
+
export declare function makeMessageType<T extends Message = DynamicMessage>(runtime: ProtoRuntime, typeName: string, fields: FieldListSource, opt?: {
|
|
13
9
|
localName?: string;
|
|
14
|
-
|
|
15
|
-
): MessageType<T>;
|
|
10
|
+
}): MessageType<T>;
|
|
@@ -5,10 +5,7 @@ export declare function makeJsonName(protoName: string): string;
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns the local name of a field, exactly like protoc-gen-es does.
|
|
7
7
|
*/
|
|
8
|
-
export declare function makeFieldName(
|
|
9
|
-
protoName: string,
|
|
10
|
-
inOneof: boolean
|
|
11
|
-
): string;
|
|
8
|
+
export declare function makeFieldName(protoName: string, inOneof: boolean): string;
|
|
12
9
|
/**
|
|
13
10
|
* Returns the local name of a oneof group, exactly like protoc-gen-es does.
|
|
14
11
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JsonFormat, JsonValue } from "../json-format.js";
|
|
2
2
|
import type { BinaryFormat } from "../binary-format.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { DynamicMessage } from "../message.js";
|
|
4
4
|
import type { Message } from "../message.js";
|
|
5
5
|
import type { EnumType, EnumValueInfo } from "../enum.js";
|
|
6
6
|
import type { MessageType } from "../message-type.js";
|
|
@@ -11,45 +11,32 @@ import type { Util } from "./util.js";
|
|
|
11
11
|
* A facade that provides serialization and other internal functionality.
|
|
12
12
|
*/
|
|
13
13
|
export interface ProtoRuntime {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
): EnumType;
|
|
43
|
-
/**
|
|
44
|
-
* Get reflection information from a generated enum.
|
|
45
|
-
* If this function is called on something other than a generated
|
|
46
|
-
* enum, it raises an error.
|
|
47
|
-
*/
|
|
48
|
-
getEnumType(enumObject: EnumObject): EnumType;
|
|
14
|
+
readonly syntax: string;
|
|
15
|
+
readonly json: JsonFormat;
|
|
16
|
+
readonly bin: BinaryFormat;
|
|
17
|
+
readonly util: Util;
|
|
18
|
+
/**
|
|
19
|
+
* Create a message type at runtime, without generating code.
|
|
20
|
+
*/
|
|
21
|
+
makeMessageType<T extends Message = DynamicMessage>(typeName: string, fields: FieldListSource, opt?: {
|
|
22
|
+
localName?: string;
|
|
23
|
+
options?: {
|
|
24
|
+
readonly [extensionName: string]: JsonValue;
|
|
25
|
+
};
|
|
26
|
+
}): MessageType<T>;
|
|
27
|
+
/**
|
|
28
|
+
* Create an enum type at runtime, without generating code.
|
|
29
|
+
*/
|
|
30
|
+
makeEnumType(typeName: string, values: EnumValueInfo[], opt?: {
|
|
31
|
+
options?: {
|
|
32
|
+
readonly [extensionName: string]: JsonValue;
|
|
33
|
+
};
|
|
34
|
+
}): EnumType;
|
|
35
|
+
/**
|
|
36
|
+
* Get reflection information from a generated enum.
|
|
37
|
+
* If this function is called on something other than a generated
|
|
38
|
+
* enum, it raises an error.
|
|
39
|
+
*/
|
|
40
|
+
getEnumType(enumObject: EnumObject): EnumType;
|
|
49
41
|
}
|
|
50
|
-
export declare function makeProtoRuntime(
|
|
51
|
-
syntax: string,
|
|
52
|
-
json: JsonFormat,
|
|
53
|
-
bin: BinaryFormat,
|
|
54
|
-
util: Util
|
|
55
|
-
): ProtoRuntime;
|
|
42
|
+
export declare function makeProtoRuntime(syntax: string, json: JsonFormat, bin: BinaryFormat, util: Util): ProtoRuntime;
|
|
@@ -3,11 +3,7 @@ import { IBinaryWriter, WireType } from "../binary-encoding.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns true if both scalar values are equal.
|
|
5
5
|
*/
|
|
6
|
-
export declare function scalarEquals(
|
|
7
|
-
type: ScalarType,
|
|
8
|
-
a: string | boolean | number | bigint | Uint8Array | undefined,
|
|
9
|
-
b: string | boolean | number | bigint | Uint8Array | undefined
|
|
10
|
-
): boolean;
|
|
6
|
+
export declare function scalarEquals(type: ScalarType, a: string | boolean | number | bigint | Uint8Array | undefined, b: string | boolean | number | bigint | Uint8Array | undefined): boolean;
|
|
11
7
|
/**
|
|
12
8
|
* Returns the default value for the given scalar type, following
|
|
13
9
|
* proto3 semantics.
|
|
@@ -23,11 +19,8 @@ export declare function scalarDefaultValue(type: ScalarType): any;
|
|
|
23
19
|
*
|
|
24
20
|
* If argument `value` is omitted, [2] is always false.
|
|
25
21
|
*/
|
|
26
|
-
export declare function scalarTypeInfo(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
WireType,
|
|
31
|
-
Exclude<keyof IBinaryWriter, "tag" | "raw" | "fork" | "join" | "finish">,
|
|
32
|
-
boolean
|
|
22
|
+
export declare function scalarTypeInfo(type: ScalarType, value?: any): [
|
|
23
|
+
WireType,
|
|
24
|
+
Exclude<keyof IBinaryWriter, "tag" | "raw" | "fork" | "join" | "finish">,
|
|
25
|
+
boolean
|
|
33
26
|
];
|
|
@@ -11,45 +11,33 @@ import type { EnumValueInfo } from "../enum.js";
|
|
|
11
11
|
* future release.
|
|
12
12
|
*/
|
|
13
13
|
export interface Util {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* Compares two messages of the same type recursively.
|
|
44
|
-
* Will also return true if both messages are `undefined`.
|
|
45
|
-
*/
|
|
46
|
-
equals<T extends Message<T>>(
|
|
47
|
-
type: MessageType,
|
|
48
|
-
a: T | PlainMessage<T> | undefined,
|
|
49
|
-
b: T | PlainMessage<T> | undefined
|
|
50
|
-
): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Create a deep copy.
|
|
53
|
-
*/
|
|
54
|
-
clone<T extends Message<T>>(message: T): T;
|
|
14
|
+
/**
|
|
15
|
+
* Create a field list
|
|
16
|
+
*/
|
|
17
|
+
newFieldList(fields: FieldListSource): FieldList;
|
|
18
|
+
/**
|
|
19
|
+
* Sets reflection information on a generated enum.
|
|
20
|
+
*/
|
|
21
|
+
setEnumType(enumObject: EnumObject, typeName: string, values: EnumValueInfo[], opt?: {
|
|
22
|
+
options?: {
|
|
23
|
+
readonly [extensionName: string]: JsonValue;
|
|
24
|
+
};
|
|
25
|
+
}): void;
|
|
26
|
+
/**
|
|
27
|
+
* Set default field values on the target message.
|
|
28
|
+
*/
|
|
29
|
+
initFields(target: Message): void;
|
|
30
|
+
/**
|
|
31
|
+
* Set specified field values on the target message, recursively.
|
|
32
|
+
*/
|
|
33
|
+
initPartial<T extends Message>(source: PartialMessage<T> | undefined, target: T): void;
|
|
34
|
+
/**
|
|
35
|
+
* Compares two messages of the same type recursively.
|
|
36
|
+
* Will also return true if both messages are `undefined`.
|
|
37
|
+
*/
|
|
38
|
+
equals<T extends Message>(type: MessageType, a: T | PlainMessage<T> | undefined, b: T | PlainMessage<T> | undefined): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Create a deep copy.
|
|
41
|
+
*/
|
|
42
|
+
clone<T extends Message>(message: T): T;
|
|
55
43
|
}
|
|
@@ -47,48 +47,48 @@
|
|
|
47
47
|
* on a two's complement, for example the npm package "long".
|
|
48
48
|
*/
|
|
49
49
|
interface Int64Support {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
50
|
+
/**
|
|
51
|
+
* 0n if bigint is available, "0" if unavailable.
|
|
52
|
+
*/
|
|
53
|
+
readonly zero: bigint;
|
|
54
|
+
/**
|
|
55
|
+
* Is bigint available?
|
|
56
|
+
*/
|
|
57
|
+
readonly supported: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Parse a signed 64-bit integer.
|
|
60
|
+
* Returns a bigint if available, a string otherwise.
|
|
61
|
+
*/
|
|
62
|
+
parse(value: string | number | bigint): bigint;
|
|
63
|
+
/**
|
|
64
|
+
* Parse an unsigned 64-bit integer.
|
|
65
|
+
* Returns a bigint if available, a string otherwise.
|
|
66
|
+
*/
|
|
67
|
+
uParse(value: string | number | bigint): bigint;
|
|
68
|
+
/**
|
|
69
|
+
* Convert a signed 64-bit integral value to a two's complement.
|
|
70
|
+
*/
|
|
71
|
+
enc(value: string | number | bigint): {
|
|
72
|
+
lo: number;
|
|
73
|
+
hi: number;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Convert an unsigned 64-bit integral value to a two's complement.
|
|
77
|
+
*/
|
|
78
|
+
uEnc(value: string | number | bigint): {
|
|
79
|
+
lo: number;
|
|
80
|
+
hi: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Convert a two's complement to a signed 64-bit integral value.
|
|
84
|
+
* Returns a bigint if available, a string otherwise.
|
|
85
|
+
*/
|
|
86
|
+
dec(lo: number, hi: number): bigint;
|
|
87
|
+
/**
|
|
88
|
+
* Convert a two's complement to an unsigned 64-bit integral value.
|
|
89
|
+
* Returns a bigint if available, a string otherwise.
|
|
90
|
+
*/
|
|
91
|
+
uDec(lo: number, hi: number): bigint;
|
|
92
92
|
}
|
|
93
93
|
export declare const protoInt64: Int64Support;
|
|
94
94
|
export {};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DynamicMessage, Message } from "./message.js";
|
|
2
2
|
import type { MessageType } from "./message-type.js";
|
|
3
3
|
/**
|
|
4
4
|
* ServiceType represents a protobuf services. It provides metadata for
|
|
5
5
|
* reflection-based operations.
|
|
6
6
|
*/
|
|
7
7
|
export interface ServiceType {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The fully qualified name of the service.
|
|
10
|
+
*/
|
|
11
|
+
readonly typeName: string;
|
|
12
|
+
/**
|
|
13
|
+
* A map of local name (safe to use in ECMAScript) to method.
|
|
14
|
+
*/
|
|
15
|
+
readonly methods: {
|
|
16
|
+
[localName: string]: MethodInfo;
|
|
17
|
+
};
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* MethodInfo represents a method of a protobuf service, a remote procedure
|
|
@@ -29,56 +29,36 @@ export interface ServiceType {
|
|
|
29
29
|
* - "idempotency": User-provided indication whether the method will cause
|
|
30
30
|
* the same effect every time it is called.
|
|
31
31
|
*/
|
|
32
|
-
export declare type MethodInfo<
|
|
33
|
-
I extends Message<I> = AnyMessage,
|
|
34
|
-
O extends Message<O> = AnyMessage
|
|
35
|
-
> =
|
|
36
|
-
| MethodInfoUnary<I, O>
|
|
37
|
-
| MethodInfoServerStreaming<I, O>
|
|
38
|
-
| MethodInfoClientStreaming<I, O>
|
|
39
|
-
| MethodInfoBiDiStreaming<I, O>;
|
|
32
|
+
export declare type MethodInfo<I extends Message = DynamicMessage, O extends Message = DynamicMessage> = MethodInfoUnary<I, O> | MethodInfoServerStreaming<I, O> | MethodInfoClientStreaming<I, O> | MethodInfoBiDiStreaming<I, O>;
|
|
40
33
|
/**
|
|
41
34
|
* A unary method: rpc (Input) returns (Output)
|
|
42
35
|
*/
|
|
43
|
-
export interface MethodInfoUnary<I extends Message
|
|
44
|
-
|
|
45
|
-
readonly kind: MethodKind.Unary;
|
|
36
|
+
export interface MethodInfoUnary<I extends Message, O extends Message> extends miShared<I, O> {
|
|
37
|
+
readonly kind: MethodKind.Unary;
|
|
46
38
|
}
|
|
47
39
|
/**
|
|
48
40
|
* A server streaming method: rpc (Input) returns (stream Output)
|
|
49
41
|
*/
|
|
50
|
-
export interface MethodInfoServerStreaming<
|
|
51
|
-
|
|
52
|
-
O extends Message<O>
|
|
53
|
-
> extends miShared<I, O> {
|
|
54
|
-
readonly kind: MethodKind.ServerStreaming;
|
|
42
|
+
export interface MethodInfoServerStreaming<I extends Message, O extends Message> extends miShared<I, O> {
|
|
43
|
+
readonly kind: MethodKind.ServerStreaming;
|
|
55
44
|
}
|
|
56
45
|
/**
|
|
57
46
|
* A client streaming method: rpc (stream Input) returns (Output)
|
|
58
47
|
*/
|
|
59
|
-
export interface MethodInfoClientStreaming<
|
|
60
|
-
|
|
61
|
-
O extends Message<O>
|
|
62
|
-
> extends miShared<I, O> {
|
|
63
|
-
readonly kind: MethodKind.ClientStreaming;
|
|
48
|
+
export interface MethodInfoClientStreaming<I extends Message, O extends Message> extends miShared<I, O> {
|
|
49
|
+
readonly kind: MethodKind.ClientStreaming;
|
|
64
50
|
}
|
|
65
51
|
/**
|
|
66
52
|
* A method that streams bi-directionally: rpc (stream Input) returns (stream Output)
|
|
67
53
|
*/
|
|
68
|
-
export interface MethodInfoBiDiStreaming<
|
|
69
|
-
|
|
70
|
-
O extends Message<O>
|
|
71
|
-
> extends miShared<I, O> {
|
|
72
|
-
readonly kind: MethodKind.BiDiStreaming;
|
|
54
|
+
export interface MethodInfoBiDiStreaming<I extends Message, O extends Message> extends miShared<I, O> {
|
|
55
|
+
readonly kind: MethodKind.BiDiStreaming;
|
|
73
56
|
}
|
|
74
|
-
interface miShared<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
readonly I: MessageType<I>;
|
|
80
|
-
readonly O: MessageType<O>;
|
|
81
|
-
readonly idempotency?: MethodIdempotency;
|
|
57
|
+
interface miShared<I extends Message = DynamicMessage, O extends Message = DynamicMessage> {
|
|
58
|
+
readonly name: string;
|
|
59
|
+
readonly I: MessageType<I>;
|
|
60
|
+
readonly O: MessageType<O>;
|
|
61
|
+
readonly idempotency?: MethodIdempotency;
|
|
82
62
|
}
|
|
83
63
|
/**
|
|
84
64
|
* MethodKind represents the four method types that can be declared in
|
|
@@ -90,10 +70,10 @@ interface miShared<
|
|
|
90
70
|
* 4. BiDiStreaming: rpc (stream Input) returns (stream Output)
|
|
91
71
|
*/
|
|
92
72
|
export declare enum MethodKind {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
73
|
+
Unary = 0,
|
|
74
|
+
ServerStreaming = 1,
|
|
75
|
+
ClientStreaming = 2,
|
|
76
|
+
BiDiStreaming = 3
|
|
97
77
|
}
|
|
98
78
|
/**
|
|
99
79
|
* Is this method side-effect-free (or safe in HTTP parlance), or just
|
|
@@ -106,13 +86,13 @@ export declare enum MethodKind {
|
|
|
106
86
|
* drops UNKNOWN.
|
|
107
87
|
*/
|
|
108
88
|
export declare enum MethodIdempotency {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Idempotent, no side effects.
|
|
91
|
+
*/
|
|
92
|
+
NoSideEffects = 1,
|
|
93
|
+
/**
|
|
94
|
+
* Idempotent, but may have side effects.
|
|
95
|
+
*/
|
|
96
|
+
Idempotent = 2
|
|
117
97
|
}
|
|
118
98
|
export {};
|
|
@@ -5,33 +5,31 @@ import type { ServiceType } from "./service-type.js";
|
|
|
5
5
|
* IMessageTypeRegistry provides look-up for message types.
|
|
6
6
|
*/
|
|
7
7
|
export interface IMessageTypeRegistry {
|
|
8
|
-
|
|
8
|
+
findMessage(typeName: string): MessageType | undefined;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* IEnumTypeRegistry provides look-up for enum types.
|
|
12
12
|
*/
|
|
13
13
|
export interface IEnumTypeRegistry {
|
|
14
|
-
|
|
14
|
+
findEnum(typeName: string): EnumType | undefined;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* IServiceTypeRegistry provides look-up for service types.
|
|
18
18
|
*/
|
|
19
19
|
export interface IServiceTypeRegistry {
|
|
20
|
-
|
|
20
|
+
findService(typeName: string): ServiceType | undefined;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* TypeRegistry is a basic type registry
|
|
24
24
|
*/
|
|
25
|
-
export declare class TypeRegistry
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
static fromIterable(types: Iterable<MessageType>): TypeRegistry;
|
|
36
|
-
static fromTypes(...types: MessageType[]): TypeRegistry;
|
|
25
|
+
export declare class TypeRegistry implements IMessageTypeRegistry, IEnumTypeRegistry, IServiceTypeRegistry {
|
|
26
|
+
private readonly messages;
|
|
27
|
+
private readonly enums;
|
|
28
|
+
private readonly services;
|
|
29
|
+
findMessage(typeName: string): MessageType | undefined;
|
|
30
|
+
findEnum(typeName: string): EnumType | undefined;
|
|
31
|
+
findService(typeName: string): ServiceType | undefined;
|
|
32
|
+
private add;
|
|
33
|
+
static fromIterable(types: Iterable<MessageType>): TypeRegistry;
|
|
34
|
+
static fromTypes(...types: MessageType[]): TypeRegistry;
|
|
37
35
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bufbuild/protobuf",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"license": "(Apache-2.0 AND BSD-3-Clause)",
|
|
5
5
|
"description": "A complete implementation of protocol buffers in TypeScript, suitable for web browsers and Node.js.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/bufbuild/
|
|
8
|
+
"url": "https://github.com/bufbuild/connect-web.git",
|
|
9
9
|
"directory": "packages/protobuf"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|