@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-13ad8e0
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/dist/authorization-service.d.ts.map +1 -1
- package/dist/authorization-service.js +0 -9
- package/dist/clients/graph-api.client.d.ts.map +1 -1
- package/dist/clients/graph-api.client.js +1 -21
- package/dist/clients/platform-api.client.d.ts.map +1 -1
- package/dist/clients/platform-api.client.js +1 -24
- package/dist/esm/authorization-service.d.ts.map +1 -1
- package/dist/esm/authorization-service.mjs +0 -9
- package/dist/esm/clients/graph-api.client.d.ts.map +1 -1
- package/dist/esm/clients/graph-api.client.mjs +2 -22
- package/dist/esm/clients/platform-api.client.d.ts.map +1 -1
- package/dist/esm/clients/platform-api.client.mjs +2 -25
- package/dist/esm/utils/authorization.utils.d.ts.map +1 -1
- package/dist/esm/utils/authorization.utils.mjs +0 -12
- package/dist/utils/authorization.utils.d.ts.map +1 -1
- package/dist/utils/authorization.utils.js +0 -12
- package/package.json +2 -7
- package/DEBUG.md +0 -203
- package/src/attributions-service.ts +0 -92
- package/src/authorization-attributes-service.ts +0 -234
- package/src/authorization-internal-service.ts +0 -129
- package/src/authorization-middleware.ts +0 -51
- package/src/authorization-service.ts +0 -384
- package/src/clients/graph-api.client.ts +0 -164
- package/src/clients/platform-api.client.ts +0 -151
- package/src/constants/sns.ts +0 -5
- package/src/constants.ts +0 -22
- package/src/index.ts +0 -46
- package/src/prometheus-service.ts +0 -147
- package/src/roles-service.ts +0 -125
- package/src/testKit/index.ts +0 -69
- package/src/types/authorization-attributes-contracts.ts +0 -33
- package/src/types/express.ts +0 -8
- package/src/types/general.ts +0 -32
- package/src/types/graph-api.types.ts +0 -19
- package/src/types/roles.ts +0 -42
- package/src/types/scoped-actions-contracts.ts +0 -48
- package/src/utils/authorization.utils.ts +0 -66
|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M,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;IAY7B;;;OAGG;WACU,wBAAwB,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAO,GAC1C,OAAO,CAAC,OAAO,CAAC;mBAkBE,6BAA6B;IAclD,OAAO,CAAC,MAAM,CAAC,gBAAgB;WAIlB,gBAAgB,CAC3B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,kBAAkB,CAAC;IAM9B,OAAO,CAAC,MAAM,CAAC,UAAU;WAsBZ,wBAAwB,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"}
|
|
@@ -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;
|
|
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
|
|
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,iBAAiB;IAC5B;;OAEG;IACH,MAAM,CAAC,mBAAmB,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;
|
|
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,iBAAiB;IAC5B;;OAEG;IACH,MAAM,CAAC,mBAAmB,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"}
|
|
@@ -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
|
|
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,MA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ACN,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;
|
|
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 {
|
|
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
|
|
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,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,iBAAiB;IAC5B;;OAEG;IACH,MAAM,CAAC,mBAAmB,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;
|
|
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,iBAAiB;IAC5B;;OAEG;IACH,MAAM,CAAC,mBAAmB,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 {
|
|
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
|
|
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;
|
|
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"}
|
|
@@ -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;
|
|
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-
|
|
3
|
+
"version": "3.3.0-feature-bashanye-navigate-can-action-in-scope-to-graph-13ad8e0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -46,9 +46,7 @@
|
|
|
46
46
|
"typescript": "^5.2.2"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
|
-
"dist/"
|
|
50
|
-
"src/",
|
|
51
|
-
"DEBUG.md"
|
|
49
|
+
"dist/"
|
|
52
50
|
],
|
|
53
51
|
"eslintConfig": {
|
|
54
52
|
"extends": "@mondaydotcomorg/trident-library",
|
|
@@ -63,8 +61,5 @@
|
|
|
63
61
|
"type": "git",
|
|
64
62
|
"url": "https://github.com/DaPulse/authorization-domain.git",
|
|
65
63
|
"directory": "packages/monday-authorization"
|
|
66
|
-
},
|
|
67
|
-
"publishConfig": {
|
|
68
|
-
"access": "public"
|
|
69
64
|
}
|
|
70
65
|
}
|