@jitar-plugins/filestore 0.0.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.
- package/README.md +45 -0
- package/dist/FileStoreHealthCheck.d.ts +9 -0
- package/dist/FileStoreHealthCheck.js +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +23 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
# File Store | Jitar Plugins
|
|
3
|
+
|
|
4
|
+
This package provides plugins for integrating the [The Shelf file store package](https://github.com/MaskingTechnology/theshelf/tree/main/packages/filestore) in Jitar applications.
|
|
5
|
+
|
|
6
|
+
It contains a single health check for checking the file store health.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @theshelf/filestore @jitar-plugins/filestore
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
Follow the following steps to configure and use the provided health check.
|
|
17
|
+
|
|
18
|
+
### Step 1 - Configure the health check
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// src/health/fileStoreHealthCheck.ts
|
|
22
|
+
|
|
23
|
+
import fileStore from '@theshelf/filestore';
|
|
24
|
+
import { FileStoreHealthCheck } from '@jitar-plugins/filestore';
|
|
25
|
+
|
|
26
|
+
export default new FileStoreHealthCheck(fileStore);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Step 2 - Activate the health check
|
|
30
|
+
|
|
31
|
+
With the health check in place, it needs to be activated by registering it to the worker / standalone service.
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
/* services/some-worker.json */
|
|
35
|
+
{
|
|
36
|
+
"url": "http://example.com:3000",
|
|
37
|
+
"healthChecks": [ /* add health checks here */
|
|
38
|
+
"./health/fileStoreHealthCheck"
|
|
39
|
+
],
|
|
40
|
+
"worker":
|
|
41
|
+
{
|
|
42
|
+
/* service configuration */
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HealthCheck } from 'jitar';
|
|
2
|
+
import type { FileStore } from '@theshelf/filestore';
|
|
3
|
+
export default class FileStoreHealthCheck implements HealthCheck {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(fileStore: FileStore);
|
|
6
|
+
get name(): string;
|
|
7
|
+
get timeout(): number;
|
|
8
|
+
isHealthy(): Promise<boolean>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default class FileStoreHealthCheck {
|
|
2
|
+
#fileStore;
|
|
3
|
+
#name = 'filestore';
|
|
4
|
+
#timeout = 5000;
|
|
5
|
+
constructor(fileStore) {
|
|
6
|
+
this.#fileStore = fileStore;
|
|
7
|
+
}
|
|
8
|
+
get name() { return this.#name; }
|
|
9
|
+
get timeout() { return this.#timeout; }
|
|
10
|
+
async isHealthy() {
|
|
11
|
+
return this.#fileStore.connected;
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FileStoreHealthCheck } from './FileStoreHealthCheck';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FileStoreHealthCheck } from './FileStoreHealthCheck';
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jitar-plugins/filestore",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"clean": "rimraf dist",
|
|
9
|
+
"lint": "eslint",
|
|
10
|
+
"review": "npm run build && npm run lint",
|
|
11
|
+
"prepublishOnly": "npm run build"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"README.md",
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"exports": "./dist/index.js",
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@theshelf/filestore": "^0.0.2",
|
|
21
|
+
"jitar": "^0.10.3"
|
|
22
|
+
}
|
|
23
|
+
}
|