@astroscope/health 0.3.2 → 0.4.0
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 +5 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -9
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ See the [demo/health](../../demo/health) directory for a working example.
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npm install @astroscope/health
|
|
16
|
+
npm install @astroscope/health health-probes
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
@@ -48,7 +48,7 @@ The health server and probe lifecycle are managed automatically — you only nee
|
|
|
48
48
|
```ts
|
|
49
49
|
// src/boot.ts
|
|
50
50
|
import type { BootContext } from '@astroscope/boot';
|
|
51
|
-
import { checks } from '
|
|
51
|
+
import { checks } from 'health-probes';
|
|
52
52
|
|
|
53
53
|
export async function onStartup({ dev, host, port }: BootContext) {
|
|
54
54
|
await connectToDatabase();
|
|
@@ -113,7 +113,8 @@ Probe endpoint paths. Two presets are available:
|
|
|
113
113
|
- `SimplePaths`: `/live`, `/ready`, `/startup`, `/health`
|
|
114
114
|
|
|
115
115
|
```ts
|
|
116
|
-
import health
|
|
116
|
+
import health from '@astroscope/health';
|
|
117
|
+
import { SimplePaths } from 'health-probes';
|
|
117
118
|
|
|
118
119
|
health({ paths: SimplePaths });
|
|
119
120
|
```
|
|
@@ -178,7 +179,7 @@ Status values:
|
|
|
178
179
|
Register health checks to verify dependencies are working:
|
|
179
180
|
|
|
180
181
|
```ts
|
|
181
|
-
import { checks } from '
|
|
182
|
+
import { checks } from 'health-probes';
|
|
182
183
|
|
|
183
184
|
// return result (recommended for boolean checks)
|
|
184
185
|
checks.register('database', () => ({
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
6
|
import { prepend } from "@astroscope/boot/prepend";
|
|
7
|
-
import { checks, K8sPaths, SimplePaths } from "health-probes";
|
|
8
7
|
function health(options = {}) {
|
|
9
8
|
const enableDev = options.dev ?? false;
|
|
10
9
|
const serverOptions = {
|
|
@@ -25,11 +24,6 @@ __astroscope_registerHealth(${JSON.stringify(serverOptions)});`
|
|
|
25
24
|
);
|
|
26
25
|
updateConfig({
|
|
27
26
|
vite: {
|
|
28
|
-
ssr: {
|
|
29
|
-
// ensure health-probes is resolved at runtime, not bundled;
|
|
30
|
-
// singleton checks/probes instances must be shared across entry and user code
|
|
31
|
-
external: ["health-probes"]
|
|
32
|
-
},
|
|
33
27
|
plugins: [
|
|
34
28
|
{
|
|
35
29
|
name: "@astroscope/health",
|
|
@@ -46,8 +40,5 @@ __astroscope_registerHealth(${JSON.stringify(serverOptions)});`
|
|
|
46
40
|
};
|
|
47
41
|
}
|
|
48
42
|
export {
|
|
49
|
-
K8sPaths,
|
|
50
|
-
SimplePaths,
|
|
51
|
-
checks,
|
|
52
43
|
health as default
|
|
53
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astroscope/health",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Kubernetes-style health probes integration for Astro",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,18 +44,17 @@
|
|
|
44
44
|
"url": "https://github.com/smnbbrv/astroscope/issues"
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/smnbbrv/astroscope/tree/main/packages/health#readme",
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"health-probes": "^1.1.0"
|
|
49
|
-
},
|
|
50
47
|
"devDependencies": {
|
|
51
48
|
"astro": "^6.0.7",
|
|
49
|
+
"health-probes": "^1.1.0",
|
|
52
50
|
"tsup": "^8.5.1",
|
|
53
51
|
"typescript": "^5.9.3",
|
|
54
|
-
"@astroscope/boot": "^0.
|
|
52
|
+
"@astroscope/boot": "^0.6.1"
|
|
55
53
|
},
|
|
56
54
|
"peerDependencies": {
|
|
57
55
|
"astro": "^6.0.0",
|
|
58
|
-
"
|
|
56
|
+
"health-probes": "^1.1.0",
|
|
57
|
+
"@astroscope/boot": "^0.6.1"
|
|
59
58
|
},
|
|
60
59
|
"scripts": {
|
|
61
60
|
"build": "tsup src/index.ts src/register.ts --format esm --dts",
|