@milaboratories/pl-client 2.16.8 → 2.16.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__external/.pnpm/{@rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.7.0_typescript@5.6.3 → @rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3}/__external/tslib/tslib.es6.cjs +2 -2
- package/dist/__external/.pnpm/{@rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.7.0_typescript@5.6.3 → @rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3}/__external/tslib/tslib.es6.cjs.map +1 -1
- package/dist/__external/.pnpm/{@rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.7.0_typescript@5.6.3 → @rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3}/__external/tslib/tslib.es6.js +2 -2
- package/dist/__external/.pnpm/{@rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.7.0_typescript@5.6.3 → @rollup_plugin-typescript@12.1.4_rollup@4.52.4_tslib@2.8.1_typescript@5.6.3}/__external/tslib/tslib.es6.js.map +1 -1
- package/dist/core/abstract_stream.d.ts +18 -0
- package/dist/core/abstract_stream.d.ts.map +1 -0
- package/dist/core/client.cjs +6 -6
- package/dist/core/client.cjs.map +1 -1
- package/dist/core/client.d.ts +3 -3
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +6 -6
- package/dist/core/client.js.map +1 -1
- package/dist/core/config.cjs +3 -0
- package/dist/core/config.cjs.map +1 -1
- package/dist/core/config.d.ts +4 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +3 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/driver.cjs +11 -0
- package/dist/core/driver.cjs.map +1 -1
- package/dist/core/driver.d.ts +8 -2
- package/dist/core/driver.d.ts.map +1 -1
- package/dist/core/driver.js +11 -1
- package/dist/core/driver.js.map +1 -1
- package/dist/core/errors.cjs +9 -0
- package/dist/core/errors.cjs.map +1 -1
- package/dist/core/errors.d.ts +1 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +9 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/ll_client.cjs +194 -39
- package/dist/core/ll_client.cjs.map +1 -1
- package/dist/core/ll_client.d.ts +36 -15
- package/dist/core/ll_client.d.ts.map +1 -1
- package/dist/core/ll_client.js +195 -40
- package/dist/core/ll_client.js.map +1 -1
- package/dist/core/ll_transaction.cjs.map +1 -1
- package/dist/core/ll_transaction.d.ts +3 -3
- package/dist/core/ll_transaction.d.ts.map +1 -1
- package/dist/core/ll_transaction.js.map +1 -1
- package/dist/core/transaction.cjs +2 -2
- package/dist/core/transaction.cjs.map +1 -1
- package/dist/core/transaction.js +2 -2
- package/dist/core/transaction.js.map +1 -1
- package/dist/core/type_conversion.cjs +2 -2
- package/dist/core/type_conversion.cjs.map +1 -1
- package/dist/core/type_conversion.d.ts +2 -2
- package/dist/core/type_conversion.d.ts.map +1 -1
- package/dist/core/type_conversion.js +2 -2
- package/dist/core/type_conversion.js.map +1 -1
- package/dist/core/unauth_client.cjs +4 -8
- package/dist/core/unauth_client.cjs.map +1 -1
- package/dist/core/unauth_client.d.ts +1 -1
- package/dist/core/unauth_client.d.ts.map +1 -1
- package/dist/core/unauth_client.js +4 -8
- package/dist/core/unauth_client.js.map +1 -1
- package/dist/core/wire.d.ts +34 -0
- package/dist/core/wire.d.ts.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.cjs.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/googleapis/googleapis/google/rpc/status.d.ts +4 -2
- package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/googleapis/googleapis/google/rpc/status.js.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.cjs +25 -25
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.client.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.js +25 -25
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api_types.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/base_types.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/ws-test.d.ts +73 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/ws-test.d.ts.map +1 -0
- package/dist/{proto → proto-grpc}/google/api/http.d.ts +28 -32
- package/dist/proto-grpc/google/api/http.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/any.cjs.map +1 -0
- package/dist/proto-grpc/google/protobuf/any.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/any.js.map +1 -0
- package/dist/{proto → proto-grpc}/google/protobuf/descriptor.d.ts +6 -152
- package/dist/proto-grpc/google/protobuf/descriptor.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/duration.cjs.map +1 -0
- package/dist/proto-grpc/google/protobuf/duration.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/duration.js.map +1 -0
- package/dist/proto-grpc/google/protobuf/empty.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/struct.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/timestamp.cjs.map +1 -0
- package/dist/proto-grpc/google/protobuf/timestamp.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/timestamp.js.map +1 -0
- package/dist/{proto → proto-grpc}/google/protobuf/wrappers.d.ts +0 -27
- package/dist/proto-grpc/google/protobuf/wrappers.d.ts.map +1 -0
- package/dist/proto-grpc/google/rpc/code.cjs +240 -0
- package/dist/proto-grpc/google/rpc/code.cjs.map +1 -0
- package/dist/proto-grpc/google/rpc/code.d.ts +219 -0
- package/dist/proto-grpc/google/rpc/code.d.ts.map +1 -0
- package/dist/proto-grpc/google/rpc/code.js +240 -0
- package/dist/proto-grpc/google/rpc/code.js.map +1 -0
- package/dist/proto-grpc/google/rpc/error_details.d.ts +654 -0
- package/dist/proto-grpc/google/rpc/error_details.d.ts.map +1 -0
- package/dist/proto-grpc/google/rpc/http.d.ts +121 -0
- package/dist/proto-grpc/google/rpc/http.d.ts.map +1 -0
- package/dist/proto-grpc/google/rpc/status.d.ts +55 -0
- package/dist/proto-grpc/google/rpc/status.d.ts.map +1 -0
- package/dist/proto-rest/index.cjs +64 -0
- package/dist/proto-rest/index.cjs.map +1 -0
- package/dist/proto-rest/index.d.ts +23 -0
- package/dist/proto-rest/index.d.ts.map +1 -0
- package/dist/proto-rest/index.js +61 -0
- package/dist/proto-rest/index.js.map +1 -0
- package/dist/proto-rest/plapi.d.ts +1488 -0
- package/dist/proto-rest/plapi.d.ts.map +1 -0
- package/package.json +8 -5
- package/src/core/abstract_stream.ts +25 -0
- package/src/core/client.ts +8 -8
- package/src/core/config.ts +9 -0
- package/src/core/driver.ts +13 -2
- package/src/core/errors.ts +7 -1
- package/src/core/ll_client.test.ts +1 -1
- package/src/core/ll_client.ts +212 -42
- package/src/core/ll_transaction.test.ts +1 -1
- package/src/core/ll_transaction.ts +4 -4
- package/src/core/transaction.ts +1 -1
- package/src/core/type_conversion.ts +3 -3
- package/src/core/unauth_client.test.ts +6 -0
- package/src/core/unauth_client.ts +8 -12
- package/src/core/wire.ts +40 -0
- package/src/index.ts +3 -1
- package/src/{proto → proto-grpc}/github.com/googleapis/googleapis/google/rpc/status.ts +5 -3
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.ts +25 -25
- package/src/proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/ws-test.ts +209 -0
- package/src/{proto → proto-grpc}/google/api/http.ts +29 -33
- package/src/{proto → proto-grpc}/google/protobuf/descriptor.ts +11 -221
- package/src/{proto → proto-grpc}/google/protobuf/wrappers.ts +4 -38
- package/src/proto-grpc/google/rpc/code.ts +236 -0
- package/src/proto-grpc/google/rpc/error_details.ts +1386 -0
- package/src/proto-grpc/google/rpc/http.ts +307 -0
- package/src/proto-grpc/google/rpc/status.ts +127 -0
- package/src/proto-rest/index.ts +83 -0
- package/src/proto-rest/plapi.ts +1488 -0
- package/dist/core/grpc.d.ts +0 -16
- package/dist/core/grpc.d.ts.map +0 -1
- package/dist/core/http.d.ts +0 -2
- package/dist/core/http.d.ts.map +0 -1
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.cjs.map +0 -1
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +0 -1
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +0 -40
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +0 -116
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +0 -46
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +0 -170
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +0 -51
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +0 -176
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +0 -131
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +0 -320
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js.map +0 -1
- package/dist/proto/google/api/http.d.ts.map +0 -1
- package/dist/proto/google/protobuf/any.cjs.map +0 -1
- package/dist/proto/google/protobuf/any.d.ts.map +0 -1
- package/dist/proto/google/protobuf/any.js.map +0 -1
- package/dist/proto/google/protobuf/descriptor.d.ts.map +0 -1
- package/dist/proto/google/protobuf/duration.cjs.map +0 -1
- package/dist/proto/google/protobuf/duration.d.ts.map +0 -1
- package/dist/proto/google/protobuf/duration.js.map +0 -1
- package/dist/proto/google/protobuf/empty.d.ts.map +0 -1
- package/dist/proto/google/protobuf/struct.d.ts.map +0 -1
- package/dist/proto/google/protobuf/timestamp.cjs.map +0 -1
- package/dist/proto/google/protobuf/timestamp.d.ts.map +0 -1
- package/dist/proto/google/protobuf/timestamp.js.map +0 -1
- package/dist/proto/google/protobuf/wrappers.d.ts.map +0 -1
- package/src/core/grpc.ts +0 -17
- package/src/core/http.ts +0 -178
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.ts +0 -45
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.ts +0 -313
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +0 -51
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +0 -406
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.ts +0 -59
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.ts +0 -489
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +0 -148
- package/src/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +0 -719
- /package/dist/{proto → proto-grpc}/github.com/googleapis/googleapis/google/rpc/status.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/googleapis/googleapis/google/rpc/status.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.client.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.client.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api_types.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api_types.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/base_types.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/base_types.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/resource_types.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/resource_types.js +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/any.cjs +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/any.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/any.js +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/duration.cjs +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/duration.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/duration.js +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/empty.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/struct.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/timestamp.cjs +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/timestamp.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/timestamp.js +0 -0
- /package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +0 -0
- /package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +0 -0
- /package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +0 -0
- /package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/import.ts +0 -0
- /package/src/{proto → proto-grpc}/github.com/milaboratory/pl/plapi/plapiproto/resource_types.ts +0 -0
- /package/src/{proto → proto-grpc}/google/protobuf/any.ts +0 -0
- /package/src/{proto → proto-grpc}/google/protobuf/duration.ts +0 -0
- /package/src/{proto → proto-grpc}/google/protobuf/empty.ts +0 -0
- /package/src/{proto → proto-grpc}/google/protobuf/struct.ts +0 -0
- /package/src/{proto → proto-grpc}/google/protobuf/timestamp.ts +0 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
// @generated by protobuf-ts 2.11.1 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
|
|
2
|
+
// @generated from protobuf file "google/rpc/http.proto" (package "google.rpc", syntax proto3)
|
|
3
|
+
// tslint:disable
|
|
4
|
+
//
|
|
5
|
+
// Copyright 2025 Google LLC
|
|
6
|
+
//
|
|
7
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
// you may not use this file except in compliance with the License.
|
|
9
|
+
// You may obtain a copy of the License at
|
|
10
|
+
//
|
|
11
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
//
|
|
13
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
// See the License for the specific language governing permissions and
|
|
17
|
+
// limitations under the License.
|
|
18
|
+
//
|
|
19
|
+
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
20
|
+
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
21
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
22
|
+
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
23
|
+
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
24
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
25
|
+
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
26
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
27
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
28
|
+
/**
|
|
29
|
+
* Represents an HTTP request.
|
|
30
|
+
*
|
|
31
|
+
* @generated from protobuf message google.rpc.HttpRequest
|
|
32
|
+
*/
|
|
33
|
+
export interface HttpRequest {
|
|
34
|
+
/**
|
|
35
|
+
* The HTTP request method.
|
|
36
|
+
*
|
|
37
|
+
* @generated from protobuf field: string method = 1
|
|
38
|
+
*/
|
|
39
|
+
method: string;
|
|
40
|
+
/**
|
|
41
|
+
* The HTTP request URI.
|
|
42
|
+
*
|
|
43
|
+
* @generated from protobuf field: string uri = 2
|
|
44
|
+
*/
|
|
45
|
+
uri: string;
|
|
46
|
+
/**
|
|
47
|
+
* The HTTP request headers. The ordering of the headers is significant.
|
|
48
|
+
* Multiple headers with the same key may present for the request.
|
|
49
|
+
*
|
|
50
|
+
* @generated from protobuf field: repeated google.rpc.HttpHeader headers = 3
|
|
51
|
+
*/
|
|
52
|
+
headers: HttpHeader[];
|
|
53
|
+
/**
|
|
54
|
+
* The HTTP request body. If the body is not expected, it should be empty.
|
|
55
|
+
*
|
|
56
|
+
* @generated from protobuf field: bytes body = 4
|
|
57
|
+
*/
|
|
58
|
+
body: Uint8Array;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Represents an HTTP response.
|
|
62
|
+
*
|
|
63
|
+
* @generated from protobuf message google.rpc.HttpResponse
|
|
64
|
+
*/
|
|
65
|
+
export interface HttpResponse {
|
|
66
|
+
/**
|
|
67
|
+
* The HTTP status code, such as 200 or 404.
|
|
68
|
+
*
|
|
69
|
+
* @generated from protobuf field: int32 status = 1
|
|
70
|
+
*/
|
|
71
|
+
status: number;
|
|
72
|
+
/**
|
|
73
|
+
* The HTTP reason phrase, such as "OK" or "Not Found".
|
|
74
|
+
*
|
|
75
|
+
* @generated from protobuf field: string reason = 2
|
|
76
|
+
*/
|
|
77
|
+
reason: string;
|
|
78
|
+
/**
|
|
79
|
+
* The HTTP response headers. The ordering of the headers is significant.
|
|
80
|
+
* Multiple headers with the same key may present for the response.
|
|
81
|
+
*
|
|
82
|
+
* @generated from protobuf field: repeated google.rpc.HttpHeader headers = 3
|
|
83
|
+
*/
|
|
84
|
+
headers: HttpHeader[];
|
|
85
|
+
/**
|
|
86
|
+
* The HTTP response body. If the body is not expected, it should be empty.
|
|
87
|
+
*
|
|
88
|
+
* @generated from protobuf field: bytes body = 4
|
|
89
|
+
*/
|
|
90
|
+
body: Uint8Array;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Represents an HTTP header.
|
|
94
|
+
*
|
|
95
|
+
* @generated from protobuf message google.rpc.HttpHeader
|
|
96
|
+
*/
|
|
97
|
+
export interface HttpHeader {
|
|
98
|
+
/**
|
|
99
|
+
* The HTTP header key. It is case insensitive.
|
|
100
|
+
*
|
|
101
|
+
* @generated from protobuf field: string key = 1
|
|
102
|
+
*/
|
|
103
|
+
key: string;
|
|
104
|
+
/**
|
|
105
|
+
* The HTTP header value.
|
|
106
|
+
*
|
|
107
|
+
* @generated from protobuf field: string value = 2
|
|
108
|
+
*/
|
|
109
|
+
value: string;
|
|
110
|
+
}
|
|
111
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
112
|
+
class HttpRequest$Type extends MessageType<HttpRequest> {
|
|
113
|
+
constructor() {
|
|
114
|
+
super("google.rpc.HttpRequest", [
|
|
115
|
+
{ no: 1, name: "method", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
116
|
+
{ no: 2, name: "uri", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
117
|
+
{ no: 3, name: "headers", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => HttpHeader },
|
|
118
|
+
{ no: 4, name: "body", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
create(value?: PartialMessage<HttpRequest>): HttpRequest {
|
|
122
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
123
|
+
message.method = "";
|
|
124
|
+
message.uri = "";
|
|
125
|
+
message.headers = [];
|
|
126
|
+
message.body = new Uint8Array(0);
|
|
127
|
+
if (value !== undefined)
|
|
128
|
+
reflectionMergePartial<HttpRequest>(this, message, value);
|
|
129
|
+
return message;
|
|
130
|
+
}
|
|
131
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: HttpRequest): HttpRequest {
|
|
132
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
133
|
+
while (reader.pos < end) {
|
|
134
|
+
let [fieldNo, wireType] = reader.tag();
|
|
135
|
+
switch (fieldNo) {
|
|
136
|
+
case /* string method */ 1:
|
|
137
|
+
message.method = reader.string();
|
|
138
|
+
break;
|
|
139
|
+
case /* string uri */ 2:
|
|
140
|
+
message.uri = reader.string();
|
|
141
|
+
break;
|
|
142
|
+
case /* repeated google.rpc.HttpHeader headers */ 3:
|
|
143
|
+
message.headers.push(HttpHeader.internalBinaryRead(reader, reader.uint32(), options));
|
|
144
|
+
break;
|
|
145
|
+
case /* bytes body */ 4:
|
|
146
|
+
message.body = reader.bytes();
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
let u = options.readUnknownField;
|
|
150
|
+
if (u === "throw")
|
|
151
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
152
|
+
let d = reader.skip(wireType);
|
|
153
|
+
if (u !== false)
|
|
154
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return message;
|
|
158
|
+
}
|
|
159
|
+
internalBinaryWrite(message: HttpRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
160
|
+
/* string method = 1; */
|
|
161
|
+
if (message.method !== "")
|
|
162
|
+
writer.tag(1, WireType.LengthDelimited).string(message.method);
|
|
163
|
+
/* string uri = 2; */
|
|
164
|
+
if (message.uri !== "")
|
|
165
|
+
writer.tag(2, WireType.LengthDelimited).string(message.uri);
|
|
166
|
+
/* repeated google.rpc.HttpHeader headers = 3; */
|
|
167
|
+
for (let i = 0; i < message.headers.length; i++)
|
|
168
|
+
HttpHeader.internalBinaryWrite(message.headers[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
|
|
169
|
+
/* bytes body = 4; */
|
|
170
|
+
if (message.body.length)
|
|
171
|
+
writer.tag(4, WireType.LengthDelimited).bytes(message.body);
|
|
172
|
+
let u = options.writeUnknownFields;
|
|
173
|
+
if (u !== false)
|
|
174
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
175
|
+
return writer;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @generated MessageType for protobuf message google.rpc.HttpRequest
|
|
180
|
+
*/
|
|
181
|
+
export const HttpRequest = new HttpRequest$Type();
|
|
182
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
183
|
+
class HttpResponse$Type extends MessageType<HttpResponse> {
|
|
184
|
+
constructor() {
|
|
185
|
+
super("google.rpc.HttpResponse", [
|
|
186
|
+
{ no: 1, name: "status", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
|
187
|
+
{ no: 2, name: "reason", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
188
|
+
{ no: 3, name: "headers", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => HttpHeader },
|
|
189
|
+
{ no: 4, name: "body", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
190
|
+
]);
|
|
191
|
+
}
|
|
192
|
+
create(value?: PartialMessage<HttpResponse>): HttpResponse {
|
|
193
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
194
|
+
message.status = 0;
|
|
195
|
+
message.reason = "";
|
|
196
|
+
message.headers = [];
|
|
197
|
+
message.body = new Uint8Array(0);
|
|
198
|
+
if (value !== undefined)
|
|
199
|
+
reflectionMergePartial<HttpResponse>(this, message, value);
|
|
200
|
+
return message;
|
|
201
|
+
}
|
|
202
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: HttpResponse): HttpResponse {
|
|
203
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
204
|
+
while (reader.pos < end) {
|
|
205
|
+
let [fieldNo, wireType] = reader.tag();
|
|
206
|
+
switch (fieldNo) {
|
|
207
|
+
case /* int32 status */ 1:
|
|
208
|
+
message.status = reader.int32();
|
|
209
|
+
break;
|
|
210
|
+
case /* string reason */ 2:
|
|
211
|
+
message.reason = reader.string();
|
|
212
|
+
break;
|
|
213
|
+
case /* repeated google.rpc.HttpHeader headers */ 3:
|
|
214
|
+
message.headers.push(HttpHeader.internalBinaryRead(reader, reader.uint32(), options));
|
|
215
|
+
break;
|
|
216
|
+
case /* bytes body */ 4:
|
|
217
|
+
message.body = reader.bytes();
|
|
218
|
+
break;
|
|
219
|
+
default:
|
|
220
|
+
let u = options.readUnknownField;
|
|
221
|
+
if (u === "throw")
|
|
222
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
223
|
+
let d = reader.skip(wireType);
|
|
224
|
+
if (u !== false)
|
|
225
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return message;
|
|
229
|
+
}
|
|
230
|
+
internalBinaryWrite(message: HttpResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
231
|
+
/* int32 status = 1; */
|
|
232
|
+
if (message.status !== 0)
|
|
233
|
+
writer.tag(1, WireType.Varint).int32(message.status);
|
|
234
|
+
/* string reason = 2; */
|
|
235
|
+
if (message.reason !== "")
|
|
236
|
+
writer.tag(2, WireType.LengthDelimited).string(message.reason);
|
|
237
|
+
/* repeated google.rpc.HttpHeader headers = 3; */
|
|
238
|
+
for (let i = 0; i < message.headers.length; i++)
|
|
239
|
+
HttpHeader.internalBinaryWrite(message.headers[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
|
|
240
|
+
/* bytes body = 4; */
|
|
241
|
+
if (message.body.length)
|
|
242
|
+
writer.tag(4, WireType.LengthDelimited).bytes(message.body);
|
|
243
|
+
let u = options.writeUnknownFields;
|
|
244
|
+
if (u !== false)
|
|
245
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
246
|
+
return writer;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* @generated MessageType for protobuf message google.rpc.HttpResponse
|
|
251
|
+
*/
|
|
252
|
+
export const HttpResponse = new HttpResponse$Type();
|
|
253
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
254
|
+
class HttpHeader$Type extends MessageType<HttpHeader> {
|
|
255
|
+
constructor() {
|
|
256
|
+
super("google.rpc.HttpHeader", [
|
|
257
|
+
{ no: 1, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
258
|
+
{ no: 2, name: "value", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
|
259
|
+
]);
|
|
260
|
+
}
|
|
261
|
+
create(value?: PartialMessage<HttpHeader>): HttpHeader {
|
|
262
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
263
|
+
message.key = "";
|
|
264
|
+
message.value = "";
|
|
265
|
+
if (value !== undefined)
|
|
266
|
+
reflectionMergePartial<HttpHeader>(this, message, value);
|
|
267
|
+
return message;
|
|
268
|
+
}
|
|
269
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: HttpHeader): HttpHeader {
|
|
270
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
271
|
+
while (reader.pos < end) {
|
|
272
|
+
let [fieldNo, wireType] = reader.tag();
|
|
273
|
+
switch (fieldNo) {
|
|
274
|
+
case /* string key */ 1:
|
|
275
|
+
message.key = reader.string();
|
|
276
|
+
break;
|
|
277
|
+
case /* string value */ 2:
|
|
278
|
+
message.value = reader.string();
|
|
279
|
+
break;
|
|
280
|
+
default:
|
|
281
|
+
let u = options.readUnknownField;
|
|
282
|
+
if (u === "throw")
|
|
283
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
284
|
+
let d = reader.skip(wireType);
|
|
285
|
+
if (u !== false)
|
|
286
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return message;
|
|
290
|
+
}
|
|
291
|
+
internalBinaryWrite(message: HttpHeader, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
292
|
+
/* string key = 1; */
|
|
293
|
+
if (message.key !== "")
|
|
294
|
+
writer.tag(1, WireType.LengthDelimited).string(message.key);
|
|
295
|
+
/* string value = 2; */
|
|
296
|
+
if (message.value !== "")
|
|
297
|
+
writer.tag(2, WireType.LengthDelimited).string(message.value);
|
|
298
|
+
let u = options.writeUnknownFields;
|
|
299
|
+
if (u !== false)
|
|
300
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
301
|
+
return writer;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* @generated MessageType for protobuf message google.rpc.HttpHeader
|
|
306
|
+
*/
|
|
307
|
+
export const HttpHeader = new HttpHeader$Type();
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// @generated by protobuf-ts 2.11.1 with parameter client_generic,optimize_speed,generate_dependencies,force_server_none
|
|
2
|
+
// @generated from protobuf file "google/rpc/status.proto" (package "google.rpc", syntax proto3)
|
|
3
|
+
// tslint:disable
|
|
4
|
+
//
|
|
5
|
+
// Copyright 2025 Google LLC
|
|
6
|
+
//
|
|
7
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
// you may not use this file except in compliance with the License.
|
|
9
|
+
// You may obtain a copy of the License at
|
|
10
|
+
//
|
|
11
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
//
|
|
13
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
// See the License for the specific language governing permissions and
|
|
17
|
+
// limitations under the License.
|
|
18
|
+
//
|
|
19
|
+
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
20
|
+
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
21
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
22
|
+
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
23
|
+
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
24
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
25
|
+
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
26
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
27
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
28
|
+
import { Any } from "../protobuf/any";
|
|
29
|
+
/**
|
|
30
|
+
* The `Status` type defines a logical error model that is suitable for
|
|
31
|
+
* different programming environments, including REST APIs and RPC APIs. It is
|
|
32
|
+
* used by [gRPC](https://github.com/grpc). Each `Status` message contains
|
|
33
|
+
* three pieces of data: error code, error message, and error details.
|
|
34
|
+
*
|
|
35
|
+
* You can find out more about this error model and how to work with it in the
|
|
36
|
+
* [API Design Guide](https://cloud.google.com/apis/design/errors).
|
|
37
|
+
*
|
|
38
|
+
* @generated from protobuf message google.rpc.Status
|
|
39
|
+
*/
|
|
40
|
+
export interface Status {
|
|
41
|
+
/**
|
|
42
|
+
* The status code, which should be an enum value of
|
|
43
|
+
* [google.rpc.Code][google.rpc.Code].
|
|
44
|
+
*
|
|
45
|
+
* @generated from protobuf field: int32 code = 1
|
|
46
|
+
*/
|
|
47
|
+
code: number;
|
|
48
|
+
/**
|
|
49
|
+
* A developer-facing error message, which should be in English. Any
|
|
50
|
+
* user-facing error message should be localized and sent in the
|
|
51
|
+
* [google.rpc.Status.details][google.rpc.Status.details] field, or localized
|
|
52
|
+
* by the client.
|
|
53
|
+
*
|
|
54
|
+
* @generated from protobuf field: string message = 2
|
|
55
|
+
*/
|
|
56
|
+
message: string;
|
|
57
|
+
/**
|
|
58
|
+
* A list of messages that carry the error details. There is a common set of
|
|
59
|
+
* message types for APIs to use.
|
|
60
|
+
*
|
|
61
|
+
* @generated from protobuf field: repeated google.protobuf.Any details = 3
|
|
62
|
+
*/
|
|
63
|
+
details: Any[];
|
|
64
|
+
}
|
|
65
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
66
|
+
class Status$Type extends MessageType<Status> {
|
|
67
|
+
constructor() {
|
|
68
|
+
super("google.rpc.Status", [
|
|
69
|
+
{ no: 1, name: "code", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
|
70
|
+
{ no: 2, name: "message", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
71
|
+
{ no: 3, name: "details", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => Any }
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
create(value?: PartialMessage<Status>): Status {
|
|
75
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
76
|
+
message.code = 0;
|
|
77
|
+
message.message = "";
|
|
78
|
+
message.details = [];
|
|
79
|
+
if (value !== undefined)
|
|
80
|
+
reflectionMergePartial<Status>(this, message, value);
|
|
81
|
+
return message;
|
|
82
|
+
}
|
|
83
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Status): Status {
|
|
84
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
85
|
+
while (reader.pos < end) {
|
|
86
|
+
let [fieldNo, wireType] = reader.tag();
|
|
87
|
+
switch (fieldNo) {
|
|
88
|
+
case /* int32 code */ 1:
|
|
89
|
+
message.code = reader.int32();
|
|
90
|
+
break;
|
|
91
|
+
case /* string message */ 2:
|
|
92
|
+
message.message = reader.string();
|
|
93
|
+
break;
|
|
94
|
+
case /* repeated google.protobuf.Any details */ 3:
|
|
95
|
+
message.details.push(Any.internalBinaryRead(reader, reader.uint32(), options));
|
|
96
|
+
break;
|
|
97
|
+
default:
|
|
98
|
+
let u = options.readUnknownField;
|
|
99
|
+
if (u === "throw")
|
|
100
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
101
|
+
let d = reader.skip(wireType);
|
|
102
|
+
if (u !== false)
|
|
103
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return message;
|
|
107
|
+
}
|
|
108
|
+
internalBinaryWrite(message: Status, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
109
|
+
/* int32 code = 1; */
|
|
110
|
+
if (message.code !== 0)
|
|
111
|
+
writer.tag(1, WireType.Varint).int32(message.code);
|
|
112
|
+
/* string message = 2; */
|
|
113
|
+
if (message.message !== "")
|
|
114
|
+
writer.tag(2, WireType.LengthDelimited).string(message.message);
|
|
115
|
+
/* repeated google.protobuf.Any details = 3; */
|
|
116
|
+
for (let i = 0; i < message.details.length; i++)
|
|
117
|
+
Any.internalBinaryWrite(message.details[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
|
|
118
|
+
let u = options.writeUnknownFields;
|
|
119
|
+
if (u !== false)
|
|
120
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
121
|
+
return writer;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @generated MessageType for protobuf message google.rpc.Status
|
|
126
|
+
*/
|
|
127
|
+
export const Status = new Status$Type();
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//
|
|
2
|
+
// This file is NOT autogenerated!
|
|
3
|
+
//
|
|
4
|
+
// After generating new clients from openapi specifications, add client types here.
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
import type { paths as PlApiPaths } from './plapi';
|
|
8
|
+
import { default as createOpenApiClient, type Middleware, type Client } from 'openapi-fetch';
|
|
9
|
+
import { Dispatcher, fetch as undiciFetch } from 'undici';
|
|
10
|
+
import { rethrowMeaningfulError } from '../core/errors';
|
|
11
|
+
import { Code } from '../proto-grpc/google/rpc/code';
|
|
12
|
+
|
|
13
|
+
export { PlApiPaths };
|
|
14
|
+
export type PlRestClientType = Client<PlApiPaths>;
|
|
15
|
+
|
|
16
|
+
export type RestClientConfig = {
|
|
17
|
+
hostAndPort: string;
|
|
18
|
+
ssl: boolean;
|
|
19
|
+
dispatcher: Dispatcher;
|
|
20
|
+
middlewares: Middleware[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function createClient<Paths extends {}>(opts: RestClientConfig): Client<Paths> {
|
|
24
|
+
const scheme = opts.ssl ? 'https://' : 'http://';
|
|
25
|
+
const client = createOpenApiClient<Paths>({
|
|
26
|
+
baseUrl: `${scheme}${opts.hostAndPort}`,
|
|
27
|
+
fetch: (input: Request): Promise<Response> => {
|
|
28
|
+
return undiciFetch(input.url, {
|
|
29
|
+
...input,
|
|
30
|
+
dispatcher: opts.dispatcher,
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
client.use(errorHandlerMiddleware(), ...opts.middlewares);
|
|
35
|
+
return client;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type ErrorResponse = {
|
|
39
|
+
code: Code,
|
|
40
|
+
message: string,
|
|
41
|
+
details: any[],
|
|
42
|
+
}
|
|
43
|
+
export async function parseResponseError(response: Response): Promise<{
|
|
44
|
+
error?: ErrorResponse | string,
|
|
45
|
+
origBody?: string,
|
|
46
|
+
}>{
|
|
47
|
+
if (response.status < 400) {
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let error: any = await response.clone().text();
|
|
52
|
+
const origBody = error;
|
|
53
|
+
try {
|
|
54
|
+
error = JSON.parse(error) as ErrorResponse;
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
error: error,
|
|
59
|
+
origBody
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Parses all API responses and thrown error in case of error response.
|
|
65
|
+
* Allows all callers to not bother about .error response field checking.
|
|
66
|
+
*/
|
|
67
|
+
function errorHandlerMiddleware(): Middleware {
|
|
68
|
+
return {
|
|
69
|
+
onResponse: async ({ request: _request, response, options: _options }) => {
|
|
70
|
+
const respErr = await parseResponseError(response);
|
|
71
|
+
if (!respErr.error) {
|
|
72
|
+
const { body, ...resOptions } = response;
|
|
73
|
+
return new Response(body, { ...resOptions, status: response.status });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (typeof respErr.error === 'string') {
|
|
77
|
+
throw new Error(respErr.error);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
rethrowMeaningfulError(respErr.error);
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|