@procedures/server 0.2.3 → 0.4.0

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 (46) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +18 -1
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/index.d.ts +6 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +7 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/module.d.ts +24 -0
  9. package/dist/module.d.ts.map +1 -0
  10. package/dist/module.js +29 -0
  11. package/dist/module.js.map +1 -0
  12. package/dist/procedures/server.start.d.ts +17 -0
  13. package/dist/procedures/server.start.d.ts.map +1 -0
  14. package/dist/procedures/server.start.js +183 -0
  15. package/dist/procedures/server.start.js.map +1 -0
  16. package/dist/procedures/server.status.d.ts +15 -0
  17. package/dist/procedures/server.status.d.ts.map +1 -0
  18. package/dist/procedures/server.status.js +118 -0
  19. package/dist/procedures/server.status.js.map +1 -0
  20. package/dist/procedures/server.stop.d.ts +14 -0
  21. package/dist/procedures/server.stop.d.ts.map +1 -0
  22. package/dist/procedures/server.stop.js +98 -0
  23. package/dist/procedures/server.stop.js.map +1 -0
  24. package/dist/register.d.ts +7 -0
  25. package/dist/register.d.ts.map +1 -0
  26. package/dist/register.js +9 -0
  27. package/dist/register.js.map +1 -0
  28. package/dist/run.d.ts.map +1 -1
  29. package/dist/run.js +18 -3
  30. package/dist/run.js.map +1 -1
  31. package/dist/schemas.d.ts +19 -0
  32. package/dist/schemas.d.ts.map +1 -0
  33. package/dist/schemas.js +48 -0
  34. package/dist/schemas.js.map +1 -0
  35. package/dist/types.d.ts +58 -0
  36. package/dist/types.d.ts.map +1 -1
  37. package/package.json +19 -5
  38. package/src/index.ts +26 -1
  39. package/src/module.ts +33 -0
  40. package/src/procedures/server.start.ts +213 -0
  41. package/src/procedures/server.status.ts +141 -0
  42. package/src/procedures/server.stop.ts +123 -0
  43. package/src/register.ts +11 -0
  44. package/src/run.ts +20 -3
  45. package/src/schemas.ts +69 -0
  46. package/src/types.ts +76 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,75 @@
1
1
  # @procedures/server
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d42d716: `server.start`, `server.stop` and `server.status` moved from `@procedures/peer` to `@procedures/server`, the package of the host. Their names, schemas and effects stay the same. They manage the background server of the `mark` CLI.
8
+
9
+ In this version, `@procedures/server` has a `./module` entry, a `./register` entry and the `client.procedures` field, so `mark server start`, `mark server stop` and `mark server status` keep working. The registry of `procedure-server` and `mark serve` has the module of the peer package and the module of the server package, as before.
10
+
11
+ The module of `@procedures/peer` does not register the three procedures any more, and `@procedures/peer/procedures` does not export them. The lockfiles stay in `@procedures/peer/lockfile`.
12
+
13
+ `connect()` of `@procedures/peer` takes `WebSocketTransport` from `@procedures/client/node`, not from the root of `@procedures/client`. Thus a peer connection in Node uses the `WebSocket` class of `ws`, and a drop ends the socket at once with `terminate()`.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [d919678]
18
+ - Updated dependencies [057d69a]
19
+ - Updated dependencies [b2a1a1e]
20
+ - Updated dependencies [057d69a]
21
+ - Updated dependencies [057d69a]
22
+ - Updated dependencies [057d69a]
23
+ - Updated dependencies [057d69a]
24
+ - Updated dependencies [057d69a]
25
+ - Updated dependencies [afd6a19]
26
+ - Updated dependencies [057d69a]
27
+ - Updated dependencies [d42d716]
28
+ - Updated dependencies [4e751da]
29
+ - @procedures/client@0.4.0
30
+ - @procedures/peer@0.4.0
31
+
32
+ ## 0.3.0
33
+
34
+ ### Patch Changes
35
+
36
+ - 381ce3a: Cancellation scopes and a graceful stop (roadmap R14). `ProcedureServer.stop({ grace })` refuses new calls with a retryable `UNAVAILABLE` and lets the calls in flight end until the grace time ends, then aborts them (`peer.stop({ grace })` passes it; `mark --server` and the `server` bin give 5 seconds). The signal of each call joins its request and the server, and `callsInFlight` counts the calls, streams included. `exec()` and `execStream()` take a `signal`. `LocalTransport` takes `interceptors`, `capability` and `clearanceOrder`, and gives a call the deadline that its client sends, so a client timeout ends a local handler too. `mark` aborts a command in its own process on the first Ctrl+C. A remote leaf of `route()` and `server.call` send the deadline of their caller, and `server.call` relays the signal.
37
+ - aaa7462: The peer accepts a bare JSON value and obeys `bodyLimit` (roadmap R5). Before, its strict JSON parser refused a number, a string or `null` with 400, and its limit of 100 kB replaced `bodyLimit`. The HTTP transport config of the peer takes `bodyLimit`. `peer.stop()` closes the HTTP server that the peer made for its WebSocket transport, so the port is free again. `mark --server` and the `server` bin stop the peer before they exit, with a limit of 10 seconds, and a second signal exits at once.
38
+ - Updated dependencies [ddea529]
39
+ - Updated dependencies [b2a3e3a]
40
+ - Updated dependencies [a8c47f1]
41
+ - Updated dependencies [381ce3a]
42
+ - Updated dependencies [0c627f8]
43
+ - Updated dependencies [ae7f05f]
44
+ - Updated dependencies [7873940]
45
+ - Updated dependencies [a70d445]
46
+ - Updated dependencies [bc70357]
47
+ - Updated dependencies [07cc998]
48
+ - Updated dependencies [a6b01a9]
49
+ - Updated dependencies [c799cdd]
50
+ - Updated dependencies [540f8d9]
51
+ - Updated dependencies [b6daaec]
52
+ - Updated dependencies [5b9264e]
53
+ - Updated dependencies [956e88b]
54
+ - Updated dependencies [ff62281]
55
+ - Updated dependencies [aaa7462]
56
+ - Updated dependencies [d81d0ed]
57
+ - Updated dependencies [aa67cc7]
58
+ - Updated dependencies [061fa22]
59
+ - Updated dependencies [cfb9d69]
60
+ - Updated dependencies [43f7de5]
61
+ - Updated dependencies [b07bb50]
62
+ - Updated dependencies [4a3bfa1]
63
+ - Updated dependencies [bd0b626]
64
+ - Updated dependencies [a6be873]
65
+ - Updated dependencies [fb30718]
66
+ - Updated dependencies [c5528e4]
67
+ - Updated dependencies [fee5d9c]
68
+ - Updated dependencies [21f7743]
69
+ - Updated dependencies [31a0b46]
70
+ - @procedures/client@0.3.0
71
+ - @procedures/peer@0.3.0
72
+
3
73
  ## 0.2.3
4
74
 
5
75
  ### Patch Changes
package/README.md CHANGED
@@ -15,6 +15,7 @@
15
15
  - [Architecture](#architecture)
16
16
  - [Quick Start](#quick-start)
17
17
  - [CLI Reference](#cli-reference)
18
+ - [Procedures](#procedures)
18
19
  - [Examples](#examples)
19
20
  - [Integration](#integration)
20
21
  - [Requirements](#requirements)
@@ -167,7 +168,7 @@ procedure-server -p @procedures/mongo/register -t http,websocket
167
168
 
168
169
  `mark serve` takes the same options and starts the same server.
169
170
 
170
- The server has a registry of its own (roadmap 3.1): the `server.*` procedures and the `./module` entry of each `--procedures` package. Two servers in one process serve only their own packages. `pkg/register`, the form of the old examples, gives the module of `pkg`. A package without a `./module` entry still works: the server takes the procedures that its import registers. The token, the `--expose` list and the browser checks come from `hostPolicy()` of `@procedures/client`.
171
+ The server has a registry of its own (roadmap 3.1): the `server.*` procedures and the `./module` entry of each `--procedures` package. The `server.*` procedures come from two modules: the module of `@procedures/peer` (`server.create`, `server.call` and the others) and the module of this package. Two servers in one process serve only their own packages. `pkg/register`, the form of the old examples, gives the module of `pkg`. A package without a `./module` entry still works: the server takes the procedures that its import registers. The token, the `--expose` list and the browser checks come from `hostPolicy()` of `@procedures/client`.
171
172
 
172
173
  ### Transport Configuration
173
174
 
@@ -192,6 +193,22 @@ graph TB
192
193
 
193
194
  ---
194
195
 
196
+ ## Procedures
197
+
198
+ The package has three procedures. They manage the background server of the `mark` CLI (`mark --server`). In version 0.3.0 and before, they were in `@procedures/peer`. Their names did not change.
199
+
200
+ | Procedure | Function |
201
+ |---|---|
202
+ | `server.start` | Start the CLI server as a background process. It writes `~/.mark/server.log`. |
203
+ | `server.stop` | Stop the CLI servers of the lockfiles, or the server of one port. A process that does not answer as the peer of its lockfile gets no signal. |
204
+ | `server.status` | Give the state of the CLI servers. It deletes the lockfile of a server that does not answer. |
205
+
206
+ - `import "@procedures/server/register"` registers them in the global registry. The package root and the `./module` entry register nothing.
207
+ - `mark` finds the package from its `client.procedures` field: `mark server start`, `mark server stop` and `mark server status` run them.
208
+ - The lockfiles stay in `@procedures/peer` (`@procedures/peer/lockfile`), because the peer of `mark --server` writes them.
209
+
210
+ ---
211
+
195
212
  ## Examples
196
213
 
197
214
  ### MongoDB Server