@luckystack/server 0.7.4 → 0.7.6
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/CHANGELOG.md +8 -0
- package/CLAUDE.md +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/docs/create-server.md +2 -2
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.7.6] - 2026-07-23
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- A successfully listening server now refreshes its boot-UUID TTL every third
|
|
15
|
+
of the configured lifetime and stops the heartbeat during shutdown. Healthy
|
|
16
|
+
long-running servers therefore no longer become not-ready after one hour.
|
|
17
|
+
|
|
10
18
|
## [0.7.4] - 2026-07-22
|
|
11
19
|
|
|
12
20
|
### Fixed
|
package/CLAUDE.md
CHANGED
|
@@ -25,7 +25,7 @@ One-call server bootstrap for a LuckyStack project. Wires together a raw Node.js
|
|
|
25
25
|
|
|
26
26
|
| Function / Export | One-liner | Deep doc |
|
|
27
27
|
|---|---|---|
|
|
28
|
-
| `createLuckyStackServer(options)` | Lower-level factory that returns `{ httpServer, ioServer, listen, stop, close }`. Wires HTTP + Socket.io + framework routes;
|
|
28
|
+
| `createLuckyStackServer(options)` | Lower-level factory that returns `{ httpServer, ioServer, listen, stop, close }`. Wires HTTP + Socket.io + framework routes; after a successful listen starts the boot-UUID TTL heartbeat, and stops it during shutdown. Installs a persistent `httpServer.on('error')` listener and (in prod) SIGTERM/SIGINT → graceful `stop()`. | -> docs/create-server.md |
|
|
29
29
|
| `RunningLuckyStackServer.stop(options?)` / `.close(options?)` | Graceful shutdown (MIS-016). Stops accepting new connections, dispatches the core `preServerStop` hook, flushes error-trackers (bounded by a per-step timeout race), then closes io + http + the Redis-adapter pub/sub clients. Each step isolated + time-bounded so one hanging step can't stall shutdown. Idempotent. `options`: `{ reason?, timeoutMs? }` (default `timeoutMs` 10000). | -> docs/create-server.md |
|
|
30
30
|
| `bootstrapLuckyStack(options)` | High-level entry: auto-imports `luckystack/<pkg>/*.ts` overlay in topological order, then delegates to `createLuckyStackServer`. An overlay file that fails to import (classic: it imports a package removed via `luckystack remove`) aborts boot with an ACTIONABLE error naming the file, instead of a raw ERR_MODULE_NOT_FOUND. | -> docs/create-server.md |
|
|
31
31
|
| `OVERLAY_ORDER` (exported const) | The canonical overlay walk order (`core, deploy, login, email, sentry, presence, cron, docs-ui, server`). Exported so the consumer's `scripts/bundleServer.mjs` imports it at build time — a hardcoded bundler copy once silently dropped the cron slot from prod; `overlayOrderParity.test.ts` pins the bundlers' fallback lists to this. | -> docs/create-server.md |
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
// src/createServer.ts
|
|
11
11
|
import http from "http";
|
|
12
|
-
import { registerBindAddress, registerBoundAddress, writeBootUuid, getLogger as getLogger13, getProjectConfig as getProjectConfig15, tryCatch as tryCatch10, tryCatchSync as tryCatchSync2, resolveEnvKey as resolveEnvKey5, dispatchHook as dispatchHook8 } from "@luckystack/core";
|
|
12
|
+
import { registerBindAddress, registerBoundAddress, writeBootUuid, startBootUuidHeartbeat, getLogger as getLogger13, getProjectConfig as getProjectConfig15, tryCatch as tryCatch10, tryCatchSync as tryCatchSync2, resolveEnvKey as resolveEnvKey5, dispatchHook as dispatchHook8 } from "@luckystack/core";
|
|
13
13
|
|
|
14
14
|
// src/httpHandler.ts
|
|
15
15
|
import { randomUUID } from "crypto";
|
|
@@ -2460,9 +2460,15 @@ var createLuckyStackServer = async (options = {}) => {
|
|
|
2460
2460
|
const { io: ioServer, adapterClients } = loadSocket(httpServer, {
|
|
2461
2461
|
maxHttpBufferSize: options.maxHttpBufferSize
|
|
2462
2462
|
});
|
|
2463
|
-
|
|
2463
|
+
let bootUuidHeartbeat = null;
|
|
2464
|
+
const listen = async (callback) => {
|
|
2465
|
+
const listeningServer = await listenLuckyStackServer(httpServer, ip, port, callback);
|
|
2466
|
+
bootUuidHeartbeat ??= startBootUuidHeartbeat();
|
|
2467
|
+
return listeningServer;
|
|
2468
|
+
};
|
|
2464
2469
|
let shutdownPromise = null;
|
|
2465
2470
|
const stop = (stopOptions = {}) => {
|
|
2471
|
+
bootUuidHeartbeat?.stop();
|
|
2466
2472
|
shutdownPromise ??= runGracefulShutdown({ httpServer, ioServer, adapterClients }, stopOptions);
|
|
2467
2473
|
return shutdownPromise;
|
|
2468
2474
|
};
|