@t-0/provider-sdk 1.1.26 → 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/lib/cjs/common/gen/tzero/v1/payment/network_pb.d.ts +2 -1
- package/lib/cjs/service/health.d.ts +21 -0
- package/lib/cjs/service/health.js +46 -0
- 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 +7 -4
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/gen/tzero/v1/payment/network_pb.d.ts +2 -1
- package/lib/esm/service/health.d.ts +21 -0
- package/lib/esm/service/health.js +42 -0
- 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 +7 -4
- 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 -1
- package/lib/cjs/common/gen/tzero/v1/system/system_pb.d.ts +0 -119
- package/lib/cjs/common/gen/tzero/v1/system/system_pb.js +0 -71
- package/lib/cjs/service/system.d.ts +0 -4
- package/lib/cjs/service/system.js +0 -18
- package/lib/esm/common/gen/tzero/v1/system/system_pb.d.ts +0 -119
- package/lib/esm/common/gen/tzero/v1/system/system_pb.js +0 -68
- package/lib/esm/service/system.d.ts +0 -4
- package/lib/esm/service/system.js +0 -14
|
@@ -192,7 +192,8 @@ export type GetQuoteResponse = Message<"tzero.v1.payment.GetQuoteResponse"> & {
|
|
|
192
192
|
/**
|
|
193
193
|
* *
|
|
194
194
|
* All best quotes from providers with credit lines.
|
|
195
|
-
* Each quote is
|
|
195
|
+
* Each quote is that provider's best effective price for the requested amount:
|
|
196
|
+
* the lowest settlement amount, and on a tie the largest pay-out amount.
|
|
196
197
|
* Each quote indicates whether it can be executed immediately.
|
|
197
198
|
* Always returned alongside success/failure - providers can compare alternatives or see options when no executable quote exists.
|
|
198
199
|
*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ServiceImpl } from "@connectrpc/connect";
|
|
2
|
+
import { Health } from "./health_pb.js";
|
|
3
|
+
/**
|
|
4
|
+
* Headers carrying the identity of the SDK answering the probe. They ride on
|
|
5
|
+
* the health response and nowhere else: `HealthCheckResponse` has a single
|
|
6
|
+
* status field and `check` names its service in the request, so the contract
|
|
7
|
+
* itself has no room for this — and taxing every callback with headers only the
|
|
8
|
+
* probe reads would be worse.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SDK_ECOSYSTEM_HEADER = "T0-Sdk-Ecosystem";
|
|
11
|
+
export declare const SDK_VERSION_HEADER = "T0-Sdk-Version";
|
|
12
|
+
/**
|
|
13
|
+
* Reports SERVING for the services registered on this server and NOT_FOUND for
|
|
14
|
+
* anything else. The set is frozen at registration; nothing is computed per
|
|
15
|
+
* request.
|
|
16
|
+
*
|
|
17
|
+
* `watch` is absent on purpose: it is server-streaming, and the body-hash
|
|
18
|
+
* signature scheme these servers run behind has no story for streams. Omitting
|
|
19
|
+
* it from a partial `ServiceImpl` makes connect-es answer UNIMPLEMENTED.
|
|
20
|
+
*/
|
|
21
|
+
export declare const createHealthServiceImpl: (services: string[]) => Partial<ServiceImpl<typeof Health>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createHealthServiceImpl = exports.SDK_VERSION_HEADER = exports.SDK_ECOSYSTEM_HEADER = void 0;
|
|
4
|
+
const protobuf_1 = require("@bufbuild/protobuf");
|
|
5
|
+
const connect_1 = require("@connectrpc/connect");
|
|
6
|
+
const health_pb_js_1 = require("./health_pb.js");
|
|
7
|
+
const version_js_1 = require("../version.js");
|
|
8
|
+
/**
|
|
9
|
+
* Headers carrying the identity of the SDK answering the probe. They ride on
|
|
10
|
+
* the health response and nowhere else: `HealthCheckResponse` has a single
|
|
11
|
+
* status field and `check` names its service in the request, so the contract
|
|
12
|
+
* itself has no room for this — and taxing every callback with headers only the
|
|
13
|
+
* probe reads would be worse.
|
|
14
|
+
*/
|
|
15
|
+
exports.SDK_ECOSYSTEM_HEADER = "T0-Sdk-Ecosystem";
|
|
16
|
+
exports.SDK_VERSION_HEADER = "T0-Sdk-Version";
|
|
17
|
+
const SDK_ECOSYSTEM = "node";
|
|
18
|
+
/**
|
|
19
|
+
* Reports SERVING for the services registered on this server and NOT_FOUND for
|
|
20
|
+
* anything else. The set is frozen at registration; nothing is computed per
|
|
21
|
+
* request.
|
|
22
|
+
*
|
|
23
|
+
* `watch` is absent on purpose: it is server-streaming, and the body-hash
|
|
24
|
+
* signature scheme these servers run behind has no story for streams. Omitting
|
|
25
|
+
* it from a partial `ServiceImpl` makes connect-es answer UNIMPLEMENTED.
|
|
26
|
+
*/
|
|
27
|
+
const createHealthServiceImpl = (services) => {
|
|
28
|
+
const registered = new Set(services);
|
|
29
|
+
const serving = (0, protobuf_1.create)(health_pb_js_1.HealthCheckResponseSchema, {
|
|
30
|
+
status: health_pb_js_1.HealthCheckResponse_ServingStatus.SERVING,
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
check(req, ctx) {
|
|
34
|
+
ctx.responseHeader.set(exports.SDK_ECOSYSTEM_HEADER, SDK_ECOSYSTEM);
|
|
35
|
+
ctx.responseHeader.set(exports.SDK_VERSION_HEADER, version_js_1.SDK_VERSION);
|
|
36
|
+
const { service } = req;
|
|
37
|
+
// An empty service name asks about the process as a whole, which is up if
|
|
38
|
+
// this handler is running at all.
|
|
39
|
+
if (service !== "" && !registered.has(service)) {
|
|
40
|
+
throw new connect_1.ConnectError(`unknown service '${service}'`, connect_1.Code.NotFound);
|
|
41
|
+
}
|
|
42
|
+
return serving;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.createHealthServiceImpl = createHealthServiceImpl;
|
|
@@ -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,8 +8,8 @@ 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
|
|
12
|
-
const
|
|
11
|
+
const health_pb_js_1 = require("./health_pb.js");
|
|
12
|
+
const health_js_1 = require("./health.js");
|
|
13
13
|
exports.REQUEST_VALIDITY_MILLIS = 60000;
|
|
14
14
|
const createSignatureVerification = (networkPublicKey) => (next) => async (req) => {
|
|
15
15
|
const ts = decodeNum(getHeader(req, headers_js_1.default.SignatureTimestamp));
|
|
@@ -57,8 +57,11 @@ const createService = (networkPublicKey, registerRoutes) => {
|
|
|
57
57
|
},
|
|
58
58
|
};
|
|
59
59
|
registerRoutes(wrappedRouter);
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
// Health is the only service this transport mounts on its own — see
|
|
61
|
+
// docs/HEALTH_SERVICE.md. Same interceptors as everything else, so the
|
|
62
|
+
// probe is signed like any other call.
|
|
63
|
+
collected.push(health_pb_js_1.Health.typeName);
|
|
64
|
+
origService(health_pb_js_1.Health, (0, health_js_1.createHealthServiceImpl)(collected));
|
|
62
65
|
},
|
|
63
66
|
interceptors: [createSignatureVerification(networkPublicKey), (0, validate_response_js_1.createValidationInterceptor)()],
|
|
64
67
|
grpcWeb: false,
|
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
|
@@ -192,7 +192,8 @@ export type GetQuoteResponse = Message<"tzero.v1.payment.GetQuoteResponse"> & {
|
|
|
192
192
|
/**
|
|
193
193
|
* *
|
|
194
194
|
* All best quotes from providers with credit lines.
|
|
195
|
-
* Each quote is
|
|
195
|
+
* Each quote is that provider's best effective price for the requested amount:
|
|
196
|
+
* the lowest settlement amount, and on a tie the largest pay-out amount.
|
|
196
197
|
* Each quote indicates whether it can be executed immediately.
|
|
197
198
|
* Always returned alongside success/failure - providers can compare alternatives or see options when no executable quote exists.
|
|
198
199
|
*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ServiceImpl } from "@connectrpc/connect";
|
|
2
|
+
import { Health } from "./health_pb.js";
|
|
3
|
+
/**
|
|
4
|
+
* Headers carrying the identity of the SDK answering the probe. They ride on
|
|
5
|
+
* the health response and nowhere else: `HealthCheckResponse` has a single
|
|
6
|
+
* status field and `check` names its service in the request, so the contract
|
|
7
|
+
* itself has no room for this — and taxing every callback with headers only the
|
|
8
|
+
* probe reads would be worse.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SDK_ECOSYSTEM_HEADER = "T0-Sdk-Ecosystem";
|
|
11
|
+
export declare const SDK_VERSION_HEADER = "T0-Sdk-Version";
|
|
12
|
+
/**
|
|
13
|
+
* Reports SERVING for the services registered on this server and NOT_FOUND for
|
|
14
|
+
* anything else. The set is frozen at registration; nothing is computed per
|
|
15
|
+
* request.
|
|
16
|
+
*
|
|
17
|
+
* `watch` is absent on purpose: it is server-streaming, and the body-hash
|
|
18
|
+
* signature scheme these servers run behind has no story for streams. Omitting
|
|
19
|
+
* it from a partial `ServiceImpl` makes connect-es answer UNIMPLEMENTED.
|
|
20
|
+
*/
|
|
21
|
+
export declare const createHealthServiceImpl: (services: string[]) => Partial<ServiceImpl<typeof Health>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { create } from "@bufbuild/protobuf";
|
|
2
|
+
import { Code, ConnectError } from "@connectrpc/connect";
|
|
3
|
+
import { HealthCheckResponse_ServingStatus, HealthCheckResponseSchema, } from "./health_pb.js";
|
|
4
|
+
import { SDK_VERSION } from "../version.js";
|
|
5
|
+
/**
|
|
6
|
+
* Headers carrying the identity of the SDK answering the probe. They ride on
|
|
7
|
+
* the health response and nowhere else: `HealthCheckResponse` has a single
|
|
8
|
+
* status field and `check` names its service in the request, so the contract
|
|
9
|
+
* itself has no room for this — and taxing every callback with headers only the
|
|
10
|
+
* probe reads would be worse.
|
|
11
|
+
*/
|
|
12
|
+
export const SDK_ECOSYSTEM_HEADER = "T0-Sdk-Ecosystem";
|
|
13
|
+
export const SDK_VERSION_HEADER = "T0-Sdk-Version";
|
|
14
|
+
const SDK_ECOSYSTEM = "node";
|
|
15
|
+
/**
|
|
16
|
+
* Reports SERVING for the services registered on this server and NOT_FOUND for
|
|
17
|
+
* anything else. The set is frozen at registration; nothing is computed per
|
|
18
|
+
* request.
|
|
19
|
+
*
|
|
20
|
+
* `watch` is absent on purpose: it is server-streaming, and the body-hash
|
|
21
|
+
* signature scheme these servers run behind has no story for streams. Omitting
|
|
22
|
+
* it from a partial `ServiceImpl` makes connect-es answer UNIMPLEMENTED.
|
|
23
|
+
*/
|
|
24
|
+
export const createHealthServiceImpl = (services) => {
|
|
25
|
+
const registered = new Set(services);
|
|
26
|
+
const serving = create(HealthCheckResponseSchema, {
|
|
27
|
+
status: HealthCheckResponse_ServingStatus.SERVING,
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
check(req, ctx) {
|
|
31
|
+
ctx.responseHeader.set(SDK_ECOSYSTEM_HEADER, SDK_ECOSYSTEM);
|
|
32
|
+
ctx.responseHeader.set(SDK_VERSION_HEADER, SDK_VERSION);
|
|
33
|
+
const { service } = req;
|
|
34
|
+
// An empty service name asks about the process as a whole, which is up if
|
|
35
|
+
// this handler is running at all.
|
|
36
|
+
if (service !== "" && !registered.has(service)) {
|
|
37
|
+
throw new ConnectError(`unknown service '${service}'`, Code.NotFound);
|
|
38
|
+
}
|
|
39
|
+
return serving;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -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
|
+
}>;
|