@auxilium/datalynk-client 1.3.4 → 1.3.5

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/api.d.ts CHANGED
@@ -35,6 +35,8 @@ export type ApiOptions = {
35
35
  name?: string;
36
36
  /** List of slices to use offline */
37
37
  offline?: number[];
38
+ /** Display an offline banner */
39
+ offlineBanner?: boolean | 'top' | 'bottom';
38
40
  /** Website hostname */
39
41
  origin?: string;
40
42
  /** Save session token to localStorage to persist logins */
@@ -97,6 +99,8 @@ export declare class Api {
97
99
  private bundle;
98
100
  /** Bundle lifecycle tracking */
99
101
  private bundleOngoing;
102
+ /** Track online state */
103
+ private heartbeat;
100
104
  /** LocalStorage key for persisting logins */
101
105
  private localStorageKey;
102
106
  /** Pending requests cache */
@@ -126,10 +130,17 @@ export declare class Api {
126
130
  url: string;
127
131
  /** Client library version */
128
132
  version: string;
129
- /** Get session info from JWT payload */
130
- get jwtPayload(): JwtPayload | null;
131
133
  /** Is token expired */
132
134
  get expired(): boolean;
135
+ /** Get session info from JWT payload */
136
+ get jwtPayload(): JwtPayload | null;
137
+ private onlineOverride;
138
+ private _online;
139
+ /** Check if we are connected */
140
+ get online(): boolean | null;
141
+ get offline(): boolean;
142
+ /** Override connection status */
143
+ set online(value: boolean | null);
133
144
  /** Logged in spoke */
134
145
  get spoke(): string;
135
146
  /** API Session token */
@@ -149,6 +160,10 @@ export declare class Api {
149
160
  */
150
161
  constructor(origin: string, options?: ApiOptions);
151
162
  private _request;
163
+ private checkConnection;
164
+ private offlineBanner;
165
+ private startHeartbeat;
166
+ private stopHeartbeat;
152
167
  /**
153
168
  * Get list of slices
154
169
  * @return {Promise<number[]>}
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAC3F,OAAO,E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9B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IA0B9B;;;;OAIG;IACI,KAAK,CAAC,GAAG,QAAQ,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE;IAehD;;;;OAIG;IACI,QAAQ,CAAC,OAAO,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC;IAiB7C;;;;;;OAMG;IACI,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,CAAC,CAAC;IAU7E;;;;;;;;;;;OAWG;IACI,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,CAAC,CAAC;IAqC/E;;;;;;;;;;;;OAYG;IACI,KAAK,CAAC,CAAC,SAAS,IAAI,GAAG,GAAG,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;CAIjE"}
package/dist/index.cjs CHANGED
@@ -338,6 +338,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
338
338
  return this.from(super.finally(res));
339
339
  }
340
340
  }
341
+ function sleep(ms) {
342
+ return new Promise((res) => setTimeout(res, ms));
343
+ }
344
+ async function sleepWhile(fn2, checkInterval = 100) {
345
+ while (await fn2()) await sleep(checkInterval);
346
+ }
341
347
  class TypedEmitter {
342
348
  constructor() {
343
349
  __publicField2(this, "listeners", {});
@@ -2133,7 +2139,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2133
2139
  var _a;
2134
2140
  if (!token) return null;
2135
2141
  else if (token == ((_a = this.user) == null ? void 0 : _a.token)) return this.user;
2136
- else if (typeof navigator != "undefined" && !navigator.onLine && typeof localStorage != "undefined" && localStorage.getItem("datalynk-user"))
2142
+ else if (!this.api.online && typeof localStorage != "undefined" && localStorage.getItem("datalynk-user"))
2137
2143
  return JSON.parse(localStorage.getItem("datalynk-user"));
2138
2144
  return this.api.request([{ "$/auth/current": {} }, { "$/env/me": {} }], { token }).then((resp) => resp[0] || resp[1] ? { ...resp[0], ...resp[1] } : null);
2139
2145
  }
@@ -3070,6 +3076,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3070
3076
  constructor(slice, api) {
3071
3077
  __publicField(this, "table");
3072
3078
  __publicField(this, "info");
3079
+ __publicField(this, "loaded", false);
3073
3080
  __publicField(this, "pendingInsert", 0);
3074
3081
  /** Unsubscribe from changes, undefined if not subscribed */
3075
3082
  __publicField(this, "unsubscribe");
@@ -3080,7 +3087,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3080
3087
  this.api = api;
3081
3088
  if (this.offlineEnabled) {
3082
3089
  this.table = (_a = api.database) == null ? void 0 : _a.table(slice.toString());
3083
- this.table.getAll().then((resp) => this.cache = resp);
3090
+ this.table.getAll().then((resp) => this.cache = resp).finally(() => this.loaded = true);
3084
3091
  this.cache$.pipe(skip(1)).subscribe(async (cache) => {
3085
3092
  var _a2;
3086
3093
  await ((_a2 = this.table) == null ? void 0 : _a2.clear());
@@ -3095,6 +3102,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3095
3102
  if (this.api.expired) await lastValueFrom(this.api.auth.user$.pipe(skip(1), takeWhile((u) => !u || this.api.expired, true)));
3096
3103
  this.pushChanges();
3097
3104
  });
3105
+ } else {
3106
+ this.loaded = true;
3098
3107
  }
3099
3108
  }
3100
3109
  /** Cached slice data */
@@ -3116,7 +3125,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3116
3125
  }
3117
3126
  execWrapper(call) {
3118
3127
  const onlineExec = call.exec.bind(call);
3119
- return () => {
3128
+ return async () => {
3120
3129
  if (this.offlineEnabled && navigator && !(navigator == null ? void 0 : navigator.onLine)) {
3121
3130
  const where = (row, condition) => {
3122
3131
  if (Array.isArray(condition) ? !condition.length : condition == null) return true;
@@ -3134,6 +3143,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3134
3143
  if (condition[0] == "$mod") return where(row, condition[1]) % where(row, condition[2]);
3135
3144
  return condition[0];
3136
3145
  };
3146
+ await sleepWhile(() => !this.loaded);
3137
3147
  let request = call.raw, resp = {};
3138
3148
  if (request["$/slice/delete"]) {
3139
3149
  const found = this.cache.filter((r) => where(r, request["$/slice/delete"]["where"])).map((r) => r.id);
@@ -3188,17 +3198,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3188
3198
  tx: null
3189
3199
  };
3190
3200
  }
3191
- if (request["$pop"]) {
3201
+ if (request["$pop"])
3192
3202
  resp = request["$pop"].split(":").reduce((acc, key) => acc[JSONAttemptParse(key)], resp);
3193
- }
3194
- return Promise.resolve(resp);
3203
+ return resp;
3195
3204
  } else {
3196
3205
  return onlineExec();
3197
3206
  }
3198
3207
  };
3199
3208
  }
3200
3209
  async pushChanges() {
3201
- if (this.offlineEnabled && navigator && navigator.onLine) {
3210
+ if (this.offlineEnabled && this.api.online) {
3202
3211
  await Promise.allSettled(
3203
3212
  this.cache.values().map((value) => {
3204
3213
  if (value._sync == "delete") {
@@ -3261,7 +3270,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3261
3270
  */
3262
3271
  sync(on = true) {
3263
3272
  if (on) {
3264
- this.pushChanges().then(() => this.select().rows().exec().then((rows) => this.cache = rows));
3273
+ this.pushChanges().then(() => this.select().rows().exec().then((rows) => {
3274
+ this.cache = rows;
3275
+ this.loaded = true;
3276
+ }));
3265
3277
  if (!this.unsubscribe) this.unsubscribe = this.api.socket.sliceEvents(this.slice, (event) => {
3266
3278
  const ids = [...event.data.new, ...event.data.changed];
3267
3279
  this.select(ids).rows().exec().then((rows) => this.cache = [...this.cache.filter((c) => c.id != null && !ids.includes(c.id)), ...rows]);
@@ -3378,7 +3390,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3378
3390
  this.close();
3379
3391
  this.connect();
3380
3392
  }, timeout * 1e3);
3381
- if (navigator.onLine) {
3393
+ if (this.api.online) {
3382
3394
  this.socket = new WebSocket(this.options.url + (this.api.token ? `?token=${this.api.token}&origin=${location.href}` : ""));
3383
3395
  this.socket.onopen = () => clearTimeout(this.retry);
3384
3396
  this.socket.onclose = () => {
@@ -3457,7 +3469,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3457
3469
  } });
3458
3470
  }
3459
3471
  }
3460
- const version = "1.3.4";
3472
+ const version = "1.3.5";
3461
3473
  class WebRtc {
3462
3474
  constructor(api) {
3463
3475
  __publicField(this, "ice");
@@ -3595,6 +3607,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3595
3607
  __publicField(this, "bundle", []);
3596
3608
  /** Bundle lifecycle tracking */
3597
3609
  __publicField(this, "bundleOngoing", false);
3610
+ /** Track online state */
3611
+ __publicField(this, "heartbeat", {
3612
+ interval: null,
3613
+ target: "version.php",
3614
+ timeout: 6e4
3615
+ });
3598
3616
  /** LocalStorage key for persisting logins */
3599
3617
  __publicField(this, "localStorageKey", "datalynk-token");
3600
3618
  /** Pending requests cache */
@@ -3624,6 +3642,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3624
3642
  __publicField(this, "url");
3625
3643
  /** Client library version */
3626
3644
  __publicField(this, "version", version);
3645
+ __publicField(this, "onlineOverride", false);
3646
+ __publicField(this, "_online", typeof navigator == "undefined" ? true : navigator.onLine);
3627
3647
  /** API Session token */
3628
3648
  __publicField(this, "token$", new BehaviorSubject(void 0));
3629
3649
  var _a, _b;
@@ -3659,6 +3679,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3659
3679
  this.pwa = new PWA(this);
3660
3680
  this.superuser = new Superuser(this);
3661
3681
  this.webrtc = new WebRtc(this);
3682
+ if (typeof window !== "undefined") {
3683
+ const handleOffline = (state) => {
3684
+ this._online = state;
3685
+ this.offlineBanner();
3686
+ };
3687
+ window.addEventListener("online", () => handleOffline(true));
3688
+ window.addEventListener("offline", () => handleOffline(false));
3689
+ this.startHeartbeat();
3690
+ this.offlineBanner();
3691
+ }
3662
3692
  if ((_a = this.options.offline) == null ? void 0 : _a.length) {
3663
3693
  this.pwa.setup();
3664
3694
  if (typeof indexedDB == "undefined") throw new Error("Cannot enable offline support, indexedDB is not available in this environment");
@@ -3683,15 +3713,36 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3683
3713
  }
3684
3714
  }
3685
3715
  }
3716
+ /** Is token expired */
3717
+ get expired() {
3718
+ var _a;
3719
+ return (((_a = this.jwtPayload) == null ? void 0 : _a.exp) ?? Infinity) * 1e3 <= Date.now();
3720
+ }
3686
3721
  /** Get session info from JWT payload */
3687
3722
  get jwtPayload() {
3688
3723
  if (!this.token) return null;
3689
3724
  return decodeJwt(this.token);
3690
3725
  }
3691
- /** Is token expired */
3692
- get expired() {
3693
- var _a;
3694
- return (((_a = this.jwtPayload) == null ? void 0 : _a.exp) ?? Infinity) * 1e3 <= Date.now();
3726
+ /** Check if we are connected */
3727
+ get online() {
3728
+ return this._online;
3729
+ }
3730
+ get offline() {
3731
+ return !this._online;
3732
+ }
3733
+ /** Override connection status */
3734
+ set online(value) {
3735
+ if (value == null) {
3736
+ this.onlineOverride = false;
3737
+ this._online = typeof navigator == "undefined" ? true : navigator.onLine;
3738
+ } else {
3739
+ this.onlineOverride = true;
3740
+ if (value == this.online) return;
3741
+ this._online = value;
3742
+ if (value) this.startHeartbeat();
3743
+ else this.stopHeartbeat();
3744
+ }
3745
+ this.offlineBanner();
3695
3746
  }
3696
3747
  /** Logged in spoke */
3697
3748
  get spoke() {
@@ -3715,12 +3766,54 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3715
3766
  }),
3716
3767
  body: JSON.stringify(_Api.translateTokens(req))
3717
3768
  }).then(async (resp) => {
3769
+ this.online = true;
3718
3770
  let data = JSONAttemptParse(await resp.text());
3719
3771
  if (!resp.ok || (data == null ? void 0 : data.error)) throw Object.assign(errorFromCode(resp.status, data.error), data);
3720
3772
  if (!options.raw) data = _Api.translateTokens(data);
3721
3773
  return data;
3722
3774
  });
3723
3775
  }
3776
+ async checkConnection() {
3777
+ if (typeof navigator != "undefined" && !navigator.onLine) {
3778
+ this._online = false;
3779
+ return;
3780
+ }
3781
+ if (this.onlineOverride) return;
3782
+ const controller = new AbortController();
3783
+ const timeout = setTimeout(() => controller.abort(), this.heartbeat.timeout);
3784
+ try {
3785
+ const response = await fetch(this.url + this.heartbeat.target, { signal: controller.signal });
3786
+ this._online = response.ok;
3787
+ } catch (error) {
3788
+ this._online = false;
3789
+ } finally {
3790
+ clearTimeout(timeout);
3791
+ }
3792
+ }
3793
+ offlineBanner() {
3794
+ if (this.options.offlineBanner === false || typeof document == "undefined") return;
3795
+ const banner = document.querySelector(".datalynk-offline-banner");
3796
+ if (this.online) {
3797
+ banner == null ? void 0 : banner.remove();
3798
+ } else if (!banner) {
3799
+ const b = document.createElement("div");
3800
+ b.className = "datalynk-offline-banner";
3801
+ Object.assign(b.style, { position: "fixed", [this.options.offlineBanner === "top" ? "top" : "bottom"]: "0", left: "0", right: "0", padding: ".75rem", fontSize: "1rem", fontWeight: "bolder", backgroundColor: "#dc3545", color: "#fff", textAlign: "center", zIndex: "9999" });
3802
+ b.innerHTML = "⚠️ You are offline, please reconnect to sync changes";
3803
+ document.body.appendChild(b);
3804
+ }
3805
+ }
3806
+ startHeartbeat() {
3807
+ this.stopHeartbeat();
3808
+ this.heartbeat.interval = setInterval(() => this.checkConnection(), this.heartbeat.timeout / 2);
3809
+ this.checkConnection();
3810
+ }
3811
+ stopHeartbeat() {
3812
+ if (this.heartbeat.interval) {
3813
+ clearInterval(this.heartbeat.interval);
3814
+ this.heartbeat.interval = null;
3815
+ }
3816
+ }
3724
3817
  /**
3725
3818
  * Get list of slices
3726
3819
  * @return {Promise<number[]>}
package/dist/index.mjs CHANGED
@@ -334,6 +334,12 @@ class PromiseProgress extends Promise {
334
334
  return this.from(super.finally(res));
335
335
  }
336
336
  }
337
+ function sleep(ms) {
338
+ return new Promise((res) => setTimeout(res, ms));
339
+ }
340
+ async function sleepWhile(fn2, checkInterval = 100) {
341
+ while (await fn2()) await sleep(checkInterval);
342
+ }
337
343
  class TypedEmitter {
338
344
  constructor() {
339
345
  __publicField2(this, "listeners", {});
@@ -2129,7 +2135,7 @@ class Auth {
2129
2135
  var _a;
2130
2136
  if (!token) return null;
2131
2137
  else if (token == ((_a = this.user) == null ? void 0 : _a.token)) return this.user;
2132
- else if (typeof navigator != "undefined" && !navigator.onLine && typeof localStorage != "undefined" && localStorage.getItem("datalynk-user"))
2138
+ else if (!this.api.online && typeof localStorage != "undefined" && localStorage.getItem("datalynk-user"))
2133
2139
  return JSON.parse(localStorage.getItem("datalynk-user"));
2134
2140
  return this.api.request([{ "$/auth/current": {} }, { "$/env/me": {} }], { token }).then((resp) => resp[0] || resp[1] ? { ...resp[0], ...resp[1] } : null);
2135
2141
  }
@@ -3066,6 +3072,7 @@ class Slice {
3066
3072
  constructor(slice, api) {
3067
3073
  __publicField(this, "table");
3068
3074
  __publicField(this, "info");
3075
+ __publicField(this, "loaded", false);
3069
3076
  __publicField(this, "pendingInsert", 0);
3070
3077
  /** Unsubscribe from changes, undefined if not subscribed */
3071
3078
  __publicField(this, "unsubscribe");
@@ -3076,7 +3083,7 @@ class Slice {
3076
3083
  this.api = api;
3077
3084
  if (this.offlineEnabled) {
3078
3085
  this.table = (_a = api.database) == null ? void 0 : _a.table(slice.toString());
3079
- this.table.getAll().then((resp) => this.cache = resp);
3086
+ this.table.getAll().then((resp) => this.cache = resp).finally(() => this.loaded = true);
3080
3087
  this.cache$.pipe(skip(1)).subscribe(async (cache) => {
3081
3088
  var _a2;
3082
3089
  await ((_a2 = this.table) == null ? void 0 : _a2.clear());
@@ -3091,6 +3098,8 @@ class Slice {
3091
3098
  if (this.api.expired) await lastValueFrom(this.api.auth.user$.pipe(skip(1), takeWhile((u) => !u || this.api.expired, true)));
3092
3099
  this.pushChanges();
3093
3100
  });
3101
+ } else {
3102
+ this.loaded = true;
3094
3103
  }
3095
3104
  }
3096
3105
  /** Cached slice data */
@@ -3112,7 +3121,7 @@ class Slice {
3112
3121
  }
3113
3122
  execWrapper(call) {
3114
3123
  const onlineExec = call.exec.bind(call);
3115
- return () => {
3124
+ return async () => {
3116
3125
  if (this.offlineEnabled && navigator && !(navigator == null ? void 0 : navigator.onLine)) {
3117
3126
  const where = (row, condition) => {
3118
3127
  if (Array.isArray(condition) ? !condition.length : condition == null) return true;
@@ -3130,6 +3139,7 @@ class Slice {
3130
3139
  if (condition[0] == "$mod") return where(row, condition[1]) % where(row, condition[2]);
3131
3140
  return condition[0];
3132
3141
  };
3142
+ await sleepWhile(() => !this.loaded);
3133
3143
  let request = call.raw, resp = {};
3134
3144
  if (request["$/slice/delete"]) {
3135
3145
  const found = this.cache.filter((r) => where(r, request["$/slice/delete"]["where"])).map((r) => r.id);
@@ -3184,17 +3194,16 @@ class Slice {
3184
3194
  tx: null
3185
3195
  };
3186
3196
  }
3187
- if (request["$pop"]) {
3197
+ if (request["$pop"])
3188
3198
  resp = request["$pop"].split(":").reduce((acc, key) => acc[JSONAttemptParse(key)], resp);
3189
- }
3190
- return Promise.resolve(resp);
3199
+ return resp;
3191
3200
  } else {
3192
3201
  return onlineExec();
3193
3202
  }
3194
3203
  };
3195
3204
  }
3196
3205
  async pushChanges() {
3197
- if (this.offlineEnabled && navigator && navigator.onLine) {
3206
+ if (this.offlineEnabled && this.api.online) {
3198
3207
  await Promise.allSettled(
3199
3208
  this.cache.values().map((value) => {
3200
3209
  if (value._sync == "delete") {
@@ -3257,7 +3266,10 @@ class Slice {
3257
3266
  */
3258
3267
  sync(on = true) {
3259
3268
  if (on) {
3260
- this.pushChanges().then(() => this.select().rows().exec().then((rows) => this.cache = rows));
3269
+ this.pushChanges().then(() => this.select().rows().exec().then((rows) => {
3270
+ this.cache = rows;
3271
+ this.loaded = true;
3272
+ }));
3261
3273
  if (!this.unsubscribe) this.unsubscribe = this.api.socket.sliceEvents(this.slice, (event) => {
3262
3274
  const ids = [...event.data.new, ...event.data.changed];
3263
3275
  this.select(ids).rows().exec().then((rows) => this.cache = [...this.cache.filter((c) => c.id != null && !ids.includes(c.id)), ...rows]);
@@ -3374,7 +3386,7 @@ class Socket {
3374
3386
  this.close();
3375
3387
  this.connect();
3376
3388
  }, timeout * 1e3);
3377
- if (navigator.onLine) {
3389
+ if (this.api.online) {
3378
3390
  this.socket = new WebSocket(this.options.url + (this.api.token ? `?token=${this.api.token}&origin=${location.href}` : ""));
3379
3391
  this.socket.onopen = () => clearTimeout(this.retry);
3380
3392
  this.socket.onclose = () => {
@@ -3453,7 +3465,7 @@ class Superuser {
3453
3465
  } });
3454
3466
  }
3455
3467
  }
3456
- const version = "1.3.4";
3468
+ const version = "1.3.5";
3457
3469
  class WebRtc {
3458
3470
  constructor(api) {
3459
3471
  __publicField(this, "ice");
@@ -3591,6 +3603,12 @@ const _Api = class _Api {
3591
3603
  __publicField(this, "bundle", []);
3592
3604
  /** Bundle lifecycle tracking */
3593
3605
  __publicField(this, "bundleOngoing", false);
3606
+ /** Track online state */
3607
+ __publicField(this, "heartbeat", {
3608
+ interval: null,
3609
+ target: "version.php",
3610
+ timeout: 6e4
3611
+ });
3594
3612
  /** LocalStorage key for persisting logins */
3595
3613
  __publicField(this, "localStorageKey", "datalynk-token");
3596
3614
  /** Pending requests cache */
@@ -3620,6 +3638,8 @@ const _Api = class _Api {
3620
3638
  __publicField(this, "url");
3621
3639
  /** Client library version */
3622
3640
  __publicField(this, "version", version);
3641
+ __publicField(this, "onlineOverride", false);
3642
+ __publicField(this, "_online", typeof navigator == "undefined" ? true : navigator.onLine);
3623
3643
  /** API Session token */
3624
3644
  __publicField(this, "token$", new BehaviorSubject(void 0));
3625
3645
  var _a, _b;
@@ -3655,6 +3675,16 @@ const _Api = class _Api {
3655
3675
  this.pwa = new PWA(this);
3656
3676
  this.superuser = new Superuser(this);
3657
3677
  this.webrtc = new WebRtc(this);
3678
+ if (typeof window !== "undefined") {
3679
+ const handleOffline = (state) => {
3680
+ this._online = state;
3681
+ this.offlineBanner();
3682
+ };
3683
+ window.addEventListener("online", () => handleOffline(true));
3684
+ window.addEventListener("offline", () => handleOffline(false));
3685
+ this.startHeartbeat();
3686
+ this.offlineBanner();
3687
+ }
3658
3688
  if ((_a = this.options.offline) == null ? void 0 : _a.length) {
3659
3689
  this.pwa.setup();
3660
3690
  if (typeof indexedDB == "undefined") throw new Error("Cannot enable offline support, indexedDB is not available in this environment");
@@ -3679,15 +3709,36 @@ const _Api = class _Api {
3679
3709
  }
3680
3710
  }
3681
3711
  }
3712
+ /** Is token expired */
3713
+ get expired() {
3714
+ var _a;
3715
+ return (((_a = this.jwtPayload) == null ? void 0 : _a.exp) ?? Infinity) * 1e3 <= Date.now();
3716
+ }
3682
3717
  /** Get session info from JWT payload */
3683
3718
  get jwtPayload() {
3684
3719
  if (!this.token) return null;
3685
3720
  return decodeJwt(this.token);
3686
3721
  }
3687
- /** Is token expired */
3688
- get expired() {
3689
- var _a;
3690
- return (((_a = this.jwtPayload) == null ? void 0 : _a.exp) ?? Infinity) * 1e3 <= Date.now();
3722
+ /** Check if we are connected */
3723
+ get online() {
3724
+ return this._online;
3725
+ }
3726
+ get offline() {
3727
+ return !this._online;
3728
+ }
3729
+ /** Override connection status */
3730
+ set online(value) {
3731
+ if (value == null) {
3732
+ this.onlineOverride = false;
3733
+ this._online = typeof navigator == "undefined" ? true : navigator.onLine;
3734
+ } else {
3735
+ this.onlineOverride = true;
3736
+ if (value == this.online) return;
3737
+ this._online = value;
3738
+ if (value) this.startHeartbeat();
3739
+ else this.stopHeartbeat();
3740
+ }
3741
+ this.offlineBanner();
3691
3742
  }
3692
3743
  /** Logged in spoke */
3693
3744
  get spoke() {
@@ -3711,12 +3762,54 @@ const _Api = class _Api {
3711
3762
  }),
3712
3763
  body: JSON.stringify(_Api.translateTokens(req))
3713
3764
  }).then(async (resp) => {
3765
+ this.online = true;
3714
3766
  let data = JSONAttemptParse(await resp.text());
3715
3767
  if (!resp.ok || (data == null ? void 0 : data.error)) throw Object.assign(errorFromCode(resp.status, data.error), data);
3716
3768
  if (!options.raw) data = _Api.translateTokens(data);
3717
3769
  return data;
3718
3770
  });
3719
3771
  }
3772
+ async checkConnection() {
3773
+ if (typeof navigator != "undefined" && !navigator.onLine) {
3774
+ this._online = false;
3775
+ return;
3776
+ }
3777
+ if (this.onlineOverride) return;
3778
+ const controller = new AbortController();
3779
+ const timeout = setTimeout(() => controller.abort(), this.heartbeat.timeout);
3780
+ try {
3781
+ const response = await fetch(this.url + this.heartbeat.target, { signal: controller.signal });
3782
+ this._online = response.ok;
3783
+ } catch (error) {
3784
+ this._online = false;
3785
+ } finally {
3786
+ clearTimeout(timeout);
3787
+ }
3788
+ }
3789
+ offlineBanner() {
3790
+ if (this.options.offlineBanner === false || typeof document == "undefined") return;
3791
+ const banner = document.querySelector(".datalynk-offline-banner");
3792
+ if (this.online) {
3793
+ banner == null ? void 0 : banner.remove();
3794
+ } else if (!banner) {
3795
+ const b = document.createElement("div");
3796
+ b.className = "datalynk-offline-banner";
3797
+ Object.assign(b.style, { position: "fixed", [this.options.offlineBanner === "top" ? "top" : "bottom"]: "0", left: "0", right: "0", padding: ".75rem", fontSize: "1rem", fontWeight: "bolder", backgroundColor: "#dc3545", color: "#fff", textAlign: "center", zIndex: "9999" });
3798
+ b.innerHTML = "⚠️ You are offline, please reconnect to sync changes";
3799
+ document.body.appendChild(b);
3800
+ }
3801
+ }
3802
+ startHeartbeat() {
3803
+ this.stopHeartbeat();
3804
+ this.heartbeat.interval = setInterval(() => this.checkConnection(), this.heartbeat.timeout / 2);
3805
+ this.checkConnection();
3806
+ }
3807
+ stopHeartbeat() {
3808
+ if (this.heartbeat.interval) {
3809
+ clearInterval(this.heartbeat.interval);
3810
+ this.heartbeat.interval = null;
3811
+ }
3812
+ }
3720
3813
  /**
3721
3814
  * Get list of slices
3722
3815
  * @return {Promise<number[]>}
package/dist/slice.d.ts CHANGED
@@ -233,6 +233,7 @@ export declare class Slice<T extends Meta = any> {
233
233
  private api;
234
234
  private table?;
235
235
  private info?;
236
+ private loaded;
236
237
  private pendingInsert;
237
238
  /** Unsubscribe from changes, undefined if not subscribed */
238
239
  unsubscribe?: Unsubscribe | null;
@@ -1 +1 @@
1
- {"version":3,"file":"slice.d.ts","sourceRoot":"","sources":["../src/slice.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAiC,MAAM,MAAM,CAAC;AACrE,OAAO,EAAC,GAAG,EAAE,iBAAiB,EAAC,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAC,IAAI,EAAE,SAAS,EAAC,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAmB,WAAW,EAAC,MAAM,UAAU,CAAC;AAEvD,qBAAa,OAAO,CAAC,CAAC,SAAS,IAAI,GAAG,GAAG;IAmB5B,OAAO,CAAC,QAAQ,CAAC,GAAG;aAAuB,KAAK,EAAE,MAAM,GAAG,MAAM;IAlB7E,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAgB;IACjC,OAAO,CAAC,OAAO,CAAW;IAE1B,iCAAiC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,0BAA0B;IAC1B,IAAI,GAAG;;;OAQN;gBAE4B,GAAG,EAAE,GAAG,EAAkB,KAAK,EAAE,MAAM,GAAG,MAAM;IAE7E;;;;;;;;;OASG;IACH,KAAK;oBA0Ga,MAAM,EAAE,GAAG,IAAI;gBACnB;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;SAAE,GAAG,IAAI;MA3GnC;IAEpB;;;;;;;;;;;OAWG;IACH,GAAG,IAAI,IAAI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E;IAO7B;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE;CAKpB"}
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.3.4",
5
+ "version": "1.3.5",
6
6
  "author": "Zak Timson <zaktimson@gmail.com>",
7
7
  "private": false,
8
8
  "main": "./dist/index.cjs",