@bella-baxter/nestjs 0.1.1-preview.14 → 0.1.1-preview.141
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 +76 -0
- package/package.json +13 -3
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @bella-baxter/nestjs
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@bella-baxter/nestjs)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
[Bella Baxter](https://github.com/Cosmic-Chimps/bella-baxter) module for NestJS — registers `BellaConfigService` as a globally injectable service backed by live-reloading secrets.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @bella-baxter/nestjs @nestjs/common @nestjs/core
|
|
12
|
+
# or
|
|
13
|
+
pnpm add @bella-baxter/nestjs @nestjs/common @nestjs/core
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Setup
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
// app.module.ts
|
|
20
|
+
import { Module } from '@nestjs/common';
|
|
21
|
+
import { BellaModule } from '@bella-baxter/nestjs';
|
|
22
|
+
|
|
23
|
+
@Module({
|
|
24
|
+
imports: [
|
|
25
|
+
BellaModule.register({
|
|
26
|
+
baxterUrl: process.env.BELLA_BAXTER_URL!,
|
|
27
|
+
apiKey: process.env.BELLA_BAXTER_API_KEY!,
|
|
28
|
+
projectSlug: 'my-app', // or BELLA_BAXTER_PROJECT env var
|
|
29
|
+
environmentSlug: 'production', // or BELLA_BAXTER_ENV env var
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
})
|
|
33
|
+
export class AppModule {}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Inject secrets
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// your.service.ts
|
|
40
|
+
import { Injectable } from '@nestjs/common';
|
|
41
|
+
import { BellaConfigService } from '@bella-baxter/nestjs';
|
|
42
|
+
|
|
43
|
+
@Injectable()
|
|
44
|
+
export class YourService {
|
|
45
|
+
constructor(private readonly bella: BellaConfigService) {}
|
|
46
|
+
|
|
47
|
+
getDbUrl(): string {
|
|
48
|
+
return this.bella.getOrThrow('DATABASE_URL');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Typed secrets
|
|
54
|
+
|
|
55
|
+
Run `bella secrets generate typescript --declaration` to generate `bella-secrets.d.ts`. The `BellaConfigService` proxy picks up the augmented `BellaSecrets` interface automatically:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
this.bella.DATABASE_URL // string — typed!
|
|
59
|
+
this.bella.PORT // number — after adding coercions
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Environment variables
|
|
63
|
+
|
|
64
|
+
| Variable | Description |
|
|
65
|
+
|----------|-------------|
|
|
66
|
+
| `BELLA_BAXTER_URL` | Base URL of the Bella Baxter API |
|
|
67
|
+
| `BELLA_BAXTER_API_KEY` | API key (`bax-...`) |
|
|
68
|
+
| `BELLA_BAXTER_PROJECT` | Project slug |
|
|
69
|
+
| `BELLA_BAXTER_ENV` | Environment slug |
|
|
70
|
+
| `BELLA_BAXTER_PRIVATE_KEY` | Private key for ZKE (optional) |
|
|
71
|
+
|
|
72
|
+
## Links
|
|
73
|
+
|
|
74
|
+
- [GitHub](https://github.com/Cosmic-Chimps/bella-baxter)
|
|
75
|
+
- [Issues](https://github.com/Cosmic-Chimps/bella-baxter/issues)
|
|
76
|
+
- [Core SDK](https://www.npmjs.com/package/@bella-baxter/sdk)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bella-baxter/nestjs",
|
|
3
|
-
"version": "0.1.1-preview.
|
|
3
|
+
"version": "0.1.1-preview.141",
|
|
4
4
|
"description": "Bella Baxter NestJS module — registers BellaConfig as an injectable service",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,17 +12,18 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
+
"README.md",
|
|
15
16
|
"dist"
|
|
16
17
|
],
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@bella-baxter/sdk": "0.1.1-preview.
|
|
19
|
+
"@bella-baxter/sdk": "0.1.1-preview.141"
|
|
19
20
|
},
|
|
20
21
|
"peerDependencies": {
|
|
21
22
|
"@nestjs/common": ">=10",
|
|
22
23
|
"@nestjs/core": ">=10"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
|
-
"typescript": "^
|
|
26
|
+
"typescript": "^6.0.2",
|
|
26
27
|
"@types/node": "^25.5.0",
|
|
27
28
|
"@nestjs/common": "^11.0.0",
|
|
28
29
|
"@nestjs/core": "^11.0.0",
|
|
@@ -35,6 +36,15 @@
|
|
|
35
36
|
"module"
|
|
36
37
|
],
|
|
37
38
|
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/Cosmic-Chimps/bella-baxter-js.git",
|
|
42
|
+
"directory": "apps/sdk/js/packages/nestjs"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/Cosmic-Chimps/bella-baxter-js/tree/main/packages/nestjs#readme",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/Cosmic-Chimps/bella-baxter-js/issues"
|
|
47
|
+
},
|
|
38
48
|
"scripts": {
|
|
39
49
|
"build": "tsc",
|
|
40
50
|
"typecheck": "tsc --noEmit"
|