@aptre/protobuf-es-lite 0.2.14 → 0.3.0
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/LICENSE +1 -1
- package/README.md +10 -15
- package/dist/binary.d.ts +13 -10
- package/dist/binary.js +24 -23
- package/dist/codegen-info.d.ts +8 -0
- package/dist/codegen-info.js +12 -4
- package/dist/create-descriptor-set.js +1 -1
- package/dist/descriptor-set.d.ts +8 -9
- package/dist/google/protobuf/any.pb.d.ts +55 -2
- package/dist/google/protobuf/any.pb.js +74 -4
- package/dist/google/protobuf/api.pb.js +13 -10
- package/dist/google/protobuf/descriptor.pb.js +125 -93
- package/dist/google/protobuf/duration.pb.d.ts +7 -2
- package/dist/google/protobuf/duration.pb.js +54 -4
- package/dist/google/protobuf/empty.pb.js +1 -0
- package/dist/google/protobuf/source_context.pb.js +3 -2
- package/dist/google/protobuf/struct.pb.d.ts +17 -4
- package/dist/google/protobuf/struct.pb.js +104 -8
- package/dist/google/protobuf/timestamp.pb.d.ts +8 -2
- package/dist/google/protobuf/timestamp.pb.js +54 -4
- package/dist/google/protobuf/type.pb.js +21 -16
- package/dist/google/protobuf/wrappers.pb.d.ts +47 -10
- package/dist/google/protobuf/wrappers.pb.js +190 -19
- package/dist/index.d.ts +5 -1
- package/dist/index.js +4 -1
- package/dist/json.d.ts +30 -4
- package/dist/json.js +17 -16
- package/dist/message.d.ts +8 -15
- package/dist/message.js +75 -71
- package/dist/protoc-gen-es-lite/typescript.d.ts +2 -2
- package/dist/protoc-gen-es-lite/typescript.js +323 -26
- package/dist/protoplugin/ecmascript/reify-wkt.d.ts +1 -5
- package/dist/protoplugin/ecmascript/reify-wkt.js +0 -10
- package/dist/type-registry.d.ts +43 -0
- package/dist/type-registry.js +14 -0
- package/example/example.pb.ts +6 -7
- package/package.json +3 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MessageType } from "../../index.js";
|
|
1
|
+
import type { JsonReadOptions, JsonValue, JsonWriteOptions, MessageType } from "../../index.js";
|
|
2
2
|
import { Message } from "../../index.js";
|
|
3
3
|
export declare const protobufPackage = "google.protobuf";
|
|
4
4
|
/**
|
|
@@ -33,7 +33,11 @@ export type ListValue = Message<{
|
|
|
33
33
|
*/
|
|
34
34
|
values?: Value[];
|
|
35
35
|
}>;
|
|
36
|
-
|
|
36
|
+
declare const ListValue_Wkt: {
|
|
37
|
+
toJson(msg: ListValue, options?: Partial<JsonWriteOptions>): JsonValue;
|
|
38
|
+
fromJson(json: JsonValue | null | undefined, options?: Partial<JsonReadOptions>): ListValue;
|
|
39
|
+
};
|
|
40
|
+
export declare const ListValue: MessageType<ListValue> & typeof ListValue_Wkt;
|
|
37
41
|
/**
|
|
38
42
|
* `Value` represents a dynamically typed value which can be either
|
|
39
43
|
* null, a number, a string, a boolean, a recursive struct value, or a
|
|
@@ -103,7 +107,11 @@ export type Value = Message<{
|
|
|
103
107
|
case: "listValue";
|
|
104
108
|
};
|
|
105
109
|
}>;
|
|
106
|
-
|
|
110
|
+
declare const Value_Wkt: {
|
|
111
|
+
toJson(msg: Value, options?: Partial<JsonWriteOptions>): JsonValue;
|
|
112
|
+
fromJson(json: JsonValue | null | undefined, _options?: Partial<JsonReadOptions>): Value;
|
|
113
|
+
};
|
|
114
|
+
export declare const Value: MessageType<Value> & typeof Value_Wkt;
|
|
107
115
|
/**
|
|
108
116
|
* `Struct` represents a structured data value, consisting of fields
|
|
109
117
|
* which map to dynamically typed values. In some languages, `Struct`
|
|
@@ -126,4 +134,9 @@ export type Struct = Message<{
|
|
|
126
134
|
[key: string]: Value;
|
|
127
135
|
};
|
|
128
136
|
}>;
|
|
129
|
-
|
|
137
|
+
declare const Struct_Wkt: {
|
|
138
|
+
toJson(msg: Struct, options?: Partial<JsonWriteOptions>): JsonValue;
|
|
139
|
+
fromJson(json: JsonValue | null | undefined, _options?: Partial<JsonReadOptions>): Struct;
|
|
140
|
+
};
|
|
141
|
+
export declare const Struct: MessageType<Struct> & typeof Struct_Wkt;
|
|
142
|
+
export {};
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
28
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
29
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
-
import { createEnumType, createMessageType } from "../../index.js";
|
|
30
|
+
import { createEnumType, createMessageType, jsonDebugValue, ScalarType } from "../../index.js";
|
|
31
31
|
export const protobufPackage = "google.protobuf";
|
|
32
32
|
/**
|
|
33
33
|
* `NullValue` is a singleton enumeration to represent the null value for the
|
|
@@ -50,29 +50,125 @@ export var NullValue;
|
|
|
50
50
|
export const NullValue_Enum = createEnumType("google.protobuf.NullValue", [
|
|
51
51
|
{ no: 0, name: "NULL_VALUE" },
|
|
52
52
|
]);
|
|
53
|
+
// ListValue_Wkt contains the well-known-type overrides for ListValue.
|
|
54
|
+
const ListValue_Wkt = {
|
|
55
|
+
toJson(msg, options) {
|
|
56
|
+
return msg.values?.map(v => Value.toJson(v, options)) ?? [];
|
|
57
|
+
},
|
|
58
|
+
fromJson(json, options) {
|
|
59
|
+
if (json == null) {
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
62
|
+
if (!Array.isArray(json)) {
|
|
63
|
+
throw new Error(`cannot decode google.protobuf.ListValue from JSON ${jsonDebugValue(json)}`);
|
|
64
|
+
}
|
|
65
|
+
const values = json.map(v => Value.fromJson(v, options));
|
|
66
|
+
return { values: values };
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
// ListValue contains the message type declaration for ListValue.
|
|
53
70
|
export const ListValue = createMessageType({
|
|
54
71
|
typeName: "google.protobuf.ListValue",
|
|
55
72
|
fields: [
|
|
56
73
|
{ no: 1, name: "values", kind: "message", T: () => Value, repeated: true },
|
|
57
74
|
],
|
|
58
75
|
packedByDefault: true,
|
|
59
|
-
});
|
|
76
|
+
}, ListValue_Wkt);
|
|
77
|
+
// Value_Wkt contains the well-known-type overrides for Value.
|
|
78
|
+
const Value_Wkt = {
|
|
79
|
+
toJson(msg, options) {
|
|
80
|
+
switch (msg.kind?.case) {
|
|
81
|
+
case "nullValue":
|
|
82
|
+
return null;
|
|
83
|
+
case "numberValue":
|
|
84
|
+
if (!Number.isFinite(msg.kind.value)) {
|
|
85
|
+
throw new Error("google.protobuf.Value cannot be NaN or Infinity");
|
|
86
|
+
}
|
|
87
|
+
return msg.kind.value;
|
|
88
|
+
case "boolValue":
|
|
89
|
+
return msg.kind.value;
|
|
90
|
+
case "stringValue":
|
|
91
|
+
return msg.kind.value;
|
|
92
|
+
case "structValue":
|
|
93
|
+
return Struct.toJson(msg.kind.value, { ...options, emitDefaultValues: true });
|
|
94
|
+
case "listValue":
|
|
95
|
+
return ListValue.toJson(msg.kind.value, { ...options, emitDefaultValues: true });
|
|
96
|
+
case null:
|
|
97
|
+
case undefined:
|
|
98
|
+
default:
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
fromJson(json, _options) {
|
|
103
|
+
const msg = {};
|
|
104
|
+
switch (typeof json) {
|
|
105
|
+
case "number":
|
|
106
|
+
msg.kind = { case: "numberValue", value: json };
|
|
107
|
+
break;
|
|
108
|
+
case "string":
|
|
109
|
+
msg.kind = { case: "stringValue", value: json };
|
|
110
|
+
break;
|
|
111
|
+
case "boolean":
|
|
112
|
+
msg.kind = { case: "boolValue", value: json };
|
|
113
|
+
break;
|
|
114
|
+
case "object":
|
|
115
|
+
if (json == null) {
|
|
116
|
+
msg.kind = { case: "nullValue", value: NullValue.NULL_VALUE };
|
|
117
|
+
}
|
|
118
|
+
else if (Array.isArray(json)) {
|
|
119
|
+
msg.kind = { case: "listValue", value: ListValue.fromJson(json) };
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
msg.kind = { case: "structValue", value: Struct.fromJson(json) };
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
default:
|
|
126
|
+
throw new Error(`cannot decode google.protobuf.Value from JSON ${jsonDebugValue(json)}`);
|
|
127
|
+
}
|
|
128
|
+
return msg;
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
// Value contains the message type declaration for Value.
|
|
60
132
|
export const Value = createMessageType({
|
|
61
133
|
typeName: "google.protobuf.Value",
|
|
62
134
|
fields: [
|
|
63
135
|
{ no: 1, name: "null_value", kind: "enum", T: NullValue_Enum, oneof: "kind" },
|
|
64
|
-
{ no: 2, name: "number_value", kind: "scalar", T:
|
|
65
|
-
{ no: 3, name: "string_value", kind: "scalar", T:
|
|
66
|
-
{ no: 4, name: "bool_value", kind: "scalar", T:
|
|
136
|
+
{ no: 2, name: "number_value", kind: "scalar", T: ScalarType.DOUBLE, oneof: "kind" },
|
|
137
|
+
{ no: 3, name: "string_value", kind: "scalar", T: ScalarType.STRING, oneof: "kind" },
|
|
138
|
+
{ no: 4, name: "bool_value", kind: "scalar", T: ScalarType.BOOL, oneof: "kind" },
|
|
67
139
|
{ no: 5, name: "struct_value", kind: "message", T: () => Struct, oneof: "kind" },
|
|
68
140
|
{ no: 6, name: "list_value", kind: "message", T: () => ListValue, oneof: "kind" },
|
|
69
141
|
],
|
|
70
142
|
packedByDefault: true,
|
|
71
|
-
});
|
|
143
|
+
}, Value_Wkt);
|
|
144
|
+
// Struct_Wkt contains the well-known-type overrides for Struct.
|
|
145
|
+
const Struct_Wkt = {
|
|
146
|
+
toJson(msg, options) {
|
|
147
|
+
const json = {};
|
|
148
|
+
if (!msg.fields) {
|
|
149
|
+
return json;
|
|
150
|
+
}
|
|
151
|
+
for (const [k, v] of Object.entries(msg.fields)) {
|
|
152
|
+
json[k] = v != null ? Value.toJson(v, options) : null;
|
|
153
|
+
}
|
|
154
|
+
return json;
|
|
155
|
+
},
|
|
156
|
+
fromJson(json, _options) {
|
|
157
|
+
if (typeof json != "object" || json == null || Array.isArray(json)) {
|
|
158
|
+
throw new Error(`cannot decode google.protobuf.Struct from JSON ${jsonDebugValue(json)}`);
|
|
159
|
+
}
|
|
160
|
+
const fields = {};
|
|
161
|
+
for (const [k, v] of Object.entries(json)) {
|
|
162
|
+
fields[k] = Value.fromJson(v);
|
|
163
|
+
}
|
|
164
|
+
return { fields: fields };
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
// Struct contains the message type declaration for Struct.
|
|
72
168
|
export const Struct = createMessageType({
|
|
73
169
|
typeName: "google.protobuf.Struct",
|
|
74
170
|
fields: [
|
|
75
|
-
{ no: 1, name: "fields", kind: "map", K:
|
|
171
|
+
{ no: 1, name: "fields", kind: "map", K: ScalarType.STRING, V: { kind: "message", T: () => Value } },
|
|
76
172
|
],
|
|
77
173
|
packedByDefault: true,
|
|
78
|
-
});
|
|
174
|
+
}, Struct_Wkt);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MessageType } from "../../index.js";
|
|
1
|
+
import type { JsonValue, MessageType } from "../../index.js";
|
|
2
2
|
import { Message } from "../../index.js";
|
|
3
3
|
export declare const protobufPackage = "google.protobuf";
|
|
4
4
|
/**
|
|
@@ -115,4 +115,10 @@ export type Timestamp = Message<{
|
|
|
115
115
|
*/
|
|
116
116
|
nanos?: number;
|
|
117
117
|
}>;
|
|
118
|
-
|
|
118
|
+
declare const Timestamp_Wkt: {
|
|
119
|
+
fromJson(json: JsonValue): Timestamp;
|
|
120
|
+
toJson(msg: Timestamp): JsonValue;
|
|
121
|
+
toDate(msg: Timestamp): Date;
|
|
122
|
+
};
|
|
123
|
+
export declare const Timestamp: MessageType<Timestamp> & typeof Timestamp_Wkt;
|
|
124
|
+
export {};
|
|
@@ -27,13 +27,63 @@
|
|
|
27
27
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
28
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
29
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
-
import { createMessageType } from "../../index.js";
|
|
30
|
+
import { createMessageType, protoInt64, ScalarType } from "../../index.js";
|
|
31
31
|
export const protobufPackage = "google.protobuf";
|
|
32
|
+
// Timestamp_Wkt contains the well-known-type overrides for Timestamp.
|
|
33
|
+
const Timestamp_Wkt = {
|
|
34
|
+
fromJson(json) {
|
|
35
|
+
if (typeof json !== "string") {
|
|
36
|
+
throw new Error(`cannot decode google.protobuf.Timestamp(json)}`);
|
|
37
|
+
}
|
|
38
|
+
const matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
|
|
39
|
+
if (!matches) {
|
|
40
|
+
throw new Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);
|
|
41
|
+
}
|
|
42
|
+
const ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
|
|
43
|
+
if (Number.isNaN(ms)) {
|
|
44
|
+
throw new Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);
|
|
45
|
+
}
|
|
46
|
+
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) {
|
|
47
|
+
throw new Error(`cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
seconds: protoInt64.parse(ms / 1000),
|
|
51
|
+
nanos: !matches[7] ? 0 : (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000),
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
toJson(msg) {
|
|
55
|
+
const ms = Number(msg.seconds) * 1000;
|
|
56
|
+
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) {
|
|
57
|
+
throw new Error(`cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);
|
|
58
|
+
}
|
|
59
|
+
if (msg.nanos != null && msg.nanos < 0) {
|
|
60
|
+
throw new Error(`cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative`);
|
|
61
|
+
}
|
|
62
|
+
let z = "Z";
|
|
63
|
+
if (msg.nanos != null && msg.nanos > 0) {
|
|
64
|
+
const nanosStr = (msg.nanos + 1000000000).toString().substring(1);
|
|
65
|
+
if (nanosStr.substring(3) === "000000") {
|
|
66
|
+
z = "." + nanosStr.substring(0, 3) + "Z";
|
|
67
|
+
}
|
|
68
|
+
else if (nanosStr.substring(6) === "000") {
|
|
69
|
+
z = "." + nanosStr.substring(0, 6) + "Z";
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
z = "." + nanosStr + "Z";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return new Date(ms).toISOString().replace(".000Z", z);
|
|
76
|
+
},
|
|
77
|
+
toDate(msg) {
|
|
78
|
+
return new Date(Number(msg.seconds ?? 0) * 1000 + Math.ceil((msg.nanos ?? 0) / 1000000));
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
// Timestamp contains the message type declaration for Timestamp.
|
|
32
82
|
export const Timestamp = createMessageType({
|
|
33
83
|
typeName: "google.protobuf.Timestamp",
|
|
34
84
|
fields: [
|
|
35
|
-
{ no: 1, name: "seconds", kind: "scalar", T:
|
|
36
|
-
{ no: 2, name: "nanos", kind: "scalar", T:
|
|
85
|
+
{ no: 1, name: "seconds", kind: "scalar", T: ScalarType.INT64 },
|
|
86
|
+
{ no: 2, name: "nanos", kind: "scalar", T: ScalarType.INT32 },
|
|
37
87
|
],
|
|
38
88
|
packedByDefault: true,
|
|
39
|
-
});
|
|
89
|
+
}, Timestamp_Wkt);
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
28
28
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
29
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
-
import { createEnumType, createMessageType } from "../../index.js";
|
|
30
|
+
import { createEnumType, createMessageType, ScalarType } from "../../index.js";
|
|
31
31
|
import { Any } from "./any.pb.js";
|
|
32
32
|
import { SourceContext } from "./source_context.pb.js";
|
|
33
33
|
export const protobufPackage = "google.protobuf";
|
|
@@ -246,61 +246,66 @@ export const Field_Cardinality_Enum = createEnumType("google.protobuf.Field.Card
|
|
|
246
246
|
{ no: 2, name: "CARDINALITY_REQUIRED" },
|
|
247
247
|
{ no: 3, name: "CARDINALITY_REPEATED" },
|
|
248
248
|
]);
|
|
249
|
+
// Option contains the message type declaration for Option.
|
|
249
250
|
export const Option = createMessageType({
|
|
250
251
|
typeName: "google.protobuf.Option",
|
|
251
252
|
fields: [
|
|
252
|
-
{ no: 1, name: "name", kind: "scalar", T:
|
|
253
|
+
{ no: 1, name: "name", kind: "scalar", T: ScalarType.STRING },
|
|
253
254
|
{ no: 2, name: "value", kind: "message", T: () => Any },
|
|
254
255
|
],
|
|
255
256
|
packedByDefault: true,
|
|
256
257
|
});
|
|
258
|
+
// Field contains the message type declaration for Field.
|
|
257
259
|
export const Field = createMessageType({
|
|
258
260
|
typeName: "google.protobuf.Field",
|
|
259
261
|
fields: [
|
|
260
262
|
{ no: 1, name: "kind", kind: "enum", T: Field_Kind_Enum },
|
|
261
263
|
{ no: 2, name: "cardinality", kind: "enum", T: Field_Cardinality_Enum },
|
|
262
|
-
{ no: 3, name: "number", kind: "scalar", T:
|
|
263
|
-
{ no: 4, name: "name", kind: "scalar", T:
|
|
264
|
-
{ no: 6, name: "type_url", kind: "scalar", T:
|
|
265
|
-
{ no: 7, name: "oneof_index", kind: "scalar", T:
|
|
266
|
-
{ no: 8, name: "packed", kind: "scalar", T:
|
|
264
|
+
{ no: 3, name: "number", kind: "scalar", T: ScalarType.INT32 },
|
|
265
|
+
{ no: 4, name: "name", kind: "scalar", T: ScalarType.STRING },
|
|
266
|
+
{ no: 6, name: "type_url", kind: "scalar", T: ScalarType.STRING },
|
|
267
|
+
{ no: 7, name: "oneof_index", kind: "scalar", T: ScalarType.INT32 },
|
|
268
|
+
{ no: 8, name: "packed", kind: "scalar", T: ScalarType.BOOL },
|
|
267
269
|
{ no: 9, name: "options", kind: "message", T: () => Option, repeated: true },
|
|
268
|
-
{ no: 10, name: "json_name", kind: "scalar", T:
|
|
269
|
-
{ no: 11, name: "default_value", kind: "scalar", T:
|
|
270
|
+
{ no: 10, name: "json_name", kind: "scalar", T: ScalarType.STRING },
|
|
271
|
+
{ no: 11, name: "default_value", kind: "scalar", T: ScalarType.STRING },
|
|
270
272
|
],
|
|
271
273
|
packedByDefault: true,
|
|
272
274
|
});
|
|
275
|
+
// Type contains the message type declaration for Type.
|
|
273
276
|
export const Type = createMessageType({
|
|
274
277
|
typeName: "google.protobuf.Type",
|
|
275
278
|
fields: [
|
|
276
|
-
{ no: 1, name: "name", kind: "scalar", T:
|
|
279
|
+
{ no: 1, name: "name", kind: "scalar", T: ScalarType.STRING },
|
|
277
280
|
{ no: 2, name: "fields", kind: "message", T: () => Field, repeated: true },
|
|
278
|
-
{ no: 3, name: "oneofs", kind: "scalar", T:
|
|
281
|
+
{ no: 3, name: "oneofs", kind: "scalar", T: ScalarType.STRING, repeated: true },
|
|
279
282
|
{ no: 4, name: "options", kind: "message", T: () => Option, repeated: true },
|
|
280
283
|
{ no: 5, name: "source_context", kind: "message", T: () => SourceContext },
|
|
281
284
|
{ no: 6, name: "syntax", kind: "enum", T: Syntax_Enum },
|
|
282
|
-
{ no: 7, name: "edition", kind: "scalar", T:
|
|
285
|
+
{ no: 7, name: "edition", kind: "scalar", T: ScalarType.STRING },
|
|
283
286
|
],
|
|
284
287
|
packedByDefault: true,
|
|
285
288
|
});
|
|
289
|
+
// EnumValue contains the message type declaration for EnumValue.
|
|
286
290
|
export const EnumValue = createMessageType({
|
|
287
291
|
typeName: "google.protobuf.EnumValue",
|
|
288
292
|
fields: [
|
|
289
|
-
{ no: 1, name: "name", kind: "scalar", T:
|
|
290
|
-
{ no: 2, name: "number", kind: "scalar", T:
|
|
293
|
+
{ no: 1, name: "name", kind: "scalar", T: ScalarType.STRING },
|
|
294
|
+
{ no: 2, name: "number", kind: "scalar", T: ScalarType.INT32 },
|
|
291
295
|
{ no: 3, name: "options", kind: "message", T: () => Option, repeated: true },
|
|
292
296
|
],
|
|
293
297
|
packedByDefault: true,
|
|
294
298
|
});
|
|
299
|
+
// Enum contains the message type declaration for Enum.
|
|
295
300
|
export const Enum = createMessageType({
|
|
296
301
|
typeName: "google.protobuf.Enum",
|
|
297
302
|
fields: [
|
|
298
|
-
{ no: 1, name: "name", kind: "scalar", T:
|
|
303
|
+
{ no: 1, name: "name", kind: "scalar", T: ScalarType.STRING },
|
|
299
304
|
{ no: 2, name: "enumvalue", kind: "message", T: () => EnumValue, repeated: true },
|
|
300
305
|
{ no: 3, name: "options", kind: "message", T: () => Option, repeated: true },
|
|
301
306
|
{ no: 4, name: "source_context", kind: "message", T: () => SourceContext },
|
|
302
307
|
{ no: 5, name: "syntax", kind: "enum", T: Syntax_Enum },
|
|
303
|
-
{ no: 6, name: "edition", kind: "scalar", T:
|
|
308
|
+
{ no: 6, name: "edition", kind: "scalar", T: ScalarType.STRING },
|
|
304
309
|
],
|
|
305
310
|
packedByDefault: true,
|
|
306
311
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MessageType } from "../../index.js";
|
|
1
|
+
import type { JsonReadOptions, JsonValue, JsonWriteOptions, MessageType } from "../../index.js";
|
|
2
2
|
import { Message } from "../../index.js";
|
|
3
3
|
export declare const protobufPackage = "google.protobuf";
|
|
4
4
|
/**
|
|
@@ -18,7 +18,11 @@ export type DoubleValue = Message<{
|
|
|
18
18
|
*/
|
|
19
19
|
value?: number;
|
|
20
20
|
}>;
|
|
21
|
-
|
|
21
|
+
declare const DoubleValue_Wkt: {
|
|
22
|
+
toJson(msg: DoubleValue, _options?: Partial<JsonWriteOptions>): JsonValue;
|
|
23
|
+
fromJson(json: JsonValue | null | undefined, _options?: Partial<JsonReadOptions>): DoubleValue;
|
|
24
|
+
};
|
|
25
|
+
export declare const DoubleValue: MessageType<DoubleValue> & typeof DoubleValue_Wkt;
|
|
22
26
|
/**
|
|
23
27
|
* Wrapper message for `float`.
|
|
24
28
|
*
|
|
@@ -36,7 +40,11 @@ export type FloatValue = Message<{
|
|
|
36
40
|
*/
|
|
37
41
|
value?: number;
|
|
38
42
|
}>;
|
|
39
|
-
|
|
43
|
+
declare const FloatValue_Wkt: {
|
|
44
|
+
toJson(msg: FloatValue, _options?: Partial<JsonWriteOptions>): JsonValue;
|
|
45
|
+
fromJson(json: JsonValue | null | undefined, _options?: Partial<JsonReadOptions>): FloatValue;
|
|
46
|
+
};
|
|
47
|
+
export declare const FloatValue: MessageType<FloatValue> & typeof FloatValue_Wkt;
|
|
40
48
|
/**
|
|
41
49
|
* Wrapper message for `int64`.
|
|
42
50
|
*
|
|
@@ -54,7 +62,11 @@ export type Int64Value = Message<{
|
|
|
54
62
|
*/
|
|
55
63
|
value?: bigint;
|
|
56
64
|
}>;
|
|
57
|
-
|
|
65
|
+
declare const Int64Value_Wkt: {
|
|
66
|
+
toJson(msg: Int64Value, _options?: Partial<JsonWriteOptions>): JsonValue;
|
|
67
|
+
fromJson(json: JsonValue | null | undefined, _options?: Partial<JsonReadOptions>): Int64Value;
|
|
68
|
+
};
|
|
69
|
+
export declare const Int64Value: MessageType<Int64Value> & typeof Int64Value_Wkt;
|
|
58
70
|
/**
|
|
59
71
|
* Wrapper message for `uint64`.
|
|
60
72
|
*
|
|
@@ -72,7 +84,11 @@ export type UInt64Value = Message<{
|
|
|
72
84
|
*/
|
|
73
85
|
value?: bigint;
|
|
74
86
|
}>;
|
|
75
|
-
|
|
87
|
+
declare const UInt64Value_Wkt: {
|
|
88
|
+
toJson(msg: UInt64Value, _options?: Partial<JsonWriteOptions>): JsonValue;
|
|
89
|
+
fromJson(json: JsonValue | null | undefined, _options?: Partial<JsonReadOptions>): UInt64Value;
|
|
90
|
+
};
|
|
91
|
+
export declare const UInt64Value: MessageType<UInt64Value> & typeof UInt64Value_Wkt;
|
|
76
92
|
/**
|
|
77
93
|
* Wrapper message for `int32`.
|
|
78
94
|
*
|
|
@@ -90,7 +106,11 @@ export type Int32Value = Message<{
|
|
|
90
106
|
*/
|
|
91
107
|
value?: number;
|
|
92
108
|
}>;
|
|
93
|
-
|
|
109
|
+
declare const Int32Value_Wkt: {
|
|
110
|
+
toJson(msg: Int32Value, _options?: Partial<JsonWriteOptions>): JsonValue;
|
|
111
|
+
fromJson(json: JsonValue | null | undefined, _options?: Partial<JsonReadOptions>): Int32Value;
|
|
112
|
+
};
|
|
113
|
+
export declare const Int32Value: MessageType<Int32Value> & typeof Int32Value_Wkt;
|
|
94
114
|
/**
|
|
95
115
|
* Wrapper message for `uint32`.
|
|
96
116
|
*
|
|
@@ -108,7 +128,11 @@ export type UInt32Value = Message<{
|
|
|
108
128
|
*/
|
|
109
129
|
value?: number;
|
|
110
130
|
}>;
|
|
111
|
-
|
|
131
|
+
declare const UInt32Value_Wkt: {
|
|
132
|
+
toJson(msg: UInt32Value, _options?: Partial<JsonWriteOptions>): JsonValue;
|
|
133
|
+
fromJson(json: JsonValue | null | undefined, _options?: Partial<JsonReadOptions>): UInt32Value;
|
|
134
|
+
};
|
|
135
|
+
export declare const UInt32Value: MessageType<UInt32Value> & typeof UInt32Value_Wkt;
|
|
112
136
|
/**
|
|
113
137
|
* Wrapper message for `bool`.
|
|
114
138
|
*
|
|
@@ -126,7 +150,11 @@ export type BoolValue = Message<{
|
|
|
126
150
|
*/
|
|
127
151
|
value?: boolean;
|
|
128
152
|
}>;
|
|
129
|
-
|
|
153
|
+
declare const BoolValue_Wkt: {
|
|
154
|
+
toJson(msg: BoolValue, _options?: Partial<JsonWriteOptions>): JsonValue;
|
|
155
|
+
fromJson(json: JsonValue | null | undefined, _options?: Partial<JsonReadOptions>): BoolValue;
|
|
156
|
+
};
|
|
157
|
+
export declare const BoolValue: MessageType<BoolValue> & typeof BoolValue_Wkt;
|
|
130
158
|
/**
|
|
131
159
|
* Wrapper message for `string`.
|
|
132
160
|
*
|
|
@@ -144,7 +172,11 @@ export type StringValue = Message<{
|
|
|
144
172
|
*/
|
|
145
173
|
value?: string;
|
|
146
174
|
}>;
|
|
147
|
-
|
|
175
|
+
declare const StringValue_Wkt: {
|
|
176
|
+
toJson(msg: StringValue, _options?: Partial<JsonWriteOptions>): JsonValue;
|
|
177
|
+
fromJson(json: JsonValue | null | undefined, _options?: Partial<JsonReadOptions>): StringValue;
|
|
178
|
+
};
|
|
179
|
+
export declare const StringValue: MessageType<StringValue> & typeof StringValue_Wkt;
|
|
148
180
|
/**
|
|
149
181
|
* Wrapper message for `bytes`.
|
|
150
182
|
*
|
|
@@ -162,4 +194,9 @@ export type BytesValue = Message<{
|
|
|
162
194
|
*/
|
|
163
195
|
value?: Uint8Array;
|
|
164
196
|
}>;
|
|
165
|
-
|
|
197
|
+
declare const BytesValue_Wkt: {
|
|
198
|
+
toJson(msg: BytesValue, _options?: Partial<JsonWriteOptions>): JsonValue;
|
|
199
|
+
fromJson(json: JsonValue | null | undefined, _options?: Partial<JsonReadOptions>): BytesValue;
|
|
200
|
+
};
|
|
201
|
+
export declare const BytesValue: MessageType<BytesValue> & typeof BytesValue_Wkt;
|
|
202
|
+
export {};
|