@bufbuild/protobuf 0.0.2-alpha.2 → 0.0.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 +5 -2
- package/dist/cjs/descriptor-registry.js +13 -0
- package/dist/cjs/google/protobuf/any_pb.js +19 -39
- package/dist/cjs/google/protobuf/api_pb.js +28 -48
- package/dist/cjs/google/protobuf/compiler/plugin_pb.js +32 -67
- package/dist/cjs/google/protobuf/descriptor_pb.js +161 -187
- package/dist/cjs/google/protobuf/duration_pb.js +21 -41
- package/dist/cjs/google/protobuf/empty_pb.js +16 -36
- package/dist/cjs/google/protobuf/field_mask_pb.js +17 -37
- package/dist/cjs/google/protobuf/source_context_pb.js +16 -36
- package/dist/cjs/google/protobuf/struct_pb.js +31 -51
- package/dist/cjs/google/protobuf/timestamp_pb.js +20 -40
- package/dist/cjs/google/protobuf/type_pb.js +43 -63
- package/dist/cjs/google/protobuf/wrappers_pb.js +76 -105
- package/dist/cjs/index-runtime.js +42 -0
- package/dist/cjs/index-wkt.js +42 -0
- package/dist/cjs/index.js +4 -38
- package/dist/cjs/private/json-format-common.js +3 -3
- package/dist/cjs/private/util-common.js +1 -1
- package/dist/cjs/proto-base64.js +138 -0
- package/dist/esm/descriptor-registry.js +13 -0
- package/dist/esm/google/protobuf/any_pb.js +14 -34
- package/dist/esm/google/protobuf/api_pb.js +11 -31
- package/dist/esm/google/protobuf/compiler/plugin_pb.js +11 -46
- package/dist/esm/google/protobuf/descriptor_pb.js +14 -40
- package/dist/esm/google/protobuf/duration_pb.js +11 -31
- package/dist/esm/google/protobuf/empty_pb.js +11 -31
- package/dist/esm/google/protobuf/field_mask_pb.js +11 -31
- package/dist/esm/google/protobuf/source_context_pb.js +11 -31
- package/dist/esm/google/protobuf/struct_pb.js +11 -31
- package/dist/esm/google/protobuf/timestamp_pb.js +11 -31
- package/dist/esm/google/protobuf/type_pb.js +11 -31
- package/dist/esm/google/protobuf/wrappers_pb.js +11 -40
- package/dist/esm/index-runtime.js +25 -0
- package/dist/esm/index-wkt.js +26 -0
- package/dist/esm/index.js +4 -24
- package/dist/esm/private/json-format-common.js +3 -3
- package/dist/esm/private/util-common.js +1 -1
- package/dist/esm/proto-base64.js +135 -0
- package/dist/types/descriptor-registry.d.ts +7 -0
- package/dist/types/google/protobuf/any_pb.d.ts +5 -5
- package/dist/types/google/protobuf/api_pb.d.ts +2 -2
- package/dist/types/google/protobuf/compiler/plugin_pb.d.ts +2 -2
- package/dist/types/google/protobuf/descriptor_pb.d.ts +18 -5
- package/dist/types/google/protobuf/duration_pb.d.ts +2 -2
- package/dist/types/google/protobuf/empty_pb.d.ts +2 -2
- package/dist/types/google/protobuf/field_mask_pb.d.ts +2 -2
- package/dist/types/google/protobuf/source_context_pb.d.ts +2 -2
- package/dist/types/google/protobuf/struct_pb.d.ts +2 -2
- package/dist/types/google/protobuf/timestamp_pb.d.ts +2 -2
- package/dist/types/google/protobuf/type_pb.d.ts +2 -2
- package/dist/types/google/protobuf/wrappers_pb.d.ts +2 -2
- package/dist/types/index-runtime.d.ts +19 -0
- package/dist/types/index-wkt.d.ts +12 -0
- package/dist/types/index.d.ts +2 -30
- package/dist/types/message-type.d.ts +2 -1
- package/dist/types/message.d.ts +4 -6
- package/dist/types/private/util.d.ts +2 -2
- package/dist/types/proto-base64.d.ts +26 -0
- package/package.json +3 -2
- package/dist/cjs/private/base64.js +0 -132
- package/dist/esm/private/base64.js +0 -127
- package/dist/types/private/base64.d.ts +0 -18
|
@@ -1,37 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
// @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
3
|
-
// @generated from file google/protobuf/source_context.proto (package google.protobuf, syntax proto3)
|
|
1
|
+
// Copyright 2021-2022 Buf Technologies, Inc.
|
|
4
2
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
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
|
|
8
6
|
//
|
|
9
|
-
//
|
|
10
|
-
// modification, are permitted provided that the following conditions are
|
|
11
|
-
// met:
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
12
8
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
// * Neither the name of Google Inc. nor the names of its
|
|
20
|
-
// contributors may be used to endorse or promote products derived from
|
|
21
|
-
// this software without specific prior written permission.
|
|
22
|
-
//
|
|
23
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
24
|
-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
25
|
-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
26
|
-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
27
|
-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
28
|
-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
30
|
-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
31
|
-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
32
|
-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
-
import { Message, proto3 } from "../../index.js";
|
|
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
|
+
import { Message, proto3 } from "../../index-runtime.js";
|
|
35
15
|
/**
|
|
36
16
|
* `SourceContext` represents information about the source of a
|
|
37
17
|
* protobuf element, like the file in which it is defined.
|
|
@@ -1,37 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
// @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
3
|
-
// @generated from file google/protobuf/struct.proto (package google.protobuf, syntax proto3)
|
|
1
|
+
// Copyright 2021-2022 Buf Technologies, Inc.
|
|
4
2
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
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
|
|
8
6
|
//
|
|
9
|
-
//
|
|
10
|
-
// modification, are permitted provided that the following conditions are
|
|
11
|
-
// met:
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
12
8
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
// * Neither the name of Google Inc. nor the names of its
|
|
20
|
-
// contributors may be used to endorse or promote products derived from
|
|
21
|
-
// this software without specific prior written permission.
|
|
22
|
-
//
|
|
23
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
24
|
-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
25
|
-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
26
|
-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
27
|
-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
28
|
-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
30
|
-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
31
|
-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
32
|
-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
-
import { Message, proto3 } from "../../index.js";
|
|
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
|
+
import { Message, proto3 } from "../../index-runtime.js";
|
|
35
15
|
/**
|
|
36
16
|
* `NullValue` is a singleton enumeration to represent the null value for the
|
|
37
17
|
* `Value` type union.
|
|
@@ -1,37 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
// @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
3
|
-
// @generated from file google/protobuf/timestamp.proto (package google.protobuf, syntax proto3)
|
|
1
|
+
// Copyright 2021-2022 Buf Technologies, Inc.
|
|
4
2
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
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
|
|
8
6
|
//
|
|
9
|
-
//
|
|
10
|
-
// modification, are permitted provided that the following conditions are
|
|
11
|
-
// met:
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
12
8
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
// * Neither the name of Google Inc. nor the names of its
|
|
20
|
-
// contributors may be used to endorse or promote products derived from
|
|
21
|
-
// this software without specific prior written permission.
|
|
22
|
-
//
|
|
23
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
24
|
-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
25
|
-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
26
|
-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
27
|
-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
28
|
-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
30
|
-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
31
|
-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
32
|
-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
-
import { Message, proto3, protoInt64 } from "../../index.js";
|
|
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
|
+
import { Message, proto3, protoInt64 } from "../../index-runtime.js";
|
|
35
15
|
/**
|
|
36
16
|
* A Timestamp represents a point in time independent of any time zone or local
|
|
37
17
|
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
@@ -1,37 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
// @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
3
|
-
// @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)
|
|
1
|
+
// Copyright 2021-2022 Buf Technologies, Inc.
|
|
4
2
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
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
|
|
8
6
|
//
|
|
9
|
-
//
|
|
10
|
-
// modification, are permitted provided that the following conditions are
|
|
11
|
-
// met:
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
12
8
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
// * Neither the name of Google Inc. nor the names of its
|
|
20
|
-
// contributors may be used to endorse or promote products derived from
|
|
21
|
-
// this software without specific prior written permission.
|
|
22
|
-
//
|
|
23
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
24
|
-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
25
|
-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
26
|
-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
27
|
-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
28
|
-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
30
|
-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
31
|
-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
32
|
-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
-
import { Message, proto3 } from "../../index.js";
|
|
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
|
+
import { Message, proto3 } from "../../index-runtime.js";
|
|
35
15
|
import { SourceContext } from "./source_context_pb.js";
|
|
36
16
|
import { Any } from "./any_pb.js";
|
|
37
17
|
/**
|
|
@@ -1,46 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
// @generated by protoc-gen-es v0.0.2-alpha.2 with parameter "bootstrap_wkt=true,ts_nocheck=false,target=ts"
|
|
3
|
-
// @generated from file google/protobuf/wrappers.proto (package google.protobuf, syntax proto3)
|
|
1
|
+
// Copyright 2021-2022 Buf Technologies, Inc.
|
|
4
2
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
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
|
|
8
6
|
//
|
|
9
|
-
//
|
|
10
|
-
// modification, are permitted provided that the following conditions are
|
|
11
|
-
// met:
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
12
8
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
// * Neither the name of Google Inc. nor the names of its
|
|
20
|
-
// contributors may be used to endorse or promote products derived from
|
|
21
|
-
// this software without specific prior written permission.
|
|
22
|
-
//
|
|
23
|
-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
24
|
-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
25
|
-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
26
|
-
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
27
|
-
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
28
|
-
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
-
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
30
|
-
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
31
|
-
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
32
|
-
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
|
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
-
// Wrappers for primitive (non-message) types. These types are useful
|
|
35
|
-
// for embedding primitives in the `google.protobuf.Any` type and for places
|
|
36
|
-
// where we need to distinguish between the absence of a primitive
|
|
37
|
-
// typed field and its default value.
|
|
38
|
-
//
|
|
39
|
-
// These wrappers have no meaningful use within repeated fields as they lack
|
|
40
|
-
// the ability to detect presence on individual elements.
|
|
41
|
-
// These wrappers have no meaningful use within a map or a oneof since
|
|
42
|
-
// individual entries of a map or fields of a oneof can already detect presence.
|
|
43
|
-
import { Message, ScalarType, proto3, protoInt64 } from "../../index.js";
|
|
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
|
+
import { Message, ScalarType, proto3, protoInt64 } from "../../index-runtime.js";
|
|
44
15
|
/**
|
|
45
16
|
* Wrapper message for `double`.
|
|
46
17
|
*
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright 2021-2022 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 { proto3 } from "./proto3.js";
|
|
15
|
+
export { proto2 } from "./proto2.js";
|
|
16
|
+
export { protoInt64 } from "./proto-int64.js";
|
|
17
|
+
export { protoBase64 } from "./proto-base64.js";
|
|
18
|
+
export { Message, } from "./message.js";
|
|
19
|
+
export { ScalarType } from "./field.js";
|
|
20
|
+
export { MethodKind, MethodIdempotency } from "./service-type.js";
|
|
21
|
+
export { TypeRegistry } from "./type-registry.js";
|
|
22
|
+
export { DescriptorRegistry } from "./descriptor-registry.js";
|
|
23
|
+
export { DescriptorSet } from "./descriptor-set.js";
|
|
24
|
+
export { WireType, BinaryWriter, BinaryReader } from "./binary-encoding.js";
|
|
25
|
+
export {} from "./json-format.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright 2021-2022 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
|
+
// ideally, we would export these types with sub-path exports:
|
|
15
|
+
export * from "./google/protobuf/compiler/plugin_pb.js";
|
|
16
|
+
export * from "./google/protobuf/api_pb.js";
|
|
17
|
+
export * from "./google/protobuf/any_pb.js";
|
|
18
|
+
export * from "./google/protobuf/descriptor_pb.js";
|
|
19
|
+
export * from "./google/protobuf/duration_pb.js";
|
|
20
|
+
export * from "./google/protobuf/empty_pb.js";
|
|
21
|
+
export * from "./google/protobuf/field_mask_pb.js";
|
|
22
|
+
export * from "./google/protobuf/source_context_pb.js";
|
|
23
|
+
export * from "./google/protobuf/struct_pb.js";
|
|
24
|
+
export * from "./google/protobuf/timestamp_pb.js";
|
|
25
|
+
export * from "./google/protobuf/type_pb.js";
|
|
26
|
+
export * from "./google/protobuf/wrappers_pb.js";
|
package/dist/esm/index.js
CHANGED
|
@@ -11,27 +11,7 @@
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export { ScalarType } from "./field.js";
|
|
19
|
-
export { MethodKind, MethodIdempotency } from "./service-type.js";
|
|
20
|
-
export { TypeRegistry } from "./type-registry.js";
|
|
21
|
-
export { DescriptorRegistry } from "./descriptor-registry.js";
|
|
22
|
-
export { DescriptorSet } from "./descriptor-set.js";
|
|
23
|
-
export { WireType, BinaryWriter, BinaryReader } from "./binary-encoding.js";
|
|
24
|
-
export {} from "./json-format.js";
|
|
25
|
-
// ideally, we would export these types with sub-path exports:
|
|
26
|
-
export * from "./google/protobuf/compiler/plugin_pb.js";
|
|
27
|
-
export * from "./google/protobuf/api_pb.js";
|
|
28
|
-
export * from "./google/protobuf/any_pb.js";
|
|
29
|
-
export * from "./google/protobuf/descriptor_pb.js";
|
|
30
|
-
export * from "./google/protobuf/duration_pb.js";
|
|
31
|
-
export * from "./google/protobuf/empty_pb.js";
|
|
32
|
-
export * from "./google/protobuf/field_mask_pb.js";
|
|
33
|
-
export * from "./google/protobuf/source_context_pb.js";
|
|
34
|
-
export * from "./google/protobuf/struct_pb.js";
|
|
35
|
-
export * from "./google/protobuf/timestamp_pb.js";
|
|
36
|
-
export * from "./google/protobuf/type_pb.js";
|
|
37
|
-
export * from "./google/protobuf/wrappers_pb.js";
|
|
14
|
+
// To avoid circular imports when the wkt import from ./index.js, we
|
|
15
|
+
// use a separate ./index-runtime.js
|
|
16
|
+
export * from "./index-runtime.js";
|
|
17
|
+
export * from "./index-wkt.js";
|
|
@@ -15,7 +15,7 @@ import { unwrapField, wrapField } from "./field-wrapper.js";
|
|
|
15
15
|
import { ScalarType } from "../field.js";
|
|
16
16
|
import { assert, assertFloat32, assertInt32, assertUInt32 } from "./assert.js";
|
|
17
17
|
import { protoInt64 } from "../proto-int64.js";
|
|
18
|
-
import {
|
|
18
|
+
import { protoBase64 } from "../proto-base64.js";
|
|
19
19
|
/* 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 */
|
|
20
20
|
// Default options for parsing JSON.
|
|
21
21
|
const jsonReadDefaults = {
|
|
@@ -363,7 +363,7 @@ function readScalar(type, json) {
|
|
|
363
363
|
return new Uint8Array(0);
|
|
364
364
|
if (typeof json !== "string")
|
|
365
365
|
break;
|
|
366
|
-
return
|
|
366
|
+
return protoBase64.dec(json);
|
|
367
367
|
}
|
|
368
368
|
throw new Error();
|
|
369
369
|
}
|
|
@@ -459,7 +459,7 @@ function writeScalar(type, value, emitIntrinsicDefault) {
|
|
|
459
459
|
case ScalarType.BYTES:
|
|
460
460
|
assert(value instanceof Uint8Array);
|
|
461
461
|
return emitIntrinsicDefault || value.byteLength > 0
|
|
462
|
-
?
|
|
462
|
+
? protoBase64.enc(value)
|
|
463
463
|
: undefined;
|
|
464
464
|
}
|
|
465
465
|
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// Copyright 2021-2022 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
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unnecessary-condition, prefer-const */
|
|
15
|
+
// lookup table from base64 character to byte
|
|
16
|
+
let encTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
|
|
17
|
+
// lookup table from base64 character *code* to byte because lookup by number is fast
|
|
18
|
+
let decTable = [];
|
|
19
|
+
for (let i = 0; i < encTable.length; i++)
|
|
20
|
+
decTable[encTable[i].charCodeAt(0)] = i;
|
|
21
|
+
// support base64url variants
|
|
22
|
+
decTable["-".charCodeAt(0)] = encTable.indexOf("+");
|
|
23
|
+
decTable["_".charCodeAt(0)] = encTable.indexOf("/");
|
|
24
|
+
export const protoBase64 = {
|
|
25
|
+
/**
|
|
26
|
+
* Decodes a base64 string to a byte array.
|
|
27
|
+
*
|
|
28
|
+
* - ignores white-space, including line breaks and tabs
|
|
29
|
+
* - allows inner padding (can decode concatenated base64 strings)
|
|
30
|
+
* - does not require padding
|
|
31
|
+
* - understands base64url encoding:
|
|
32
|
+
* "-" instead of "+",
|
|
33
|
+
* "_" instead of "/",
|
|
34
|
+
* no padding
|
|
35
|
+
*/
|
|
36
|
+
dec(base64Str) {
|
|
37
|
+
// estimate byte size, not accounting for inner padding and whitespace
|
|
38
|
+
let es = (base64Str.length * 3) / 4;
|
|
39
|
+
// if (es % 3 !== 0)
|
|
40
|
+
// throw new Error("invalid base64 string");
|
|
41
|
+
if (base64Str[base64Str.length - 2] == "=")
|
|
42
|
+
es -= 2;
|
|
43
|
+
else if (base64Str[base64Str.length - 1] == "=")
|
|
44
|
+
es -= 1;
|
|
45
|
+
let bytes = new Uint8Array(es), bytePos = 0, // position in byte array
|
|
46
|
+
groupPos = 0, // position in base64 group
|
|
47
|
+
b, // current byte
|
|
48
|
+
p = 0; // previous byte
|
|
49
|
+
for (let i = 0; i < base64Str.length; i++) {
|
|
50
|
+
b = decTable[base64Str.charCodeAt(i)];
|
|
51
|
+
if (b === undefined) {
|
|
52
|
+
switch (base64Str[i]) {
|
|
53
|
+
// @ts-ignore TS7029: Fallthrough case in switch
|
|
54
|
+
case "=":
|
|
55
|
+
groupPos = 0; // reset state when padding found
|
|
56
|
+
// @ts-ignore TS7029: Fallthrough case in switch
|
|
57
|
+
case "\n":
|
|
58
|
+
case "\r":
|
|
59
|
+
case "\t":
|
|
60
|
+
case " ":
|
|
61
|
+
continue; // skip white-space, and padding
|
|
62
|
+
default:
|
|
63
|
+
throw Error("invalid base64 string.");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
switch (groupPos) {
|
|
67
|
+
case 0:
|
|
68
|
+
p = b;
|
|
69
|
+
groupPos = 1;
|
|
70
|
+
break;
|
|
71
|
+
case 1:
|
|
72
|
+
bytes[bytePos++] = (p << 2) | ((b & 48) >> 4);
|
|
73
|
+
p = b;
|
|
74
|
+
groupPos = 2;
|
|
75
|
+
break;
|
|
76
|
+
case 2:
|
|
77
|
+
bytes[bytePos++] = ((p & 15) << 4) | ((b & 60) >> 2);
|
|
78
|
+
p = b;
|
|
79
|
+
groupPos = 3;
|
|
80
|
+
break;
|
|
81
|
+
case 3:
|
|
82
|
+
bytes[bytePos++] = ((p & 3) << 6) | b;
|
|
83
|
+
groupPos = 0;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (groupPos == 1)
|
|
88
|
+
throw Error("invalid base64 string.");
|
|
89
|
+
return bytes.subarray(0, bytePos);
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* Decodes a base64 string to a byte array.
|
|
93
|
+
*
|
|
94
|
+
* - ignores white-space, including line breaks and tabs
|
|
95
|
+
* - allows inner padding (can decode concatenated base64 strings)
|
|
96
|
+
* - does not require padding
|
|
97
|
+
* - understands base64url encoding:
|
|
98
|
+
* "-" instead of "+",
|
|
99
|
+
* "_" instead of "/",
|
|
100
|
+
* no padding
|
|
101
|
+
*/
|
|
102
|
+
enc(bytes) {
|
|
103
|
+
let base64 = "", groupPos = 0, // position in base64 group
|
|
104
|
+
b, // current byte
|
|
105
|
+
p = 0; // carry over from previous byte
|
|
106
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
107
|
+
b = bytes[i];
|
|
108
|
+
switch (groupPos) {
|
|
109
|
+
case 0:
|
|
110
|
+
base64 += encTable[b >> 2];
|
|
111
|
+
p = (b & 3) << 4;
|
|
112
|
+
groupPos = 1;
|
|
113
|
+
break;
|
|
114
|
+
case 1:
|
|
115
|
+
base64 += encTable[p | (b >> 4)];
|
|
116
|
+
p = (b & 15) << 2;
|
|
117
|
+
groupPos = 2;
|
|
118
|
+
break;
|
|
119
|
+
case 2:
|
|
120
|
+
base64 += encTable[p | (b >> 6)];
|
|
121
|
+
base64 += encTable[b & 63];
|
|
122
|
+
groupPos = 0;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// padding required?
|
|
127
|
+
if (groupPos) {
|
|
128
|
+
base64 += encTable[p];
|
|
129
|
+
base64 += "=";
|
|
130
|
+
if (groupPos == 1)
|
|
131
|
+
base64 += "=";
|
|
132
|
+
}
|
|
133
|
+
return base64;
|
|
134
|
+
},
|
|
135
|
+
};
|
|
@@ -4,6 +4,8 @@ import type { EnumType } from "./enum.js";
|
|
|
4
4
|
import { DescriptorSet } from "./descriptor-set.js";
|
|
5
5
|
import type { IEnumTypeRegistry, IMessageTypeRegistry, IServiceTypeRegistry } from "./type-registry.js";
|
|
6
6
|
import type { ServiceType } from "./service-type.js";
|
|
7
|
+
import { FileDescriptorSet } from "./google/protobuf/descriptor_pb.js";
|
|
8
|
+
import type { PartialMessage } from "./message.js";
|
|
7
9
|
/**
|
|
8
10
|
* DescriptorRegistry is a type registry that dynamically creates types
|
|
9
11
|
* from a set of google.protobuf.FileDescriptorProto.
|
|
@@ -17,6 +19,11 @@ export declare class DescriptorRegistry implements IMessageTypeRegistry, IEnumTy
|
|
|
17
19
|
private readonly messages;
|
|
18
20
|
private readonly services;
|
|
19
21
|
constructor(descriptorSet?: DescriptorSet, replaceWkt?: boolean);
|
|
22
|
+
/**
|
|
23
|
+
* Conveniently create a DescriptorRegistry from a FileDescriptorSet
|
|
24
|
+
* instance or a FileDescriptorSet in binary format.
|
|
25
|
+
*/
|
|
26
|
+
static fromFileDescriptorSet(bytesOrSet: Uint8Array | FileDescriptorSet | PartialMessage<FileDescriptorSet>): DescriptorRegistry;
|
|
20
27
|
/**
|
|
21
28
|
* May raise an error on invalid descriptors.
|
|
22
29
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, JsonWriteOptions, MessageType, PartialMessage, PlainMessage } from "../../index.js";
|
|
2
|
-
import { Message } from "../../index.js";
|
|
1
|
+
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, JsonWriteOptions, MessageType, PartialMessage, PlainMessage } from "../../index-runtime.js";
|
|
2
|
+
import { Message } from "../../index-runtime.js";
|
|
3
3
|
/**
|
|
4
4
|
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
5
5
|
* URL that describes the type of the serialized message.
|
|
@@ -26,7 +26,7 @@ import { Message } from "../../index.js";
|
|
|
26
26
|
* foo = any.unpack(Foo.class);
|
|
27
27
|
* }
|
|
28
28
|
*
|
|
29
|
-
*
|
|
29
|
+
* Example 3: Pack and unpack a message in Python.
|
|
30
30
|
*
|
|
31
31
|
* foo = Foo(...)
|
|
32
32
|
* any = Any()
|
|
@@ -36,7 +36,7 @@ import { Message } from "../../index.js";
|
|
|
36
36
|
* any.Unpack(foo)
|
|
37
37
|
* ...
|
|
38
38
|
*
|
|
39
|
-
*
|
|
39
|
+
* Example 4: Pack and unpack a message in Go
|
|
40
40
|
*
|
|
41
41
|
* foo := &pb.Foo{...}
|
|
42
42
|
* any, err := anypb.New(foo)
|
|
@@ -57,7 +57,7 @@ import { Message } from "../../index.js";
|
|
|
57
57
|
*
|
|
58
58
|
*
|
|
59
59
|
* JSON
|
|
60
|
-
*
|
|
60
|
+
*
|
|
61
61
|
* The JSON representation of an `Any` value uses the regular
|
|
62
62
|
* representation of the deserialized, embedded message, with an
|
|
63
63
|
* additional field `@type` which contains the type URL. Example:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "../../index.js";
|
|
2
|
-
import { Message } from "../../index.js";
|
|
1
|
+
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "../../index-runtime.js";
|
|
2
|
+
import { Message } from "../../index-runtime.js";
|
|
3
3
|
import { Option, Syntax } from "./type_pb.js";
|
|
4
4
|
import { SourceContext } from "./source_context_pb.js";
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "../../../index.js";
|
|
2
|
-
import { Message } from "../../../index.js";
|
|
1
|
+
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "../../../index-runtime.js";
|
|
2
|
+
import { Message } from "../../../index-runtime.js";
|
|
3
3
|
import { FileDescriptorProto, GeneratedCodeInfo } from "../descriptor_pb.js";
|
|
4
4
|
/**
|
|
5
5
|
* The version number of protocol compiler.
|