@auxilium/datalynk-client 1.2.91 → 1.2.92

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/index.js CHANGED
@@ -3371,7 +3371,7 @@ class Superuser {
3371
3371
  } });
3372
3372
  }
3373
3373
  }
3374
- const version = "1.2.91";
3374
+ const version = "1.2.92";
3375
3375
  class WebRtc {
3376
3376
  constructor(api) {
3377
3377
  __publicField(this, "ice");
package/dist/index.mjs CHANGED
@@ -3369,7 +3369,7 @@ class Superuser {
3369
3369
  } });
3370
3370
  }
3371
3371
  }
3372
- const version = "1.2.91";
3372
+ const version = "1.2.92";
3373
3373
  class WebRtc {
3374
3374
  constructor(api) {
3375
3375
  __publicField(this, "ice");
@@ -3,13 +3,24 @@ const cache = "datalynk";
3
3
  self.addEventListener("fetch", (event) => {
4
4
  const request = event.request;
5
5
  if (navigator.onLine) {
6
- event.respondWith(fetch(request).then((response) => {
7
- const responseClone = response.clone();
8
- if (request.url.startsWith(self.location.origin) || request.url.startsWith("https://datalynk-client"))
9
- caches.open(cache).then((cache2) => cache2.put(request, responseClone));
10
- return response;
11
- }));
6
+ event.respondWith(
7
+ fetch(request).then((response) => {
8
+ if (response && response.status === 200 && (request.url.startsWith(self.location.origin) || request.url.startsWith("https://datalynk-client"))) {
9
+ const responseClone = response.clone();
10
+ caches.open(cache).then((cache2) => cache2.put(request, responseClone));
11
+ }
12
+ return response;
13
+ }).catch(() => {
14
+ return caches.match(request).then(
15
+ (cachedResponse) => cachedResponse || new Response("You are offline", { status: 503, statusText: "Service Unavailable" })
16
+ );
17
+ })
18
+ );
12
19
  } else {
13
- event.respondWith(caches.match(request).then((cachedResponse) => cachedResponse || new Response("You are offline", { status: 503, statusText: "Service Unavailable" })));
20
+ event.respondWith(
21
+ caches.match(request).then(
22
+ (cachedResponse) => cachedResponse || new Response("You are offline", { status: 503, statusText: "Service Unavailable" })
23
+ )
24
+ );
14
25
  }
15
26
  });
@@ -2,13 +2,24 @@ const cache = "datalynk";
2
2
  self.addEventListener("fetch", (event) => {
3
3
  const request = event.request;
4
4
  if (navigator.onLine) {
5
- event.respondWith(fetch(request).then((response) => {
6
- const responseClone = response.clone();
7
- if (request.url.startsWith(self.location.origin) || request.url.startsWith("https://datalynk-client"))
8
- caches.open(cache).then((cache2) => cache2.put(request, responseClone));
9
- return response;
10
- }));
5
+ event.respondWith(
6
+ fetch(request).then((response) => {
7
+ if (response && response.status === 200 && (request.url.startsWith(self.location.origin) || request.url.startsWith("https://datalynk-client"))) {
8
+ const responseClone = response.clone();
9
+ caches.open(cache).then((cache2) => cache2.put(request, responseClone));
10
+ }
11
+ return response;
12
+ }).catch(() => {
13
+ return caches.match(request).then(
14
+ (cachedResponse) => cachedResponse || new Response("You are offline", { status: 503, statusText: "Service Unavailable" })
15
+ );
16
+ })
17
+ );
11
18
  } else {
12
- event.respondWith(caches.match(request).then((cachedResponse) => cachedResponse || new Response("You are offline", { status: 503, statusText: "Service Unavailable" })));
19
+ event.respondWith(
20
+ caches.match(request).then(
21
+ (cachedResponse) => cachedResponse || new Response("You are offline", { status: 503, statusText: "Service Unavailable" })
22
+ )
23
+ );
13
24
  }
14
25
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@auxilium/datalynk-client",
3
3
  "description": "Datalynk client library",
4
4
  "repository": "https://gitlab.auxiliumgroup.com/auxilium/datalynk/datalynk-client",
5
- "version": "1.2.91",
5
+ "version": "1.2.92",
6
6
  "author": "Zak Timson <zaktimson@gmail.com>",
7
7
  "private": false,
8
8
  "main": "./dist/index.cjs",