@di-framework/bindings 6.0.14 → 6.0.16
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 +8 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,21 +14,23 @@ Terraform, Crossplane, Helm, or another infrastructure layer.
|
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { Component, Container } from '@di-framework/core/decorators';
|
|
17
|
-
import { KeyValue, Postgres,
|
|
17
|
+
import { KeyValue, Postgres, PlatformBinding } from '@di-framework/bindings';
|
|
18
18
|
|
|
19
|
-
@
|
|
19
|
+
@PlatformBinding('user-database')
|
|
20
20
|
@Container()
|
|
21
21
|
export class UserDatabase extends Postgres {}
|
|
22
22
|
|
|
23
|
-
@
|
|
23
|
+
@PlatformBinding('sessions', { interfaces: ['store', 'atomics'] })
|
|
24
24
|
@Container()
|
|
25
25
|
export class Sessions extends KeyValue {}
|
|
26
26
|
|
|
27
|
-
@
|
|
27
|
+
@PlatformBinding('cache')
|
|
28
28
|
@Container()
|
|
29
29
|
export class Cache extends KeyValue {}
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
`@WasmCloudBinding` remains exported as a deprecated alias of `@PlatformBinding` for back-compat; new code should use `@PlatformBinding`.
|
|
33
|
+
|
|
32
34
|
Put those classes in `src/bindings.ts`. The wasmCloud CLI extension discovers the file, contributes
|
|
33
35
|
each class to the shared WIT requirement graph, generates real WIT guest imports, and renders
|
|
34
36
|
matching `hostInterfaces` entries. PostgreSQL entries omit `hostInterfaces[].name` to match the
|
|
@@ -98,7 +100,7 @@ leaves it unloaded. Import `@di-framework/bindings/postgres` from a guest that d
|
|
|
98
100
|
Secret material is referenced, never inlined:
|
|
99
101
|
|
|
100
102
|
```ts
|
|
101
|
-
@
|
|
103
|
+
@PlatformBinding('user-database', { secretFrom: 'orders-user-database' })
|
|
102
104
|
@Container()
|
|
103
105
|
export class UserDatabase extends Postgres {}
|
|
104
106
|
```
|
|
@@ -136,7 +138,7 @@ testContainer.registerValue(UserDatabase, new FakeUserDatabase());
|
|
|
136
138
|
## Managed PostgreSQL (upcoming release)
|
|
137
139
|
|
|
138
140
|
```ts
|
|
139
|
-
@
|
|
141
|
+
@PlatformBinding('orders-db', { serviceName: 'orders' })
|
|
140
142
|
export class OrdersDatabase extends Postgres {}
|
|
141
143
|
```
|
|
142
144
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@di-framework/bindings",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.16",
|
|
4
4
|
"description": "Native platform WIT service bindings for DI Framework applications.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@di-framework/core": "^6",
|
|
49
49
|
"@di-framework/repo": "^6.1.0",
|
|
50
|
-
"typescript": "^5"
|
|
50
|
+
"typescript": "^5 || ^6 || ^7"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"@di-framework/repo": {
|