@onlineapps/conn-orch-api-mapper 1.0.28 → 1.0.29
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.
- package/package.json +1 -1
- package/src/ApiMapper.js +15 -9
package/package.json
CHANGED
package/src/ApiMapper.js
CHANGED
|
@@ -762,17 +762,23 @@ class ApiMapper {
|
|
|
762
762
|
}
|
|
763
763
|
|
|
764
764
|
// Multitenancy: propagate account context from workflow _system into HTTP header.
|
|
765
|
-
//
|
|
766
|
-
//
|
|
765
|
+
// FAIL-FAST: _system.account_id is REQUIRED for all workflow requests.
|
|
766
|
+
// Gateway sets this, so missing value indicates configuration error.
|
|
767
767
|
const sys = context && typeof context === 'object' ? context._system : null;
|
|
768
|
-
if (sys
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
768
|
+
if (!sys || !Object.prototype.hasOwnProperty.call(sys, 'account_id')) {
|
|
769
|
+
throw new Error(
|
|
770
|
+
'[ApiMapper][AccountContext] Missing account context - Expected context._system.account_id. ' +
|
|
771
|
+
'Fix: Gateway must set _system.account_id from account-id header.'
|
|
772
|
+
);
|
|
773
|
+
}
|
|
774
|
+
const accountId = Number.parseInt(String(sys.account_id), 10);
|
|
775
|
+
if (!Number.isInteger(accountId) || accountId <= 0) {
|
|
776
|
+
throw new Error(
|
|
777
|
+
`[ApiMapper][AccountContext] Invalid account context - Expected context._system.account_id to be a positive integer, got: ${sys.account_id}`
|
|
778
|
+
);
|
|
775
779
|
}
|
|
780
|
+
// Do not allow step input to override tenant header
|
|
781
|
+
request.headers['account-id'] = String(accountId);
|
|
776
782
|
|
|
777
783
|
return request;
|
|
778
784
|
}
|