document-rest 1.3.0 → 1.4.1

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 (3) hide show
  1. package/README.md +10 -0
  2. package/dist/bin.js +5 -3
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -22,6 +22,16 @@ This binds a plain `node:http` listener to `127.0.0.1` (loopback only) on the gi
22
22
 
23
23
  Every release also attaches a Node [single-executable application](https://nodejs.org/api/single-executable-applications.html) build for Linux (x64 and arm64), Windows (x64 and arm64), and macOS (Apple Silicon and Intel) to that release's own GitHub Release assets — the entire server and its dependencies embedded in one file, needing no Node.js install or `npx` at all. For the "a caller with no Node runtime of its own" case this package exists for in the first place, this removes the last Node dependency too: download the asset matching your platform from the package's tag on the [Releases page](https://github.com/ExaDev/documents.js/releases), run it directly (`chmod +x` on Linux/macOS first), and it takes the identical `--port` flag.
24
24
 
25
+ ### Container image
26
+
27
+ Every release also publishes a multi-arch (`linux/amd64` + `linux/arm64`) container image to GitHub Container Registry, wrapping the identical standalone binary above on a minimal [distroless](https://github.com/GoogleContainerTools/distroless) base rather than a Node install:
28
+
29
+ ```sh
30
+ docker run -p 3100:3100 ghcr.io/exadev/documents.js:VERSION --port 3100
31
+ ```
32
+
33
+ Replace `VERSION` with the package's own exact release version (e.g. `1.2.0`) — matching the version-pinned convention every other artifact in this repository uses, this image is never published under a loose major/minor tag such as `1` or `1.2`, though `latest` does track the newest release. The image binds to `0.0.0.0` inside the container regardless of `--port`, so `-p <host>:<container>` is all that's needed to reach it; see the security note above about this listener having no authentication of its own — publishing the container's port makes it reachable by anything that can reach the host, so put a reverse proxy or firewall in front of it before exposing it beyond your own machine.
34
+
25
35
  ## API
26
36
 
27
37
  **`GET /`** lists every available operation:
package/dist/bin.js CHANGED
@@ -131,15 +131,17 @@ function parsePort(raw) {
131
131
  * Returns the listening `Server` rather than resolving `void` so a caller with a reason to stop it again (a test binding an ephemeral port for the duration of one assertion) can -- neither real distribution shape needs to, so both simply discard it.
132
132
  */
133
133
  async function main() {
134
- const portArg = readFlag(process.argv.slice(2), "port");
134
+ const args = process.argv.slice(2);
135
+ const portArg = readFlag(args, "port");
135
136
  const port = portArg === void 0 ? DEFAULT_PORT : parsePort(portArg);
137
+ const host = readFlag(args, "host") ?? "127.0.0.1";
136
138
  const server = createRestServer();
137
139
  await new Promise((resolve) => {
138
- server.listen(port, "127.0.0.1", resolve);
140
+ server.listen(port, host, resolve);
139
141
  });
140
142
  const address = server.address();
141
143
  if (address === null || typeof address === "string") throw new Error("Expected the HTTP server to bind a TCP address, not a pipe or Unix socket");
142
- console.error(`document-rest listening on http://127.0.0.1:${String(address.port)}`);
144
+ console.error(`document-rest listening on http://${host}:${String(address.port)}`);
143
145
  return server;
144
146
  }
145
147
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-rest",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "A plain REST API server exposing document-operations' conversion, editing, inspection, and .odb operations as JSON-over-HTTP endpoints -- one POST route per operation, for a caller with no MCP client and no Node runtime of their own.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -87,8 +87,8 @@
87
87
  "license": "MIT",
88
88
  "packageManager": "pnpm@11.6.0",
89
89
  "dependencies": {
90
- "document-operations": "1.1.0",
91
- "documents.js": "7.20.1",
90
+ "document-operations": "1.1.1",
91
+ "documents.js": "7.20.2",
92
92
  "zod": "4.4.3"
93
93
  },
94
94
  "devDependencies": {
@@ -97,7 +97,7 @@
97
97
  "@vitest/coverage-v8": "4.1.11",
98
98
  "eslint": "10.8.1",
99
99
  "husky": "9.1.7",
100
- "odf.js": "7.25.1",
100
+ "odf.js": "7.25.2",
101
101
  "publint": "0.3.22",
102
102
  "semantic-release": "25.0.9",
103
103
  "tsdown": "0.22.14",