@t-0/provider-sdk 1.1.27 → 1.1.28
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 +0 -3
- package/lib/cjs/service/health.d.ts +1 -1
- package/lib/cjs/service/health.js +1 -5
- package/lib/cjs/service/health_pb.d.ts +157 -0
- package/lib/cjs/service/health_pb.js +87 -0
- package/lib/cjs/service/service.js +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/service/health.d.ts +1 -1
- package/lib/esm/service/health.js +1 -5
- package/lib/esm/service/health_pb.d.ts +157 -0
- package/lib/esm/service/health_pb.js +84 -0
- package/lib/esm/service/service.js +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -14,10 +14,7 @@ See [starter README](../starter/README.md) for details on the generated project.
|
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
-
The SDK depends on `@buf/grpc_grpc.bufbuild_es`, which is published on the Buf Schema Registry, not npmjs. Point the `@buf` scope at BSR before installing (the starter template already ships this `.npmrc`):
|
|
18
|
-
|
|
19
17
|
```bash
|
|
20
|
-
echo '@buf:registry=https://buf.build/gen/npm/v1/' >> .npmrc
|
|
21
18
|
npm install @t-0/provider-sdk
|
|
22
19
|
```
|
|
23
20
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ServiceImpl } from "@connectrpc/connect";
|
|
2
|
-
import { Health } from "
|
|
2
|
+
import { Health } from "./health_pb.js";
|
|
3
3
|
/**
|
|
4
4
|
* Headers carrying the identity of the SDK answering the probe. They ride on
|
|
5
5
|
* the health response and nowhere else: `HealthCheckResponse` has a single
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createHealthServiceImpl = exports.SDK_VERSION_HEADER = exports.SDK_ECOSYSTEM_HEADER = void 0;
|
|
4
4
|
const protobuf_1 = require("@bufbuild/protobuf");
|
|
5
5
|
const connect_1 = require("@connectrpc/connect");
|
|
6
|
-
const health_pb_js_1 = require("
|
|
6
|
+
const health_pb_js_1 = require("./health_pb.js");
|
|
7
7
|
const version_js_1 = require("../version.js");
|
|
8
8
|
/**
|
|
9
9
|
* Headers carrying the identity of the SDK answering the probe. They ride on
|
|
@@ -33,10 +33,6 @@ const createHealthServiceImpl = (services) => {
|
|
|
33
33
|
check(req, ctx) {
|
|
34
34
|
ctx.responseHeader.set(exports.SDK_ECOSYSTEM_HEADER, SDK_ECOSYSTEM);
|
|
35
35
|
ctx.responseHeader.set(exports.SDK_VERSION_HEADER, version_js_1.SDK_VERSION);
|
|
36
|
-
// The schema comes from a published .d.ts, whose type brands do not
|
|
37
|
-
// survive ServiceImpl's generics — connect-es widens the request to
|
|
38
|
-
// Message<string>. The descriptor is still the real one at runtime, so
|
|
39
|
-
// this narrows back to what the wire actually carries.
|
|
40
36
|
const { service } = req;
|
|
41
37
|
// An empty service name asks about the process as a whole, which is up if
|
|
42
38
|
// this handler is running at all.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
3
|
+
/**
|
|
4
|
+
* Describes the file grpc/health/v1/health.proto.
|
|
5
|
+
*/
|
|
6
|
+
export declare const file_grpc_health_v1_health: GenFile;
|
|
7
|
+
/**
|
|
8
|
+
* @generated from message grpc.health.v1.HealthCheckRequest
|
|
9
|
+
*/
|
|
10
|
+
export type HealthCheckRequest = Message<"grpc.health.v1.HealthCheckRequest"> & {
|
|
11
|
+
/**
|
|
12
|
+
* @generated from field: string service = 1;
|
|
13
|
+
*/
|
|
14
|
+
service: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Describes the message grpc.health.v1.HealthCheckRequest.
|
|
18
|
+
* Use `create(HealthCheckRequestSchema)` to create a new message.
|
|
19
|
+
*/
|
|
20
|
+
export declare const HealthCheckRequestSchema: GenMessage<HealthCheckRequest>;
|
|
21
|
+
/**
|
|
22
|
+
* @generated from message grpc.health.v1.HealthCheckResponse
|
|
23
|
+
*/
|
|
24
|
+
export type HealthCheckResponse = Message<"grpc.health.v1.HealthCheckResponse"> & {
|
|
25
|
+
/**
|
|
26
|
+
* @generated from field: grpc.health.v1.HealthCheckResponse.ServingStatus status = 1;
|
|
27
|
+
*/
|
|
28
|
+
status: HealthCheckResponse_ServingStatus;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Describes the message grpc.health.v1.HealthCheckResponse.
|
|
32
|
+
* Use `create(HealthCheckResponseSchema)` to create a new message.
|
|
33
|
+
*/
|
|
34
|
+
export declare const HealthCheckResponseSchema: GenMessage<HealthCheckResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* @generated from enum grpc.health.v1.HealthCheckResponse.ServingStatus
|
|
37
|
+
*/
|
|
38
|
+
export declare enum HealthCheckResponse_ServingStatus {
|
|
39
|
+
/**
|
|
40
|
+
* @generated from enum value: UNKNOWN = 0;
|
|
41
|
+
*/
|
|
42
|
+
UNKNOWN = 0,
|
|
43
|
+
/**
|
|
44
|
+
* @generated from enum value: SERVING = 1;
|
|
45
|
+
*/
|
|
46
|
+
SERVING = 1,
|
|
47
|
+
/**
|
|
48
|
+
* @generated from enum value: NOT_SERVING = 2;
|
|
49
|
+
*/
|
|
50
|
+
NOT_SERVING = 2,
|
|
51
|
+
/**
|
|
52
|
+
* Used only by the Watch method.
|
|
53
|
+
*
|
|
54
|
+
* @generated from enum value: SERVICE_UNKNOWN = 3;
|
|
55
|
+
*/
|
|
56
|
+
SERVICE_UNKNOWN = 3
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Describes the enum grpc.health.v1.HealthCheckResponse.ServingStatus.
|
|
60
|
+
*/
|
|
61
|
+
export declare const HealthCheckResponse_ServingStatusSchema: GenEnum<HealthCheckResponse_ServingStatus>;
|
|
62
|
+
/**
|
|
63
|
+
* @generated from message grpc.health.v1.HealthListRequest
|
|
64
|
+
*/
|
|
65
|
+
export type HealthListRequest = Message<"grpc.health.v1.HealthListRequest"> & {};
|
|
66
|
+
/**
|
|
67
|
+
* Describes the message grpc.health.v1.HealthListRequest.
|
|
68
|
+
* Use `create(HealthListRequestSchema)` to create a new message.
|
|
69
|
+
*/
|
|
70
|
+
export declare const HealthListRequestSchema: GenMessage<HealthListRequest>;
|
|
71
|
+
/**
|
|
72
|
+
* @generated from message grpc.health.v1.HealthListResponse
|
|
73
|
+
*/
|
|
74
|
+
export type HealthListResponse = Message<"grpc.health.v1.HealthListResponse"> & {
|
|
75
|
+
/**
|
|
76
|
+
* statuses contains all the services and their respective status.
|
|
77
|
+
*
|
|
78
|
+
* @generated from field: map<string, grpc.health.v1.HealthCheckResponse> statuses = 1;
|
|
79
|
+
*/
|
|
80
|
+
statuses: {
|
|
81
|
+
[key: string]: HealthCheckResponse;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Describes the message grpc.health.v1.HealthListResponse.
|
|
86
|
+
* Use `create(HealthListResponseSchema)` to create a new message.
|
|
87
|
+
*/
|
|
88
|
+
export declare const HealthListResponseSchema: GenMessage<HealthListResponse>;
|
|
89
|
+
/**
|
|
90
|
+
* Health is gRPC's mechanism for checking whether a server is able to handle
|
|
91
|
+
* RPCs. Its semantics are documented in
|
|
92
|
+
* https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
|
|
93
|
+
*
|
|
94
|
+
* @generated from service grpc.health.v1.Health
|
|
95
|
+
*/
|
|
96
|
+
export declare const Health: GenService<{
|
|
97
|
+
/**
|
|
98
|
+
* Check gets the health of the specified service. If the requested service
|
|
99
|
+
* is unknown, the call will fail with status NOT_FOUND. If the caller does
|
|
100
|
+
* not specify a service name, the server should respond with its overall
|
|
101
|
+
* health status.
|
|
102
|
+
*
|
|
103
|
+
* Clients should set a deadline when calling Check, and can declare the
|
|
104
|
+
* server unhealthy if they do not receive a timely response.
|
|
105
|
+
*
|
|
106
|
+
* @generated from rpc grpc.health.v1.Health.Check
|
|
107
|
+
*/
|
|
108
|
+
check: {
|
|
109
|
+
methodKind: "unary";
|
|
110
|
+
input: typeof HealthCheckRequestSchema;
|
|
111
|
+
output: typeof HealthCheckResponseSchema;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* List provides a non-atomic snapshot of the health of all the available
|
|
115
|
+
* services.
|
|
116
|
+
*
|
|
117
|
+
* The server may respond with a RESOURCE_EXHAUSTED error if too many services
|
|
118
|
+
* exist.
|
|
119
|
+
*
|
|
120
|
+
* Clients should set a deadline when calling List, and can declare the server
|
|
121
|
+
* unhealthy if they do not receive a timely response.
|
|
122
|
+
*
|
|
123
|
+
* Clients should keep in mind that the list of health services exposed by an
|
|
124
|
+
* application can change over the lifetime of the process.
|
|
125
|
+
*
|
|
126
|
+
* @generated from rpc grpc.health.v1.Health.List
|
|
127
|
+
*/
|
|
128
|
+
list: {
|
|
129
|
+
methodKind: "unary";
|
|
130
|
+
input: typeof HealthListRequestSchema;
|
|
131
|
+
output: typeof HealthListResponseSchema;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Performs a watch for the serving status of the requested service.
|
|
135
|
+
* The server will immediately send back a message indicating the current
|
|
136
|
+
* serving status. It will then subsequently send a new message whenever
|
|
137
|
+
* the service's serving status changes.
|
|
138
|
+
*
|
|
139
|
+
* If the requested service is unknown when the call is received, the
|
|
140
|
+
* server will send a message setting the serving status to
|
|
141
|
+
* SERVICE_UNKNOWN but will *not* terminate the call. If at some
|
|
142
|
+
* future point, the serving status of the service becomes known, the
|
|
143
|
+
* server will send a new message with the service's serving status.
|
|
144
|
+
*
|
|
145
|
+
* If the call terminates with status UNIMPLEMENTED, then clients
|
|
146
|
+
* should assume this method is not supported and should not retry the
|
|
147
|
+
* call. If the call terminates with any other status (including OK),
|
|
148
|
+
* clients should retry the call with appropriate exponential backoff.
|
|
149
|
+
*
|
|
150
|
+
* @generated from rpc grpc.health.v1.Health.Watch
|
|
151
|
+
*/
|
|
152
|
+
watch: {
|
|
153
|
+
methodKind: "server_streaming";
|
|
154
|
+
input: typeof HealthCheckRequestSchema;
|
|
155
|
+
output: typeof HealthCheckResponseSchema;
|
|
156
|
+
};
|
|
157
|
+
}>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Vendored generated stubs for grpc.health.v1 -- do not edit by hand.
|
|
3
|
+
//
|
|
4
|
+
// Source: buf.build/grpc/grpc, grpc/health/v1/health.proto
|
|
5
|
+
// Plugin: buf.build/bufbuild/es:v2.12.0 (kept in step with the root
|
|
6
|
+
// buf.gen.yaml pin -- plugin and @bufbuild/protobuf runtime must
|
|
7
|
+
// agree on major).
|
|
8
|
+
//
|
|
9
|
+
// Regenerate by overwriting this file:
|
|
10
|
+
//
|
|
11
|
+
// cd node/sdk
|
|
12
|
+
// buf generate buf.build/grpc/grpc --path grpc/health/v1/health.proto \
|
|
13
|
+
// --template '{"version":"v2","plugins":[{"remote":"buf.build/bufbuild/es:v2.12.0","out":"gen-health","opt":["target=ts","import_extension=js"]}]}'
|
|
14
|
+
// mv gen-health/grpc/health/v1/health_pb.ts src/service/health_pb.ts
|
|
15
|
+
// rm -rf gen-health
|
|
16
|
+
//
|
|
17
|
+
// Vendored rather than depended on: the equivalent package
|
|
18
|
+
// `@buf/grpc_grpc.bufbuild_es` is published only on the Buf Schema Registry, and
|
|
19
|
+
// reaching it needs registry config that a published npm package cannot hand its
|
|
20
|
+
// consumers -- so depending on it 404'd every downstream install. Rationale in
|
|
21
|
+
// docs/HEALTH_SERVICE.md.
|
|
22
|
+
//
|
|
23
|
+
// Lives under src/service/ rather than src/common/gen/ so the transport keeps
|
|
24
|
+
// importing nothing from common/gen.
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Health = exports.HealthListResponseSchema = exports.HealthListRequestSchema = exports.HealthCheckResponse_ServingStatusSchema = exports.HealthCheckResponse_ServingStatus = exports.HealthCheckResponseSchema = exports.HealthCheckRequestSchema = exports.file_grpc_health_v1_health = void 0;
|
|
27
|
+
const codegenv2_1 = require("@bufbuild/protobuf/codegenv2");
|
|
28
|
+
/**
|
|
29
|
+
* Describes the file grpc/health/v1/health.proto.
|
|
30
|
+
*/
|
|
31
|
+
exports.file_grpc_health_v1_health = (0, codegenv2_1.fileDesc)("ChtncnBjL2hlYWx0aC92MS9oZWFsdGgucHJvdG8SDmdycGMuaGVhbHRoLnYxIiUKEkhlYWx0aENoZWNrUmVxdWVzdBIPCgdzZXJ2aWNlGAEgASgJIqkBChNIZWFsdGhDaGVja1Jlc3BvbnNlEkEKBnN0YXR1cxgBIAEoDjIxLmdycGMuaGVhbHRoLnYxLkhlYWx0aENoZWNrUmVzcG9uc2UuU2VydmluZ1N0YXR1cyJPCg1TZXJ2aW5nU3RhdHVzEgsKB1VOS05PV04QABILCgdTRVJWSU5HEAESDwoLTk9UX1NFUlZJTkcQAhITCg9TRVJWSUNFX1VOS05PV04QAyITChFIZWFsdGhMaXN0UmVxdWVzdCKuAQoSSGVhbHRoTGlzdFJlc3BvbnNlEkIKCHN0YXR1c2VzGAEgAygLMjAuZ3JwYy5oZWFsdGgudjEuSGVhbHRoTGlzdFJlc3BvbnNlLlN0YXR1c2VzRW50cnkaVAoNU3RhdHVzZXNFbnRyeRILCgNrZXkYASABKAkSMgoFdmFsdWUYAiABKAsyIy5ncnBjLmhlYWx0aC52MS5IZWFsdGhDaGVja1Jlc3BvbnNlOgI4ATL9AQoGSGVhbHRoElAKBUNoZWNrEiIuZ3JwYy5oZWFsdGgudjEuSGVhbHRoQ2hlY2tSZXF1ZXN0GiMuZ3JwYy5oZWFsdGgudjEuSGVhbHRoQ2hlY2tSZXNwb25zZRJNCgRMaXN0EiEuZ3JwYy5oZWFsdGgudjEuSGVhbHRoTGlzdFJlcXVlc3QaIi5ncnBjLmhlYWx0aC52MS5IZWFsdGhMaXN0UmVzcG9uc2USUgoFV2F0Y2gSIi5ncnBjLmhlYWx0aC52MS5IZWFsdGhDaGVja1JlcXVlc3QaIy5ncnBjLmhlYWx0aC52MS5IZWFsdGhDaGVja1Jlc3BvbnNlMAFCcAoRaW8uZ3JwYy5oZWFsdGgudjFCC0hlYWx0aFByb3RvUAFaLGdvb2dsZS5nb2xhbmcub3JnL2dycGMvaGVhbHRoL2dycGNfaGVhbHRoX3YxogIMR3JwY0hlYWx0aFYxqgIOR3JwYy5IZWFsdGguVjFiBnByb3RvMw");
|
|
32
|
+
/**
|
|
33
|
+
* Describes the message grpc.health.v1.HealthCheckRequest.
|
|
34
|
+
* Use `create(HealthCheckRequestSchema)` to create a new message.
|
|
35
|
+
*/
|
|
36
|
+
exports.HealthCheckRequestSchema = (0, codegenv2_1.messageDesc)(exports.file_grpc_health_v1_health, 0);
|
|
37
|
+
/**
|
|
38
|
+
* Describes the message grpc.health.v1.HealthCheckResponse.
|
|
39
|
+
* Use `create(HealthCheckResponseSchema)` to create a new message.
|
|
40
|
+
*/
|
|
41
|
+
exports.HealthCheckResponseSchema = (0, codegenv2_1.messageDesc)(exports.file_grpc_health_v1_health, 1);
|
|
42
|
+
/**
|
|
43
|
+
* @generated from enum grpc.health.v1.HealthCheckResponse.ServingStatus
|
|
44
|
+
*/
|
|
45
|
+
var HealthCheckResponse_ServingStatus;
|
|
46
|
+
(function (HealthCheckResponse_ServingStatus) {
|
|
47
|
+
/**
|
|
48
|
+
* @generated from enum value: UNKNOWN = 0;
|
|
49
|
+
*/
|
|
50
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["UNKNOWN"] = 0] = "UNKNOWN";
|
|
51
|
+
/**
|
|
52
|
+
* @generated from enum value: SERVING = 1;
|
|
53
|
+
*/
|
|
54
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["SERVING"] = 1] = "SERVING";
|
|
55
|
+
/**
|
|
56
|
+
* @generated from enum value: NOT_SERVING = 2;
|
|
57
|
+
*/
|
|
58
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["NOT_SERVING"] = 2] = "NOT_SERVING";
|
|
59
|
+
/**
|
|
60
|
+
* Used only by the Watch method.
|
|
61
|
+
*
|
|
62
|
+
* @generated from enum value: SERVICE_UNKNOWN = 3;
|
|
63
|
+
*/
|
|
64
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["SERVICE_UNKNOWN"] = 3] = "SERVICE_UNKNOWN";
|
|
65
|
+
})(HealthCheckResponse_ServingStatus || (exports.HealthCheckResponse_ServingStatus = HealthCheckResponse_ServingStatus = {}));
|
|
66
|
+
/**
|
|
67
|
+
* Describes the enum grpc.health.v1.HealthCheckResponse.ServingStatus.
|
|
68
|
+
*/
|
|
69
|
+
exports.HealthCheckResponse_ServingStatusSchema = (0, codegenv2_1.enumDesc)(exports.file_grpc_health_v1_health, 1, 0);
|
|
70
|
+
/**
|
|
71
|
+
* Describes the message grpc.health.v1.HealthListRequest.
|
|
72
|
+
* Use `create(HealthListRequestSchema)` to create a new message.
|
|
73
|
+
*/
|
|
74
|
+
exports.HealthListRequestSchema = (0, codegenv2_1.messageDesc)(exports.file_grpc_health_v1_health, 2);
|
|
75
|
+
/**
|
|
76
|
+
* Describes the message grpc.health.v1.HealthListResponse.
|
|
77
|
+
* Use `create(HealthListResponseSchema)` to create a new message.
|
|
78
|
+
*/
|
|
79
|
+
exports.HealthListResponseSchema = (0, codegenv2_1.messageDesc)(exports.file_grpc_health_v1_health, 3);
|
|
80
|
+
/**
|
|
81
|
+
* Health is gRPC's mechanism for checking whether a server is able to handle
|
|
82
|
+
* RPCs. Its semantics are documented in
|
|
83
|
+
* https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
|
|
84
|
+
*
|
|
85
|
+
* @generated from service grpc.health.v1.Health
|
|
86
|
+
*/
|
|
87
|
+
exports.Health = (0, codegenv2_1.serviceDesc)(exports.file_grpc_health_v1_health, 0);
|
|
@@ -8,7 +8,7 @@ const connect_1 = require("@connectrpc/connect");
|
|
|
8
8
|
const headers_js_1 = __importDefault(require("../common/headers.js"));
|
|
9
9
|
const secp256k1_js_1 = require("@noble/curves/secp256k1.js");
|
|
10
10
|
const validate_response_js_1 = require("./validate_response.js");
|
|
11
|
-
const health_pb_js_1 = require("
|
|
11
|
+
const health_pb_js_1 = require("./health_pb.js");
|
|
12
12
|
const health_js_1 = require("./health.js");
|
|
13
13
|
exports.REQUEST_VALIDITY_MILLIS = 60000;
|
|
14
14
|
const createSignatureVerification = (networkPublicKey) => (next) => async (req) => {
|
package/lib/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.1.
|
|
1
|
+
export declare const SDK_VERSION = "1.1.28";
|
package/lib/cjs/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ServiceImpl } from "@connectrpc/connect";
|
|
2
|
-
import { Health } from "
|
|
2
|
+
import { Health } from "./health_pb.js";
|
|
3
3
|
/**
|
|
4
4
|
* Headers carrying the identity of the SDK answering the probe. They ride on
|
|
5
5
|
* the health response and nowhere else: `HealthCheckResponse` has a single
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { create } from "@bufbuild/protobuf";
|
|
2
2
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
3
|
-
import { HealthCheckResponse_ServingStatus, HealthCheckResponseSchema, } from "
|
|
3
|
+
import { HealthCheckResponse_ServingStatus, HealthCheckResponseSchema, } from "./health_pb.js";
|
|
4
4
|
import { SDK_VERSION } from "../version.js";
|
|
5
5
|
/**
|
|
6
6
|
* Headers carrying the identity of the SDK answering the probe. They ride on
|
|
@@ -30,10 +30,6 @@ export const createHealthServiceImpl = (services) => {
|
|
|
30
30
|
check(req, ctx) {
|
|
31
31
|
ctx.responseHeader.set(SDK_ECOSYSTEM_HEADER, SDK_ECOSYSTEM);
|
|
32
32
|
ctx.responseHeader.set(SDK_VERSION_HEADER, SDK_VERSION);
|
|
33
|
-
// The schema comes from a published .d.ts, whose type brands do not
|
|
34
|
-
// survive ServiceImpl's generics — connect-es widens the request to
|
|
35
|
-
// Message<string>. The descriptor is still the real one at runtime, so
|
|
36
|
-
// this narrows back to what the wire actually carries.
|
|
37
33
|
const { service } = req;
|
|
38
34
|
// An empty service name asks about the process as a whole, which is up if
|
|
39
35
|
// this handler is running at all.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
3
|
+
/**
|
|
4
|
+
* Describes the file grpc/health/v1/health.proto.
|
|
5
|
+
*/
|
|
6
|
+
export declare const file_grpc_health_v1_health: GenFile;
|
|
7
|
+
/**
|
|
8
|
+
* @generated from message grpc.health.v1.HealthCheckRequest
|
|
9
|
+
*/
|
|
10
|
+
export type HealthCheckRequest = Message<"grpc.health.v1.HealthCheckRequest"> & {
|
|
11
|
+
/**
|
|
12
|
+
* @generated from field: string service = 1;
|
|
13
|
+
*/
|
|
14
|
+
service: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Describes the message grpc.health.v1.HealthCheckRequest.
|
|
18
|
+
* Use `create(HealthCheckRequestSchema)` to create a new message.
|
|
19
|
+
*/
|
|
20
|
+
export declare const HealthCheckRequestSchema: GenMessage<HealthCheckRequest>;
|
|
21
|
+
/**
|
|
22
|
+
* @generated from message grpc.health.v1.HealthCheckResponse
|
|
23
|
+
*/
|
|
24
|
+
export type HealthCheckResponse = Message<"grpc.health.v1.HealthCheckResponse"> & {
|
|
25
|
+
/**
|
|
26
|
+
* @generated from field: grpc.health.v1.HealthCheckResponse.ServingStatus status = 1;
|
|
27
|
+
*/
|
|
28
|
+
status: HealthCheckResponse_ServingStatus;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Describes the message grpc.health.v1.HealthCheckResponse.
|
|
32
|
+
* Use `create(HealthCheckResponseSchema)` to create a new message.
|
|
33
|
+
*/
|
|
34
|
+
export declare const HealthCheckResponseSchema: GenMessage<HealthCheckResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* @generated from enum grpc.health.v1.HealthCheckResponse.ServingStatus
|
|
37
|
+
*/
|
|
38
|
+
export declare enum HealthCheckResponse_ServingStatus {
|
|
39
|
+
/**
|
|
40
|
+
* @generated from enum value: UNKNOWN = 0;
|
|
41
|
+
*/
|
|
42
|
+
UNKNOWN = 0,
|
|
43
|
+
/**
|
|
44
|
+
* @generated from enum value: SERVING = 1;
|
|
45
|
+
*/
|
|
46
|
+
SERVING = 1,
|
|
47
|
+
/**
|
|
48
|
+
* @generated from enum value: NOT_SERVING = 2;
|
|
49
|
+
*/
|
|
50
|
+
NOT_SERVING = 2,
|
|
51
|
+
/**
|
|
52
|
+
* Used only by the Watch method.
|
|
53
|
+
*
|
|
54
|
+
* @generated from enum value: SERVICE_UNKNOWN = 3;
|
|
55
|
+
*/
|
|
56
|
+
SERVICE_UNKNOWN = 3
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Describes the enum grpc.health.v1.HealthCheckResponse.ServingStatus.
|
|
60
|
+
*/
|
|
61
|
+
export declare const HealthCheckResponse_ServingStatusSchema: GenEnum<HealthCheckResponse_ServingStatus>;
|
|
62
|
+
/**
|
|
63
|
+
* @generated from message grpc.health.v1.HealthListRequest
|
|
64
|
+
*/
|
|
65
|
+
export type HealthListRequest = Message<"grpc.health.v1.HealthListRequest"> & {};
|
|
66
|
+
/**
|
|
67
|
+
* Describes the message grpc.health.v1.HealthListRequest.
|
|
68
|
+
* Use `create(HealthListRequestSchema)` to create a new message.
|
|
69
|
+
*/
|
|
70
|
+
export declare const HealthListRequestSchema: GenMessage<HealthListRequest>;
|
|
71
|
+
/**
|
|
72
|
+
* @generated from message grpc.health.v1.HealthListResponse
|
|
73
|
+
*/
|
|
74
|
+
export type HealthListResponse = Message<"grpc.health.v1.HealthListResponse"> & {
|
|
75
|
+
/**
|
|
76
|
+
* statuses contains all the services and their respective status.
|
|
77
|
+
*
|
|
78
|
+
* @generated from field: map<string, grpc.health.v1.HealthCheckResponse> statuses = 1;
|
|
79
|
+
*/
|
|
80
|
+
statuses: {
|
|
81
|
+
[key: string]: HealthCheckResponse;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Describes the message grpc.health.v1.HealthListResponse.
|
|
86
|
+
* Use `create(HealthListResponseSchema)` to create a new message.
|
|
87
|
+
*/
|
|
88
|
+
export declare const HealthListResponseSchema: GenMessage<HealthListResponse>;
|
|
89
|
+
/**
|
|
90
|
+
* Health is gRPC's mechanism for checking whether a server is able to handle
|
|
91
|
+
* RPCs. Its semantics are documented in
|
|
92
|
+
* https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
|
|
93
|
+
*
|
|
94
|
+
* @generated from service grpc.health.v1.Health
|
|
95
|
+
*/
|
|
96
|
+
export declare const Health: GenService<{
|
|
97
|
+
/**
|
|
98
|
+
* Check gets the health of the specified service. If the requested service
|
|
99
|
+
* is unknown, the call will fail with status NOT_FOUND. If the caller does
|
|
100
|
+
* not specify a service name, the server should respond with its overall
|
|
101
|
+
* health status.
|
|
102
|
+
*
|
|
103
|
+
* Clients should set a deadline when calling Check, and can declare the
|
|
104
|
+
* server unhealthy if they do not receive a timely response.
|
|
105
|
+
*
|
|
106
|
+
* @generated from rpc grpc.health.v1.Health.Check
|
|
107
|
+
*/
|
|
108
|
+
check: {
|
|
109
|
+
methodKind: "unary";
|
|
110
|
+
input: typeof HealthCheckRequestSchema;
|
|
111
|
+
output: typeof HealthCheckResponseSchema;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* List provides a non-atomic snapshot of the health of all the available
|
|
115
|
+
* services.
|
|
116
|
+
*
|
|
117
|
+
* The server may respond with a RESOURCE_EXHAUSTED error if too many services
|
|
118
|
+
* exist.
|
|
119
|
+
*
|
|
120
|
+
* Clients should set a deadline when calling List, and can declare the server
|
|
121
|
+
* unhealthy if they do not receive a timely response.
|
|
122
|
+
*
|
|
123
|
+
* Clients should keep in mind that the list of health services exposed by an
|
|
124
|
+
* application can change over the lifetime of the process.
|
|
125
|
+
*
|
|
126
|
+
* @generated from rpc grpc.health.v1.Health.List
|
|
127
|
+
*/
|
|
128
|
+
list: {
|
|
129
|
+
methodKind: "unary";
|
|
130
|
+
input: typeof HealthListRequestSchema;
|
|
131
|
+
output: typeof HealthListResponseSchema;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Performs a watch for the serving status of the requested service.
|
|
135
|
+
* The server will immediately send back a message indicating the current
|
|
136
|
+
* serving status. It will then subsequently send a new message whenever
|
|
137
|
+
* the service's serving status changes.
|
|
138
|
+
*
|
|
139
|
+
* If the requested service is unknown when the call is received, the
|
|
140
|
+
* server will send a message setting the serving status to
|
|
141
|
+
* SERVICE_UNKNOWN but will *not* terminate the call. If at some
|
|
142
|
+
* future point, the serving status of the service becomes known, the
|
|
143
|
+
* server will send a new message with the service's serving status.
|
|
144
|
+
*
|
|
145
|
+
* If the call terminates with status UNIMPLEMENTED, then clients
|
|
146
|
+
* should assume this method is not supported and should not retry the
|
|
147
|
+
* call. If the call terminates with any other status (including OK),
|
|
148
|
+
* clients should retry the call with appropriate exponential backoff.
|
|
149
|
+
*
|
|
150
|
+
* @generated from rpc grpc.health.v1.Health.Watch
|
|
151
|
+
*/
|
|
152
|
+
watch: {
|
|
153
|
+
methodKind: "server_streaming";
|
|
154
|
+
input: typeof HealthCheckRequestSchema;
|
|
155
|
+
output: typeof HealthCheckResponseSchema;
|
|
156
|
+
};
|
|
157
|
+
}>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Vendored generated stubs for grpc.health.v1 -- do not edit by hand.
|
|
2
|
+
//
|
|
3
|
+
// Source: buf.build/grpc/grpc, grpc/health/v1/health.proto
|
|
4
|
+
// Plugin: buf.build/bufbuild/es:v2.12.0 (kept in step with the root
|
|
5
|
+
// buf.gen.yaml pin -- plugin and @bufbuild/protobuf runtime must
|
|
6
|
+
// agree on major).
|
|
7
|
+
//
|
|
8
|
+
// Regenerate by overwriting this file:
|
|
9
|
+
//
|
|
10
|
+
// cd node/sdk
|
|
11
|
+
// buf generate buf.build/grpc/grpc --path grpc/health/v1/health.proto \
|
|
12
|
+
// --template '{"version":"v2","plugins":[{"remote":"buf.build/bufbuild/es:v2.12.0","out":"gen-health","opt":["target=ts","import_extension=js"]}]}'
|
|
13
|
+
// mv gen-health/grpc/health/v1/health_pb.ts src/service/health_pb.ts
|
|
14
|
+
// rm -rf gen-health
|
|
15
|
+
//
|
|
16
|
+
// Vendored rather than depended on: the equivalent package
|
|
17
|
+
// `@buf/grpc_grpc.bufbuild_es` is published only on the Buf Schema Registry, and
|
|
18
|
+
// reaching it needs registry config that a published npm package cannot hand its
|
|
19
|
+
// consumers -- so depending on it 404'd every downstream install. Rationale in
|
|
20
|
+
// docs/HEALTH_SERVICE.md.
|
|
21
|
+
//
|
|
22
|
+
// Lives under src/service/ rather than src/common/gen/ so the transport keeps
|
|
23
|
+
// importing nothing from common/gen.
|
|
24
|
+
import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
|
|
25
|
+
/**
|
|
26
|
+
* Describes the file grpc/health/v1/health.proto.
|
|
27
|
+
*/
|
|
28
|
+
export const file_grpc_health_v1_health = /*@__PURE__*/ fileDesc("ChtncnBjL2hlYWx0aC92MS9oZWFsdGgucHJvdG8SDmdycGMuaGVhbHRoLnYxIiUKEkhlYWx0aENoZWNrUmVxdWVzdBIPCgdzZXJ2aWNlGAEgASgJIqkBChNIZWFsdGhDaGVja1Jlc3BvbnNlEkEKBnN0YXR1cxgBIAEoDjIxLmdycGMuaGVhbHRoLnYxLkhlYWx0aENoZWNrUmVzcG9uc2UuU2VydmluZ1N0YXR1cyJPCg1TZXJ2aW5nU3RhdHVzEgsKB1VOS05PV04QABILCgdTRVJWSU5HEAESDwoLTk9UX1NFUlZJTkcQAhITCg9TRVJWSUNFX1VOS05PV04QAyITChFIZWFsdGhMaXN0UmVxdWVzdCKuAQoSSGVhbHRoTGlzdFJlc3BvbnNlEkIKCHN0YXR1c2VzGAEgAygLMjAuZ3JwYy5oZWFsdGgudjEuSGVhbHRoTGlzdFJlc3BvbnNlLlN0YXR1c2VzRW50cnkaVAoNU3RhdHVzZXNFbnRyeRILCgNrZXkYASABKAkSMgoFdmFsdWUYAiABKAsyIy5ncnBjLmhlYWx0aC52MS5IZWFsdGhDaGVja1Jlc3BvbnNlOgI4ATL9AQoGSGVhbHRoElAKBUNoZWNrEiIuZ3JwYy5oZWFsdGgudjEuSGVhbHRoQ2hlY2tSZXF1ZXN0GiMuZ3JwYy5oZWFsdGgudjEuSGVhbHRoQ2hlY2tSZXNwb25zZRJNCgRMaXN0EiEuZ3JwYy5oZWFsdGgudjEuSGVhbHRoTGlzdFJlcXVlc3QaIi5ncnBjLmhlYWx0aC52MS5IZWFsdGhMaXN0UmVzcG9uc2USUgoFV2F0Y2gSIi5ncnBjLmhlYWx0aC52MS5IZWFsdGhDaGVja1JlcXVlc3QaIy5ncnBjLmhlYWx0aC52MS5IZWFsdGhDaGVja1Jlc3BvbnNlMAFCcAoRaW8uZ3JwYy5oZWFsdGgudjFCC0hlYWx0aFByb3RvUAFaLGdvb2dsZS5nb2xhbmcub3JnL2dycGMvaGVhbHRoL2dycGNfaGVhbHRoX3YxogIMR3JwY0hlYWx0aFYxqgIOR3JwYy5IZWFsdGguVjFiBnByb3RvMw");
|
|
29
|
+
/**
|
|
30
|
+
* Describes the message grpc.health.v1.HealthCheckRequest.
|
|
31
|
+
* Use `create(HealthCheckRequestSchema)` to create a new message.
|
|
32
|
+
*/
|
|
33
|
+
export const HealthCheckRequestSchema = /*@__PURE__*/ messageDesc(file_grpc_health_v1_health, 0);
|
|
34
|
+
/**
|
|
35
|
+
* Describes the message grpc.health.v1.HealthCheckResponse.
|
|
36
|
+
* Use `create(HealthCheckResponseSchema)` to create a new message.
|
|
37
|
+
*/
|
|
38
|
+
export const HealthCheckResponseSchema = /*@__PURE__*/ messageDesc(file_grpc_health_v1_health, 1);
|
|
39
|
+
/**
|
|
40
|
+
* @generated from enum grpc.health.v1.HealthCheckResponse.ServingStatus
|
|
41
|
+
*/
|
|
42
|
+
export var HealthCheckResponse_ServingStatus;
|
|
43
|
+
(function (HealthCheckResponse_ServingStatus) {
|
|
44
|
+
/**
|
|
45
|
+
* @generated from enum value: UNKNOWN = 0;
|
|
46
|
+
*/
|
|
47
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["UNKNOWN"] = 0] = "UNKNOWN";
|
|
48
|
+
/**
|
|
49
|
+
* @generated from enum value: SERVING = 1;
|
|
50
|
+
*/
|
|
51
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["SERVING"] = 1] = "SERVING";
|
|
52
|
+
/**
|
|
53
|
+
* @generated from enum value: NOT_SERVING = 2;
|
|
54
|
+
*/
|
|
55
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["NOT_SERVING"] = 2] = "NOT_SERVING";
|
|
56
|
+
/**
|
|
57
|
+
* Used only by the Watch method.
|
|
58
|
+
*
|
|
59
|
+
* @generated from enum value: SERVICE_UNKNOWN = 3;
|
|
60
|
+
*/
|
|
61
|
+
HealthCheckResponse_ServingStatus[HealthCheckResponse_ServingStatus["SERVICE_UNKNOWN"] = 3] = "SERVICE_UNKNOWN";
|
|
62
|
+
})(HealthCheckResponse_ServingStatus || (HealthCheckResponse_ServingStatus = {}));
|
|
63
|
+
/**
|
|
64
|
+
* Describes the enum grpc.health.v1.HealthCheckResponse.ServingStatus.
|
|
65
|
+
*/
|
|
66
|
+
export const HealthCheckResponse_ServingStatusSchema = /*@__PURE__*/ enumDesc(file_grpc_health_v1_health, 1, 0);
|
|
67
|
+
/**
|
|
68
|
+
* Describes the message grpc.health.v1.HealthListRequest.
|
|
69
|
+
* Use `create(HealthListRequestSchema)` to create a new message.
|
|
70
|
+
*/
|
|
71
|
+
export const HealthListRequestSchema = /*@__PURE__*/ messageDesc(file_grpc_health_v1_health, 2);
|
|
72
|
+
/**
|
|
73
|
+
* Describes the message grpc.health.v1.HealthListResponse.
|
|
74
|
+
* Use `create(HealthListResponseSchema)` to create a new message.
|
|
75
|
+
*/
|
|
76
|
+
export const HealthListResponseSchema = /*@__PURE__*/ messageDesc(file_grpc_health_v1_health, 3);
|
|
77
|
+
/**
|
|
78
|
+
* Health is gRPC's mechanism for checking whether a server is able to handle
|
|
79
|
+
* RPCs. Its semantics are documented in
|
|
80
|
+
* https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
|
|
81
|
+
*
|
|
82
|
+
* @generated from service grpc.health.v1.Health
|
|
83
|
+
*/
|
|
84
|
+
export const Health = /*@__PURE__*/ serviceDesc(file_grpc_health_v1_health, 0);
|
|
@@ -2,7 +2,7 @@ import { Code, ConnectError, createContextKey, createContextValues } from "@conn
|
|
|
2
2
|
import NetworkHeaders from "../common/headers.js";
|
|
3
3
|
import { secp256k1 } from '@noble/curves/secp256k1.js';
|
|
4
4
|
import { createValidationInterceptor } from "./validate_response.js";
|
|
5
|
-
import { Health } from "
|
|
5
|
+
import { Health } from "./health_pb.js";
|
|
6
6
|
import { createHealthServiceImpl } from "./health.js";
|
|
7
7
|
export const REQUEST_VALIDITY_MILLIS = 60000;
|
|
8
8
|
const createSignatureVerification = (networkPublicKey) => (next) => async (req) => {
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.1.
|
|
1
|
+
export declare const SDK_VERSION = "1.1.28";
|
package/lib/esm/version.js
CHANGED