@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/ApiMapper.js +15 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/conn-orch-api-mapper",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "API mapping connector for OA Drive - maps cookbook operations to HTTP endpoints",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
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
- // This is the single source of truth for workflow-scoped tenant.
766
- // NOTE: Gateway must set cookbook._system.account_id explicitly (no fallbacks).
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 && Object.prototype.hasOwnProperty.call(sys, 'account_id')) {
769
- const accountId = Number.parseInt(String(sys.account_id), 10);
770
- if (!Number.isInteger(accountId) || accountId <= 0) {
771
- throw new Error(`[ApiMapper][AccountContext] Invalid account context - Expected context._system.account_id to be a positive integer, got: ${sys.account_id}`);
772
- }
773
- // Do not allow step input to override tenant header
774
- request.headers['account-id'] = String(accountId);
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
  }