@mondaydotcomorg/monday-authorization 3.3.0-feature-bashanye-navigate-can-action-in-scope-to-graph-752f21a → 3.3.0-feature-bashanye-navigate-can-action-in-scope-to-graph-2992133

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.
@@ -1 +1 @@
1
- {"version":3,"file":"authorization-service.d.ts","sourceRoot":"","sources":["../src/authorization-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAmB,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACb,MAAM,kCAAkC,CAAC;AAe1C,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,mBAAmB,CAAC,EAAE,mBAAmB,EAAE,CAAC;CAC7C;AAED,wBAAgB,sBAAsB,CAAC,wBAAwB,EAAE,kBAAkB,QAElF;AAMD,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,WAAW,CAAC,MAAC;IACpB,MAAM,CAAC,sCAAsC,CAAC,EAAE,MAAM,CAAC;IACvD,MAAM,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IAEnC;;;OAGG;WACU,YAAY,CACvB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,QAAQ,EAAE,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC;WAEhB,YAAY,CACvB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,2BAA2B,EAAE,mBAAmB,EAAE,GACjD,OAAO,CAAC,iBAAiB,CAAC;IAY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EACN,sCAAsC,GAAE,MAAiD,QAY1F;AAED,wBAAsB,eAAe,kBAMpC;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAepG"}
@@ -89,19 +89,15 @@ class AuthorizationService {
89
89
  return attributionsService.PlatformProfile.INTERNAL;
90
90
  }
91
91
  static async canActionInScopeMultiple(accountId, userId, scopedActions) {
92
- authorizationInternalService.logger.debug({ tag: 'authorization-service', accountId, userId, scopedActionsCount: scopedActions.length }, 'canActionInScopeMultiple called');
93
92
  const shouldNavigateToGraph = Boolean(this.igniteClient?.isReleased(NAVIGATE_CAN_ACTION_IN_SCOPE_TO_GRAPH_FF, { accountId, userId }));
94
- authorizationInternalService.logger.debug({ tag: 'authorization-service', accountId, userId, shouldNavigateToGraph }, `Graph API routing feature flag: ${shouldNavigateToGraph ? 'ENABLED' : 'DISABLED'}`);
95
93
  const internalAuthToken = authorizationInternalService.AuthorizationInternalService.generateInternalAuthToken(accountId, userId);
96
94
  const startTime = perf_hooks.performance.now();
97
95
  let scopedActionResponseObjects;
98
96
  let usedGraphApi = false;
99
97
  if (shouldNavigateToGraph) {
100
- authorizationInternalService.logger.debug({ tag: 'authorization-service', accountId, userId }, 'Attempting Graph API authorization');
101
98
  try {
102
99
  scopedActionResponseObjects = await clients_graphApi_client.GraphApiClient.checkPermissions(internalAuthToken, scopedActions);
103
100
  usedGraphApi = true;
104
- authorizationInternalService.logger.debug({ tag: 'authorization-service', accountId, userId, resultCount: scopedActionResponseObjects.length }, 'Graph API authorization successful');
105
101
  }
106
102
  catch (error) {
107
103
  // Fallback to Platform API if Graph API fails
@@ -111,18 +107,13 @@ class AuthorizationService {
111
107
  accountId,
112
108
  userId,
113
109
  }, 'Graph API authorization failed, falling back to Platform API');
114
- authorizationInternalService.logger.debug({ tag: 'authorization-service', accountId, userId }, 'Starting Platform API fallback');
115
110
  const profile = this.getProfile(accountId, userId);
116
- authorizationInternalService.logger.debug({ tag: 'authorization-service', accountId, userId, profile }, 'Retrieved Platform API profile for fallback');
117
111
  scopedActionResponseObjects = await clients_platformApi_client.PlatformApiClient.checkPermissions(profile, internalAuthToken, userId, scopedActions);
118
112
  usedGraphApi = false;
119
- authorizationInternalService.logger.debug({ tag: 'authorization-service', accountId, userId, resultCount: scopedActionResponseObjects.length }, 'Platform API fallback successful');
120
113
  }
121
114
  }
122
115
  else {
123
- authorizationInternalService.logger.debug({ tag: 'authorization-service', accountId, userId }, 'Using Platform API directly (Graph API FF disabled)');
124
116
  const profile = this.getProfile(accountId, userId);
125
- authorizationInternalService.logger.debug({ tag: 'authorization-service', accountId, userId, profile }, 'Retrieved Platform API profile');
126
117
  scopedActionResponseObjects = await clients_platformApi_client.PlatformApiClient.checkPermissions(profile, internalAuthToken, userId, scopedActions);
127
118
  usedGraphApi = false;
128
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"graph-api.client.d.ts","sourceRoot":"","sources":["../../src/clients/graph-api.client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAsB,MAAM,mCAAmC,CAAC;AAGjH,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EAIvB,MAAM,0BAA0B,CAAC;AAMlC;;GAEG;AACH,qBAAa,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,iBAAiB;IAyBzE;;OAEG;WACU,gBAAgB,CAC3B,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,sBAAsB,CAAC;IA0ElC;;OAEG;IACH,MAAM,CAAC,WAAW,CAChB,aAAa,EAAE,YAAY,EAAE,EAC7B,aAAa,EAAE,sBAAsB,GACpC,0BAA0B,EAAE;IAkB/B;;OAEG;WACU,gBAAgB,CAC3B,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;CAIzC"}
1
+ {"version":3,"file":"graph-api.client.d.ts","sourceRoot":"","sources":["../../src/clients/graph-api.client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAsB,MAAM,mCAAmC,CAAC;AAGjH,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EAIvB,MAAM,0BAA0B,CAAC;AAMlC;;GAEG;AACH,qBAAa,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,iBAAiB;IAyBzE;;OAEG;WACU,gBAAgB,CAC3B,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,sBAAsB,CAAC;IA4ClC;;OAEG;IACH,MAAM,CAAC,WAAW,CAChB,aAAa,EAAE,YAAY,EAAE,EAC7B,aAAa,EAAE,sBAAsB,GACpC,0BAA0B,EAAE;IAkB/B;;OAEG;WACU,gBAAgB,CAC3B,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;CAIzC"}
@@ -44,15 +44,6 @@ class GraphApiClient {
44
44
  const httpClient = tridentBackendApi.Api.getPart('httpClient');
45
45
  const attributionHeaders = attributionsService.getAttributionsFromApi();
46
46
  const bodyPayload = this.buildRequestBody(scopedActions);
47
- authorizationInternalService.logger.debug({
48
- tag: 'graph-api-client',
49
- scopedActionsCount: scopedActions.length,
50
- appName: 'authorization-graph',
51
- path: CAN_ACTION_IN_SCOPE_GRAPH_PATH,
52
- timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
53
- retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
54
- bodyPayloadKeys: Object.keys(bodyPayload),
55
- }, '🔍 Graph API Debug: Starting request');
56
47
  try {
57
48
  const response = await httpClient.fetch({
58
49
  url: {
@@ -61,7 +52,7 @@ class GraphApiClient {
61
52
  },
62
53
  method: 'POST',
63
54
  headers: {
64
- Authorization: internalAuthToken.substring(0, 20) + '...', // Mask token for security
55
+ Authorization: internalAuthToken,
65
56
  'Content-Type': 'application/json',
66
57
  ...attributionHeaders,
67
58
  },
@@ -70,21 +61,10 @@ class GraphApiClient {
70
61
  timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
71
62
  retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
72
63
  });
73
- authorizationInternalService.logger.debug({
74
- tag: 'graph-api-client',
75
- responseKeys: Object.keys(response),
76
- scopedActionsCount: scopedActions.length,
77
- }, '✅ Graph API Debug: Request successful');
78
64
  prometheusService.setGraphAvailability(true);
79
65
  return response;
80
66
  }
81
67
  catch (err) {
82
- authorizationInternalService.logger.debug({
83
- tag: 'graph-api-client',
84
- error: err instanceof Error ? err.message : String(err),
85
- status: err instanceof mondayFetchApi.HttpFetcherError ? err.status : 'unknown',
86
- scopedActionsCount: scopedActions.length,
87
- }, '❌ Graph API Debug: Request failed');
88
68
  prometheusService.setGraphAvailability(false);
89
69
  if (err instanceof mondayFetchApi.HttpFetcherError) {
90
70
  authorizationInternalService.AuthorizationInternalService.throwOnHttpError(err.status, 'canActionInScopeMultiple');
@@ -1 +1 @@
1
- {"version":3,"file":"platform-api.client.d.ts","sourceRoot":"","sources":["../../src/clients/platform-api.client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAE7F,OAAO,EAA0B,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAOlF,KAAK,2BAA2B,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG;IAC/D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC;AAEF,UAAU,0BAA0B;IAClC,MAAM,EAAE,0BAA0B,EAAE,CAAC;CACtC;AAED;;GAEG;AACH,qBAAa,iBAAi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;IA0CtC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,0BAA0B,GAAG,0BAA0B,EAAE;IAkBtF;;OAEG;WACU,gBAAgB,CAC3B,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,MAAM,EACzB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;CAKzC"}
@@ -27,16 +27,6 @@ class PlatformApiClient {
27
27
  static async fetchPermissions(profile, internalAuthToken, userId, scopedActionsPayload) {
28
28
  const attributionHeaders = attributionsService.getAttributionsFromApi();
29
29
  const httpClient = tridentBackendApi.Api.getPart('httpClient');
30
- authorizationInternalService.logger.debug({
31
- tag: 'platform-api-client',
32
- profile,
33
- userId,
34
- scopedActionsCount: scopedActionsPayload.length,
35
- appName: 'platform',
36
- path: PLATFORM_CAN_ACTIONS_IN_SCOPES_PATH,
37
- timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
38
- retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
39
- }, '🔍 Platform API Debug: Starting request');
40
30
  try {
41
31
  const response = await httpClient.fetch({
42
32
  url: {
@@ -46,7 +36,7 @@ class PlatformApiClient {
46
36
  },
47
37
  method: 'POST',
48
38
  headers: {
49
- Authorization: internalAuthToken.substring(0, 20) + '...', // Mask token for security
39
+ Authorization: internalAuthToken,
50
40
  'Content-Type': 'application/json',
51
41
  ...attributionHeaders,
52
42
  },
@@ -55,22 +45,9 @@ class PlatformApiClient {
55
45
  timeout: authorizationInternalService.AuthorizationInternalService.getRequestTimeout(),
56
46
  retryPolicy: authorizationInternalService.AuthorizationInternalService.getRetriesPolicy(),
57
47
  });
58
- authorizationInternalService.logger.debug({
59
- tag: 'platform-api-client',
60
- hasResult: !!response.result,
61
- resultCount: response.result?.length || 0,
62
- }, '✅ Platform API Debug: Request successful');
63
48
  return response;
64
49
  }
65
50
  catch (err) {
66
- authorizationInternalService.logger.debug({
67
- tag: 'platform-api-client',
68
- error: err instanceof Error ? err.message : String(err),
69
- status: err instanceof mondayFetchApi.HttpFetcherError ? err.status : 'unknown',
70
- profile,
71
- userId,
72
- scopedActionsCount: scopedActionsPayload.length,
73
- }, '❌ Platform API Debug: Request failed');
74
51
  if (err instanceof mondayFetchApi.HttpFetcherError) {
75
52
  authorizationInternalService.AuthorizationInternalService.throwOnHttpError(err.status, 'canActionInScopeMultiple');
76
53
  prometheusService.incrementAuthorizationError(utils_authorization_utils.scopeToResource(utils_authorization_utils.toCamelCase(scopedActionsPayload[0].scope)).resourceType, scopedActionsPayload[0].action, err.status);
@@ -1 +1 @@
1
- {"version":3,"file":"authorization-service.d.ts","sourceRoot":"","sources":["../../src/authorization-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAmB,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACb,MAAM,kCAAkC,CAAC;AAe1C,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,mBAAmB,CAAC,EAAE,mBAAmB,EAAE,CAAC;CAC7C;AAED,wBAAgB,sBAAsB,CAAC,wBAAwB,EAAE,kBAAkB,QAElF;AAMD,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,WAAW,CAAC,MAAC;IACpB,MAAM,CAAC,sCAAsC,CAAC,EAAE,MAAM,CAAC;IACvD,MAAM,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IAEnC;;;OAGG;WACU,YAAY,CACvB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,SAAS,EA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AAwB,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;mBAkEnB,oBAAoB;mBAUpB,oBAAoB;CAoF1C;AAED,wBAAgB,cAAc,CAC5B,MAAM,KAAA,EACN,sCAAsC,GAAE,MAAiD,QAY1F;AAED,wBAAsB,eAAe,kBAMpC;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAepG"}
@@ -87,19 +87,15 @@ class AuthorizationService {
87
87
  return PlatformProfile.INTERNAL;
88
88
  }
89
89
  static async canActionInScopeMultiple(accountId, userId, scopedActions) {
90
- logger.debug({ tag: 'authorization-service', accountId, userId, scopedActionsCount: scopedActions.length }, 'canActionInScopeMultiple called');
91
90
  const shouldNavigateToGraph = Boolean(this.igniteClient?.isReleased(NAVIGATE_CAN_ACTION_IN_SCOPE_TO_GRAPH_FF, { accountId, userId }));
92
- logger.debug({ tag: 'authorization-service', accountId, userId, shouldNavigateToGraph }, `Graph API routing feature flag: ${shouldNavigateToGraph ? 'ENABLED' : 'DISABLED'}`);
93
91
  const internalAuthToken = AuthorizationInternalService.generateInternalAuthToken(accountId, userId);
94
92
  const startTime = performance.now();
95
93
  let scopedActionResponseObjects;
96
94
  let usedGraphApi = false;
97
95
  if (shouldNavigateToGraph) {
98
- logger.debug({ tag: 'authorization-service', accountId, userId }, 'Attempting Graph API authorization');
99
96
  try {
100
97
  scopedActionResponseObjects = await GraphApiClient.checkPermissions(internalAuthToken, scopedActions);
101
98
  usedGraphApi = true;
102
- logger.debug({ tag: 'authorization-service', accountId, userId, resultCount: scopedActionResponseObjects.length }, 'Graph API authorization successful');
103
99
  }
104
100
  catch (error) {
105
101
  // Fallback to Platform API if Graph API fails
@@ -109,18 +105,13 @@ class AuthorizationService {
109
105
  accountId,
110
106
  userId,
111
107
  }, 'Graph API authorization failed, falling back to Platform API');
112
- logger.debug({ tag: 'authorization-service', accountId, userId }, 'Starting Platform API fallback');
113
108
  const profile = this.getProfile(accountId, userId);
114
- logger.debug({ tag: 'authorization-service', accountId, userId, profile }, 'Retrieved Platform API profile for fallback');
115
109
  scopedActionResponseObjects = await PlatformApiClient.checkPermissions(profile, internalAuthToken, userId, scopedActions);
116
110
  usedGraphApi = false;
117
- logger.debug({ tag: 'authorization-service', accountId, userId, resultCount: scopedActionResponseObjects.length }, 'Platform API fallback successful');
118
111
  }
119
112
  }
120
113
  else {
121
- logger.debug({ tag: 'authorization-service', accountId, userId }, 'Using Platform API directly (Graph API FF disabled)');
122
114
  const profile = this.getProfile(accountId, userId);
123
- logger.debug({ tag: 'authorization-service', accountId, userId, profile }, 'Retrieved Platform API profile');
124
115
  scopedActionResponseObjects = await PlatformApiClient.checkPermissions(profile, internalAuthToken, userId, scopedActions);
125
116
  usedGraphApi = false;
126
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"graph-api.client.d.ts","sourceRoot":"","sources":["../../../src/clients/graph-api.client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAsB,MAAM,mCAAmC,CAAC;AAGjH,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EAIvB,MAAM,0BAA0B,CAAC;AAMlC;;GAEG;AACH,qBAAa,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,iBAAiB;IAyBzE;;OAEG;WACU,gBAAgB,CAC3B,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,sBAAsB,CAAC;IA0ElC;;OAEG;IACH,MAAM,CAAC,WAAW,CAChB,aAAa,EAAE,YAAY,EAAE,EAC7B,aAAa,EAAE,sBAAsB,GACpC,0BAA0B,EAAE;IAkB/B;;OAEG;WACU,gBAAgB,CAC3B,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;CAIzC"}
1
+ {"version":3,"file":"graph-api.client.d.ts","sourceRoot":"","sources":["../../../src/clients/graph-api.client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAsB,MAAM,mCAAmC,CAAC;AAGjH,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EAIvB,MAAM,0BAA0B,CAAC;AAMlC;;GAEG;AACH,qBAAa,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,iBAAiB;IAyBzE;;OAEG;WACU,gBAAgB,CAC3B,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,sBAAsB,CAAC;IA4ClC;;OAEG;IACH,MAAM,CAAC,WAAW,CAChB,aAAa,EAAE,YAAY,EAAE,EAC7B,aAAa,EAAE,sBAAsB,GACpC,0BAA0B,EAAE;IAkB/B;;OAEG;WACU,gBAAgB,CAC3B,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;CAIzC"}
@@ -1,6 +1,6 @@
1
1
  import { Api } from '@mondaydotcomorg/trident-backend-api';
2
2
  import { HttpFetcherError } from '@mondaydotcomorg/monday-fetch-api';
3
- import { logger, AuthorizationInternalService } from '../authorization-internal-service.mjs';
3
+ import { AuthorizationInternalService } from '../authorization-internal-service.mjs';
4
4
  import { getAttributionsFromApi } from '../attributions-service.mjs';
5
5
  import { scopeToResource } from '../utils/authorization.utils.mjs';
6
6
  import { setGraphAvailability, incrementAuthorizationError } from '../prometheus-service.mjs';
@@ -42,15 +42,6 @@ class GraphApiClient {
42
42
  const httpClient = Api.getPart('httpClient');
43
43
  const attributionHeaders = getAttributionsFromApi();
44
44
  const bodyPayload = this.buildRequestBody(scopedActions);
45
- logger.debug({
46
- tag: 'graph-api-client',
47
- scopedActionsCount: scopedActions.length,
48
- appName: 'authorization-graph',
49
- path: CAN_ACTION_IN_SCOPE_GRAPH_PATH,
50
- timeout: AuthorizationInternalService.getRequestTimeout(),
51
- retryPolicy: AuthorizationInternalService.getRetriesPolicy(),
52
- bodyPayloadKeys: Object.keys(bodyPayload),
53
- }, '🔍 Graph API Debug: Starting request');
54
45
  try {
55
46
  const response = await httpClient.fetch({
56
47
  url: {
@@ -59,7 +50,7 @@ class GraphApiClient {
59
50
  },
60
51
  method: 'POST',
61
52
  headers: {
62
- Authorization: internalAuthToken.substring(0, 20) + '...', // Mask token for security
53
+ Authorization: internalAuthToken,
63
54
  'Content-Type': 'application/json',
64
55
  ...attributionHeaders,
65
56
  },
@@ -68,21 +59,10 @@ class GraphApiClient {
68
59
  timeout: AuthorizationInternalService.getRequestTimeout(),
69
60
  retryPolicy: AuthorizationInternalService.getRetriesPolicy(),
70
61
  });
71
- logger.debug({
72
- tag: 'graph-api-client',
73
- responseKeys: Object.keys(response),
74
- scopedActionsCount: scopedActions.length,
75
- }, '✅ Graph API Debug: Request successful');
76
62
  setGraphAvailability(true);
77
63
  return response;
78
64
  }
79
65
  catch (err) {
80
- logger.debug({
81
- tag: 'graph-api-client',
82
- error: err instanceof Error ? err.message : String(err),
83
- status: err instanceof HttpFetcherError ? err.status : 'unknown',
84
- scopedActionsCount: scopedActions.length,
85
- }, '❌ Graph API Debug: Request failed');
86
66
  setGraphAvailability(false);
87
67
  if (err instanceof HttpFetcherError) {
88
68
  AuthorizationInternalService.throwOnHttpError(err.status, 'canActionInScopeMultiple');
@@ -1 +1 @@
1
- {"version":3,"file":"platform-api.client.d.ts","sourceRoot":"","sources":["../../../src/clients/platform-api.client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAE7F,OAAO,EAA0B,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAOlF,KAAK,2B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AAmB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,2BAA2B,EAAE;IAOxF;;OAEG;WACU,gBAAgB,CAC3B,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,MAAM,EACzB,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,2BAA2B,EAAE,GAClD,OAAO,CAAC,0BAA0B,CAAC;IA0CtC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,0BAA0B,GAAG,0BAA0B,EAAE;IAkBtF;;OAEG;WACU,gBAAgB,CAC3B,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,MAAM,EACzB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;CAKzC"}
@@ -1,6 +1,6 @@
1
1
  import { Api } from '@mondaydotcomorg/trident-backend-api';
2
2
  import { HttpFetcherError } from '@mondaydotcomorg/monday-fetch-api';
3
- import { logger, AuthorizationInternalService } from '../authorization-internal-service.mjs';
3
+ import { AuthorizationInternalService, logger } from '../authorization-internal-service.mjs';
4
4
  import { getAttributionsFromApi } from '../attributions-service.mjs';
5
5
  import { toSnakeCase, scopeToResource, toCamelCase } from '../utils/authorization.utils.mjs';
6
6
  import { incrementAuthorizationError } from '../prometheus-service.mjs';
@@ -25,16 +25,6 @@ class PlatformApiClient {
25
25
  static async fetchPermissions(profile, internalAuthToken, userId, scopedActionsPayload) {
26
26
  const attributionHeaders = getAttributionsFromApi();
27
27
  const httpClient = Api.getPart('httpClient');
28
- logger.debug({
29
- tag: 'platform-api-client',
30
- profile,
31
- userId,
32
- scopedActionsCount: scopedActionsPayload.length,
33
- appName: 'platform',
34
- path: PLATFORM_CAN_ACTIONS_IN_SCOPES_PATH,
35
- timeout: AuthorizationInternalService.getRequestTimeout(),
36
- retryPolicy: AuthorizationInternalService.getRetriesPolicy(),
37
- }, '🔍 Platform API Debug: Starting request');
38
28
  try {
39
29
  const response = await httpClient.fetch({
40
30
  url: {
@@ -44,7 +34,7 @@ class PlatformApiClient {
44
34
  },
45
35
  method: 'POST',
46
36
  headers: {
47
- Authorization: internalAuthToken.substring(0, 20) + '...', // Mask token for security
37
+ Authorization: internalAuthToken,
48
38
  'Content-Type': 'application/json',
49
39
  ...attributionHeaders,
50
40
  },
@@ -53,22 +43,9 @@ class PlatformApiClient {
53
43
  timeout: AuthorizationInternalService.getRequestTimeout(),
54
44
  retryPolicy: AuthorizationInternalService.getRetriesPolicy(),
55
45
  });
56
- logger.debug({
57
- tag: 'platform-api-client',
58
- hasResult: !!response.result,
59
- resultCount: response.result?.length || 0,
60
- }, '✅ Platform API Debug: Request successful');
61
46
  return response;
62
47
  }
63
48
  catch (err) {
64
- logger.debug({
65
- tag: 'platform-api-client',
66
- error: err instanceof Error ? err.message : String(err),
67
- status: err instanceof HttpFetcherError ? err.status : 'unknown',
68
- profile,
69
- userId,
70
- scopedActionsCount: scopedActionsPayload.length,
71
- }, '❌ Platform API Debug: Request failed');
72
49
  if (err instanceof HttpFetcherError) {
73
50
  AuthorizationInternalService.throwOnHttpError(err.status, 'canActionInScopeMultiple');
74
51
  incrementAuthorizationError(scopeToResource(toCamelCase(scopedActionsPayload[0].scope)).resourceType, scopedActionsPayload[0].action, err.status);
@@ -1 +1 @@
1
- {"version":3,"file":"authorization.utils.d.ts","sourceRoot":"","sources":["../../../src/utils/authorization.utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGpE,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACpH,MAAM,MAAM,aAAa,CAAC,CA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EG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG;IAAE,YAAY,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAmB3G;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAEtE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAEzE"}
@@ -1,38 +1,26 @@
1
1
  import snakeCase from 'lodash/snakeCase.js';
2
2
  import camelCase from 'lodash/camelCase.js';
3
3
  import mapKeys from 'lodash/mapKeys.js';
4
- import { logger } from '../authorization-internal-service.mjs';
5
4
 
6
5
  /**
7
6
  * Converts a scope object to resource type and resource ID
8
7
  */
9
8
  function scopeToResource(scope) {
10
- logger.debug({
11
- tag: 'authorization-utils',
12
- scopeKeys: Object.keys(scope),
13
- scopeValues: Object.values(scope),
14
- }, '🔍 Utils Debug: Converting scope to resource');
15
9
  if ('workspaceId' in scope) {
16
- logger.debug({ tag: 'authorization-utils', resourceId: scope.workspaceId }, '🔍 Utils Debug: Mapped to workspace');
17
10
  return { resourceType: 'workspace', resourceId: scope.workspaceId };
18
11
  }
19
12
  if ('boardId' in scope) {
20
- logger.debug({ tag: 'authorization-utils', resourceId: scope.boardId }, '🔍 Utils Debug: Mapped to board');
21
13
  return { resourceType: 'board', resourceId: scope.boardId };
22
14
  }
23
15
  if ('pulseId' in scope) {
24
- logger.debug({ tag: 'authorization-utils', resourceId: scope.pulseId }, '🔍 Utils Debug: Mapped to pulse');
25
16
  return { resourceType: 'pulse', resourceId: scope.pulseId };
26
17
  }
27
18
  if ('accountProductId' in scope) {
28
- logger.debug({ tag: 'authorization-utils', resourceId: scope.accountProductId }, '🔍 Utils Debug: Mapped to account_product');
29
19
  return { resourceType: 'account_product', resourceId: scope.accountProductId };
30
20
  }
31
21
  if ('accountId' in scope) {
32
- logger.debug({ tag: 'authorization-utils', resourceId: scope.accountId }, '🔍 Utils Debug: Mapped to account');
33
22
  return { resourceType: 'account', resourceId: scope.accountId };
34
23
  }
35
- logger.debug({ tag: 'authorization-utils', scope }, '❌ Utils Debug: Unsupported scope provided');
36
24
  throw new Error('Unsupported scope provided');
37
25
  }
38
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"authorization.utils.d.ts","sourceRoot":"","sources":["../../src/utils/authorization.utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGpE,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACpH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC3C;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC9E,CAAC,CAAC;AAEN;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG;IAAE,YAAY,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAoC3G;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAEtE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAEzE"}
1
+ {"version":3,"file":"authorization.utils.d.ts","sourceRoot":"","sources":["../../src/utils/authorization.utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACpH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC3C;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC9E,CAAC,CAAC;AAEN;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG;IAAE,YAAY,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAmB3G;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAEtE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAEzE"}
@@ -3,7 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
3
  const snakeCase = require('lodash/snakeCase.js');
4
4
  const camelCase = require('lodash/camelCase.js');
5
5
  const mapKeys = require('lodash/mapKeys.js');
6
- const authorizationInternalService = require('../authorization-internal-service.js');
7
6
 
8
7
  const _interopDefault = e => e && e.__esModule ? e : { default: e };
9
8
 
@@ -15,32 +14,21 @@ const mapKeys__default = /*#__PURE__*/_interopDefault(mapKeys);
15
14
  * Converts a scope object to resource type and resource ID
16
15
  */
17
16
  function scopeToResource(scope) {
18
- authorizationInternalService.logger.debug({
19
- tag: 'authorization-utils',
20
- scopeKeys: Object.keys(scope),
21
- scopeValues: Object.values(scope),
22
- }, '🔍 Utils Debug: Converting scope to resource');
23
17
  if ('workspaceId' in scope) {
24
- authorizationInternalService.logger.debug({ tag: 'authorization-utils', resourceId: scope.workspaceId }, '🔍 Utils Debug: Mapped to workspace');
25
18
  return { resourceType: 'workspace', resourceId: scope.workspaceId };
26
19
  }
27
20
  if ('boardId' in scope) {
28
- authorizationInternalService.logger.debug({ tag: 'authorization-utils', resourceId: scope.boardId }, '🔍 Utils Debug: Mapped to board');
29
21
  return { resourceType: 'board', resourceId: scope.boardId };
30
22
  }
31
23
  if ('pulseId' in scope) {
32
- authorizationInternalService.logger.debug({ tag: 'authorization-utils', resourceId: scope.pulseId }, '🔍 Utils Debug: Mapped to pulse');
33
24
  return { resourceType: 'pulse', resourceId: scope.pulseId };
34
25
  }
35
26
  if ('accountProductId' in scope) {
36
- authorizationInternalService.logger.debug({ tag: 'authorization-utils', resourceId: scope.accountProductId }, '🔍 Utils Debug: Mapped to account_product');
37
27
  return { resourceType: 'account_product', resourceId: scope.accountProductId };
38
28
  }
39
29
  if ('accountId' in scope) {
40
- authorizationInternalService.logger.debug({ tag: 'authorization-utils', resourceId: scope.accountId }, '🔍 Utils Debug: Mapped to account');
41
30
  return { resourceType: 'account', resourceId: scope.accountId };
42
31
  }
43
- authorizationInternalService.logger.debug({ tag: 'authorization-utils', scope }, '❌ Utils Debug: Unsupported scope provided');
44
32
  throw new Error('Unsupported scope provided');
45
33
  }
46
34
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mondaydotcomorg/monday-authorization",
3
- "version": "3.3.0-feature-bashanye-navigate-can-action-in-scope-to-graph-752f21a",
3
+ "version": "3.3.0-feature-bashanye-navigate-can-action-in-scope-to-graph-2992133",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "BSD-3-Clause",
@@ -47,8 +47,7 @@
47
47
  },
48
48
  "files": [
49
49
  "dist/",
50
- "src/",
51
- "DEBUG.md"
50
+ "src/"
52
51
  ],
53
52
  "eslintConfig": {
54
53
  "extends": "@mondaydotcomorg/trident-library",
@@ -63,8 +62,5 @@
63
62
  "type": "git",
64
63
  "url": "https://github.com/DaPulse/authorization-domain.git",
65
64
  "directory": "packages/monday-authorization"
66
- },
67
- "publishConfig": {
68
- "access": "public"
69
65
  }
70
66
  }
@@ -154,19 +154,11 @@ export class AuthorizationService {
154
154
  userId: number,
155
155
  scopedActions: ScopedAction[]
156
156
  ): Promise<ScopedActionResponseObject[]> {
157
- logger.debug(
158
- { tag: 'authorization-service', accountId, userId, scopedActionsCount: scopedActions.length },
159
- 'canActionInScopeMultiple called'
160
- );
161
157
 
162
158
  const shouldNavigateToGraph = Boolean(
163
159
  this.igniteClient?.isReleased(NAVIGATE_CAN_ACTION_IN_SCOPE_TO_GRAPH_FF, { accountId, userId })
164
160
  );
165
161
 
166
- logger.debug(
167
- { tag: 'authorization-service', accountId, userId, shouldNavigateToGraph },
168
- `Graph API routing feature flag: ${shouldNavigateToGraph ? 'ENABLED' : 'DISABLED'}`
169
- );
170
162
 
171
163
  const internalAuthToken = AuthorizationInternalService.generateInternalAuthToken(accountId, userId);
172
164
 
@@ -175,14 +167,9 @@ export class AuthorizationService {
175
167
  let usedGraphApi = false;
176
168
 
177
169
  if (shouldNavigateToGraph) {
178
- logger.debug({ tag: 'authorization-service', accountId, userId }, 'Attempting Graph API authorization');
179
170
  try {
180
171
  scopedActionResponseObjects = await GraphApiClient.checkPermissions(internalAuthToken, scopedActions);
181
172
  usedGraphApi = true;
182
- logger.debug(
183
- { tag: 'authorization-service', accountId, userId, resultCount: scopedActionResponseObjects.length },
184
- 'Graph API authorization successful'
185
- );
186
173
  } catch (error) {
187
174
  // Fallback to Platform API if Graph API fails
188
175
  logger.warn(
@@ -194,12 +181,7 @@ export class AuthorizationService {
194
181
  },
195
182
  'Graph API authorization failed, falling back to Platform API'
196
183
  );
197
- logger.debug({ tag: 'authorization-service', accountId, userId }, 'Starting Platform API fallback');
198
184
  const profile = this.getProfile(accountId, userId);
199
- logger.debug(
200
- { tag: 'authorization-service', accountId, userId, profile },
201
- 'Retrieved Platform API profile for fallback'
202
- );
203
185
  scopedActionResponseObjects = await PlatformApiClient.checkPermissions(
204
186
  profile,
205
187
  internalAuthToken,
@@ -207,18 +189,9 @@ export class AuthorizationService {
207
189
  scopedActions
208
190
  );
209
191
  usedGraphApi = false;
210
- logger.debug(
211
- { tag: 'authorization-service', accountId, userId, resultCount: scopedActionResponseObjects.length },
212
- 'Platform API fallback successful'
213
- );
214
192
  }
215
193
  } else {
216
- logger.debug(
217
- { tag: 'authorization-service', accountId, userId },
218
- 'Using Platform API directly (Graph API FF disabled)'
219
- );
220
194
  const profile = this.getProfile(accountId, userId);
221
- logger.debug({ tag: 'authorization-service', accountId, userId, profile }, 'Retrieved Platform API profile');
222
195
  scopedActionResponseObjects = await PlatformApiClient.checkPermissions(
223
196
  profile,
224
197
  internalAuthToken,
@@ -1,7 +1,7 @@
1
1
  import { Api } from '@mondaydotcomorg/trident-backend-api';
2
2
  import { HttpFetcherError } from '@mondaydotcomorg/monday-fetch-api';
3
3
  import { ScopedAction, ScopedActionResponseObject, ScopedActionPermit } from '../types/scoped-actions-contracts';
4
- import { AuthorizationInternalService, logger } from '../authorization-internal-service';
4
+ import { AuthorizationInternalService } from '../authorization-internal-service';
5
5
  import { getAttributionsFromApi } from '../attributions-service';
6
6
  import {
7
7
  GraphIsAllowedDto,
@@ -58,18 +58,6 @@ export class GraphApiClient {
58
58
  const attributionHeaders = getAttributionsFromApi();
59
59
  const bodyPayload = this.buildRequestBody(scopedActions);
60
60
 
61
- logger.debug(
62
- {
63
- tag: 'graph-api-client',
64
- scopedActionsCount: scopedActions.length,
65
- appName: 'authorization-graph',
66
- path: CAN_ACTION_IN_SCOPE_GRAPH_PATH,
67
- timeout: AuthorizationInternalService.getRequestTimeout(),
68
- retryPolicy: AuthorizationInternalService.getRetriesPolicy(),
69
- bodyPayloadKeys: Object.keys(bodyPayload),
70
- },
71
- '🔍 Graph API Debug: Starting request'
72
- );
73
61
 
74
62
  try {
75
63
  const response = await httpClient!.fetch<GraphIsAllowedResponse>(
@@ -80,7 +68,7 @@ export class GraphApiClient {
80
68
  },
81
69
  method: 'POST',
82
70
  headers: {
83
- Authorization: internalAuthToken.substring(0, 20) + '...', // Mask token for security
71
+ Authorization: internalAuthToken,
84
72
  'Content-Type': 'application/json',
85
73
  ...attributionHeaders,
86
74
  },
@@ -92,28 +80,10 @@ export class GraphApiClient {
92
80
  }
93
81
  );
94
82
 
95
- logger.debug(
96
- {
97
- tag: 'graph-api-client',
98
- responseKeys: Object.keys(response),
99
- scopedActionsCount: scopedActions.length,
100
- },
101
- '✅ Graph API Debug: Request successful'
102
- );
103
83
 
104
84
  setGraphAvailability(true);
105
85
  return response;
106
86
  } catch (err) {
107
- logger.debug(
108
- {
109
- tag: 'graph-api-client',
110
- error: err instanceof Error ? err.message : String(err),
111
- status: err instanceof HttpFetcherError ? err.status : 'unknown',
112
- scopedActionsCount: scopedActions.length,
113
- },
114
- '❌ Graph API Debug: Request failed'
115
- );
116
-
117
87
  setGraphAvailability(false);
118
88
  if (err instanceof HttpFetcherError) {
119
89
  AuthorizationInternalService.throwOnHttpError(err.status, 'canActionInScopeMultiple');
@@ -43,19 +43,6 @@ export class PlatformApiClient {
43
43
  const attributionHeaders = getAttributionsFromApi();
44
44
  const httpClient = Api.getPart('httpClient');
45
45
 
46
- logger.debug(
47
- {
48
- tag: 'platform-api-client',
49
- profile,
50
- userId,
51
- scopedActionsCount: scopedActionsPayload.length,
52
- appName: 'platform',
53
- path: PLATFORM_CAN_ACTIONS_IN_SCOPES_PATH,
54
- timeout: AuthorizationInternalService.getRequestTimeout(),
55
- retryPolicy: AuthorizationInternalService.getRetriesPolicy(),
56
- },
57
- '🔍 Platform API Debug: Starting request'
58
- );
59
46
 
60
47
  try {
61
48
  const response = await httpClient!.fetch<CanActionsInScopesResponse>(
@@ -67,7 +54,7 @@ export class PlatformApiClient {
67
54
  },
68
55
  method: 'POST',
69
56
  headers: {
70
- Authorization: internalAuthToken.substring(0, 20) + '...', // Mask token for security
57
+ Authorization: internalAuthToken,
71
58
  'Content-Type': 'application/json',
72
59
  ...attributionHeaders,
73
60
  },
@@ -79,29 +66,9 @@ export class PlatformApiClient {
79
66
  }
80
67
  );
81
68
 
82
- logger.debug(
83
- {
84
- tag: 'platform-api-client',
85
- hasResult: !!response.result,
86
- resultCount: response.result?.length || 0,
87
- },
88
- '✅ Platform API Debug: Request successful'
89
- );
90
69
 
91
70
  return response;
92
71
  } catch (err) {
93
- logger.debug(
94
- {
95
- tag: 'platform-api-client',
96
- error: err instanceof Error ? err.message : String(err),
97
- status: err instanceof HttpFetcherError ? err.status : 'unknown',
98
- profile,
99
- userId,
100
- scopedActionsCount: scopedActionsPayload.length,
101
- },
102
- '❌ Platform API Debug: Request failed'
103
- );
104
-
105
72
  if (err instanceof HttpFetcherError) {
106
73
  AuthorizationInternalService.throwOnHttpError(err.status, 'canActionInScopeMultiple');
107
74
  incrementAuthorizationError(
@@ -3,7 +3,6 @@ import camelCase from 'lodash/camelCase.js';
3
3
  import mapKeys from 'lodash/mapKeys.js';
4
4
  import { ScopeOptions } from '../types/scoped-actions-contracts';
5
5
  import { ResourceType, ResourceId } from '../types/graph-api.types';
6
- import { logger } from '../authorization-internal-service';
7
6
 
8
7
  export type CamelCase<S extends string> = S extends `${infer F}_${infer R}` ? `${F}${Capitalize<CamelCase<R>>}` : S;
9
8
  export type CamelCaseKeys<T> = T extends object
@@ -14,40 +13,23 @@ export type CamelCaseKeys<T> = T extends object
14
13
  * Converts a scope object to resource type and resource ID
15
14
  */
16
15
  export function scopeToResource(scope: ScopeOptions): { resourceType: ResourceType; resourceId: ResourceId } {
17
- logger.debug(
18
- {
19
- tag: 'authorization-utils',
20
- scopeKeys: Object.keys(scope),
21
- scopeValues: Object.values(scope),
22
- },
23
- '🔍 Utils Debug: Converting scope to resource'
24
- );
25
16
 
26
17
  if ('workspaceId' in scope) {
27
- logger.debug({ tag: 'authorization-utils', resourceId: scope.workspaceId }, '🔍 Utils Debug: Mapped to workspace');
28
18
  return { resourceType: 'workspace', resourceId: scope.workspaceId };
29
19
  }
30
20
  if ('boardId' in scope) {
31
- logger.debug({ tag: 'authorization-utils', resourceId: scope.boardId }, '🔍 Utils Debug: Mapped to board');
32
21
  return { resourceType: 'board', resourceId: scope.boardId };
33
22
  }
34
23
  if ('pulseId' in scope) {
35
- logger.debug({ tag: 'authorization-utils', resourceId: scope.pulseId }, '🔍 Utils Debug: Mapped to pulse');
36
24
  return { resourceType: 'pulse', resourceId: scope.pulseId };
37
25
  }
38
26
  if ('accountProductId' in scope) {
39
- logger.debug(
40
- { tag: 'authorization-utils', resourceId: scope.accountProductId },
41
- '🔍 Utils Debug: Mapped to account_product'
42
- );
43
27
  return { resourceType: 'account_product', resourceId: scope.accountProductId };
44
28
  }
45
29
  if ('accountId' in scope) {
46
- logger.debug({ tag: 'authorization-utils', resourceId: scope.accountId }, '🔍 Utils Debug: Mapped to account');
47
30
  return { resourceType: 'account', resourceId: scope.accountId };
48
31
  }
49
32
 
50
- logger.debug({ tag: 'authorization-utils', scope }, '❌ Utils Debug: Unsupported scope provided');
51
33
  throw new Error('Unsupported scope provided');
52
34
  }
53
35
 
package/DEBUG.md DELETED
@@ -1,203 +0,0 @@
1
- # Debugging @mondaydotcomorg/monday-authorization
2
-
3
- This guide explains how to debug the monday-authorization package when it's installed as a dependency in your project.
4
-
5
- ## 🔧 Setup for Debugging
6
-
7
- ### 1. Install the Package with Source Files
8
-
9
- When you install the package, it includes both compiled JavaScript and TypeScript source files:
10
-
11
- ```bash
12
- npm install @mondaydotcomorg/monday-authorization
13
- ```
14
-
15
- The package includes:
16
-
17
- - `dist/` - Compiled JavaScript with source maps
18
- - `src/` - Original TypeScript source files
19
-
20
- ### 2. Configure Your Debugger
21
-
22
- #### VS Code Launch Configuration
23
-
24
- Create a `.vscode/launch.json` file in your project:
25
-
26
- ```json
27
- {
28
- "version": "0.2.0",
29
- "configurations": [
30
- {
31
- "name": "Debug Authorization Package",
32
- "type": "node",
33
- "request": "launch",
34
- "program": "${workspaceFolder}/your-main-file.js",
35
- "sourceMaps": true,
36
- "resolveSourceMapLocations": [
37
- "${workspaceFolder}/**",
38
- "!**/node_modules/**",
39
- "**/node_modules/@mondaydotcomorg/monday-authorization/**"
40
- ],
41
- "skipFiles": ["<node_internals>/**", "node_modules/**"],
42
- "outFiles": ["${workspaceFolder}/node_modules/@mondaydotcomorg/monday-authorization/dist/**/*.js"]
43
- }
44
- ]
45
- }
46
- ```
47
-
48
- #### WebStorm/IntelliJ IDEA
49
-
50
- 1. Go to `Run` → `Edit Configurations`
51
- 2. Add a new `Node.js` configuration
52
- 3. Set the JavaScript file to your main application file
53
- 4. In the debugger settings, ensure source maps are enabled
54
-
55
- ### 3. Enable Debug Logging
56
-
57
- The package includes comprehensive debug logging. To see debug logs:
58
-
59
- ```bash
60
- # Set environment variable
61
- export LOG_LEVEL=debug
62
-
63
- # Or in your application
64
- process.env.LOG_LEVEL = 'debug';
65
- ```
66
-
67
- ### 4. Breakpoints in Source Files
68
-
69
- You can set breakpoints directly in the TypeScript source files:
70
-
71
- 1. Open the source file: `node_modules/@mondaydotcomorg/monday-authorization/src/`
72
- 2. Set breakpoints in the TypeScript code
73
- 3. Your debugger should map them to the running JavaScript
74
-
75
- ## 🔍 Debug Log Categories
76
-
77
- The package logs debug information with these tags:
78
-
79
- ### Authorization Service (`authorization-service`)
80
-
81
- ```
82
- 🔍 canActionInScopeMultiple called { accountId, userId, scopedActionsCount }
83
- 📍 Graph API routing feature flag: ENABLED/DISABLED
84
- 🎯 Attempting Graph API authorization
85
- ✅ Graph API authorization successful
86
- ❌ Graph API authorization failed, falling back to Platform API
87
- 🔄 Using Platform API directly (Graph API FF disabled)
88
- ```
89
-
90
- ### Graph API Client (`graph-api-client`)
91
-
92
- ```
93
- 🔍 Graph API Debug: Starting request { scopedActionsCount, appName, path, timeout, bodyPayloadKeys }
94
- ✅ Graph API Debug: Request successful { responseKeys, scopedActionsCount }
95
- ❌ Graph API Debug: Request failed { error, status, scopedActionsCount }
96
- ```
97
-
98
- ### Platform API Client (`platform-api-client`)
99
-
100
- ```
101
- 🔍 Platform API Debug: Starting request { profile, userId, scopedActionsCount, appName, path }
102
- ✅ Platform API Debug: Request successful { hasResult, resultCount }
103
- ❌ Platform API Debug: Request failed { error, status, profile, userId }
104
- ```
105
-
106
- ### Authorization Utils (`authorization-utils`)
107
-
108
- ```
109
- 🔍 Utils Debug: Converting scope to resource { scopeKeys, scopeValues }
110
- 🔍 Utils Debug: Mapped to workspace/board/pulse/etc { resourceId }
111
- ❌ Utils Debug: Unsupported scope provided { scope }
112
- ```
113
-
114
- ## 🐛 Common Debugging Scenarios
115
-
116
- ### Graph API 500 Errors
117
-
118
- When you see Graph API failures, the logs will show:
119
-
120
- 1. ✅ Feature flag status (enabled/disabled)
121
- 2. 🎯 API attempt (Graph API first)
122
- 3. ❌ Failure details (error message, status code)
123
- 4. 🔄 Fallback trigger (automatic switch to Platform API)
124
- 5. ✅ Fallback success (Platform API response)
125
-
126
- ### Scope Mapping Issues
127
-
128
- Debug logs show how scopes are converted to resources:
129
-
130
- ```
131
- 🔍 Utils Debug: Converting scope to resource { scopeKeys: ['boardId'], scopeValues: [123] }
132
- 🔍 Utils Debug: Mapped to board { resourceId: 123 }
133
- ```
134
-
135
- ### Authorization Flow
136
-
137
- Complete flow visibility:
138
-
139
- 1. **Entry**: `canActionInScopeMultiple called`
140
- 2. **Decision**: Feature flag check
141
- 3. **Attempt**: API selection and request
142
- 4. **Result**: Success/failure with details
143
- 5. **Fallback**: Automatic recovery if needed
144
-
145
- ## 📊 Source Maps
146
-
147
- The package includes source maps for both:
148
-
149
- - `dist/index.js.map` - Main CommonJS build
150
- - `dist/esm/index.mjs.map` - ESM build
151
-
152
- These allow your debugger to map the running JavaScript back to the original TypeScript source.
153
-
154
- ## 🔧 Advanced Debugging
155
-
156
- ### Custom Logger Configuration
157
-
158
- ```typescript
159
- import { logger } from '@mondaydotcomorg/monday-authorization/src/authorization-internal-service';
160
-
161
- // Configure custom logging
162
- logger.level = 'debug';
163
- ```
164
-
165
- ### Inspecting Authorization Objects
166
-
167
- ```typescript
168
- // Add this to your code to inspect authorization calls
169
- import { AuthorizationService } from '@mondaydotcomorg/monday-authorization';
170
-
171
- // Monkey patch for debugging
172
- const originalCanActionInScopeMultiple = AuthorizationService.canActionInScopeMultiple;
173
- AuthorizationService.canActionInScopeMultiple = async (...args) => {
174
- console.log('🔍 Authorization call:', args);
175
- const result = await originalCanActionInScopeMultiple.apply(AuthorizationService, args);
176
- console.log('✅ Authorization result:', result);
177
- return result;
178
- };
179
- ```
180
-
181
- ## 📝 Troubleshooting
182
-
183
- ### Breakpoints Not Working
184
-
185
- 1. Ensure source maps are enabled in your debugger
186
- 2. Check that `node_modules/@mondaydotcomorg/monday-authorization/src/` files are accessible
187
- 3. Verify the source map files exist in `dist/`
188
-
189
- ### Logs Not Showing
190
-
191
- 1. Set `LOG_LEVEL=debug` environment variable
192
- 2. Check that your logger configuration includes debug level
193
- 3. Look for logs with tags: `authorization-service`, `graph-api-client`, `platform-api-client`, `authorization-utils`
194
-
195
- ### Source Files Not Found
196
-
197
- 1. Clear node_modules and reinstall the package
198
- 2. Ensure the package version includes source files
199
- 3. Check that `src/` directory exists in `node_modules/@mondaydotcomorg/monday-authorization/`
200
-
201
- ---
202
-
203
- With these debugging capabilities, you can fully inspect and understand the authorization flow in your applications! 🚀