@openhi/constructs 0.0.111 → 0.0.113

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 (111) hide show
  1. package/lib/chunk-23PUSHBV.mjs +24 -0
  2. package/lib/chunk-23PUSHBV.mjs.map +1 -0
  3. package/lib/{chunk-7FUAMZOF.mjs → chunk-53OHXLIL.mjs} +3 -3
  4. package/lib/chunk-6NBGYGFL.mjs +1803 -0
  5. package/lib/chunk-6NBGYGFL.mjs.map +1 -0
  6. package/lib/chunk-7RZHFI77.mjs +22 -0
  7. package/lib/chunk-7RZHFI77.mjs.map +1 -0
  8. package/lib/{chunk-7Q2IJ2J5.mjs → chunk-CUUKXDB2.mjs} +6 -6
  9. package/lib/chunk-FYHBHHWK.mjs +47 -0
  10. package/lib/chunk-FYHBHHWK.mjs.map +1 -0
  11. package/lib/{chunk-MULKGFIJ.mjs → chunk-GBDIGTNV.mjs} +165 -10
  12. package/lib/chunk-GBDIGTNV.mjs.map +1 -0
  13. package/lib/chunk-HQ67J7BP.mjs +199 -0
  14. package/lib/chunk-HQ67J7BP.mjs.map +1 -0
  15. package/lib/{chunk-AJ3G3THO.mjs → chunk-KO64HPWQ.mjs} +2 -2
  16. package/lib/{chunk-BB5MK4L3.mjs → chunk-KSFC72TT.mjs} +3 -3
  17. package/lib/{chunk-2TPJ6HOF.mjs → chunk-NZRW7ROK.mjs} +72 -54
  18. package/lib/chunk-NZRW7ROK.mjs.map +1 -0
  19. package/lib/chunk-QJDHVMKT.mjs +117 -0
  20. package/lib/chunk-QJDHVMKT.mjs.map +1 -0
  21. package/lib/{chunk-IS4VQRI4.mjs → chunk-QMBJ4VHC.mjs} +12 -47
  22. package/lib/chunk-QMBJ4VHC.mjs.map +1 -0
  23. package/lib/chunk-TRY7JGWO.mjs +16 -0
  24. package/lib/chunk-TRY7JGWO.mjs.map +1 -0
  25. package/lib/chunk-W4KR4CSL.mjs +236 -0
  26. package/lib/chunk-W4KR4CSL.mjs.map +1 -0
  27. package/lib/{chunk-AGF3RAAZ.mjs → chunk-WPCBVDFZ.mjs} +2 -2
  28. package/lib/chunk-WQWFVEVX.mjs +66 -0
  29. package/lib/chunk-WQWFVEVX.mjs.map +1 -0
  30. package/lib/{chunk-SYBADQXI.mjs → chunk-ZM4GDHHC.mjs} +77 -2
  31. package/lib/chunk-ZM4GDHHC.mjs.map +1 -0
  32. package/lib/delete-chunk.handler.d.mts +29 -0
  33. package/lib/delete-chunk.handler.d.ts +29 -0
  34. package/lib/delete-chunk.handler.js +2716 -0
  35. package/lib/delete-chunk.handler.js.map +1 -0
  36. package/lib/delete-chunk.handler.mjs +47 -0
  37. package/lib/delete-chunk.handler.mjs.map +1 -0
  38. package/lib/events-CjS-sm0W.d.mts +107 -0
  39. package/lib/events-CjS-sm0W.d.ts +107 -0
  40. package/lib/events-Da_cFgtc.d.mts +208 -0
  41. package/lib/events-Da_cFgtc.d.ts +208 -0
  42. package/lib/finalize.handler.d.mts +35 -0
  43. package/lib/finalize.handler.d.ts +35 -0
  44. package/lib/finalize.handler.js +875 -0
  45. package/lib/finalize.handler.js.map +1 -0
  46. package/lib/finalize.handler.mjs +166 -0
  47. package/lib/finalize.handler.mjs.map +1 -0
  48. package/lib/index.d.mts +189 -2
  49. package/lib/index.d.ts +500 -3
  50. package/lib/index.js +1753 -174
  51. package/lib/index.js.map +1 -1
  52. package/lib/index.mjs +571 -17
  53. package/lib/index.mjs.map +1 -1
  54. package/lib/list-chunks.handler.d.mts +28 -0
  55. package/lib/list-chunks.handler.d.ts +28 -0
  56. package/lib/list-chunks.handler.js +2746 -0
  57. package/lib/list-chunks.handler.js.map +1 -0
  58. package/lib/list-chunks.handler.mjs +54 -0
  59. package/lib/list-chunks.handler.mjs.map +1 -0
  60. package/lib/platform-deploy-bridge.handler.js +76 -1
  61. package/lib/platform-deploy-bridge.handler.js.map +1 -1
  62. package/lib/platform-deploy-bridge.handler.mjs +1 -1
  63. package/lib/pre-token-generation.handler.js +1106 -155
  64. package/lib/pre-token-generation.handler.js.map +1 -1
  65. package/lib/pre-token-generation.handler.mjs +6 -4
  66. package/lib/pre-token-generation.handler.mjs.map +1 -1
  67. package/lib/provision-default-workspace.handler.js +1529 -142
  68. package/lib/provision-default-workspace.handler.js.map +1 -1
  69. package/lib/provision-default-workspace.handler.mjs +8 -4
  70. package/lib/provision-default-workspace.handler.mjs.map +1 -1
  71. package/lib/rename-finalize.handler.d.mts +30 -0
  72. package/lib/rename-finalize.handler.d.ts +30 -0
  73. package/lib/rename-finalize.handler.js +795 -0
  74. package/lib/rename-finalize.handler.js.map +1 -0
  75. package/lib/rename-finalize.handler.mjs +90 -0
  76. package/lib/rename-finalize.handler.mjs.map +1 -0
  77. package/lib/rename-list-targets.handler.d.mts +26 -0
  78. package/lib/rename-list-targets.handler.d.ts +26 -0
  79. package/lib/rename-list-targets.handler.js +2985 -0
  80. package/lib/rename-list-targets.handler.js.map +1 -0
  81. package/lib/rename-list-targets.handler.mjs +431 -0
  82. package/lib/rename-list-targets.handler.mjs.map +1 -0
  83. package/lib/rename-rewrite-chunk.handler.d.mts +35 -0
  84. package/lib/rename-rewrite-chunk.handler.d.ts +35 -0
  85. package/lib/rename-rewrite-chunk.handler.js +2021 -0
  86. package/lib/rename-rewrite-chunk.handler.js.map +1 -0
  87. package/lib/rename-rewrite-chunk.handler.mjs +27 -0
  88. package/lib/rename-rewrite-chunk.handler.mjs.map +1 -0
  89. package/lib/rest-api-lambda.handler.js +4021 -932
  90. package/lib/rest-api-lambda.handler.js.map +1 -1
  91. package/lib/rest-api-lambda.handler.mjs +1786 -80
  92. package/lib/rest-api-lambda.handler.mjs.map +1 -1
  93. package/lib/seed-demo-data.handler.js +1588 -124
  94. package/lib/seed-demo-data.handler.js.map +1 -1
  95. package/lib/seed-demo-data.handler.mjs +10 -6
  96. package/lib/seed-system-data.handler.js +1179 -155
  97. package/lib/seed-system-data.handler.js.map +1 -1
  98. package/lib/seed-system-data.handler.mjs +5 -4
  99. package/lib/seed-system-data.handler.mjs.map +1 -1
  100. package/package.json +2 -2
  101. package/lib/chunk-2TPJ6HOF.mjs.map +0 -1
  102. package/lib/chunk-IS4VQRI4.mjs.map +0 -1
  103. package/lib/chunk-MULKGFIJ.mjs.map +0 -1
  104. package/lib/chunk-QR5JVSCF.mjs +0 -862
  105. package/lib/chunk-QR5JVSCF.mjs.map +0 -1
  106. package/lib/chunk-SYBADQXI.mjs.map +0 -1
  107. /package/lib/{chunk-7FUAMZOF.mjs.map → chunk-53OHXLIL.mjs.map} +0 -0
  108. /package/lib/{chunk-7Q2IJ2J5.mjs.map → chunk-CUUKXDB2.mjs.map} +0 -0
  109. /package/lib/{chunk-AJ3G3THO.mjs.map → chunk-KO64HPWQ.mjs.map} +0 -0
  110. /package/lib/{chunk-BB5MK4L3.mjs.map → chunk-KSFC72TT.mjs.map} +0 -0
  111. /package/lib/{chunk-AGF3RAAZ.mjs.map → chunk-WPCBVDFZ.mjs.map} +0 -0
package/lib/index.d.ts CHANGED
@@ -20,9 +20,11 @@ import * as rds from 'aws-cdk-lib/aws-rds';
20
20
  import { HostedZone, HostedZoneProps, IHostedZone, HostedZoneAttributes } from 'aws-cdk-lib/aws-route53';
21
21
  import { StringParameterProps, StringParameter } from 'aws-cdk-lib/aws-ssm';
22
22
  import { Distribution, DistributionProps } from 'aws-cdk-lib/aws-cloudfront';
23
+ import { StateMachine } from 'aws-cdk-lib/aws-stepfunctions';
24
+ import { RenamableEntityType } from '@openhi/workflows';
25
+ export { ControlPlaneOwningDeleteCompleteV1, ControlPlaneOwningDeleteCompleteV1Detail, ControlPlaneOwningDeleteFailedV1, ControlPlaneOwningDeleteFailedV1Detail, ControlPlaneOwningDeleteV1, ControlPlaneOwningDeleteV1Detail, ControlPlaneRenameCompleteV1, ControlPlaneRenameCompleteV1Detail, ControlPlaneRenameFailedV1, ControlPlaneRenameFailedV1Detail, ControlPlaneRenameV1, ControlPlaneRenameV1Detail, OPENHI_DATA_SOURCE, OPENHI_OPS_SOURCE, OWNING_ENTITY_TYPE, OwningEntityType, PlatformDeploymentCompletedV1, PlatformSystemDataSeededV1, RENAMABLE_ENTITY_TYPE, RenamableEntityType } from '@openhi/workflows';
23
26
  import { PlatformRoleCode } from '@openhi/types';
24
27
  import { PostConfirmationTriggerEvent } from 'aws-lambda';
25
- export { PlatformDeploymentCompletedV1, PlatformSystemDataSeededV1 } from '@openhi/workflows';
26
28
 
27
29
  /*******************************************************************************
28
30
  *
@@ -121,6 +123,112 @@ interface DynamoDbStreamKinesisRecord {
121
123
  };
122
124
  }
123
125
 
126
+ /**
127
+ * @see sites/www-docs/content/packages/@openhi/constructs/workflows/control-plane/owning-delete-cascade/events.md
128
+ *
129
+ * Shared event-shape constants for the TR-022 owning-entity hard-delete
130
+ * cascade. The cascade's input detail-type (on the data event bus) and
131
+ * its two terminal detail-types (on the ops event bus) are owned by
132
+ * `@openhi/workflows`; this module re-imports them so the workflow
133
+ * construct can wire the EventBridge rule and the terminal publisher
134
+ * from a single place.
135
+ */
136
+
137
+ /**
138
+ * Stable logical name registered with the shared `WorkflowDedupTable`
139
+ * (TR-015). The state machine's `DedupCheck` state writes a row keyed
140
+ * by `(consumerName, eventId, attempt)` to absorb EventBridge retries.
141
+ */
142
+ declare const OWNING_DELETE_CASCADE_CONSUMER_NAME: "owning-delete-cascade";
143
+ /**
144
+ * Map-state max concurrency. Per the ADR-018 implementation guide
145
+ * section 4: inline Map (NOT Distributed Map — that lives on TR-023's
146
+ * rename cascade), tunable via the construct's `cascadeMapConcurrency`
147
+ * prop. Operators may scale this down on first rollout.
148
+ */
149
+ declare const OWNING_DELETE_CASCADE_DEFAULT_CONCURRENCY: 8;
150
+ /**
151
+ * Stuck-cascade alarm threshold. Per the implementation guide section
152
+ * 4 "Observability" — operator-tunable via
153
+ * `stuckCascadeThresholdMinutes` on the construct prop.
154
+ */
155
+ declare const OWNING_DELETE_CASCADE_STUCK_THRESHOLD_MINUTES: 15;
156
+ /**
157
+ * Inputs each cascade Map iteration receives. The state machine
158
+ * builds one of these per chunk and passes them in via `ItemsPath`.
159
+ * The handler then issues a single `TransactWriteItems` for the
160
+ * entire chunk.
161
+ */
162
+ interface CascadeChunkInput {
163
+ /** Owner identity carried through every step for observability. */
164
+ readonly ownerType: "Workspace" | "User";
165
+ readonly ownerId: string;
166
+ readonly tenantId?: string;
167
+ /** Rows to delete in this chunk. Length must be 1..100. */
168
+ readonly rows: ReadonlyArray<{
169
+ readonly entity: string;
170
+ readonly key: Record<string, string>;
171
+ }>;
172
+ /**
173
+ * Idempotency token uniquely identifying this chunk within the
174
+ * cascade execution. Forwarded to `executeMultiWrite` so replayed
175
+ * chunks land idempotently (per AWS SDK `ClientRequestToken`).
176
+ */
177
+ readonly chunkToken: string;
178
+ }
179
+ /** Inputs the cascade list-and-chunk step receives. */
180
+ interface CascadeListInput {
181
+ readonly ownerType: "Workspace" | "User";
182
+ readonly ownerId: string;
183
+ readonly tenantId?: string;
184
+ /** Per-entity cursor map from the previous page (start of run is `{}`). */
185
+ readonly cursors?: Record<string, string | null>;
186
+ /**
187
+ * Cumulative `projectionsRemoved` count carried forward across
188
+ * pages — emitted on the terminal `complete` event.
189
+ */
190
+ readonly projectionsRemoved?: number;
191
+ /** Cumulative `chunkCount` carried forward across pages. */
192
+ readonly chunkCount?: number;
193
+ }
194
+ /** Outputs the cascade list-and-chunk step emits to feed the Map state. */
195
+ interface CascadeListOutput {
196
+ readonly ownerType: "Workspace" | "User";
197
+ readonly ownerId: string;
198
+ readonly tenantId?: string;
199
+ readonly cursors: Record<string, string | null>;
200
+ readonly chunks: ReadonlyArray<CascadeChunkInput>;
201
+ readonly exhausted: boolean;
202
+ readonly projectionsRemoved: number;
203
+ readonly chunkCount: number;
204
+ }
205
+ /** Inputs the cascade finalize step receives. */
206
+ interface CascadeFinalizeInput {
207
+ readonly ownerType: "Workspace" | "User";
208
+ readonly ownerId: string;
209
+ readonly tenantId?: string;
210
+ readonly projectionsRemoved: number;
211
+ readonly chunkCount: number;
212
+ readonly startedAt: string;
213
+ /** Optional eventId / correlation carried through the run for ADR-016 envelope. */
214
+ readonly eventId?: string;
215
+ readonly correlationId?: string;
216
+ readonly causationId?: string;
217
+ }
218
+ /** Outputs the cascade finalize step emits (used by tests and telemetry). */
219
+ interface CascadeFinalizeOutput {
220
+ readonly ownerType: "Workspace" | "User";
221
+ readonly ownerId: string;
222
+ readonly tenantId?: string;
223
+ readonly projectionsRemoved: number;
224
+ readonly chunkCount: number;
225
+ readonly durationMs: number;
226
+ readonly completedAt: string;
227
+ readonly canonicalDeleted: boolean;
228
+ }
229
+ /** Env var the construct uses to inject the ops event bus name into the finalize Lambda. */
230
+ declare const OWNING_DELETE_OPS_EVENT_BUS_ENV_VAR: "OWNING_DELETE_OPS_EVENT_BUS_NAME";
231
+
124
232
  /**
125
233
  * @see sites/www-docs/content/packages/@openhi/constructs/workflows/control-plane/platform-deploy-bridge/index.md
126
234
  */
@@ -164,6 +272,211 @@ interface CloudFormationStackStatusChangeDetail {
164
272
  readonly "client-request-token"?: string;
165
273
  }
166
274
 
275
+ /**
276
+ * Enumerate projection rows affected by a Tenant / User / Role rename
277
+ * for the TR-023 rename cascade.
278
+ *
279
+ * One page per call; the cascade state machine outer loop walks the
280
+ * returned `cursors` map back into this operation until every per-entity
281
+ * stream returns `null`. Each emitted row carries:
282
+ *
283
+ * - the projection-entity name (so the rewrite-chunk operation can map
284
+ * it to the correct ElectroDB entity in `executeMultiWrite`),
285
+ * - the **existing** composite key (used for the `delete` triple in the
286
+ * transact-write pair),
287
+ * - the **new** composite key (used for the `put` triple — same row
288
+ * identity but a rewritten SK when the SK encodes the renamed
289
+ * normalized name), and
290
+ * - the row's existing attributes (carried verbatim into the `put` so
291
+ * `summary`, `vid`, `lastUpdated`, etc. are preserved across the
292
+ * rewrite), with the renamed `denormalized<CarrierEntity>Name`
293
+ * replaced by the new display name.
294
+ *
295
+ * Per-entityType query plan (per the ADR-018 implementation guide § 5):
296
+ *
297
+ * - **User rename**: under `PK = USER#ID#<userId>` — Membership user-
298
+ * projection rows (patterns #3 + #4) and RoleAssignment user-projection
299
+ * rows (pattern #5). Workspace-side projection rows
300
+ * (membershipWorkspaceProjection #2 + roleAssignmentWorkspaceProjection
301
+ * #9) encode `<normalizedUserName>` in their SK; this operation
302
+ * discovers the affected workspaces from the user's pattern-#4
303
+ * memberships and queries each workspace partition for them.
304
+ * - **Role rename**: under every affected user partition — RoleAssignment
305
+ * user-projection rows (pattern #5) sort on `<normalizedRoleName>` and
306
+ * need a SK rewrite. RoleAssignment canonical (pattern #8) and
307
+ * workspace-projection (pattern #9) sort on raw `<roleId>` so only the
308
+ * denormalized attr changes (no SK rewrite). The affected user-ids
309
+ * are discovered via the canonical RoleAssignment GSI1 (`<roleId>#`
310
+ * prefix).
311
+ * - **Tenant rename**: only `denormalizedTenantName` updates — SKs do
312
+ * not carry tenant-name; the row identity is preserved. Affected user-
313
+ * ids are discovered via the canonical Membership GSI1 page.
314
+ *
315
+ * For #1023 the User-rename path is implemented in full; the Tenant /
316
+ * Role discovery hooks are scaffolded with the right query shape and
317
+ * cursor map but only walk one canonical discovery batch per call (the
318
+ * cascade outer loop pages through them). See § 5 of the implementation
319
+ * guide for the full matrix.
320
+ *
321
+ * @see .state/adr-018-implementation-guide.md § 5 (TR-023 Rename-Cascade Consumer Contract)
322
+ * @see .claude/rules/data-layer-layout.md
323
+ */
324
+
325
+ /**
326
+ * Projection-entity name keys this operation may emit. Each key maps to
327
+ * an entity in the control-plane service; the rewrite-chunk consumer
328
+ * forwards it to `executeMultiWrite` as the `entity` field on a triple.
329
+ */
330
+ declare const RENAME_CASCADE_PROJECTION_ENTITY: {
331
+ readonly MembershipUserProjection: "membershipUserProjection";
332
+ readonly MembershipWorkspaceProjection: "membershipWorkspaceProjection";
333
+ readonly RoleAssignmentUserProjection: "roleAssignmentUserProjection";
334
+ readonly RoleAssignmentWorkspaceProjection: "roleAssignmentWorkspaceProjection";
335
+ };
336
+ type RenameCascadeProjectionEntity = (typeof RENAME_CASCADE_PROJECTION_ENTITY)[keyof typeof RENAME_CASCADE_PROJECTION_ENTITY];
337
+ /**
338
+ * One row to rewrite — the cascade rewrite-chunk operation turns each
339
+ * entry into a `delete oldKey` + `put newPayload` transact-write pair.
340
+ *
341
+ * `oldKey` and `newKey` differ only in the SK segment when the SK
342
+ * encodes a normalized form of the renamed name. For Tenant rename and
343
+ * for SK-stable RoleAssignment projections (canonical pattern #8 and
344
+ * workspace pattern #9 under a Role rename), `oldKey === newKey` and
345
+ * the rewrite collapses to a single `put` overwrite.
346
+ */
347
+ interface RenameCascadeRewriteTarget {
348
+ readonly entity: RenameCascadeProjectionEntity;
349
+ /** Composite key payload for the existing row. */
350
+ readonly oldKey: Record<string, string>;
351
+ /** Composite key payload for the rewritten row. */
352
+ readonly newKey: Record<string, string>;
353
+ /**
354
+ * Full row payload to write at `newKey` — carries the existing
355
+ * `summary`, `vid`, `lastUpdated`, and discriminating fields, with
356
+ * the renamed `denormalized<CarrierEntity>Name` swapped to the new
357
+ * display name.
358
+ */
359
+ readonly newItem: Record<string, unknown>;
360
+ /**
361
+ * `true` when `oldKey` and `newKey` differ — the rewrite must atomic
362
+ * delete the old row and put the new row in the same transaction.
363
+ * `false` when only the denormalized attr changes — a single `put`
364
+ * overwrite is sufficient.
365
+ */
366
+ readonly skRewriteRequired: boolean;
367
+ }
368
+
369
+ /**
370
+ * Shared event-shape constants for the TR-023 rename-cascade consumer.
371
+ * The cascade's input detail-type (on the data event bus) and its two
372
+ * terminal detail-types (on the ops event bus) are owned by
373
+ * `@openhi/workflows`; this module re-imports them so the workflow
374
+ * construct can wire the EventBridge rule and the terminal publisher
375
+ * from a single place.
376
+ *
377
+ * @see .state/adr-018-implementation-guide.md section 5
378
+ */
379
+
380
+ /**
381
+ * Stable logical name registered with the shared `WorkflowDedupTable`
382
+ * (TR-015). The state machine's `DedupCheck` state writes a row keyed
383
+ * by `(consumerName, eventId, attempt)` to absorb EventBridge retries.
384
+ */
385
+ declare const RENAME_CASCADE_CONSUMER_NAME: "rename-cascade";
386
+ /**
387
+ * Distributed-Map max concurrency. Per the ADR-018 implementation guide
388
+ * section 5: Distributed Map (NOT inline — TR-022 owning-delete uses
389
+ * inline), tunable via the construct's `cascadeMapConcurrency` prop.
390
+ * Operators may scale this down on first rollout.
391
+ */
392
+ declare const RENAME_CASCADE_DEFAULT_CONCURRENCY: 10;
393
+ /**
394
+ * `CascadeFailed` alarm threshold — fires when ExecutionsFailed exceeds
395
+ * the value over the configured period. Per the implementation guide
396
+ * section 5 "Alarm thresholds" table.
397
+ */
398
+ declare const RENAME_CASCADE_FAILED_THRESHOLD: 0;
399
+ /**
400
+ * `CascadeSlow` alarm threshold (in seconds) — fires when ExecutionTime
401
+ * p99 exceeds the value. Per the implementation guide section 5.
402
+ */
403
+ declare const RENAME_CASCADE_SLOW_THRESHOLD_SECONDS: 300;
404
+ /**
405
+ * Inputs the cascade list-targets step receives. Most fields come
406
+ * straight off the `ControlPlaneRenameV1` envelope payload; `cursors`
407
+ * threads through the outer loop.
408
+ */
409
+ interface RenameCascadeListInput {
410
+ readonly entityType: RenamableEntityType;
411
+ readonly entityId: string;
412
+ readonly tenantId?: string;
413
+ readonly oldName: string;
414
+ readonly newName: string;
415
+ readonly oldNormalizedName: string;
416
+ readonly newNormalizedName: string;
417
+ readonly cursors?: Record<string, string | null>;
418
+ /** Cumulative `itemsRewritten` carried forward across pages. */
419
+ readonly itemsRewritten?: number;
420
+ /** Cumulative `chunkCount` carried forward across pages. */
421
+ readonly chunkCount?: number;
422
+ }
423
+ /** Inputs the cascade rewrite-chunk step receives — one chunk per Map iteration. */
424
+ interface RenameCascadeChunkInput {
425
+ readonly entityType: RenamableEntityType;
426
+ readonly entityId: string;
427
+ readonly tenantId?: string;
428
+ /** Targets to rewrite in this transaction. Length must be 1..50. */
429
+ readonly targets: ReadonlyArray<RenameCascadeRewriteTarget>;
430
+ /**
431
+ * Idempotency token uniquely identifying this chunk within the
432
+ * cascade execution. Forwarded to `executeMultiWrite` so replayed
433
+ * chunks land idempotently.
434
+ */
435
+ readonly chunkToken: string;
436
+ }
437
+ /** Outputs the cascade list-targets step emits to feed the Distributed Map state. */
438
+ interface RenameCascadeListOutput {
439
+ readonly entityType: RenamableEntityType;
440
+ readonly entityId: string;
441
+ readonly tenantId?: string;
442
+ readonly oldName: string;
443
+ readonly newName: string;
444
+ readonly oldNormalizedName: string;
445
+ readonly newNormalizedName: string;
446
+ readonly cursors: Record<string, string | null>;
447
+ readonly chunks: ReadonlyArray<RenameCascadeChunkInput>;
448
+ readonly exhausted: boolean;
449
+ readonly itemsRewritten: number;
450
+ readonly chunkCount: number;
451
+ }
452
+ /** Inputs the cascade finalize step receives. */
453
+ interface RenameCascadeFinalizeInput {
454
+ readonly entityType: RenamableEntityType;
455
+ readonly entityId: string;
456
+ readonly tenantId?: string;
457
+ readonly newName: string;
458
+ readonly itemsRewritten: number;
459
+ readonly chunkCount: number;
460
+ readonly startedAt: string;
461
+ /** Optional eventId / correlation for ADR-016 envelope chaining. */
462
+ readonly eventId?: string;
463
+ readonly correlationId?: string;
464
+ readonly causationId?: string;
465
+ }
466
+ /** Outputs the cascade finalize step emits (used by tests + telemetry). */
467
+ interface RenameCascadeFinalizeOutput {
468
+ readonly entityType: RenamableEntityType;
469
+ readonly entityId: string;
470
+ readonly tenantId?: string;
471
+ readonly newName: string;
472
+ readonly itemsRewritten: number;
473
+ readonly chunkCount: number;
474
+ readonly durationMs: number;
475
+ readonly completedAt: string;
476
+ }
477
+ /** Env var the construct uses to inject the ops event bus name into the finalize Lambda. */
478
+ declare const RENAME_CASCADE_OPS_EVENT_BUS_ENV_VAR: "RENAME_CASCADE_OPS_EVENT_BUS_NAME";
479
+
167
480
  /**
168
481
  * @see sites/www-docs/content/packages/@openhi/constructs/workflows/control-plane/seed-demo-data/events.md
169
482
  */
@@ -2152,5 +2465,189 @@ declare class OpenHiGraphqlService extends OpenHiService {
2152
2465
  protected createRootGraphqlApi(): RootGraphqlApi;
2153
2466
  }
2154
2467
 
2155
- export { BRIDGED_STATUSES, CLOUDFORMATION_EVENT_SOURCE, CLOUDFORMATION_STACK_STATUS_CHANGE_DETAIL_TYPE, CONTROL_EVENT_BUS_NAME_ENV_VAR, ChildHostedZone, CognitoFixtureSeederClient, CognitoUserPool, CognitoUserPoolClient, CognitoUserPoolDomain, CognitoUserPoolKmsKey, ControlEventBus, DATA_STORE_CHANGE_DETAIL_MAX_UTF8_BYTES, DATA_STORE_CHANGE_DETAIL_TYPE, DATA_STORE_CHANGE_EVENT_SOURCE, DEMO_PERIOD, DEMO_TENANT_SPECS, DEMO_URN_SYSTEM, DEV_USERS, DataEventBus, DataStoreHistoricalArchive, DataStorePostgresReplica, DiscoverableStringParameter, DynamoDbDataStore, OPENHI_REPO_TAG_KEY_ENV_VAR, OPENHI_RESOURCE_URN_SYSTEM, OPENHI_TAG_KEY_PREFIX_ENV_VAR, OPENHI_TAG_SUFFIX_BRANCH_NAME, OPENHI_TAG_SUFFIX_REPO_NAME, OPENHI_TAG_SUFFIX_SERVICE_TYPE, OPENHI_TAG_SUFFIX_STAGE_TYPE, OpenHiApp, OpenHiAuthService, OpenHiDataService, OpenHiEnvironment, OpenHiGlobalService, OpenHiGraphqlService, OpenHiRestApiService, OpenHiService, OpenHiStage, OpsEventBus, PLACEHOLDER_TENANT_ID, PLACEHOLDER_WORKSPACE_ID, PLATFORM_DEPLOY_BRIDGE_ACTOR_SYSTEM, PLATFORM_SCOPE_TENANT_ID, POSTGRES_REPLICA_CLUSTER_ARN_SSM_NAME, POSTGRES_REPLICA_DATABASE_NAME_SSM_NAME, POSTGRES_REPLICA_SECRET_ARN_SSM_NAME, PROVISION_DEFAULT_WORKSPACE_DETAIL_TYPE, PlatformDeployBridge, PlatformDeployBridgeLambda, PostAuthenticationLambda, PostConfirmationLambda, PreTokenGenerationLambda, ProvisionDefaultWorkspaceLambda, REST_API_BASE_URL_SSM_NAME, RootGraphqlApi, RootHostedZone, RootHttpApi, RootWildcardCertificate, SEED_DEMO_DATA_CONSUMER_NAME, SEED_SYSTEM_DATA_ACTOR_SYSTEM, SEED_SYSTEM_DATA_CONSUMER_NAME, SEED_SYSTEM_DATA_CONTROL_BUS_ENV_VAR, STATIC_HOSTING_SERVICE_TYPE, SeedDemoDataLambda, SeedDemoDataWorkflow, SeedSystemDataLambda, SeedSystemDataWorkflow, StaticHosting, USER_ONBOARDING_EVENT_SOURCE, UserOnboardingWorkflow, WorkflowDedupConsumerNameInvalidError, WorkflowDedupTable, WorkflowDedupTableDuplicateError, buildFhirCurrentResourceChangeDetail, buildProvisionDefaultWorkspaceRequestedDetail, demoBasePartitionKeys, demoDevUserPartitionKeys, demoMembershipId, demoMembershipPartitionKey, demoRoleAssignmentId, demoRoleAssignmentPartitionKey, demoRolesForUserInTenant, demoScenarioIdentifier, demoTenantPartitionKey, demoUserPartitionKey, demoWorkspacePartitionKey, getDynamoDbDataStoreTableName, getPostgresReplicaSchemaName, getWorkflowDedupTableName, openHiTagKey, openhiResourceIdentifier, rolePartitionKey };
2156
- export type { BridgedStatus, BuildParameterNameProps, ChildHostedZoneProps, CloudFormationStackStatusChangeDetail, CognitoFixtureSeederClientProps, DataStoreHistoricalArchiveProps, DataStorePostgresReplicaProps, DemoDevUser, DemoTenantSpec, DemoWorkspaceSpec, DiscoverableStringParameterProps, DynamoDbDataStoreProps, FhirCurrentResourceChangeDetail, GrantConsumerOptions, OpenHiAppProps, OpenHiAuthServiceProps, OpenHiDataServiceProps, OpenHiEnvironmentProps, OpenHiGlobalServiceProps, OpenHiGraphqlServiceProps, OpenHiRestApiServiceProps, OpenHiServiceProps, OpenHiServiceType, OpenHiStageProps, PlatformDeployBridgeLambdaProps, PlatformDeployBridgeProps, PostConfirmationLambdaProps, PreTokenGenerationLambdaProps, ProvisionDefaultWorkspaceLambdaProps, ProvisionDefaultWorkspaceRequestedDetail, RootGraphqlApiProps, RootHttpApiProps, SeedDemoDataLambdaProps, SeedDemoDataWorkflowProps, SeedSystemDataLambdaProps, SeedSystemDataWorkflowProps, StaticHostingProps, UserOnboardingWorkflowProps, WorkflowDedupTableProps };
2468
+ interface OwningDeleteCascadeLambdasProps {
2469
+ /** Data-store table the cascade reads (Query) and writes (DeleteItem / TransactWriteItems) against. */
2470
+ readonly dataStoreTable: ITable;
2471
+ /** Ops event bus the cascade finalize step publishes terminal events onto. */
2472
+ readonly opsEventBus: IEventBus;
2473
+ }
2474
+ /**
2475
+ * The three Lambdas that power the TR-022 owning-entity hard-delete
2476
+ * cascade state machine. Bundled together because the state machine
2477
+ * wires them in a fixed topology and they share the same data-store
2478
+ * grant pattern.
2479
+ *
2480
+ * - `listChunks` — pages through the owner's adjacency-list partition
2481
+ * via ElectroDB Query, splits the page into <=100-item chunks for
2482
+ * the inline Map state.
2483
+ * - `deleteChunk` — Map-iteration handler; submits one chunk as a
2484
+ * single `TransactWriteItems` via `executeMultiWrite`. The state
2485
+ * machine's `MaxConcurrency = 8` runs up to eight of these in
2486
+ * parallel.
2487
+ * - `finalize` — deletes the owning canonical record at
2488
+ * `SK = "CURRENT"` conditional on `lifecycleState = "deleting"`,
2489
+ * then emits the `control-plane.owning-delete-complete.v1` terminal
2490
+ * event on the ops event bus.
2491
+ *
2492
+ * IAM grants are scoped per-Lambda: the read/write Lambdas get
2493
+ * table-level Query / TransactWriteItems on the data store; the
2494
+ * finalize Lambda gets a focused `DeleteItem` + `PutEvents` policy
2495
+ * (no Query, no broad writes).
2496
+ */
2497
+ declare class OwningDeleteCascadeLambdas extends Construct {
2498
+ readonly listChunks: NodejsFunction;
2499
+ readonly deleteChunk: NodejsFunction;
2500
+ readonly finalize: NodejsFunction;
2501
+ constructor(scope: Construct, props: OwningDeleteCascadeLambdasProps);
2502
+ }
2503
+
2504
+ /**
2505
+ * @see sites/www-docs/content/packages/@openhi/constructs/workflows/control-plane/owning-delete-cascade/owning-delete-cascade-workflow.md
2506
+ */
2507
+ interface OwningDeleteCascadeWorkflowProps {
2508
+ /**
2509
+ * Data event bus carrying `control-plane.owning-delete.v1`. The
2510
+ * workflow's EventBridge rule lives on this bus and starts a state
2511
+ * machine execution per matching event.
2512
+ */
2513
+ readonly dataEventBus: IEventBus;
2514
+ /** Ops event bus the cascade finalize step publishes terminal events onto. */
2515
+ readonly opsEventBus: IEventBus;
2516
+ /** Data-store table the cascade reads from / writes deletes into. */
2517
+ readonly dataStoreTable: ITable;
2518
+ /**
2519
+ * Inline-Map max concurrency. Defaults to
2520
+ * {@link OWNING_DELETE_CASCADE_DEFAULT_CONCURRENCY} (8) per the
2521
+ * ADR-018 implementation guide section 4 — tunable per environment.
2522
+ * NOTE: this is an **inline** Map (NOT Distributed Map — TR-022
2523
+ * Choice 2A pins inline; TR-023 uses Distributed for renames).
2524
+ */
2525
+ readonly cascadeMapConcurrency?: number;
2526
+ }
2527
+ /**
2528
+ * Control-plane workflow that fans out the TR-022 owning-entity
2529
+ * hard-delete cascade.
2530
+ *
2531
+ * Pipeline (per the ADR-018 implementation guide section 4):
2532
+ *
2533
+ * 1. Synchronous API entry point flips the canonical owning record's
2534
+ * `lifecycleState: active -> deleting`. (Owned by the REST adapter,
2535
+ * not this construct.)
2536
+ * 2. DynamoDB stream / Firehose transform publishes
2537
+ * `control-plane.owning-delete.v1` on the data event bus.
2538
+ * 3. EventBridge rule (owned here) starts this state machine.
2539
+ * 4. State machine outer loop:
2540
+ * - `ListChunks` Lambda pages through the owner's adjacency-list
2541
+ * partition and emits chunks of up to 100 projection rows.
2542
+ * - `RewriteChunks` inline Map (MaxConcurrency = 8) deletes each
2543
+ * chunk in parallel via `executeMultiWrite`.
2544
+ * - `IsExhausted` Choice loops back to `ListChunks` until the page
2545
+ * query returns zero items and every per-entity cursor is `null`.
2546
+ * 5. `Finalize` Lambda deletes the canonical owning record
2547
+ * (conditional on `lifecycleState = "deleting"`) and emits
2548
+ * `control-plane.owning-delete-complete.v1` on the ops event bus.
2549
+ *
2550
+ * Idempotency: every Map iteration uses a per-chunk `ClientRequestToken`,
2551
+ * and the finalize step's canonical delete is conditional on
2552
+ * `lifecycleState = "deleting"`. A replayed execution finds no rows
2553
+ * to delete, no canonical to remove, and emits no terminal event.
2554
+ */
2555
+ declare class OwningDeleteCascadeWorkflow extends Construct {
2556
+ readonly lambdas: OwningDeleteCascadeLambdas;
2557
+ readonly stateMachine: StateMachine;
2558
+ readonly rule: Rule;
2559
+ constructor(scope: Construct, props: OwningDeleteCascadeWorkflowProps);
2560
+ }
2561
+
2562
+ interface RenameCascadeLambdasProps {
2563
+ /** Data-store table the cascade reads (Query) and writes (TransactWriteItems) against. */
2564
+ readonly dataStoreTable: ITable;
2565
+ /** Ops event bus the cascade finalize step publishes terminal events onto. */
2566
+ readonly opsEventBus: IEventBus;
2567
+ }
2568
+ /**
2569
+ * The three Lambdas that power the TR-023 rename cascade state machine.
2570
+ *
2571
+ * - `listTargets` — pages through the affected projection partitions
2572
+ * for a rename and emits chunks of up to 50 rewrite targets.
2573
+ * - `rewriteChunk` — Distributed-Map iteration handler; submits one
2574
+ * chunk as a single `TransactWriteItems` via `executeMultiWrite`. The
2575
+ * state machine's `MaxConcurrency = 10` runs up to ten of these in
2576
+ * parallel.
2577
+ * - `finalize` — emits `control-plane.rename-complete.v1` on the ops
2578
+ * event bus.
2579
+ *
2580
+ * IAM grants are scoped per-Lambda: read/write Lambdas get table-level
2581
+ * Query / TransactWriteItems on the data store; the finalize Lambda
2582
+ * gets only `events:PutEvents` on the ops event bus.
2583
+ */
2584
+ declare class RenameCascadeLambdas extends Construct {
2585
+ readonly listTargets: NodejsFunction;
2586
+ readonly rewriteChunk: NodejsFunction;
2587
+ readonly finalize: NodejsFunction;
2588
+ constructor(scope: Construct, props: RenameCascadeLambdasProps);
2589
+ }
2590
+
2591
+ interface RenameCascadeWorkflowProps {
2592
+ /**
2593
+ * Data event bus carrying `control-plane.rename.v1`. The workflow's
2594
+ * EventBridge rule lives on this bus and starts a state machine
2595
+ * execution per matching event.
2596
+ */
2597
+ readonly dataEventBus: IEventBus;
2598
+ /** Ops event bus the cascade finalize step publishes terminal events onto. */
2599
+ readonly opsEventBus: IEventBus;
2600
+ /** Data-store table the cascade reads from / writes rewrites into. */
2601
+ readonly dataStoreTable: ITable;
2602
+ /**
2603
+ * Distributed-Map max concurrency. Defaults to
2604
+ * {@link RENAME_CASCADE_DEFAULT_CONCURRENCY} (10) per the ADR-018
2605
+ * implementation guide section 5 — tunable per environment.
2606
+ *
2607
+ * NOTE: this is a **Distributed** Map (NOT inline — TR-022's
2608
+ * owning-delete cascade uses inline; TR-023's rename cascade uses
2609
+ * Distributed).
2610
+ */
2611
+ readonly cascadeMapConcurrency?: number;
2612
+ }
2613
+ /**
2614
+ * Control-plane workflow that fans out the TR-023 rename cascade.
2615
+ *
2616
+ * Pipeline (per the ADR-018 implementation guide section 5):
2617
+ *
2618
+ * 1. The Firehose transform Lambda publishes
2619
+ * `control-plane.rename.v1` on the data event bus when it observes
2620
+ * a stream record showing a display-name change on a canonical
2621
+ * Tenant / User / Role row.
2622
+ * 2. EventBridge rule (owned here) starts this state machine.
2623
+ * 3. State machine outer loop:
2624
+ * - `ListTargets` Lambda pages through the affected projection
2625
+ * partitions for the renamed entity and emits chunks of up to 50
2626
+ * rewrite targets.
2627
+ * - `RewriteChunks` Distributed Map (MaxConcurrency = 10) rewrites
2628
+ * each chunk in parallel via `executeMultiWrite`. Each target
2629
+ * maps to either a `delete oldKey` + `put newItem` pair (SK
2630
+ * rewrite) or a single `put newItem` overwrite (attr-only update).
2631
+ * - `IsExhausted` Choice loops back to `ListTargets` until every
2632
+ * per-stream cursor returns `null`.
2633
+ * 4. `Finalize` Lambda emits `control-plane.rename-complete.v1` on the
2634
+ * ops event bus.
2635
+ *
2636
+ * Idempotency: every Map iteration uses a per-chunk `ClientRequestToken`,
2637
+ * and the state machine's `Catch` block absorbs
2638
+ * `DynamoDB.TransactionCanceledException` as a no-op success — a
2639
+ * replayed chunk where every row is already at the new SK fails its
2640
+ * delete-old triple and the helper rolls back; the cascade keeps
2641
+ * draining the page until the outer loop terminates on exhaustion.
2642
+ * Lost-race writes (per the TR-023 idempotency rule) are accepted —
2643
+ * the renaming write loses to a later concurrent write on the same row.
2644
+ */
2645
+ declare class RenameCascadeWorkflow extends Construct {
2646
+ readonly lambdas: RenameCascadeLambdas;
2647
+ readonly stateMachine: StateMachine;
2648
+ readonly rule: Rule;
2649
+ constructor(scope: Construct, props: RenameCascadeWorkflowProps);
2650
+ }
2651
+
2652
+ export { BRIDGED_STATUSES, CLOUDFORMATION_EVENT_SOURCE, CLOUDFORMATION_STACK_STATUS_CHANGE_DETAIL_TYPE, CONTROL_EVENT_BUS_NAME_ENV_VAR, ChildHostedZone, CognitoFixtureSeederClient, CognitoUserPool, CognitoUserPoolClient, CognitoUserPoolDomain, CognitoUserPoolKmsKey, ControlEventBus, DATA_STORE_CHANGE_DETAIL_MAX_UTF8_BYTES, DATA_STORE_CHANGE_DETAIL_TYPE, DATA_STORE_CHANGE_EVENT_SOURCE, DEMO_PERIOD, DEMO_TENANT_SPECS, DEMO_URN_SYSTEM, DEV_USERS, DataEventBus, DataStoreHistoricalArchive, DataStorePostgresReplica, DiscoverableStringParameter, DynamoDbDataStore, OPENHI_REPO_TAG_KEY_ENV_VAR, OPENHI_RESOURCE_URN_SYSTEM, OPENHI_TAG_KEY_PREFIX_ENV_VAR, OPENHI_TAG_SUFFIX_BRANCH_NAME, OPENHI_TAG_SUFFIX_REPO_NAME, OPENHI_TAG_SUFFIX_SERVICE_TYPE, OPENHI_TAG_SUFFIX_STAGE_TYPE, OWNING_DELETE_CASCADE_CONSUMER_NAME, OWNING_DELETE_CASCADE_DEFAULT_CONCURRENCY, OWNING_DELETE_CASCADE_STUCK_THRESHOLD_MINUTES, OWNING_DELETE_OPS_EVENT_BUS_ENV_VAR, OpenHiApp, OpenHiAuthService, OpenHiDataService, OpenHiEnvironment, OpenHiGlobalService, OpenHiGraphqlService, OpenHiRestApiService, OpenHiService, OpenHiStage, OpsEventBus, OwningDeleteCascadeLambdas, OwningDeleteCascadeWorkflow, PLACEHOLDER_TENANT_ID, PLACEHOLDER_WORKSPACE_ID, PLATFORM_DEPLOY_BRIDGE_ACTOR_SYSTEM, PLATFORM_SCOPE_TENANT_ID, POSTGRES_REPLICA_CLUSTER_ARN_SSM_NAME, POSTGRES_REPLICA_DATABASE_NAME_SSM_NAME, POSTGRES_REPLICA_SECRET_ARN_SSM_NAME, PROVISION_DEFAULT_WORKSPACE_DETAIL_TYPE, PlatformDeployBridge, PlatformDeployBridgeLambda, PostAuthenticationLambda, PostConfirmationLambda, PreTokenGenerationLambda, ProvisionDefaultWorkspaceLambda, RENAME_CASCADE_CONSUMER_NAME, RENAME_CASCADE_DEFAULT_CONCURRENCY, RENAME_CASCADE_FAILED_THRESHOLD, RENAME_CASCADE_OPS_EVENT_BUS_ENV_VAR, RENAME_CASCADE_SLOW_THRESHOLD_SECONDS, REST_API_BASE_URL_SSM_NAME, RenameCascadeLambdas, RenameCascadeWorkflow, RootGraphqlApi, RootHostedZone, RootHttpApi, RootWildcardCertificate, SEED_DEMO_DATA_CONSUMER_NAME, SEED_SYSTEM_DATA_ACTOR_SYSTEM, SEED_SYSTEM_DATA_CONSUMER_NAME, SEED_SYSTEM_DATA_CONTROL_BUS_ENV_VAR, STATIC_HOSTING_SERVICE_TYPE, SeedDemoDataLambda, SeedDemoDataWorkflow, SeedSystemDataLambda, SeedSystemDataWorkflow, StaticHosting, USER_ONBOARDING_EVENT_SOURCE, UserOnboardingWorkflow, WorkflowDedupConsumerNameInvalidError, WorkflowDedupTable, WorkflowDedupTableDuplicateError, buildFhirCurrentResourceChangeDetail, buildProvisionDefaultWorkspaceRequestedDetail, demoBasePartitionKeys, demoDevUserPartitionKeys, demoMembershipId, demoMembershipPartitionKey, demoRoleAssignmentId, demoRoleAssignmentPartitionKey, demoRolesForUserInTenant, demoScenarioIdentifier, demoTenantPartitionKey, demoUserPartitionKey, demoWorkspacePartitionKey, getDynamoDbDataStoreTableName, getPostgresReplicaSchemaName, getWorkflowDedupTableName, openHiTagKey, openhiResourceIdentifier, rolePartitionKey };
2653
+ export type { BridgedStatus, BuildParameterNameProps, CascadeChunkInput, CascadeFinalizeInput, CascadeFinalizeOutput, CascadeListInput, CascadeListOutput, ChildHostedZoneProps, CloudFormationStackStatusChangeDetail, CognitoFixtureSeederClientProps, DataStoreHistoricalArchiveProps, DataStorePostgresReplicaProps, DemoDevUser, DemoTenantSpec, DemoWorkspaceSpec, DiscoverableStringParameterProps, DynamoDbDataStoreProps, FhirCurrentResourceChangeDetail, GrantConsumerOptions, OpenHiAppProps, OpenHiAuthServiceProps, OpenHiDataServiceProps, OpenHiEnvironmentProps, OpenHiGlobalServiceProps, OpenHiGraphqlServiceProps, OpenHiRestApiServiceProps, OpenHiServiceProps, OpenHiServiceType, OpenHiStageProps, OwningDeleteCascadeLambdasProps, OwningDeleteCascadeWorkflowProps, PlatformDeployBridgeLambdaProps, PlatformDeployBridgeProps, PostConfirmationLambdaProps, PreTokenGenerationLambdaProps, ProvisionDefaultWorkspaceLambdaProps, ProvisionDefaultWorkspaceRequestedDetail, RenameCascadeChunkInput, RenameCascadeFinalizeInput, RenameCascadeFinalizeOutput, RenameCascadeLambdasProps, RenameCascadeListInput, RenameCascadeListOutput, RenameCascadeWorkflowProps, RootGraphqlApiProps, RootHttpApiProps, SeedDemoDataLambdaProps, SeedDemoDataWorkflowProps, SeedSystemDataLambdaProps, SeedSystemDataWorkflowProps, StaticHostingProps, UserOnboardingWorkflowProps, WorkflowDedupTableProps };