@equinor/roma-framework 0.0.7-BETA.4 → 0.0.7-BETA.6
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/dev-portal/package.json
CHANGED
|
@@ -59931,7 +59931,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
59931
59931
|
}
|
|
59932
59932
|
const CACHED_ITEMS_MAX = 300;
|
|
59933
59933
|
const setupEventSource = async (config2, subject, abort) => {
|
|
59934
|
-
|
|
59934
|
+
let token2 = await config2.options.accessTokenFactory();
|
|
59935
59935
|
fetchEventSource(config2.url, {
|
|
59936
59936
|
headers: {
|
|
59937
59937
|
Authorization: `Bearer ${token2}`
|
|
@@ -59942,6 +59942,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
59942
59942
|
const data = eventSourceMessage.data;
|
|
59943
59943
|
try {
|
|
59944
59944
|
const parsed = JSON.parse(data);
|
|
59945
|
+
if (parsed.subject === "keep-alive")
|
|
59946
|
+
return;
|
|
59945
59947
|
const values = subject.getValue();
|
|
59946
59948
|
subject.next(
|
|
59947
59949
|
[
|
|
@@ -59953,14 +59955,18 @@ var __privateMethod = (obj, member, method) => {
|
|
|
59953
59955
|
console.error("Failed to parse message: ", ex);
|
|
59954
59956
|
}
|
|
59955
59957
|
},
|
|
59956
|
-
|
|
59957
|
-
|
|
59958
|
-
throw new Error("Connection closed, reconnecting.");
|
|
59959
|
-
}
|
|
59958
|
+
onerror: (err) => {
|
|
59959
|
+
throw err;
|
|
59960
59960
|
}
|
|
59961
59961
|
}).then(() => {
|
|
59962
|
+
config2.options.accessTokenFactory().then((t2) => token2 = t2);
|
|
59963
|
+
if (config2.options.reconnect) {
|
|
59964
|
+
setTimeout(() => setupEventSource(config2, subject, abort), 200);
|
|
59965
|
+
}
|
|
59966
|
+
}).catch((err) => {
|
|
59967
|
+
config2.options.accessTokenFactory().then((t2) => token2 = t2);
|
|
59962
59968
|
if (config2.options.reconnect) {
|
|
59963
|
-
setTimeout(() => setupEventSource(config2, subject, abort),
|
|
59969
|
+
setTimeout(() => setupEventSource(config2, subject, abort), 200);
|
|
59964
59970
|
}
|
|
59965
59971
|
});
|
|
59966
59972
|
return {
|
package/package.json
CHANGED
package/roma-framework.mjs
CHANGED
|
@@ -5274,13 +5274,13 @@ const createUrlParamsFromObject = (obj) => {
|
|
|
5274
5274
|
});
|
|
5275
5275
|
return params;
|
|
5276
5276
|
};
|
|
5277
|
-
class HttpError extends Error {
|
|
5277
|
+
let HttpError$1 = class HttpError extends Error {
|
|
5278
5278
|
constructor(message, response) {
|
|
5279
5279
|
super(message);
|
|
5280
5280
|
this.message = message;
|
|
5281
5281
|
this.response = response;
|
|
5282
5282
|
}
|
|
5283
|
-
}
|
|
5283
|
+
};
|
|
5284
5284
|
const handleJsonRequest = async (req) => {
|
|
5285
5285
|
if (req.status >= 400) {
|
|
5286
5286
|
let msg;
|
|
@@ -5303,7 +5303,7 @@ const handleJsonRequest = async (req) => {
|
|
|
5303
5303
|
headers: req.headers,
|
|
5304
5304
|
url: req.url
|
|
5305
5305
|
};
|
|
5306
|
-
throw new HttpError(req.statusText, error);
|
|
5306
|
+
throw new HttpError$1(req.statusText, error);
|
|
5307
5307
|
}
|
|
5308
5308
|
return await req.json();
|
|
5309
5309
|
};
|
|
@@ -5375,12 +5375,36 @@ const useCustomClient = () => {
|
|
|
5375
5375
|
// Add body if data is provided
|
|
5376
5376
|
}
|
|
5377
5377
|
);
|
|
5378
|
+
let value;
|
|
5378
5379
|
if (response.headers.get("content-length") === "0" || response.status === 204) {
|
|
5379
|
-
|
|
5380
|
+
value = await response.text();
|
|
5381
|
+
} else {
|
|
5382
|
+
value = await response.json();
|
|
5380
5383
|
}
|
|
5381
|
-
|
|
5384
|
+
if (response.status >= 400) {
|
|
5385
|
+
const error = {
|
|
5386
|
+
status: response.status,
|
|
5387
|
+
statusText: response.statusText,
|
|
5388
|
+
ok: false,
|
|
5389
|
+
headers: response.headers,
|
|
5390
|
+
url: response.url,
|
|
5391
|
+
message: value
|
|
5392
|
+
};
|
|
5393
|
+
throw new HttpError2(
|
|
5394
|
+
typeof value === "string" ? value : error.statusText,
|
|
5395
|
+
error
|
|
5396
|
+
);
|
|
5397
|
+
}
|
|
5398
|
+
return value;
|
|
5382
5399
|
};
|
|
5383
5400
|
};
|
|
5401
|
+
class HttpError2 extends Error {
|
|
5402
|
+
constructor(message, response) {
|
|
5403
|
+
super(message);
|
|
5404
|
+
this.message = message;
|
|
5405
|
+
this.response = response;
|
|
5406
|
+
}
|
|
5407
|
+
}
|
|
5384
5408
|
const useGetSettingByUserAndIdHook = () => {
|
|
5385
5409
|
const getSettingByUserAndId = useCustomClient();
|
|
5386
5410
|
return (userId, id, signal) => {
|