@openhi/constructs 0.0.0 → 0.0.1
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/lib/chunk-LZOMFHX3.mjs +38 -0
- package/lib/chunk-LZOMFHX3.mjs.map +1 -0
- package/lib/index.d.mts +664 -0
- package/lib/index.d.ts +745 -3
- package/lib/index.js +1133 -19
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +1120 -0
- package/lib/index.mjs.map +1 -0
- package/lib/rest-api-lambda.handler.d.mts +6 -0
- package/lib/rest-api-lambda.handler.d.ts +6 -0
- package/lib/rest-api-lambda.handler.js +677 -0
- package/lib/rest-api-lambda.handler.js.map +1 -0
- package/lib/rest-api-lambda.handler.mjs +646 -0
- package/lib/rest-api-lambda.handler.mjs.map +1 -0
- package/package.json +37 -28
- package/lib/app/index.d.ts +0 -4
- package/lib/app/index.js +0 -21
- package/lib/app/open-hi-app.d.ts +0 -85
- package/lib/app/open-hi-app.js +0 -127
- package/lib/app/open-hi-environment.d.ts +0 -59
- package/lib/app/open-hi-environment.js +0 -72
- package/lib/app/open-hi-service.d.ts +0 -169
- package/lib/app/open-hi-service.js +0 -195
- package/lib/app/open-hi-stage.d.ts +0 -71
- package/lib/app/open-hi-stage.js +0 -70
- package/lib/components/acm/root-wildcard-certificate.d.ts +0 -15
- package/lib/components/acm/root-wildcard-certificate.js +0 -35
- package/lib/components/api-gateway/core-http-api.d.ts +0 -10
- package/lib/components/api-gateway/core-http-api.js +0 -44
- package/lib/components/api-gateway/http-lambda-integration-no-permissions.d.ts +0 -18
- package/lib/components/api-gateway/http-lambda-integration-no-permissions.js +0 -26
- package/lib/components/app-sync/core-graphql-api.d.ts +0 -12
- package/lib/components/app-sync/core-graphql-api.js +0 -54
- package/lib/components/auth.d.ts +0 -75
- package/lib/components/auth.js +0 -100
- package/lib/components/cognito/core-user-pool-client.d.ts +0 -10
- package/lib/components/cognito/core-user-pool-client.js +0 -47
- package/lib/components/cognito/core-user-pool-domain.d.ts +0 -10
- package/lib/components/cognito/core-user-pool-domain.js +0 -41
- package/lib/components/cognito/core-user-pool-kms-key.d.ts +0 -10
- package/lib/components/cognito/core-user-pool-kms-key.js +0 -37
- package/lib/components/cognito/core-user-pool.d.ts +0 -10
- package/lib/components/cognito/core-user-pool.js +0 -54
- package/lib/components/core.d.ts +0 -102
- package/lib/components/core.js +0 -79
- package/lib/components/dynamodb/dynamo-db-data-store.d.ts +0 -33
- package/lib/components/dynamodb/dynamo-db-data-store.js +0 -107
- package/lib/components/event-bridge/data-event-bus.d.ts +0 -19
- package/lib/components/event-bridge/data-event-bus.js +0 -34
- package/lib/components/event-bridge/ops-event-bus.d.ts +0 -19
- package/lib/components/event-bridge/ops-event-bus.js +0 -34
- package/lib/components/global.d.ts +0 -36
- package/lib/components/global.js +0 -63
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.js +0 -18
- package/lib/components/route-53/child-hosted-zone.d.ts +0 -20
- package/lib/components/route-53/child-hosted-zone.js +0 -48
- package/lib/components/route-53/root-hosted-zone.d.ts +0 -10
- package/lib/components/route-53/root-hosted-zone.js +0 -20
- package/lib/components/ssm/discoverable-string-parameter.d.ts +0 -59
- package/lib/components/ssm/discoverable-string-parameter.js +0 -50
- package/lib/components/ssm/index.d.ts +0 -1
- package/lib/components/ssm/index.js +0 -18
- package/lib/data/dynamo/ehr/r4/Patient.d.ts +0 -180
- package/lib/data/dynamo/ehr/r4/Patient.js +0 -192
- package/lib/data/dynamo/ehr/r4/ehr-r4-data-service.d.ts +0 -162
- package/lib/data/dynamo/ehr/r4/ehr-r4-data-service.js +0 -37
- package/lib/data/hello-world.d.ts +0 -39
- package/lib/data/hello-world.js +0 -59
- package/lib/data/import-patient-with-dynalite.d.ts +0 -1
- package/lib/data/import-patient-with-dynalite.js +0 -87
- package/lib/data/import-patient.d.ts +0 -47
- package/lib/data/import-patient.js +0 -158
- package/lib/data/lambda/rest-api-lambda.d.ts +0 -13
- package/lib/data/lambda/rest-api-lambda.handler.d.ts +0 -1
- package/lib/data/lambda/rest-api-lambda.handler.js +0 -10
- package/lib/data/lambda/rest-api-lambda.js +0 -22
- package/lib/data/middleware/open-hi-context.d.ts +0 -13
- package/lib/data/middleware/open-hi-context.js +0 -31
- package/lib/data/rest-api/ehr/r4/Patient.d.ts +0 -16
- package/lib/data/rest-api/ehr/r4/Patient.js +0 -234
- package/lib/data/rest-api/rest-api-local.d.ts +0 -1
- package/lib/data/rest-api/rest-api-local.js +0 -8
- package/lib/data/rest-api/rest-api-mockdata.d.ts +0 -7
- package/lib/data/rest-api/rest-api-mockdata.js +0 -585
- package/lib/data/rest-api/rest-api.d.ts +0 -3
- package/lib/data/rest-api/rest-api.js +0 -26
- package/lib/lib/compression.d.ts +0 -27
- package/lib/lib/compression.js +0 -87
- package/lib/services/index.d.ts +0 -5
- package/lib/services/index.js +0 -22
- package/lib/services/open-hi-auth-service.d.ts +0 -31
- package/lib/services/open-hi-auth-service.js +0 -31
- package/lib/services/open-hi-core-service.d.ts +0 -15
- package/lib/services/open-hi-core-service.js +0 -38
- package/lib/services/open-hi-data-service.d.ts +0 -18
- package/lib/services/open-hi-data-service.js +0 -18
- package/lib/services/open-hi-global-service.d.ts +0 -15
- package/lib/services/open-hi-global-service.js +0 -44
- package/lib/services/open-hi-rest-api-service.d.ts +0 -17
- package/lib/services/open-hi-rest-api-service.js +0 -107
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,745 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { App, AppProps, Stage, StageProps, Stack, StackProps, RemovalPolicy } from 'aws-cdk-lib';
|
|
2
|
+
import { Construct, IConstruct } from 'constructs';
|
|
3
|
+
import { HttpApiProps, HttpApi, IHttpApi } from 'aws-cdk-lib/aws-apigatewayv2';
|
|
4
|
+
import { GraphqlApiProps } from 'aws-cdk-lib/aws-appsync';
|
|
5
|
+
import { EventBusProps } from 'aws-cdk-lib/aws-events';
|
|
6
|
+
import { StringParameterProps, StringParameter } from 'aws-cdk-lib/aws-ssm';
|
|
7
|
+
import { UserPoolProps, IUserPool, IUserPoolClient, IUserPoolDomain } from 'aws-cdk-lib/aws-cognito';
|
|
8
|
+
import { IKey } from 'aws-cdk-lib/aws-kms';
|
|
9
|
+
import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager';
|
|
10
|
+
import { HostedZoneAttributes, IHostedZone } from 'aws-cdk-lib/aws-route53';
|
|
11
|
+
import { SetOptional } from 'type-fest';
|
|
12
|
+
import { ITable } from 'aws-cdk-lib/aws-dynamodb';
|
|
13
|
+
|
|
14
|
+
/*******************************************************************************
|
|
15
|
+
*
|
|
16
|
+
* OpenHi Config
|
|
17
|
+
*
|
|
18
|
+
* These types are kept in their own package to prevent dependency conflicts and
|
|
19
|
+
* conditions between @openhi/constructs and @openhi/platform.
|
|
20
|
+
*
|
|
21
|
+
******************************************************************************/
|
|
22
|
+
/**
|
|
23
|
+
* Stage Types
|
|
24
|
+
*
|
|
25
|
+
* What stage of deployment is this? Dev, staging, or prod?
|
|
26
|
+
*/
|
|
27
|
+
declare const OPEN_HI_STAGE: {
|
|
28
|
+
/**
|
|
29
|
+
* Development environment, typically used for testing and development.
|
|
30
|
+
*/
|
|
31
|
+
readonly DEV: "dev";
|
|
32
|
+
/**
|
|
33
|
+
* Staging environment, used for pre-production testing.
|
|
34
|
+
*/
|
|
35
|
+
readonly STAGE: "stage";
|
|
36
|
+
/**
|
|
37
|
+
* Production environment, used for live deployments.
|
|
38
|
+
*/
|
|
39
|
+
readonly PROD: "prod";
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Deployment Target Role
|
|
43
|
+
*
|
|
44
|
+
* Is this (account, region) the primary or a secondary deployment target for the stage?
|
|
45
|
+
* Works for both multi-region (different regions) and cellular (same region, different accounts).
|
|
46
|
+
*/
|
|
47
|
+
declare const OPEN_HI_DEPLOYMENT_TARGET_ROLE: {
|
|
48
|
+
/**
|
|
49
|
+
* The primary deployment target for this stage (main account/region).
|
|
50
|
+
* For example, the base DynamoDB region for global tables.
|
|
51
|
+
*/
|
|
52
|
+
readonly PRIMARY: "primary";
|
|
53
|
+
/**
|
|
54
|
+
* A secondary deployment target for this stage (additional account/region).
|
|
55
|
+
* For example, a replica region for a global DynamoDB table, or another cell in the same region.
|
|
56
|
+
*/
|
|
57
|
+
readonly SECONDARY: "secondary";
|
|
58
|
+
};
|
|
59
|
+
interface OpenHiEnvironmentConfig {
|
|
60
|
+
account: string;
|
|
61
|
+
region: string;
|
|
62
|
+
/**
|
|
63
|
+
* Route53 zone containing DNS for this service.
|
|
64
|
+
*/
|
|
65
|
+
hostedZoneId?: string;
|
|
66
|
+
zoneName?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Represents the configuration for OpenHi services across different stages and
|
|
70
|
+
* deployment targets.
|
|
71
|
+
*/
|
|
72
|
+
interface OpenHiConfig {
|
|
73
|
+
versions?: {
|
|
74
|
+
cdk?: {
|
|
75
|
+
cdkLibVersion?: string;
|
|
76
|
+
cdkCliVersion?: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
deploymentTargets?: {
|
|
80
|
+
[OPEN_HI_STAGE.DEV]?: {
|
|
81
|
+
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
|
|
82
|
+
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
|
|
83
|
+
};
|
|
84
|
+
[OPEN_HI_STAGE.STAGE]?: {
|
|
85
|
+
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
|
|
86
|
+
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
|
|
87
|
+
};
|
|
88
|
+
[OPEN_HI_STAGE.PROD]?: {
|
|
89
|
+
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
|
|
90
|
+
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Properties for creating an OpenHiStage instance.
|
|
97
|
+
*/
|
|
98
|
+
interface OpenHiStageProps extends StageProps {
|
|
99
|
+
/**
|
|
100
|
+
* The type of the OpenHi stage.
|
|
101
|
+
*/
|
|
102
|
+
readonly stageType: (typeof OPEN_HI_STAGE)[keyof typeof OPEN_HI_STAGE];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Represents a deployment stage in the OpenHi infrastructure hierarchy.
|
|
106
|
+
*/
|
|
107
|
+
declare class OpenHiStage extends Stage {
|
|
108
|
+
/**
|
|
109
|
+
* The OpenHiApp that this stage belongs to.
|
|
110
|
+
*
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
113
|
+
ohApp: OpenHiApp;
|
|
114
|
+
/**
|
|
115
|
+
* Properties for configuring the stage.
|
|
116
|
+
*
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
props: OpenHiStageProps;
|
|
120
|
+
/**
|
|
121
|
+
* Finds the OpenHiStage that contains the given construct.
|
|
122
|
+
*/
|
|
123
|
+
static of(construct: IConstruct): OpenHiStage | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Type guard to check if a value is an OpenHiStage instance.
|
|
126
|
+
*/
|
|
127
|
+
static isOpenHiStage(this: void, x: any): x is OpenHiStage;
|
|
128
|
+
/**
|
|
129
|
+
* The type of this OpenHi stage.
|
|
130
|
+
*/
|
|
131
|
+
readonly stageType: (typeof OPEN_HI_STAGE)[keyof typeof OPEN_HI_STAGE];
|
|
132
|
+
/**
|
|
133
|
+
* Creates a new OpenHiStage instance.
|
|
134
|
+
*/
|
|
135
|
+
constructor(
|
|
136
|
+
/**
|
|
137
|
+
* The OpenHiApp that this stage belongs to.
|
|
138
|
+
*
|
|
139
|
+
* @public
|
|
140
|
+
*/
|
|
141
|
+
ohApp: OpenHiApp,
|
|
142
|
+
/**
|
|
143
|
+
* Properties for configuring the stage.
|
|
144
|
+
*
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
props: OpenHiStageProps);
|
|
148
|
+
/**
|
|
149
|
+
* Gets all OpenHiEnvironment instances contained within this stage.
|
|
150
|
+
*/
|
|
151
|
+
get environments(): Array<OpenHiEnvironment>;
|
|
152
|
+
/**
|
|
153
|
+
* Gets the primary OpenHiEnvironment for this stage, if one exists.
|
|
154
|
+
*/
|
|
155
|
+
get primaryEnvironment(): OpenHiEnvironment | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* Gets all secondary OpenHiEnvironment instances for this stage.
|
|
158
|
+
*/
|
|
159
|
+
get secondaryEnvironments(): Array<OpenHiEnvironment>;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Properties for creating an OpenHiEnvironment.
|
|
164
|
+
*/
|
|
165
|
+
interface OpenHiEnvironmentProps extends StageProps {
|
|
166
|
+
/**
|
|
167
|
+
* The deployment target role for this (account, region).
|
|
168
|
+
*/
|
|
169
|
+
readonly deploymentTargetRole: (typeof OPEN_HI_DEPLOYMENT_TARGET_ROLE)[keyof typeof OPEN_HI_DEPLOYMENT_TARGET_ROLE];
|
|
170
|
+
/**
|
|
171
|
+
* Configuration for this specific environment.
|
|
172
|
+
*/
|
|
173
|
+
readonly config: OpenHiEnvironmentConfig;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Represents an OpenHi environment within an AWS CDK stage.
|
|
177
|
+
*/
|
|
178
|
+
declare class OpenHiEnvironment extends Stage {
|
|
179
|
+
/**
|
|
180
|
+
* The OpenHiStage that contains this environment.
|
|
181
|
+
*/
|
|
182
|
+
ohStage: OpenHiStage;
|
|
183
|
+
/**
|
|
184
|
+
* Properties for creating the environment.
|
|
185
|
+
*/
|
|
186
|
+
props: OpenHiEnvironmentProps;
|
|
187
|
+
/**
|
|
188
|
+
* Finds the OpenHiEnvironment that contains the given construct.
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
static of(construct: IConstruct): OpenHiEnvironment | undefined;
|
|
192
|
+
/**
|
|
193
|
+
* Type guard to check if a value is an OpenHiEnvironment instance.
|
|
194
|
+
*/
|
|
195
|
+
static isOpenHiEnvironment(this: void, x: any): x is OpenHiEnvironment;
|
|
196
|
+
/**
|
|
197
|
+
* Configuration for this specific environment.
|
|
198
|
+
*/
|
|
199
|
+
readonly config: OpenHiEnvironmentConfig;
|
|
200
|
+
/**
|
|
201
|
+
* The deployment target role for this (account, region).
|
|
202
|
+
*/
|
|
203
|
+
readonly deploymentTargetRole: (typeof OPEN_HI_DEPLOYMENT_TARGET_ROLE)[keyof typeof OPEN_HI_DEPLOYMENT_TARGET_ROLE];
|
|
204
|
+
/**
|
|
205
|
+
* Creates a new OpenHiEnvironment.
|
|
206
|
+
*/
|
|
207
|
+
constructor(
|
|
208
|
+
/**
|
|
209
|
+
* The OpenHiStage that contains this environment.
|
|
210
|
+
*/
|
|
211
|
+
ohStage: OpenHiStage,
|
|
212
|
+
/**
|
|
213
|
+
* Properties for creating the environment.
|
|
214
|
+
*/
|
|
215
|
+
props: OpenHiEnvironmentProps);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Properties for creating an OpenHiApp instance.
|
|
220
|
+
*/
|
|
221
|
+
interface OpenHiAppProps extends AppProps {
|
|
222
|
+
/**
|
|
223
|
+
* Optional name for the application.
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
readonly appName?: string;
|
|
227
|
+
/**
|
|
228
|
+
* The OpenHi configuration object that defines stages, environments, and
|
|
229
|
+
* their associated AWS account and region settings.
|
|
230
|
+
*/
|
|
231
|
+
readonly config: OpenHiConfig;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Root application construct for OpenHi CDK applications.
|
|
235
|
+
*/
|
|
236
|
+
declare class OpenHiApp extends App {
|
|
237
|
+
/**
|
|
238
|
+
* Finds the OpenHiApp instance that contains the given construct in its
|
|
239
|
+
* construct tree.
|
|
240
|
+
*/
|
|
241
|
+
static of(construct: IConstruct): OpenHiApp | undefined;
|
|
242
|
+
/**
|
|
243
|
+
* Type guard that checks if a value is an OpenHiApp instance.
|
|
244
|
+
*/
|
|
245
|
+
static isOpenHiApp(this: void, x: any): x is OpenHiApp;
|
|
246
|
+
/**
|
|
247
|
+
* Name for the application.
|
|
248
|
+
*/
|
|
249
|
+
readonly appName: string;
|
|
250
|
+
/**
|
|
251
|
+
* The OpenHi configuration object for this application.
|
|
252
|
+
*/
|
|
253
|
+
readonly config: OpenHiConfig;
|
|
254
|
+
/**
|
|
255
|
+
* Creates a new OpenHiApp instance.
|
|
256
|
+
*/
|
|
257
|
+
constructor(props: OpenHiAppProps);
|
|
258
|
+
/*****************************************************************************
|
|
259
|
+
*
|
|
260
|
+
* Stages
|
|
261
|
+
*
|
|
262
|
+
****************************************************************************/
|
|
263
|
+
/**
|
|
264
|
+
* Gets all OpenHiStage instances that are direct children of this app.
|
|
265
|
+
|
|
266
|
+
*/
|
|
267
|
+
get stages(): Array<OpenHiStage>;
|
|
268
|
+
/**
|
|
269
|
+
* Gets the development stage, if it exists.
|
|
270
|
+
*/
|
|
271
|
+
get devStage(): OpenHiStage | undefined;
|
|
272
|
+
/**
|
|
273
|
+
* Gets the staging stage, if it exists.
|
|
274
|
+
*/
|
|
275
|
+
get stageStage(): OpenHiStage | undefined;
|
|
276
|
+
/**
|
|
277
|
+
* Gets the production stage, if it exists.
|
|
278
|
+
*/
|
|
279
|
+
get prodStage(): OpenHiStage | undefined;
|
|
280
|
+
/*****************************************************************************
|
|
281
|
+
*
|
|
282
|
+
* Environments
|
|
283
|
+
*
|
|
284
|
+
****************************************************************************/
|
|
285
|
+
/**
|
|
286
|
+
* Gets all OpenHiEnvironment instances across all stages in this app.
|
|
287
|
+
*/
|
|
288
|
+
get environments(): Array<OpenHiEnvironment>;
|
|
289
|
+
/**
|
|
290
|
+
* Gets all primary environments across all stages in this app.
|
|
291
|
+
*/
|
|
292
|
+
get primaryEnvironments(): Array<OpenHiEnvironment>;
|
|
293
|
+
/**
|
|
294
|
+
* Gets all secondary environments across all stages in this app.
|
|
295
|
+
*/
|
|
296
|
+
get secondaryEnvironments(): Array<OpenHiEnvironment>;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
interface CoreProps {
|
|
300
|
+
/**
|
|
301
|
+
* Pass in options for an event bus, optional.
|
|
302
|
+
*/
|
|
303
|
+
readonly dataEventBusProps?: EventBusProps;
|
|
304
|
+
/**
|
|
305
|
+
* Pass in options for an event bus, optional.
|
|
306
|
+
*/
|
|
307
|
+
readonly opsEventBusProps?: EventBusProps;
|
|
308
|
+
/**
|
|
309
|
+
* Optional args for creating HTTP API.
|
|
310
|
+
*/
|
|
311
|
+
readonly httpApiProps?: HttpApiProps;
|
|
312
|
+
/**
|
|
313
|
+
* Optional args for creating the core GraphQL API.
|
|
314
|
+
*/
|
|
315
|
+
readonly graphqlApiProps?: GraphqlApiProps;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Service type identifiers for OpenHI services.
|
|
320
|
+
*
|
|
321
|
+
* @remarks
|
|
322
|
+
* These constants define the different types of services that can be deployed
|
|
323
|
+
* within the OpenHI platform. Each service type represents a distinct domain
|
|
324
|
+
* or functional area with its own data model, API endpoints, and business logic.
|
|
325
|
+
*
|
|
326
|
+
* Service types are used for:
|
|
327
|
+
* - Resource naming and tagging
|
|
328
|
+
* - Service discovery and routing
|
|
329
|
+
* - Deployment context calculations
|
|
330
|
+
* - Cross-service communication patterns
|
|
331
|
+
*
|
|
332
|
+
* @public
|
|
333
|
+
*/
|
|
334
|
+
declare const OPEN_HI_SERVICE_TYPE: {
|
|
335
|
+
/**
|
|
336
|
+
* Authentication service.
|
|
337
|
+
* *
|
|
338
|
+
* Only one instance of the auth service should exist per environment.
|
|
339
|
+
*/
|
|
340
|
+
readonly AUTH: "auth";
|
|
341
|
+
/**
|
|
342
|
+
* Root shared core services.
|
|
343
|
+
*
|
|
344
|
+
* Only one instance of the core service should exist per environment.
|
|
345
|
+
*/
|
|
346
|
+
readonly CORE: "core";
|
|
347
|
+
/**
|
|
348
|
+
* Rest API service.
|
|
349
|
+
*/
|
|
350
|
+
readonly REST_API: "rest-api";
|
|
351
|
+
/**
|
|
352
|
+
* Global Infrastructure stack (Route53, ACM).
|
|
353
|
+
*/
|
|
354
|
+
readonly GLOBAL: "global";
|
|
355
|
+
/**
|
|
356
|
+
* Data service (DynamoDB, S3, persistence).
|
|
357
|
+
*/
|
|
358
|
+
readonly DATA: "data";
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* Type representing valid OpenHI service type values. This is a union of the
|
|
362
|
+
* values from {@link OPEN_HI_SERVICE_TYPE}.
|
|
363
|
+
*
|
|
364
|
+
* @public
|
|
365
|
+
*/
|
|
366
|
+
type OpenHiServiceType = (typeof OPEN_HI_SERVICE_TYPE)[keyof typeof OPEN_HI_SERVICE_TYPE];
|
|
367
|
+
/**
|
|
368
|
+
* Properties for creating an {@link OpenHiService} stack.
|
|
369
|
+
*
|
|
370
|
+
* @public
|
|
371
|
+
*/
|
|
372
|
+
interface OpenHiServiceProps extends StackProps {
|
|
373
|
+
/**
|
|
374
|
+
* Optional branch name override.
|
|
375
|
+
*/
|
|
376
|
+
readonly branchName?: string;
|
|
377
|
+
/**
|
|
378
|
+
* Optional repository name override.
|
|
379
|
+
*/
|
|
380
|
+
readonly repoName?: string;
|
|
381
|
+
/**
|
|
382
|
+
* Optional application name override.
|
|
383
|
+
*/
|
|
384
|
+
readonly appName?: string;
|
|
385
|
+
/**
|
|
386
|
+
* Default release branch name.
|
|
387
|
+
*/
|
|
388
|
+
readonly defaultReleaseBranch?: string;
|
|
389
|
+
/**
|
|
390
|
+
* The removal policy for persistent stack resources.
|
|
391
|
+
*/
|
|
392
|
+
readonly removalPolicy?: RemovalPolicy;
|
|
393
|
+
/**
|
|
394
|
+
* Environment configuration for this service.
|
|
395
|
+
*/
|
|
396
|
+
readonly config?: OpenHiEnvironmentConfig;
|
|
397
|
+
/**
|
|
398
|
+
* A constant that identifies the service type.
|
|
399
|
+
*/
|
|
400
|
+
readonly serviceType?: OpenHiServiceType;
|
|
401
|
+
/**
|
|
402
|
+
* Optional props for the core construct.
|
|
403
|
+
*/
|
|
404
|
+
readonly coreProps?: CoreProps;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Represents an OpenHI service stack within the OpenHI platform.
|
|
408
|
+
*/
|
|
409
|
+
declare class OpenHiService extends Stack {
|
|
410
|
+
ohEnv: OpenHiEnvironment;
|
|
411
|
+
props: OpenHiServiceProps;
|
|
412
|
+
/**
|
|
413
|
+
* The service/stack ID that was passed to the constructor.
|
|
414
|
+
*/
|
|
415
|
+
readonly serviceId: string;
|
|
416
|
+
/**
|
|
417
|
+
* The deployment target role identifier.
|
|
418
|
+
*/
|
|
419
|
+
readonly deploymentTargetRole: string;
|
|
420
|
+
/**
|
|
421
|
+
* Repository name used in resource tagging.
|
|
422
|
+
*/
|
|
423
|
+
readonly repoName: string;
|
|
424
|
+
/**
|
|
425
|
+
* Application name identifier.
|
|
426
|
+
*/
|
|
427
|
+
readonly appName: string;
|
|
428
|
+
/**
|
|
429
|
+
* Default release branch name.
|
|
430
|
+
*/
|
|
431
|
+
readonly defaultReleaseBranch: string;
|
|
432
|
+
/**
|
|
433
|
+
* Branch name used when calculating resource names and hashes.
|
|
434
|
+
*/
|
|
435
|
+
readonly branchName: string;
|
|
436
|
+
/**
|
|
437
|
+
* Short hash unique to the deployment target (app name, deployment target role, account, region).
|
|
438
|
+
*/
|
|
439
|
+
readonly environmentHash: string;
|
|
440
|
+
/**
|
|
441
|
+
* Short hash unique to the environment and branch combination.
|
|
442
|
+
*/
|
|
443
|
+
readonly branchHash: string;
|
|
444
|
+
/**
|
|
445
|
+
* Short hash unique to the specific stack/service.
|
|
446
|
+
*/
|
|
447
|
+
readonly stackHash: string;
|
|
448
|
+
/**
|
|
449
|
+
* The removal policy for persistent stack resources.
|
|
450
|
+
*/
|
|
451
|
+
readonly removalPolicy: RemovalPolicy;
|
|
452
|
+
/**
|
|
453
|
+
* Environment configuration for this service.
|
|
454
|
+
* This is either the value passed in or the default config
|
|
455
|
+
*/
|
|
456
|
+
readonly config: OpenHiEnvironmentConfig;
|
|
457
|
+
/**
|
|
458
|
+
* A constant that identifies the service type.
|
|
459
|
+
*/
|
|
460
|
+
readonly serviceType: (typeof OPEN_HI_SERVICE_TYPE)[keyof typeof OPEN_HI_SERVICE_TYPE] | string;
|
|
461
|
+
/**
|
|
462
|
+
* Core construct containing shared infrastructure.
|
|
463
|
+
*/
|
|
464
|
+
/**
|
|
465
|
+
* Creates a new OpenHI service stack.
|
|
466
|
+
*
|
|
467
|
+
* @param ohEnv - The OpenHI environment (stage) this service belongs to
|
|
468
|
+
* @param id - Unique identifier for this service stack (e.g., "user-service")
|
|
469
|
+
* @param props - Optional properties for configuring the service
|
|
470
|
+
*
|
|
471
|
+
* @throws {Error} If account and region are not defined in props or environment
|
|
472
|
+
*
|
|
473
|
+
*/
|
|
474
|
+
constructor(ohEnv: OpenHiEnvironment, id: string, props?: OpenHiServiceProps);
|
|
475
|
+
/**
|
|
476
|
+
* Creates or returns the core construct for shared infrastructure.
|
|
477
|
+
*/
|
|
478
|
+
/**
|
|
479
|
+
* DNS prefix for this branche's child zone.
|
|
480
|
+
*/
|
|
481
|
+
get childZonePrefix(): string;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/*******************************************************************************
|
|
485
|
+
*
|
|
486
|
+
* DiscoverableStringParameterProps: props for creating or looking up SSM
|
|
487
|
+
* parameters. Includes StringParameterProps (minus parameterName) plus
|
|
488
|
+
* name-building fields used by buildParameterName.
|
|
489
|
+
*
|
|
490
|
+
******************************************************************************/
|
|
491
|
+
interface DiscoverableStringParameterProps extends Omit<StringParameterProps, "parameterName"> {
|
|
492
|
+
/**
|
|
493
|
+
* SSM param name used to build the SSM parameter name via buildParameterName
|
|
494
|
+
* and stored as a tag on the parameter for discoverability.
|
|
495
|
+
*/
|
|
496
|
+
readonly ssmParamName: string;
|
|
497
|
+
/**
|
|
498
|
+
* The environment hash the parameter belongs to.
|
|
499
|
+
* @default - the current stack's environment hash
|
|
500
|
+
*/
|
|
501
|
+
readonly branchHash?: string;
|
|
502
|
+
/**
|
|
503
|
+
* The service type the parameter belongs to.
|
|
504
|
+
* @default - the current stack's service type
|
|
505
|
+
*/
|
|
506
|
+
readonly serviceType?: string;
|
|
507
|
+
/**
|
|
508
|
+
* The AWS account the parameter belongs to.
|
|
509
|
+
* @default - the current stack's account
|
|
510
|
+
*/
|
|
511
|
+
readonly account?: string;
|
|
512
|
+
/**
|
|
513
|
+
* The AWS region the parameter belongs to.
|
|
514
|
+
* @default - the current stack's region
|
|
515
|
+
*/
|
|
516
|
+
readonly region?: string;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Props for buildParameterName and valueForLookupName.
|
|
520
|
+
* Includes ssmParamName (required) and optional overrides (branchHash, serviceType, account, region).
|
|
521
|
+
*/
|
|
522
|
+
type BuildParameterNameProps = Pick<DiscoverableStringParameterProps, "ssmParamName" | "branchHash" | "serviceType" | "account" | "region">;
|
|
523
|
+
/**
|
|
524
|
+
* Discoverable SSM string parameter construct. Extends CDK StringParameter:
|
|
525
|
+
* builds parameterName from the given name via buildParameterName and tags
|
|
526
|
+
* the parameter with the name constant.
|
|
527
|
+
*/
|
|
528
|
+
declare class DiscoverableStringParameter extends StringParameter {
|
|
529
|
+
/**
|
|
530
|
+
* Build a param name based on predictable attributes found in services and
|
|
531
|
+
* constructs. Used for storage and retrieval of SSM values across services.
|
|
532
|
+
*/
|
|
533
|
+
static buildParameterName(scope: Construct, props: BuildParameterNameProps): string;
|
|
534
|
+
/**
|
|
535
|
+
* Read the string value of an SSM parameter created with DiscoverableStringParameter,
|
|
536
|
+
* using props that include ssmParamName and optional overrides (e.g. serviceType).
|
|
537
|
+
*/
|
|
538
|
+
static valueForLookupName(scope: Construct, props: BuildParameterNameProps): string;
|
|
539
|
+
constructor(scope: Construct, id: string, props: DiscoverableStringParameterProps);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
interface OpenHiCoreServiceProps extends OpenHiServiceProps {
|
|
543
|
+
}
|
|
544
|
+
declare class OpenHiCoreService extends OpenHiService {
|
|
545
|
+
/*****************************************************************************
|
|
546
|
+
*
|
|
547
|
+
* PROPS
|
|
548
|
+
*
|
|
549
|
+
* Final props calculated from inputs combined with default values.
|
|
550
|
+
*
|
|
551
|
+
****************************************************************************/
|
|
552
|
+
readonly props: OpenHiCoreServiceProps;
|
|
553
|
+
constructor(ohEnv: OpenHiEnvironment, props?: OpenHiCoreServiceProps);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
interface AuthProps {
|
|
557
|
+
/**
|
|
558
|
+
* Optional props for creating the user pool.
|
|
559
|
+
*/
|
|
560
|
+
readonly userPoolProps?: UserPoolProps;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Auth construct that manages Cognito authentication resources.
|
|
564
|
+
*
|
|
565
|
+
* @remarks
|
|
566
|
+
* The Auth construct provides authentication infrastructure including:
|
|
567
|
+
* - Cognito User Pool for user management and authentication
|
|
568
|
+
* - User Pool Client for application integration
|
|
569
|
+
* - User Pool Domain for hosting the Cognito hosted UI
|
|
570
|
+
* - KMS Key for Cognito User Pool encryption
|
|
571
|
+
*
|
|
572
|
+
* When created in the Auth service (`serviceType === OPEN_HI_SERVICE_TYPE.AUTH`),
|
|
573
|
+
* it creates concrete resources. Otherwise, it imports existing resources
|
|
574
|
+
* from SSM Parameter Store.
|
|
575
|
+
*
|
|
576
|
+
* Use {@link Auth.fromConstruct} to obtain an Auth instance (with resources
|
|
577
|
+
* imported from AUTH SSM parameters) when not in the Auth service, e.g. from
|
|
578
|
+
* the Core construct.
|
|
579
|
+
*
|
|
580
|
+
* @public
|
|
581
|
+
*/
|
|
582
|
+
declare class Auth extends Construct {
|
|
583
|
+
/**
|
|
584
|
+
* Returns an Auth instance that uses resources imported from AUTH SSM
|
|
585
|
+
* parameters. Use this when creating Core or other stacks that consume
|
|
586
|
+
* auth resources; the Auth stack must be deployed first.
|
|
587
|
+
*
|
|
588
|
+
* @param scope - Construct scope (e.g. Core); must be in a stack that has
|
|
589
|
+
* access to the same account/region as the deployed Auth stack.
|
|
590
|
+
*/
|
|
591
|
+
static fromConstruct(scope: Construct): Auth;
|
|
592
|
+
/**
|
|
593
|
+
* Is this construct being created in the auth service or elsewhere?
|
|
594
|
+
*/
|
|
595
|
+
readonly isAuthService: boolean;
|
|
596
|
+
/**
|
|
597
|
+
* KMS Key used to encrypt the Cognito User Pool. We need a custom key so that
|
|
598
|
+
* we can decrypt tokens when sending emails using something other than SES.
|
|
599
|
+
*/
|
|
600
|
+
readonly userPoolKmsKey: IKey;
|
|
601
|
+
/**
|
|
602
|
+
* Cognito User Pool for user management and authentication.
|
|
603
|
+
*/
|
|
604
|
+
readonly userPool: IUserPool;
|
|
605
|
+
/**
|
|
606
|
+
* Cognito User Pool Client for application integration with the User Pool.
|
|
607
|
+
*/
|
|
608
|
+
readonly userPoolClient: IUserPoolClient;
|
|
609
|
+
/**
|
|
610
|
+
* Cognito User Pool Domain for hosting the Cognito hosted UI.
|
|
611
|
+
*/
|
|
612
|
+
readonly userPoolDomain: IUserPoolDomain;
|
|
613
|
+
constructor(scope: Construct, props?: AuthProps);
|
|
614
|
+
/*****************************************************************************
|
|
615
|
+
*
|
|
616
|
+
* Auth Support
|
|
617
|
+
*
|
|
618
|
+
****************************************************************************/
|
|
619
|
+
protected createUserPoolKmsKey(): IKey;
|
|
620
|
+
protected createUserPool(props?: UserPoolProps): IUserPool;
|
|
621
|
+
protected createUserPoolClient(props: {
|
|
622
|
+
userPool: IUserPool;
|
|
623
|
+
}): IUserPoolClient;
|
|
624
|
+
protected createUserPoolDomain(props: {
|
|
625
|
+
userPool: IUserPool;
|
|
626
|
+
}): IUserPoolDomain;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
interface OpenHiAuthServiceProps extends OpenHiServiceProps {
|
|
630
|
+
/**
|
|
631
|
+
* Optional props for the auth construct.
|
|
632
|
+
*/
|
|
633
|
+
readonly authProps?: AuthProps;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* OpenHI Auth Service stack.
|
|
637
|
+
*
|
|
638
|
+
* @remarks
|
|
639
|
+
* The Auth service manages authentication infrastructure including:
|
|
640
|
+
* - Cognito User Pool for user management and authentication
|
|
641
|
+
* - User Pool Client for application integration
|
|
642
|
+
* - User Pool Domain for hosting the Cognito hosted UI
|
|
643
|
+
* - KMS Key for Cognito User Pool encryption
|
|
644
|
+
*
|
|
645
|
+
* Only one instance of the auth service should exist per environment.
|
|
646
|
+
*
|
|
647
|
+
* @public
|
|
648
|
+
*/
|
|
649
|
+
declare class OpenHiAuthService extends OpenHiService {
|
|
650
|
+
props: OpenHiAuthServiceProps;
|
|
651
|
+
/**
|
|
652
|
+
* Auth construct containing authentication resources.
|
|
653
|
+
*/
|
|
654
|
+
readonly auth: Auth;
|
|
655
|
+
constructor(ohEnv: OpenHiEnvironment, props?: OpenHiAuthServiceProps);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
interface GlobalProps {
|
|
659
|
+
/**
|
|
660
|
+
* Root zone configuration attributes. Zone name is required, hosted zone ID
|
|
661
|
+
* is optional.
|
|
662
|
+
*/
|
|
663
|
+
readonly rootHostedZoneAttributes: HostedZoneAttributes;
|
|
664
|
+
/**
|
|
665
|
+
* Child zone configuration attributes. Zone name is required, hosted zone ID
|
|
666
|
+
* is optional.
|
|
667
|
+
*/
|
|
668
|
+
readonly childHostedZoneAttributes?: SetOptional<HostedZoneAttributes, "hostedZoneId">;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Global construct: owns global infrastructure (e.g. DNS and certificate resources).
|
|
672
|
+
|
|
673
|
+
*/
|
|
674
|
+
declare class Global extends Construct {
|
|
675
|
+
props: GlobalProps;
|
|
676
|
+
/**
|
|
677
|
+
* Root hosted zone when config provides zoneName.
|
|
678
|
+
*/
|
|
679
|
+
readonly rootHostedZone: IHostedZone;
|
|
680
|
+
/**
|
|
681
|
+
* Child hosted zone when root zone exists.
|
|
682
|
+
*/
|
|
683
|
+
readonly childHostedZone?: IHostedZone;
|
|
684
|
+
/**
|
|
685
|
+
* Root wildcard certificate.
|
|
686
|
+
*/
|
|
687
|
+
readonly rootWildcardCertificate: ICertificate;
|
|
688
|
+
constructor(scope: Construct, id: string, props: GlobalProps);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
interface OpenHiGlobalServiceProps extends OpenHiServiceProps {
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Global Infrastructure stack: owns global DNS and certificates
|
|
695
|
+
*/
|
|
696
|
+
declare class OpenHiGlobalService extends OpenHiService {
|
|
697
|
+
/**
|
|
698
|
+
* Global construct.
|
|
699
|
+
*/
|
|
700
|
+
readonly global: Global;
|
|
701
|
+
constructor(ohEnv: OpenHiEnvironment, props?: OpenHiGlobalServiceProps);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
declare class CoreHttpApi extends HttpApi {
|
|
705
|
+
/**
|
|
706
|
+
* Used when storing the API ID in SSM.
|
|
707
|
+
*/
|
|
708
|
+
static readonly SSM_PARAM_NAME = "CORE_HTTP_API";
|
|
709
|
+
static fromConstruct(scope: Construct): IHttpApi;
|
|
710
|
+
constructor(scope: Construct, props?: HttpApiProps);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
interface OpenHiRestApiServiceProps extends OpenHiServiceProps {
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* SSM parameter name suffix for the REST API base URL.
|
|
717
|
+
* Full parameter name is built via buildParameterName with serviceType REST_API.
|
|
718
|
+
*/
|
|
719
|
+
declare const REST_API_BASE_URL_SSM_NAME = "REST_API_BASE_URL";
|
|
720
|
+
/**
|
|
721
|
+
* REST API service stack: HTTP API, custom domain, and Lambda; exports base URL via SSM.
|
|
722
|
+
*/
|
|
723
|
+
declare class OpenHiRestApiService extends OpenHiService {
|
|
724
|
+
readonly coreHttpApi: CoreHttpApi;
|
|
725
|
+
constructor(ohEnv: OpenHiEnvironment, props?: OpenHiRestApiServiceProps);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
interface OpenHiDataServiceProps extends OpenHiServiceProps {
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Data storage service stack: centralizes DynamoDB, S3, and other persistence
|
|
732
|
+
* resources for OpenHI. Creates the single-table data store (CRM, CMS, ERP,
|
|
733
|
+
* EHR); add buckets or other resources as needed.
|
|
734
|
+
*/
|
|
735
|
+
declare class OpenHiDataService extends OpenHiService {
|
|
736
|
+
/**
|
|
737
|
+
* The single-table DynamoDB data store. Use {@link DynamoDbDataStore.fromConstruct}
|
|
738
|
+
* from other stacks to obtain an ITable reference by name.
|
|
739
|
+
*/
|
|
740
|
+
readonly dataStore: ITable;
|
|
741
|
+
constructor(ohEnv: OpenHiEnvironment, props?: OpenHiDataServiceProps);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
export { DiscoverableStringParameter, OPEN_HI_SERVICE_TYPE, OpenHiApp, OpenHiAuthService, OpenHiCoreService, OpenHiDataService, OpenHiEnvironment, OpenHiGlobalService, OpenHiRestApiService, OpenHiService, OpenHiStage, REST_API_BASE_URL_SSM_NAME };
|
|
745
|
+
export type { BuildParameterNameProps, DiscoverableStringParameterProps, OpenHiAppProps, OpenHiAuthServiceProps, OpenHiCoreServiceProps, OpenHiDataServiceProps, OpenHiEnvironmentProps, OpenHiGlobalServiceProps, OpenHiRestApiServiceProps, OpenHiServiceProps, OpenHiServiceType, OpenHiStageProps };
|