@mondaydotcomorg/monday-authorization 1.2.19-incr-moshesa-upgrade-to-httpclient-and-use-profile--stubisauthorizedfetch.1f00782 → 1.2.19-incr-moshesa-upgrade-to-httpclient-and-use-profile--stubisauthorizedfetch.b83da61
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":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAuB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACb,MAAM,kCAAkC,CAAC;AAQ1C,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;
|
|
1
|
+
{"version":3,"file":"authorization-service.d.ts","sourceRoot":"","sources":["../src/authorization-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAuB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACb,MAAM,kCAAkC,CAAC;AAQ1C,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;AAeD,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,WAAW,CAAC,MAAC;IACpB,MAAM,CAAC,sCAAsC,CAAC,EAAE,MAAM,CAAC;IAEvD;;;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;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;WAMjB,wBAAwB,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;mBAkEnB,oBAAoB;mBAUpB,oBAAoB;CAmF1C;AAED,wBAAgB,cAAc,CAC5B,MAAM,KAAA,EACN,sCAAsC,GAAE,MAAiD,QAY1F"}
|
|
@@ -80,7 +80,7 @@ class AuthorizationService {
|
|
|
80
80
|
const attributionHeaders = attributionsService.getAttributionsFromApi();
|
|
81
81
|
const httpClient = tridentBackendApi.Api.getPart('httpClient');
|
|
82
82
|
const profile = attributionsService.getProfile();
|
|
83
|
-
let response
|
|
83
|
+
let response;
|
|
84
84
|
try {
|
|
85
85
|
response = await httpClient.fetch({
|
|
86
86
|
url: {
|
|
@@ -114,7 +114,11 @@ class AuthorizationService {
|
|
|
114
114
|
function toCamelCase(obj) {
|
|
115
115
|
return mapKeys__default.default(obj, (_, key) => camelCase__default.default(key));
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
if (!response) {
|
|
118
|
+
authorizationInternalService.logger.error({ tag: 'authorization-service', response }, 'AuthorizationService: missing response');
|
|
119
|
+
throw new Error('AuthorizationService: missing response');
|
|
120
|
+
}
|
|
121
|
+
const scopedActionsResponseObjects = response.result.map(responseObject => {
|
|
118
122
|
const { scopedAction, permit } = responseObject;
|
|
119
123
|
const { scope } = scopedAction;
|
|
120
124
|
return {
|
|
@@ -135,7 +139,7 @@ class AuthorizationService {
|
|
|
135
139
|
const attributionHeaders = attributionsService.getAttributionsFromApi();
|
|
136
140
|
const httpClient = tridentBackendApi.Api.getPart('httpClient');
|
|
137
141
|
const profile = attributionsService.getProfile();
|
|
138
|
-
let response
|
|
142
|
+
let response;
|
|
139
143
|
try {
|
|
140
144
|
response = await httpClient.fetch({
|
|
141
145
|
url: {
|
|
@@ -169,7 +173,11 @@ class AuthorizationService {
|
|
|
169
173
|
const endTime = perf_hooks.performance.now();
|
|
170
174
|
const time = endTime - startTime;
|
|
171
175
|
const unauthorizedObjects = [];
|
|
172
|
-
|
|
176
|
+
if (!response) {
|
|
177
|
+
authorizationInternalService.logger.error({ tag: 'authorization-service', response }, 'AuthorizationService: missing response');
|
|
178
|
+
throw new Error('AuthorizationService: missing response');
|
|
179
|
+
}
|
|
180
|
+
response.result.forEach(function (isAuthorized, index) {
|
|
173
181
|
const authorizationObject = authorizationRequestObjects[index];
|
|
174
182
|
if (!isAuthorized) {
|
|
175
183
|
unauthorizedObjects.push(authorizationObject);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-service.d.ts","sourceRoot":"","sources":["../../src/authorization-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAuB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACb,MAAM,kCAAkC,CAAC;AAQ1C,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;
|
|
1
|
+
{"version":3,"file":"authorization-service.d.ts","sourceRoot":"","sources":["../../src/authorization-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAuB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACb,MAAM,kCAAkC,CAAC;AAQ1C,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;AAeD,qBAAa,oBAAoB;IAC/B,MAAM,CAAC,WAAW,CAAC,MAAC;IACpB,MAAM,CAAC,sCAAsC,CAAC,EAAE,MAAM,CAAC;IAEvD;;;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;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;WAMjB,wBAAwB,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,YAAY,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC;mBAkEnB,oBAAoB;mBAUpB,oBAAoB;CAmF1C;AAED,wBAAgB,cAAc,CAC5B,MAAM,KAAA,EACN,sCAAsC,GAAE,MAAiD,QAY1F"}
|
|
@@ -72,7 +72,7 @@ class AuthorizationService {
|
|
|
72
72
|
const attributionHeaders = getAttributionsFromApi();
|
|
73
73
|
const httpClient = Api.getPart('httpClient');
|
|
74
74
|
const profile = getProfile();
|
|
75
|
-
let response
|
|
75
|
+
let response;
|
|
76
76
|
try {
|
|
77
77
|
response = await httpClient.fetch({
|
|
78
78
|
url: {
|
|
@@ -106,7 +106,11 @@ class AuthorizationService {
|
|
|
106
106
|
function toCamelCase(obj) {
|
|
107
107
|
return mapKeys(obj, (_, key) => camelCase(key));
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
if (!response) {
|
|
110
|
+
logger.error({ tag: 'authorization-service', response }, 'AuthorizationService: missing response');
|
|
111
|
+
throw new Error('AuthorizationService: missing response');
|
|
112
|
+
}
|
|
113
|
+
const scopedActionsResponseObjects = response.result.map(responseObject => {
|
|
110
114
|
const { scopedAction, permit } = responseObject;
|
|
111
115
|
const { scope } = scopedAction;
|
|
112
116
|
return {
|
|
@@ -127,7 +131,7 @@ class AuthorizationService {
|
|
|
127
131
|
const attributionHeaders = getAttributionsFromApi();
|
|
128
132
|
const httpClient = Api.getPart('httpClient');
|
|
129
133
|
const profile = getProfile();
|
|
130
|
-
let response
|
|
134
|
+
let response;
|
|
131
135
|
try {
|
|
132
136
|
response = await httpClient.fetch({
|
|
133
137
|
url: {
|
|
@@ -161,7 +165,11 @@ class AuthorizationService {
|
|
|
161
165
|
const endTime = performance.now();
|
|
162
166
|
const time = endTime - startTime;
|
|
163
167
|
const unauthorizedObjects = [];
|
|
164
|
-
|
|
168
|
+
if (!response) {
|
|
169
|
+
logger.error({ tag: 'authorization-service', response }, 'AuthorizationService: missing response');
|
|
170
|
+
throw new Error('AuthorizationService: missing response');
|
|
171
|
+
}
|
|
172
|
+
response.result.forEach(function (isAuthorized, index) {
|
|
165
173
|
const authorizationObject = authorizationRequestObjects[index];
|
|
166
174
|
if (!isAuthorized) {
|
|
167
175
|
unauthorizedObjects.push(authorizationObject);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mondaydotcomorg/monday-authorization",
|
|
3
|
-
"version": "1.2.19-incr-moshesa-upgrade-to-httpclient-and-use-profile--stubisauthorizedfetch.
|
|
3
|
+
"version": "1.2.19-incr-moshesa-upgrade-to-httpclient-and-use-profile--stubisauthorizedfetch.b83da61",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "BSD-3-Clause",
|