@openhi/constructs 0.0.177 → 0.0.179

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 (54) hide show
  1. package/lib/{chunk-Z4PZSLYY.mjs → chunk-3M4QTQH6.mjs} +2 -2
  2. package/lib/{chunk-JUSVETWK.mjs → chunk-4LQR32D2.mjs} +38 -40
  3. package/lib/{chunk-JUSVETWK.mjs.map → chunk-4LQR32D2.mjs.map} +1 -1
  4. package/lib/{chunk-XNUCKVSE.mjs → chunk-7GMTHOYF.mjs} +2 -2
  5. package/lib/{chunk-E2OWEBBH.mjs → chunk-DIVYB6GD.mjs} +18 -4
  6. package/lib/chunk-DIVYB6GD.mjs.map +1 -0
  7. package/lib/chunk-F2LY4TEI.mjs +272 -0
  8. package/lib/chunk-F2LY4TEI.mjs.map +1 -0
  9. package/lib/{chunk-GG2WD6TA.mjs → chunk-JJ3AQ6G5.mjs} +9 -3
  10. package/lib/{chunk-GG2WD6TA.mjs.map → chunk-JJ3AQ6G5.mjs.map} +1 -1
  11. package/lib/{chunk-EBB4RNUG.mjs → chunk-PIQISEGW.mjs} +2 -2
  12. package/lib/{chunk-FDBBTNCI.mjs → chunk-Q4KQD2NB.mjs} +117 -5
  13. package/lib/chunk-Q4KQD2NB.mjs.map +1 -0
  14. package/lib/{chunk-Y4RGUAM2.mjs → chunk-V6KLFEHC.mjs} +105 -34
  15. package/lib/chunk-V6KLFEHC.mjs.map +1 -0
  16. package/lib/chunk-VQY57NOV.mjs +60 -0
  17. package/lib/chunk-VQY57NOV.mjs.map +1 -0
  18. package/lib/counter-maintenance.handler.mjs +4 -4
  19. package/lib/counter-reconciliation.handler.js +2 -2
  20. package/lib/counter-reconciliation.handler.js.map +1 -1
  21. package/lib/counter-reconciliation.handler.mjs +9 -267
  22. package/lib/counter-reconciliation.handler.mjs.map +1 -1
  23. package/lib/index.d.mts +117 -2
  24. package/lib/index.d.ts +117 -2
  25. package/lib/index.js +6454 -6243
  26. package/lib/index.js.map +1 -1
  27. package/lib/index.mjs +106 -4
  28. package/lib/index.mjs.map +1 -1
  29. package/lib/pre-token-generation.handler.js +28 -19
  30. package/lib/pre-token-generation.handler.js.map +1 -1
  31. package/lib/pre-token-generation.handler.mjs +4 -5
  32. package/lib/pre-token-generation.handler.mjs.map +1 -1
  33. package/lib/provision-default-workspace.handler.js +22 -19
  34. package/lib/provision-default-workspace.handler.js.map +1 -1
  35. package/lib/provision-default-workspace.handler.mjs +3 -4
  36. package/lib/provision-default-workspace.handler.mjs.map +1 -1
  37. package/lib/rest-api-lambda.handler.js +400 -214
  38. package/lib/rest-api-lambda.handler.js.map +1 -1
  39. package/lib/rest-api-lambda.handler.mjs +243 -171
  40. package/lib/rest-api-lambda.handler.mjs.map +1 -1
  41. package/lib/seed-demo-data.handler.d.mts +19 -0
  42. package/lib/seed-demo-data.handler.d.ts +19 -0
  43. package/lib/seed-demo-data.handler.js +805 -159
  44. package/lib/seed-demo-data.handler.js.map +1 -1
  45. package/lib/seed-demo-data.handler.mjs +8 -4
  46. package/package.json +3 -3
  47. package/lib/chunk-6HGSR3TG.mjs +0 -123
  48. package/lib/chunk-6HGSR3TG.mjs.map +0 -1
  49. package/lib/chunk-E2OWEBBH.mjs.map +0 -1
  50. package/lib/chunk-FDBBTNCI.mjs.map +0 -1
  51. package/lib/chunk-Y4RGUAM2.mjs.map +0 -1
  52. /package/lib/{chunk-Z4PZSLYY.mjs.map → chunk-3M4QTQH6.mjs.map} +0 -0
  53. /package/lib/{chunk-XNUCKVSE.mjs.map → chunk-7GMTHOYF.mjs.map} +0 -0
  54. /package/lib/{chunk-EBB4RNUG.mjs.map → chunk-PIQISEGW.mjs.map} +0 -0
@@ -23,7 +23,7 @@ __export(pre_token_generation_handler_exports, {
23
23
  handler: () => handler
24
24
  });
25
25
  module.exports = __toCommonJS(pre_token_generation_handler_exports);
26
- var import_types6 = require("@openhi/types");
26
+ var import_types7 = require("@openhi/types");
27
27
 
28
28
  // src/data/dynamo/dynamo-control-service.ts
29
29
  var import_electrodb14 = require("electrodb");
@@ -1940,7 +1940,7 @@ function decompressResource(compressedOrRaw) {
1940
1940
  var DATA_ENTITY_SK = "CURRENT";
1941
1941
  var BATCH_GET_MAX_ATTEMPTS = 3;
1942
1942
  var BATCH_GET_BASE_BACKOFF_MS = 50;
1943
- async function batchGetWithRetry(entity, keys) {
1943
+ async function batchGetWithRetry(entity, keys, options) {
1944
1944
  if (keys.length === 0) return [];
1945
1945
  const collected = [];
1946
1946
  let pending = keys;
@@ -1952,7 +1952,7 @@ async function batchGetWithRetry(entity, keys) {
1952
1952
  );
1953
1953
  }
1954
1954
  attempt++;
1955
- const result = await entity.get(pending).go();
1955
+ const result = await entity.get(pending).go(options?.consistent ? { consistent: true } : void 0);
1956
1956
  collected.push(...result.data);
1957
1957
  const unprocessed = result.unprocessed ?? [];
1958
1958
  if (unprocessed.length === 0) break;
@@ -2085,9 +2085,15 @@ async function listRoleAssignmentsOperation(params) {
2085
2085
  )
2086
2086
  );
2087
2087
  return dispatchListMode(mode, shardResults, {
2088
+ // Strongly-consistent BatchGet on the base table so a role change is
2089
+ // reflected immediately by the read-back the admin-console dropdowns
2090
+ // issue right after their PUT/POST. Without it the eventually-consistent
2091
+ // hydration can return the *previous* role, making the dropdown appear
2092
+ // to revert (#1347).
2088
2093
  hydrate: (orderedIds) => batchGetWithRetry(
2089
2094
  service.entities.roleAssignment,
2090
- orderedIds.map((id) => ({ tenantId, id, sk: SK2 }))
2095
+ orderedIds.map((id) => ({ tenantId, id, sk: SK2 })),
2096
+ { consistent: true }
2091
2097
  ),
2092
2098
  getId: (item) => item.id,
2093
2099
  buildEntry: (id, item) => ({
@@ -2105,8 +2111,20 @@ async function listRoleAssignmentsOperation(params) {
2105
2111
  });
2106
2112
  }
2107
2113
 
2108
- // src/data/operations/control/user/user-create-operation.ts
2114
+ // src/data/operations/control/user/user-admin-set-context-operation.ts
2109
2115
  var import_types3 = require("@openhi/types");
2116
+
2117
+ // src/data/operations/fhir-reference.ts
2118
+ function idFromReference(reference, prefix) {
2119
+ if (!reference || !reference.startsWith(prefix)) {
2120
+ return void 0;
2121
+ }
2122
+ const id = reference.slice(prefix.length);
2123
+ return id.length > 0 ? id : void 0;
2124
+ }
2125
+
2126
+ // src/data/operations/control/user/user-create-operation.ts
2127
+ var import_types4 = require("@openhi/types");
2110
2128
  var import_ulid = require("ulid");
2111
2129
 
2112
2130
  // src/data/operations/control/user/user-find-by-sub-operation.ts
@@ -2134,7 +2152,7 @@ async function findUserBySubOperation(params) {
2134
2152
  }
2135
2153
 
2136
2154
  // src/data/operations/control/user/user-switch-tenant-workspace-operation.ts
2137
- var import_types4 = require("@openhi/types");
2155
+ var import_types5 = require("@openhi/types");
2138
2156
 
2139
2157
  // src/data/operations/control/user/user-resource-helpers.ts
2140
2158
  function parseUserResource(resource) {
@@ -2145,17 +2163,8 @@ function parseUserResource(resource) {
2145
2163
  }
2146
2164
  }
2147
2165
 
2148
- // src/data/operations/fhir-reference.ts
2149
- function idFromReference(reference, prefix) {
2150
- if (!reference || !reference.startsWith(prefix)) {
2151
- return void 0;
2152
- }
2153
- const id = reference.slice(prefix.length);
2154
- return id.length > 0 ? id : void 0;
2155
- }
2156
-
2157
2166
  // src/data/operations/control/user/user-update-operation.ts
2158
- var import_types5 = require("@openhi/types");
2167
+ var import_types6 = require("@openhi/types");
2159
2168
 
2160
2169
  // src/data/dynamo/dynamo-data-service.ts
2161
2170
  var import_electrodb16 = require("electrodb");
@@ -3287,7 +3296,7 @@ async function resolveOrganizationRoles(tenantId, workspaceId, userId) {
3287
3296
  if (matching === void 0) {
3288
3297
  return void 0;
3289
3298
  }
3290
- const linked = (0, import_types6.getLinkedDataIdentity)(
3299
+ const linked = (0, import_types7.getLinkedDataIdentity)(
3291
3300
  matching.resource
3292
3301
  );
3293
3302
  if (linked?.reference === void 0) {
@@ -3306,7 +3315,7 @@ async function resolveOrganizationRoles(tenantId, workspaceId, userId) {
3306
3315
  const codings = role.code?.flatMap((cc) => cc.coding ?? []) ?? [];
3307
3316
  for (const c of codings) {
3308
3317
  if (typeof c.code !== "string") continue;
3309
- const parsed = import_types6.organizationRoleCodeSchema.safeParse(c.code);
3318
+ const parsed = import_types7.organizationRoleCodeSchema.safeParse(c.code);
3310
3319
  if (parsed.success) {
3311
3320
  codes.add(parsed.data);
3312
3321
  }
@@ -3343,7 +3352,7 @@ async function resolvePlatformRoles(tenantId, workspaceId, userId) {
3343
3352
  const roleId = idFromReference(ref, "Role/");
3344
3353
  if (roleId === void 0) continue;
3345
3354
  const candidate = roleId.startsWith("role-") ? roleId.slice("role-".length) : roleId;
3346
- const parsed = import_types6.platformRoleCodeSchema.safeParse(candidate);
3355
+ const parsed = import_types7.platformRoleCodeSchema.safeParse(candidate);
3347
3356
  if (parsed.success) {
3348
3357
  codes.add(parsed.data);
3349
3358
  }