@mark1russell7/service 0.8.18 → 0.8.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/README.md +19 -0
  2. package/build/backoff.d.ts +44 -2
  3. package/build/{builder-zO48Vgoj.d.ts → builder.d.ts} +14 -101
  4. package/build/builder.js +499 -0
  5. package/build/builder.js.map +1 -0
  6. package/build/{call-context-DDhcVvn5.d.ts → call-context.d.ts} +3 -4
  7. package/build/channel.d.ts +1 -1
  8. package/build/{core-BSzt4RI2.d.ts → client/core.d.ts} +32 -61
  9. package/build/{machine-BhVeHr_m.js → client/core.js} +4 -153
  10. package/build/client/core.js.map +1 -0
  11. package/build/{dial-ChwIcvd4.d.ts → client/dial.d.ts} +3 -4
  12. package/build/client/dial.js +52 -0
  13. package/build/client/dial.js.map +1 -0
  14. package/build/client/machine.js +29 -0
  15. package/build/client/machine.js.map +1 -0
  16. package/build/client/meets.d.ts +35 -0
  17. package/build/client/meets.js +78 -0
  18. package/build/client/meets.js.map +1 -0
  19. package/build/clock.d.ts +1 -1
  20. package/build/conformance.d.ts +122 -0
  21. package/build/conformance.js +470 -0
  22. package/build/conformance.js.map +1 -0
  23. package/build/contract.d.ts +28 -0
  24. package/build/contract.js +184 -0
  25. package/build/contract.js.map +1 -0
  26. package/build/description.d.ts +161 -0
  27. package/build/description.js +11 -0
  28. package/build/description.js.map +1 -0
  29. package/build/drains.js +35 -0
  30. package/build/drains.js.map +1 -0
  31. package/build/events.d.ts +25 -0
  32. package/build/fakes.d.ts +43 -0
  33. package/build/fakes.js +93 -0
  34. package/build/fakes.js.map +1 -0
  35. package/build/grpc/client.d.ts +153 -0
  36. package/build/grpc/client.js +474 -0
  37. package/build/grpc/client.js.map +1 -0
  38. package/build/grpc/connection.d.ts +97 -0
  39. package/build/grpc/connection.js +59 -0
  40. package/build/grpc/connection.js.map +1 -0
  41. package/build/grpc/machine.d.ts +12 -0
  42. package/build/grpc/machine.js +149 -0
  43. package/build/grpc/machine.js.map +1 -0
  44. package/build/grpc/meets.d.ts +14 -0
  45. package/build/grpc/meets.js +105 -0
  46. package/build/grpc/meets.js.map +1 -0
  47. package/build/grpc/starting.d.ts +33 -0
  48. package/build/grpc/starting.js +89 -0
  49. package/build/grpc/starting.js.map +1 -0
  50. package/build/grpc.d.ts +9 -303
  51. package/build/grpc.js +7 -854
  52. package/build/health.d.ts +93 -0
  53. package/build/health.js +223 -0
  54. package/build/health.js.map +1 -0
  55. package/build/heartbeat.d.ts +1 -1
  56. package/build/host/discovery.d.ts +61 -0
  57. package/build/host/discovery.js +113 -0
  58. package/build/host/discovery.js.map +1 -0
  59. package/build/host/env.d.ts +14 -0
  60. package/build/host/env.js +57 -0
  61. package/build/host/env.js.map +1 -0
  62. package/build/host/fakes.d.ts +82 -0
  63. package/build/host/fakes.js +239 -0
  64. package/build/host/fakes.js.map +1 -0
  65. package/build/host/group.d.ts +142 -0
  66. package/build/host/group.js +517 -0
  67. package/build/host/group.js.map +1 -0
  68. package/build/host/install.d.ts +96 -0
  69. package/build/host/install.js +330 -0
  70. package/build/host/install.js.map +1 -0
  71. package/build/host/lock.d.ts +78 -0
  72. package/build/host/lock.js +190 -0
  73. package/build/host/lock.js.map +1 -0
  74. package/build/host/logs.d.ts +26 -0
  75. package/build/host/logs.js +48 -0
  76. package/build/host/logs.js.map +1 -0
  77. package/build/host/node.d.ts +14 -0
  78. package/build/host/node.js +309 -0
  79. package/build/host/node.js.map +1 -0
  80. package/build/{ports-B1ayTL-j.d.ts → host/ports.d.ts} +15 -16
  81. package/build/host/ports.js +17 -0
  82. package/build/host/ports.js.map +1 -0
  83. package/build/host/probes.d.ts +51 -0
  84. package/build/host/probes.js +139 -0
  85. package/build/host/probes.js.map +1 -0
  86. package/build/host/processes.d.ts +32 -0
  87. package/build/host/processes.js +63 -0
  88. package/build/host/processes.js.map +1 -0
  89. package/build/host/render.d.ts +84 -0
  90. package/build/host/render.js +235 -0
  91. package/build/host/render.js.map +1 -0
  92. package/build/host/watch.d.ts +90 -0
  93. package/build/host/watch.js +165 -0
  94. package/build/host/watch.js.map +1 -0
  95. package/build/host.d.ts +13 -671
  96. package/build/host.js +12 -2126
  97. package/build/http/answers.js +29 -0
  98. package/build/http/answers.js.map +1 -0
  99. package/build/http/fake-server.js +61 -0
  100. package/build/http/fake-server.js.map +1 -0
  101. package/build/http/outcome.d.ts +115 -0
  102. package/build/http/outcome.js +325 -0
  103. package/build/http/outcome.js.map +1 -0
  104. package/build/http/probes.d.ts +83 -0
  105. package/build/http/probes.js +232 -0
  106. package/build/http/probes.js.map +1 -0
  107. package/build/http/transport.d.ts +165 -0
  108. package/build/http/transport.js +517 -0
  109. package/build/http/transport.js.map +1 -0
  110. package/build/http-client/client.d.ts +121 -0
  111. package/build/http-client/client.js +330 -0
  112. package/build/http-client/client.js.map +1 -0
  113. package/build/http-client/connection.d.ts +78 -0
  114. package/build/http-client/connection.js +54 -0
  115. package/build/http-client/connection.js.map +1 -0
  116. package/build/http-client/machine.d.ts +14 -0
  117. package/build/http-client/machine.js +109 -0
  118. package/build/http-client/machine.js.map +1 -0
  119. package/build/http-client/meets.d.ts +11 -0
  120. package/build/http-client/meets.js +74 -0
  121. package/build/http-client/meets.js.map +1 -0
  122. package/build/http-client/session.d.ts +87 -0
  123. package/build/http-client/session.js +99 -0
  124. package/build/http-client/session.js.map +1 -0
  125. package/build/http-client/starting.d.ts +25 -0
  126. package/build/http-client/starting.js +65 -0
  127. package/build/http-client/starting.js.map +1 -0
  128. package/build/http-client.d.ts +9 -330
  129. package/build/http-client.js +8 -707
  130. package/build/http.d.ts +5 -353
  131. package/build/http.js +3 -1086
  132. package/build/identity.d.ts +16 -0
  133. package/build/identity.js +44 -0
  134. package/build/identity.js.map +1 -0
  135. package/build/index.d.ts +35 -412
  136. package/build/index.js +24 -3277
  137. package/build/knobs.d.ts +1 -0
  138. package/build/{knobs-BJcz6m01.js → knobs.js} +2 -34
  139. package/build/knobs.js.map +1 -0
  140. package/build/latch.d.ts +29 -0
  141. package/build/latch.js +122 -0
  142. package/build/latch.js.map +1 -0
  143. package/build/{rules-HyFCBStQ.d.ts → law.d.ts} +19 -37
  144. package/build/law.js +149 -0
  145. package/build/law.js.map +1 -0
  146. package/build/lifecycle.d.ts +144 -0
  147. package/build/lifecycle.js +411 -0
  148. package/build/lifecycle.js.map +1 -0
  149. package/build/limiter/machine.d.ts +40 -0
  150. package/build/limiter/machine.js +279 -0
  151. package/build/limiter/machine.js.map +1 -0
  152. package/build/{policy-CBcK2XGg.d.ts → limiter/policy.d.ts} +28 -29
  153. package/build/{policy-UYALkqVq.js → limiter/policy.js} +10 -9
  154. package/build/limiter/policy.js.map +1 -0
  155. package/build/{limiter-Cm8nC-Gd.d.ts → limiter/quota.d.ts} +50 -76
  156. package/build/{limiter-Bgy6Gmvl.js → limiter/quota.js} +32 -425
  157. package/build/limiter/quota.js.map +1 -0
  158. package/build/{store-DFwFKrsB.d.ts → limiter/store.d.ts} +10 -11
  159. package/build/limiter/store.js +145 -0
  160. package/build/limiter/store.js.map +1 -0
  161. package/build/limiter.d.ts +4 -3
  162. package/build/limiter.js +4 -2
  163. package/build/lint.d.ts +152 -0
  164. package/build/lint.js +576 -0
  165. package/build/lint.js.map +1 -0
  166. package/build/logger.d.ts +71 -0
  167. package/build/logger.js +183 -0
  168. package/build/logger.js.map +1 -0
  169. package/build/machines.d.ts +41 -0
  170. package/build/machines.js +451 -0
  171. package/build/machines.js.map +1 -0
  172. package/build/metrics.d.ts +53 -0
  173. package/build/metrics.js +111 -0
  174. package/build/metrics.js.map +1 -0
  175. package/build/mongodb/client.d.ts +131 -0
  176. package/build/mongodb/client.js +388 -0
  177. package/build/mongodb/client.js.map +1 -0
  178. package/build/mongodb/connection.d.ts +112 -0
  179. package/build/mongodb/connection.js +12 -0
  180. package/build/mongodb/connection.js.map +1 -0
  181. package/build/mongodb/machine.d.ts +14 -0
  182. package/build/mongodb/machine.js +122 -0
  183. package/build/mongodb/machine.js.map +1 -0
  184. package/build/mongodb/meets.d.ts +15 -0
  185. package/build/mongodb/meets.js +103 -0
  186. package/build/mongodb/meets.js.map +1 -0
  187. package/build/mongodb/starting.d.ts +29 -0
  188. package/build/mongodb/starting.js +77 -0
  189. package/build/mongodb/starting.js.map +1 -0
  190. package/build/mongodb.d.ts +8 -296
  191. package/build/mongodb.js +7 -682
  192. package/build/operation.d.ts +27 -0
  193. package/build/{operation-DF73RZOI.js → operation.js} +2 -2
  194. package/build/operation.js.map +1 -0
  195. package/build/otel.d.ts +2 -2
  196. package/build/pg/client.d.ts +96 -0
  197. package/build/pg/client.js +277 -0
  198. package/build/pg/client.js.map +1 -0
  199. package/build/pg/connection.d.ts +75 -0
  200. package/build/pg/connection.js +11 -0
  201. package/build/pg/connection.js.map +1 -0
  202. package/build/pg/machine.d.ts +13 -0
  203. package/build/pg/machine.js +111 -0
  204. package/build/pg/machine.js.map +1 -0
  205. package/build/pg/meets.d.ts +14 -0
  206. package/build/pg/meets.js +83 -0
  207. package/build/pg/meets.js.map +1 -0
  208. package/build/pg/starting.d.ts +26 -0
  209. package/build/pg/starting.js +62 -0
  210. package/build/pg/starting.js.map +1 -0
  211. package/build/pg.d.ts +8 -219
  212. package/build/pg.js +7 -525
  213. package/build/poller.d.ts +9 -0
  214. package/build/poller.js +152 -0
  215. package/build/poller.js.map +1 -0
  216. package/build/process.d.ts +114 -0
  217. package/build/process.js +170 -0
  218. package/build/process.js.map +1 -0
  219. package/build/profiles.d.ts +68 -0
  220. package/build/profiles.js +120 -0
  221. package/build/profiles.js.map +1 -0
  222. package/build/{queue-DXdw1vLO.d.ts → queue.d.ts} +16 -29
  223. package/build/queue.js +279 -0
  224. package/build/queue.js.map +1 -0
  225. package/build/rabbitmq/client.d.ts +144 -0
  226. package/build/rabbitmq/client.js +426 -0
  227. package/build/rabbitmq/client.js.map +1 -0
  228. package/build/rabbitmq/connection.d.ts +91 -0
  229. package/build/rabbitmq/connection.js +15 -0
  230. package/build/rabbitmq/connection.js.map +1 -0
  231. package/build/rabbitmq/machine.d.ts +13 -0
  232. package/build/rabbitmq/machine.js +159 -0
  233. package/build/rabbitmq/machine.js.map +1 -0
  234. package/build/rabbitmq/meets.d.ts +12 -0
  235. package/build/rabbitmq/meets.js +96 -0
  236. package/build/rabbitmq/meets.js.map +1 -0
  237. package/build/rabbitmq/starting.d.ts +27 -0
  238. package/build/rabbitmq/starting.js +67 -0
  239. package/build/rabbitmq/starting.js.map +1 -0
  240. package/build/rabbitmq.d.ts +8 -283
  241. package/build/rabbitmq.js +7 -742
  242. package/build/redis/client.d.ts +86 -0
  243. package/build/redis/client.js +285 -0
  244. package/build/redis/client.js.map +1 -0
  245. package/build/redis/connection.d.ts +57 -0
  246. package/build/redis/connection.js +11 -0
  247. package/build/redis/connection.js.map +1 -0
  248. package/build/redis/limiter.d.ts +43 -0
  249. package/build/redis/limiter.js +164 -0
  250. package/build/redis/limiter.js.map +1 -0
  251. package/build/redis/machine.d.ts +12 -0
  252. package/build/redis/machine.js +144 -0
  253. package/build/redis/machine.js.map +1 -0
  254. package/build/redis/meets.d.ts +11 -0
  255. package/build/redis/meets.js +75 -0
  256. package/build/redis/meets.js.map +1 -0
  257. package/build/redis/operations.d.ts +5 -0
  258. package/build/redis/operations.js +114 -0
  259. package/build/redis/operations.js.map +1 -0
  260. package/build/redis.d.ts +10 -207
  261. package/build/redis.js +9 -771
  262. package/build/requests.d.ts +66 -0
  263. package/build/requests.js +279 -0
  264. package/build/requests.js.map +1 -0
  265. package/build/retrier.d.ts +62 -0
  266. package/build/{retrier-Dnjhvxol.js → retrier.js} +2 -2
  267. package/build/retrier.js.map +1 -0
  268. package/build/routes.d.ts +35 -0
  269. package/build/routes.js +77 -0
  270. package/build/routes.js.map +1 -0
  271. package/build/rules.d.ts +19 -2
  272. package/build/stops.d.ts +51 -0
  273. package/build/stops.js +86 -0
  274. package/build/stops.js.map +1 -0
  275. package/build/testing.d.ts +8 -270
  276. package/build/testing.js +4 -1027
  277. package/build/testing.js.map +1 -1
  278. package/build/timing.d.ts +63 -0
  279. package/build/{timing-DZl36uXs.js → timing.js} +2 -2
  280. package/build/timing.js.map +1 -0
  281. package/build/units.d.ts +17 -0
  282. package/build/units.js +236 -0
  283. package/build/units.js.map +1 -0
  284. package/build/watchdog.d.ts +34 -0
  285. package/build/watchdog.js +53 -0
  286. package/build/watchdog.js.map +1 -0
  287. package/build/websocket/client.d.ts +136 -0
  288. package/build/websocket/client.js +422 -0
  289. package/build/websocket/client.js.map +1 -0
  290. package/build/websocket/connection.d.ts +83 -0
  291. package/build/websocket/connection.js +57 -0
  292. package/build/websocket/connection.js.map +1 -0
  293. package/build/websocket/machine.d.ts +12 -0
  294. package/build/websocket/machine.js +155 -0
  295. package/build/websocket/machine.js.map +1 -0
  296. package/build/websocket/meets.d.ts +14 -0
  297. package/build/websocket/meets.js +92 -0
  298. package/build/websocket/meets.js.map +1 -0
  299. package/build/websocket/starting.d.ts +25 -0
  300. package/build/websocket/starting.js +69 -0
  301. package/build/websocket/starting.js.map +1 -0
  302. package/build/websocket.d.ts +9 -264
  303. package/build/websocket.js +8 -774
  304. package/build/worker.d.ts +92 -0
  305. package/build/worker.js +153 -0
  306. package/build/worker.js.map +1 -0
  307. package/package.json +4 -3
  308. package/build/backoff-QTRGfkEK.d.ts +0 -45
  309. package/build/clock-DpVgpY4h.d.ts +0 -2
  310. package/build/grpc.js.map +0 -1
  311. package/build/host.js.map +0 -1
  312. package/build/http-client.js.map +0 -1
  313. package/build/http.js.map +0 -1
  314. package/build/index.js.map +0 -1
  315. package/build/knobs-BJcz6m01.js.map +0 -1
  316. package/build/lifecycle-D0J-zwZF.d.ts +0 -374
  317. package/build/limiter-Bgy6Gmvl.js.map +0 -1
  318. package/build/logger-B6drv9w0.d.ts +0 -488
  319. package/build/machine-BhVeHr_m.js.map +0 -1
  320. package/build/mongodb.js.map +0 -1
  321. package/build/operation-DF73RZOI.js.map +0 -1
  322. package/build/pg.js.map +0 -1
  323. package/build/policy-UYALkqVq.js.map +0 -1
  324. package/build/process-7R9M29wN.js +0 -437
  325. package/build/process-7R9M29wN.js.map +0 -1
  326. package/build/rabbitmq.js.map +0 -1
  327. package/build/redis.js.map +0 -1
  328. package/build/requests-DD2ALv0_.js +0 -583
  329. package/build/requests-DD2ALv0_.js.map +0 -1
  330. package/build/retrier-Dnjhvxol.js.map +0 -1
  331. package/build/timing-DZl36uXs.js.map +0 -1
  332. package/build/websocket.js.map +0 -1
@@ -1,330 +1,9 @@
1
- import { C as MANIFESTATIONS, D as firstDetector, E as Situation, O as unwatched, S as Detector, T as Meeting, _ as Sent, a as ClientKnobs, c as ClientSpec, d as Factory, g as SendOptions, h as STARTING_POLL, i as ClientJoin, l as ClientStep, n as CheckOptions, o as ClientOptions, r as Client, s as ClientSocket, t as Attempt, u as DialFn, w as Manifestation } from "./core-BSzt4RI2.js";
2
- import { t as CallContext } from "./call-context-DDhcVvn5.js";
3
- import { t as Judge } from "./dial-ChwIcvd4.js";
4
- import { N as Poll, ut as Operation } from "./logger-B6drv9w0.js";
5
- import { n as Clock } from "./clock-DpVgpY4h.js";
6
- import { Extent, Quantity } from "@mark1russell7/quantity";
7
- import { Machine } from "@mark1russell7/algebra";
8
- /** An HTTP socket is the socket of a client in the core: the join of the prober and the bounded close read it. */
9
- type HttpSocket = ClientSocket;
10
- /** An HTTP response is a whole response: its status, its headers, and its whole body. */
11
- interface HttpResponse {
12
- readonly status: number;
13
- /** These are the headers of the response, by their names in lower case, as Node gives them. */
14
- readonly headers: Readonly<Record<string, string | readonly string[] | undefined>>;
15
- readonly body: Buffer;
16
- }
17
- /** An agent request is one request that the wrapper gives the agent. */
18
- interface AgentRequest {
19
- readonly host: string;
20
- readonly port: number;
21
- readonly method: string;
22
- readonly path: string;
23
- readonly headers: Readonly<Record<string, string>>;
24
- readonly body?: Uint8Array | undefined;
25
- }
26
- /**
27
- * These are the events of one request that the wrapper reads. The agent gives each one at most one
28
- * time. `connect` comes only for a new connection. A request on a free socket left the client when it got that socket.
29
- */
30
- interface AgentEvents {
31
- /** The agent gave the request a socket. `reused` is true for a socket from the free list (`req.reusedSocket`). */
32
- socket(socket: HttpSocket, reused: boolean): void;
33
- /** The new socket of the request connected. The request then leaves the client. */
34
- connect(): void;
35
- }
36
- /** An agent exchange is one request in the agent: the promise of its whole response, and the abort that destroys its socket. */
37
- interface AgentExchange {
38
- /** This promise resolves with the whole response, or rejects with the error of the request, the socket or the body. */
39
- readonly response: Promise<HttpResponse>;
40
- /** This method destroys the request and its socket. A request that waits for a socket leaves the queue of the agent. */
41
- abort(error: Error): void;
42
- }
43
- /**
44
- * An agent is the part of an `http.Agent` of Node that the wrapper uses, with `http.request` on it.
45
- * A fake for tests has each part too. Thus the wrapper does not load node:http until it connects.
46
- */
47
- interface HttpAgent {
48
- /** This method sends one request on the agent. */
49
- request(request: AgentRequest, events: AgentEvents): AgentExchange;
50
- /** This method gives each socket of the agent that is open: the busy ones and the free ones. */
51
- sockets(): readonly HttpSocket[];
52
- /** This method destroys each socket of the agent. A request on a socket then fails. */
53
- destroy(): void;
54
- }
55
- /**
56
- * These are the options that the wrapper gives `new http.Agent`. Each one comes from the declaration.
57
- * The wrapper sets each option that has an effect on a timer, thus no default of Node decides one.
58
- */
59
- interface HttpAgentOptions {
60
- readonly keepAlive: true;
61
- /**
62
- * This time is the free socket timer (`timeout`). The agent closes a free socket at the smaller of
63
- * this time and the hint of the server less `agentKeepAliveTimeoutBuffer`. 0 is no timer, and then the hint does not apply.
64
- */
65
- readonly timeout: number;
66
- /** This time is subtracted from the hint of the server (`Keep-Alive: timeout=…`). A hint at or below it gives no reuse. */
67
- readonly agentKeepAliveTimeoutBuffer: number;
68
- /** This time is the idle time of TCP keepalive. The agent always turns keepalive on, and Node truncates the time to whole seconds. */
69
- readonly keepAliveMsecs: number;
70
- /** This count is the most sockets for one origin. A request waits in the agent for a socket above it. */
71
- readonly maxSockets: number;
72
- /** This count is the most free sockets for one origin. */
73
- readonly maxFreeSockets: number;
74
- /** The agent gives the socket that was free last, as the global agent does. */
75
- readonly scheduling: "lifo";
76
- }
77
- /** An agent factory makes the agent of the client from its options. */
78
- type AgentFactory = Factory<HttpAgentOptions, HttpAgent>;
79
- /**
80
- * This factory makes an `http.Agent` of Node. It loads node:http only when a client connects.
81
- * Each request goes through `http.request` with the agent. The response settles at the end of its body.
82
- * A body that ends before it is complete rejects the response.
83
- */
84
- export declare const nodeAgent: AgentFactory;
85
- /**
86
- * These are the knobs of the client, each a time, by the names of the ordering law where the law
87
- * has them. The runtime has no defaults, thus each knob is necessary. The constant
88
- * `HTTP_CLIENT_STARTING_KNOBS` gives a declaration from the HTTP cells. The knobs that each client has come from the core.
89
- */
90
- interface HttpClientKnobs extends ClientKnobs {
91
- /** This time bounds the TCP connect of a new socket. The wrapper has this timer, because the agent has none. */
92
- readonly connect_bound: Quantity;
93
- /**
94
- * This time bounds each call: from its start until the end of the body of its response. It also
95
- * bounds the wait for a socket. The wrapper has this timer, because the agent has none.
96
- */
97
- readonly request_timeout: Quantity;
98
- /**
99
- * This time is the free socket timer of the agent (`timeout`). The agent closes a free socket at the
100
- * smaller of this time and the hint of the server less `hint_buffer`. It must be below `server_idle_close` (O01).
101
- */
102
- readonly pool_idle_expiry: Extent;
103
- /** This time is what the agent subtracts from the hint of the server (`agentKeepAliveTimeoutBuffer`). A hint at or below it gives no reuse. */
104
- readonly hint_buffer: Quantity;
105
- /**
106
- * This time is when the server closes an idle connection, after its response. A Node server closes
107
- * at `keepAliveTimeout` plus `keepAliveTimeoutBuffer`. "infinite" is a server that keeps an idle
108
- * connection with no bound. The client does not set it: `problems` compares it with `pool_idle_expiry` (O01).
109
- */
110
- readonly server_idle_close: Extent;
111
- /** This time is the idle time of TCP keepalive (`keepAliveMsecs`), in whole seconds. The agent always turns keepalive on. */
112
- readonly keepalive_idle: Extent;
113
- /** The agent does not replace a connection at an age, thus this knob must be "infinite". */
114
- readonly max_connection_age: Extent;
115
- /** This time bounds the close of the client: the wait for the calls in flight, then a destroy of each socket. */
116
- readonly close_bound: Quantity;
117
- }
118
- /** A check request is the request of the round-trip check, and of the first connection at the connect. */
119
- interface CheckRequest {
120
- readonly method: string;
121
- readonly path: string;
122
- }
123
- /**
124
- * This request asks about the server, not about a resource (RFC 9110 §9.3.7). Thus it changes no
125
- * state. A server that does not route it still answers with a status, and the status tells that it is alive.
126
- */
127
- export declare const OPTIONS_STAR: CheckRequest;
128
- /** An HTTP client spec is the declaration of one HTTP client: the origin that it connects to, its pool, and its knobs. */
129
- interface HttpClientSpec extends ClientSpec<HttpClientKnobs> {
130
- /** This count is the most sockets of the pool (`maxSockets`). It is also the most free sockets. */
131
- readonly pool: {
132
- readonly max: number;
133
- };
134
- /** This request is the request of the round-trip check and of the first connection. Without it, the client uses `OPTIONS *`. */
135
- readonly check?: CheckRequest | undefined;
136
- /**
137
- * These operations add to the table of the client, or change it. The table names each method by
138
- * its idempotency in RFC 9110. A caller can name an operation of its own, for example a POST with an `Idempotency-Key`.
139
- */
140
- readonly operations?: Readonly<Record<string, Operation>> | undefined;
141
- }
142
- /** These options make a client. Without them, it uses the agent of Node, the real clock, and a dial with `OPTIONS *`. */
143
- interface HttpClientOptions extends ClientOptions<AgentFactory> {
144
- /**
145
- * With this call context, each request gets the headers of the active context of its caller, for
146
- * example `traceparent`. A header of the call with the same name stays. `callContext` of the entry `/otel` gives one.
147
- */
148
- readonly callContext?: CallContext | undefined;
149
- }
150
- /** An HTTP call is one request. A string body goes as UTF-8, with its `content-length`. */
151
- interface HttpCall {
152
- readonly method: string;
153
- readonly path: string;
154
- readonly headers?: Readonly<Record<string, string>> | undefined;
155
- readonly body?: string | Uint8Array | undefined;
156
- /** This name is the operation of the call in the table. Without it, the operation is the method. */
157
- readonly operation?: string | undefined;
158
- }
159
- /** An HTTP client is a dependency of a service: its declaration, its handle, its checks and its requests. */
160
- interface HttpClient extends Client<ClientStep, ClientJoin> {
161
- /** This text is the state of the client, as `HTTP_CLIENT_MACHINE` names it. */
162
- readonly status: string;
163
- /**
164
- * This method sends a request, and gives its outcome in three values. A whole response of each
165
- * status is `ok`. The client sends again only an idempotent operation, one time at most, after an
166
- * outcome that is not certain. The second try stays in the bound of the request.
167
- */
168
- request(call: HttpCall, options?: SendOptions): Promise<Sent<HttpResponse>>;
169
- }
170
- /**
171
- * These operations are the methods of HTTP, by their idempotency in RFC 9110 §9.2.2. A second
172
- * request of GET, HEAD, OPTIONS, TRACE, PUT or DELETE has the same effect as one. POST and PATCH do not.
173
- */
174
- export declare const HTTP_OPERATIONS: Readonly<Record<string, Operation>>;
175
- /** This function gives the problems of a spec: the knobs that the agent cannot use. */
176
- export declare const specProblems: (name: string, spec: HttpClientSpec) => string[];
177
- /** This function gives the options of `new http.Agent` from a spec. Each timer of the agent comes from the declaration. */
178
- export declare const agentOptions: (spec: HttpClientSpec) => HttpAgentOptions;
179
- /** This function gives the bytes of the dial: `OPTIONS *` with the Host header, and a close after the answer. */
180
- export declare const optionsRequest: (host: string, port: number) => string;
181
- /** This judge reads the status line of the answer. Any status passes, because it tells that an HTTP server answered. */
182
- export declare const statusJudge: Judge;
183
- /** This dial function opens a TCP connection, sends `OPTIONS *`, and waits for the status line. It changes no state on the server. */
184
- export declare const httpDial: DialFn;
185
- /**
186
- * This function makes an HTTP client, a dependency of a service over an `http.Agent` of Node.
187
- * - It sets each timer of the agent from the declaration. The agent sends no request again by itself,
188
- * and the client sends again only an idempotent operation of its table.
189
- * - Its call is a request until the end of the body of its response. The wrapper has a timer for the
190
- * connect and one for the call, because the agent has none.
191
- * - It tells the outcome of a call in three values. A request that did not get a connected socket
192
- * did not leave the client. A failure after that is not certain.
193
- * - It destroys the socket of each call that is not `ok`, thus no later request gets that socket.
194
- * - It records each new socket of the pool (D1). HTTP gives no id of a connection.
195
- *
196
- * The core of the clients gives the outcomes, the second try, the calls in flight and the timer of a
197
- * call. It also gives the bounded close and the checks. This entry gives what the agent does in its own way.
198
- */
199
- export declare const httpClient: (name: string, spec: HttpClientSpec, options?: HttpClientOptions) => HttpClient;
200
- /**
201
- * The HTTP client of the service as a `mark1russell7.machine/1` document. It is the agent as the
202
- * wrapper sees it, not one socket: the document `node-http-agent` of `@mark1russell7/machines`
203
- * gives each socket of the agent. The state is the outcome of the last connect of a socket:
204
- * - `ready`: the last connect succeeded.
205
- * - `failing`: the last connect failed, or did not end in connect_bound. The agent does not connect
206
- * again by itself. The next request tries again.
207
- *
208
- * A free socket that the agent closes does not change the state. A request on a reused socket that
209
- * fails records `reuse.failed`, and the state stays. A test records the transitions of the client
210
- * and replays them against this document.
211
- */
212
- export declare const HTTP_CLIENT_MACHINE: Machine;
213
- /**
214
- * This function gives the manifestations that an HTTP client can meet, and the detectors of each,
215
- * from its knobs. The HTTP cells measured them on the agent of Node 24.21.0:
216
- * - The agent has no timer of a call, thus the timer of the wrapper finds each silent call in flight.
217
- * - The free socket timer closes an idle socket at `pool_idle_expiry` at most. Thus no request goes
218
- * later on a socket that went silent while it was free.
219
- * - A FIN on a busy socket fails the call with "socket hang up". A FIN on a free socket destroys it.
220
- */
221
- export declare const httpClientMeetings: (name: string, knobs: HttpClientKnobs) => Meeting[];
222
- /**
223
- * This poll is the poll of the checks that `HTTP_CLIENT_STARTING_KNOBS` fits. It is `STARTING_POLL` of
224
- * the core: each 5 s with a jitter of 20 %, and a timeout of 4 s (B6, O12). The poll does not depend on the driver.
225
- */
226
- export declare const HTTP_CLIENT_STARTING_POLL: Poll;
227
- /**
228
- * These knobs are a declaration to start from. They come from what the HTTP cells measured on the
229
- * agent of Node 24.21.0 against a Node server at its defaults. The runtime has no defaults: a service gives
230
- * these knobs, or its own. Each value holds the borders that the cells measured:
231
- * - `connect_bound` 5 s: the connect timeout of DP44. The agent has no connect timer.
232
- * - `request_timeout` 9.5 s: in the slowest poll of 10 s (O13). The agent has no timer of a call.
233
- * A frozen server held the call of undici until its headersTimeout, at 10.187 s.
234
- * - `pool_idle_expiry` 4 s: the free socket timer. The agent then closes a free socket at 4 s, the
235
- * hint of 5 s less `hint_buffer`. That is below the idle close of the server.
236
- * - `hint_buffer` 1 s: the default of the agent.
237
- * - `server_idle_close` 6 s: a Node server closes an idle connection at its `keepAliveTimeout` of 5 s
238
- * plus its buffer of 1 s. The cells measured 6.0003 s. O01 then has a margin of 2 s.
239
- * - `keepalive_idle` 1 s: the default of the agent. Node truncates it to whole seconds.
240
- * - `max_connection_age` "infinite": the agent does not replace a connection at an age.
241
- * - `close_bound` 2 s: a call in flight behind a black hole holds its socket with no bound.
242
- * - `retrans_giveup_time` 924.6 s: the give-up of Linux at `tcp_retries2 = 15`.
243
- */
244
- export declare const HTTP_CLIENT_STARTING_KNOBS: HttpClientKnobs;
245
- /**
246
- * These are the knobs of the session check of an HTTP/2 client. They have the names and the units of
247
- * the gRPC client, because the check is the same PING. The grpc-js driver ends its transport at the first PING with no ACK.
248
- */
249
- interface SessionCheckKnobs {
250
- /**
251
- * This time is the quiet interval of a session. A tick comes at each interval, and it sends a PING
252
- * when the session heard nothing since the last tick. "infinite" sends no PING.
253
- */
254
- readonly keepalive_time: Extent;
255
- /** This time bounds the ACK of each PING. With no ACK in it, the check closes the session. */
256
- readonly keepalive_timeout: Quantity;
257
- }
258
- /**
259
- * A session is the part of an HTTP/2 session that the check uses. A `ClientHttp2Session` of
260
- * `node:http2` has each member, thus the check does not load `node:http2`.
261
- */
262
- interface H2Session {
263
- /** This flag is true until the socket of the session connects. */
264
- readonly connecting: boolean;
265
- /** This method sends a PING. The callback gets null at the ACK, and an error otherwise. It gives false when the PING did not go. */
266
- ping(callback: (error: Error | null) => void): boolean;
267
- /** This method ends the session and each stream on it at once. */
268
- destroy(error?: Error): void;
269
- }
270
- /** A close is the part of the check that closed the session. */
271
- type SessionClose = "stream timeout" | "no PING answer";
272
- /** These options make a session check. */
273
- interface SessionCheckOptions {
274
- readonly knobs: SessionCheckKnobs;
275
- /**
276
- * True lets a quiet session with no stream get a PING, as the option of the gRPC client does.
277
- * The default is false: a server can refuse a PING with no stream (O26).
278
- */
279
- readonly keepaliveWithoutCalls?: boolean | undefined;
280
- /** This clock gives the ticks and the timeouts. The default is `realClock`. */
281
- readonly clock?: Clock | undefined;
282
- /** This function receives the close of the session by the check, with its cause. */
283
- readonly onClose?: ((cause: SessionClose) => void) | undefined;
284
- }
285
- /**
286
- * A session check closes an HTTP/2 session that stopped answering. The caller tells it of each
287
- * stream and of each frame from the peer. The next stream of the caller then opens a new session.
288
- */
289
- interface SessionCheck {
290
- /** This method tells the check that a stream started on the session. */
291
- opened(): void;
292
- /** This method tells the check that a stream ended with an answer or an error. */
293
- ended(): void;
294
- /** This method tells the check that a stream ended at its timeout. The check then closes the session. */
295
- timedOut(): void;
296
- /** This method tells the check that a frame came from the peer, for example a response or the SETTINGS of the peer. */
297
- heard(): void;
298
- /** This method stops the check, and the session stays. A second use does nothing. */
299
- stop(): void;
300
- /** This count is the streams in flight on the session. */
301
- readonly streams: number;
302
- /** This cause is why the check closed the session, or null while it did not. */
303
- readonly closed: SessionClose | null;
304
- }
305
- /** This code is on the error that ends each stream of a session that the check closes. */
306
- export declare const SESSION_CHECK_CLOSE = "ERR_SESSION_CHECK";
307
- /**
308
- * This function starts the check of one HTTP/2 session. It has two parts:
309
- * - A stream that times out closes its session, and not only the stream. On HTTP/1.1, a request
310
- * that times out destroys its socket. On HTTP/2, the session is the connection.
311
- * - The heartbeat of the package sends a PING after a quiet interval. With no ACK in
312
- * `keepalive_timeout`, it closes the session.
313
- *
314
- * A session that has not connected cannot answer a PING. Thus its tick waits for the SETTINGS of the
315
- * peer through `heard()`, in `keepalive_timeout`.
316
- */
317
- export declare const sessionCheck: (session: H2Session, options: SessionCheckOptions) => SessionCheck;
318
- /**
319
- * This function gives the most time from the last frame of the peer to the close of a session by the
320
- * PING. The first quiet tick comes up to two intervals after that frame, and its PING then waits
321
- * `keepalive_timeout`. "infinite" is a check with no PING. Then only a stream timeout closes the session.
322
- */
323
- export declare const sessionCheckDetection: (knobs: SessionCheckKnobs) => Extent;
324
- /**
325
- * This function gives the problems of the knobs of a session check. Each knob is a time of zero or
326
- * more. `keepalive_time` is "infinite" for no PING, and not zero. `keepalive_timeout` is a finite time
327
- * above zero, because the check is the only bound of the PING.
328
- */
329
- export declare const sessionCheckProblems: (name: string, knobs: SessionCheckKnobs) => string[];
330
- export { type AgentEvents, type AgentExchange, type AgentFactory, type AgentRequest, type Attempt, type CheckOptions, type CheckRequest, type Client, type ClientJoin, type ClientKnobs, type ClientOptions, type ClientSocket, type ClientSpec, type ClientStep, type Detector, type DialFn, type Factory, type H2Session, type HttpAgent, type HttpAgentOptions, type HttpCall, type HttpClient, type HttpClientKnobs, type HttpClientOptions, type HttpClientSpec, type HttpResponse, type HttpSocket, MANIFESTATIONS, type Manifestation, type Meeting, STARTING_POLL, type SendOptions, type Sent, type SessionCheck, type SessionCheckKnobs, type SessionCheckOptions, type SessionClose, type Situation, firstDetector, unwatched };
1
+ import { Attempt, CheckOptions, Client, ClientJoin, ClientKnobs, ClientOptions, ClientSocket, ClientSpec, ClientStep, DialFn, Factory, STARTING_POLL, SendOptions, Sent } from "./client/core.js";
2
+ import { Detector, MANIFESTATIONS, Manifestation, Meeting, Situation, firstDetector, unwatched } from "./client/meets.js";
3
+ import { CheckRequest, HTTP_OPERATIONS, HttpCall, HttpClient, HttpClientKnobs, HttpClientOptions, HttpClientSpec, OPTIONS_STAR, agentOptions, httpClient, httpDial, optionsRequest, specProblems, statusJudge } from "./http-client/client.js";
4
+ import { AgentEvents, AgentExchange, AgentFactory, AgentRequest, HttpAgent, HttpAgentOptions, HttpResponse, HttpSocket, nodeAgent } from "./http-client/connection.js";
5
+ import { HTTP_CLIENT_MACHINE } from "./http-client/machine.js";
6
+ import { httpClientMeetings } from "./http-client/meets.js";
7
+ import { HTTP_CLIENT_STARTING_KNOBS, HTTP_CLIENT_STARTING_POLL } from "./http-client/starting.js";
8
+ import { H2Session, SESSION_CHECK_CLOSE, SessionCheck, SessionCheckKnobs, SessionCheckOptions, SessionClose, sessionCheck, sessionCheckDetection, sessionCheckProblems } from "./http-client/session.js";
9
+ export { type AgentEvents, type AgentExchange, type AgentFactory, type AgentRequest, type Attempt, type CheckOptions, type CheckRequest, type Client, type ClientJoin, type ClientKnobs, type ClientOptions, type ClientSocket, type ClientSpec, type ClientStep, type Detector, type DialFn, type Factory, type H2Session, HTTP_CLIENT_MACHINE, HTTP_CLIENT_STARTING_KNOBS, HTTP_CLIENT_STARTING_POLL, HTTP_OPERATIONS, type HttpAgent, type HttpAgentOptions, type HttpCall, type HttpClient, type HttpClientKnobs, type HttpClientOptions, type HttpClientSpec, type HttpResponse, type HttpSocket, MANIFESTATIONS, type Manifestation, type Meeting, OPTIONS_STAR, SESSION_CHECK_CLOSE, STARTING_POLL, type SendOptions, type Sent, type SessionCheck, type SessionCheckKnobs, type SessionCheckOptions, type SessionClose, type Situation, agentOptions, firstDetector, httpClient, httpClientMeetings, httpDial, nodeAgent, optionsRequest, sessionCheck, sessionCheckDetection, sessionCheckProblems, specProblems, statusJudge, unwatched };