@openhi/constructs 0.0.118 → 0.0.120

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.
@@ -23,7 +23,7 @@ import {
23
23
  createTenantOperation,
24
24
  createWorkspaceOperation,
25
25
  extractDenormalizedReferenceDisplay
26
- } from "./chunk-QWWLM452.mjs";
26
+ } from "./chunk-7WDX6GPO.mjs";
27
27
  import {
28
28
  buildMembershipUserProjectionItem,
29
29
  buildMembershipWorkspaceProjectionItem,
@@ -60,6 +60,7 @@ import {
60
60
  updateDataEntityById
61
61
  } from "./chunk-U7L7T4XU.mjs";
62
62
  import {
63
+ ConflictError,
63
64
  ForbiddenError,
64
65
  NotFoundError,
65
66
  ValidationError,
@@ -1621,6 +1622,22 @@ async function createMembershipRoute(req, res) {
1621
1622
  });
1622
1623
  return res.status(201).location(`${BASE_PATH.MEMBERSHIP}/${result.id}`).json({ ...result.resource, meta: result.meta });
1623
1624
  } catch (err) {
1625
+ if (err instanceof ConflictError) {
1626
+ return res.status(409).json({
1627
+ resourceType: "OperationOutcome",
1628
+ issue: [
1629
+ { severity: "error", code: "conflict", diagnostics: err.message }
1630
+ ]
1631
+ });
1632
+ }
1633
+ if (err instanceof ValidationError) {
1634
+ return res.status(400).json({
1635
+ resourceType: "OperationOutcome",
1636
+ issue: [
1637
+ { severity: "error", code: "invalid", diagnostics: err.message }
1638
+ ]
1639
+ });
1640
+ }
1624
1641
  console.error("POST Membership error:", err);
1625
1642
  return res.status(500).json({
1626
1643
  resourceType: "OperationOutcome",
@@ -2149,6 +2166,22 @@ async function createRoleAssignmentRoute(req, res) {
2149
2166
  });
2150
2167
  return res.status(201).location(`${BASE_PATH.ROLEASSIGNMENT}/${result.id}`).json({ ...result.resource, meta: result.meta });
2151
2168
  } catch (err) {
2169
+ if (err instanceof ConflictError) {
2170
+ return res.status(409).json({
2171
+ resourceType: "OperationOutcome",
2172
+ issue: [
2173
+ { severity: "error", code: "conflict", diagnostics: err.message }
2174
+ ]
2175
+ });
2176
+ }
2177
+ if (err instanceof ValidationError) {
2178
+ return res.status(400).json({
2179
+ resourceType: "OperationOutcome",
2180
+ issue: [
2181
+ { severity: "error", code: "invalid", diagnostics: err.message }
2182
+ ]
2183
+ });
2184
+ }
2152
2185
  console.error("POST RoleAssignment error:", err);
2153
2186
  return res.status(500).json({
2154
2187
  resourceType: "OperationOutcome",