@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.
Files changed (145) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/clone.d.ts +1 -1
  3. package/dist/cjs/clone.js +9 -6
  4. package/dist/cjs/codegenv1/boot.d.ts +1 -1
  5. package/dist/cjs/codegenv1/boot.js +3 -5
  6. package/dist/cjs/codegenv1/embed.d.ts +1 -1
  7. package/dist/cjs/codegenv1/embed.js +39 -34
  8. package/dist/cjs/codegenv1/enum.d.ts +1 -1
  9. package/dist/cjs/codegenv1/extension.d.ts +1 -1
  10. package/dist/cjs/codegenv1/file.d.ts +1 -1
  11. package/dist/cjs/codegenv1/file.js +5 -7
  12. package/dist/cjs/codegenv1/index.d.ts +1 -0
  13. package/dist/cjs/codegenv1/index.js +1 -0
  14. package/dist/cjs/codegenv1/message.d.ts +1 -1
  15. package/dist/cjs/codegenv1/scalar.d.ts +5 -0
  16. package/dist/cjs/codegenv1/scalar.js +39 -0
  17. package/dist/cjs/codegenv1/service.d.ts +3 -3
  18. package/dist/cjs/codegenv1/types.d.ts +7 -9
  19. package/dist/cjs/create.d.ts +1 -1
  20. package/dist/cjs/create.js +6 -5
  21. package/dist/cjs/{desc-types.d.ts → descriptors.d.ts} +39 -7
  22. package/dist/cjs/descriptors.js +53 -0
  23. package/dist/cjs/equals.d.ts +1 -1
  24. package/dist/cjs/extensions.d.ts +1 -1
  25. package/dist/cjs/extensions.js +4 -3
  26. package/dist/cjs/fields.d.ts +1 -1
  27. package/dist/cjs/from-binary.d.ts +1 -1
  28. package/dist/cjs/from-binary.js +32 -29
  29. package/dist/cjs/from-json.d.ts +2 -2
  30. package/dist/cjs/from-json.js +201 -188
  31. package/dist/cjs/index.d.ts +2 -1
  32. package/dist/cjs/index.js +2 -1
  33. package/dist/cjs/is-message.d.ts +1 -1
  34. package/dist/cjs/proto-int64.d.ts +4 -1
  35. package/dist/cjs/proto-int64.js +16 -6
  36. package/dist/cjs/reflect/error.d.ts +1 -1
  37. package/dist/cjs/reflect/guard.d.ts +1 -1
  38. package/dist/cjs/reflect/guard.js +4 -4
  39. package/dist/cjs/reflect/index.d.ts +0 -1
  40. package/dist/cjs/reflect/index.js +0 -1
  41. package/dist/cjs/reflect/names.d.ts +1 -1
  42. package/dist/cjs/reflect/names.js +1 -1
  43. package/dist/cjs/reflect/nested-types.d.ts +1 -1
  44. package/dist/cjs/reflect/reflect-check.d.ts +10 -1
  45. package/dist/cjs/reflect/reflect-check.js +126 -9
  46. package/dist/cjs/reflect/reflect-types.d.ts +3 -41
  47. package/dist/cjs/reflect/reflect.d.ts +1 -1
  48. package/dist/cjs/reflect/reflect.js +42 -60
  49. package/dist/cjs/reflect/scalar.d.ts +3 -55
  50. package/dist/cjs/reflect/scalar.js +26 -220
  51. package/dist/cjs/reflect/unsafe.d.ts +1 -17
  52. package/dist/cjs/reflect/unsafe.js +2 -20
  53. package/dist/cjs/{reflect/registry.d.ts → registry.d.ts} +2 -2
  54. package/dist/cjs/{reflect/registry.js → registry.js} +54 -36
  55. package/dist/cjs/to-binary.d.ts +1 -1
  56. package/dist/cjs/to-binary.js +27 -27
  57. package/dist/cjs/to-json.d.ts +7 -6
  58. package/dist/cjs/to-json.js +57 -44
  59. package/dist/cjs/types.d.ts +1 -1
  60. package/dist/cjs/wire/base64-encoding.js +2 -2
  61. package/dist/cjs/wire/binary-encoding.d.ts +20 -0
  62. package/dist/cjs/wire/binary-encoding.js +75 -8
  63. package/dist/cjs/wire/size-delimited.d.ts +1 -1
  64. package/dist/cjs/wire/text-format.d.ts +1 -2
  65. package/dist/cjs/wire/text-format.js +21 -19
  66. package/dist/cjs/wkt/any.d.ts +2 -2
  67. package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +6 -0
  68. package/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
  69. package/dist/cjs/wkt/wrappers.d.ts +1 -1
  70. package/dist/esm/clone.d.ts +1 -1
  71. package/dist/esm/clone.js +8 -5
  72. package/dist/esm/codegenv1/boot.d.ts +1 -1
  73. package/dist/esm/codegenv1/boot.js +3 -5
  74. package/dist/esm/codegenv1/embed.d.ts +1 -1
  75. package/dist/esm/codegenv1/embed.js +9 -4
  76. package/dist/esm/codegenv1/enum.d.ts +1 -1
  77. package/dist/esm/codegenv1/extension.d.ts +1 -1
  78. package/dist/esm/codegenv1/file.d.ts +1 -1
  79. package/dist/esm/codegenv1/file.js +4 -6
  80. package/dist/esm/codegenv1/index.d.ts +1 -0
  81. package/dist/esm/codegenv1/index.js +1 -0
  82. package/dist/esm/codegenv1/message.d.ts +1 -1
  83. package/dist/esm/codegenv1/scalar.d.ts +5 -0
  84. package/dist/esm/codegenv1/scalar.js +35 -0
  85. package/dist/esm/codegenv1/service.d.ts +3 -3
  86. package/dist/esm/codegenv1/types.d.ts +7 -9
  87. package/dist/esm/create.d.ts +1 -1
  88. package/dist/esm/create.js +4 -3
  89. package/dist/esm/{desc-types.d.ts → descriptors.d.ts} +39 -7
  90. package/dist/esm/descriptors.js +50 -0
  91. package/dist/esm/equals.d.ts +1 -1
  92. package/dist/esm/extensions.d.ts +1 -1
  93. package/dist/esm/extensions.js +4 -3
  94. package/dist/esm/fields.d.ts +1 -1
  95. package/dist/esm/from-binary.d.ts +1 -1
  96. package/dist/esm/from-binary.js +14 -11
  97. package/dist/esm/from-json.d.ts +2 -2
  98. package/dist/esm/from-json.js +194 -181
  99. package/dist/esm/index.d.ts +2 -1
  100. package/dist/esm/index.js +2 -1
  101. package/dist/esm/is-message.d.ts +1 -1
  102. package/dist/esm/proto-int64.d.ts +4 -1
  103. package/dist/esm/proto-int64.js +16 -6
  104. package/dist/esm/reflect/error.d.ts +1 -1
  105. package/dist/esm/reflect/guard.d.ts +1 -1
  106. package/dist/esm/reflect/guard.js +4 -4
  107. package/dist/esm/reflect/index.d.ts +0 -1
  108. package/dist/esm/reflect/index.js +0 -1
  109. package/dist/esm/reflect/names.d.ts +1 -1
  110. package/dist/esm/reflect/names.js +1 -1
  111. package/dist/esm/reflect/nested-types.d.ts +1 -1
  112. package/dist/esm/reflect/reflect-check.d.ts +10 -1
  113. package/dist/esm/reflect/reflect-check.js +119 -2
  114. package/dist/esm/reflect/reflect-types.d.ts +3 -41
  115. package/dist/esm/reflect/reflect-types.js +1 -0
  116. package/dist/esm/reflect/reflect.d.ts +1 -1
  117. package/dist/esm/reflect/reflect.js +25 -43
  118. package/dist/esm/reflect/scalar.d.ts +3 -55
  119. package/dist/esm/reflect/scalar.js +14 -205
  120. package/dist/esm/reflect/unsafe.d.ts +1 -17
  121. package/dist/esm/reflect/unsafe.js +1 -17
  122. package/dist/esm/{reflect/registry.d.ts → registry.d.ts} +2 -2
  123. package/dist/esm/{reflect/registry.js → registry.js} +44 -26
  124. package/dist/esm/to-binary.d.ts +1 -1
  125. package/dist/esm/to-binary.js +1 -1
  126. package/dist/esm/to-json.d.ts +7 -6
  127. package/dist/esm/to-json.js +42 -29
  128. package/dist/esm/types.d.ts +1 -1
  129. package/dist/esm/wire/base64-encoding.js +2 -2
  130. package/dist/esm/wire/binary-encoding.d.ts +20 -0
  131. package/dist/esm/wire/binary-encoding.js +68 -1
  132. package/dist/esm/wire/size-delimited.d.ts +1 -1
  133. package/dist/esm/wire/text-format.d.ts +1 -2
  134. package/dist/esm/wire/text-format.js +5 -3
  135. package/dist/esm/wkt/any.d.ts +2 -2
  136. package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +6 -0
  137. package/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
  138. package/dist/esm/wkt/wrappers.d.ts +1 -1
  139. package/package.json +1 -1
  140. package/dist/cjs/desc-types.js +0 -15
  141. package/dist/cjs/reflect/assert.d.ts +0 -16
  142. package/dist/cjs/reflect/assert.js +0 -59
  143. package/dist/esm/desc-types.js +0 -14
  144. package/dist/esm/reflect/assert.d.ts +0 -16
  145. 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;
@@ -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
- }