@openhi/constructs 0.0.0 → 0.0.2

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.
Files changed (101) hide show
  1. package/lib/chunk-LZOMFHX3.mjs +38 -0
  2. package/lib/chunk-LZOMFHX3.mjs.map +1 -0
  3. package/lib/index.d.mts +788 -0
  4. package/lib/index.d.ts +869 -3
  5. package/lib/index.js +1318 -19
  6. package/lib/index.js.map +1 -0
  7. package/lib/index.mjs +1303 -0
  8. package/lib/index.mjs.map +1 -0
  9. package/lib/rest-api-lambda.handler.d.mts +6 -0
  10. package/lib/rest-api-lambda.handler.d.ts +6 -0
  11. package/lib/rest-api-lambda.handler.js +677 -0
  12. package/lib/rest-api-lambda.handler.js.map +1 -0
  13. package/lib/rest-api-lambda.handler.mjs +646 -0
  14. package/lib/rest-api-lambda.handler.mjs.map +1 -0
  15. package/package.json +37 -28
  16. package/lib/app/index.d.ts +0 -4
  17. package/lib/app/index.js +0 -21
  18. package/lib/app/open-hi-app.d.ts +0 -85
  19. package/lib/app/open-hi-app.js +0 -127
  20. package/lib/app/open-hi-environment.d.ts +0 -59
  21. package/lib/app/open-hi-environment.js +0 -72
  22. package/lib/app/open-hi-service.d.ts +0 -169
  23. package/lib/app/open-hi-service.js +0 -195
  24. package/lib/app/open-hi-stage.d.ts +0 -71
  25. package/lib/app/open-hi-stage.js +0 -70
  26. package/lib/components/acm/root-wildcard-certificate.d.ts +0 -15
  27. package/lib/components/acm/root-wildcard-certificate.js +0 -35
  28. package/lib/components/api-gateway/core-http-api.d.ts +0 -10
  29. package/lib/components/api-gateway/core-http-api.js +0 -44
  30. package/lib/components/api-gateway/http-lambda-integration-no-permissions.d.ts +0 -18
  31. package/lib/components/api-gateway/http-lambda-integration-no-permissions.js +0 -26
  32. package/lib/components/app-sync/core-graphql-api.d.ts +0 -12
  33. package/lib/components/app-sync/core-graphql-api.js +0 -54
  34. package/lib/components/auth.d.ts +0 -75
  35. package/lib/components/auth.js +0 -100
  36. package/lib/components/cognito/core-user-pool-client.d.ts +0 -10
  37. package/lib/components/cognito/core-user-pool-client.js +0 -47
  38. package/lib/components/cognito/core-user-pool-domain.d.ts +0 -10
  39. package/lib/components/cognito/core-user-pool-domain.js +0 -41
  40. package/lib/components/cognito/core-user-pool-kms-key.d.ts +0 -10
  41. package/lib/components/cognito/core-user-pool-kms-key.js +0 -37
  42. package/lib/components/cognito/core-user-pool.d.ts +0 -10
  43. package/lib/components/cognito/core-user-pool.js +0 -54
  44. package/lib/components/core.d.ts +0 -102
  45. package/lib/components/core.js +0 -79
  46. package/lib/components/dynamodb/dynamo-db-data-store.d.ts +0 -33
  47. package/lib/components/dynamodb/dynamo-db-data-store.js +0 -107
  48. package/lib/components/event-bridge/data-event-bus.d.ts +0 -19
  49. package/lib/components/event-bridge/data-event-bus.js +0 -34
  50. package/lib/components/event-bridge/ops-event-bus.d.ts +0 -19
  51. package/lib/components/event-bridge/ops-event-bus.js +0 -34
  52. package/lib/components/global.d.ts +0 -36
  53. package/lib/components/global.js +0 -63
  54. package/lib/components/index.d.ts +0 -1
  55. package/lib/components/index.js +0 -18
  56. package/lib/components/route-53/child-hosted-zone.d.ts +0 -20
  57. package/lib/components/route-53/child-hosted-zone.js +0 -48
  58. package/lib/components/route-53/root-hosted-zone.d.ts +0 -10
  59. package/lib/components/route-53/root-hosted-zone.js +0 -20
  60. package/lib/components/ssm/discoverable-string-parameter.d.ts +0 -59
  61. package/lib/components/ssm/discoverable-string-parameter.js +0 -50
  62. package/lib/components/ssm/index.d.ts +0 -1
  63. package/lib/components/ssm/index.js +0 -18
  64. package/lib/data/dynamo/ehr/r4/Patient.d.ts +0 -180
  65. package/lib/data/dynamo/ehr/r4/Patient.js +0 -192
  66. package/lib/data/dynamo/ehr/r4/ehr-r4-data-service.d.ts +0 -162
  67. package/lib/data/dynamo/ehr/r4/ehr-r4-data-service.js +0 -37
  68. package/lib/data/hello-world.d.ts +0 -39
  69. package/lib/data/hello-world.js +0 -59
  70. package/lib/data/import-patient-with-dynalite.d.ts +0 -1
  71. package/lib/data/import-patient-with-dynalite.js +0 -87
  72. package/lib/data/import-patient.d.ts +0 -47
  73. package/lib/data/import-patient.js +0 -158
  74. package/lib/data/lambda/rest-api-lambda.d.ts +0 -13
  75. package/lib/data/lambda/rest-api-lambda.handler.d.ts +0 -1
  76. package/lib/data/lambda/rest-api-lambda.handler.js +0 -10
  77. package/lib/data/lambda/rest-api-lambda.js +0 -22
  78. package/lib/data/middleware/open-hi-context.d.ts +0 -13
  79. package/lib/data/middleware/open-hi-context.js +0 -31
  80. package/lib/data/rest-api/ehr/r4/Patient.d.ts +0 -16
  81. package/lib/data/rest-api/ehr/r4/Patient.js +0 -234
  82. package/lib/data/rest-api/rest-api-local.d.ts +0 -1
  83. package/lib/data/rest-api/rest-api-local.js +0 -8
  84. package/lib/data/rest-api/rest-api-mockdata.d.ts +0 -7
  85. package/lib/data/rest-api/rest-api-mockdata.js +0 -585
  86. package/lib/data/rest-api/rest-api.d.ts +0 -3
  87. package/lib/data/rest-api/rest-api.js +0 -26
  88. package/lib/lib/compression.d.ts +0 -27
  89. package/lib/lib/compression.js +0 -87
  90. package/lib/services/index.d.ts +0 -5
  91. package/lib/services/index.js +0 -22
  92. package/lib/services/open-hi-auth-service.d.ts +0 -31
  93. package/lib/services/open-hi-auth-service.js +0 -31
  94. package/lib/services/open-hi-core-service.d.ts +0 -15
  95. package/lib/services/open-hi-core-service.js +0 -38
  96. package/lib/services/open-hi-data-service.d.ts +0 -18
  97. package/lib/services/open-hi-data-service.js +0 -18
  98. package/lib/services/open-hi-global-service.d.ts +0 -15
  99. package/lib/services/open-hi-global-service.js +0 -44
  100. package/lib/services/open-hi-rest-api-service.d.ts +0 -17
  101. package/lib/services/open-hi-rest-api-service.js +0 -107
package/lib/index.d.ts CHANGED
@@ -1,3 +1,869 @@
1
- export * from "./app";
2
- export * from "./components";
3
- export * from "./services";
1
+ import { RemovalPolicy, App, AppProps, Stage, StageProps, Stack, StackProps } from 'aws-cdk-lib';
2
+ import { Construct, IConstruct } from 'constructs';
3
+ import { ICertificate, Certificate, CertificateProps } from 'aws-cdk-lib/aws-certificatemanager';
4
+ import { IHttpApi, HttpApi, HttpApiProps, DomainName } from 'aws-cdk-lib/aws-apigatewayv2';
5
+ import { GraphqlApi, IGraphqlApi, GraphqlApiProps } from 'aws-cdk-lib/aws-appsync';
6
+ import { UserPool, UserPoolProps, UserPoolClient, UserPoolClientProps, UserPoolDomain, UserPoolDomainProps, IUserPool, IUserPoolClient, IUserPoolDomain } from 'aws-cdk-lib/aws-cognito';
7
+ import { Key, KeyProps, IKey } from 'aws-cdk-lib/aws-kms';
8
+ import { Table, TableProps, ITable } from 'aws-cdk-lib/aws-dynamodb';
9
+ import { EventBus, EventBusProps, IEventBus } from 'aws-cdk-lib/aws-events';
10
+ import { HostedZone, HostedZoneProps, IHostedZone, HostedZoneAttributes } from 'aws-cdk-lib/aws-route53';
11
+ import { StringParameterProps, StringParameter } from 'aws-cdk-lib/aws-ssm';
12
+
13
+ /*******************************************************************************
14
+ *
15
+ * OpenHi Config
16
+ *
17
+ * These types are kept in their own package to prevent dependency conflicts and
18
+ * conditions between @openhi/constructs and @openhi/platform.
19
+ *
20
+ ******************************************************************************/
21
+ /**
22
+ * Stage Types
23
+ *
24
+ * What stage of deployment is this? Dev, staging, or prod?
25
+ */
26
+ declare const OPEN_HI_STAGE: {
27
+ /**
28
+ * Development environment, typically used for testing and development.
29
+ */
30
+ readonly DEV: "dev";
31
+ /**
32
+ * Staging environment, used for pre-production testing.
33
+ */
34
+ readonly STAGE: "stage";
35
+ /**
36
+ * Production environment, used for live deployments.
37
+ */
38
+ readonly PROD: "prod";
39
+ };
40
+ /**
41
+ * Deployment Target Role
42
+ *
43
+ * Is this (account, region) the primary or a secondary deployment target for the stage?
44
+ * Works for both multi-region (different regions) and cellular (same region, different accounts).
45
+ */
46
+ declare const OPEN_HI_DEPLOYMENT_TARGET_ROLE: {
47
+ /**
48
+ * The primary deployment target for this stage (main account/region).
49
+ * For example, the base DynamoDB region for global tables.
50
+ */
51
+ readonly PRIMARY: "primary";
52
+ /**
53
+ * A secondary deployment target for this stage (additional account/region).
54
+ * For example, a replica region for a global DynamoDB table, or another cell in the same region.
55
+ */
56
+ readonly SECONDARY: "secondary";
57
+ };
58
+ interface OpenHiEnvironmentConfig {
59
+ account: string;
60
+ region: string;
61
+ /**
62
+ * Route53 zone containing DNS for this service.
63
+ */
64
+ hostedZoneId?: string;
65
+ zoneName?: string;
66
+ }
67
+ /**
68
+ * Represents the configuration for OpenHi services across different stages and
69
+ * deployment targets.
70
+ */
71
+ interface OpenHiConfig {
72
+ versions?: {
73
+ cdk?: {
74
+ cdkLibVersion?: string;
75
+ cdkCliVersion?: string;
76
+ };
77
+ };
78
+ deploymentTargets?: {
79
+ [OPEN_HI_STAGE.DEV]?: {
80
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
81
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
82
+ };
83
+ [OPEN_HI_STAGE.STAGE]?: {
84
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
85
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
86
+ };
87
+ [OPEN_HI_STAGE.PROD]?: {
88
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
89
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
90
+ };
91
+ };
92
+ }
93
+
94
+ /**
95
+ * Properties for creating an OpenHiStage instance.
96
+ */
97
+ interface OpenHiStageProps extends StageProps {
98
+ /**
99
+ * The type of the OpenHi stage.
100
+ */
101
+ readonly stageType: (typeof OPEN_HI_STAGE)[keyof typeof OPEN_HI_STAGE];
102
+ }
103
+ /**
104
+ * Represents a deployment stage in the OpenHi infrastructure hierarchy.
105
+ */
106
+ declare class OpenHiStage extends Stage {
107
+ /**
108
+ * The OpenHiApp that this stage belongs to.
109
+ *
110
+ * @public
111
+ */
112
+ ohApp: OpenHiApp;
113
+ /**
114
+ * Properties for configuring the stage.
115
+ *
116
+ * @public
117
+ */
118
+ props: OpenHiStageProps;
119
+ /**
120
+ * Finds the OpenHiStage that contains the given construct.
121
+ */
122
+ static of(construct: IConstruct): OpenHiStage | undefined;
123
+ /**
124
+ * Type guard to check if a value is an OpenHiStage instance.
125
+ */
126
+ static isOpenHiStage(this: void, x: any): x is OpenHiStage;
127
+ /**
128
+ * The type of this OpenHi stage.
129
+ */
130
+ readonly stageType: (typeof OPEN_HI_STAGE)[keyof typeof OPEN_HI_STAGE];
131
+ /**
132
+ * Creates a new OpenHiStage instance.
133
+ */
134
+ constructor(
135
+ /**
136
+ * The OpenHiApp that this stage belongs to.
137
+ *
138
+ * @public
139
+ */
140
+ ohApp: OpenHiApp,
141
+ /**
142
+ * Properties for configuring the stage.
143
+ *
144
+ * @public
145
+ */
146
+ props: OpenHiStageProps);
147
+ /**
148
+ * Gets all OpenHiEnvironment instances contained within this stage.
149
+ */
150
+ get environments(): Array<OpenHiEnvironment>;
151
+ /**
152
+ * Gets the primary OpenHiEnvironment for this stage, if one exists.
153
+ */
154
+ get primaryEnvironment(): OpenHiEnvironment | undefined;
155
+ /**
156
+ * Gets all secondary OpenHiEnvironment instances for this stage.
157
+ */
158
+ get secondaryEnvironments(): Array<OpenHiEnvironment>;
159
+ }
160
+
161
+ /**
162
+ * Properties for creating an OpenHiEnvironment.
163
+ */
164
+ interface OpenHiEnvironmentProps extends StageProps {
165
+ /**
166
+ * The deployment target role for this (account, region).
167
+ */
168
+ readonly deploymentTargetRole: (typeof OPEN_HI_DEPLOYMENT_TARGET_ROLE)[keyof typeof OPEN_HI_DEPLOYMENT_TARGET_ROLE];
169
+ /**
170
+ * Configuration for this specific environment.
171
+ */
172
+ readonly config: OpenHiEnvironmentConfig;
173
+ }
174
+ /**
175
+ * Represents an OpenHi environment within an AWS CDK stage.
176
+ */
177
+ declare class OpenHiEnvironment extends Stage {
178
+ /**
179
+ * The OpenHiStage that contains this environment.
180
+ */
181
+ ohStage: OpenHiStage;
182
+ /**
183
+ * Properties for creating the environment.
184
+ */
185
+ props: OpenHiEnvironmentProps;
186
+ /**
187
+ * Finds the OpenHiEnvironment that contains the given construct.
188
+ * ```
189
+ */
190
+ static of(construct: IConstruct): OpenHiEnvironment | undefined;
191
+ /**
192
+ * Type guard to check if a value is an OpenHiEnvironment instance.
193
+ */
194
+ static isOpenHiEnvironment(this: void, x: any): x is OpenHiEnvironment;
195
+ /**
196
+ * Configuration for this specific environment.
197
+ */
198
+ readonly config: OpenHiEnvironmentConfig;
199
+ /**
200
+ * The deployment target role for this (account, region).
201
+ */
202
+ readonly deploymentTargetRole: (typeof OPEN_HI_DEPLOYMENT_TARGET_ROLE)[keyof typeof OPEN_HI_DEPLOYMENT_TARGET_ROLE];
203
+ /**
204
+ * Creates a new OpenHiEnvironment.
205
+ */
206
+ constructor(
207
+ /**
208
+ * The OpenHiStage that contains this environment.
209
+ */
210
+ ohStage: OpenHiStage,
211
+ /**
212
+ * Properties for creating the environment.
213
+ */
214
+ props: OpenHiEnvironmentProps);
215
+ }
216
+
217
+ /**
218
+ * Properties for creating an OpenHiApp instance.
219
+ */
220
+ interface OpenHiAppProps extends AppProps {
221
+ /**
222
+ * Optional name for the application.
223
+ * ```
224
+ */
225
+ readonly appName?: string;
226
+ /**
227
+ * The OpenHi configuration object that defines stages, environments, and
228
+ * their associated AWS account and region settings.
229
+ */
230
+ readonly config: OpenHiConfig;
231
+ }
232
+ /**
233
+ * Root application construct for OpenHi CDK applications.
234
+ */
235
+ declare class OpenHiApp extends App {
236
+ /**
237
+ * Finds the OpenHiApp instance that contains the given construct in its
238
+ * construct tree.
239
+ */
240
+ static of(construct: IConstruct): OpenHiApp | undefined;
241
+ /**
242
+ * Type guard that checks if a value is an OpenHiApp instance.
243
+ */
244
+ static isOpenHiApp(this: void, x: any): x is OpenHiApp;
245
+ /**
246
+ * Name for the application.
247
+ */
248
+ readonly appName: string;
249
+ /**
250
+ * The OpenHi configuration object for this application.
251
+ */
252
+ readonly config: OpenHiConfig;
253
+ /**
254
+ * Creates a new OpenHiApp instance.
255
+ */
256
+ constructor(props: OpenHiAppProps);
257
+ /*****************************************************************************
258
+ *
259
+ * Stages
260
+ *
261
+ ****************************************************************************/
262
+ /**
263
+ * Gets all OpenHiStage instances that are direct children of this app.
264
+
265
+ */
266
+ get stages(): Array<OpenHiStage>;
267
+ /**
268
+ * Gets the development stage, if it exists.
269
+ */
270
+ get devStage(): OpenHiStage | undefined;
271
+ /**
272
+ * Gets the staging stage, if it exists.
273
+ */
274
+ get stageStage(): OpenHiStage | undefined;
275
+ /**
276
+ * Gets the production stage, if it exists.
277
+ */
278
+ get prodStage(): OpenHiStage | undefined;
279
+ /*****************************************************************************
280
+ *
281
+ * Environments
282
+ *
283
+ ****************************************************************************/
284
+ /**
285
+ * Gets all OpenHiEnvironment instances across all stages in this app.
286
+ */
287
+ get environments(): Array<OpenHiEnvironment>;
288
+ /**
289
+ * Gets all primary environments across all stages in this app.
290
+ */
291
+ get primaryEnvironments(): Array<OpenHiEnvironment>;
292
+ /**
293
+ * Gets all secondary environments across all stages in this app.
294
+ */
295
+ get secondaryEnvironments(): Array<OpenHiEnvironment>;
296
+ }
297
+
298
+ /**
299
+ * Known OpenHI service type strings. Each service class defines its own
300
+ * static SERVICE_TYPE (e.g. OpenHiAuthService.SERVICE_TYPE === "auth").
301
+ *
302
+ * @public
303
+ */
304
+ type OpenHiServiceType = "auth" | "rest-api" | "data" | "global" | "graphql-api";
305
+ /**
306
+ * Properties for creating an {@link OpenHiService} stack.
307
+ *
308
+ * @public
309
+ */
310
+ interface OpenHiServiceProps extends StackProps {
311
+ /**
312
+ * Optional branch name override.
313
+ */
314
+ readonly branchName?: string;
315
+ /**
316
+ * Optional repository name override.
317
+ */
318
+ readonly repoName?: string;
319
+ /**
320
+ * Optional application name override.
321
+ */
322
+ readonly appName?: string;
323
+ /**
324
+ * Default release branch name.
325
+ */
326
+ readonly defaultReleaseBranch?: string;
327
+ /**
328
+ * The removal policy for persistent stack resources.
329
+ */
330
+ readonly removalPolicy?: RemovalPolicy;
331
+ /**
332
+ * Environment configuration for this service.
333
+ */
334
+ readonly config?: OpenHiEnvironmentConfig;
335
+ /**
336
+ * A constant that identifies the service type.
337
+ */
338
+ readonly serviceType?: OpenHiServiceType;
339
+ }
340
+ /**
341
+ * Represents an OpenHI service stack within the OpenHI platform.
342
+ * Subclasses must override {@link serviceType} to return their static SERVICE_TYPE.
343
+ */
344
+ declare abstract class OpenHiService extends Stack {
345
+ ohEnv: OpenHiEnvironment;
346
+ props: OpenHiServiceProps;
347
+ /**
348
+ * The service/stack ID that was passed to the constructor.
349
+ */
350
+ readonly serviceId: string;
351
+ /**
352
+ * The deployment target role identifier.
353
+ */
354
+ readonly deploymentTargetRole: string;
355
+ /**
356
+ * Repository name used in resource tagging.
357
+ */
358
+ readonly repoName: string;
359
+ /**
360
+ * Application name identifier.
361
+ */
362
+ readonly appName: string;
363
+ /**
364
+ * Default release branch name.
365
+ */
366
+ readonly defaultReleaseBranch: string;
367
+ /**
368
+ * Branch name used when calculating resource names and hashes.
369
+ */
370
+ readonly branchName: string;
371
+ /**
372
+ * Short hash unique to the deployment target (app name, deployment target role, account, region).
373
+ */
374
+ readonly environmentHash: string;
375
+ /**
376
+ * Short hash unique to the environment and branch combination.
377
+ */
378
+ readonly branchHash: string;
379
+ /**
380
+ * Short hash unique to the specific stack/service.
381
+ */
382
+ readonly stackHash: string;
383
+ /**
384
+ * The removal policy for persistent stack resources.
385
+ */
386
+ readonly removalPolicy: RemovalPolicy;
387
+ /**
388
+ * Environment configuration for this service.
389
+ * This is either the value passed in or the default config
390
+ */
391
+ readonly config: OpenHiEnvironmentConfig;
392
+ /**
393
+ * Service type identifier. Override in subclasses to return the class's static SERVICE_TYPE.
394
+ * Used for parameter names, tags, and service discovery.
395
+ */
396
+ abstract get serviceType(): OpenHiServiceType | string;
397
+ /**
398
+ * Creates a new OpenHI service stack.
399
+ *
400
+ * @param ohEnv - The OpenHI environment (stage) this service belongs to
401
+ * @param id - Unique identifier for this service stack (e.g., "user-service")
402
+ * @param props - Optional properties for configuring the service
403
+ *
404
+ * @throws {Error} If account and region are not defined in props or environment
405
+ *
406
+ */
407
+ constructor(ohEnv: OpenHiEnvironment, id: string, props?: OpenHiServiceProps);
408
+ /**
409
+ * DNS prefix for this branche's child zone.
410
+ */
411
+ get childZonePrefix(): string;
412
+ }
413
+
414
+ declare class RootWildcardCertificate extends Certificate {
415
+ /**
416
+ * Used when storing the Certificate ARN in SSM.
417
+ */
418
+ static readonly SSM_PARAM_NAME = "ROOT_WILDCARD_CERT_ARN";
419
+ /**
420
+ * Using a special name here since this will be shared and used among many
421
+ * stacks and services. Use with OpenHiGlobalService.rootWildcardCertificateFromConstruct.
422
+ */
423
+ static ssmParameterName(): string;
424
+ constructor(scope: Construct, props: CertificateProps);
425
+ }
426
+
427
+ declare class RootHttpApi extends HttpApi {
428
+ /**
429
+ * Used when storing the API ID in SSM.
430
+ */
431
+ static readonly SSM_PARAM_NAME = "ROOT_HTTP_API";
432
+ constructor(scope: Construct, props?: HttpApiProps);
433
+ }
434
+
435
+ interface RootGraphqlApiProps extends GraphqlApiProps {
436
+ }
437
+ declare class RootGraphqlApi extends GraphqlApi {
438
+ /**
439
+ * Used when storing the GraphQl API ID in SSM.
440
+ */
441
+ static readonly SSM_PARAM_NAME = "ROOT_GRAPHQL_API";
442
+ static fromConstruct(scope: Construct): IGraphqlApi;
443
+ constructor(scope: Construct, props?: Omit<RootGraphqlApiProps, "name">);
444
+ }
445
+
446
+ declare class CognitoUserPool extends UserPool {
447
+ /**
448
+ * Used when storing the User Pool ID in SSM.
449
+ */
450
+ static readonly SSM_PARAM_NAME = "COGNITO_USER_POOL";
451
+ constructor(scope: Construct, props?: UserPoolProps);
452
+ }
453
+
454
+ declare class CognitoUserPoolClient extends UserPoolClient {
455
+ /**
456
+ * Used when storing the User Pool Client ID in SSM.
457
+ */
458
+ static readonly SSM_PARAM_NAME = "COGNITO_USER_POOL_CLIENT";
459
+ constructor(scope: Construct, props: UserPoolClientProps);
460
+ }
461
+
462
+ declare class CognitoUserPoolDomain extends UserPoolDomain {
463
+ /**
464
+ * Used when storing the User Pool Domain in SSM.
465
+ */
466
+ static readonly SSM_PARAM_NAME = "COGNITO_USER_POOL_DOMAIN";
467
+ constructor(scope: Construct, props: UserPoolDomainProps);
468
+ }
469
+
470
+ declare class CognitoUserPoolKmsKey extends Key {
471
+ /**
472
+ * Used when storing the KMS Key in SSM.
473
+ */
474
+ static readonly SSM_PARAM_NAME = "COGNITO_USER_POOL_KMS_KEY";
475
+ constructor(scope: Construct, props?: KeyProps);
476
+ }
477
+
478
+ /**
479
+ * DynamoDB table name for the data store. Used for cross-stack reference and
480
+ * deterministic naming per branch. The table backs multiple use cases (e.g.
481
+ * CRM, CMS, ERP, EHR).
482
+ */
483
+ declare function getDynamoDbDataStoreTableName(scope: Construct): string;
484
+ interface DynamoDbDataStoreProps extends Omit<TableProps, "tableName" | "removalPolicy"> {
485
+ /**
486
+ * Optional removal policy override. If not set, uses the service's default
487
+ * removal policy (RETAIN for prod, DESTROY otherwise).
488
+ */
489
+ readonly removalPolicy?: RemovalPolicy;
490
+ }
491
+ /**
492
+ * DynamoDB table implementing the single-table design for app data (e.g. FHIR
493
+ * resources, CRM, CMS, ERP, EHR).
494
+ *
495
+ * @see {@link https://github.com/codedrifters/openhi/blob/main/sites/www-docs/content/architecture/dynamodb-single-table-design.md | DynamoDB Single-Table Design}
496
+ *
497
+ * Primary key: PK (String), SK (String).
498
+ * GSIs: GSI1 (reverse reference), GSI2 (identifier lookup), GSI3 (facility ops), GSI4 (resource type list).
499
+ */
500
+ declare class DynamoDbDataStore extends Table {
501
+ constructor(scope: Construct, id: string, props?: DynamoDbDataStoreProps);
502
+ }
503
+
504
+ declare class DataEventBus extends EventBus {
505
+ /*****************************************************************************
506
+ *
507
+ * Return a name for this EventBus based on the stack environment hash. This
508
+ * name is common across all stacks since it's using the environment hash in
509
+ * it's name.
510
+ *
511
+ ****************************************************************************/
512
+ static getEventBusName(scope: Construct): string;
513
+ constructor(scope: Construct, props?: EventBusProps);
514
+ }
515
+
516
+ declare class OpsEventBus extends EventBus {
517
+ /*****************************************************************************
518
+ *
519
+ * Return a name for this EventBus based on the stack environment hash. This
520
+ * name is common across all stacks since it's using the environment hash in
521
+ * it's name.
522
+ *
523
+ ****************************************************************************/
524
+ static getEventBusName(scope: Construct): string;
525
+ constructor(scope: Construct, props?: EventBusProps);
526
+ }
527
+
528
+ interface ChildHostedZoneProps extends HostedZoneProps {
529
+ /**
530
+ * The root zone we will attach this sub-zone to.
531
+ */
532
+ readonly parentHostedZone: IHostedZone;
533
+ }
534
+ declare class ChildHostedZone extends HostedZone {
535
+ /**
536
+ * Used when storing the child zone ID in SSM. Use {@link OpenHiGlobalService.childHostedZoneFromConstruct} to look up.
537
+ */
538
+ static readonly SSM_PARAM_NAME = "CHILDHOSTEDZONE";
539
+ constructor(scope: Construct, id: string, props: ChildHostedZoneProps);
540
+ }
541
+
542
+ /**
543
+ * Placeholder for root hosted zone. Use {@link OpenHiGlobalService.rootHostedZoneFromConstruct}
544
+ * to obtain an IHostedZone from attributes (e.g. from config). The root zone is always
545
+ * created manually and imported via config.
546
+ */
547
+ declare class RootHostedZone extends Construct {
548
+ }
549
+
550
+ /*******************************************************************************
551
+ *
552
+ * DiscoverableStringParameterProps: props for creating or looking up SSM
553
+ * parameters. Includes StringParameterProps (minus parameterName) plus
554
+ * name-building fields used by buildParameterName.
555
+ *
556
+ ******************************************************************************/
557
+ interface DiscoverableStringParameterProps extends Omit<StringParameterProps, "parameterName"> {
558
+ /**
559
+ * SSM param name used to build the SSM parameter name via buildParameterName
560
+ * and stored as a tag on the parameter for discoverability.
561
+ */
562
+ readonly ssmParamName: string;
563
+ /**
564
+ * The environment hash the parameter belongs to.
565
+ * @default - the current stack's environment hash
566
+ */
567
+ readonly branchHash?: string;
568
+ /**
569
+ * The service type the parameter belongs to.
570
+ * @default - the current stack's service type
571
+ */
572
+ readonly serviceType?: string;
573
+ /**
574
+ * The AWS account the parameter belongs to.
575
+ * @default - the current stack's account
576
+ */
577
+ readonly account?: string;
578
+ /**
579
+ * The AWS region the parameter belongs to.
580
+ * @default - the current stack's region
581
+ */
582
+ readonly region?: string;
583
+ }
584
+ /**
585
+ * Props for buildParameterName and valueForLookupName.
586
+ * Includes ssmParamName (required) and optional overrides (branchHash, serviceType, account, region).
587
+ */
588
+ type BuildParameterNameProps = Pick<DiscoverableStringParameterProps, "ssmParamName" | "branchHash" | "serviceType" | "account" | "region">;
589
+ /**
590
+ * Discoverable SSM string parameter construct. Extends CDK StringParameter:
591
+ * builds parameterName from the given name via buildParameterName and tags
592
+ * the parameter with the name constant.
593
+ */
594
+ declare class DiscoverableStringParameter extends StringParameter {
595
+ /**
596
+ * Version of the parameter name format / discoverability schema.
597
+ * Bump when buildParameterName or tagging semantics change.
598
+ * Also used to drive replacement of parameters during CloudFormation deploys.
599
+ */
600
+ static readonly version = "v1";
601
+ /**
602
+ * Build a param name based on predictable attributes found in services and
603
+ * constructs. Used for storage and retrieval of SSM values across services.
604
+ */
605
+ static buildParameterName(scope: Construct, props: BuildParameterNameProps): string;
606
+ /**
607
+ * Read the string value of an SSM parameter created with DiscoverableStringParameter,
608
+ * using props that include ssmParamName and optional overrides (e.g. serviceType).
609
+ */
610
+ static valueForLookupName(scope: Construct, props: BuildParameterNameProps): string;
611
+ constructor(scope: Construct, id: string, props: DiscoverableStringParameterProps);
612
+ }
613
+
614
+ interface OpenHiAuthServiceProps extends OpenHiServiceProps {
615
+ /**
616
+ * Optional props for the Cognito User Pool.
617
+ */
618
+ readonly userPoolProps?: UserPoolProps;
619
+ }
620
+ /**
621
+ * OpenHI Auth Service stack.
622
+ *
623
+ * @remarks
624
+ * The Auth service manages authentication infrastructure including:
625
+ * - Cognito User Pool for user management and authentication
626
+ * - User Pool Client for application integration
627
+ * - User Pool Domain for hosting the Cognito hosted UI
628
+ * - KMS Key for Cognito User Pool encryption
629
+ *
630
+ * Resources are created in protected methods; subclasses may override to customize.
631
+ * Other stacks obtain auth by calling **OpenHiAuthService.userPoolFromConstruct(scope)**,
632
+ * **OpenHiAuthService.userPoolClientFromConstruct(scope)**,
633
+ * **OpenHiAuthService.userPoolDomainFromConstruct(scope)**,
634
+ * and **OpenHiAuthService.userPoolKmsKeyFromConstruct(scope)** for each resource needed.
635
+ *
636
+ * Only one instance of the auth service should exist per environment.
637
+ *
638
+ * @public
639
+ */
640
+ declare class OpenHiAuthService extends OpenHiService {
641
+ props: OpenHiAuthServiceProps;
642
+ static readonly SERVICE_TYPE = "auth";
643
+ /**
644
+ * Returns an IUserPool by looking up the Auth stack's User Pool ID from SSM.
645
+ */
646
+ static userPoolFromConstruct(scope: Construct): IUserPool;
647
+ /**
648
+ * Returns an IUserPoolClient by looking up the Auth stack's User Pool Client ID from SSM.
649
+ */
650
+ static userPoolClientFromConstruct(scope: Construct): IUserPoolClient;
651
+ /**
652
+ * Returns an IUserPoolDomain by looking up the Auth stack's User Pool Domain from SSM.
653
+ */
654
+ static userPoolDomainFromConstruct(scope: Construct): IUserPoolDomain;
655
+ /**
656
+ * Returns an IKey (KMS) by looking up the Auth stack's User Pool KMS Key ARN from SSM.
657
+ */
658
+ static userPoolKmsKeyFromConstruct(scope: Construct): IKey;
659
+ get serviceType(): string;
660
+ readonly userPoolKmsKey: IKey;
661
+ readonly userPool: IUserPool;
662
+ readonly userPoolClient: IUserPoolClient;
663
+ readonly userPoolDomain: IUserPoolDomain;
664
+ constructor(ohEnv: OpenHiEnvironment, props?: OpenHiAuthServiceProps);
665
+ /**
666
+ * Creates the KMS key for the Cognito User Pool and exports its ARN to SSM.
667
+ * Look up via {@link OpenHiAuthService.userPoolKmsKeyFromConstruct}.
668
+ * Override to customize.
669
+ */
670
+ protected createUserPoolKmsKey(): IKey;
671
+ /**
672
+ * Creates the Cognito User Pool and exports its ID to SSM.
673
+ * Look up via {@link OpenHiAuthService.userPoolFromConstruct}.
674
+ * Override to customize.
675
+ */
676
+ protected createUserPool(): IUserPool;
677
+ /**
678
+ * Creates the User Pool Client and exports its ID to SSM (AUTH service type).
679
+ * Look up via {@link OpenHiAuthService.userPoolClientFromConstruct}.
680
+ * Override to customize.
681
+ */
682
+ protected createUserPoolClient(): IUserPoolClient;
683
+ /**
684
+ * Creates the User Pool Domain (Cognito hosted UI) and exports domain name to SSM.
685
+ * Look up via {@link OpenHiAuthService.userPoolDomainFromConstruct}.
686
+ * Override to customize.
687
+ */
688
+ protected createUserPoolDomain(): IUserPoolDomain;
689
+ }
690
+
691
+ interface OpenHiGlobalServiceProps extends OpenHiServiceProps {
692
+ }
693
+ /**
694
+ * Global Infrastructure stack: owns global DNS and certificates.
695
+ * Resources (root zone, optional child zone, wildcard cert) are created
696
+ * in protected methods; subclasses may override to customize.
697
+ */
698
+ declare class OpenHiGlobalService extends OpenHiService {
699
+ static readonly SERVICE_TYPE = "global";
700
+ /**
701
+ * Returns an IHostedZone from the given attributes (no SSM). Use when the zone is imported from config.
702
+ */
703
+ static rootHostedZoneFromConstruct(scope: Construct, props: HostedZoneAttributes): IHostedZone;
704
+ /**
705
+ * Returns an ICertificate by looking up the Global stack's wildcard cert ARN from SSM.
706
+ */
707
+ static rootWildcardCertificateFromConstruct(scope: Construct): ICertificate;
708
+ /**
709
+ * Returns an IHostedZone by looking up the child hosted zone ID from SSM. Defaults to GLOBAL service type.
710
+ */
711
+ static childHostedZoneFromConstruct(scope: Construct, props: {
712
+ zoneName: string;
713
+ serviceType?: OpenHiServiceType;
714
+ }): IHostedZone;
715
+ get serviceType(): string;
716
+ readonly rootHostedZone: IHostedZone;
717
+ readonly childHostedZone?: IHostedZone;
718
+ readonly rootWildcardCertificate: ICertificate;
719
+ constructor(ohEnv: OpenHiEnvironment, props?: OpenHiGlobalServiceProps);
720
+ /**
721
+ * Validates that config required for the Global stack is present.
722
+ */
723
+ protected validateConfig(props: OpenHiGlobalServiceProps): void;
724
+ /**
725
+ * Creates the root hosted zone (imported via attributes from config).
726
+ * Override to customize or create the zone.
727
+ */
728
+ protected createRootHostedZone(): IHostedZone;
729
+ /**
730
+ * Creates the optional child hosted zone (e.g. branch subdomain).
731
+ * Override to create a child zone when config provides childHostedZoneAttributes.
732
+ * If you create a ChildHostedZone, also create a DiscoverableStringParameter
733
+ * with ChildHostedZone.SSM_PARAM_NAME and the zone's hostedZoneId.
734
+ */
735
+ protected createChildHostedZone(): IHostedZone | undefined;
736
+ /**
737
+ * Creates the root wildcard certificate. On main branch, creates a new cert
738
+ * with DNS validation; otherwise imports from SSM.
739
+ * Override to customize certificate creation.
740
+ */
741
+ protected createRootWildcardCertificate(): ICertificate;
742
+ }
743
+
744
+ interface OpenHiRestApiServiceProps extends OpenHiServiceProps {
745
+ }
746
+ /**
747
+ * SSM parameter name suffix for the REST API base URL.
748
+ * Full parameter name is built via buildParameterName with serviceType REST_API.
749
+ */
750
+ declare const REST_API_BASE_URL_SSM_NAME = "REST_API_BASE_URL";
751
+ /**
752
+ * REST API service stack: HTTP API, custom domain, and Lambda; exports base URL via SSM.
753
+ * Resources are created in protected methods; subclasses may override to customize.
754
+ */
755
+ declare class OpenHiRestApiService extends OpenHiService {
756
+ static readonly SERVICE_TYPE = "rest-api";
757
+ /**
758
+ * Returns an IHttpApi by looking up the REST API stack's HTTP API ID from SSM.
759
+ */
760
+ static rootHttpApiFromConstruct(scope: Construct): IHttpApi;
761
+ /**
762
+ * Returns the REST API base URL (e.g. https://api.example.com) by looking it up from SSM.
763
+ * Use in other stacks for E2E, scripts, or config.
764
+ */
765
+ static restApiBaseUrlFromConstruct(scope: Construct): string;
766
+ get serviceType(): string;
767
+ readonly rootHttpApi: RootHttpApi;
768
+ constructor(ohEnv: OpenHiEnvironment, props?: OpenHiRestApiServiceProps);
769
+ /**
770
+ * Validates that config required for the REST API stack is present.
771
+ */
772
+ protected validateConfig(props: OpenHiRestApiServiceProps): void;
773
+ /**
774
+ * Creates the hosted zone reference (imported from config).
775
+ * Override to customize.
776
+ */
777
+ protected createHostedZone(): IHostedZone;
778
+ /**
779
+ * Creates the wildcard certificate (imported from Global stack via SSM).
780
+ * Override to customize.
781
+ */
782
+ protected createCertificate(): ICertificate;
783
+ /**
784
+ * Returns the API domain name string (e.g. api.example.com or api-{prefix}.example.com).
785
+ * Override to customize.
786
+ */
787
+ protected createApiDomainNameString(hostedZone: IHostedZone): string;
788
+ /**
789
+ * Creates the SSM parameter for the REST API base URL.
790
+ * Look up via {@link OpenHiRestApiService.restApiBaseUrlFromConstruct}.
791
+ * Override to customize.
792
+ */
793
+ protected createRestApiBaseUrlParameter(apiDomainName: string): void;
794
+ /**
795
+ * Creates the API Gateway custom domain name resource.
796
+ * Override to customize.
797
+ */
798
+ protected createDomainName(_hostedZone: IHostedZone, certificate: ICertificate): DomainName;
799
+ /**
800
+ * Creates the Lambda integration, HTTP routes, and API DNS record.
801
+ * Override to customize. Uses {@link rootHttpApi} set by the constructor.
802
+ */
803
+ protected createRestApiLambdaAndRoutes(hostedZone: IHostedZone, domainName: DomainName): void;
804
+ /**
805
+ * Creates the Root HTTP API with default domain mapping and exports API ID to SSM.
806
+ * Look up via {@link OpenHiRestApiService.rootHttpApiFromConstruct}.
807
+ * Override to customize.
808
+ */
809
+ protected createRootHttpApi(domainName: DomainName): RootHttpApi;
810
+ }
811
+
812
+ interface OpenHiDataServiceProps extends OpenHiServiceProps {
813
+ }
814
+ /**
815
+ * Data storage service stack: centralizes DynamoDB, S3, EventBridge event buses,
816
+ * and other persistence resources for OpenHI. Creates the single-table data store
817
+ * (CRM, CMS, ERP, EHR) and the data/ops event buses in protected methods;
818
+ * subclasses may override to customize.
819
+ */
820
+ declare class OpenHiDataService extends OpenHiService {
821
+ static readonly SERVICE_TYPE = "data";
822
+ /**
823
+ * Returns the data event bus by name (deterministic per branch). Use from other stacks to obtain an IEventBus reference.
824
+ */
825
+ static dataEventBusFromConstruct(scope: Construct): IEventBus;
826
+ /**
827
+ * Returns the ops event bus by name (deterministic per branch). Use from other stacks to obtain an IEventBus reference.
828
+ */
829
+ static opsEventBusFromConstruct(scope: Construct): IEventBus;
830
+ /**
831
+ * Returns the data store table by name. Use from other stacks (e.g. REST API Lambda) to obtain an ITable reference.
832
+ */
833
+ static dynamoDbDataStoreFromConstruct(scope: Construct, id?: string): ITable;
834
+ get serviceType(): string;
835
+ /**
836
+ * Event bus for data-related events (ingestion, transformation, storage).
837
+ * Other stacks obtain it via {@link OpenHiDataService.dataEventBusFromConstruct}.
838
+ */
839
+ readonly dataEventBus: IEventBus;
840
+ /**
841
+ * Event bus for operational events (monitoring, alerting, system health).
842
+ * Other stacks obtain it via {@link OpenHiDataService.opsEventBusFromConstruct}.
843
+ */
844
+ readonly opsEventBus: IEventBus;
845
+ /**
846
+ * The single-table DynamoDB data store. Use {@link OpenHiDataService.dynamoDbDataStoreFromConstruct}
847
+ * from other stacks to obtain an ITable reference by name.
848
+ */
849
+ readonly dataStore: ITable;
850
+ constructor(ohEnv: OpenHiEnvironment, props?: OpenHiDataServiceProps);
851
+ /**
852
+ * Creates the data event bus.
853
+ * Override to customize.
854
+ */
855
+ protected createDataEventBus(): IEventBus;
856
+ /**
857
+ * Creates the ops event bus.
858
+ * Override to customize.
859
+ */
860
+ protected createOpsEventBus(): IEventBus;
861
+ /**
862
+ * Creates the single-table DynamoDB data store.
863
+ * Override to customize.
864
+ */
865
+ protected createDataStore(): ITable;
866
+ }
867
+
868
+ export { ChildHostedZone, CognitoUserPool, CognitoUserPoolClient, CognitoUserPoolDomain, CognitoUserPoolKmsKey, DataEventBus, DiscoverableStringParameter, DynamoDbDataStore, OpenHiApp, OpenHiAuthService, OpenHiDataService, OpenHiEnvironment, OpenHiGlobalService, OpenHiRestApiService, OpenHiService, OpenHiStage, OpsEventBus, REST_API_BASE_URL_SSM_NAME, RootGraphqlApi, RootHostedZone, RootHttpApi, RootWildcardCertificate, getDynamoDbDataStoreTableName };
869
+ export type { BuildParameterNameProps, ChildHostedZoneProps, DiscoverableStringParameterProps, DynamoDbDataStoreProps, OpenHiAppProps, OpenHiAuthServiceProps, OpenHiDataServiceProps, OpenHiEnvironmentProps, OpenHiGlobalServiceProps, OpenHiRestApiServiceProps, OpenHiServiceProps, OpenHiServiceType, OpenHiStageProps, RootGraphqlApiProps };