@bufbuild/protobuf 0.0.1-alpha.1 → 0.0.2-alpha.2
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/dist/cjs/binary-encoding.js +414 -409
- package/dist/cjs/binary-format.js +13 -0
- package/dist/cjs/descriptor-registry.js +420 -449
- package/dist/cjs/descriptor-set.js +429 -513
- package/dist/cjs/enum.js +13 -0
- package/dist/cjs/field-list.js +13 -0
- package/dist/cjs/field.js +43 -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/google/varint.js +166 -171
- package/dist/cjs/index.js +41 -122
- package/dist/cjs/json-format.js +13 -0
- package/dist/cjs/message-type.js +13 -0
- package/dist/cjs/message.js +89 -85
- package/dist/cjs/private/assert.js +33 -26
- package/dist/cjs/private/base64.js +93 -79
- package/dist/cjs/private/binary-format-common.js +208 -208
- package/dist/cjs/private/binary-format-proto2.js +88 -109
- package/dist/cjs/private/binary-format-proto3.js +70 -90
- package/dist/cjs/private/enum.js +77 -44
- package/dist/cjs/private/field-list.js +64 -50
- package/dist/cjs/private/field-wrapper.js +21 -10
- package/dist/cjs/private/field.js +35 -25
- package/dist/cjs/private/json-format-common.js +427 -440
- package/dist/cjs/private/json-format-proto2.js +91 -89
- package/dist/cjs/private/json-format-proto3.js +82 -93
- package/dist/cjs/private/message-type.js +39 -27
- package/dist/cjs/private/names.js +71 -62
- package/dist/cjs/private/options-map.js +13 -0
- package/dist/cjs/private/proto-runtime.js +25 -16
- package/dist/cjs/private/scalars.js +113 -103
- package/dist/cjs/private/util-common.js +193 -210
- package/dist/cjs/private/util.js +13 -0
- package/dist/cjs/proto-int64.js +123 -111
- package/dist/cjs/proto2.js +63 -63
- package/dist/cjs/proto3.js +74 -74
- package/dist/cjs/service-type.js +27 -17
- package/dist/cjs/type-registry.js +46 -31
- package/dist/esm/binary-encoding.js +414 -414
- package/dist/esm/binary-format.js +13 -0
- package/dist/esm/descriptor-registry.js +422 -458
- package/dist/esm/descriptor-set.js +430 -478
- package/dist/esm/enum.js +13 -0
- package/dist/esm/field-list.js +13 -0
- package/dist/esm/field.js +42 -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/google/varint.js +165 -164
- package/dist/esm/index.js +14 -1
- package/dist/esm/json-format.js +13 -0
- package/dist/esm/message-type.js +13 -0
- package/dist/esm/message.js +89 -85
- package/dist/esm/private/assert.js +32 -21
- package/dist/esm/private/base64.js +92 -78
- package/dist/esm/private/binary-format-common.js +209 -207
- package/dist/esm/private/binary-format-proto2.js +89 -81
- package/dist/esm/private/binary-format-proto3.js +71 -67
- package/dist/esm/private/enum.js +75 -43
- package/dist/esm/private/field-list.js +64 -50
- package/dist/esm/private/field-wrapper.js +21 -10
- package/dist/esm/private/field.js +35 -22
- package/dist/esm/private/json-format-common.js +427 -435
- package/dist/esm/private/json-format-proto2.js +89 -81
- package/dist/esm/private/json-format-proto3.js +79 -80
- package/dist/esm/private/message-type.js +40 -28
- package/dist/esm/private/names.js +70 -57
- package/dist/esm/private/options-map.js +13 -0
- package/dist/esm/private/proto-runtime.js +26 -12
- package/dist/esm/private/scalars.js +112 -99
- package/dist/esm/private/util-common.js +193 -192
- package/dist/esm/private/util.js +13 -0
- package/dist/esm/proto-int64.js +123 -111
- package/dist/esm/proto2.js +63 -57
- package/dist/esm/proto3.js +74 -68
- package/dist/esm/service-type.js +25 -12
- package/dist/esm/type-registry.js +46 -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/google/varint.d.ts +6 -13
- package/dist/types/index.d.ts +4 -27
- package/dist/types/json-format.d.ts +70 -89
- package/dist/types/message-type.d.ts +37 -45
- package/dist/types/message.d.ts +62 -87
- 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 +13 -11
- package/dist/types/private/field-list.d.ts +14 -21
- package/dist/types/private/field-wrapper.d.ts +4 -10
- package/dist/types/private/field.d.ts +12 -12
- package/dist/types/private/json-format-common.d.ts +5 -27
- package/dist/types/private/message-type.d.ts +12 -7
- 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 +34 -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 +36 -56
- package/dist/types/type-registry.d.ts +13 -15
- package/package.json +2 -3
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// Copyright 2021-2022 Buf Technologies, Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
2
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
16
|
exports.makeJsonFormatCommon = void 0;
|
|
4
17
|
const field_wrapper_js_1 = require("./field-wrapper.js");
|
|
@@ -9,474 +22,448 @@ const base64_js_1 = require("./base64.js");
|
|
|
9
22
|
/* eslint-disable no-case-declarations, @typescript-eslint/restrict-plus-operands,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument */
|
|
10
23
|
// Default options for parsing JSON.
|
|
11
24
|
const jsonReadDefaults = {
|
|
12
|
-
|
|
25
|
+
ignoreUnknownFields: false,
|
|
13
26
|
};
|
|
14
27
|
// Default options for serializing to JSON.
|
|
15
28
|
const jsonWriteDefaults = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
emitDefaultValues: false,
|
|
30
|
+
enumAsInteger: false,
|
|
31
|
+
useProtoFieldName: false,
|
|
32
|
+
prettySpaces: 0,
|
|
20
33
|
};
|
|
21
34
|
function makeReadOptions(options) {
|
|
22
|
-
|
|
35
|
+
return options ? { ...jsonReadDefaults, ...options } : jsonReadDefaults;
|
|
23
36
|
}
|
|
24
37
|
function makeWriteOptions(options) {
|
|
25
|
-
|
|
38
|
+
return options ? { ...jsonWriteDefaults, ...options } : jsonWriteDefaults;
|
|
26
39
|
}
|
|
27
40
|
function makeJsonFormatCommon(makeWriteField) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
`cannot decode message ${type.typeName} from JSON: ${this.debug(
|
|
36
|
-
json
|
|
37
|
-
)}`
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
message = message ?? new type();
|
|
41
|
-
const oneofSeen = {};
|
|
42
|
-
for (const [jsonKey, jsonValue] of Object.entries(json)) {
|
|
43
|
-
const field = type.fields.findJsonName(jsonKey);
|
|
44
|
-
if (!field) {
|
|
45
|
-
if (!options.ignoreUnknownFields) {
|
|
46
|
-
throw new Error(
|
|
47
|
-
`cannot decode message ${type.typeName} from JSON: key "${jsonKey}" is unknown`
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
let localName = field.localName;
|
|
53
|
-
let target = message;
|
|
54
|
-
if (field.oneof) {
|
|
55
|
-
if (jsonValue === null && field.kind == "scalar") {
|
|
56
|
-
// see conformance test Required.Proto3.JsonInput.OneofFieldNull{First,Second}
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
const seen = oneofSeen[field.oneof.localName];
|
|
60
|
-
if (seen) {
|
|
61
|
-
throw new Error(
|
|
62
|
-
`cannot decode message ${type.typeName} from JSON: multiple keys for oneof "${field.oneof.name}" present: "${seen}", "${jsonKey}"`
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
oneofSeen[field.oneof.localName] = jsonKey;
|
|
66
|
-
target = target[field.oneof.localName] = { case: localName };
|
|
67
|
-
localName = "value";
|
|
68
|
-
}
|
|
69
|
-
if (field.repeated) {
|
|
70
|
-
if (jsonValue === null) {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (!Array.isArray(jsonValue)) {
|
|
74
|
-
throw new Error(
|
|
75
|
-
`cannot decode field ${type.typeName}.${
|
|
76
|
-
field.name
|
|
77
|
-
} from JSON: "${this.debug(jsonValue)}"`
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
const targetArray = target[localName];
|
|
81
|
-
for (const jsonItem of jsonValue) {
|
|
82
|
-
if (jsonItem === null) {
|
|
83
|
-
throw new Error(
|
|
84
|
-
`cannot decode field ${type.typeName}.${
|
|
85
|
-
field.name
|
|
86
|
-
} from JSON: "${this.debug(jsonItem)}"`
|
|
87
|
-
);
|
|
41
|
+
const writeField = makeWriteField(writeEnum, writeScalar);
|
|
42
|
+
return {
|
|
43
|
+
makeReadOptions,
|
|
44
|
+
makeWriteOptions,
|
|
45
|
+
readMessage(type, json, options, message) {
|
|
46
|
+
if (json == null || Array.isArray(json) || typeof json != "object") {
|
|
47
|
+
throw new Error(`cannot decode message ${type.typeName} from JSON: ${this.debug(json)}`);
|
|
88
48
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
break;
|
|
99
|
-
case "scalar":
|
|
100
|
-
try {
|
|
101
|
-
val = readScalar(field.T, jsonItem);
|
|
102
|
-
} catch (e) {
|
|
103
|
-
let m = `cannot decode field ${type.typeName}.${
|
|
104
|
-
field.name
|
|
105
|
-
} from JSON: "${this.debug(jsonItem)}"`;
|
|
106
|
-
if (e instanceof Error && e.message.length > 0) {
|
|
107
|
-
m += `: ${e.message}`;
|
|
108
|
-
}
|
|
109
|
-
throw new Error(m);
|
|
49
|
+
message = message ?? new type();
|
|
50
|
+
const oneofSeen = {};
|
|
51
|
+
for (const [jsonKey, jsonValue] of Object.entries(json)) {
|
|
52
|
+
const field = type.fields.findJsonName(jsonKey);
|
|
53
|
+
if (!field) {
|
|
54
|
+
if (!options.ignoreUnknownFields) {
|
|
55
|
+
throw new Error(`cannot decode message ${type.typeName} from JSON: key "${jsonKey}" is unknown`);
|
|
56
|
+
}
|
|
57
|
+
continue;
|
|
110
58
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
59
|
+
let localName = field.localName;
|
|
60
|
+
let target = message;
|
|
61
|
+
if (field.oneof) {
|
|
62
|
+
if (jsonValue === null && field.kind == "scalar") {
|
|
63
|
+
// see conformance test Required.Proto3.JsonInput.OneofFieldNull{First,Second}
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const seen = oneofSeen[field.oneof.localName];
|
|
67
|
+
if (seen) {
|
|
68
|
+
throw new Error(`cannot decode message ${type.typeName} from JSON: multiple keys for oneof "${field.oneof.name}" present: "${seen}", "${jsonKey}"`);
|
|
69
|
+
}
|
|
70
|
+
oneofSeen[field.oneof.localName] = jsonKey;
|
|
71
|
+
target = target[field.oneof.localName] = { case: localName };
|
|
72
|
+
localName = "value";
|
|
73
|
+
}
|
|
74
|
+
if (field.repeated) {
|
|
75
|
+
if (jsonValue === null) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (!Array.isArray(jsonValue)) {
|
|
79
|
+
throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: "${this.debug(jsonValue)}"`);
|
|
80
|
+
}
|
|
81
|
+
const targetArray = target[localName];
|
|
82
|
+
for (const jsonItem of jsonValue) {
|
|
83
|
+
if (jsonItem === null) {
|
|
84
|
+
throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: "${this.debug(jsonItem)}"`);
|
|
85
|
+
}
|
|
86
|
+
let val;
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- "map" is invalid for repeated fields
|
|
88
|
+
switch (field.kind) {
|
|
89
|
+
case "message":
|
|
90
|
+
val = field.T.fromJson(jsonItem, options);
|
|
91
|
+
break;
|
|
92
|
+
case "enum":
|
|
93
|
+
val = readEnum(field.T, jsonItem, options.ignoreUnknownFields);
|
|
94
|
+
if (val === undefined)
|
|
95
|
+
continue;
|
|
96
|
+
break;
|
|
97
|
+
case "scalar":
|
|
98
|
+
try {
|
|
99
|
+
val = readScalar(field.T, jsonItem);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
let m = `cannot decode field ${type.typeName}.${field.name} from JSON: "${this.debug(jsonItem)}"`;
|
|
103
|
+
if (e instanceof Error && e.message.length > 0) {
|
|
104
|
+
m += `: ${e.message}`;
|
|
105
|
+
}
|
|
106
|
+
throw new Error(m);
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
targetArray.push(val);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else if (field.kind == "map") {
|
|
114
|
+
if (jsonValue === null) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (Array.isArray(jsonValue) || typeof jsonValue != "object") {
|
|
118
|
+
throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonValue)}`);
|
|
119
|
+
}
|
|
120
|
+
const targetMap = target[localName];
|
|
121
|
+
for (const [jsonMapKey, jsonMapValue] of Object.entries(jsonValue)) {
|
|
122
|
+
if (jsonMapValue === null) {
|
|
123
|
+
throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: map value null`);
|
|
124
|
+
}
|
|
125
|
+
let val;
|
|
126
|
+
switch (field.V.kind) {
|
|
127
|
+
case "message":
|
|
128
|
+
val = field.V.T.fromJson(jsonMapValue, options);
|
|
129
|
+
break;
|
|
130
|
+
case "enum":
|
|
131
|
+
val = readEnum(field.V.T, jsonMapValue, options.ignoreUnknownFields);
|
|
132
|
+
if (val === undefined)
|
|
133
|
+
continue;
|
|
134
|
+
break;
|
|
135
|
+
case "scalar":
|
|
136
|
+
try {
|
|
137
|
+
val = readScalar(field.V.T, jsonMapValue);
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
let m = `cannot decode map value for field ${type.typeName}.${field.name} from JSON: "${this.debug(jsonValue)}"`;
|
|
141
|
+
if (e instanceof Error && e.message.length > 0) {
|
|
142
|
+
m += `: ${e.message}`;
|
|
143
|
+
}
|
|
144
|
+
throw new Error(m);
|
|
145
|
+
}
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
targetMap[readScalar(field.K, field.K == field_js_1.ScalarType.BOOL
|
|
150
|
+
? jsonMapKey == "true"
|
|
151
|
+
? true
|
|
152
|
+
: jsonMapKey == "false"
|
|
153
|
+
? false
|
|
154
|
+
: jsonMapKey
|
|
155
|
+
: jsonMapKey).toString()] = val;
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
let m = `cannot decode map key for field ${type.typeName}.${field.name} from JSON: "${this.debug(jsonValue)}"`;
|
|
159
|
+
if (e instanceof Error && e.message.length > 0) {
|
|
160
|
+
m += `: ${e.message}`;
|
|
161
|
+
}
|
|
162
|
+
throw new Error(m);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
switch (field.kind) {
|
|
168
|
+
case "message":
|
|
169
|
+
const messageType = field.T;
|
|
170
|
+
if (jsonValue === null &&
|
|
171
|
+
messageType.typeName != "google.protobuf.Value") {
|
|
172
|
+
if (field.oneof) {
|
|
173
|
+
throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: null is invalid for oneof field "${jsonKey}"`);
|
|
174
|
+
}
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
const targetMessage = target[localName] === undefined
|
|
178
|
+
? new messageType()
|
|
179
|
+
: (0, field_wrapper_js_1.wrapField)(messageType, target[localName]);
|
|
180
|
+
target[localName] = (0, field_wrapper_js_1.unwrapField)(messageType, targetMessage.fromJson(jsonValue, options));
|
|
181
|
+
break;
|
|
182
|
+
case "enum":
|
|
183
|
+
const enumValue = readEnum(field.T, jsonValue, options.ignoreUnknownFields);
|
|
184
|
+
if (enumValue !== undefined) {
|
|
185
|
+
target[localName] = enumValue;
|
|
186
|
+
}
|
|
187
|
+
break;
|
|
188
|
+
case "scalar":
|
|
189
|
+
try {
|
|
190
|
+
target[localName] = readScalar(field.T, jsonValue);
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
let m = `cannot decode field ${type.typeName}.${field.name} from JSON: "${this.debug(jsonValue)}"`;
|
|
194
|
+
if (e instanceof Error && e.message.length > 0) {
|
|
195
|
+
m += `: ${e.message}`;
|
|
196
|
+
}
|
|
197
|
+
throw new Error(m);
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
157
201
|
}
|
|
158
|
-
break;
|
|
159
202
|
}
|
|
203
|
+
return message;
|
|
204
|
+
},
|
|
205
|
+
writeMessage(message, options) {
|
|
206
|
+
const type = message.getType();
|
|
207
|
+
const json = {};
|
|
208
|
+
let field;
|
|
160
209
|
try {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
} else {
|
|
184
|
-
switch (field.kind) {
|
|
185
|
-
case "message":
|
|
186
|
-
const messageType = field.T;
|
|
187
|
-
if (
|
|
188
|
-
jsonValue === null &&
|
|
189
|
-
messageType.typeName != "google.protobuf.Value"
|
|
190
|
-
) {
|
|
191
|
-
if (field.oneof) {
|
|
192
|
-
throw new Error(
|
|
193
|
-
`cannot decode field ${type.typeName}.${field.name} from JSON: null is invalid for oneof field "${jsonKey}"`
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
continue;
|
|
197
|
-
}
|
|
198
|
-
const targetMessage =
|
|
199
|
-
target[localName] === undefined
|
|
200
|
-
? new messageType()
|
|
201
|
-
: (0, field_wrapper_js_1.wrapField)(
|
|
202
|
-
messageType,
|
|
203
|
-
target[localName]
|
|
204
|
-
);
|
|
205
|
-
target[localName] = (0, field_wrapper_js_1.unwrapField)(
|
|
206
|
-
messageType,
|
|
207
|
-
targetMessage.fromJson(jsonValue, options)
|
|
208
|
-
);
|
|
209
|
-
break;
|
|
210
|
-
case "enum":
|
|
211
|
-
const enumValue = readEnum(
|
|
212
|
-
field.T,
|
|
213
|
-
jsonValue,
|
|
214
|
-
options.ignoreUnknownFields
|
|
215
|
-
);
|
|
216
|
-
if (enumValue !== undefined) {
|
|
217
|
-
target[localName] = enumValue;
|
|
218
|
-
}
|
|
219
|
-
break;
|
|
220
|
-
case "scalar":
|
|
221
|
-
try {
|
|
222
|
-
target[localName] = readScalar(field.T, jsonValue);
|
|
223
|
-
} catch (e) {
|
|
224
|
-
let m = `cannot decode field ${type.typeName}.${
|
|
225
|
-
field.name
|
|
226
|
-
} from JSON: "${this.debug(jsonValue)}"`;
|
|
227
|
-
if (e instanceof Error && e.message.length > 0) {
|
|
228
|
-
m += `: ${e.message}`;
|
|
210
|
+
for (const member of type.fields.byMember()) {
|
|
211
|
+
let jsonValue;
|
|
212
|
+
if (member.kind == "oneof") {
|
|
213
|
+
const oneof = message[member.localName];
|
|
214
|
+
if (oneof.value === undefined) {
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
field = member.findField(oneof.case);
|
|
218
|
+
if (!field) {
|
|
219
|
+
throw "oneof case not found: " + oneof.case;
|
|
220
|
+
}
|
|
221
|
+
jsonValue = writeField(field, oneof.value, options);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
field = member;
|
|
225
|
+
jsonValue = writeField(field, message[field.localName], options);
|
|
226
|
+
}
|
|
227
|
+
if (jsonValue !== undefined) {
|
|
228
|
+
json[options.useProtoFieldName ? field.name : field.jsonName] =
|
|
229
|
+
jsonValue;
|
|
230
|
+
}
|
|
229
231
|
}
|
|
230
|
-
throw new Error(m);
|
|
231
|
-
}
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
return message;
|
|
237
|
-
},
|
|
238
|
-
writeMessage(message, options) {
|
|
239
|
-
const type = message.getType();
|
|
240
|
-
const json = {};
|
|
241
|
-
let field;
|
|
242
|
-
try {
|
|
243
|
-
for (const member of type.fields.byMember()) {
|
|
244
|
-
let jsonValue;
|
|
245
|
-
if (member.kind == "oneof") {
|
|
246
|
-
const oneof = message[member.localName];
|
|
247
|
-
if (oneof.value === undefined) {
|
|
248
|
-
continue;
|
|
249
232
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
233
|
+
catch (e) {
|
|
234
|
+
const m = field
|
|
235
|
+
? `cannot encode field ${type.typeName}.${field.name} to JSON`
|
|
236
|
+
: `cannot encode message ${type.typeName} to JSON`;
|
|
237
|
+
const r = e instanceof Error ? e.message : String(e);
|
|
238
|
+
throw new Error(m + (r.length > 0 ? `: ${r}` : ""));
|
|
253
239
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
json[options.useProtoFieldName ? field.name : field.jsonName] =
|
|
261
|
-
jsonValue;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
} catch (e) {
|
|
265
|
-
const m = field
|
|
266
|
-
? `cannot encode field ${type.typeName}.${field.name} to JSON`
|
|
267
|
-
: `cannot encode message ${type.typeName} to JSON`;
|
|
268
|
-
const r = e instanceof Error ? e.message : String(e);
|
|
269
|
-
throw new Error(m + (r.length > 0 ? `: ${r}` : ""));
|
|
270
|
-
}
|
|
271
|
-
return json;
|
|
272
|
-
},
|
|
273
|
-
readScalar,
|
|
274
|
-
writeScalar,
|
|
275
|
-
debug: debugJsonValue,
|
|
276
|
-
};
|
|
240
|
+
return json;
|
|
241
|
+
},
|
|
242
|
+
readScalar,
|
|
243
|
+
writeScalar,
|
|
244
|
+
debug: debugJsonValue,
|
|
245
|
+
};
|
|
277
246
|
}
|
|
278
247
|
exports.makeJsonFormatCommon = makeJsonFormatCommon;
|
|
279
248
|
function debugJsonValue(json) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
249
|
+
if (json === null) {
|
|
250
|
+
return "null";
|
|
251
|
+
}
|
|
252
|
+
switch (typeof json) {
|
|
253
|
+
case "object":
|
|
254
|
+
return Array.isArray(json) ? "array" : "object";
|
|
255
|
+
case "string":
|
|
256
|
+
return json.length > 100 ? "string" : `"${json.split('"').join('\\"')}"`;
|
|
257
|
+
default:
|
|
258
|
+
return json.toString();
|
|
259
|
+
}
|
|
291
260
|
}
|
|
292
261
|
// May throw an error. If the error message is non-blank, it should be shown.
|
|
293
262
|
// It is up to the caller to provide context.
|
|
294
263
|
function readScalar(type, json) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
264
|
+
// every valid case in the switch below returns, and every fall
|
|
265
|
+
// through is regarded as a failure.
|
|
266
|
+
switch (type) {
|
|
267
|
+
// float, double: JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity".
|
|
268
|
+
// Either numbers or strings are accepted. Exponent notation is also accepted.
|
|
269
|
+
case field_js_1.ScalarType.DOUBLE:
|
|
270
|
+
case field_js_1.ScalarType.FLOAT:
|
|
271
|
+
if (json === null)
|
|
272
|
+
return 0.0;
|
|
273
|
+
if (json === "NaN")
|
|
274
|
+
return Number.NaN;
|
|
275
|
+
if (json === "Infinity")
|
|
276
|
+
return Number.POSITIVE_INFINITY;
|
|
277
|
+
if (json === "-Infinity")
|
|
278
|
+
return Number.NEGATIVE_INFINITY;
|
|
279
|
+
if (json === "") {
|
|
280
|
+
// empty string is not a number
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
if (typeof json == "string" && json.trim().length !== json.length) {
|
|
284
|
+
// extra whitespace
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
if (typeof json != "string" && typeof json != "number") {
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
const float = Number(json);
|
|
291
|
+
if (Number.isNaN(float)) {
|
|
292
|
+
// not a number
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
if (!Number.isFinite(float)) {
|
|
296
|
+
// infinity and -infinity are handled by string representation above, so this is an error
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
if (type == field_js_1.ScalarType.FLOAT)
|
|
300
|
+
(0, assert_js_1.assertFloat32)(float);
|
|
301
|
+
return float;
|
|
302
|
+
// int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.
|
|
303
|
+
case field_js_1.ScalarType.INT32:
|
|
304
|
+
case field_js_1.ScalarType.FIXED32:
|
|
305
|
+
case field_js_1.ScalarType.SFIXED32:
|
|
306
|
+
case field_js_1.ScalarType.SINT32:
|
|
307
|
+
case field_js_1.ScalarType.UINT32:
|
|
308
|
+
if (json === null)
|
|
309
|
+
return 0;
|
|
310
|
+
let int32;
|
|
311
|
+
if (typeof json == "number")
|
|
312
|
+
int32 = json;
|
|
313
|
+
else if (typeof json == "string" && json.length > 0) {
|
|
314
|
+
if (json.trim().length === json.length)
|
|
315
|
+
int32 = Number(json);
|
|
316
|
+
}
|
|
317
|
+
if (int32 === undefined)
|
|
318
|
+
break;
|
|
319
|
+
if (type == field_js_1.ScalarType.UINT32)
|
|
320
|
+
(0, assert_js_1.assertUInt32)(int32);
|
|
321
|
+
else
|
|
322
|
+
(0, assert_js_1.assertInt32)(int32);
|
|
323
|
+
return int32;
|
|
324
|
+
// int64, fixed64, uint64: JSON value will be a decimal string. Either numbers or strings are accepted.
|
|
325
|
+
case field_js_1.ScalarType.INT64:
|
|
326
|
+
case field_js_1.ScalarType.SFIXED64:
|
|
327
|
+
case field_js_1.ScalarType.SINT64:
|
|
328
|
+
if (json === null)
|
|
329
|
+
return proto_int64_js_1.protoInt64.zero;
|
|
330
|
+
if (typeof json != "number" && typeof json != "string")
|
|
331
|
+
break;
|
|
332
|
+
return proto_int64_js_1.protoInt64.parse(json);
|
|
333
|
+
case field_js_1.ScalarType.FIXED64:
|
|
334
|
+
case field_js_1.ScalarType.UINT64:
|
|
335
|
+
if (json === null)
|
|
336
|
+
return proto_int64_js_1.protoInt64.zero;
|
|
337
|
+
if (typeof json != "number" && typeof json != "string")
|
|
338
|
+
break;
|
|
339
|
+
return proto_int64_js_1.protoInt64.uParse(json);
|
|
340
|
+
// bool:
|
|
341
|
+
case field_js_1.ScalarType.BOOL:
|
|
342
|
+
if (json === null)
|
|
343
|
+
return false;
|
|
344
|
+
if (typeof json !== "boolean")
|
|
345
|
+
break;
|
|
346
|
+
return json;
|
|
347
|
+
// string:
|
|
348
|
+
case field_js_1.ScalarType.STRING:
|
|
349
|
+
if (json === null)
|
|
350
|
+
return "";
|
|
351
|
+
if (typeof json !== "string") {
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
// A string must always contain UTF-8 encoded or 7-bit ASCII.
|
|
355
|
+
// We validate with encodeURIComponent, which appears to be the fastest widely available option.
|
|
356
|
+
try {
|
|
357
|
+
encodeURIComponent(json);
|
|
358
|
+
}
|
|
359
|
+
catch (e) {
|
|
360
|
+
throw new Error("invalid UTF8");
|
|
361
|
+
}
|
|
362
|
+
return json;
|
|
363
|
+
// bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.
|
|
364
|
+
// Either standard or URL-safe base64 encoding with/without paddings are accepted.
|
|
365
|
+
case field_js_1.ScalarType.BYTES:
|
|
366
|
+
if (json === null || json === "")
|
|
367
|
+
return new Uint8Array(0);
|
|
368
|
+
if (typeof json !== "string")
|
|
369
|
+
break;
|
|
370
|
+
return (0, base64_js_1.base64decode)(json);
|
|
371
|
+
}
|
|
372
|
+
throw new Error();
|
|
385
373
|
}
|
|
386
374
|
function readEnum(type, json, ignoreUnknownFields) {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
`cannot decode enum ${type.typeName} from JSON: ${debugJsonValue(json)}`
|
|
407
|
-
);
|
|
375
|
+
if (json === null) {
|
|
376
|
+
// proto3 requires 0 to be default value for all enums
|
|
377
|
+
return 0;
|
|
378
|
+
}
|
|
379
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
380
|
+
switch (typeof json) {
|
|
381
|
+
case "number":
|
|
382
|
+
if (Number.isInteger(json)) {
|
|
383
|
+
return json;
|
|
384
|
+
}
|
|
385
|
+
break;
|
|
386
|
+
case "string":
|
|
387
|
+
const value = type.findName(json);
|
|
388
|
+
if (value || ignoreUnknownFields) {
|
|
389
|
+
return value?.no;
|
|
390
|
+
}
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
throw new Error(`cannot decode enum ${type.typeName} from JSON: ${debugJsonValue(json)}`);
|
|
408
394
|
}
|
|
409
395
|
function writeEnum(type, value, emitIntrinsicDefault, enumAsInteger) {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
396
|
+
if (value === undefined) {
|
|
397
|
+
return value;
|
|
398
|
+
}
|
|
399
|
+
if (value === 0 && !emitIntrinsicDefault) {
|
|
400
|
+
// proto3 requires 0 to be default value for all enums
|
|
401
|
+
return undefined;
|
|
402
|
+
}
|
|
403
|
+
if (enumAsInteger) {
|
|
404
|
+
return value;
|
|
405
|
+
}
|
|
406
|
+
if (type.typeName == "google.protobuf.NullValue") {
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
const val = type.findNumber(value);
|
|
410
|
+
return val?.name ?? value; // if we don't know the enum value, just return the number
|
|
425
411
|
}
|
|
426
412
|
function writeScalar(type, value, emitIntrinsicDefault) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
413
|
+
if (value === undefined) {
|
|
414
|
+
return undefined;
|
|
415
|
+
}
|
|
416
|
+
switch (type) {
|
|
417
|
+
// int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.
|
|
418
|
+
case field_js_1.ScalarType.INT32:
|
|
419
|
+
case field_js_1.ScalarType.SFIXED32:
|
|
420
|
+
case field_js_1.ScalarType.SINT32:
|
|
421
|
+
case field_js_1.ScalarType.FIXED32:
|
|
422
|
+
case field_js_1.ScalarType.UINT32:
|
|
423
|
+
(0, assert_js_1.assert)(typeof value == "number");
|
|
424
|
+
return value != 0 || emitIntrinsicDefault ? value : undefined;
|
|
425
|
+
// float, double: JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity".
|
|
426
|
+
// Either numbers or strings are accepted. Exponent notation is also accepted.
|
|
427
|
+
case field_js_1.ScalarType.FLOAT:
|
|
428
|
+
// assertFloat32(value);
|
|
429
|
+
case field_js_1.ScalarType.DOUBLE: // eslint-disable-line no-fallthrough
|
|
430
|
+
(0, assert_js_1.assert)(typeof value == "number");
|
|
431
|
+
if (Number.isNaN(value))
|
|
432
|
+
return "NaN";
|
|
433
|
+
if (value === Number.POSITIVE_INFINITY)
|
|
434
|
+
return "Infinity";
|
|
435
|
+
if (value === Number.NEGATIVE_INFINITY)
|
|
436
|
+
return "-Infinity";
|
|
437
|
+
return value !== 0 || emitIntrinsicDefault ? value : undefined;
|
|
438
|
+
// string:
|
|
439
|
+
case field_js_1.ScalarType.STRING:
|
|
440
|
+
(0, assert_js_1.assert)(typeof value == "string");
|
|
441
|
+
return value.length > 0 || emitIntrinsicDefault ? value : undefined;
|
|
442
|
+
// bool:
|
|
443
|
+
case field_js_1.ScalarType.BOOL:
|
|
444
|
+
(0, assert_js_1.assert)(typeof value == "boolean");
|
|
445
|
+
return value || emitIntrinsicDefault ? value : undefined;
|
|
446
|
+
// JSON value will be a decimal string. Either numbers or strings are accepted.
|
|
447
|
+
case field_js_1.ScalarType.UINT64:
|
|
448
|
+
case field_js_1.ScalarType.FIXED64:
|
|
449
|
+
case field_js_1.ScalarType.INT64:
|
|
450
|
+
case field_js_1.ScalarType.SFIXED64:
|
|
451
|
+
case field_js_1.ScalarType.SINT64:
|
|
452
|
+
(0, assert_js_1.assert)(typeof value == "bigint" ||
|
|
453
|
+
typeof value == "string" ||
|
|
454
|
+
typeof value == "number");
|
|
455
|
+
// We use implicit conversion with `value != 0` to catch both 0n and "0"
|
|
456
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
457
|
+
// @ts-ignore
|
|
458
|
+
return emitIntrinsicDefault || value != 0
|
|
459
|
+
? value.toString(10)
|
|
460
|
+
: undefined;
|
|
461
|
+
// bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.
|
|
462
|
+
// Either standard or URL-safe base64 encoding with/without paddings are accepted.
|
|
463
|
+
case field_js_1.ScalarType.BYTES:
|
|
464
|
+
(0, assert_js_1.assert)(value instanceof Uint8Array);
|
|
465
|
+
return emitIntrinsicDefault || value.byteLength > 0
|
|
466
|
+
? (0, base64_js_1.base64encode)(value)
|
|
467
|
+
: undefined;
|
|
468
|
+
}
|
|
482
469
|
}
|