@luckystack/server 0.8.5 → 0.8.7

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.
@@ -108,6 +108,39 @@ await server.listen();
108
108
 
109
109
  ---
110
110
 
111
+ ### `afterListen(task, options?): Promise<void>`
112
+
113
+ Runs work that belongs **after** the server is accepting traffic — durable queue
114
+ workers, warm-up passes, reconciliation jobs.
115
+
116
+ ```typescript
117
+ await server.listen();
118
+
119
+ await server.afterListen(async () => {
120
+ const { startWorkers } = await import('../src/jobs/workers');
121
+ await startWorkers();
122
+ }, { label: 'job workers' });
123
+ ```
124
+
125
+ **Why it exists.** The scaffolded `server/server.ts` wraps its boot in an IIFE
126
+ whose `.catch` calls `process.exit(1)`. That is right for everything *before*
127
+ `listen()` — a failure there means there is no server. Appending post-listen work
128
+ to the same chain silently extends "fatal" to tasks that run while the server is
129
+ already serving, so one unreachable dependency (a queue's database, say) kills a
130
+ healthy process. Behind a supervisor that becomes a crash-loop: restart,
131
+ dependency still down, repeat — while the log claims `failed to start` about a
132
+ server that started fine.
133
+
134
+ | Option | Default | Effect |
135
+ |---|---|---|
136
+ | `fatal` | `false` | `true` re-throws instead of swallowing. Use only when the process genuinely has no purpose without the task. |
137
+ | `label` | `'post-listen task'` | Names the task in the failure log. |
138
+
139
+ Never resolves to the task's value — it is fire-and-report, not a pipeline stage.
140
+ Read whatever you need inside the callback.
141
+
142
+ ---
143
+
111
144
  ### `bootstrapLuckyStack(options?: BootstrapLuckyStackOptions): Promise<RunningLuckyStackServer>`
112
145
 
113
146
  **Signature:**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luckystack/server",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -57,20 +57,20 @@
57
57
  "test": "vitest run"
58
58
  },
59
59
  "dependencies": {
60
- "@luckystack/api": "^0.8.5",
61
- "@luckystack/core": "^0.8.5"
60
+ "@luckystack/api": "^0.8.7",
61
+ "@luckystack/core": "^0.8.7"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@prisma/client": "^6.19.0",
65
65
  "socket.io": "^4.8.0",
66
- "@luckystack/cron": "^0.8.5",
67
- "@luckystack/devkit": "^0.8.5",
68
- "@luckystack/docs-ui": "^0.8.5",
69
- "@luckystack/email": "^0.8.5",
70
- "@luckystack/error-tracking": "^0.8.5",
71
- "@luckystack/login": "^0.8.5",
72
- "@luckystack/presence": "^0.8.5",
73
- "@luckystack/sync": "^0.8.5"
66
+ "@luckystack/cron": "^0.8.7",
67
+ "@luckystack/devkit": "^0.8.7",
68
+ "@luckystack/docs-ui": "^0.8.7",
69
+ "@luckystack/email": "^0.8.7",
70
+ "@luckystack/error-tracking": "^0.8.7",
71
+ "@luckystack/login": "^0.8.7",
72
+ "@luckystack/presence": "^0.8.7",
73
+ "@luckystack/sync": "^0.8.7"
74
74
  },
75
75
  "peerDependenciesMeta": {
76
76
  "@prisma/client": {