/
project.ts
45 lines (43 loc) · 1.27 KB
/
project.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* Classes for project creators to use and extend.
*
* @module
*/
import { Result } from 'neverthrow';
import {
ComponentConfig,
GeneralConfig,
InfraConfig,
NetworkConfig,
RelationConfig,
ServiceConfig,
} from './config';
import { PlanError } from './domain';
import { InfraPlan, InfraPlanConstructs, InfraPlanOutputs } from './package';
/**
* Abstract class to be extended by projects to develop custom code in order to augment the baseline infra generated by a package.
*
* @group For project creators
*/
export abstract class Custom<
IPC extends InfraPlanConstructs,
GC extends GeneralConfig,
NC extends NetworkConfig,
CC extends ComponentConfig,
SC extends ServiceConfig,
RC extends RelationConfig
> {
/**
* Augmenting the generated infra baseline with project-specific operations.
*
* @param config The project configuration in full.
* @param result The baseline infra generated so far by the package.
* @param scope Optional parent construct.
* @returns Result that encapsulates either outputs {@link InfraPlanOutputs} if successful, or error {@link PlanError} if failed.
*/
abstract enhanceWith(
config: InfraConfig<GC, NC, CC, SC, RC>,
result: InfraPlan<IPC>,
scope: any
): Result<InfraPlanOutputs, PlanError>;
}