@encore.dev/sdk 2.0.0-beta.15 → 2.0.0-beta.17
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/README.md +111 -101
- package/app_meta.ts +56 -54
- package/config/config.ts +60 -57
- package/config/secrets.ts +45 -52
- package/config/value.ts +23 -26
- package/cron/mod.ts +28 -29
- package/dist/app_meta.d.ts +52 -50
- package/dist/app_meta.d.ts.map +1 -1
- package/dist/app_meta.js +2 -2
- package/dist/app_meta.js.map +1 -1
- package/dist/config/config.d.ts +58 -55
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +8 -9
- package/dist/config/config.js.map +1 -1
- package/dist/config/secrets.d.ts +45 -52
- package/dist/config/secrets.d.ts.map +1 -1
- package/dist/config/secrets.js +8 -9
- package/dist/config/secrets.js.map +1 -1
- package/dist/config/value.d.ts +20 -23
- package/dist/config/value.d.ts.map +1 -1
- package/dist/config/value.js +20 -23
- package/dist/config/value.js.map +1 -1
- package/dist/cron/mod.d.ts +26 -27
- package/dist/cron/mod.d.ts.map +1 -1
- package/dist/cron/mod.js +13 -14
- package/dist/cron/mod.js.map +1 -1
- package/dist/frontends/mod.d.ts +20 -19
- package/dist/frontends/mod.d.ts.map +1 -1
- package/dist/frontends/mod.js +20 -19
- package/dist/frontends/mod.js.map +1 -1
- package/dist/gateway/errors.d.ts +28 -30
- package/dist/gateway/errors.d.ts.map +1 -1
- package/dist/gateway/errors.js +29 -31
- package/dist/gateway/errors.js.map +1 -1
- package/dist/gateway/match.d.ts +54 -54
- package/dist/gateway/match.d.ts.map +1 -1
- package/dist/gateway/match.js +56 -56
- package/dist/gateway/match.js.map +1 -1
- package/dist/gateway/middleware.d.ts +62 -64
- package/dist/gateway/middleware.d.ts.map +1 -1
- package/dist/gateway/middleware.js +1 -1
- package/dist/gateway/middleware.js.map +1 -1
- package/dist/gateway/mod.d.ts +64 -67
- package/dist/gateway/mod.d.ts.map +1 -1
- package/dist/gateway/mod.js +72 -76
- package/dist/gateway/mod.js.map +1 -1
- package/dist/gateway/request.d.ts +138 -134
- package/dist/gateway/request.d.ts.map +1 -1
- package/dist/gateway/request.js +117 -108
- package/dist/gateway/request.js.map +1 -1
- package/dist/gateway/serve.d.ts +29 -34
- package/dist/gateway/serve.d.ts.map +1 -1
- package/dist/gateway/serve.js +51 -56
- package/dist/gateway/serve.js.map +1 -1
- package/dist/gateways/mod.d.ts +23 -21
- package/dist/gateways/mod.d.ts.map +1 -1
- package/dist/gateways/mod.js +25 -23
- package/dist/gateways/mod.js.map +1 -1
- package/dist/internal/runtime/napi/napi.cjs +1 -1
- package/dist/internal/runtime/napi/napi.d.cts +10 -3
- package/dist/internal/runtime/shutdown.d.ts +75 -57
- package/dist/internal/runtime/shutdown.d.ts.map +1 -1
- package/dist/internal/runtime/shutdown.js +88 -84
- package/dist/internal/runtime/shutdown.js.map +1 -1
- package/dist/log/logger.d.ts +43 -37
- package/dist/log/logger.d.ts.map +1 -1
- package/dist/log/logger.js +26 -25
- package/dist/log/logger.js.map +1 -1
- package/dist/metrics/mod.d.ts +133 -114
- package/dist/metrics/mod.d.ts.map +1 -1
- package/dist/metrics/mod.js +109 -101
- package/dist/metrics/mod.js.map +1 -1
- package/dist/otel.d.ts +6 -3
- package/dist/otel.d.ts.map +1 -1
- package/dist/otel.js +6 -3
- package/dist/otel.js.map +1 -1
- package/dist/pubsub/subscription.d.ts +88 -116
- package/dist/pubsub/subscription.d.ts.map +1 -1
- package/dist/pubsub/subscription.js +14 -17
- package/dist/pubsub/subscription.js.map +1 -1
- package/dist/pubsub/topic.d.ts +86 -113
- package/dist/pubsub/topic.d.ts.map +1 -1
- package/dist/pubsub/topic.js +68 -82
- package/dist/pubsub/topic.js.map +1 -1
- package/dist/reqctx/mod.d.ts +83 -86
- package/dist/reqctx/mod.d.ts.map +1 -1
- package/dist/reqctx/mod.js +39 -41
- package/dist/reqctx/mod.js.map +1 -1
- package/dist/services/index.d.ts +76 -75
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +73 -71
- package/dist/services/index.js.map +1 -1
- package/dist/shutdown/mod.d.ts +26 -25
- package/dist/shutdown/mod.d.ts.map +1 -1
- package/dist/shutdown/mod.js +26 -25
- package/dist/shutdown/mod.js.map +1 -1
- package/dist/storage/clickhouse/database.d.ts +113 -115
- package/dist/storage/clickhouse/database.d.ts.map +1 -1
- package/dist/storage/clickhouse/database.js +65 -79
- package/dist/storage/clickhouse/database.js.map +1 -1
- package/dist/storage/clickhouse/errors.d.ts +25 -26
- package/dist/storage/clickhouse/errors.d.ts.map +1 -1
- package/dist/storage/clickhouse/errors.js +15 -17
- package/dist/storage/clickhouse/errors.js.map +1 -1
- package/dist/storage/clickhouse/mod.d.ts +10 -10
- package/dist/storage/clickhouse/mod.js +10 -10
- package/dist/storage/objects/bucket.d.ts +196 -225
- package/dist/storage/objects/bucket.d.ts.map +1 -1
- package/dist/storage/objects/bucket.js +71 -84
- package/dist/storage/objects/bucket.js.map +1 -1
- package/dist/storage/objects/error.d.ts +4 -4
- package/dist/storage/objects/error.js +4 -4
- package/dist/storage/postgres/database.d.ts +124 -149
- package/dist/storage/postgres/database.d.ts.map +1 -1
- package/dist/storage/postgres/database.js +98 -135
- package/dist/storage/postgres/database.js.map +1 -1
- package/dist/storage/postgres/errors.d.ts +42 -48
- package/dist/storage/postgres/errors.d.ts.map +1 -1
- package/dist/storage/postgres/errors.js +44 -51
- package/dist/storage/postgres/errors.js.map +1 -1
- package/dist/storage/postgres/interval.d.ts +19 -19
- package/dist/storage/postgres/interval.d.ts.map +1 -1
- package/dist/storage/postgres/interval.js +21 -21
- package/dist/storage/postgres/interval.js.map +1 -1
- package/dist/storage/redis/bitfield.d.ts +48 -23
- package/dist/storage/redis/bitfield.d.ts.map +1 -1
- package/dist/storage/redis/bitfield.js +38 -19
- package/dist/storage/redis/bitfield.js.map +1 -1
- package/dist/storage/redis/command.d.ts +16 -12
- package/dist/storage/redis/command.d.ts.map +1 -1
- package/dist/storage/redis/command.js +16 -12
- package/dist/storage/redis/command.js.map +1 -1
- package/dist/storage/redis/commands.d.ts +99 -100
- package/dist/storage/redis/commands.d.ts.map +1 -1
- package/dist/storage/redis/commands.js +84 -85
- package/dist/storage/redis/commands.js.map +1 -1
- package/dist/storage/redis/database.d.ts +138 -122
- package/dist/storage/redis/database.d.ts.map +1 -1
- package/dist/storage/redis/database.js +120 -101
- package/dist/storage/redis/database.js.map +1 -1
- package/dist/storage/redis/mod.d.ts +52 -48
- package/dist/storage/redis/mod.d.ts.map +1 -1
- package/dist/storage/redis/mod.js +52 -48
- package/dist/storage/redis/mod.js.map +1 -1
- package/dist/storage/redis/options.d.ts +26 -24
- package/dist/storage/redis/options.d.ts.map +1 -1
- package/dist/storage/redis/options.js.map +1 -1
- package/dist/storage/redis/pubsub.d.ts +16 -16
- package/dist/storage/redis/pubsub.d.ts.map +1 -1
- package/dist/storage/redis/pubsub.js +14 -14
- package/dist/storage/redis/pubsub.js.map +1 -1
- package/dist/storage/redis/reply.d.ts +80 -72
- package/dist/storage/redis/reply.d.ts.map +1 -1
- package/dist/storage/redis/reply.js +53 -46
- package/dist/storage/redis/reply.js.map +1 -1
- package/dist/storage/redis/scan.d.ts +4 -4
- package/dist/storage/redis/scan.d.ts.map +1 -1
- package/dist/storage/redis/scan.js +6 -6
- package/dist/storage/redis/scan.js.map +1 -1
- package/dist/storage/redis/script.d.ts +28 -21
- package/dist/storage/redis/script.d.ts.map +1 -1
- package/dist/storage/redis/script.js +29 -22
- package/dist/storage/redis/script.js.map +1 -1
- package/dist/storage/redis/target.d.ts +17 -1
- package/dist/storage/redis/target.d.ts.map +1 -1
- package/dist/storage/redis/target.js +30 -1
- package/dist/storage/redis/target.js.map +1 -1
- package/dist/storage/redis/wire.d.ts +6 -6
- package/dist/storage/redis/wire.d.ts.map +1 -1
- package/dist/storage/redis/wire.js +6 -6
- package/dist/storage/redis/wire.js.map +1 -1
- package/dist/testing/mod.d.ts +83 -88
- package/dist/testing/mod.d.ts.map +1 -1
- package/dist/testing/mod.js +75 -81
- package/dist/testing/mod.js.map +1 -1
- package/dist/testing/playwright.d.ts +28 -32
- package/dist/testing/playwright.d.ts.map +1 -1
- package/dist/testing/playwright.js +22 -27
- package/dist/testing/playwright.js.map +1 -1
- package/dist/testing/puppeteer.d.ts +11 -12
- package/dist/testing/puppeteer.d.ts.map +1 -1
- package/dist/testing/puppeteer.js +17 -18
- package/dist/testing/puppeteer.js.map +1 -1
- package/dist/testing/system.d.ts +72 -90
- package/dist/testing/system.d.ts.map +1 -1
- package/dist/testing/system.js +90 -107
- package/dist/testing/system.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/frontends/mod.test.ts +6 -2
- package/frontends/mod.ts +20 -19
- package/gateway/errors.ts +30 -32
- package/gateway/match.ts +61 -57
- package/gateway/middleware.ts +62 -64
- package/gateway/mod.ts +73 -76
- package/gateway/request.ts +143 -140
- package/gateway/serve.ts +58 -63
- package/gateways/mod.ts +25 -23
- package/internal/runtime/napi/napi.cjs +1 -1
- package/internal/runtime/napi/napi.d.cts +10 -3
- package/internal/runtime/shutdown.ts +113 -101
- package/log/logger.test.ts +8 -0
- package/log/logger.ts +48 -45
- package/metrics/mod.ts +138 -122
- package/otel.ts +6 -3
- package/package.json +1 -1
- package/pubsub/subscription.ts +93 -123
- package/pubsub/topic.ts +96 -130
- package/reqctx/mod.ts +83 -86
- package/services/index.ts +78 -78
- package/shutdown/mod.ts +26 -25
- package/storage/clickhouse/database.ts +115 -129
- package/storage/clickhouse/errors.ts +27 -29
- package/storage/clickhouse/mod.ts +10 -10
- package/storage/objects/bucket.ts +209 -239
- package/storage/objects/error.ts +4 -4
- package/storage/postgres/database.ts +131 -164
- package/storage/postgres/errors.ts +45 -52
- package/storage/postgres/interval.ts +21 -21
- package/storage/redis/bitfield.ts +51 -26
- package/storage/redis/command.ts +16 -12
- package/storage/redis/commands.ts +99 -100
- package/storage/redis/database.ts +145 -123
- package/storage/redis/mod.ts +52 -48
- package/storage/redis/options.ts +26 -24
- package/storage/redis/pubsub.ts +14 -14
- package/storage/redis/redis.test.ts +17 -2
- package/storage/redis/reply.ts +85 -77
- package/storage/redis/scan.ts +6 -6
- package/storage/redis/script.ts +29 -22
- package/storage/redis/target.ts +34 -1
- package/storage/redis/wire.ts +8 -8
- package/testing/mod.ts +99 -105
- package/testing/playwright.ts +32 -37
- package/testing/puppeteer.ts +22 -23
- package/testing/system.ts +117 -133
|
@@ -2,92 +2,110 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
import type { Runtime } from './napi/napi.cjs';
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Current phase of Encore's graceful shutdown:
|
|
6
7
|
*
|
|
7
8
|
* - `not-started`: shutdown has not begun.
|
|
8
|
-
* - `started`: Pub/Sub intake has stopped; Encore
|
|
9
|
-
* handlers
|
|
10
|
-
* - `cleanup`: Encore is closing
|
|
11
|
-
* - `completed`: cleanup has finished
|
|
9
|
+
* - `started`: Pub/Sub intake has stopped; Encore is waiting for in-flight
|
|
10
|
+
* message handlers and application holds to finish.
|
|
11
|
+
* - `cleanup`: Encore is closing managed resources and flushing telemetry.
|
|
12
|
+
* - `completed`: cleanup has finished (whether it succeeded or timed out).
|
|
13
|
+
*/
|
|
12
14
|
export type ShutdownPhase = 'not-started' | 'started' | 'cleanup' | 'completed';
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
/**
|
|
16
|
+
* Outcome of a completed shutdown: `'success'` if cleanup finished within the
|
|
17
|
+
* shutdown deadline, or `'timeout'` if the deadline expired. A failed cleanup
|
|
18
|
+
* rejects with {@link ShutdownError}.
|
|
19
|
+
*/
|
|
16
20
|
export type ShutdownResult = 'success' | 'timeout';
|
|
17
|
-
/** Encore's cleanup
|
|
21
|
+
/** Thrown when Encore's resource cleanup fails or a shutdown API is called invalidly. */
|
|
18
22
|
export declare class ShutdownError extends Error {
|
|
19
23
|
name: string;
|
|
20
24
|
}
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
25
|
+
/**
|
|
26
|
+
* A hold that delays Encore resource cleanup until {@link release} is called
|
|
27
|
+
* or the shutdown deadline expires. Calling `release()` more than once is a
|
|
28
|
+
* no-op. Implements `Disposable` so `using` releases it automatically at the
|
|
29
|
+
* end of a scope.
|
|
30
|
+
*/
|
|
24
31
|
export interface ShutdownHold extends Disposable {
|
|
25
32
|
release(): void;
|
|
26
33
|
}
|
|
27
|
-
/**
|
|
34
|
+
/** Context passed to an {@link onShutdown} callback. */
|
|
28
35
|
export interface ShutdownContext {
|
|
29
|
-
/** Aborts when cleanup begins
|
|
30
|
-
*
|
|
36
|
+
/** Aborts when resource cleanup begins (either because the shutdown deadline
|
|
37
|
+
* expired or because cleanup was forced), even if the callback is still running. */
|
|
31
38
|
signal: AbortSignal;
|
|
32
|
-
/**
|
|
33
|
-
* `Date.now()`
|
|
39
|
+
/** Timestamp when the shutdown deadline expires, in milliseconds since the
|
|
40
|
+
* Unix epoch (matching `Date.now()`). */
|
|
34
41
|
deadline: number;
|
|
35
42
|
}
|
|
36
|
-
/**
|
|
43
|
+
/** Callback invoked when shutdown begins. Resource cleanup waits for any
|
|
44
|
+
* returned promise to settle (up to the shutdown deadline). */
|
|
37
45
|
export type ShutdownCallback = (ctx: ShutdownContext) => void | Promise<void>;
|
|
38
|
-
/** Aborts
|
|
39
|
-
*
|
|
46
|
+
/** Aborts as soon as shutdown begins: Encore stops accepting new Pub/Sub
|
|
47
|
+
* messages, and your application should stop accepting new work as well. */
|
|
40
48
|
export declare const signal: AbortSignal;
|
|
41
|
-
/** Sets the runtime
|
|
49
|
+
/** Sets the native runtime instance used to coordinate shutdown. */
|
|
42
50
|
export declare function setShutdownRuntime(rt: Runtime): void;
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
51
|
+
/**
|
|
52
|
+
* Delays Encore's resource cleanup until the returned hold is released or the
|
|
53
|
+
* shutdown deadline expires. If called after the application has already
|
|
54
|
+
* drained or cleanup has begun, returns an already-released hold and logs a
|
|
55
|
+
* warning.
|
|
56
|
+
*/
|
|
46
57
|
export declare function hold(): ShutdownHold;
|
|
47
|
-
/**
|
|
58
|
+
/** Delays resource cleanup until `work` settles. Any rejection is logged. */
|
|
48
59
|
export declare function waitUntil(work: PromiseLike<unknown>): void;
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
60
|
+
/**
|
|
61
|
+
* Registers `callback` to run when shutdown begins (or immediately if shutdown
|
|
62
|
+
* has already begun), delaying resource cleanup until it settles. Disposing
|
|
63
|
+
* the returned handle unregisters the callback.
|
|
64
|
+
*/
|
|
52
65
|
export declare function onShutdown(callback: ShutdownCallback): Disposable;
|
|
53
|
-
/** Registers
|
|
54
|
-
*
|
|
66
|
+
/** Registers an Encore-internal shutdown callback without disabling automatic
|
|
67
|
+
* detection of application-owned signal handlers. */
|
|
55
68
|
export declare function onShutdownInternal(callback: ShutdownCallback): Disposable;
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
69
|
+
/**
|
|
70
|
+
* Initiates graceful shutdown (idempotent): stops Pub/Sub intake, aborts
|
|
71
|
+
* {@link signal}, and invokes all registered {@link onShutdown} callbacks.
|
|
72
|
+
* Encore cleans up resources once every hold is released or the shutdown
|
|
73
|
+
* deadline expires. Outside tests, `SIGTERM` and `SIGINT` call this
|
|
74
|
+
* automatically.
|
|
75
|
+
*/
|
|
60
76
|
export declare function begin(): void;
|
|
61
|
-
/**
|
|
77
|
+
/** Returns the current shutdown phase. */
|
|
62
78
|
export declare function phase(): ShutdownPhase;
|
|
63
|
-
/** Resolves once
|
|
64
|
-
*
|
|
79
|
+
/** Resolves once shutdown has begun and Pub/Sub intake has stopped. Awaiting
|
|
80
|
+
* this promise does not keep the event loop alive. */
|
|
65
81
|
export declare function started(): Promise<void>;
|
|
66
|
-
/** Resolves once cleanup begins
|
|
67
|
-
*
|
|
82
|
+
/** Resolves once resource cleanup begins (because the app drained, the
|
|
83
|
+
* shutdown deadline expired, or cleanup was forced). Awaiting this promise
|
|
84
|
+
* does not keep the event loop alive. */
|
|
68
85
|
export declare function cleanup(): Promise<void>;
|
|
69
|
-
/** Resolves with the shutdown
|
|
70
|
-
* deadline
|
|
71
|
-
*
|
|
86
|
+
/** Resolves with the shutdown result once cleanup completes (even after the
|
|
87
|
+
* deadline), or rejects with {@link ShutdownError} if cleanup failed. Once
|
|
88
|
+
* shutdown has begun, awaiting this keeps the event loop alive. */
|
|
72
89
|
export declare function completed(): Promise<ShutdownResult>;
|
|
73
|
-
/**
|
|
74
|
-
*
|
|
90
|
+
/** Starts resource cleanup immediately without waiting for application holds
|
|
91
|
+
* or in-flight Pub/Sub handlers. Work still running may encounter closed
|
|
92
|
+
* resources. */
|
|
75
93
|
export declare function forceCleanup(): void;
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* forces cleanup.
|
|
94
|
+
/**
|
|
95
|
+
* Installs signal listeners for `SIGTERM` and `SIGINT` (and daemon stop
|
|
96
|
+
* requests on Windows) to drive graceful shutdown and exit once cleanup
|
|
97
|
+
* completes. Exits with `process.exitCode` (0 unless set) if cleanup succeeds
|
|
98
|
+
* within the deadline, or 1 otherwise. A second `SIGINT` forces cleanup.
|
|
81
99
|
*
|
|
82
|
-
*
|
|
83
|
-
* until
|
|
84
|
-
*
|
|
100
|
+
* If the application registers its own signal listener without using Encore's
|
|
101
|
+
* shutdown hooks, Encore waits until the application re-raises the signal,
|
|
102
|
+
* exits, or drains its event loop.
|
|
103
|
+
*/
|
|
85
104
|
export declare function watchShutdownSignals(): void;
|
|
86
|
-
/** Runs `
|
|
87
|
-
* runtime handles SIGTERM
|
|
88
|
-
*
|
|
89
|
-
* holds. */
|
|
105
|
+
/** Runs `r` until shutdown completes and returns the exit code. The native
|
|
106
|
+
* runtime handles `SIGTERM`, `SIGINT`, and Windows console close events,
|
|
107
|
+
* triggers JS shutdown here, and waits for application holds before cleanup. */
|
|
90
108
|
export declare function runUntilShutdown(r: Runtime): Promise<number>;
|
|
91
|
-
/**
|
|
109
|
+
/** Configures `sig` to force immediate cleanup when received a second time. */
|
|
92
110
|
export declare function forceCleanupOnRepeat(sig: NodeJS.Signals): void;
|
|
93
111
|
//# sourceMappingURL=shutdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../../../internal/runtime/shutdown.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../../../internal/runtime/shutdown.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnD,yFAAyF;AACzF,qBAAa,aAAc,SAAQ,KAAK;IAC7B,IAAI,SAAmB;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B;wFACoF;IACpF,MAAM,EAAE,WAAW,CAAC;IACpB;6CACyC;IACzC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;+DAC+D;AAC/D,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAqD9E;4EAC4E;AAC5E,eAAO,MAAM,MAAM,EAAE,WAA+B,CAAC;AAErD,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAEpD;AAOD;;;;;GAKG;AACH,wBAAgB,IAAI,IAAI,YAAY,CAiBnC;AAED,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAK1D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU,CAIjE;AAED;qDACqD;AACrD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU,CAGzE;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAY5B;AAED,0CAA0C;AAC1C,wBAAgB,KAAK,IAAI,aAAa,CAErC;AAED;sDACsD;AACtD,wBAAgB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAEvC;AAED;;yCAEyC;AACzC,wBAAgB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAEvC;AAED;;mEAEmE;AACnE,wBAAgB,SAAS,IAAI,OAAO,CAAC,cAAc,CAAC,CASnD;AAED;;gBAEgB;AAChB,wBAAgB,YAAY,IAAI,IAAI,CAGnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAK3C;AAED;;gFAEgF;AAChF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAI5D;AAED,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAE9D"}
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
/** Encore's cleanup
|
|
1
|
+
/** Thrown when Encore's resource cleanup fails or a shutdown API is called invalidly. */
|
|
2
2
|
export class ShutdownError extends Error {
|
|
3
3
|
name = 'ShutdownError';
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
/** Signals that initiate graceful shutdown. On Windows under Node.js, includes
|
|
6
|
+
* `SIGBREAK` (sent by the daemon when a process does not handle stop requests);
|
|
7
|
+
* Bun terminates immediately on `SIGBREAK` regardless of listeners. */
|
|
8
8
|
const SIGNALS = process.platform === 'win32' && !process.versions.bun
|
|
9
9
|
? ['SIGTERM', 'SIGINT', 'SIGBREAK']
|
|
10
10
|
: ['SIGTERM', 'SIGINT'];
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* members already received. */
|
|
11
|
+
/** Minimum interval after the first signal before the same signal is treated
|
|
12
|
+
* as a deliberate repeat rather than a duplicate forwarded by a process group. */
|
|
14
13
|
const REPEAT_MS = 1000;
|
|
15
14
|
let runtime;
|
|
16
|
-
/** Whether the runtime
|
|
17
|
-
*
|
|
15
|
+
/** Whether the native runtime owns the event loop ({@link runUntilShutdown}),
|
|
16
|
+
* handling signals natively and letting its caller exit. */
|
|
18
17
|
let hosted = false;
|
|
19
18
|
const callbacks = new Set();
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
19
|
+
/** Callbacks registered internally by Encore (such as the API framework's
|
|
20
|
+
* server), which do not count as application-managed shutdown hooks. */
|
|
22
21
|
const ownCallbacks = new WeakSet();
|
|
23
22
|
let holds = 0;
|
|
24
23
|
let begun = false;
|
|
25
24
|
let markBegun;
|
|
26
25
|
const begunAt = new Promise(resolve => (markBegun = resolve));
|
|
27
26
|
let deadline = 0;
|
|
28
|
-
/** Whether
|
|
27
|
+
/** Whether the application has already been marked drained (new holds no longer delay cleanup). */
|
|
29
28
|
let drained = false;
|
|
30
29
|
let cleaningUp = false;
|
|
31
30
|
const startAbort = new AbortController();
|
|
@@ -35,26 +34,24 @@ const startedAt = new Promise(resolve => (markStarted = resolve));
|
|
|
35
34
|
let markCleanup;
|
|
36
35
|
const cleanupAt = new Promise(resolve => (markCleanup = resolve));
|
|
37
36
|
let completion;
|
|
38
|
-
/**
|
|
39
|
-
* for
|
|
40
|
-
* waiting for its drain. */
|
|
37
|
+
/** Signals that force immediate cleanup when received a second time (a second
|
|
38
|
+
* Ctrl-C, or for gateway processes a second `SIGTERM` from the supervisor). */
|
|
41
39
|
const forcing = new Set(['SIGINT']);
|
|
42
|
-
/**
|
|
40
|
+
/** Signal that initiated shutdown; when set, Encore exits the process once cleanup finishes. */
|
|
43
41
|
let signalled;
|
|
44
42
|
let signalledAt = 0;
|
|
45
|
-
/**
|
|
46
|
-
* its shutdown, until it is done. */
|
|
43
|
+
/** Automatic hold kept while an application handles the shutdown signal itself. */
|
|
47
44
|
let appHold;
|
|
48
|
-
/**
|
|
45
|
+
/** Signal re-raised by the application after removing its own listener, re-sent after cleanup. */
|
|
49
46
|
let reraised;
|
|
50
|
-
/** Whether Encore
|
|
47
|
+
/** Whether Encore is currently waiting on cleanup to exit the process. */
|
|
51
48
|
let exiting = false;
|
|
52
|
-
/** Whether the process
|
|
49
|
+
/** Whether the process exit path has already started. */
|
|
53
50
|
let finished = false;
|
|
54
|
-
/** Aborts
|
|
55
|
-
*
|
|
51
|
+
/** Aborts as soon as shutdown begins: Encore stops accepting new Pub/Sub
|
|
52
|
+
* messages, and your application should stop accepting new work as well. */
|
|
56
53
|
export const signal = startAbort.signal;
|
|
57
|
-
/** Sets the runtime
|
|
54
|
+
/** Sets the native runtime instance used to coordinate shutdown. */
|
|
58
55
|
export function setShutdownRuntime(rt) {
|
|
59
56
|
runtime = rt;
|
|
60
57
|
}
|
|
@@ -63,12 +60,15 @@ function rt() {
|
|
|
63
60
|
throw new ShutdownError('the Encore runtime is not loaded');
|
|
64
61
|
return runtime;
|
|
65
62
|
}
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
63
|
+
/**
|
|
64
|
+
* Delays Encore's resource cleanup until the returned hold is released or the
|
|
65
|
+
* shutdown deadline expires. If called after the application has already
|
|
66
|
+
* drained or cleanup has begun, returns an already-released hold and logs a
|
|
67
|
+
* warning.
|
|
68
|
+
*/
|
|
69
69
|
export function hold() {
|
|
70
70
|
if (drained || cleaningUp) {
|
|
71
|
-
console.warn('encore:
|
|
71
|
+
console.warn('encore: shutdown hold acquired after the app drained; cleanup will not wait for it');
|
|
72
72
|
const release = () => { };
|
|
73
73
|
return { release, [Symbol.dispose]: release };
|
|
74
74
|
}
|
|
@@ -83,32 +83,37 @@ export function hold() {
|
|
|
83
83
|
};
|
|
84
84
|
return { release, [Symbol.dispose]: release };
|
|
85
85
|
}
|
|
86
|
-
/**
|
|
86
|
+
/** Delays resource cleanup until `work` settles. Any rejection is logged. */
|
|
87
87
|
export function waitUntil(work) {
|
|
88
88
|
const held = hold();
|
|
89
89
|
Promise.resolve(work)
|
|
90
90
|
.then(undefined, err => console.error('encore: shutdown work failed:', err))
|
|
91
91
|
.finally(() => held.release());
|
|
92
92
|
}
|
|
93
|
-
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
93
|
+
/**
|
|
94
|
+
* Registers `callback` to run when shutdown begins (or immediately if shutdown
|
|
95
|
+
* has already begun), delaying resource cleanup until it settles. Disposing
|
|
96
|
+
* the returned handle unregisters the callback.
|
|
97
|
+
*/
|
|
96
98
|
export function onShutdown(callback) {
|
|
97
99
|
callbacks.add(callback);
|
|
98
100
|
if (begun)
|
|
99
101
|
run(callback);
|
|
100
102
|
return { [Symbol.dispose]: () => void callbacks.delete(callback) };
|
|
101
103
|
}
|
|
102
|
-
/** Registers
|
|
103
|
-
*
|
|
104
|
+
/** Registers an Encore-internal shutdown callback without disabling automatic
|
|
105
|
+
* detection of application-owned signal handlers. */
|
|
104
106
|
export function onShutdownInternal(callback) {
|
|
105
107
|
ownCallbacks.add(callback);
|
|
106
108
|
return onShutdown(callback);
|
|
107
109
|
}
|
|
108
|
-
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
110
|
+
/**
|
|
111
|
+
* Initiates graceful shutdown (idempotent): stops Pub/Sub intake, aborts
|
|
112
|
+
* {@link signal}, and invokes all registered {@link onShutdown} callbacks.
|
|
113
|
+
* Encore cleans up resources once every hold is released or the shutdown
|
|
114
|
+
* deadline expires. Outside tests, `SIGTERM` and `SIGINT` call this
|
|
115
|
+
* automatically.
|
|
116
|
+
*/
|
|
112
117
|
export function begin() {
|
|
113
118
|
if (begun)
|
|
114
119
|
return;
|
|
@@ -125,23 +130,24 @@ export function begin() {
|
|
|
125
130
|
run(callback);
|
|
126
131
|
settle();
|
|
127
132
|
}
|
|
128
|
-
/**
|
|
133
|
+
/** Returns the current shutdown phase. */
|
|
129
134
|
export function phase() {
|
|
130
135
|
return (runtime?.shutdownPhase() ?? 'not-started');
|
|
131
136
|
}
|
|
132
|
-
/** Resolves once
|
|
133
|
-
*
|
|
137
|
+
/** Resolves once shutdown has begun and Pub/Sub intake has stopped. Awaiting
|
|
138
|
+
* this promise does not keep the event loop alive. */
|
|
134
139
|
export function started() {
|
|
135
140
|
return startedAt;
|
|
136
141
|
}
|
|
137
|
-
/** Resolves once cleanup begins
|
|
138
|
-
*
|
|
142
|
+
/** Resolves once resource cleanup begins (because the app drained, the
|
|
143
|
+
* shutdown deadline expired, or cleanup was forced). Awaiting this promise
|
|
144
|
+
* does not keep the event loop alive. */
|
|
139
145
|
export function cleanup() {
|
|
140
146
|
return cleanupAt;
|
|
141
147
|
}
|
|
142
|
-
/** Resolves with the shutdown
|
|
143
|
-
* deadline
|
|
144
|
-
*
|
|
148
|
+
/** Resolves with the shutdown result once cleanup completes (even after the
|
|
149
|
+
* deadline), or rejects with {@link ShutdownError} if cleanup failed. Once
|
|
150
|
+
* shutdown has begun, awaiting this keeps the event loop alive. */
|
|
145
151
|
export function completed() {
|
|
146
152
|
return (completion ??= begunAt
|
|
147
153
|
.then(() => rt().shutdownCompleted())
|
|
@@ -152,39 +158,40 @@ export function completed() {
|
|
|
152
158
|
return result;
|
|
153
159
|
}));
|
|
154
160
|
}
|
|
155
|
-
/**
|
|
156
|
-
*
|
|
161
|
+
/** Starts resource cleanup immediately without waiting for application holds
|
|
162
|
+
* or in-flight Pub/Sub handlers. Work still running may encounter closed
|
|
163
|
+
* resources. */
|
|
157
164
|
export function forceCleanup() {
|
|
158
165
|
if (!begun)
|
|
159
166
|
throw new ShutdownError('shutdown has not begun');
|
|
160
167
|
rt().forceShutdownCleanup();
|
|
161
168
|
}
|
|
162
|
-
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* forces cleanup.
|
|
169
|
+
/**
|
|
170
|
+
* Installs signal listeners for `SIGTERM` and `SIGINT` (and daemon stop
|
|
171
|
+
* requests on Windows) to drive graceful shutdown and exit once cleanup
|
|
172
|
+
* completes. Exits with `process.exitCode` (0 unless set) if cleanup succeeds
|
|
173
|
+
* within the deadline, or 1 otherwise. A second `SIGINT` forces cleanup.
|
|
167
174
|
*
|
|
168
|
-
*
|
|
169
|
-
* until
|
|
170
|
-
*
|
|
175
|
+
* If the application registers its own signal listener without using Encore's
|
|
176
|
+
* shutdown hooks, Encore waits until the application re-raises the signal,
|
|
177
|
+
* exits, or drains its event loop.
|
|
178
|
+
*/
|
|
171
179
|
export function watchShutdownSignals() {
|
|
172
180
|
for (const s of SIGNALS)
|
|
173
181
|
process.on(s, onSignal);
|
|
174
|
-
// Windows has no SIGTERM: the daemon
|
|
175
|
-
// as SIGTERM
|
|
182
|
+
// Windows has no SIGTERM: the daemon signals a named event instead, which we
|
|
183
|
+
// surface as SIGTERM so application listeners see it too.
|
|
176
184
|
rt().watchStopRequest(() => void process.emit('SIGTERM', 'SIGTERM'));
|
|
177
185
|
}
|
|
178
|
-
/** Runs `
|
|
179
|
-
* runtime handles SIGTERM
|
|
180
|
-
*
|
|
181
|
-
* holds. */
|
|
186
|
+
/** Runs `r` until shutdown completes and returns the exit code. The native
|
|
187
|
+
* runtime handles `SIGTERM`, `SIGINT`, and Windows console close events,
|
|
188
|
+
* triggers JS shutdown here, and waits for application holds before cleanup. */
|
|
182
189
|
export function runUntilShutdown(r) {
|
|
183
190
|
runtime = r;
|
|
184
191
|
hosted = true;
|
|
185
192
|
return r.runForever(true, begin);
|
|
186
193
|
}
|
|
187
|
-
/**
|
|
194
|
+
/** Configures `sig` to force immediate cleanup when received a second time. */
|
|
188
195
|
export function forceCleanupOnRepeat(sig) {
|
|
189
196
|
forcing.add(sig);
|
|
190
197
|
}
|
|
@@ -196,15 +203,15 @@ function onSignal(sig) {
|
|
|
196
203
|
signalled = sig;
|
|
197
204
|
signalledAt = Date.now();
|
|
198
205
|
if (!appTellsShutdown() && process.listenerCount(sig) > 1) {
|
|
199
|
-
// The app's own listeners run after this one
|
|
206
|
+
// The app's own listeners run after this one and may take time to drain.
|
|
200
207
|
appHold = hold();
|
|
201
|
-
console.warn(`encore:
|
|
202
|
-
'
|
|
208
|
+
console.warn(`encore: detected custom ${sig} handler; Encore will clean up after it finishes. ` +
|
|
209
|
+
'Use onShutdown() from @encore.dev/sdk/shutdown to coordinate shutdown explicitly.');
|
|
203
210
|
}
|
|
204
211
|
process.on('beforeExit', onIdle);
|
|
205
212
|
begin();
|
|
206
213
|
}
|
|
207
|
-
/**
|
|
214
|
+
/** Returns whether the application has any active holds or user-registered callbacks. */
|
|
208
215
|
function appTellsShutdown() {
|
|
209
216
|
if (holds > 0)
|
|
210
217
|
return true;
|
|
@@ -218,8 +225,7 @@ function repeated(sig) {
|
|
|
218
225
|
if (!signalled)
|
|
219
226
|
return;
|
|
220
227
|
if (appHold && sig === signalled && process.listenerCount(sig) === 1) {
|
|
221
|
-
// The app
|
|
222
|
-
// the signal it handled counts: another may arrive while it still runs.
|
|
228
|
+
// The app removed its own listener and re-raised the original signal.
|
|
223
229
|
reraised = sig;
|
|
224
230
|
appHold.release();
|
|
225
231
|
return;
|
|
@@ -228,12 +234,11 @@ function repeated(sig) {
|
|
|
228
234
|
rt().forceShutdownCleanup();
|
|
229
235
|
}
|
|
230
236
|
}
|
|
231
|
-
/**
|
|
232
|
-
*
|
|
233
|
-
* open on the event loop may yet release them. */
|
|
237
|
+
/** Called when the event loop empties: releases any automatic app-signal hold
|
|
238
|
+
* while still honoring explicit holds until the deadline. */
|
|
234
239
|
function onIdle() {
|
|
235
|
-
//
|
|
236
|
-
//
|
|
240
|
+
// Defer one turn so a signal re-raised while closing the last handle is
|
|
241
|
+
// observed first.
|
|
237
242
|
setImmediate(() => {
|
|
238
243
|
appHold?.release();
|
|
239
244
|
if (!finished)
|
|
@@ -247,11 +252,11 @@ function settle() {
|
|
|
247
252
|
function markDrained() {
|
|
248
253
|
drained = true;
|
|
249
254
|
rt().markApplicationDrained();
|
|
250
|
-
//
|
|
255
|
+
// Once the app is drained, keep the event loop alive while cleanup finishes.
|
|
251
256
|
if (signalled)
|
|
252
257
|
exitOnCompletion();
|
|
253
258
|
}
|
|
254
|
-
/**
|
|
259
|
+
/** Waits for cleanup to complete (keeping the event loop alive) and exits. */
|
|
255
260
|
function exitOnCompletion() {
|
|
256
261
|
if (exiting)
|
|
257
262
|
return;
|
|
@@ -260,12 +265,11 @@ function exitOnCompletion() {
|
|
|
260
265
|
}
|
|
261
266
|
function onPhase(phase, result) {
|
|
262
267
|
reached(phase);
|
|
263
|
-
// Cleanup also completes
|
|
264
|
-
// or not; the exit code then says it was cut short.
|
|
268
|
+
// Cleanup also completes if the deadline expires before the app finishes.
|
|
265
269
|
if (phase === 'completed' && signalled)
|
|
266
270
|
exit(result ?? 'failed');
|
|
267
271
|
}
|
|
268
|
-
/**
|
|
272
|
+
/** Resolves promises waiting on `phase` and any earlier phases. */
|
|
269
273
|
function reached(phase) {
|
|
270
274
|
if (phase === 'cleanup' || phase === 'completed') {
|
|
271
275
|
cleaningUp = true;
|
|
@@ -274,13 +278,13 @@ function reached(phase) {
|
|
|
274
278
|
}
|
|
275
279
|
markStarted();
|
|
276
280
|
}
|
|
277
|
-
/** Exits with 1 if cleanup failed or timed out
|
|
278
|
-
*
|
|
281
|
+
/** Exits with 1 if cleanup failed or timed out; otherwise re-raises any signal
|
|
282
|
+
* the application re-raised, or exits with `process.exitCode`. */
|
|
279
283
|
function exit(result) {
|
|
280
284
|
if (finished)
|
|
281
285
|
return;
|
|
282
286
|
finished = true;
|
|
283
|
-
// Completion may
|
|
287
|
+
// Completion may arrive before intermediate phase callbacks.
|
|
284
288
|
reached('completed');
|
|
285
289
|
if (result !== 'success')
|
|
286
290
|
process.exit(1);
|
|
@@ -292,8 +296,8 @@ function exit(result) {
|
|
|
292
296
|
}
|
|
293
297
|
process.exit();
|
|
294
298
|
}
|
|
295
|
-
/**
|
|
296
|
-
* cleanup
|
|
299
|
+
/** Handles synchronous process exit initiated by the application: finishes
|
|
300
|
+
* cleanup synchronously and overrides the exit code if cleanup fails. */
|
|
297
301
|
function finishOnExit() {
|
|
298
302
|
if (finished)
|
|
299
303
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../../../internal/runtime/shutdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../../../internal/runtime/shutdown.ts"],"names":[],"mappings":"AAoBA,yFAAyF;AACzF,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,IAAI,GAAG,eAAe,CAAC;CACjC;AA0BD;;uEAEuE;AACvE,MAAM,OAAO,GACX,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG;IACnD,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC;IACnC,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC5B;kFACkF;AAClF,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB,IAAI,OAA4B,CAAC;AACjC;4DAC4D;AAC5D,IAAI,MAAM,GAAG,KAAK,CAAC;AACnB,MAAM,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;AAC9C;wEACwE;AACxE,MAAM,YAAY,GAAG,IAAI,OAAO,EAAoB,CAAC;AACrD,IAAI,KAAK,GAAG,CAAC,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