@blamejs/core 0.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 (160) hide show
  1. package/CHANGELOG.md +230 -0
  2. package/LICENSE +201 -0
  3. package/LTS-CALENDAR.md +29 -0
  4. package/MIGRATING.md +7 -0
  5. package/NOTICE +59 -0
  6. package/README.md +100 -0
  7. package/bin/blamejs.js +13 -0
  8. package/index.js +253 -0
  9. package/lib/api-key.js +705 -0
  10. package/lib/api-snapshot.js +335 -0
  11. package/lib/app-shutdown.js +381 -0
  12. package/lib/app.js +364 -0
  13. package/lib/atomic-file.js +525 -0
  14. package/lib/audit-chain.js +168 -0
  15. package/lib/audit-sign.js +319 -0
  16. package/lib/audit-tools.js +682 -0
  17. package/lib/audit.js +753 -0
  18. package/lib/auth/jwt.js +280 -0
  19. package/lib/auth/oauth.js +691 -0
  20. package/lib/auth/passkey.js +185 -0
  21. package/lib/auth/password.js +139 -0
  22. package/lib/auth/totp.js +17 -0
  23. package/lib/auth-header.js +81 -0
  24. package/lib/backup/bundle.js +219 -0
  25. package/lib/backup/crypto.js +174 -0
  26. package/lib/backup/index.js +490 -0
  27. package/lib/backup/manifest.js +275 -0
  28. package/lib/bundler.js +295 -0
  29. package/lib/cache.js +819 -0
  30. package/lib/chain-writer.js +234 -0
  31. package/lib/cli-helpers.js +201 -0
  32. package/lib/cli.js +1377 -0
  33. package/lib/cluster-provider-db.js +245 -0
  34. package/lib/cluster-storage.js +166 -0
  35. package/lib/cluster.js +691 -0
  36. package/lib/consent.js +222 -0
  37. package/lib/constants.js +186 -0
  38. package/lib/cookies.js +293 -0
  39. package/lib/credential-hash.js +303 -0
  40. package/lib/crypto-field.js +159 -0
  41. package/lib/crypto.js +250 -0
  42. package/lib/db-query.js +297 -0
  43. package/lib/db-schema.js +250 -0
  44. package/lib/db.js +1054 -0
  45. package/lib/deprecate.js +226 -0
  46. package/lib/dev.js +324 -0
  47. package/lib/error-page.js +424 -0
  48. package/lib/events.js +135 -0
  49. package/lib/external-db.js +422 -0
  50. package/lib/forms.js +378 -0
  51. package/lib/framework-error.js +189 -0
  52. package/lib/framework-schema.js +604 -0
  53. package/lib/handlers.js +350 -0
  54. package/lib/html-balance.js +227 -0
  55. package/lib/http-client.js +615 -0
  56. package/lib/i18n.js +780 -0
  57. package/lib/jobs.js +181 -0
  58. package/lib/lazy-require.js +48 -0
  59. package/lib/log-stream-local.js +137 -0
  60. package/lib/log-stream-webhook.js +170 -0
  61. package/lib/log-stream.js +211 -0
  62. package/lib/log.js +355 -0
  63. package/lib/mail-bounce.js +507 -0
  64. package/lib/mail.js +701 -0
  65. package/lib/metrics.js +647 -0
  66. package/lib/middleware/api-encrypt.js +553 -0
  67. package/lib/middleware/attach-user.js +156 -0
  68. package/lib/middleware/body-parser.js +883 -0
  69. package/lib/middleware/bot-guard.js +148 -0
  70. package/lib/middleware/compression.js +436 -0
  71. package/lib/middleware/cors.js +236 -0
  72. package/lib/middleware/csp-nonce.js +332 -0
  73. package/lib/middleware/csrf-protect.js +275 -0
  74. package/lib/middleware/error-handler.js +46 -0
  75. package/lib/middleware/health.js +358 -0
  76. package/lib/middleware/index.js +52 -0
  77. package/lib/middleware/rate-limit.js +319 -0
  78. package/lib/middleware/request-id.js +53 -0
  79. package/lib/middleware/require-auth.js +95 -0
  80. package/lib/middleware/security-headers.js +91 -0
  81. package/lib/migrations.js +353 -0
  82. package/lib/mtls-ca.js +333 -0
  83. package/lib/mtls-engine-default.js +285 -0
  84. package/lib/nonce-store.js +177 -0
  85. package/lib/notify.js +643 -0
  86. package/lib/ntp-check.js +178 -0
  87. package/lib/object-store/azure-blob.js +467 -0
  88. package/lib/object-store/gcs.js +469 -0
  89. package/lib/object-store/http-put.js +153 -0
  90. package/lib/object-store/index.js +140 -0
  91. package/lib/object-store/local.js +163 -0
  92. package/lib/object-store/retry.js +15 -0
  93. package/lib/object-store/sigv4.js +535 -0
  94. package/lib/observability.js +114 -0
  95. package/lib/pagination.js +371 -0
  96. package/lib/parsers/index.js +64 -0
  97. package/lib/parsers/safe-csv.js +224 -0
  98. package/lib/parsers/safe-env.js +614 -0
  99. package/lib/parsers/safe-toml.js +745 -0
  100. package/lib/parsers/safe-xml.js +379 -0
  101. package/lib/parsers/safe-yaml.js +977 -0
  102. package/lib/permissions.js +430 -0
  103. package/lib/pqc-agent.js +85 -0
  104. package/lib/pqc-gate.js +266 -0
  105. package/lib/protocol-dispatcher.js +144 -0
  106. package/lib/queue-local.js +327 -0
  107. package/lib/queue.js +430 -0
  108. package/lib/redact.js +192 -0
  109. package/lib/render.js +193 -0
  110. package/lib/request-helpers.js +178 -0
  111. package/lib/restore-bundle.js +239 -0
  112. package/lib/restore-rollback.js +254 -0
  113. package/lib/restore.js +301 -0
  114. package/lib/retry.js +329 -0
  115. package/lib/router.js +437 -0
  116. package/lib/safe-async.js +520 -0
  117. package/lib/safe-buffer.js +162 -0
  118. package/lib/safe-json.js +532 -0
  119. package/lib/safe-schema.js +1176 -0
  120. package/lib/safe-sql.js +157 -0
  121. package/lib/safe-url.js +109 -0
  122. package/lib/scheduler.js +680 -0
  123. package/lib/seeders.js +622 -0
  124. package/lib/session.js +304 -0
  125. package/lib/slug.js +243 -0
  126. package/lib/static.js +268 -0
  127. package/lib/storage.js +470 -0
  128. package/lib/subject.js +281 -0
  129. package/lib/template.js +781 -0
  130. package/lib/testing.js +621 -0
  131. package/lib/totp.js +285 -0
  132. package/lib/tracing.js +484 -0
  133. package/lib/validate-opts.js +56 -0
  134. package/lib/vault/index.js +299 -0
  135. package/lib/vault/passphrase-ops.js +311 -0
  136. package/lib/vault/passphrase-source.js +198 -0
  137. package/lib/vault/rotate.js +761 -0
  138. package/lib/vault/wrap.js +289 -0
  139. package/lib/vendor/MANIFEST.json +84 -0
  140. package/lib/vendor/argon2/argon2.cjs +466 -0
  141. package/lib/vendor/argon2/argon2.d.cts +62 -0
  142. package/lib/vendor/argon2/package.json +1 -0
  143. package/lib/vendor/argon2/prebuilds/darwin-arm64/argon2.armv8.glibc.node +0 -0
  144. package/lib/vendor/argon2/prebuilds/darwin-x64/argon2.glibc.node +0 -0
  145. package/lib/vendor/argon2/prebuilds/freebsd-arm64/argon2.armv8.glibc.node +0 -0
  146. package/lib/vendor/argon2/prebuilds/freebsd-x64/argon2.glibc.node +0 -0
  147. package/lib/vendor/argon2/prebuilds/linux-arm/argon2.armv7.glibc.node +0 -0
  148. package/lib/vendor/argon2/prebuilds/linux-arm/argon2.armv7.musl.node +0 -0
  149. package/lib/vendor/argon2/prebuilds/linux-arm64/argon2.armv8.glibc.node +0 -0
  150. package/lib/vendor/argon2/prebuilds/linux-arm64/argon2.armv8.musl.node +0 -0
  151. package/lib/vendor/argon2/prebuilds/linux-x64/argon2.glibc.node +0 -0
  152. package/lib/vendor/argon2/prebuilds/linux-x64/argon2.musl.node +0 -0
  153. package/lib/vendor/argon2/prebuilds/win32-x64/argon2.glibc.node +0 -0
  154. package/lib/vendor/noble-ciphers.cjs +9 -0
  155. package/lib/vendor/pki.cjs +181 -0
  156. package/lib/vendor/simplewebauthn-server.cjs +328 -0
  157. package/lib/webhook.js +632 -0
  158. package/lib/websocket-channels.js +413 -0
  159. package/lib/websocket.js +833 -0
  160. package/package.json +39 -0
@@ -0,0 +1,381 @@
1
+ "use strict";
2
+ /**
3
+ * app-shutdown — graceful-shutdown orchestrator.
4
+ *
5
+ * SIGTERM is the contract between Kubernetes / systemd / docker stop
6
+ * and the framework. Production rolling restarts depend on the
7
+ * server draining cleanly: stop accepting new traffic, finish in-
8
+ * flight requests, drain jobs, close DB, release the cluster lease.
9
+ * Without orchestration each subsystem's shutdown races every other
10
+ * subsystem's; the result is dropped requests, half-completed jobs,
11
+ * stuck cluster leases that block the next pod from acquiring.
12
+ *
13
+ * This module ships a phase-ordered orchestrator. Each phase is
14
+ * named, time-bounded, and best-effort — a phase failure logs an
15
+ * issue but doesn't block subsequent phases (we still want to close
16
+ * the DB and release the lease even if jobs draining timed out).
17
+ *
18
+ * Standard phase order:
19
+ *
20
+ * 1. beforeStop operator hook (run before anything else)
21
+ * 2. mark-draining health.markShuttingDown() so /readyz → 503
22
+ * and the LB starts draining the pod
23
+ * 3. stop-accepting flip the orchestrator's `draining` flag —
24
+ * middleware (orchestrator.middleware())
25
+ * refuses new requests with 503
26
+ * 4. drain-in-flight wait for the in-flight counter to reach 0
27
+ * (tracked via the same middleware) up to
28
+ * phaseTimeoutMs
29
+ * 5. afterDrain operator hook (run after in-flight drained)
30
+ * 6. scheduler scheduler.stop() if registered
31
+ * 7. jobs jobs.shutdown() / queue.shutdown() — let
32
+ * current handlers finish, refuse new lease
33
+ * 8. websockets router.closeWebSockets() if HTTP server
34
+ * 9. http-server server.close() — waits for keepalive
35
+ * connections to drain
36
+ * 10. cluster cluster.shutdown() — release lease cleanly
37
+ * so the next pod can acquire it without
38
+ * waiting out the lease TTL
39
+ * 11. db db.close() — flushes encrypted-at-rest
40
+ * snapshot, closes SQLite handle
41
+ * 12. external-db externalDb.shutdown() — drain pool
42
+ *
43
+ * Custom phases can be added via opts.phases; each entry is
44
+ * { name, run: async fn, timeoutMs? }. The orchestrator runs them
45
+ * in array order. The standard phase set above is added by
46
+ * createApp via the components map; standalone callers build their
47
+ * own.
48
+ *
49
+ * var orchestrator = b.appShutdown.create({
50
+ * graceMs: 30000,
51
+ * phases: [
52
+ * { name: "beforeStop", run: async function () { ... } },
53
+ * { name: "drain-in-flight", run: orchestrator.waitInFlight, timeoutMs: 10000 },
54
+ * { name: "db", run: function () { db.close(); } },
55
+ * ],
56
+ * installSignalHandlers: true, // SIGTERM + SIGINT auto-call shutdown
57
+ * });
58
+ *
59
+ * var result = await orchestrator.shutdown();
60
+ * // → { ok, phases: [{ name, ms, ok, error? }, ...], totalMs, draining }
61
+ *
62
+ * // Mounted as middleware to refuse new requests during drain +
63
+ * // track in-flight count.
64
+ * router.use(orchestrator.middleware());
65
+ *
66
+ * orchestrator.draining(); // true once shutdown() has been called
67
+ * orchestrator.inFlight(); // current in-flight count
68
+ *
69
+ * Idempotency: shutdown() is idempotent. Calling it twice returns
70
+ * the same Promise. Signal handlers fire it via `installSignalHandlers`
71
+ * so SIGTERM + SIGINT both route through the same orchestration.
72
+ *
73
+ * Per-phase timeouts: each phase has a budget. If a phase doesn't
74
+ * complete within timeoutMs it's marked failed and the orchestrator
75
+ * moves to the next phase. Default = remaining grace divided by
76
+ * remaining phases (so a slow phase doesn't starve later ones).
77
+ *
78
+ * Tracing integration: when b.tracing has an active registry, each
79
+ * phase runs inside a span named "shutdown.<phase>" so operators see
80
+ * which phase took how long in their tracing exporter.
81
+ */
82
+
83
+ var safeAsync = require("./safe-async");
84
+ var { defineClass } = require("./framework-error");
85
+ var { boot } = require("./log");
86
+
87
+ var AppShutdownError = defineClass("AppShutdownError", { alwaysPermanent: true });
88
+ var log = boot("app-shutdown");
89
+
90
+ var DEFAULT_GRACE_MS = 30000;
91
+
92
+ function create(opts) {
93
+ opts = opts || {};
94
+ var graceMs = typeof opts.graceMs === "number" && opts.graceMs > 0 ? opts.graceMs : DEFAULT_GRACE_MS;
95
+ var phases = Array.isArray(opts.phases) ? opts.phases.slice() : [];
96
+ var installSignalHandlers = !!opts.installSignalHandlers;
97
+ for (var i = 0; i < phases.length; i++) {
98
+ if (!phases[i] || typeof phases[i].name !== "string" || typeof phases[i].run !== "function") {
99
+ throw new AppShutdownError("app-shutdown/bad-phase",
100
+ "phases[" + i + "] must be { name: string, run: function, timeoutMs?: number }");
101
+ }
102
+ }
103
+
104
+ var draining = false;
105
+ var inFlightCount = 0;
106
+ var inFlightWaiters = [];
107
+ var shutdownPromise = null;
108
+ var startTime = null;
109
+ var signalsInstalled = false;
110
+ var signalHandlers = {};
111
+
112
+ function _drainComplete() {
113
+ var pending = inFlightWaiters;
114
+ inFlightWaiters = [];
115
+ for (var i = 0; i < pending.length; i++) pending[i]();
116
+ }
117
+
118
+ function _trackResEnd(res) {
119
+ var origEnd = res.end;
120
+ res.end = function () {
121
+ try { return origEnd.apply(res, arguments); }
122
+ finally {
123
+ inFlightCount--;
124
+ if (inFlightCount === 0 && draining && inFlightWaiters.length > 0) {
125
+ _drainComplete();
126
+ }
127
+ }
128
+ };
129
+ }
130
+
131
+ function middleware() {
132
+ return function shutdownGuard(req, res, next) {
133
+ if (draining) {
134
+ // Refuse new requests with 503 once the orchestrator has
135
+ // started shutting down. Cache-Control: no-store so probes
136
+ // don't get a stale 503 served from a CDN.
137
+ if (typeof res.writeHead === "function") {
138
+ var body = JSON.stringify({ error: "service-shutting-down" });
139
+ res.writeHead(503, {
140
+ "Content-Type": "application/json; charset=utf-8",
141
+ "Content-Length": Buffer.byteLength(body),
142
+ "Cache-Control": "no-store",
143
+ "Connection": "close",
144
+ });
145
+ res.end(body);
146
+ }
147
+ return;
148
+ }
149
+ inFlightCount++;
150
+ _trackResEnd(res);
151
+ return next();
152
+ };
153
+ }
154
+
155
+ // Wait for inFlightCount to hit 0. Resolves immediately if already 0.
156
+ // Caller-supplied timeout via the phase wrapper.
157
+ function waitInFlight() {
158
+ if (inFlightCount === 0) return Promise.resolve();
159
+ return new Promise(function (resolve) { inFlightWaiters.push(resolve); });
160
+ }
161
+
162
+ // Run a single phase with a budget. Returns { name, ms, ok, error? }.
163
+ async function _runPhase(phase, budgetMs, span) {
164
+ var phaseStart = Date.now();
165
+ var result = { name: phase.name, ms: 0, ok: true };
166
+ var timeoutMs = typeof phase.timeoutMs === "number" && phase.timeoutMs > 0
167
+ ? Math.min(phase.timeoutMs, budgetMs) : budgetMs;
168
+ try {
169
+ await safeAsync.withTimeout(
170
+ Promise.resolve().then(function () { return phase.run(); }),
171
+ timeoutMs,
172
+ { name: "shutdown." + phase.name }
173
+ );
174
+ } catch (e) {
175
+ result.ok = false;
176
+ result.error = (e && e.message) || String(e);
177
+ log.error("shutdown phase '" + phase.name + "' failed: " + result.error);
178
+ }
179
+ result.ms = Date.now() - phaseStart;
180
+ if (span && typeof span.setAttribute === "function") {
181
+ span.setAttribute("shutdown.phase.ok", result.ok);
182
+ span.setAttribute("shutdown.phase.ms", result.ms);
183
+ }
184
+ return result;
185
+ }
186
+
187
+ function shutdown() {
188
+ if (shutdownPromise) return shutdownPromise;
189
+ draining = true;
190
+ startTime = Date.now();
191
+ shutdownPromise = (async function () {
192
+ var tracing = null;
193
+ try { tracing = require("./tracing"); } catch (_e) { /* tracing optional */ }
194
+ var phaseResults = [];
195
+ var remainingPhases = phases.length;
196
+ for (var i = 0; i < phases.length; i++) {
197
+ var elapsed = Date.now() - startTime;
198
+ var remainingMs = Math.max(0, graceMs - elapsed);
199
+ var perPhaseBudget = remainingPhases > 0 ? Math.floor(remainingMs / remainingPhases) : remainingMs;
200
+ // Each phase wrapped in a tracing span if a registry is active.
201
+ var phaseResult;
202
+ if (tracing && typeof tracing.tap === "function") {
203
+ phaseResult = await tracing.tap("shutdown." + phases[i].name, null, function (s) {
204
+ return _runPhase(phases[i], perPhaseBudget, s);
205
+ });
206
+ } else {
207
+ phaseResult = await _runPhase(phases[i], perPhaseBudget, null);
208
+ }
209
+ phaseResults.push(phaseResult);
210
+ remainingPhases--;
211
+ }
212
+ // Allow any straggling in-flight resolvers to drop refs.
213
+ _drainComplete();
214
+ var totalMs = Date.now() - startTime;
215
+ var allOk = phaseResults.every(function (p) { return p.ok; });
216
+ log("shutdown complete in " + totalMs + "ms (" +
217
+ phaseResults.filter(function (p) { return p.ok; }).length + "/" +
218
+ phaseResults.length + " phases ok)");
219
+ return { ok: allOk, phases: phaseResults, totalMs: totalMs, draining: true };
220
+ })();
221
+ return shutdownPromise;
222
+ }
223
+
224
+ function _signalCallback(sig) {
225
+ return function () {
226
+ log("received " + sig + " — initiating graceful shutdown");
227
+ shutdown().then(function (result) {
228
+ if (process.exitCode === undefined || process.exitCode === 0) {
229
+ process.exitCode = result.ok ? 0 : 1;
230
+ }
231
+ }).catch(function (e) {
232
+ log.error("shutdown threw unexpectedly: " + ((e && e.message) || String(e)));
233
+ process.exitCode = 1;
234
+ });
235
+ };
236
+ }
237
+
238
+ function installSignals() {
239
+ if (signalsInstalled) return;
240
+ signalsInstalled = true;
241
+ signalHandlers.SIGTERM = _signalCallback("SIGTERM");
242
+ signalHandlers.SIGINT = _signalCallback("SIGINT");
243
+ process.on("SIGTERM", signalHandlers.SIGTERM);
244
+ process.on("SIGINT", signalHandlers.SIGINT);
245
+ }
246
+
247
+ function uninstallSignals() {
248
+ if (!signalsInstalled) return;
249
+ process.removeListener("SIGTERM", signalHandlers.SIGTERM);
250
+ process.removeListener("SIGINT", signalHandlers.SIGINT);
251
+ signalsInstalled = false;
252
+ signalHandlers = {};
253
+ }
254
+
255
+ if (installSignalHandlers) installSignals();
256
+
257
+ return {
258
+ shutdown: shutdown,
259
+ middleware: middleware,
260
+ waitInFlight: waitInFlight,
261
+ draining: function () { return draining; },
262
+ inFlight: function () { return inFlightCount; },
263
+ addPhase: function (phase) {
264
+ if (!phase || typeof phase.name !== "string" || typeof phase.run !== "function") {
265
+ throw new AppShutdownError("app-shutdown/bad-phase",
266
+ "addPhase requires { name: string, run: function, timeoutMs?: number }");
267
+ }
268
+ if (shutdownPromise) {
269
+ throw new AppShutdownError("app-shutdown/already-started",
270
+ "cannot addPhase after shutdown() has started");
271
+ }
272
+ phases.push(phase);
273
+ },
274
+ installSignals: installSignals,
275
+ uninstallSignals: uninstallSignals,
276
+ _resetForTest: function () {
277
+ uninstallSignals();
278
+ shutdownPromise = null;
279
+ draining = false;
280
+ inFlightCount = 0;
281
+ inFlightWaiters = [];
282
+ },
283
+ };
284
+ }
285
+
286
+ // Standard phase builder — given a components map, returns a phases
287
+ // array suitable for create({ phases }). Used by createApp; operators
288
+ // with custom topology call this directly to get the same ordering
289
+ // then prepend / append their own phases.
290
+ function standardPhases(components) {
291
+ components = components || {};
292
+ var phases = [];
293
+
294
+ if (components.health && typeof components.health.markShuttingDown === "function") {
295
+ phases.push({
296
+ name: "mark-draining",
297
+ run: function () { components.health.markShuttingDown(); },
298
+ timeoutMs: 1000,
299
+ });
300
+ }
301
+
302
+ // The drain-in-flight phase needs the orchestrator's own
303
+ // waitInFlight; it's added by createApp using addPhase after the
304
+ // orchestrator instance exists. This function emits the phases that
305
+ // don't need orchestrator references.
306
+
307
+ if (components.scheduler && typeof components.scheduler.stop === "function") {
308
+ phases.push({
309
+ name: "scheduler",
310
+ run: function () { return components.scheduler.stop(); },
311
+ timeoutMs: 5000,
312
+ });
313
+ }
314
+
315
+ if (components.jobs && typeof components.jobs.shutdown === "function") {
316
+ phases.push({
317
+ name: "jobs",
318
+ run: function () { return components.jobs.shutdown({ timeoutMs: 5000 }); },
319
+ timeoutMs: 8000,
320
+ });
321
+ } else if (components.queue && typeof components.queue.shutdown === "function") {
322
+ phases.push({
323
+ name: "queue",
324
+ run: function () { return components.queue.shutdown({ timeoutMs: 5000 }); },
325
+ timeoutMs: 8000,
326
+ });
327
+ }
328
+
329
+ if (components.router && typeof components.router.closeWebSockets === "function") {
330
+ phases.push({
331
+ name: "websockets",
332
+ run: function () { return components.router.closeWebSockets({ timeoutMs: 3000 }); },
333
+ timeoutMs: 5000,
334
+ });
335
+ }
336
+
337
+ if (components.server && typeof components.server.close === "function") {
338
+ phases.push({
339
+ name: "http-server",
340
+ run: function () {
341
+ return new Promise(function (resolve) {
342
+ components.server.close(function () { resolve(); });
343
+ });
344
+ },
345
+ timeoutMs: 10000,
346
+ });
347
+ }
348
+
349
+ if (components.cluster && typeof components.cluster.shutdown === "function") {
350
+ phases.push({
351
+ name: "cluster",
352
+ run: function () { return components.cluster.shutdown(); },
353
+ timeoutMs: 5000,
354
+ });
355
+ }
356
+
357
+ if (components.db && typeof components.db.close === "function") {
358
+ phases.push({
359
+ name: "db",
360
+ run: function () { components.db.close(); },
361
+ timeoutMs: 5000,
362
+ });
363
+ }
364
+
365
+ if (components.externalDb && typeof components.externalDb.shutdown === "function") {
366
+ phases.push({
367
+ name: "external-db",
368
+ run: function () { return components.externalDb.shutdown(); },
369
+ timeoutMs: 5000,
370
+ });
371
+ }
372
+
373
+ return phases;
374
+ }
375
+
376
+ module.exports = {
377
+ create: create,
378
+ standardPhases: standardPhases,
379
+ AppShutdownError: AppShutdownError,
380
+ DEFAULT_GRACE_MS: DEFAULT_GRACE_MS,
381
+ };