@forinda/kickjs-multi-tenant 1.2.12 → 1.3.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 +55 -0
- package/package.json +29 -7
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @forinda/kickjs-multi-tenant
|
|
2
|
+
|
|
3
|
+
Multi-tenancy helpers for KickJS — tenant resolution, scoped DI, and database routing.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Using the KickJS CLI (recommended)
|
|
9
|
+
kick add multi-tenant
|
|
10
|
+
|
|
11
|
+
# Manual install
|
|
12
|
+
pnpm add @forinda/kickjs-multi-tenant
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- `TenantAdapter` — lifecycle adapter that resolves tenant from requests
|
|
18
|
+
- `TENANT_CONTEXT` token for injecting tenant info via DI
|
|
19
|
+
- Pluggable resolution strategies: header, subdomain, path, or custom
|
|
20
|
+
- Scoped DI for per-tenant service instances
|
|
21
|
+
|
|
22
|
+
## Quick Example
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { TenantAdapter, TENANT_CONTEXT, type TenantInfo } from '@forinda/kickjs-multi-tenant'
|
|
26
|
+
import { Inject, Service } from '@forinda/kickjs-core'
|
|
27
|
+
|
|
28
|
+
bootstrap({
|
|
29
|
+
modules,
|
|
30
|
+
adapters: [
|
|
31
|
+
new TenantAdapter({
|
|
32
|
+
strategy: 'header',
|
|
33
|
+
headerName: 'X-Tenant-ID',
|
|
34
|
+
}),
|
|
35
|
+
],
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// Access tenant in any service
|
|
39
|
+
@Service()
|
|
40
|
+
class DataService {
|
|
41
|
+
@Inject(TENANT_CONTEXT) private tenant!: TenantInfo
|
|
42
|
+
|
|
43
|
+
async getData() {
|
|
44
|
+
return this.repo.findByTenant(this.tenant.id)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Documentation
|
|
50
|
+
|
|
51
|
+
[Full documentation](https://forinda.github.io/kick-js/)
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forinda/kickjs-multi-tenant",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Multi-tenancy helpers for KickJS — tenant resolution, scoped DI, and database routing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kickjs",
|
|
7
|
-
"
|
|
7
|
+
"nodejs",
|
|
8
|
+
"typescript",
|
|
9
|
+
"express",
|
|
10
|
+
"decorators",
|
|
11
|
+
"dependency-injection",
|
|
12
|
+
"backend",
|
|
13
|
+
"api",
|
|
14
|
+
"framework",
|
|
8
15
|
"multitenancy",
|
|
9
16
|
"saas",
|
|
10
17
|
"tenant",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
18
|
+
"subdomain",
|
|
19
|
+
"isolation",
|
|
13
20
|
"@forinda/kickjs-core",
|
|
14
|
-
"@forinda/kickjs-http"
|
|
21
|
+
"@forinda/kickjs-http",
|
|
22
|
+
"@forinda/kickjs-config",
|
|
23
|
+
"@forinda/kickjs-cli",
|
|
24
|
+
"@forinda/kickjs-swagger",
|
|
25
|
+
"@forinda/kickjs-testing",
|
|
26
|
+
"@forinda/kickjs-prisma",
|
|
27
|
+
"@forinda/kickjs-ws",
|
|
28
|
+
"@forinda/kickjs-drizzle",
|
|
29
|
+
"@forinda/kickjs-otel",
|
|
30
|
+
"@forinda/kickjs-graphql",
|
|
31
|
+
"@forinda/kickjs-auth",
|
|
32
|
+
"@forinda/kickjs-cron",
|
|
33
|
+
"@forinda/kickjs-mailer",
|
|
34
|
+
"@forinda/kickjs-queue",
|
|
35
|
+
"@forinda/kickjs-devtools",
|
|
36
|
+
"@forinda/kickjs-notifications"
|
|
15
37
|
],
|
|
16
38
|
"type": "module",
|
|
17
39
|
"main": "dist/index.js",
|
|
@@ -27,8 +49,8 @@
|
|
|
27
49
|
],
|
|
28
50
|
"dependencies": {
|
|
29
51
|
"reflect-metadata": "^0.2.2",
|
|
30
|
-
"@forinda/kickjs-core": "1.
|
|
31
|
-
"@forinda/kickjs-http": "1.
|
|
52
|
+
"@forinda/kickjs-core": "1.3.0",
|
|
53
|
+
"@forinda/kickjs-http": "1.3.0"
|
|
32
54
|
},
|
|
33
55
|
"devDependencies": {
|
|
34
56
|
"@types/node": "^24.5.2",
|