@bufbuild/protobuf 0.0.1 → 0.0.2-alpha.3

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 (115) hide show
  1. package/README.md +1 -21
  2. package/dist/cjs/binary-encoding.js +21 -8
  3. package/dist/cjs/binary-format.js +13 -0
  4. package/dist/cjs/descriptor-registry.js +13 -0
  5. package/dist/cjs/descriptor-set.js +13 -0
  6. package/dist/cjs/enum.js +13 -0
  7. package/dist/cjs/field-list.js +13 -0
  8. package/dist/cjs/field.js +13 -0
  9. package/dist/cjs/google/protobuf/any_pb.js +13 -33
  10. package/dist/cjs/google/protobuf/api_pb.js +10 -30
  11. package/dist/cjs/google/protobuf/compiler/plugin_pb.js +10 -45
  12. package/dist/cjs/google/protobuf/descriptor_pb.js +13 -39
  13. package/dist/cjs/google/protobuf/duration_pb.js +10 -30
  14. package/dist/cjs/google/protobuf/empty_pb.js +10 -30
  15. package/dist/cjs/google/protobuf/field_mask_pb.js +10 -30
  16. package/dist/cjs/google/protobuf/source_context_pb.js +10 -30
  17. package/dist/cjs/google/protobuf/struct_pb.js +10 -30
  18. package/dist/cjs/google/protobuf/timestamp_pb.js +10 -30
  19. package/dist/cjs/google/protobuf/type_pb.js +10 -30
  20. package/dist/cjs/google/protobuf/wrappers_pb.js +10 -39
  21. package/dist/cjs/{private/goog-varint.js → google/varint.js} +0 -0
  22. package/dist/cjs/index.js +21 -2
  23. package/dist/cjs/json-format.js +13 -0
  24. package/dist/cjs/message-type.js +13 -0
  25. package/dist/cjs/message.js +18 -6
  26. package/dist/cjs/private/assert.js +13 -0
  27. package/dist/cjs/private/binary-format-common.js +13 -0
  28. package/dist/cjs/private/binary-format-proto2.js +13 -0
  29. package/dist/cjs/private/binary-format-proto3.js +13 -0
  30. package/dist/cjs/private/enum.js +39 -1
  31. package/dist/cjs/private/field-list.js +13 -0
  32. package/dist/cjs/private/field-wrapper.js +13 -0
  33. package/dist/cjs/private/field.js +13 -0
  34. package/dist/cjs/private/json-format-common.js +16 -3
  35. package/dist/cjs/private/json-format-proto2.js +13 -0
  36. package/dist/cjs/private/json-format-proto3.js +13 -0
  37. package/dist/cjs/private/message-type.js +13 -0
  38. package/dist/cjs/private/names.js +13 -0
  39. package/dist/cjs/private/options-map.js +13 -0
  40. package/dist/cjs/private/proto-runtime.js +14 -0
  41. package/dist/cjs/private/scalars.js +13 -0
  42. package/dist/cjs/private/util-common.js +16 -3
  43. package/dist/cjs/private/util.js +13 -0
  44. package/dist/cjs/proto-base64.js +138 -0
  45. package/dist/cjs/proto-int64.js +19 -6
  46. package/dist/cjs/proto2.js +13 -0
  47. package/dist/cjs/proto3.js +13 -0
  48. package/dist/cjs/service-type.js +13 -0
  49. package/dist/cjs/type-registry.js +13 -0
  50. package/dist/esm/binary-encoding.js +14 -1
  51. package/dist/esm/binary-format.js +13 -0
  52. package/dist/esm/descriptor-registry.js +13 -0
  53. package/dist/esm/descriptor-set.js +13 -0
  54. package/dist/esm/enum.js +13 -0
  55. package/dist/esm/field-list.js +13 -0
  56. package/dist/esm/field.js +13 -0
  57. package/dist/esm/google/protobuf/any_pb.js +13 -33
  58. package/dist/esm/google/protobuf/api_pb.js +10 -30
  59. package/dist/esm/google/protobuf/compiler/plugin_pb.js +10 -45
  60. package/dist/esm/google/protobuf/descriptor_pb.js +13 -39
  61. package/dist/esm/google/protobuf/duration_pb.js +10 -30
  62. package/dist/esm/google/protobuf/empty_pb.js +10 -30
  63. package/dist/esm/google/protobuf/field_mask_pb.js +10 -30
  64. package/dist/esm/google/protobuf/source_context_pb.js +10 -30
  65. package/dist/esm/google/protobuf/struct_pb.js +10 -30
  66. package/dist/esm/google/protobuf/timestamp_pb.js +10 -30
  67. package/dist/esm/google/protobuf/type_pb.js +10 -30
  68. package/dist/esm/google/protobuf/wrappers_pb.js +10 -39
  69. package/dist/esm/{private/goog-varint.js → google/varint.js} +0 -0
  70. package/dist/esm/index.js +14 -0
  71. package/dist/esm/json-format.js +13 -0
  72. package/dist/esm/message-type.js +13 -0
  73. package/dist/esm/message.js +18 -6
  74. package/dist/esm/private/assert.js +13 -0
  75. package/dist/esm/private/binary-format-common.js +13 -0
  76. package/dist/esm/private/binary-format-proto2.js +13 -0
  77. package/dist/esm/private/binary-format-proto3.js +13 -0
  78. package/dist/esm/private/enum.js +37 -0
  79. package/dist/esm/private/field-list.js +13 -0
  80. package/dist/esm/private/field-wrapper.js +13 -0
  81. package/dist/esm/private/field.js +13 -0
  82. package/dist/esm/private/json-format-common.js +16 -3
  83. package/dist/esm/private/json-format-proto2.js +13 -0
  84. package/dist/esm/private/json-format-proto3.js +13 -0
  85. package/dist/esm/private/message-type.js +13 -0
  86. package/dist/esm/private/names.js +13 -0
  87. package/dist/esm/private/options-map.js +13 -0
  88. package/dist/esm/private/proto-runtime.js +15 -1
  89. package/dist/esm/private/scalars.js +13 -0
  90. package/dist/esm/private/util-common.js +16 -3
  91. package/dist/esm/private/util.js +13 -0
  92. package/dist/esm/proto-base64.js +135 -0
  93. package/dist/esm/proto-int64.js +14 -1
  94. package/dist/esm/proto2.js +13 -0
  95. package/dist/esm/proto3.js +13 -0
  96. package/dist/esm/service-type.js +13 -0
  97. package/dist/esm/type-registry.js +13 -0
  98. package/dist/types/google/protobuf/any_pb.d.ts +3 -3
  99. package/dist/types/google/protobuf/descriptor_pb.d.ts +16 -3
  100. package/dist/types/{private/goog-varint.d.ts → google/varint.d.ts} +0 -0
  101. package/dist/types/index.d.ts +2 -1
  102. package/dist/types/json-format.d.ts +1 -1
  103. package/dist/types/message-type.d.ts +4 -3
  104. package/dist/types/message.d.ts +16 -15
  105. package/dist/types/private/enum.d.ts +9 -0
  106. package/dist/types/private/field-wrapper.d.ts +3 -3
  107. package/dist/types/private/message-type.d.ts +12 -2
  108. package/dist/types/private/proto-runtime.d.ts +18 -13
  109. package/dist/types/private/util.d.ts +4 -4
  110. package/dist/types/proto-base64.d.ts +26 -0
  111. package/dist/types/service-type.d.ts +7 -7
  112. package/package.json +3 -4
  113. package/dist/cjs/private/base64.js +0 -119
  114. package/dist/esm/private/base64.js +0 -114
  115. package/dist/types/private/base64.d.ts +0 -18
@@ -1,37 +1,17 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
4
- // @generated from file google/protobuf/field_mask.proto (package google.protobuf, syntax proto3)
2
+ // Copyright 2021-2022 Buf Technologies, Inc.
5
3
  //
6
- // Protocol Buffers - Google's data interchange format
7
- // Copyright 2008 Google Inc. All rights reserved.
8
- // https://developers.google.com/protocol-buffers/
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
9
7
  //
10
- // Redistribution and use in source and binary forms, with or without
11
- // modification, are permitted provided that the following conditions are
12
- // met:
8
+ // http://www.apache.org/licenses/LICENSE-2.0
13
9
  //
14
- // * Redistributions of source code must retain the above copyright
15
- // notice, this list of conditions and the following disclaimer.
16
- // * Redistributions in binary form must reproduce the above
17
- // copyright notice, this list of conditions and the following disclaimer
18
- // in the documentation and/or other materials provided with the
19
- // distribution.
20
- // * Neither the name of Google Inc. nor the names of its
21
- // contributors may be used to endorse or promote products derived from
22
- // this software without specific prior written permission.
23
- //
24
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.
35
15
  Object.defineProperty(exports, "__esModule", { value: true });
36
16
  exports.FieldMask = void 0;
37
17
  const index_js_1 = require("../../index.js");
@@ -1,37 +1,17 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
4
- // @generated from file google/protobuf/source_context.proto (package google.protobuf, syntax proto3)
2
+ // Copyright 2021-2022 Buf Technologies, Inc.
5
3
  //
6
- // Protocol Buffers - Google's data interchange format
7
- // Copyright 2008 Google Inc. All rights reserved.
8
- // https://developers.google.com/protocol-buffers/
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
9
7
  //
10
- // Redistribution and use in source and binary forms, with or without
11
- // modification, are permitted provided that the following conditions are
12
- // met:
8
+ // http://www.apache.org/licenses/LICENSE-2.0
13
9
  //
14
- // * Redistributions of source code must retain the above copyright
15
- // notice, this list of conditions and the following disclaimer.
16
- // * Redistributions in binary form must reproduce the above
17
- // copyright notice, this list of conditions and the following disclaimer
18
- // in the documentation and/or other materials provided with the
19
- // distribution.
20
- // * Neither the name of Google Inc. nor the names of its
21
- // contributors may be used to endorse or promote products derived from
22
- // this software without specific prior written permission.
23
- //
24
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.
35
15
  Object.defineProperty(exports, "__esModule", { value: true });
36
16
  exports.SourceContext = void 0;
37
17
  const index_js_1 = require("../../index.js");
@@ -1,37 +1,17 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
4
- // @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
2
+ // Copyright 2021-2022 Buf Technologies, Inc.
5
3
  //
6
- // Protocol Buffers - Google's data interchange format
7
- // Copyright 2008 Google Inc. All rights reserved.
8
- // https://developers.google.com/protocol-buffers/
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
9
7
  //
10
- // Redistribution and use in source and binary forms, with or without
11
- // modification, are permitted provided that the following conditions are
12
- // met:
8
+ // http://www.apache.org/licenses/LICENSE-2.0
13
9
  //
14
- // * Redistributions of source code must retain the above copyright
15
- // notice, this list of conditions and the following disclaimer.
16
- // * Redistributions in binary form must reproduce the above
17
- // copyright notice, this list of conditions and the following disclaimer
18
- // in the documentation and/or other materials provided with the
19
- // distribution.
20
- // * Neither the name of Google Inc. nor the names of its
21
- // contributors may be used to endorse or promote products derived from
22
- // this software without specific prior written permission.
23
- //
24
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.
35
15
  Object.defineProperty(exports, "__esModule", { value: true });
36
16
  exports.ListValue = exports.Value = exports.Struct = exports.NullValue = void 0;
37
17
  const index_js_1 = require("../../index.js");
@@ -1,37 +1,17 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
4
- // @generated from file google/protobuf/timestamp.proto (package google.protobuf, syntax proto3)
2
+ // Copyright 2021-2022 Buf Technologies, Inc.
5
3
  //
6
- // Protocol Buffers - Google's data interchange format
7
- // Copyright 2008 Google Inc. All rights reserved.
8
- // https://developers.google.com/protocol-buffers/
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
9
7
  //
10
- // Redistribution and use in source and binary forms, with or without
11
- // modification, are permitted provided that the following conditions are
12
- // met:
8
+ // http://www.apache.org/licenses/LICENSE-2.0
13
9
  //
14
- // * Redistributions of source code must retain the above copyright
15
- // notice, this list of conditions and the following disclaimer.
16
- // * Redistributions in binary form must reproduce the above
17
- // copyright notice, this list of conditions and the following disclaimer
18
- // in the documentation and/or other materials provided with the
19
- // distribution.
20
- // * Neither the name of Google Inc. nor the names of its
21
- // contributors may be used to endorse or promote products derived from
22
- // this software without specific prior written permission.
23
- //
24
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.
35
15
  Object.defineProperty(exports, "__esModule", { value: true });
36
16
  exports.Timestamp = void 0;
37
17
  const index_js_1 = require("../../index.js");
@@ -1,37 +1,17 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
4
- // @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
2
+ // Copyright 2021-2022 Buf Technologies, Inc.
5
3
  //
6
- // Protocol Buffers - Google's data interchange format
7
- // Copyright 2008 Google Inc. All rights reserved.
8
- // https://developers.google.com/protocol-buffers/
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
9
7
  //
10
- // Redistribution and use in source and binary forms, with or without
11
- // modification, are permitted provided that the following conditions are
12
- // met:
8
+ // http://www.apache.org/licenses/LICENSE-2.0
13
9
  //
14
- // * Redistributions of source code must retain the above copyright
15
- // notice, this list of conditions and the following disclaimer.
16
- // * Redistributions in binary form must reproduce the above
17
- // copyright notice, this list of conditions and the following disclaimer
18
- // in the documentation and/or other materials provided with the
19
- // distribution.
20
- // * Neither the name of Google Inc. nor the names of its
21
- // contributors may be used to endorse or promote products derived from
22
- // this software without specific prior written permission.
23
- //
24
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.
35
15
  Object.defineProperty(exports, "__esModule", { value: true });
36
16
  exports.Option = exports.EnumValue = exports.Enum = exports.Field_Cardinality = exports.Field_Kind = exports.Field = exports.Type = exports.Syntax = void 0;
37
17
  const index_js_1 = require("../../index.js");
@@ -1,46 +1,17 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
- // @generated by protoc-gen-es v0.0.1 with parameter "bootstrap_wkt=true,ts_nocheck=false"
4
- // @generated from file google/protobuf/wrappers.proto (package google.protobuf, syntax proto3)
2
+ // Copyright 2021-2022 Buf Technologies, Inc.
5
3
  //
6
- // Protocol Buffers - Google's data interchange format
7
- // Copyright 2008 Google Inc. All rights reserved.
8
- // https://developers.google.com/protocol-buffers/
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
9
7
  //
10
- // Redistribution and use in source and binary forms, with or without
11
- // modification, are permitted provided that the following conditions are
12
- // met:
8
+ // http://www.apache.org/licenses/LICENSE-2.0
13
9
  //
14
- // * Redistributions of source code must retain the above copyright
15
- // notice, this list of conditions and the following disclaimer.
16
- // * Redistributions in binary form must reproduce the above
17
- // copyright notice, this list of conditions and the following disclaimer
18
- // in the documentation and/or other materials provided with the
19
- // distribution.
20
- // * Neither the name of Google Inc. nor the names of its
21
- // contributors may be used to endorse or promote products derived from
22
- // this software without specific prior written permission.
23
- //
24
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
- // Wrappers for primitive (non-message) types. These types are useful
36
- // for embedding primitives in the `google.protobuf.Any` type and for places
37
- // where we need to distinguish between the absence of a primitive
38
- // typed field and its default value.
39
- //
40
- // These wrappers have no meaningful use within repeated fields as they lack
41
- // the ability to detect presence on individual elements.
42
- // These wrappers have no meaningful use within a map or a oneof since
43
- // individual entries of a map or fields of a oneof can already detect presence.
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.
44
15
  Object.defineProperty(exports, "__esModule", { value: true });
45
16
  exports.BytesValue = exports.StringValue = exports.BoolValue = exports.UInt32Value = exports.Int32Value = exports.UInt64Value = exports.Int64Value = exports.FloatValue = exports.DoubleValue = void 0;
46
17
  const index_js_1 = require("../../index.js");
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,24 @@
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
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
16
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
5
22
  }) : (function(o, m, k, k2) {
6
23
  if (k2 === undefined) k2 = k;
7
24
  o[k2] = m[k];
@@ -10,13 +27,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
27
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
28
  };
12
29
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.BinaryReader = exports.BinaryWriter = exports.WireType = exports.DescriptorSet = exports.DescriptorRegistry = exports.TypeRegistry = exports.MethodIdempotency = exports.MethodKind = exports.ScalarType = exports.Message = exports.protoInt64 = exports.proto2 = exports.proto3 = void 0;
30
+ exports.BinaryReader = exports.BinaryWriter = exports.WireType = exports.DescriptorSet = exports.DescriptorRegistry = exports.TypeRegistry = exports.MethodIdempotency = exports.MethodKind = exports.ScalarType = exports.Message = exports.protoBase64 = exports.protoInt64 = exports.proto2 = exports.proto3 = void 0;
14
31
  var proto3_js_1 = require("./proto3.js");
15
32
  Object.defineProperty(exports, "proto3", { enumerable: true, get: function () { return proto3_js_1.proto3; } });
16
33
  var proto2_js_1 = require("./proto2.js");
17
34
  Object.defineProperty(exports, "proto2", { enumerable: true, get: function () { return proto2_js_1.proto2; } });
18
35
  var proto_int64_js_1 = require("./proto-int64.js");
19
36
  Object.defineProperty(exports, "protoInt64", { enumerable: true, get: function () { return proto_int64_js_1.protoInt64; } });
37
+ var proto_base64_js_1 = require("./proto-base64.js");
38
+ Object.defineProperty(exports, "protoBase64", { enumerable: true, get: function () { return proto_base64_js_1.protoBase64; } });
20
39
  var message_js_1 = require("./message.js");
21
40
  Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return message_js_1.Message; } });
22
41
  var field_js_1 = require("./field.js");
@@ -1,2 +1,15 @@
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 });
@@ -1,2 +1,15 @@
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 });
@@ -1,26 +1,38 @@
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.Message = void 0;
4
17
  /**
5
- * Every message - generated or created at runtime - is an instance of this
6
- * class.
18
+ * Message is the base class of every message, generated, or created at
19
+ * runtime.
7
20
  *
8
- * It is unsafe to extend this class. If you want to create a message at run
9
- * time, use proto3.makeMessageType().
21
+ * It is _not_ safe to extend this class. If you want to create a message at
22
+ * run time, use proto3.makeMessageType().
10
23
  */
11
24
  class Message {
12
- // TODO find better name to prevent field name conflicts?
13
25
  /**
14
26
  * Compare with a message of the same type.
15
27
  */
16
28
  equals(other) {
17
29
  return this.getType().runtime.util.equals(this.getType(), this, other);
18
30
  }
19
- // TODO find better name to prevent field name conflicts?
20
31
  /**
21
32
  * Create a deep copy.
22
33
  */
23
34
  clone() {
35
+ // return this.getType().runtime.util.clone(this);
24
36
  return this.getType().runtime.util.clone(this);
25
37
  }
26
38
  /**
@@ -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.assertFloat32 = exports.assertUInt32 = exports.assertInt32 = exports.assert = void 0;
4
17
  /**
@@ -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.writePacked = exports.writeScalar = exports.writeMessageField = exports.writeMapEntry = exports.makeBinaryFormatCommon = void 0;
4
17
  const binary_encoding_js_1 = require("../binary-encoding.js");
@@ -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.makeBinaryFormatProto2 = void 0;
4
17
  const field_js_1 = require("../field.js");
@@ -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.makeBinaryFormatProto3 = void 0;
4
17
  const field_js_1 = require("../field.js");
@@ -1,6 +1,19 @@
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
- exports.makeEnumType = exports.setEnumType = exports.getEnumType = void 0;
16
+ exports.makeEnum = exports.makeEnumType = exports.setEnumType = exports.getEnumType = void 0;
4
17
  const assert_js_1 = require("./assert.js");
5
18
  const enumTypeSymbol = Symbol("@bufbuild/protobuf/enum-type");
6
19
  /**
@@ -63,3 +76,28 @@ function makeEnumType(typeName, values
63
76
  };
64
77
  }
65
78
  exports.makeEnumType = makeEnumType;
79
+ /**
80
+ * Create a new enum object with the given values.
81
+ */
82
+ function makeEnum(typeName, values, opt) {
83
+ const enumObject = {};
84
+ for (const value of values) {
85
+ const name = makeEnumValueName(value, opt?.sharedPrefix);
86
+ enumObject[name] = value.no;
87
+ enumObject[value.no] = name;
88
+ }
89
+ setEnumType(enumObject, typeName, values);
90
+ return enumObject;
91
+ }
92
+ exports.makeEnum = makeEnum;
93
+ // Construct a local name for an enum value.
94
+ // This logic matches the Go function with the same name in private/protoplugin/names.go
95
+ function makeEnumValueName(value, sharedPrefix) {
96
+ if (sharedPrefix === undefined) {
97
+ return value.name;
98
+ }
99
+ if (!value.name.startsWith(sharedPrefix)) {
100
+ return value.name;
101
+ }
102
+ return value.name.substring(sharedPrefix.length);
103
+ }
@@ -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.InternalFieldList = void 0;
4
17
  class InternalFieldList {
@@ -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.unwrapField = exports.wrapField = void 0;
4
17
  /**
@@ -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.InternalOneofInfo = void 0;
4
17
  const names_js_1 = require("./names.js");