@mark1russell7/service 0.6.2 → 0.6.3

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 (42) hide show
  1. package/README.md +88 -2
  2. package/build/{builder-0OlfomVU.d.ts → builder-bXJqMe2p.d.ts} +3 -2
  3. package/build/{core-Iy9rIXOT.d.ts → core-B1zbS4WY.d.ts} +4 -3
  4. package/build/{dial-DLT7bTlA.d.ts → dial-CSGKVlZe.d.ts} +2 -2
  5. package/build/grpc.d.ts +3 -3
  6. package/build/grpc.js +1 -1
  7. package/build/host.d.ts +556 -0
  8. package/build/host.js +1738 -0
  9. package/build/host.js.map +1 -0
  10. package/build/http-client.d.ts +3 -3
  11. package/build/http-client.js +1 -1
  12. package/build/http.d.ts +1 -1
  13. package/build/index.d.ts +4 -3
  14. package/build/index.js +3 -169
  15. package/build/index.js.map +1 -1
  16. package/build/lifecycle-Ks9Yd5CM.d.ts +387 -0
  17. package/build/{lifecycle-DXK880vG.d.ts → logger-DhFgh48y.d.ts} +2 -385
  18. package/build/{machine-Dq2OlzCG.js → machine-DKWLZOqu.js} +3 -2
  19. package/build/{machine-Dq2OlzCG.js.map → machine-DKWLZOqu.js.map} +1 -1
  20. package/build/mongodb.d.ts +3 -3
  21. package/build/mongodb.js +1 -1
  22. package/build/operation-DL5RxFds.js +25 -0
  23. package/build/operation-DL5RxFds.js.map +1 -0
  24. package/build/pg.d.ts +2 -2
  25. package/build/pg.js +1 -1
  26. package/build/ports-CZLzYK5d.d.ts +125 -0
  27. package/build/process-DG_im2zc.js +171 -0
  28. package/build/process-DG_im2zc.js.map +1 -0
  29. package/build/{queue-CvBNNZZJ.d.ts → queue-BjiGodqh.d.ts} +3 -2
  30. package/build/rabbitmq.d.ts +4 -4
  31. package/build/rabbitmq.js +1 -1
  32. package/build/redis.d.ts +2 -2
  33. package/build/redis.js +1 -1
  34. package/build/{retrier-CRda6z9G.js → retrier-Bzkme_yM.js} +2 -24
  35. package/build/retrier-Bzkme_yM.js.map +1 -0
  36. package/build/testing.d.ts +84 -3
  37. package/build/testing.js +226 -1
  38. package/build/testing.js.map +1 -1
  39. package/build/websocket.d.ts +3 -3
  40. package/build/websocket.js +1 -1
  41. package/package.json +5 -1
  42. package/build/retrier-CRda6z9G.js.map +0 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A service that you declare as data before it starts. You compose it with plain calls: its dependencies, its checks, its policies and its shutdown. `describe()` gives the whole graph as data, and it starts nothing. `lint()` then applies the timer-ordering law to that graph. `start()` gives the graph to the health runtime, and `run()` starts the whole lifecycle.
4
4
 
5
- This release has the declaration, its export, the law, the health runtime, the lifecycle and the edge of a service in Node (`@mark1russell7/service/http`). The wrappers of the clients come in a later release.
5
+ This release has the declaration, its export, the law, the health runtime, the lifecycle and the edge of a service in Node (`@mark1russell7/service/http`). It also has the host of a program in Node (`@mark1russell7/service/host`). The wrappers of the clients come in a later release.
6
6
 
7
7
  ## What the package does
8
8
 
@@ -538,6 +538,89 @@ app.controller("orders").requires("db").route("POST /orders", { idempotent: fals
538
538
  const life = await app.run(); // the process exits after SIGTERM, with 0 or 1
539
539
  ```
540
540
 
541
+ ## The host
542
+
543
+ `@mark1russell7/service/host` keeps programs alive on one computer, without a container platform. It installs a Windows scheduled task or a systemd user unit. A group supervisor then starts each program in sequence and starts it again after it stops. Of the modules of Node, the entry imports only `node:child_process`, `node:fs/promises`, `node:net`, `node:os` and `node:path`. The root of the package does not import it.
544
+
545
+ Each effect goes through a port (`HostPorts`): the commands, the files, the processes, the network and the clock. `nodeHostPorts()` gives the ports of Node. A test gives `fakeHost()` from the testing subpath, thus it starts no process and installs no task.
546
+
547
+ | Export | Function |
548
+ | --- | --- |
549
+ | `installService(spec, ports, { start })` | Writes the task or the unit, and registers it with `schtasks` or `systemctl --user` |
550
+ | `uninstallService`, `startService`, `stopService` | Remove, start and stop the task or the unit |
551
+ | `serviceStatus(spec, ports, { discovery })` | The state of the task or the unit, and the record of its instance |
552
+ | `renderTaskXml`, `renderSystemdUnit`, `renderSystemdTimer` | The task and the units as text, with no effect |
553
+ | `superviseGroup(spec, ports, options)` | The supervisor of a group of programs |
554
+ | `startOrder`, `groupProblems` | The start sequence of a group, and the problems of its spec |
555
+ | `acquireInstanceLock`, `inspectInstanceLock` | The lock of one instance: a file with the process ID and its start time |
556
+ | `writeDiscovery`, `readDiscovery`, `removeDiscovery` | The discovery file: the process ID, the port, the address and the start time |
557
+ | `stopTree(pid, ports)` | The stop of a process tree by its process ID |
558
+ | `probeOnce`, `parseEnvFile`, `rotatingLog` | A ready probe, an env file and a log file with rotation |
559
+
560
+ - **The task.** On Windows, `installService` writes the XML of a scheduled task and gives it to `schtasks /Create`. The task starts at logon or each day, as the user, without a window. It starts the program again after a failure.
561
+ - **The unit.** On Linux, `installService` writes a systemd user unit in `$XDG_CONFIG_HOME/systemd/user` and enables it. A daily start also gets a timer. Other platforms get `unsupported`, and nothing changes.
562
+ - **The outcomes.** Each operation gives data, not a throw: `done`, `failed` with each command and its output, `refused` with the problems of the spec, or `unsupported`.
563
+ - **The lock.** The lock file has the process ID and its start time. Thus a new process with the same ID does not hold the lock. A lock whose process stopped is stale, and the next take removes it.
564
+ - **The discovery file.** A client reads the port and the address of a running instance from it. `readDiscovery` tells `running`, `absent`, `stale` or `malformed`, and it does not throw.
565
+ - **The sequence of a group.** A program starts when each program of its `after` is ready. A ready probe is an HTTP status, a TCP connection or a command that gives 0. The times of a probe are quantities.
566
+ - **A program that stops.** It starts again after the backoff of its `retrier`. The count of tries goes back to 0 after the program is ready for `resetAfter`. A program also waits until its `after` programs are ready again.
567
+ - **A program that is not ready in its time.** The supervisor stops it after `within`, and starts it again after the backoff. The state of the program tells the reason.
568
+ - **One instance of each program.** Each program has its own lock. The supervisor holds the lock for its child, thus a second supervisor of the same group gets `held` and starts nothing.
569
+ - **The files of a program.** Its output goes to `<stateDir>/logs/<name>.log`, which rotates at its size. Its environment is the host, then its env file, then its `env`. It also gets its own `cwd`.
570
+ - **The staged stop.** The supervisor stops the programs in the reverse sequence. A program with an IPC channel gets the message `"shutdown"`, which `svc.trigger("ipc-message", …)` matches. Else Linux sends SIGTERM, and Windows starts `taskkill /T /PID` without `/F`.
571
+ - **The stop of the tree.** After the grace, Windows starts `taskkill /T /F /PID <pid>`. Linux sends SIGKILL to the process group of the child. The host does not stop a process by its name or its command line at any time.
572
+
573
+ ```ts
574
+ // group.js: the logon task starts this supervisor as the user
575
+ import { daemon, service } from "@mark1russell7/service";
576
+ import { nodeHostPorts, superviseGroup } from "@mark1russell7/service/host";
577
+
578
+ const s = (value: number) => ({ value, unit: "s" });
579
+ const ms = (value: number) => ({ value, unit: "ms" });
580
+ const group = superviseGroup(
581
+ {
582
+ name: "stack",
583
+ stateDir: "/var/lib/stack",
584
+ programs: [
585
+ { name: "db", program: "/usr/bin/db", ready: { probe: { kind: "tcp", port: 5432 }, interval: ms(500), timeout: ms(250), within: s(30) } },
586
+ {
587
+ name: "api",
588
+ program: process.execPath,
589
+ args: ["api.js"],
590
+ cwd: "/srv/api",
591
+ envFile: "/var/lib/stack/api.env",
592
+ after: ["db"],
593
+ ipc: true,
594
+ ready: { probe: { kind: "http", url: "http://127.0.0.1:8080/health" }, interval: ms(500), timeout: ms(250), within: s(30) },
595
+ listen: { port: 8080, url: "http://127.0.0.1:8080/" },
596
+ },
597
+ ],
598
+ },
599
+ nodeHostPorts(),
600
+ );
601
+
602
+ const host = service("stack")
603
+ .profile(daemon)
604
+ .dependency("group", { system: null, knobs: {}, operations: {} }, { connect: () => group.start(), close: () => group.stop() })
605
+ .readiness({ type: "debounce", interval: s(5), failAfter: 3, recoverAfter: 1 })
606
+ .liveness({ type: "window", failAfter: s(45) })
607
+ .startup(s(60));
608
+ await host.run();
609
+ ```
610
+
611
+ ```ts
612
+ // install.js: the owner of the computer starts this one time
613
+ import { installService, nodeHostPorts } from "@mark1russell7/service/host";
614
+
615
+ const outcome = await installService(
616
+ { name: "stack", description: "The stack", program: process.execPath, args: ["group.js"], start: "logon", restart: { after: { value: 1, unit: "min" } }, stateDir: "/var/lib/stack" },
617
+ nodeHostPorts(),
618
+ );
619
+ console.log(outcome.kind);
620
+ ```
621
+
622
+ - **The stop of the group.** The phase `tear down dependencies` caps `group.stop()`. Give that phase a cap above the sum of the graces of the programs.
623
+
541
624
  ## The testing subpath
542
625
 
543
626
  `@mark1russell7/service/testing` has the seams that a test of a service needs:
@@ -548,6 +631,7 @@ const life = await app.run(); // the process exits after SIGTERM, with 0 or 1
548
631
  - `scriptedCheck(behavior)` gives a check whose behavior a test sets: `"ok"`, `"error"`, `"indeterminate"`, `"throw"`, `"timeout"` or `"hang"`.
549
632
  - `quietServer()` starts a TCP echo server that can go quiet. Its connections stay open while it is quiet, as with a frozen peer.
550
633
  - `detachedLifecycle()` gives a lifecycle with no service, for the start of a transport in a test.
634
+ - `fakeHost(options)` gives the ports of the host entry on a fake clock, a fake file system and fake processes. It records each command and each signal. A test ends a child with `exit(code)`, and `polite` makes each child obey a staged stop.
551
635
  - `transportConformance(make, options)` generates the conformance test of a transport. `make` gives a subject: the transport, a way to offer new work and a way to hold work in flight. The cases check that `stopIntake` refuses new work, and that the count is correct and comes from events. They also check that `drain` holds to its deadline and gives the cooperative abort, and that `close` is idempotent and bounded. The fake clock makes the cases fast, and the real clock measures them.
552
636
  - `contractCases(declare)` generates the contract test of a declaration. The cases are the service at rest, each dependency unavailable, each dependency degraded by 100 ms, each recovery, and a negative control. A dependency that no check exercises is a finding, and so is a check whose timeout a latency of 100 ms fails.
553
637
 
@@ -799,7 +883,7 @@ for await (const event of stream) {
799
883
  - **The gRPC client.** These tests use a fake channel and a fake clock. They cover the declaration, the outcome of each status code, the methods that the client sends again or not, the keepalive and the IDLE channel. They also cover a GOAWAY, the close, the checks and the manifestations. Seven scenarios replay against the document of the client. One test sends calls through grpc-js to a server of the loopback.
800
884
  - **F6 for Redis.** The fault matrix crosses each manifestation (a refusal, a frozen process, a black hole, a death without a close, and an app stall), each gating posture, two timings and two jitters. That is 60 cases on the fake. Each case holds the trip and the release of its policy to `failSpan` and `recoverSpan`. Five more cases shut the service down during each manifestation, and each one exits 0.
801
885
  - **The timers.** These tests use a fake clock, and they cover the hooks of the heartbeat and its two kinds of ping. A property test holds the death of a silent peer to `detectionTime` in 300 seeded cases. Another one compares the heartbeat with a WebSocket heartbeat that sends one ping at a time, on 300 schedules of pongs. The backoff gives the delays of three earlier backoffs, number for number, and each delay is in its band.
802
- - **The entries.** The timer entries reach no other package, no `node:` module and no zod. No entry of the service reaches zod, also through `quantity` and the replay of the algebra. The root reaches no `node:` module. The HTTP edge reaches only `node:http`, `node:net` and `quantity`. The worker loop and the queue drain reach only `quantity`.
886
+ - **The entries.** The timer entries reach no other package, no `node:` module and no zod. No entry of the service reaches zod, also through `quantity` and the replay of the algebra. The root reaches no `node:` module. The HTTP edge reaches only `node:http`, `node:net` and `quantity`. The worker loop and the queue drain reach only `quantity`. The host reaches only `quantity` and five `node:` modules, and it loads none of its fakes.
803
887
  - **The requests.** A unary work is a stream of one item, and a stream gives each item when its reader asks. The drain waits for an open stream. The cooperative abort ends a stream through `return()`, and a cut or a failure after the first item ends in-band. A reader that stops early stops the work. The function of a route pattern decides the answer of each cut request.
804
888
  - **The options of the runner.** These tests cover the requests of a transport while the startup runs, the policy of a repeat signal, the profiles and the process triggers. They also cover the exit codes, a first Ctrl-C that aborts at once, and the flush of the output.
805
889
  - **The composition.** Two components, each with a transport, a dependency and a check, share one service and one `run()`. The parts start and stop in their sequence, and the process exits one time.
@@ -813,6 +897,8 @@ for await (const event of stream) {
813
897
  - **The worker loop.** These tests use the fake clock. They cover the sleep, `"more"`, the backoff and its jitter, `wake()`, the stop of the intake and the drain with its cooperative abort. They also cover the bound of an iteration, the lanes, the setup, the teardown, the close bound and the law (O20).
814
898
  - **The queue drain.** These tests cover the slots, the poll, the policy of A11 and the count of deliveries. They also cover a job that goes back at the stop, an async iterable and a failed take. A cut job of each kind of route, the close bound and the refusals of the service have tests too.
815
899
  - **The conformance of the helpers.** The worker loop passes each case of the kit with three lanes, and the queue drain with three slots. Each one passes with the request tracking and without it. With one lane, the loop passes each case that holds one work.
900
+ - **The host.** These tests use `fakeHost()`, thus they start no process and install no task. They cover the text of the task and the units, each command of each operation, and the lock with its stale recovery. They also cover the discovery file, the probes, the env file and the rotation of the log.
901
+ - **The group supervisor.** These tests cover the start sequence with its probes, the environment, the logs, and the lock of each program. They also cover the backoff and its reset, a restart that waits for its programs, and the deadline of a probe. Each stage of the stop has tests on Linux and on Windows.
816
902
  - **The IPC message.** A message that matches a declared shape starts the staged shutdown on the fake process, with the exit code of its signal. A second message obeys the policy of a repeat signal.
817
903
  - **On real sockets.** `HTTP_IT=1` starts the tests of the HTTP edge on the loopback. They cover the conformance on the fake clock and on the real clock, keep-alive and the stop of the intake. They also cover the upgrades, the probe server and a service after SIGTERM. They measure time, thus only CI starts them (`http.yml`), on Node 22.19, 24 and 26. CI keeps the raw records of each job as an artifact.
818
904
  - **On the real clock.** `WORKERS_IT=1` starts the kit of the worker loop and of the queue drain on the real clock, in the jobs of `http.yml`.
@@ -1,6 +1,7 @@
1
1
  import { n as Clock } from "./clock-mVqhXD0b.js";
2
2
  import { c as LimiterSpec } from "./policy-G4QJ1ZZq.js";
3
- import { D as CheckFn, E as StartOptions, Gt as Operation, J as Trace, K as Outcome, Ot as ExitTrigger, Pt as ProcessTrigger, Q as Check, S as Health, St as OperationOf, at as Gate, d as TransportImpl, et as CooperativeFloor, gt as Timing, lt as RepeatSignal, mt as Poll, n as HealthServer, nt as Dependency, o as PhaseWork, ot as MessageTrigger, r as Lifecycle, rt as ExitCodes, s as RunOptions, st as Phase, t as DependencyHandle, tt as Coupling, ut as ServiceDescription } from "./lifecycle-DXK880vG.js";
3
+ import { C as MessageTrigger, D as ServiceDescription, E as RepeatSignal, G as ExitTrigger, N as Timing, S as Gate, Z as ProcessTrigger, _ as CooperativeFloor, b as ExitCodes, ct as Operation, h as Check, j as Poll, v as Coupling, w as Phase, y as Dependency, z as OperationOf } from "./logger-DhFgh48y.js";
4
+ import { D as CheckFn, E as StartOptions, F as Outcome, L as Trace, S as Health, d as TransportImpl, n as HealthServer, o as PhaseWork, r as Lifecycle, s as RunOptions, t as DependencyHandle } from "./lifecycle-Ks9Yd5CM.js";
4
5
  import { Extent, Quantity } from "@mark1russell7/quantity";
5
6
  //#region src/profiles.d.ts
6
7
  /**
@@ -208,4 +209,4 @@ interface ServiceBuilder {
208
209
  declare const service: (name: string) => ServiceBuilder;
209
210
  //#endregion
210
211
  export { WatchdogSpec as a, Profile as c, kubernetes as d, localDev as f, Watchdog as i, daemon as l, ServiceBuilder as n, watchdog as o, service as r, PodTiming as s, ControllerBuilder as t, ephemeral as u };
211
- //# sourceMappingURL=builder-0OlfomVU.d.ts.map
212
+ //# sourceMappingURL=builder-bXJqMe2p.d.ts.map
@@ -1,7 +1,8 @@
1
1
  import { t as Backoff } from "./backoff-B-jGWVDm.js";
2
2
  import { n as Clock } from "./clock-mVqhXD0b.js";
3
- import { D as CheckFn, Gt as Operation, Q as Check, Z as Recorder, at as Gate, dt as Step, mt as Poll, nt as Dependency, t as DependencyHandle, ut as ServiceDescription } from "./lifecycle-DXK880vG.js";
4
- import { n as ServiceBuilder } from "./builder-0OlfomVU.js";
3
+ import { D as ServiceDescription, O as Step, S as Gate, ct as Operation, h as Check, j as Poll, m as Recorder, y as Dependency } from "./logger-DhFgh48y.js";
4
+ import { D as CheckFn, t as DependencyHandle } from "./lifecycle-Ks9Yd5CM.js";
5
+ import { n as ServiceBuilder } from "./builder-bXJqMe2p.js";
5
6
  import { Extent, Quantity } from "@mark1russell7/quantity";
6
7
  //#region src/client/meets.d.ts
7
8
  /** A situation is what the connection did when the failure started: a command in flight, or idle. */
@@ -230,4 +231,4 @@ declare const retryProblems: (name: string, knobs: RetryKnobs) => string[];
230
231
  declare const STARTING_POLL: Poll;
231
232
  //#endregion
232
233
  export { MANIFESTATIONS as C, firstDetector as D, Situation as E, unwatched as O, Detector as S, Meeting as T, Sent as _, ClientKnobs as a, retryProblems as b, ClientSpec as c, Factory as d, ReadyWait as f, SendOptions as g, STARTING_POLL as h, ClientJoin as i, ClientStep as l, RetrySchedule as m, CheckOptions as n, ClientOptions as o, RetryKnobs as p, Client as r, ClientSocket as s, Attempt as t, DialFn as u, readyWait as v, Manifestation as w, retrySchedule as x, retryBackoff as y };
233
- //# sourceMappingURL=core-Iy9rIXOT.d.ts.map
234
+ //# sourceMappingURL=core-B1zbS4WY.d.ts.map
@@ -1,4 +1,4 @@
1
- import "./core-Iy9rIXOT.js";
1
+ import "./core-B1zbS4WY.js";
2
2
  //#region src/client/dial.d.ts
3
3
  /**
4
4
  * A judge reads the bytes that the server sent so far. It gives null for a good answer, an error for
@@ -13,4 +13,4 @@ type Judge = (received: Buffer) => Error | null | "more";
13
13
  declare const statusLineJudge: (accept: (status: number, line: string) => Error | null) => Judge;
14
14
  //#endregion
15
15
  export { statusLineJudge as n, Judge as t };
16
- //# sourceMappingURL=dial-DLT7bTlA.d.ts.map
16
+ //# sourceMappingURL=dial-CSGKVlZe.d.ts.map
package/build/grpc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Gt as Operation, mt as Poll } from "./lifecycle-DXK880vG.js";
2
- import { C as MANIFESTATIONS, D as firstDetector, E as Situation, O as unwatched, S as Detector, T as Meeting, _ as Sent, a as ClientKnobs, b as retryProblems, c as ClientSpec, d as Factory, f as ReadyWait, g as SendOptions, h as STARTING_POLL, i as ClientJoin, l as ClientStep, n as CheckOptions, o as ClientOptions, p as RetryKnobs, r as Client, s as ClientSocket, t as Attempt, u as DialFn, v as readyWait, w as Manifestation } from "./core-Iy9rIXOT.js";
3
- import { t as Judge } from "./dial-DLT7bTlA.js";
1
+ import { ct as Operation, j as Poll } from "./logger-DhFgh48y.js";
2
+ import { C as MANIFESTATIONS, D as firstDetector, E as Situation, O as unwatched, S as Detector, T as Meeting, _ as Sent, a as ClientKnobs, b as retryProblems, c as ClientSpec, d as Factory, f as ReadyWait, g as SendOptions, h as STARTING_POLL, i as ClientJoin, l as ClientStep, n as CheckOptions, o as ClientOptions, p as RetryKnobs, r as Client, s as ClientSocket, t as Attempt, u as DialFn, v as readyWait, w as Manifestation } from "./core-B1zbS4WY.js";
3
+ import { t as Judge } from "./dial-CSGKVlZe.js";
4
4
  import { Extent, Quantity } from "@mark1russell7/quantity";
5
5
  import { Machine } from "@mark1russell7/algebra";
6
6
  //#region src/grpc/connection.d.ts
package/build/grpc.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { realClock } from "./clock.js";
2
2
  import { i as heartbeatDetection } from "./timing-DGRi3XCI.js";
3
- import { B as zeroProblems, C as notSent, D as readyWait, F as timeProblems, G as immediate, H as NEVER, L as wholeProblems, M as sendWithReissue, N as socketEnds, P as stepChecks, R as withinBound, S as ms, U as WHAT, V as MANIFESTATIONS, W as firstDetector, X as unwatched, Y as kernelGiveUp, _ as inFlight, a as helloDial, b as message, c as ageProblems, d as clientProblems, f as clientRecorder, g as idleCloseProblem, h as finiteMs, i as authority, j as roundTripCheck, k as retryProblems, l as attachClient, m as dialCheck, n as closeTimer, r as transition, s as STARTING_POLL, t as clientKnob, u as clientBounds, w as operationTable, y as localStateCheck, z as wrapperTimerProblems } from "./machine-Dq2OlzCG.js";
3
+ import { B as zeroProblems, C as notSent, D as readyWait, F as timeProblems, G as immediate, H as NEVER, L as wholeProblems, M as sendWithReissue, N as socketEnds, P as stepChecks, R as withinBound, S as ms, U as WHAT, V as MANIFESTATIONS, W as firstDetector, X as unwatched, Y as kernelGiveUp, _ as inFlight, a as helloDial, b as message, c as ageProblems, d as clientProblems, f as clientRecorder, g as idleCloseProblem, h as finiteMs, i as authority, j as roundTripCheck, k as retryProblems, l as attachClient, m as dialCheck, n as closeTimer, r as transition, s as STARTING_POLL, t as clientKnob, u as clientBounds, w as operationTable, y as localStateCheck, z as wrapperTimerProblems } from "./machine-DKWLZOqu.js";
4
4
  //#region src/grpc/connection.ts
5
5
  /** These states are in the sequence of the enum of grpc-js: the index of a state is its value. */
6
6
  const GRPC_STATES = [