@breadstone/archipel-mcp 0.0.46 → 0.0.48
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/data/guides/composition-context.md +462 -0
- package/data/guides/index.md +1 -0
- package/data/packages/platform-blob-storage/api/Class.BlobStorageStrategyBase.md +1 -0
- package/data/packages/platform-blob-storage/api/Class.EmptyBlobStorageStrategy.md +183 -0
- package/data/packages/platform-blob-storage/api/Variable.AWS_S3_ACCESS_KEY_ID.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.AWS_S3_BUCKET.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.AWS_S3_CONFIG_ENTRIES.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.AWS_S3_ENDPOINT.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.AWS_S3_REGION.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.AWS_S3_SECRET_ACCESS_KEY.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.LOCAL_BLOB_BASE_PATH.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.LOCAL_BLOB_BUCKET.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.LOCAL_CONFIG_ENTRIES.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.PLATFORM_BLOB_STORAGE_CONFIG_ENTRIES.md +1 -1
- package/data/packages/platform-blob-storage/api/index.md +1 -0
- package/data/packages/platform-blob-storage/index.md +21 -1
- package/data/packages/platform-bootstrap/api/Class.CompositionContext.md +226 -0
- package/data/packages/platform-bootstrap/api/Class.CompositionModule.md +56 -0
- package/data/packages/platform-bootstrap/api/Class.CompositionResolver.md +206 -0
- package/data/packages/platform-bootstrap/api/Class.PlatformApplicationBuilder.md +75 -8
- package/data/packages/platform-bootstrap/api/Function.createCompositionContext.md +56 -0
- package/data/packages/platform-bootstrap/api/Interface.ICompositionContext.md +179 -0
- package/data/packages/platform-bootstrap/api/Interface.ICreateCompositionContextOptions.md +54 -0
- package/data/packages/platform-bootstrap/api/Interface.ICreateWithCompositionOptions.md +128 -0
- package/data/packages/platform-bootstrap/api/Interface.IProviderDecision.md +36 -0
- package/data/packages/platform-bootstrap/api/TypeAlias.CompositionImport.md +20 -0
- package/data/packages/platform-bootstrap/api/TypeAlias.ProviderComposer.md +53 -0
- package/data/packages/platform-bootstrap/api/index.md +10 -0
- package/data/packages/platform-database/api/Class.DatabaseModule.md +22 -7
- package/data/packages/platform-database/api/Interface.IRepositoryQuery2.md +2 -0
- package/data/packages/platform-mailing/api/Class.DeliveryStrategyBase.md +0 -1
- package/data/packages/platform-mailing/api/index.md +0 -1
- package/package.json +1 -1
- package/data/packages/platform-mailing/api/Class.LogDeliveryStrategy.md +0 -71
|
@@ -5,7 +5,7 @@ editUrl: false
|
|
|
5
5
|
---
|
|
6
6
|
# Class: PlatformApplicationBuilder\<TApplication\>
|
|
7
7
|
|
|
8
|
-
Defined in: [application/PlatformApplicationBuilder.ts:
|
|
8
|
+
Defined in: [application/PlatformApplicationBuilder.ts:99](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L99)
|
|
9
9
|
|
|
10
10
|
Fluent builder that composes NestJS bootstrap steps and executes them once.
|
|
11
11
|
|
|
@@ -23,7 +23,7 @@ Fluent builder that composes NestJS bootstrap steps and executes them once.
|
|
|
23
23
|
new PlatformApplicationBuilder<TApplication>(app, options?): PlatformApplicationBuilder<TApplication>;
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
Defined in: [application/PlatformApplicationBuilder.ts:
|
|
26
|
+
Defined in: [application/PlatformApplicationBuilder.ts:111](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L111)
|
|
27
27
|
|
|
28
28
|
#### Parameters
|
|
29
29
|
|
|
@@ -46,7 +46,7 @@ Defined in: [application/PlatformApplicationBuilder.ts:28](https://github.com/Ru
|
|
|
46
46
|
get app(): TApplication;
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Defined in: [application/PlatformApplicationBuilder.ts:
|
|
49
|
+
Defined in: [application/PlatformApplicationBuilder.ts:205](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L205)
|
|
50
50
|
|
|
51
51
|
The wrapped NestJS application.
|
|
52
52
|
|
|
@@ -56,13 +56,80 @@ The wrapped NestJS application.
|
|
|
56
56
|
|
|
57
57
|
## Methods
|
|
58
58
|
|
|
59
|
+
### createWithComposition()
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
static createWithComposition<TApp>(composer, options?): Promise<PlatformApplicationBuilder<TApp>>;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Defined in: [application/PlatformApplicationBuilder.ts:163](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L163)
|
|
66
|
+
|
|
67
|
+
Creates a new application builder using composition-based module assembly.
|
|
68
|
+
|
|
69
|
+
This factory bootstraps a lightweight composition context to read configuration
|
|
70
|
+
values, then invokes the provided composer function to determine which modules
|
|
71
|
+
to import. The resulting modules are assembled into a dynamic root module
|
|
72
|
+
and a NestJS application is created from it.
|
|
73
|
+
|
|
74
|
+
The composition context is automatically closed after the composer function completes.
|
|
75
|
+
|
|
76
|
+
#### Type Parameters
|
|
77
|
+
|
|
78
|
+
| Type Parameter | Default type | Description |
|
|
79
|
+
| ------ | ------ | ------ |
|
|
80
|
+
| `TApp` *extends* `INestApplication`\<`any`\> | `INestApplication`\<`any`\> | The NestJS application type. Defaults to INestApplication. |
|
|
81
|
+
|
|
82
|
+
#### Parameters
|
|
83
|
+
|
|
84
|
+
| Parameter | Type | Description |
|
|
85
|
+
| ------ | ------ | ------ |
|
|
86
|
+
| `composer` | (`context`) => \| [`CompositionImport`](TypeAlias.CompositionImport)[] \| `Promise`\<[`CompositionImport`](TypeAlias.CompositionImport)[]\> | A function that receives the composition context and returns an array of modules to import. |
|
|
87
|
+
| `options?` | [`ICreateWithCompositionOptions`](Interface.ICreateWithCompositionOptions)\<`TApp`\> | Options for creating the composed application. |
|
|
88
|
+
|
|
89
|
+
#### Returns
|
|
90
|
+
|
|
91
|
+
`Promise`\<`PlatformApplicationBuilder`\<`TApp`\>\>
|
|
92
|
+
|
|
93
|
+
A promise that resolves to a configured PlatformApplicationBuilder.
|
|
94
|
+
|
|
95
|
+
#### Example
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { PlatformApplicationBuilder } from '@breadstone/archipel-platform-bootstrap';
|
|
99
|
+
import { ExpressAdapter, NestExpressApplication } from '@nestjs/platform-express';
|
|
100
|
+
|
|
101
|
+
const builder = await PlatformApplicationBuilder.createWithComposition<NestExpressApplication>(
|
|
102
|
+
async (context) => {
|
|
103
|
+
const imports: CompositionImport[] = [AppModule];
|
|
104
|
+
|
|
105
|
+
const driver = context.tryGetConfigValue({ key: 'MAIL_DRIVER' }, 'log');
|
|
106
|
+
if (driver === 'smtp') {
|
|
107
|
+
const { MailModule } = await import('@breadstone/archipel-platform-mailing');
|
|
108
|
+
const { SmtpDeliveryStrategy } = await import('@breadstone/archipel-platform-mailing/delivering/smtp');
|
|
109
|
+
imports.push(MailModule.register({ deliveryStrategy: SmtpDeliveryStrategy }));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return imports;
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
appFactory: (module) => NestFactory.create<NestExpressApplication>(module, new ExpressAdapter()),
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
await builder
|
|
120
|
+
.use(useApi({ prefix: 'api' }))
|
|
121
|
+
.listenFromConfig({ fallbackPort: 3000 });
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
***
|
|
125
|
+
|
|
59
126
|
### initialize()
|
|
60
127
|
|
|
61
128
|
```ts
|
|
62
129
|
initialize(): Promise<TApplication>;
|
|
63
130
|
```
|
|
64
131
|
|
|
65
|
-
Defined in: [application/PlatformApplicationBuilder.ts:
|
|
132
|
+
Defined in: [application/PlatformApplicationBuilder.ts:231](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L231)
|
|
66
133
|
|
|
67
134
|
Executes the configured bootstrap pipeline and initializes the NestJS application.
|
|
68
135
|
|
|
@@ -80,7 +147,7 @@ The wrapped NestJS application.
|
|
|
80
147
|
listen(port, hostname?): Promise<TApplication>;
|
|
81
148
|
```
|
|
82
149
|
|
|
83
|
-
Defined in: [application/PlatformApplicationBuilder.ts:
|
|
150
|
+
Defined in: [application/PlatformApplicationBuilder.ts:255](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L255)
|
|
84
151
|
|
|
85
152
|
Executes the pipeline and starts the NestJS listener on the given port.
|
|
86
153
|
|
|
@@ -105,7 +172,7 @@ The wrapped NestJS application.
|
|
|
105
172
|
listenFromConfig(options?): Promise<TApplication>;
|
|
106
173
|
```
|
|
107
174
|
|
|
108
|
-
Defined in: [application/PlatformApplicationBuilder.ts:
|
|
175
|
+
Defined in: [application/PlatformApplicationBuilder.ts:274](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L274)
|
|
109
176
|
|
|
110
177
|
Executes the pipeline and starts the listener using typed configuration keys.
|
|
111
178
|
|
|
@@ -129,7 +196,7 @@ The wrapped NestJS application.
|
|
|
129
196
|
run(): Promise<PlatformBootstrapContext<TApplication>>;
|
|
130
197
|
```
|
|
131
198
|
|
|
132
|
-
Defined in: [application/PlatformApplicationBuilder.ts:
|
|
199
|
+
Defined in: [application/PlatformApplicationBuilder.ts:243](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L243)
|
|
133
200
|
|
|
134
201
|
Executes the configured bootstrap pipeline without starting a listener.
|
|
135
202
|
|
|
@@ -147,7 +214,7 @@ The bootstrap context used for the execution.
|
|
|
147
214
|
use(step): this;
|
|
148
215
|
```
|
|
149
216
|
|
|
150
|
-
Defined in: [application/PlatformApplicationBuilder.ts:
|
|
217
|
+
Defined in: [application/PlatformApplicationBuilder.ts:220](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L220)
|
|
151
218
|
|
|
152
219
|
Adds a bootstrap step to the application pipeline.
|
|
153
220
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Function: createCompositionContext()'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Function: createCompositionContext()
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
function createCompositionContext(options?): Promise<ICompositionContext>;
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Defined in: composition/factory/createCompositionContext.ts:88
|
|
13
|
+
|
|
14
|
+
Creates a temporary NestJS context for stage-aware module composition.
|
|
15
|
+
|
|
16
|
+
This function bootstraps a minimal NestJS application context that provides
|
|
17
|
+
access to configuration. Use this context to make decisions about which
|
|
18
|
+
modules should be dynamically imported into the real application.
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
| Parameter | Type | Description |
|
|
23
|
+
| ------ | ------ | ------ |
|
|
24
|
+
| `options?` | [`ICreateCompositionContextOptions`](Interface.ICreateCompositionContextOptions) | Optional configuration for the composition context. |
|
|
25
|
+
|
|
26
|
+
## Returns
|
|
27
|
+
|
|
28
|
+
`Promise`\<[`ICompositionContext`](Interface.ICompositionContext)\>
|
|
29
|
+
|
|
30
|
+
A promise that resolves to the composition context.
|
|
31
|
+
|
|
32
|
+
## Remarks
|
|
33
|
+
|
|
34
|
+
The composition context must be closed after the real application has been
|
|
35
|
+
created by calling [ICompositionContext.close](Interface.ICompositionContext#close). Use a try/finally block
|
|
36
|
+
to ensure proper cleanup.
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
async function bootstrap(): Promise<void> {
|
|
42
|
+
const composition = await createCompositionContext();
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const appModule = await createAppModule(composition);
|
|
46
|
+
const app = await NestFactory.create(appModule);
|
|
47
|
+
|
|
48
|
+
await PlatformApplicationBuilder
|
|
49
|
+
.from(app)
|
|
50
|
+
.use(useApi({ ... }))
|
|
51
|
+
.listenFromConfig();
|
|
52
|
+
} finally {
|
|
53
|
+
await composition.close();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Interface: ICompositionContext'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Interface: ICompositionContext
|
|
7
|
+
|
|
8
|
+
Defined in: composition/context/ICompositionContext.ts:35
|
|
9
|
+
|
|
10
|
+
Pre-bootstrap context for stage-aware module composition.
|
|
11
|
+
|
|
12
|
+
This context is created before the main application module graph is built.
|
|
13
|
+
It provides access to configuration and lightweight composition services
|
|
14
|
+
that help determine which modules should be dynamically imported.
|
|
15
|
+
|
|
16
|
+
## Remarks
|
|
17
|
+
|
|
18
|
+
The composition context uses a temporary NestJS application context internally.
|
|
19
|
+
This context must be closed after the real application has been created by
|
|
20
|
+
calling [ICompositionContext.close](#close).
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
const composition = await createCompositionContext();
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const appModule = await createAppModule(composition);
|
|
29
|
+
const app = await NestFactory.create(appModule);
|
|
30
|
+
await app.listen(3000);
|
|
31
|
+
} finally {
|
|
32
|
+
await composition.close();
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Properties
|
|
37
|
+
|
|
38
|
+
### config
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
readonly config: ConfigService;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Defined in: composition/context/ICompositionContext.ts:53
|
|
45
|
+
|
|
46
|
+
The Archipel configuration service.
|
|
47
|
+
|
|
48
|
+
Provides typed access to environment configuration values.
|
|
49
|
+
|
|
50
|
+
***
|
|
51
|
+
|
|
52
|
+
### context
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
readonly context: INestApplicationContext;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Defined in: composition/context/ICompositionContext.ts:44
|
|
59
|
+
|
|
60
|
+
The temporary NestJS application context.
|
|
61
|
+
|
|
62
|
+
Used only for dependency injection resolution during composition.
|
|
63
|
+
Do not use this context for runtime services.
|
|
64
|
+
|
|
65
|
+
## Methods
|
|
66
|
+
|
|
67
|
+
### close()
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
close(): Promise<void>;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Defined in: composition/context/ICompositionContext.ts:100
|
|
74
|
+
|
|
75
|
+
Closes the temporary composition context.
|
|
76
|
+
|
|
77
|
+
Must be called after the real application has been created to release
|
|
78
|
+
resources held by the composition context.
|
|
79
|
+
|
|
80
|
+
#### Returns
|
|
81
|
+
|
|
82
|
+
`Promise`\<`void`\>
|
|
83
|
+
|
|
84
|
+
A promise that resolves when the context is closed.
|
|
85
|
+
|
|
86
|
+
***
|
|
87
|
+
|
|
88
|
+
### getConfigValue()
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
getConfigValue<T>(key): T;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Defined in: composition/context/ICompositionContext.ts:65
|
|
95
|
+
|
|
96
|
+
Reads a required configuration value.
|
|
97
|
+
|
|
98
|
+
#### Type Parameters
|
|
99
|
+
|
|
100
|
+
| Type Parameter | Description |
|
|
101
|
+
| ------ | ------ |
|
|
102
|
+
| `T` | The expected type of the configuration value. |
|
|
103
|
+
|
|
104
|
+
#### Parameters
|
|
105
|
+
|
|
106
|
+
| Parameter | Type | Description |
|
|
107
|
+
| ------ | ------ | ------ |
|
|
108
|
+
| `key` | `IConfigKey`\<`T`\> | The typed configuration key. |
|
|
109
|
+
|
|
110
|
+
#### Returns
|
|
111
|
+
|
|
112
|
+
`T`
|
|
113
|
+
|
|
114
|
+
The typed configuration value.
|
|
115
|
+
|
|
116
|
+
#### Throws
|
|
117
|
+
|
|
118
|
+
When the configuration key is not found.
|
|
119
|
+
|
|
120
|
+
***
|
|
121
|
+
|
|
122
|
+
### getService()
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
getService<T>(token): T;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Defined in: composition/context/ICompositionContext.ts:88
|
|
129
|
+
|
|
130
|
+
Resolves a provider from the composition context.
|
|
131
|
+
|
|
132
|
+
#### Type Parameters
|
|
133
|
+
|
|
134
|
+
| Type Parameter | Description |
|
|
135
|
+
| ------ | ------ |
|
|
136
|
+
| `T` | The type of the provider. |
|
|
137
|
+
|
|
138
|
+
#### Parameters
|
|
139
|
+
|
|
140
|
+
| Parameter | Type | Description |
|
|
141
|
+
| ------ | ------ | ------ |
|
|
142
|
+
| `token` | (...`args`) => `T` | The provider token (class, string, or symbol). |
|
|
143
|
+
|
|
144
|
+
#### Returns
|
|
145
|
+
|
|
146
|
+
`T`
|
|
147
|
+
|
|
148
|
+
The resolved provider instance.
|
|
149
|
+
|
|
150
|
+
***
|
|
151
|
+
|
|
152
|
+
### tryGetConfigValue()
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
tryGetConfigValue<T>(key, fallback): T;
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Defined in: composition/context/ICompositionContext.ts:77
|
|
159
|
+
|
|
160
|
+
Reads an optional configuration value with a fallback.
|
|
161
|
+
|
|
162
|
+
#### Type Parameters
|
|
163
|
+
|
|
164
|
+
| Type Parameter | Description |
|
|
165
|
+
| ------ | ------ |
|
|
166
|
+
| `T` | The expected type of the configuration value. |
|
|
167
|
+
|
|
168
|
+
#### Parameters
|
|
169
|
+
|
|
170
|
+
| Parameter | Type | Description |
|
|
171
|
+
| ------ | ------ | ------ |
|
|
172
|
+
| `key` | `IConfigKey`\<`T`\> | The typed configuration key. |
|
|
173
|
+
| `fallback` | `T` | The fallback value when the key is absent. |
|
|
174
|
+
|
|
175
|
+
#### Returns
|
|
176
|
+
|
|
177
|
+
`T`
|
|
178
|
+
|
|
179
|
+
The typed configuration value or the fallback.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Interface: ICreateCompositionContextOptions'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Interface: ICreateCompositionContextOptions
|
|
7
|
+
|
|
8
|
+
Defined in: composition/factory/createCompositionContext.ts:17
|
|
9
|
+
|
|
10
|
+
Options for creating the composition context.
|
|
11
|
+
|
|
12
|
+
## Properties
|
|
13
|
+
|
|
14
|
+
### enableLogging?
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
readonly optional enableLogging?: boolean;
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Defined in: composition/factory/createCompositionContext.ts:49
|
|
21
|
+
|
|
22
|
+
Whether to enable logging for the composition context.
|
|
23
|
+
|
|
24
|
+
Defaults to `false` to keep composition silent.
|
|
25
|
+
|
|
26
|
+
***
|
|
27
|
+
|
|
28
|
+
### module?
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
readonly optional module?: Type<unknown>;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Defined in: composition/factory/createCompositionContext.ts:40
|
|
35
|
+
|
|
36
|
+
Custom composition module to use instead of the default [CompositionModule](Class.CompositionModule).
|
|
37
|
+
|
|
38
|
+
Use this to provide application-specific composition services such as
|
|
39
|
+
custom [CompositionResolver](Class.CompositionResolver) implementations.
|
|
40
|
+
|
|
41
|
+
#### Example
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
@Module({
|
|
45
|
+
imports: [ConfigModule.forRoot({ strategyFactory: () => new EnvironmentConfigStrategy() })],
|
|
46
|
+
providers: [AppCompositionResolver],
|
|
47
|
+
exports: [ConfigModule, AppCompositionResolver]
|
|
48
|
+
})
|
|
49
|
+
export class AppCompositionModule {}
|
|
50
|
+
|
|
51
|
+
const context = await createCompositionContext({
|
|
52
|
+
module: AppCompositionModule
|
|
53
|
+
});
|
|
54
|
+
```
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Interface: ICreateWithCompositionOptions\<TApplication\>'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Interface: ICreateWithCompositionOptions\<TApplication\>
|
|
7
|
+
|
|
8
|
+
Defined in: [application/PlatformApplicationBuilder.ts:22](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L22)
|
|
9
|
+
|
|
10
|
+
Options for creating a composed application.
|
|
11
|
+
|
|
12
|
+
## Type Parameters
|
|
13
|
+
|
|
14
|
+
| Type Parameter | Default type |
|
|
15
|
+
| ------ | ------ |
|
|
16
|
+
| `TApplication` *extends* `INestApplication` | `INestApplication` |
|
|
17
|
+
|
|
18
|
+
## Properties
|
|
19
|
+
|
|
20
|
+
### adapter?
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
readonly optional adapter?: unknown;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Defined in: [application/PlatformApplicationBuilder.ts:70](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L70)
|
|
27
|
+
|
|
28
|
+
Custom HTTP adapter to use.
|
|
29
|
+
|
|
30
|
+
#### Example
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { ExpressAdapter } from '@nestjs/platform-express';
|
|
34
|
+
|
|
35
|
+
const builder = await PlatformApplicationBuilder.createWithComposition({
|
|
36
|
+
adapter: new ExpressAdapter(),
|
|
37
|
+
// ...
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
***
|
|
42
|
+
|
|
43
|
+
### appFactory?
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
readonly optional appFactory?: (composedModule) => Promise<TApplication>;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Defined in: [application/PlatformApplicationBuilder.ts:91](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L91)
|
|
50
|
+
|
|
51
|
+
Factory function that creates the application type.
|
|
52
|
+
|
|
53
|
+
If provided, this takes precedence over the default `NestFactory.create()` call.
|
|
54
|
+
Use this for custom application types or adapters.
|
|
55
|
+
|
|
56
|
+
#### Parameters
|
|
57
|
+
|
|
58
|
+
| Parameter | Type |
|
|
59
|
+
| ------ | ------ |
|
|
60
|
+
| `composedModule` | `DynamicModule` |
|
|
61
|
+
|
|
62
|
+
#### Returns
|
|
63
|
+
|
|
64
|
+
`Promise`\<`TApplication`\>
|
|
65
|
+
|
|
66
|
+
#### Example
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const builder = await PlatformApplicationBuilder.createWithComposition({
|
|
70
|
+
appFactory: (module) => NestFactory.create<NestExpressApplication>(
|
|
71
|
+
module,
|
|
72
|
+
new ExpressAdapter()
|
|
73
|
+
),
|
|
74
|
+
// ...
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
***
|
|
79
|
+
|
|
80
|
+
### compositionModule?
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
readonly optional compositionModule?: Type<unknown>;
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Defined in: [application/PlatformApplicationBuilder.ts:30](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L30)
|
|
87
|
+
|
|
88
|
+
Custom composition module that provides the composition services.
|
|
89
|
+
|
|
90
|
+
If not provided, the default [CompositionModule](Class.CompositionModule) is used.
|
|
91
|
+
|
|
92
|
+
***
|
|
93
|
+
|
|
94
|
+
### enableCompositionLogging?
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
readonly optional enableCompositionLogging?: boolean;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Defined in: [application/PlatformApplicationBuilder.ts:39](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L39)
|
|
101
|
+
|
|
102
|
+
Whether to enable logging for the composition context.
|
|
103
|
+
|
|
104
|
+
Defaults to `false`.
|
|
105
|
+
|
|
106
|
+
***
|
|
107
|
+
|
|
108
|
+
### nestOptions?
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
readonly optional nestOptions?: NestApplicationOptions;
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Defined in: [application/PlatformApplicationBuilder.ts:46](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L46)
|
|
115
|
+
|
|
116
|
+
NestJS application options passed to `NestFactory.create()`.
|
|
117
|
+
|
|
118
|
+
***
|
|
119
|
+
|
|
120
|
+
### platformOptions?
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
readonly optional platformOptions?: IPlatformApplicationOptions;
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Defined in: [application/PlatformApplicationBuilder.ts:53](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-bootstrap/src/application/PlatformApplicationBuilder.ts#L53)
|
|
127
|
+
|
|
128
|
+
Platform application options for the builder.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Interface: IProviderDecision'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Interface: IProviderDecision
|
|
7
|
+
|
|
8
|
+
Defined in: composition/types/IProviderDecision.ts:12
|
|
9
|
+
|
|
10
|
+
Represents the result of a provider composition decision.
|
|
11
|
+
|
|
12
|
+
## Properties
|
|
13
|
+
|
|
14
|
+
### imports
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
readonly imports: readonly CompositionImport[];
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Defined in: composition/types/IProviderDecision.ts:27
|
|
21
|
+
|
|
22
|
+
The modules to import when [shouldImport](#shouldimport) is `true`.
|
|
23
|
+
|
|
24
|
+
When [shouldImport](#shouldimport) is `false`, this array should be empty or omitted.
|
|
25
|
+
|
|
26
|
+
***
|
|
27
|
+
|
|
28
|
+
### shouldImport
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
readonly shouldImport: boolean;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Defined in: composition/types/IProviderDecision.ts:18
|
|
35
|
+
|
|
36
|
+
Whether the provider should be imported into the application module graph.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Type Alias: CompositionImport'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Type Alias: CompositionImport
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
type CompositionImport =
|
|
10
|
+
| Type<unknown>
|
|
11
|
+
| DynamicModule
|
|
12
|
+
| Promise<DynamicModule>
|
|
13
|
+
| ForwardReference<unknown>;
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Defined in: composition/types/CompositionImport.ts:14
|
|
17
|
+
|
|
18
|
+
Represents a valid NestJS module import that can be used during composition.
|
|
19
|
+
|
|
20
|
+
This type mirrors the allowed import types in NestJS module metadata.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Type Alias: ProviderComposer\<TContext\>'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Type Alias: ProviderComposer\<TContext\>
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
type ProviderComposer<TContext> = (context) => Promise<IProviderDecision>;
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Defined in: composition/types/ProviderComposer.ts:37
|
|
13
|
+
|
|
14
|
+
Function signature for a provider composer.
|
|
15
|
+
|
|
16
|
+
A provider composer is responsible for determining which modules should be
|
|
17
|
+
imported based on the current composition context (configuration, stage, etc.).
|
|
18
|
+
|
|
19
|
+
## Type Parameters
|
|
20
|
+
|
|
21
|
+
| Type Parameter | Default type | Description |
|
|
22
|
+
| ------ | ------ | ------ |
|
|
23
|
+
| `TContext` *extends* [`ICompositionContext`](Interface.ICompositionContext) | [`ICompositionContext`](Interface.ICompositionContext) | The composition context type. Defaults to [ICompositionContext](Interface.ICompositionContext). |
|
|
24
|
+
|
|
25
|
+
## Parameters
|
|
26
|
+
|
|
27
|
+
| Parameter | Type |
|
|
28
|
+
| ------ | ------ |
|
|
29
|
+
| `context` | `TContext` |
|
|
30
|
+
|
|
31
|
+
## Returns
|
|
32
|
+
|
|
33
|
+
`Promise`\<[`IProviderDecision`](Interface.IProviderDecision)\>
|
|
34
|
+
|
|
35
|
+
## Example
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const composeMailProvider: ProviderComposer = async (context) => {
|
|
39
|
+
const driver = context.config.tryGet('MAIL_DRIVER', 'log');
|
|
40
|
+
|
|
41
|
+
if (driver === 'smtp') {
|
|
42
|
+
const { MailModule } = await import('@breadstone/archipel-platform-mailing');
|
|
43
|
+
const { SmtpDeliveryStrategy } = await import('@breadstone/archipel-platform-mailing/delivering/smtp');
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
shouldImport: true,
|
|
47
|
+
imports: [MailModule.register({ deliveryStrategy: SmtpDeliveryStrategy })]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return { shouldImport: false, imports: [] };
|
|
52
|
+
};
|
|
53
|
+
```
|