@openhi/constructs 0.0.103 → 0.0.105

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 (35) hide show
  1. package/README.md +14 -0
  2. package/lib/chunk-2PM2NGXI.mjs +31 -0
  3. package/lib/chunk-2PM2NGXI.mjs.map +1 -0
  4. package/lib/chunk-36YCDLLA.mjs +1258 -0
  5. package/lib/chunk-36YCDLLA.mjs.map +1 -0
  6. package/lib/chunk-BXEG7IOZ.mjs +108 -0
  7. package/lib/chunk-BXEG7IOZ.mjs.map +1 -0
  8. package/lib/chunk-WNUH2WDZ.mjs +45 -0
  9. package/lib/chunk-WNUH2WDZ.mjs.map +1 -0
  10. package/lib/events-CVA3_eEB.d.mts +23 -0
  11. package/lib/events-CVA3_eEB.d.ts +23 -0
  12. package/lib/index.d.mts +92 -21
  13. package/lib/index.d.ts +112 -22
  14. package/lib/index.js +214 -72
  15. package/lib/index.js.map +1 -1
  16. package/lib/index.mjs +190 -74
  17. package/lib/index.mjs.map +1 -1
  18. package/lib/post-confirmation.handler.js +50 -904
  19. package/lib/post-confirmation.handler.js.map +1 -1
  20. package/lib/post-confirmation.handler.mjs +36 -111
  21. package/lib/post-confirmation.handler.mjs.map +1 -1
  22. package/lib/pre-token-generation.handler.js +62 -27
  23. package/lib/pre-token-generation.handler.js.map +1 -1
  24. package/lib/pre-token-generation.handler.mjs +22 -31
  25. package/lib/pre-token-generation.handler.mjs.map +1 -1
  26. package/lib/provision-default-workspace.handler.d.mts +13 -0
  27. package/lib/provision-default-workspace.handler.d.ts +13 -0
  28. package/lib/{chunk-MLTYFMSE.mjs → provision-default-workspace.handler.js} +346 -26
  29. package/lib/provision-default-workspace.handler.js.map +1 -0
  30. package/lib/provision-default-workspace.handler.mjs +173 -0
  31. package/lib/provision-default-workspace.handler.mjs.map +1 -0
  32. package/lib/rest-api-lambda.handler.mjs +40 -546
  33. package/lib/rest-api-lambda.handler.mjs.map +1 -1
  34. package/package.json +2 -2
  35. package/lib/chunk-MLTYFMSE.mjs.map +0 -1
package/lib/index.d.mts CHANGED
@@ -9,7 +9,7 @@ import { Key, KeyProps, IKey } from 'aws-cdk-lib/aws-kms';
9
9
  import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';
10
10
  import { D as DynamoDbStreamKinesisRecord } from './dynamodb-stream-record-CJtV6a1t.mjs';
11
11
  import * as events from 'aws-cdk-lib/aws-events';
12
- import { EventBus, EventBusProps, IEventBus } from 'aws-cdk-lib/aws-events';
12
+ import { EventBus, EventBusProps, Rule, IEventBus } from 'aws-cdk-lib/aws-events';
13
13
  import * as kinesis from 'aws-cdk-lib/aws-kinesis';
14
14
  import * as kinesisfirehose from 'aws-cdk-lib/aws-kinesisfirehose';
15
15
  import * as s3 from 'aws-cdk-lib/aws-s3';
@@ -21,7 +21,9 @@ import { HostedZone, HostedZoneProps, IHostedZone, HostedZoneAttributes } from '
21
21
  import { StringParameterProps, StringParameter } from 'aws-cdk-lib/aws-ssm';
22
22
  import { Distribution, DistributionProps } from 'aws-cdk-lib/aws-cloudfront';
23
23
  import { IFunction } from 'aws-cdk-lib/aws-lambda';
24
+ export { P as PROVISION_DEFAULT_WORKSPACE_DETAIL_TYPE, a as ProvisionDefaultWorkspaceRequestedDetail, U as USER_ONBOARDING_EVENT_SOURCE, b as buildProvisionDefaultWorkspaceRequestedDetail } from './events-CVA3_eEB.mjs';
24
25
  import '@aws-sdk/client-dynamodb';
26
+ import 'aws-lambda';
25
27
 
26
28
  /**
27
29
  * Properties for creating an OpenHiStage instance.
@@ -484,16 +486,14 @@ declare class PostAuthenticationLambda extends Construct {
484
486
 
485
487
  interface PostConfirmationLambdaProps {
486
488
  /**
487
- * DynamoDB data store table name. Passed to the Lambda as DYNAMO_TABLE_NAME
488
- * so the control-plane ElectroDB service writes to the same single-table store.
489
+ * Control-plane EventBridge bus name. Passed to the Lambda as
490
+ * CONTROL_EVENT_BUS_NAME so it can publish onboarding workflow events.
489
491
  */
490
- readonly dynamoTableName: string;
492
+ readonly controlEventBusName: string;
491
493
  }
492
494
  /**
493
- * Lambda used as Cognito Post Confirmation trigger. Creates the new user's
494
- * default Tenant, Workspace, Memberships, and RoleAssignment, plus a User
495
- * record carrying the Cognito `sub` and current tenant/workspace pointers
496
- * (ADR 2026-03-17-01).
495
+ * Lambda used as Cognito Post Confirmation trigger. It publishes a control
496
+ * event and returns quickly; workflow Lambdas own provisioning.
497
497
  */
498
498
  declare class PostConfirmationLambda extends Construct {
499
499
  readonly lambda: NodejsFunction;
@@ -661,6 +661,21 @@ declare class OpsEventBus extends EventBus {
661
661
  constructor(scope: Construct, props?: EventBusProps);
662
662
  }
663
663
 
664
+ /**
665
+ * @see sites/www-docs/content/packages/@openhi/constructs/components/event-bridge/control-event-bus.md
666
+ */
667
+ declare class ControlEventBus extends EventBus {
668
+ /*****************************************************************************
669
+ *
670
+ * Return a name for this EventBus based on the stack environment hash. This
671
+ * name is common across all stacks since it's using the environment hash in
672
+ * its name.
673
+ *
674
+ ****************************************************************************/
675
+ static getEventBusName(scope: Construct): string;
676
+ constructor(scope: Construct, props?: EventBusProps);
677
+ }
678
+
664
679
  /**
665
680
  * SSM parameter names that publish the Postgres replica's coordinates so other
666
681
  * stacks (notably the REST API stack) can discover them without a direct CDK
@@ -905,6 +920,47 @@ declare class StaticHosting extends Construct {
905
920
  constructor(scope: Construct, id: string, props?: StaticHostingProps);
906
921
  }
907
922
 
923
+ interface ProvisionDefaultWorkspaceLambdaProps {
924
+ /**
925
+ * DynamoDB data store table. Used for the Lambda's `DYNAMO_TABLE_NAME`
926
+ * env var and for granting the Lambda the writes + GSI queries it needs
927
+ * to provision default control-plane resources.
928
+ */
929
+ readonly dataStoreTable: ITable;
930
+ /**
931
+ * Control-plane event bus that the EventBridge Rule listens on.
932
+ */
933
+ readonly controlEventBus: IEventBus;
934
+ }
935
+ /**
936
+ * Lambda used by the user-onboarding workflow to create a user's default
937
+ * Tenant, Workspace, Memberships, and RoleAssignment.
938
+ *
939
+ * Owns the EventBridge Rule that routes the default-workspace onboarding
940
+ * event to itself, and the IAM permissions it needs on the data store
941
+ * table — colocating routing + permissions with the function they target.
942
+ */
943
+ declare class ProvisionDefaultWorkspaceLambda extends Construct {
944
+ readonly lambda: NodejsFunction;
945
+ readonly rule: Rule;
946
+ constructor(scope: Construct, props: ProvisionDefaultWorkspaceLambdaProps);
947
+ }
948
+
949
+ /**
950
+ * @see sites/www-docs/content/packages/@openhi/constructs/workflows/control-plane/user-onboarding/user-onboarding-workflow.md
951
+ */
952
+ interface UserOnboardingWorkflowProps {
953
+ readonly controlEventBus: IEventBus;
954
+ readonly dataStoreTable: ITable;
955
+ }
956
+ /**
957
+ * Control-plane workflow for onboarding users after Cognito confirmation.
958
+ */
959
+ declare class UserOnboardingWorkflow extends Construct {
960
+ readonly provisionDefaultWorkspace: ProvisionDefaultWorkspaceLambda;
961
+ constructor(scope: Construct, props: UserOnboardingWorkflowProps);
962
+ }
963
+
908
964
  /**
909
965
  * @see sites/www-docs/content/packages/@openhi/constructs/services/open-hi-auth-service.md
910
966
  */
@@ -970,6 +1026,7 @@ declare class OpenHiAuthService extends OpenHiService {
970
1026
  readonly preTokenGenerationLambda: IFunction;
971
1027
  readonly postAuthenticationLambda: IFunction;
972
1028
  readonly postConfirmationLambda: IFunction;
1029
+ readonly userOnboardingWorkflow: UserOnboardingWorkflow;
973
1030
  readonly userPool: IUserPool;
974
1031
  readonly userPoolClient: IUserPoolClient;
975
1032
  readonly userPoolDomain: IUserPoolDomain;
@@ -986,6 +1043,7 @@ declare class OpenHiAuthService extends OpenHiService {
986
1043
  * would collide.
987
1044
  */
988
1045
  private _dataStoreTable;
1046
+ private _controlEventBus;
989
1047
  constructor(ohEnv: OpenHiEnvironment, props?: OpenHiAuthServiceProps);
990
1048
  /**
991
1049
  * Creates the KMS key for the Cognito User Pool and exports its ARN to SSM.
@@ -1008,13 +1066,13 @@ declare class OpenHiAuthService extends OpenHiService {
1008
1066
  protected createPostAuthenticationLambda(): IFunction;
1009
1067
  /**
1010
1068
  * Creates the Post Confirmation Lambda (Cognito trigger). On sign-up
1011
- * confirmation, writes the new user's default Tenant, Workspace,
1012
- * Memberships, and `tenant-user` RoleAssignment, plus a User record
1013
- * carrying the Cognito `sub` and current tenant/workspace pointers
1014
- * (ADR 2026-03-17-01 invariants).
1069
+ * confirmation, publishes a control-plane workflow event; provisioning lives
1070
+ * behind EventBridge.
1015
1071
  */
1016
1072
  protected createPostConfirmationLambda(): IFunction;
1073
+ protected createUserOnboardingWorkflow(): UserOnboardingWorkflow;
1017
1074
  private dataStoreTable;
1075
+ private controlEventBus;
1018
1076
  /**
1019
1077
  * Creates the Cognito User Pool and exports its ID to SSM.
1020
1078
  * Look up via {@link OpenHiAuthService.userPoolFromConstruct}.
@@ -1046,9 +1104,8 @@ declare class OpenHiAuthService extends OpenHiService {
1046
1104
  */
1047
1105
  protected grantPostAuthenticationPermissions(): void;
1048
1106
  /**
1049
- * Grants the Post Confirmation Lambda write access to the data store
1050
- * table (and its GSIs) so it can seed the new user's Tenant, Workspace,
1051
- * Memberships, RoleAssignment, and User records on sign-up confirmation.
1107
+ * Grants the Post Confirmation Lambda publish-only access to the
1108
+ * control-plane event bus. Workflow Lambdas own DynamoDB writes.
1052
1109
  */
1053
1110
  protected grantPostConfirmationPermissions(): void;
1054
1111
  /**
@@ -1084,9 +1141,9 @@ interface OpenHiGlobalServiceProps extends OpenHiServiceProps {
1084
1141
  }
1085
1142
  /**
1086
1143
  * Global Infrastructure stack: owns global DNS, certificates, and the
1087
- * cross-region EventBridge buses (data, ops). Resources (root zone, optional
1088
- * child zone, wildcard cert, data/ops buses) are created in protected methods;
1089
- * subclasses may override to customize.
1144
+ * cross-region EventBridge buses (data, ops, control). Resources (root zone,
1145
+ * optional child zone, wildcard cert, data/ops/control buses) are created in
1146
+ * protected methods; subclasses may override to customize.
1090
1147
  */
1091
1148
  declare class OpenHiGlobalService extends OpenHiService {
1092
1149
  static readonly SERVICE_TYPE = "global";
@@ -1113,6 +1170,10 @@ declare class OpenHiGlobalService extends OpenHiService {
1113
1170
  * Returns the ops event bus by name (deterministic per branch). Use from other stacks to obtain an IEventBus reference.
1114
1171
  */
1115
1172
  static opsEventBusFromConstruct(scope: Construct): IEventBus;
1173
+ /**
1174
+ * Returns the control-plane event bus by name (deterministic per branch). Use from other stacks to obtain an IEventBus reference.
1175
+ */
1176
+ static controlEventBusFromConstruct(scope: Construct): IEventBus;
1116
1177
  get serviceType(): string;
1117
1178
  /** Override so this.props is typed with this service's options. */
1118
1179
  props: OpenHiGlobalServiceProps;
@@ -1129,6 +1190,11 @@ declare class OpenHiGlobalService extends OpenHiService {
1129
1190
  * Other stacks obtain it via {@link OpenHiGlobalService.opsEventBusFromConstruct}.
1130
1191
  */
1131
1192
  readonly opsEventBus: IEventBus;
1193
+ /**
1194
+ * Event bus for control-plane lifecycle and command events.
1195
+ * Other stacks obtain it via {@link OpenHiGlobalService.controlEventBusFromConstruct}.
1196
+ */
1197
+ readonly controlEventBus: IEventBus;
1132
1198
  constructor(ohEnv: OpenHiEnvironment, props?: OpenHiGlobalServiceProps);
1133
1199
  /**
1134
1200
  * Validates that config required for the Global stack is present.
@@ -1162,6 +1228,11 @@ declare class OpenHiGlobalService extends OpenHiService {
1162
1228
  * Override to customize.
1163
1229
  */
1164
1230
  protected createOpsEventBus(): IEventBus;
1231
+ /**
1232
+ * Creates the control-plane event bus.
1233
+ * Override to customize.
1234
+ */
1235
+ protected createControlEventBus(): IEventBus;
1165
1236
  }
1166
1237
 
1167
1238
  /**
@@ -1251,8 +1322,8 @@ interface OpenHiDataServiceProps extends OpenHiServiceProps {
1251
1322
  * Data storage service stack: centralizes DynamoDB, S3, and other persistence
1252
1323
  * resources for OpenHI. Creates the single-table data store in a protected
1253
1324
  * method; subclasses may override to customize. EventBridge event buses
1254
- * (data, ops) are owned by {@link OpenHiGlobalService} so they deploy ahead of
1255
- * regional services.
1325
+ * (data, ops, control) are owned by {@link OpenHiGlobalService} so they deploy
1326
+ * ahead of regional services.
1256
1327
  */
1257
1328
  declare class OpenHiDataService extends OpenHiService {
1258
1329
  static readonly SERVICE_TYPE = "data";
@@ -1314,4 +1385,4 @@ declare class OpenHiGraphqlService extends OpenHiService {
1314
1385
  protected createRootGraphqlApi(): RootGraphqlApi;
1315
1386
  }
1316
1387
 
1317
- export { type BuildParameterNameProps, ChildHostedZone, type ChildHostedZoneProps, CognitoFixtureSeederClient, type CognitoFixtureSeederClientProps, CognitoUserPool, CognitoUserPoolClient, CognitoUserPoolDomain, CognitoUserPoolKmsKey, DATA_STORE_CHANGE_DETAIL_MAX_UTF8_BYTES, DATA_STORE_CHANGE_DETAIL_TYPE, DATA_STORE_CHANGE_EVENT_SOURCE, DataEventBus, DataStoreHistoricalArchive, type DataStoreHistoricalArchiveProps, DataStorePostgresReplica, type DataStorePostgresReplicaProps, DiscoverableStringParameter, type DiscoverableStringParameterProps, DynamoDbDataStore, type DynamoDbDataStoreProps, type FhirCurrentResourceChangeDetail, OpenHiApp, type OpenHiAppProps, OpenHiAuthService, type OpenHiAuthServiceProps, OpenHiDataService, type OpenHiDataServiceProps, OpenHiEnvironment, type OpenHiEnvironmentProps, OpenHiGlobalService, type OpenHiGlobalServiceProps, OpenHiGraphqlService, type OpenHiGraphqlServiceProps, OpenHiRestApiService, type OpenHiRestApiServiceProps, OpenHiService, type OpenHiServiceProps, type OpenHiServiceType, OpenHiStage, type OpenHiStageProps, OpsEventBus, POSTGRES_REPLICA_CLUSTER_ARN_SSM_NAME, POSTGRES_REPLICA_DATABASE_NAME_SSM_NAME, POSTGRES_REPLICA_SECRET_ARN_SSM_NAME, PostAuthenticationLambda, PostConfirmationLambda, type PostConfirmationLambdaProps, PreTokenGenerationLambda, type PreTokenGenerationLambdaProps, REST_API_BASE_URL_SSM_NAME, RootGraphqlApi, type RootGraphqlApiProps, RootHostedZone, RootHttpApi, type RootHttpApiProps, RootWildcardCertificate, STATIC_HOSTING_SERVICE_TYPE, StaticHosting, type StaticHostingProps, buildFhirCurrentResourceChangeDetail, getDynamoDbDataStoreTableName, getPostgresReplicaSchemaName };
1388
+ export { type BuildParameterNameProps, ChildHostedZone, type ChildHostedZoneProps, CognitoFixtureSeederClient, type CognitoFixtureSeederClientProps, CognitoUserPool, CognitoUserPoolClient, CognitoUserPoolDomain, CognitoUserPoolKmsKey, ControlEventBus, DATA_STORE_CHANGE_DETAIL_MAX_UTF8_BYTES, DATA_STORE_CHANGE_DETAIL_TYPE, DATA_STORE_CHANGE_EVENT_SOURCE, DataEventBus, DataStoreHistoricalArchive, type DataStoreHistoricalArchiveProps, DataStorePostgresReplica, type DataStorePostgresReplicaProps, DiscoverableStringParameter, type DiscoverableStringParameterProps, DynamoDbDataStore, type DynamoDbDataStoreProps, type FhirCurrentResourceChangeDetail, OpenHiApp, type OpenHiAppProps, OpenHiAuthService, type OpenHiAuthServiceProps, OpenHiDataService, type OpenHiDataServiceProps, OpenHiEnvironment, type OpenHiEnvironmentProps, OpenHiGlobalService, type OpenHiGlobalServiceProps, OpenHiGraphqlService, type OpenHiGraphqlServiceProps, OpenHiRestApiService, type OpenHiRestApiServiceProps, OpenHiService, type OpenHiServiceProps, type OpenHiServiceType, OpenHiStage, type OpenHiStageProps, OpsEventBus, POSTGRES_REPLICA_CLUSTER_ARN_SSM_NAME, POSTGRES_REPLICA_DATABASE_NAME_SSM_NAME, POSTGRES_REPLICA_SECRET_ARN_SSM_NAME, PostAuthenticationLambda, PostConfirmationLambda, type PostConfirmationLambdaProps, PreTokenGenerationLambda, type PreTokenGenerationLambdaProps, ProvisionDefaultWorkspaceLambda, type ProvisionDefaultWorkspaceLambdaProps, REST_API_BASE_URL_SSM_NAME, RootGraphqlApi, type RootGraphqlApiProps, RootHostedZone, RootHttpApi, type RootHttpApiProps, RootWildcardCertificate, STATIC_HOSTING_SERVICE_TYPE, StaticHosting, type StaticHostingProps, UserOnboardingWorkflow, type UserOnboardingWorkflowProps, buildFhirCurrentResourceChangeDetail, getDynamoDbDataStoreTableName, getPostgresReplicaSchemaName };
package/lib/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import { Key, KeyProps, IKey } from 'aws-cdk-lib/aws-kms';
8
8
  import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';
9
9
  import { AttributeValue } from '@aws-sdk/client-dynamodb';
10
10
  import * as events from 'aws-cdk-lib/aws-events';
11
- import { EventBus, EventBusProps, IEventBus } from 'aws-cdk-lib/aws-events';
11
+ import { EventBus, EventBusProps, Rule, IEventBus } from 'aws-cdk-lib/aws-events';
12
12
  import * as kinesis from 'aws-cdk-lib/aws-kinesis';
13
13
  import * as kinesisfirehose from 'aws-cdk-lib/aws-kinesisfirehose';
14
14
  import * as s3 from 'aws-cdk-lib/aws-s3';
@@ -20,6 +20,7 @@ import { HostedZone, HostedZoneProps, IHostedZone, HostedZoneAttributes } from '
20
20
  import { StringParameterProps, StringParameter } from 'aws-cdk-lib/aws-ssm';
21
21
  import { Distribution, DistributionProps } from 'aws-cdk-lib/aws-cloudfront';
22
22
  import { IFunction } from 'aws-cdk-lib/aws-lambda';
23
+ import { PostConfirmationTriggerEvent } from 'aws-lambda';
23
24
 
24
25
  /*******************************************************************************
25
26
  *
@@ -118,6 +119,26 @@ interface DynamoDbStreamKinesisRecord {
118
119
  };
119
120
  }
120
121
 
122
+ /**
123
+ * @see sites/www-docs/content/packages/@openhi/constructs/workflows/control-plane/user-onboarding/events.md
124
+ */
125
+ declare const USER_ONBOARDING_EVENT_SOURCE = "openhi.control.user-onboarding";
126
+ declare const PROVISION_DEFAULT_WORKSPACE_DETAIL_TYPE = "ProvisionDefaultWorkspaceRequested";
127
+ interface ProvisionDefaultWorkspaceRequestedDetail {
128
+ readonly cognitoSub: string;
129
+ readonly userId?: string;
130
+ readonly email?: string;
131
+ readonly displayName?: string;
132
+ readonly trigger: {
133
+ readonly source: "cognito.post-confirmation";
134
+ readonly triggerSource?: string;
135
+ readonly userPoolId?: string;
136
+ readonly userName?: string;
137
+ readonly clientId?: string;
138
+ };
139
+ }
140
+ declare const buildProvisionDefaultWorkspaceRequestedDetail: (event: PostConfirmationTriggerEvent) => ProvisionDefaultWorkspaceRequestedDetail | undefined;
141
+
121
142
  /**
122
143
  * Properties for creating an OpenHiStage instance.
123
144
  */
@@ -579,16 +600,14 @@ declare class PostAuthenticationLambda extends Construct {
579
600
 
580
601
  interface PostConfirmationLambdaProps {
581
602
  /**
582
- * DynamoDB data store table name. Passed to the Lambda as DYNAMO_TABLE_NAME
583
- * so the control-plane ElectroDB service writes to the same single-table store.
603
+ * Control-plane EventBridge bus name. Passed to the Lambda as
604
+ * CONTROL_EVENT_BUS_NAME so it can publish onboarding workflow events.
584
605
  */
585
- readonly dynamoTableName: string;
606
+ readonly controlEventBusName: string;
586
607
  }
587
608
  /**
588
- * Lambda used as Cognito Post Confirmation trigger. Creates the new user's
589
- * default Tenant, Workspace, Memberships, and RoleAssignment, plus a User
590
- * record carrying the Cognito `sub` and current tenant/workspace pointers
591
- * (ADR 2026-03-17-01).
609
+ * Lambda used as Cognito Post Confirmation trigger. It publishes a control
610
+ * event and returns quickly; workflow Lambdas own provisioning.
592
611
  */
593
612
  declare class PostConfirmationLambda extends Construct {
594
613
  readonly lambda: NodejsFunction;
@@ -756,6 +775,21 @@ declare class OpsEventBus extends EventBus {
756
775
  constructor(scope: Construct, props?: EventBusProps);
757
776
  }
758
777
 
778
+ /**
779
+ * @see sites/www-docs/content/packages/@openhi/constructs/components/event-bridge/control-event-bus.md
780
+ */
781
+ declare class ControlEventBus extends EventBus {
782
+ /*****************************************************************************
783
+ *
784
+ * Return a name for this EventBus based on the stack environment hash. This
785
+ * name is common across all stacks since it's using the environment hash in
786
+ * its name.
787
+ *
788
+ ****************************************************************************/
789
+ static getEventBusName(scope: Construct): string;
790
+ constructor(scope: Construct, props?: EventBusProps);
791
+ }
792
+
759
793
  /**
760
794
  * SSM parameter names that publish the Postgres replica's coordinates so other
761
795
  * stacks (notably the REST API stack) can discover them without a direct CDK
@@ -1000,6 +1034,47 @@ declare class StaticHosting extends Construct {
1000
1034
  constructor(scope: Construct, id: string, props?: StaticHostingProps);
1001
1035
  }
1002
1036
 
1037
+ interface ProvisionDefaultWorkspaceLambdaProps {
1038
+ /**
1039
+ * DynamoDB data store table. Used for the Lambda's `DYNAMO_TABLE_NAME`
1040
+ * env var and for granting the Lambda the writes + GSI queries it needs
1041
+ * to provision default control-plane resources.
1042
+ */
1043
+ readonly dataStoreTable: ITable;
1044
+ /**
1045
+ * Control-plane event bus that the EventBridge Rule listens on.
1046
+ */
1047
+ readonly controlEventBus: IEventBus;
1048
+ }
1049
+ /**
1050
+ * Lambda used by the user-onboarding workflow to create a user's default
1051
+ * Tenant, Workspace, Memberships, and RoleAssignment.
1052
+ *
1053
+ * Owns the EventBridge Rule that routes the default-workspace onboarding
1054
+ * event to itself, and the IAM permissions it needs on the data store
1055
+ * table — colocating routing + permissions with the function they target.
1056
+ */
1057
+ declare class ProvisionDefaultWorkspaceLambda extends Construct {
1058
+ readonly lambda: NodejsFunction;
1059
+ readonly rule: Rule;
1060
+ constructor(scope: Construct, props: ProvisionDefaultWorkspaceLambdaProps);
1061
+ }
1062
+
1063
+ /**
1064
+ * @see sites/www-docs/content/packages/@openhi/constructs/workflows/control-plane/user-onboarding/user-onboarding-workflow.md
1065
+ */
1066
+ interface UserOnboardingWorkflowProps {
1067
+ readonly controlEventBus: IEventBus;
1068
+ readonly dataStoreTable: ITable;
1069
+ }
1070
+ /**
1071
+ * Control-plane workflow for onboarding users after Cognito confirmation.
1072
+ */
1073
+ declare class UserOnboardingWorkflow extends Construct {
1074
+ readonly provisionDefaultWorkspace: ProvisionDefaultWorkspaceLambda;
1075
+ constructor(scope: Construct, props: UserOnboardingWorkflowProps);
1076
+ }
1077
+
1003
1078
  /**
1004
1079
  * @see sites/www-docs/content/packages/@openhi/constructs/services/open-hi-auth-service.md
1005
1080
  */
@@ -1065,6 +1140,7 @@ declare class OpenHiAuthService extends OpenHiService {
1065
1140
  readonly preTokenGenerationLambda: IFunction;
1066
1141
  readonly postAuthenticationLambda: IFunction;
1067
1142
  readonly postConfirmationLambda: IFunction;
1143
+ readonly userOnboardingWorkflow: UserOnboardingWorkflow;
1068
1144
  readonly userPool: IUserPool;
1069
1145
  readonly userPoolClient: IUserPoolClient;
1070
1146
  readonly userPoolDomain: IUserPoolDomain;
@@ -1081,6 +1157,7 @@ declare class OpenHiAuthService extends OpenHiService {
1081
1157
  * would collide.
1082
1158
  */
1083
1159
  private _dataStoreTable;
1160
+ private _controlEventBus;
1084
1161
  constructor(ohEnv: OpenHiEnvironment, props?: OpenHiAuthServiceProps);
1085
1162
  /**
1086
1163
  * Creates the KMS key for the Cognito User Pool and exports its ARN to SSM.
@@ -1103,13 +1180,13 @@ declare class OpenHiAuthService extends OpenHiService {
1103
1180
  protected createPostAuthenticationLambda(): IFunction;
1104
1181
  /**
1105
1182
  * Creates the Post Confirmation Lambda (Cognito trigger). On sign-up
1106
- * confirmation, writes the new user's default Tenant, Workspace,
1107
- * Memberships, and `tenant-user` RoleAssignment, plus a User record
1108
- * carrying the Cognito `sub` and current tenant/workspace pointers
1109
- * (ADR 2026-03-17-01 invariants).
1183
+ * confirmation, publishes a control-plane workflow event; provisioning lives
1184
+ * behind EventBridge.
1110
1185
  */
1111
1186
  protected createPostConfirmationLambda(): IFunction;
1187
+ protected createUserOnboardingWorkflow(): UserOnboardingWorkflow;
1112
1188
  private dataStoreTable;
1189
+ private controlEventBus;
1113
1190
  /**
1114
1191
  * Creates the Cognito User Pool and exports its ID to SSM.
1115
1192
  * Look up via {@link OpenHiAuthService.userPoolFromConstruct}.
@@ -1141,9 +1218,8 @@ declare class OpenHiAuthService extends OpenHiService {
1141
1218
  */
1142
1219
  protected grantPostAuthenticationPermissions(): void;
1143
1220
  /**
1144
- * Grants the Post Confirmation Lambda write access to the data store
1145
- * table (and its GSIs) so it can seed the new user's Tenant, Workspace,
1146
- * Memberships, RoleAssignment, and User records on sign-up confirmation.
1221
+ * Grants the Post Confirmation Lambda publish-only access to the
1222
+ * control-plane event bus. Workflow Lambdas own DynamoDB writes.
1147
1223
  */
1148
1224
  protected grantPostConfirmationPermissions(): void;
1149
1225
  /**
@@ -1179,9 +1255,9 @@ interface OpenHiGlobalServiceProps extends OpenHiServiceProps {
1179
1255
  }
1180
1256
  /**
1181
1257
  * Global Infrastructure stack: owns global DNS, certificates, and the
1182
- * cross-region EventBridge buses (data, ops). Resources (root zone, optional
1183
- * child zone, wildcard cert, data/ops buses) are created in protected methods;
1184
- * subclasses may override to customize.
1258
+ * cross-region EventBridge buses (data, ops, control). Resources (root zone,
1259
+ * optional child zone, wildcard cert, data/ops/control buses) are created in
1260
+ * protected methods; subclasses may override to customize.
1185
1261
  */
1186
1262
  declare class OpenHiGlobalService extends OpenHiService {
1187
1263
  static readonly SERVICE_TYPE = "global";
@@ -1208,6 +1284,10 @@ declare class OpenHiGlobalService extends OpenHiService {
1208
1284
  * Returns the ops event bus by name (deterministic per branch). Use from other stacks to obtain an IEventBus reference.
1209
1285
  */
1210
1286
  static opsEventBusFromConstruct(scope: Construct): IEventBus;
1287
+ /**
1288
+ * Returns the control-plane event bus by name (deterministic per branch). Use from other stacks to obtain an IEventBus reference.
1289
+ */
1290
+ static controlEventBusFromConstruct(scope: Construct): IEventBus;
1211
1291
  get serviceType(): string;
1212
1292
  /** Override so this.props is typed with this service's options. */
1213
1293
  props: OpenHiGlobalServiceProps;
@@ -1224,6 +1304,11 @@ declare class OpenHiGlobalService extends OpenHiService {
1224
1304
  * Other stacks obtain it via {@link OpenHiGlobalService.opsEventBusFromConstruct}.
1225
1305
  */
1226
1306
  readonly opsEventBus: IEventBus;
1307
+ /**
1308
+ * Event bus for control-plane lifecycle and command events.
1309
+ * Other stacks obtain it via {@link OpenHiGlobalService.controlEventBusFromConstruct}.
1310
+ */
1311
+ readonly controlEventBus: IEventBus;
1227
1312
  constructor(ohEnv: OpenHiEnvironment, props?: OpenHiGlobalServiceProps);
1228
1313
  /**
1229
1314
  * Validates that config required for the Global stack is present.
@@ -1257,6 +1342,11 @@ declare class OpenHiGlobalService extends OpenHiService {
1257
1342
  * Override to customize.
1258
1343
  */
1259
1344
  protected createOpsEventBus(): IEventBus;
1345
+ /**
1346
+ * Creates the control-plane event bus.
1347
+ * Override to customize.
1348
+ */
1349
+ protected createControlEventBus(): IEventBus;
1260
1350
  }
1261
1351
 
1262
1352
  /**
@@ -1346,8 +1436,8 @@ interface OpenHiDataServiceProps extends OpenHiServiceProps {
1346
1436
  * Data storage service stack: centralizes DynamoDB, S3, and other persistence
1347
1437
  * resources for OpenHI. Creates the single-table data store in a protected
1348
1438
  * method; subclasses may override to customize. EventBridge event buses
1349
- * (data, ops) are owned by {@link OpenHiGlobalService} so they deploy ahead of
1350
- * regional services.
1439
+ * (data, ops, control) are owned by {@link OpenHiGlobalService} so they deploy
1440
+ * ahead of regional services.
1351
1441
  */
1352
1442
  declare class OpenHiDataService extends OpenHiService {
1353
1443
  static readonly SERVICE_TYPE = "data";
@@ -1409,5 +1499,5 @@ declare class OpenHiGraphqlService extends OpenHiService {
1409
1499
  protected createRootGraphqlApi(): RootGraphqlApi;
1410
1500
  }
1411
1501
 
1412
- export { ChildHostedZone, CognitoFixtureSeederClient, CognitoUserPool, CognitoUserPoolClient, CognitoUserPoolDomain, CognitoUserPoolKmsKey, DATA_STORE_CHANGE_DETAIL_MAX_UTF8_BYTES, DATA_STORE_CHANGE_DETAIL_TYPE, DATA_STORE_CHANGE_EVENT_SOURCE, DataEventBus, DataStoreHistoricalArchive, DataStorePostgresReplica, DiscoverableStringParameter, DynamoDbDataStore, OpenHiApp, OpenHiAuthService, OpenHiDataService, OpenHiEnvironment, OpenHiGlobalService, OpenHiGraphqlService, OpenHiRestApiService, OpenHiService, OpenHiStage, OpsEventBus, POSTGRES_REPLICA_CLUSTER_ARN_SSM_NAME, POSTGRES_REPLICA_DATABASE_NAME_SSM_NAME, POSTGRES_REPLICA_SECRET_ARN_SSM_NAME, PostAuthenticationLambda, PostConfirmationLambda, PreTokenGenerationLambda, REST_API_BASE_URL_SSM_NAME, RootGraphqlApi, RootHostedZone, RootHttpApi, RootWildcardCertificate, STATIC_HOSTING_SERVICE_TYPE, StaticHosting, buildFhirCurrentResourceChangeDetail, getDynamoDbDataStoreTableName, getPostgresReplicaSchemaName };
1413
- export type { BuildParameterNameProps, ChildHostedZoneProps, CognitoFixtureSeederClientProps, DataStoreHistoricalArchiveProps, DataStorePostgresReplicaProps, DiscoverableStringParameterProps, DynamoDbDataStoreProps, FhirCurrentResourceChangeDetail, OpenHiAppProps, OpenHiAuthServiceProps, OpenHiDataServiceProps, OpenHiEnvironmentProps, OpenHiGlobalServiceProps, OpenHiGraphqlServiceProps, OpenHiRestApiServiceProps, OpenHiServiceProps, OpenHiServiceType, OpenHiStageProps, PostConfirmationLambdaProps, PreTokenGenerationLambdaProps, RootGraphqlApiProps, RootHttpApiProps, StaticHostingProps };
1502
+ export { ChildHostedZone, CognitoFixtureSeederClient, CognitoUserPool, CognitoUserPoolClient, CognitoUserPoolDomain, CognitoUserPoolKmsKey, ControlEventBus, DATA_STORE_CHANGE_DETAIL_MAX_UTF8_BYTES, DATA_STORE_CHANGE_DETAIL_TYPE, DATA_STORE_CHANGE_EVENT_SOURCE, DataEventBus, DataStoreHistoricalArchive, DataStorePostgresReplica, DiscoverableStringParameter, DynamoDbDataStore, OpenHiApp, OpenHiAuthService, OpenHiDataService, OpenHiEnvironment, OpenHiGlobalService, OpenHiGraphqlService, OpenHiRestApiService, OpenHiService, OpenHiStage, OpsEventBus, POSTGRES_REPLICA_CLUSTER_ARN_SSM_NAME, POSTGRES_REPLICA_DATABASE_NAME_SSM_NAME, POSTGRES_REPLICA_SECRET_ARN_SSM_NAME, PROVISION_DEFAULT_WORKSPACE_DETAIL_TYPE, PostAuthenticationLambda, PostConfirmationLambda, PreTokenGenerationLambda, ProvisionDefaultWorkspaceLambda, REST_API_BASE_URL_SSM_NAME, RootGraphqlApi, RootHostedZone, RootHttpApi, RootWildcardCertificate, STATIC_HOSTING_SERVICE_TYPE, StaticHosting, USER_ONBOARDING_EVENT_SOURCE, UserOnboardingWorkflow, buildFhirCurrentResourceChangeDetail, buildProvisionDefaultWorkspaceRequestedDetail, getDynamoDbDataStoreTableName, getPostgresReplicaSchemaName };
1503
+ export type { BuildParameterNameProps, ChildHostedZoneProps, CognitoFixtureSeederClientProps, DataStoreHistoricalArchiveProps, DataStorePostgresReplicaProps, DiscoverableStringParameterProps, DynamoDbDataStoreProps, FhirCurrentResourceChangeDetail, OpenHiAppProps, OpenHiAuthServiceProps, OpenHiDataServiceProps, OpenHiEnvironmentProps, OpenHiGlobalServiceProps, OpenHiGraphqlServiceProps, OpenHiRestApiServiceProps, OpenHiServiceProps, OpenHiServiceType, OpenHiStageProps, PostConfirmationLambdaProps, PreTokenGenerationLambdaProps, ProvisionDefaultWorkspaceLambdaProps, ProvisionDefaultWorkspaceRequestedDetail, RootGraphqlApiProps, RootHttpApiProps, StaticHostingProps, UserOnboardingWorkflowProps };