@bufbuild/protobuf 2.0.0-alpha.2 → 2.0.0-alpha.4
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 +1 -1
- package/dist/cjs/clone.d.ts +1 -1
- package/dist/cjs/clone.js +9 -6
- package/dist/cjs/codegenv1/boot.d.ts +1 -1
- package/dist/cjs/codegenv1/boot.js +3 -5
- package/dist/cjs/codegenv1/embed.d.ts +1 -1
- package/dist/cjs/codegenv1/embed.js +39 -34
- package/dist/cjs/codegenv1/enum.d.ts +1 -1
- package/dist/cjs/codegenv1/extension.d.ts +1 -1
- package/dist/cjs/codegenv1/file.d.ts +1 -1
- package/dist/cjs/codegenv1/file.js +5 -7
- package/dist/cjs/codegenv1/index.d.ts +1 -0
- package/dist/cjs/codegenv1/index.js +1 -0
- package/dist/cjs/codegenv1/message.d.ts +1 -1
- package/dist/cjs/codegenv1/scalar.d.ts +5 -0
- package/dist/cjs/codegenv1/scalar.js +39 -0
- package/dist/cjs/codegenv1/service.d.ts +3 -3
- package/dist/cjs/codegenv1/types.d.ts +7 -9
- package/dist/cjs/create.d.ts +1 -1
- package/dist/cjs/create.js +6 -5
- package/dist/cjs/{desc-types.d.ts → descriptors.d.ts} +39 -7
- package/dist/cjs/descriptors.js +53 -0
- package/dist/cjs/equals.d.ts +1 -1
- package/dist/cjs/extensions.d.ts +1 -1
- package/dist/cjs/extensions.js +4 -3
- package/dist/cjs/fields.d.ts +1 -1
- package/dist/cjs/from-binary.d.ts +1 -1
- package/dist/cjs/from-binary.js +32 -29
- package/dist/cjs/from-json.d.ts +2 -2
- package/dist/cjs/from-json.js +201 -188
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/is-message.d.ts +1 -1
- package/dist/cjs/proto-int64.d.ts +4 -1
- package/dist/cjs/proto-int64.js +16 -6
- package/dist/cjs/reflect/error.d.ts +1 -1
- package/dist/cjs/reflect/guard.d.ts +1 -1
- package/dist/cjs/reflect/guard.js +4 -4
- package/dist/cjs/reflect/index.d.ts +0 -1
- package/dist/cjs/reflect/index.js +0 -1
- package/dist/cjs/reflect/names.d.ts +1 -1
- package/dist/cjs/reflect/names.js +1 -1
- package/dist/cjs/reflect/nested-types.d.ts +1 -1
- package/dist/cjs/reflect/reflect-check.d.ts +10 -1
- package/dist/cjs/reflect/reflect-check.js +126 -9
- package/dist/cjs/reflect/reflect-types.d.ts +3 -41
- package/dist/cjs/reflect/reflect.d.ts +1 -1
- package/dist/cjs/reflect/reflect.js +42 -60
- package/dist/cjs/reflect/scalar.d.ts +3 -55
- package/dist/cjs/reflect/scalar.js +26 -220
- package/dist/cjs/reflect/unsafe.d.ts +1 -17
- package/dist/cjs/reflect/unsafe.js +2 -20
- package/dist/cjs/{reflect/registry.d.ts → registry.d.ts} +2 -2
- package/dist/cjs/{reflect/registry.js → registry.js} +54 -36
- package/dist/cjs/to-binary.d.ts +1 -1
- package/dist/cjs/to-binary.js +27 -27
- package/dist/cjs/to-json.d.ts +7 -6
- package/dist/cjs/to-json.js +57 -44
- package/dist/cjs/types.d.ts +1 -1
- package/dist/cjs/wire/base64-encoding.js +2 -2
- package/dist/cjs/wire/binary-encoding.d.ts +20 -0
- package/dist/cjs/wire/binary-encoding.js +75 -8
- package/dist/cjs/wire/size-delimited.d.ts +1 -1
- package/dist/cjs/wire/text-format.d.ts +1 -2
- package/dist/cjs/wire/text-format.js +21 -19
- package/dist/cjs/wkt/any.d.ts +2 -2
- package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +6 -0
- package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/dist/cjs/wkt/wrappers.d.ts +1 -1
- package/dist/esm/clone.d.ts +1 -1
- package/dist/esm/clone.js +8 -5
- package/dist/esm/codegenv1/boot.d.ts +1 -1
- package/dist/esm/codegenv1/boot.js +3 -5
- package/dist/esm/codegenv1/embed.d.ts +1 -1
- package/dist/esm/codegenv1/embed.js +9 -4
- package/dist/esm/codegenv1/enum.d.ts +1 -1
- package/dist/esm/codegenv1/extension.d.ts +1 -1
- package/dist/esm/codegenv1/file.d.ts +1 -1
- package/dist/esm/codegenv1/file.js +4 -6
- package/dist/esm/codegenv1/index.d.ts +1 -0
- package/dist/esm/codegenv1/index.js +1 -0
- package/dist/esm/codegenv1/message.d.ts +1 -1
- package/dist/esm/codegenv1/scalar.d.ts +5 -0
- package/dist/esm/codegenv1/scalar.js +35 -0
- package/dist/esm/codegenv1/service.d.ts +3 -3
- package/dist/esm/codegenv1/types.d.ts +7 -9
- package/dist/esm/create.d.ts +1 -1
- package/dist/esm/create.js +4 -3
- package/dist/esm/{desc-types.d.ts → descriptors.d.ts} +39 -7
- package/dist/esm/descriptors.js +50 -0
- package/dist/esm/equals.d.ts +1 -1
- package/dist/esm/extensions.d.ts +1 -1
- package/dist/esm/extensions.js +4 -3
- package/dist/esm/fields.d.ts +1 -1
- package/dist/esm/from-binary.d.ts +1 -1
- package/dist/esm/from-binary.js +14 -11
- package/dist/esm/from-json.d.ts +2 -2
- package/dist/esm/from-json.js +194 -181
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/is-message.d.ts +1 -1
- package/dist/esm/proto-int64.d.ts +4 -1
- package/dist/esm/proto-int64.js +16 -6
- package/dist/esm/reflect/error.d.ts +1 -1
- package/dist/esm/reflect/guard.d.ts +1 -1
- package/dist/esm/reflect/guard.js +4 -4
- package/dist/esm/reflect/index.d.ts +0 -1
- package/dist/esm/reflect/index.js +0 -1
- package/dist/esm/reflect/names.d.ts +1 -1
- package/dist/esm/reflect/names.js +1 -1
- package/dist/esm/reflect/nested-types.d.ts +1 -1
- package/dist/esm/reflect/reflect-check.d.ts +10 -1
- package/dist/esm/reflect/reflect-check.js +119 -2
- package/dist/esm/reflect/reflect-types.d.ts +3 -41
- package/dist/esm/reflect/reflect-types.js +1 -0
- package/dist/esm/reflect/reflect.d.ts +1 -1
- package/dist/esm/reflect/reflect.js +25 -43
- package/dist/esm/reflect/scalar.d.ts +3 -55
- package/dist/esm/reflect/scalar.js +14 -205
- package/dist/esm/reflect/unsafe.d.ts +1 -17
- package/dist/esm/reflect/unsafe.js +1 -17
- package/dist/esm/{reflect/registry.d.ts → registry.d.ts} +2 -2
- package/dist/esm/{reflect/registry.js → registry.js} +44 -26
- package/dist/esm/to-binary.d.ts +1 -1
- package/dist/esm/to-binary.js +1 -1
- package/dist/esm/to-json.d.ts +7 -6
- package/dist/esm/to-json.js +42 -29
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/wire/base64-encoding.js +2 -2
- package/dist/esm/wire/binary-encoding.d.ts +20 -0
- package/dist/esm/wire/binary-encoding.js +68 -1
- package/dist/esm/wire/size-delimited.d.ts +1 -1
- package/dist/esm/wire/text-format.d.ts +1 -2
- package/dist/esm/wire/text-format.js +5 -3
- package/dist/esm/wkt/any.d.ts +2 -2
- package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +6 -0
- package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/dist/esm/wkt/wrappers.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/desc-types.js +0 -15
- package/dist/cjs/reflect/assert.d.ts +0 -16
- package/dist/cjs/reflect/assert.js +0 -59
- package/dist/esm/desc-types.js +0 -14
- package/dist/esm/reflect/assert.d.ts +0 -16
- package/dist/esm/reflect/assert.js +0 -52
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Assert that condition is truthy or throw error (with message)
|
|
3
|
-
*/
|
|
4
|
-
export declare function assert(condition: unknown, msg?: string): asserts condition;
|
|
5
|
-
/**
|
|
6
|
-
* Assert a valid signed protobuf 32-bit integer.
|
|
7
|
-
*/
|
|
8
|
-
export declare function assertInt32(arg: unknown): asserts arg is number;
|
|
9
|
-
/**
|
|
10
|
-
* Assert a valid unsigned protobuf 32-bit integer.
|
|
11
|
-
*/
|
|
12
|
-
export declare function assertUInt32(arg: unknown): asserts arg is number;
|
|
13
|
-
/**
|
|
14
|
-
* Assert a valid protobuf float value.
|
|
15
|
-
*/
|
|
16
|
-
export declare function assertFloat32(arg: unknown): asserts arg is number;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2021-2024 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.
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.assertFloat32 = exports.assertUInt32 = exports.assertInt32 = exports.assert = void 0;
|
|
17
|
-
/**
|
|
18
|
-
* Assert that condition is truthy or throw error (with message)
|
|
19
|
-
*/
|
|
20
|
-
function assert(condition, msg) {
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions -- we want the implicit conversion to boolean
|
|
22
|
-
if (!condition) {
|
|
23
|
-
throw new Error(msg);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.assert = assert;
|
|
27
|
-
const FLOAT32_MAX = 3.4028234663852886e38, FLOAT32_MIN = -3.4028234663852886e38, UINT32_MAX = 0xffffffff, INT32_MAX = 0x7fffffff, INT32_MIN = -0x80000000;
|
|
28
|
-
/**
|
|
29
|
-
* Assert a valid signed protobuf 32-bit integer.
|
|
30
|
-
*/
|
|
31
|
-
function assertInt32(arg) {
|
|
32
|
-
if (typeof arg !== "number")
|
|
33
|
-
throw new Error("invalid int 32: " + typeof arg);
|
|
34
|
-
if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN)
|
|
35
|
-
throw new Error("invalid int 32: " + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string
|
|
36
|
-
}
|
|
37
|
-
exports.assertInt32 = assertInt32;
|
|
38
|
-
/**
|
|
39
|
-
* Assert a valid unsigned protobuf 32-bit integer.
|
|
40
|
-
*/
|
|
41
|
-
function assertUInt32(arg) {
|
|
42
|
-
if (typeof arg !== "number")
|
|
43
|
-
throw new Error("invalid uint 32: " + typeof arg);
|
|
44
|
-
if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0)
|
|
45
|
-
throw new Error("invalid uint 32: " + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string
|
|
46
|
-
}
|
|
47
|
-
exports.assertUInt32 = assertUInt32;
|
|
48
|
-
/**
|
|
49
|
-
* Assert a valid protobuf float value.
|
|
50
|
-
*/
|
|
51
|
-
function assertFloat32(arg) {
|
|
52
|
-
if (typeof arg !== "number")
|
|
53
|
-
throw new Error("invalid float 32: " + typeof arg);
|
|
54
|
-
if (!Number.isFinite(arg))
|
|
55
|
-
return;
|
|
56
|
-
if (arg > FLOAT32_MAX || arg < FLOAT32_MIN)
|
|
57
|
-
throw new Error("invalid float 32: " + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string
|
|
58
|
-
}
|
|
59
|
-
exports.assertFloat32 = assertFloat32;
|
package/dist/esm/desc-types.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright 2021-2024 Buf Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Assert that condition is truthy or throw error (with message)
|
|
3
|
-
*/
|
|
4
|
-
export declare function assert(condition: unknown, msg?: string): asserts condition;
|
|
5
|
-
/**
|
|
6
|
-
* Assert a valid signed protobuf 32-bit integer.
|
|
7
|
-
*/
|
|
8
|
-
export declare function assertInt32(arg: unknown): asserts arg is number;
|
|
9
|
-
/**
|
|
10
|
-
* Assert a valid unsigned protobuf 32-bit integer.
|
|
11
|
-
*/
|
|
12
|
-
export declare function assertUInt32(arg: unknown): asserts arg is number;
|
|
13
|
-
/**
|
|
14
|
-
* Assert a valid protobuf float value.
|
|
15
|
-
*/
|
|
16
|
-
export declare function assertFloat32(arg: unknown): asserts arg is number;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// Copyright 2021-2024 Buf Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
/**
|
|
15
|
-
* Assert that condition is truthy or throw error (with message)
|
|
16
|
-
*/
|
|
17
|
-
export function assert(condition, msg) {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions -- we want the implicit conversion to boolean
|
|
19
|
-
if (!condition) {
|
|
20
|
-
throw new Error(msg);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const FLOAT32_MAX = 3.4028234663852886e38, FLOAT32_MIN = -3.4028234663852886e38, UINT32_MAX = 0xffffffff, INT32_MAX = 0x7fffffff, INT32_MIN = -0x80000000;
|
|
24
|
-
/**
|
|
25
|
-
* Assert a valid signed protobuf 32-bit integer.
|
|
26
|
-
*/
|
|
27
|
-
export function assertInt32(arg) {
|
|
28
|
-
if (typeof arg !== "number")
|
|
29
|
-
throw new Error("invalid int 32: " + typeof arg);
|
|
30
|
-
if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN)
|
|
31
|
-
throw new Error("invalid int 32: " + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Assert a valid unsigned protobuf 32-bit integer.
|
|
35
|
-
*/
|
|
36
|
-
export function assertUInt32(arg) {
|
|
37
|
-
if (typeof arg !== "number")
|
|
38
|
-
throw new Error("invalid uint 32: " + typeof arg);
|
|
39
|
-
if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0)
|
|
40
|
-
throw new Error("invalid uint 32: " + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Assert a valid protobuf float value.
|
|
44
|
-
*/
|
|
45
|
-
export function assertFloat32(arg) {
|
|
46
|
-
if (typeof arg !== "number")
|
|
47
|
-
throw new Error("invalid float 32: " + typeof arg);
|
|
48
|
-
if (!Number.isFinite(arg))
|
|
49
|
-
return;
|
|
50
|
-
if (arg > FLOAT32_MAX || arg < FLOAT32_MIN)
|
|
51
|
-
throw new Error("invalid float 32: " + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string
|
|
52
|
-
}
|