-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
modules.ts
80 lines (61 loc) · 2.43 KB
/
modules.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* eslint-disable import/no-extraneous-dependencies */
import { ExternalModule, Type } from '@cdklabs/typewriter';
import { CallableExpr } from './callable-expr';
/**
* A class representing an external module that can be imported into a target module.
*/
export abstract class ImportableModule extends ExternalModule {
/**
* The name to import all targets in the module as.
*/
public abstract importAs: string;
}
class PathModule extends ImportableModule {
public readonly join = CallableExpr.fromName(this, 'join');
public readonly importAs = 'path';
public constructor() {
super('path');
}
}
class ConstructsModule extends ImportableModule {
public readonly Construct = Type.fromName(this, 'Construct');
public readonly importAs = 'constructs';
public constructor() {
super('constructs');
}
}
class CoreModule extends ImportableModule {
public readonly Stack = Type.fromName(this, 'Stack');
public readonly CustomResourceProviderBase = Type.fromName(this, 'CustomResourceProviderBase');
public readonly CustomResourceProviderOptions = Type.fromName(this, 'CustomResourceProviderOptions');
public readonly determineLatestNodeRuntimeName = CallableExpr.fromName(this, 'determineLatestNodeRuntimeName');
public readonly importAs = 'cdk';
public constructor() {
super('../../../core');
}
}
class LambdaModule extends ImportableModule {
public readonly Function = Type.fromName(this, 'Function');
public readonly SingletonFunction = Type.fromName(this, 'SingletonFunction');
public readonly FunctionOptions = Type.fromName(this, 'FunctionOptions');
public readonly Runtime = Type.fromName(this, 'Runtime');
public readonly RuntimeFamily = Type.fromName(this, 'RuntimeFamily');
public readonly Code = Type.fromName(this, 'Code');
public readonly determineLatestNodeRuntime = CallableExpr.fromName(this, 'determineLatestNodeRuntime');
public readonly importAs = 'lambda';
public constructor() {
super('../../../aws-lambda');
}
}
class RegionInfoModule extends ImportableModule {
public readonly FactName = Type.fromName(this, 'FactName');
public readonly importAs = 'region';
public constructor() {
super('../../../region-info');
}
}
export const PATH_MODULE = new PathModule();
export const CONSTRUCTS_MODULE = new ConstructsModule();
export const CORE_MODULE = new CoreModule();
export const LAMBDA_MODULE = new LambdaModule();
export const REGION_INFO_MODULE = new RegionInfoModule();