@auxilium/datalynk-client 1.3.4 → 1.3.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/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 */
@@ -56,9 +58,9 @@ export type ApiOptions = {
56
58
  };
57
59
  /** Progressive Web App settings */
58
60
  pwaSettings?: {
59
- /** How long to wait before showing install prompt (seconds). Default is 30 seconds */
61
+ /** How long to wait before showing the installation prompt (seconds). Default is 30 seconds */
60
62
  timeout?: number;
61
- /** Days until dismissed prompt can show again. If set to 0 it will trigger every refresh. (Default is 7 days) */
63
+ /** Days until the dismissed prompt can show again. If set to `0` it will trigger every refresh. (Default is 7 days) */
62
64
  dismissExpiry?: number;
63
65
  /** Show PWA install link on login screen. Default is False */
64
66
  loginLink?: boolean;
@@ -70,6 +72,8 @@ export type ApiOptions = {
70
72
  export interface ApiRequestOptions {
71
73
  /** Skip bundling & caching */
72
74
  noOptimize?: boolean;
75
+ /** Queue for network connection */
76
+ offline?: boolean;
73
77
  /** Skip the token translating step */
74
78
  raw?: boolean;
75
79
  /** Set request token */
@@ -97,6 +101,8 @@ export declare class Api {
97
101
  private bundle;
98
102
  /** Bundle lifecycle tracking */
99
103
  private bundleOngoing;
104
+ /** Track online state */
105
+ private heartbeat;
100
106
  /** LocalStorage key for persisting logins */
101
107
  private localStorageKey;
102
108
  /** Pending requests cache */
@@ -121,15 +127,22 @@ export declare class Api {
121
127
  /** Options */
122
128
  options: ApiOptions;
123
129
  /** Created slices */
124
- sliceCache: Map<number, Slice<any>>;
130
+ sliceCache: Map<number, Slice>;
125
131
  /** API URL */
126
132
  url: string;
127
133
  /** Client library version */
128
134
  version: string;
129
- /** Get session info from JWT payload */
130
- get jwtPayload(): JwtPayload | null;
131
135
  /** Is token expired */
132
136
  get expired(): boolean;
137
+ /** Get session info from JWT payload */
138
+ get jwtPayload(): JwtPayload | null;
139
+ private onlineOverride;
140
+ online$: BehaviorSubject<boolean>;
141
+ /** Check if we are connected */
142
+ get online(): boolean | null;
143
+ get offline(): boolean;
144
+ /** Override connection status */
145
+ set online(value: boolean | null);
133
146
  /** Logged in spoke */
134
147
  get spoke(): string;
135
148
  /** API Session token */
@@ -149,6 +162,10 @@ export declare class Api {
149
162
  */
150
163
  constructor(origin: string, options?: ApiOptions);
151
164
  private _request;
165
+ private checkConnection;
166
+ private offlineBanner;
167
+ private startHeartbeat;
168
+ private stopHeartbeat;
152
169
  /**
153
170
  * Get list of slices
154
171
  * @return {Promise<number[]>}
@@ -177,13 +194,16 @@ export declare class Api {
177
194
  [key: string]: any;
178
195
  }): Promise<any>;
179
196
  /**
180
- * Exact same as `request` method, but logs the response in the console automatically
197
+ * Exact same as the `request` method, but logs the response in the console automatically
181
198
  *
182
199
  * @param {object | string} data Datalynk request as object or string
183
200
  * @param {ApiRequestOptions} options
184
201
  * @returns {Promise<any>} Datalynk response
185
202
  */
186
203
  debug<T = any>(data: any, options?: ApiRequestOptions): Promise<T>;
204
+ debug<T = any>(data: any, options: {
205
+ offline: true;
206
+ } & ApiRequestOptions): Promise<T | void>;
187
207
  /**
188
208
  * Send a request to Datalynk
189
209
  *
@@ -197,6 +217,9 @@ export declare class Api {
197
217
  * @returns {Promise<any>} Datalynk response or error
198
218
  */
199
219
  request<T = any>(data: any, options?: ApiRequestOptions): Promise<T>;
220
+ request<T = any>(data: any, options: {
221
+ offline: true;
222
+ } & ApiRequestOptions): Promise<T | void>;
200
223
  /**
201
224
  * Create a slice object using the API
202
225
  *
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,EAA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C,aAAa;IAOrB;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAQ9B;;;;;;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,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,CAAC;IAClE,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE;QAAC,OAAO,EAAE,IAAI,CAAA;KAAC,GAAG,iBAAiB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAWjG;;;;;;;;;;;OAWG;IACI,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE;QAAC,OAAO,EAAE,IAAI,CAAA;KAAC,GAAG,iBAAiB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IA2CnG;;;;;;;;;;;;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
  }
@@ -3060,7 +3066,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3060
3066
  return this;
3061
3067
  }
3062
3068
  }
3063
- class Slice {
3069
+ const _Slice = class _Slice {
3064
3070
  /**
3065
3071
  * An object to aid in constructing requests
3066
3072
  *
@@ -3070,17 +3076,21 @@ 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");
3073
- __publicField(this, "pendingInsert", 0);
3074
- /** Unsubscribe from changes, undefined if not subscribed */
3075
- __publicField(this, "unsubscribe");
3079
+ __publicField(this, "loaded", false);
3076
3080
  /** Cached slice data as an observable */
3077
3081
  __publicField(this, "cache$", new BehaviorSubject([]));
3082
+ /** Unsubscribe from changes, undefined if not subscribed */
3083
+ __publicField(this, "unsubscribe");
3078
3084
  var _a;
3079
3085
  this.slice = slice;
3080
3086
  this.api = api;
3081
3087
  if (this.offlineEnabled) {
3082
3088
  this.table = (_a = api.database) == null ? void 0 : _a.table(slice.toString());
3083
- this.table.getAll().then((resp) => this.cache = resp);
3089
+ this.table.getAll().then((resp) => {
3090
+ this.cache = resp;
3091
+ const lowest = resp.reduce((acc, r) => Math.min(acc, r.id), 0);
3092
+ if (lowest < _Slice.nextId) _Slice.nextId = lowest;
3093
+ }).finally(() => this.loaded = true);
3084
3094
  this.cache$.pipe(skip(1)).subscribe(async (cache) => {
3085
3095
  var _a2;
3086
3096
  await ((_a2 = this.table) == null ? void 0 : _a2.clear());
@@ -3088,13 +3098,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3088
3098
  var _a3;
3089
3099
  return (_a3 = this.table) == null ? void 0 : _a3.put(c.id, c);
3090
3100
  }));
3091
- this.fixIncrement();
3092
3101
  });
3093
3102
  this.sync();
3094
- window.addEventListener("online", async () => {
3103
+ this.api.online$.subscribe(async (online) => {
3104
+ if (!online) return;
3095
3105
  if (this.api.expired) await lastValueFrom(this.api.auth.user$.pipe(skip(1), takeWhile((u) => !u || this.api.expired, true)));
3096
3106
  this.pushChanges();
3097
3107
  });
3108
+ } else {
3109
+ this.loaded = true;
3098
3110
  }
3099
3111
  }
3100
3112
  /** Cached slice data */
@@ -3110,13 +3122,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3110
3122
  var _a;
3111
3123
  return (_a = this.api.database) == null ? void 0 : _a.includes(this.slice.toString());
3112
3124
  }
3113
- fixIncrement() {
3114
- var _a;
3115
- this.pendingInsert = ((_a = this.cache.toSorted(sortByProp("id")).pop()) == null ? void 0 : _a["id"]) || 0;
3116
- }
3117
3125
  execWrapper(call) {
3118
3126
  const onlineExec = call.exec.bind(call);
3119
- return () => {
3127
+ return async () => {
3120
3128
  if (this.offlineEnabled && navigator && !(navigator == null ? void 0 : navigator.onLine)) {
3121
3129
  const where = (row, condition) => {
3122
3130
  if (Array.isArray(condition) ? !condition.length : condition == null) return true;
@@ -3134,6 +3142,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3134
3142
  if (condition[0] == "$mod") return where(row, condition[1]) % where(row, condition[2]);
3135
3143
  return condition[0];
3136
3144
  };
3145
+ await sleepWhile(() => !this.loaded);
3137
3146
  let request = call.raw, resp = {};
3138
3147
  if (request["$/slice/delete"]) {
3139
3148
  const found = this.cache.filter((r) => where(r, request["$/slice/delete"]["where"])).map((r) => r.id);
@@ -3158,7 +3167,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3158
3167
  } else if (request["$/slice/xinsert"]) {
3159
3168
  const rows = request["$/slice/xinsert"]["rows"].map((r) => ({
3160
3169
  ...r,
3161
- id: -++this.pendingInsert,
3170
+ id: --_Slice.nextId,
3162
3171
  _sync: "insert"
3163
3172
  }));
3164
3173
  this.cache = [...this.cache, ...rows];
@@ -3188,17 +3197,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3188
3197
  tx: null
3189
3198
  };
3190
3199
  }
3191
- if (request["$pop"]) {
3200
+ if (request["$pop"])
3192
3201
  resp = request["$pop"].split(":").reduce((acc, key) => acc[JSONAttemptParse(key)], resp);
3193
- }
3194
- return Promise.resolve(resp);
3202
+ return resp;
3195
3203
  } else {
3196
3204
  return onlineExec();
3197
3205
  }
3198
3206
  };
3199
3207
  }
3200
3208
  async pushChanges() {
3201
- if (this.offlineEnabled && navigator && navigator.onLine) {
3209
+ if (this.offlineEnabled && this.api.online) {
3202
3210
  await Promise.allSettled(
3203
3211
  this.cache.values().map((value) => {
3204
3212
  if (value._sync == "delete") {
@@ -3261,7 +3269,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3261
3269
  */
3262
3270
  sync(on = true) {
3263
3271
  if (on) {
3264
- this.pushChanges().then(() => this.select().rows().exec().then((rows) => this.cache = rows));
3272
+ this.pushChanges().then(() => this.select().rows().exec().then((rows) => {
3273
+ this.cache = rows;
3274
+ this.loaded = true;
3275
+ }));
3265
3276
  if (!this.unsubscribe) this.unsubscribe = this.api.socket.sliceEvents(this.slice, (event) => {
3266
3277
  const ids = [...event.data.new, ...event.data.changed];
3267
3278
  this.select(ids).rows().exec().then((rows) => this.cache = [...this.cache.filter((c) => c.id != null && !ids.includes(c.id)), ...rows]);
@@ -3322,7 +3333,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3322
3333
  call.exec = this.execWrapper(call);
3323
3334
  return call.update(rows);
3324
3335
  }
3325
- }
3336
+ };
3337
+ __publicField(_Slice, "idMap", {});
3338
+ __publicField(_Slice, "nextId", 0);
3339
+ let Slice = _Slice;
3326
3340
  class Socket {
3327
3341
  constructor(api, options = {}) {
3328
3342
  __publicField(this, "listeners", []);
@@ -3378,7 +3392,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3378
3392
  this.close();
3379
3393
  this.connect();
3380
3394
  }, timeout * 1e3);
3381
- if (navigator.onLine) {
3395
+ if (this.api.online) {
3382
3396
  this.socket = new WebSocket(this.options.url + (this.api.token ? `?token=${this.api.token}&origin=${location.href}` : ""));
3383
3397
  this.socket.onopen = () => clearTimeout(this.retry);
3384
3398
  this.socket.onclose = () => {
@@ -3457,7 +3471,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3457
3471
  } });
3458
3472
  }
3459
3473
  }
3460
- const version = "1.3.4";
3474
+ const version = "1.3.6";
3461
3475
  class WebRtc {
3462
3476
  constructor(api) {
3463
3477
  __publicField(this, "ice");
@@ -3595,6 +3609,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3595
3609
  __publicField(this, "bundle", []);
3596
3610
  /** Bundle lifecycle tracking */
3597
3611
  __publicField(this, "bundleOngoing", false);
3612
+ /** Track online state */
3613
+ __publicField(this, "heartbeat", {
3614
+ interval: null,
3615
+ target: "version.php",
3616
+ timeout: 6e4
3617
+ });
3598
3618
  /** LocalStorage key for persisting logins */
3599
3619
  __publicField(this, "localStorageKey", "datalynk-token");
3600
3620
  /** Pending requests cache */
@@ -3624,6 +3644,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3624
3644
  __publicField(this, "url");
3625
3645
  /** Client library version */
3626
3646
  __publicField(this, "version", version);
3647
+ __publicField(this, "onlineOverride", false);
3648
+ __publicField(this, "online$", new BehaviorSubject(typeof navigator == "undefined" ? true : navigator.onLine));
3627
3649
  /** API Session token */
3628
3650
  __publicField(this, "token$", new BehaviorSubject(void 0));
3629
3651
  var _a, _b;
@@ -3659,10 +3681,28 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3659
3681
  this.pwa = new PWA(this);
3660
3682
  this.superuser = new Superuser(this);
3661
3683
  this.webrtc = new WebRtc(this);
3684
+ this.database = new Database("datalynk", ["pending", ...this.options.offline || []]);
3685
+ this.online$.subscribe(async (online) => {
3686
+ var _a2;
3687
+ if (!online) return;
3688
+ const table = (_a2 = this.database) == null ? void 0 : _a2.table("pending");
3689
+ const keys = await (table == null ? void 0 : table.getAllKeys());
3690
+ await Promise.allSettled(keys.map(async (k) => {
3691
+ const r = await (table == null ? void 0 : table.get(k));
3692
+ await this.request(r).then(() => table == null ? void 0 : table.delete(k));
3693
+ }));
3694
+ });
3695
+ if (typeof window !== "undefined") {
3696
+ const handleOffline = (state = this.offline) => {
3697
+ if (this.online != state) this.online$.next(state);
3698
+ };
3699
+ window.addEventListener("online", () => handleOffline(true));
3700
+ window.addEventListener("offline", () => handleOffline(false));
3701
+ this.online$.subscribe(() => this.offlineBanner());
3702
+ }
3662
3703
  if ((_a = this.options.offline) == null ? void 0 : _a.length) {
3663
3704
  this.pwa.setup();
3664
3705
  if (typeof indexedDB == "undefined") throw new Error("Cannot enable offline support, indexedDB is not available in this environment");
3665
- this.database = new Database("datalynk", this.options.offline);
3666
3706
  (_b = this.options.offline) == null ? void 0 : _b.forEach((id) => this.slice(id));
3667
3707
  if (this.options.serviceWorker && typeof navigator["serviceWorker"] != "undefined") {
3668
3708
  (async () => {
@@ -3683,15 +3723,35 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3683
3723
  }
3684
3724
  }
3685
3725
  }
3726
+ /** Is token expired */
3727
+ get expired() {
3728
+ var _a;
3729
+ return (((_a = this.jwtPayload) == null ? void 0 : _a.exp) ?? Infinity) * 1e3 <= Date.now();
3730
+ }
3686
3731
  /** Get session info from JWT payload */
3687
3732
  get jwtPayload() {
3688
3733
  if (!this.token) return null;
3689
3734
  return decodeJwt(this.token);
3690
3735
  }
3691
- /** Is token expired */
3692
- get expired() {
3693
- var _a;
3694
- return (((_a = this.jwtPayload) == null ? void 0 : _a.exp) ?? Infinity) * 1e3 <= Date.now();
3736
+ /** Check if we are connected */
3737
+ get online() {
3738
+ return this.online$.getValue();
3739
+ }
3740
+ get offline() {
3741
+ return !this.online;
3742
+ }
3743
+ /** Override connection status */
3744
+ set online(value) {
3745
+ if (value == null) {
3746
+ this.onlineOverride = false;
3747
+ this.online$.next(typeof navigator == "undefined" ? true : navigator.onLine);
3748
+ } else {
3749
+ this.onlineOverride = true;
3750
+ if (value == this.online) return;
3751
+ this.online$.next(value);
3752
+ if (value) this.startHeartbeat();
3753
+ else this.stopHeartbeat();
3754
+ }
3695
3755
  }
3696
3756
  /** Logged in spoke */
3697
3757
  get spoke() {
@@ -3715,12 +3775,56 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3715
3775
  }),
3716
3776
  body: JSON.stringify(_Api.translateTokens(req))
3717
3777
  }).then(async (resp) => {
3778
+ const warning = resp.headers["X-Warning"];
3779
+ if (warning) console.warn(warning);
3780
+ this.online = true;
3718
3781
  let data = JSONAttemptParse(await resp.text());
3719
3782
  if (!resp.ok || (data == null ? void 0 : data.error)) throw Object.assign(errorFromCode(resp.status, data.error), data);
3720
3783
  if (!options.raw) data = _Api.translateTokens(data);
3721
3784
  return data;
3722
3785
  });
3723
3786
  }
3787
+ async checkConnection() {
3788
+ if (typeof navigator != "undefined" && !navigator.onLine) {
3789
+ this.online$.next(false);
3790
+ return;
3791
+ }
3792
+ if (this.onlineOverride) return;
3793
+ const controller = new AbortController();
3794
+ const timeout = setTimeout(() => controller.abort(), this.heartbeat.timeout);
3795
+ try {
3796
+ const response = await fetch(this.url + this.heartbeat.target, { signal: controller.signal });
3797
+ this.online$.next(response.ok);
3798
+ } catch (error) {
3799
+ this.online$.next(false);
3800
+ } finally {
3801
+ clearTimeout(timeout);
3802
+ }
3803
+ }
3804
+ offlineBanner() {
3805
+ if (this.options.offlineBanner === false || typeof document == "undefined") return;
3806
+ const banner = document.querySelector(".datalynk-offline-banner");
3807
+ if (this.online) {
3808
+ banner == null ? void 0 : banner.remove();
3809
+ } else if (!banner) {
3810
+ const b = document.createElement("div");
3811
+ b.className = "datalynk-offline-banner";
3812
+ 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" });
3813
+ b.innerHTML = "⚠️ You are offline, please reconnect to sync changes";
3814
+ document.body.appendChild(b);
3815
+ }
3816
+ }
3817
+ startHeartbeat() {
3818
+ this.stopHeartbeat();
3819
+ this.heartbeat.interval = setInterval(() => this.checkConnection(), this.heartbeat.timeout / 2);
3820
+ this.checkConnection();
3821
+ }
3822
+ stopHeartbeat() {
3823
+ if (this.heartbeat.interval) {
3824
+ clearInterval(this.heartbeat.interval);
3825
+ this.heartbeat.interval = null;
3826
+ }
3827
+ }
3724
3828
  /**
3725
3829
  * Get list of slices
3726
3830
  * @return {Promise<number[]>}
@@ -3803,13 +3907,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3803
3907
  { "$_": "*" }
3804
3908
  ] }, {});
3805
3909
  }
3806
- /**
3807
- * Exact same as `request` method, but logs the response in the console automatically
3808
- *
3809
- * @param {object | string} data Datalynk request as object or string
3810
- * @param {ApiRequestOptions} options
3811
- * @returns {Promise<any>} Datalynk response
3812
- */
3813
3910
  debug(data, options = {}) {
3814
3911
  return this.request(data, options).then((data2) => {
3815
3912
  console.log(data2);
@@ -3819,20 +3916,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3819
3916
  return err;
3820
3917
  });
3821
3918
  }
3822
- /**
3823
- * Send a request to Datalynk
3824
- *
3825
- * @example
3826
- * ```ts
3827
- * const response = await api.request('$/auth/current');
3828
- * ```
3829
- *
3830
- * @param {object} data Request using Datalynk API syntax. Strings will be converted: '$/auth/current' -> {'$/auth/current': {}}
3831
- * @param {ApiRequestOptions} options
3832
- * @returns {Promise<any>} Datalynk response or error
3833
- */
3834
3919
  request(data, options = {}) {
3920
+ var _a, _b;
3835
3921
  data = typeof data == "string" ? { [data]: {} } : data;
3922
+ let key = JSON.stringify(data);
3923
+ if (this.offline) {
3924
+ (_b = (_a = this.database) == null ? void 0 : _a.table("pending")) == null ? void 0 : _b.add(data, key);
3925
+ return Promise.resolve();
3926
+ }
3836
3927
  if (options.noOptimize) {
3837
3928
  return new Promise((res, rej) => {
3838
3929
  this._request(data, options).then((resp) => {
@@ -3840,7 +3931,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3840
3931
  }).catch((err) => rej(err));
3841
3932
  });
3842
3933
  }
3843
- let key = JSON.stringify(data);
3844
3934
  if (!this.pending[key]) {
3845
3935
  this.pending[key] = new Promise((res, rej) => this.bundle.push({ data, res, rej }));
3846
3936
  this.pending[key].catch().then(() => delete this.pending[key]);
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
  }
@@ -3056,7 +3062,7 @@ class ApiCall {
3056
3062
  return this;
3057
3063
  }
3058
3064
  }
3059
- class Slice {
3065
+ const _Slice = class _Slice {
3060
3066
  /**
3061
3067
  * An object to aid in constructing requests
3062
3068
  *
@@ -3066,17 +3072,21 @@ class Slice {
3066
3072
  constructor(slice, api) {
3067
3073
  __publicField(this, "table");
3068
3074
  __publicField(this, "info");
3069
- __publicField(this, "pendingInsert", 0);
3070
- /** Unsubscribe from changes, undefined if not subscribed */
3071
- __publicField(this, "unsubscribe");
3075
+ __publicField(this, "loaded", false);
3072
3076
  /** Cached slice data as an observable */
3073
3077
  __publicField(this, "cache$", new BehaviorSubject([]));
3078
+ /** Unsubscribe from changes, undefined if not subscribed */
3079
+ __publicField(this, "unsubscribe");
3074
3080
  var _a;
3075
3081
  this.slice = slice;
3076
3082
  this.api = api;
3077
3083
  if (this.offlineEnabled) {
3078
3084
  this.table = (_a = api.database) == null ? void 0 : _a.table(slice.toString());
3079
- this.table.getAll().then((resp) => this.cache = resp);
3085
+ this.table.getAll().then((resp) => {
3086
+ this.cache = resp;
3087
+ const lowest = resp.reduce((acc, r) => Math.min(acc, r.id), 0);
3088
+ if (lowest < _Slice.nextId) _Slice.nextId = lowest;
3089
+ }).finally(() => this.loaded = true);
3080
3090
  this.cache$.pipe(skip(1)).subscribe(async (cache) => {
3081
3091
  var _a2;
3082
3092
  await ((_a2 = this.table) == null ? void 0 : _a2.clear());
@@ -3084,13 +3094,15 @@ class Slice {
3084
3094
  var _a3;
3085
3095
  return (_a3 = this.table) == null ? void 0 : _a3.put(c.id, c);
3086
3096
  }));
3087
- this.fixIncrement();
3088
3097
  });
3089
3098
  this.sync();
3090
- window.addEventListener("online", async () => {
3099
+ this.api.online$.subscribe(async (online) => {
3100
+ if (!online) return;
3091
3101
  if (this.api.expired) await lastValueFrom(this.api.auth.user$.pipe(skip(1), takeWhile((u) => !u || this.api.expired, true)));
3092
3102
  this.pushChanges();
3093
3103
  });
3104
+ } else {
3105
+ this.loaded = true;
3094
3106
  }
3095
3107
  }
3096
3108
  /** Cached slice data */
@@ -3106,13 +3118,9 @@ class Slice {
3106
3118
  var _a;
3107
3119
  return (_a = this.api.database) == null ? void 0 : _a.includes(this.slice.toString());
3108
3120
  }
3109
- fixIncrement() {
3110
- var _a;
3111
- this.pendingInsert = ((_a = this.cache.toSorted(sortByProp("id")).pop()) == null ? void 0 : _a["id"]) || 0;
3112
- }
3113
3121
  execWrapper(call) {
3114
3122
  const onlineExec = call.exec.bind(call);
3115
- return () => {
3123
+ return async () => {
3116
3124
  if (this.offlineEnabled && navigator && !(navigator == null ? void 0 : navigator.onLine)) {
3117
3125
  const where = (row, condition) => {
3118
3126
  if (Array.isArray(condition) ? !condition.length : condition == null) return true;
@@ -3130,6 +3138,7 @@ class Slice {
3130
3138
  if (condition[0] == "$mod") return where(row, condition[1]) % where(row, condition[2]);
3131
3139
  return condition[0];
3132
3140
  };
3141
+ await sleepWhile(() => !this.loaded);
3133
3142
  let request = call.raw, resp = {};
3134
3143
  if (request["$/slice/delete"]) {
3135
3144
  const found = this.cache.filter((r) => where(r, request["$/slice/delete"]["where"])).map((r) => r.id);
@@ -3154,7 +3163,7 @@ class Slice {
3154
3163
  } else if (request["$/slice/xinsert"]) {
3155
3164
  const rows = request["$/slice/xinsert"]["rows"].map((r) => ({
3156
3165
  ...r,
3157
- id: -++this.pendingInsert,
3166
+ id: --_Slice.nextId,
3158
3167
  _sync: "insert"
3159
3168
  }));
3160
3169
  this.cache = [...this.cache, ...rows];
@@ -3184,17 +3193,16 @@ class Slice {
3184
3193
  tx: null
3185
3194
  };
3186
3195
  }
3187
- if (request["$pop"]) {
3196
+ if (request["$pop"])
3188
3197
  resp = request["$pop"].split(":").reduce((acc, key) => acc[JSONAttemptParse(key)], resp);
3189
- }
3190
- return Promise.resolve(resp);
3198
+ return resp;
3191
3199
  } else {
3192
3200
  return onlineExec();
3193
3201
  }
3194
3202
  };
3195
3203
  }
3196
3204
  async pushChanges() {
3197
- if (this.offlineEnabled && navigator && navigator.onLine) {
3205
+ if (this.offlineEnabled && this.api.online) {
3198
3206
  await Promise.allSettled(
3199
3207
  this.cache.values().map((value) => {
3200
3208
  if (value._sync == "delete") {
@@ -3257,7 +3265,10 @@ class Slice {
3257
3265
  */
3258
3266
  sync(on = true) {
3259
3267
  if (on) {
3260
- this.pushChanges().then(() => this.select().rows().exec().then((rows) => this.cache = rows));
3268
+ this.pushChanges().then(() => this.select().rows().exec().then((rows) => {
3269
+ this.cache = rows;
3270
+ this.loaded = true;
3271
+ }));
3261
3272
  if (!this.unsubscribe) this.unsubscribe = this.api.socket.sliceEvents(this.slice, (event) => {
3262
3273
  const ids = [...event.data.new, ...event.data.changed];
3263
3274
  this.select(ids).rows().exec().then((rows) => this.cache = [...this.cache.filter((c) => c.id != null && !ids.includes(c.id)), ...rows]);
@@ -3318,7 +3329,10 @@ class Slice {
3318
3329
  call.exec = this.execWrapper(call);
3319
3330
  return call.update(rows);
3320
3331
  }
3321
- }
3332
+ };
3333
+ __publicField(_Slice, "idMap", {});
3334
+ __publicField(_Slice, "nextId", 0);
3335
+ let Slice = _Slice;
3322
3336
  class Socket {
3323
3337
  constructor(api, options = {}) {
3324
3338
  __publicField(this, "listeners", []);
@@ -3374,7 +3388,7 @@ class Socket {
3374
3388
  this.close();
3375
3389
  this.connect();
3376
3390
  }, timeout * 1e3);
3377
- if (navigator.onLine) {
3391
+ if (this.api.online) {
3378
3392
  this.socket = new WebSocket(this.options.url + (this.api.token ? `?token=${this.api.token}&origin=${location.href}` : ""));
3379
3393
  this.socket.onopen = () => clearTimeout(this.retry);
3380
3394
  this.socket.onclose = () => {
@@ -3453,7 +3467,7 @@ class Superuser {
3453
3467
  } });
3454
3468
  }
3455
3469
  }
3456
- const version = "1.3.4";
3470
+ const version = "1.3.6";
3457
3471
  class WebRtc {
3458
3472
  constructor(api) {
3459
3473
  __publicField(this, "ice");
@@ -3591,6 +3605,12 @@ const _Api = class _Api {
3591
3605
  __publicField(this, "bundle", []);
3592
3606
  /** Bundle lifecycle tracking */
3593
3607
  __publicField(this, "bundleOngoing", false);
3608
+ /** Track online state */
3609
+ __publicField(this, "heartbeat", {
3610
+ interval: null,
3611
+ target: "version.php",
3612
+ timeout: 6e4
3613
+ });
3594
3614
  /** LocalStorage key for persisting logins */
3595
3615
  __publicField(this, "localStorageKey", "datalynk-token");
3596
3616
  /** Pending requests cache */
@@ -3620,6 +3640,8 @@ const _Api = class _Api {
3620
3640
  __publicField(this, "url");
3621
3641
  /** Client library version */
3622
3642
  __publicField(this, "version", version);
3643
+ __publicField(this, "onlineOverride", false);
3644
+ __publicField(this, "online$", new BehaviorSubject(typeof navigator == "undefined" ? true : navigator.onLine));
3623
3645
  /** API Session token */
3624
3646
  __publicField(this, "token$", new BehaviorSubject(void 0));
3625
3647
  var _a, _b;
@@ -3655,10 +3677,28 @@ const _Api = class _Api {
3655
3677
  this.pwa = new PWA(this);
3656
3678
  this.superuser = new Superuser(this);
3657
3679
  this.webrtc = new WebRtc(this);
3680
+ this.database = new Database("datalynk", ["pending", ...this.options.offline || []]);
3681
+ this.online$.subscribe(async (online) => {
3682
+ var _a2;
3683
+ if (!online) return;
3684
+ const table = (_a2 = this.database) == null ? void 0 : _a2.table("pending");
3685
+ const keys = await (table == null ? void 0 : table.getAllKeys());
3686
+ await Promise.allSettled(keys.map(async (k) => {
3687
+ const r = await (table == null ? void 0 : table.get(k));
3688
+ await this.request(r).then(() => table == null ? void 0 : table.delete(k));
3689
+ }));
3690
+ });
3691
+ if (typeof window !== "undefined") {
3692
+ const handleOffline = (state = this.offline) => {
3693
+ if (this.online != state) this.online$.next(state);
3694
+ };
3695
+ window.addEventListener("online", () => handleOffline(true));
3696
+ window.addEventListener("offline", () => handleOffline(false));
3697
+ this.online$.subscribe(() => this.offlineBanner());
3698
+ }
3658
3699
  if ((_a = this.options.offline) == null ? void 0 : _a.length) {
3659
3700
  this.pwa.setup();
3660
3701
  if (typeof indexedDB == "undefined") throw new Error("Cannot enable offline support, indexedDB is not available in this environment");
3661
- this.database = new Database("datalynk", this.options.offline);
3662
3702
  (_b = this.options.offline) == null ? void 0 : _b.forEach((id) => this.slice(id));
3663
3703
  if (this.options.serviceWorker && typeof navigator["serviceWorker"] != "undefined") {
3664
3704
  (async () => {
@@ -3679,15 +3719,35 @@ const _Api = class _Api {
3679
3719
  }
3680
3720
  }
3681
3721
  }
3722
+ /** Is token expired */
3723
+ get expired() {
3724
+ var _a;
3725
+ return (((_a = this.jwtPayload) == null ? void 0 : _a.exp) ?? Infinity) * 1e3 <= Date.now();
3726
+ }
3682
3727
  /** Get session info from JWT payload */
3683
3728
  get jwtPayload() {
3684
3729
  if (!this.token) return null;
3685
3730
  return decodeJwt(this.token);
3686
3731
  }
3687
- /** Is token expired */
3688
- get expired() {
3689
- var _a;
3690
- return (((_a = this.jwtPayload) == null ? void 0 : _a.exp) ?? Infinity) * 1e3 <= Date.now();
3732
+ /** Check if we are connected */
3733
+ get online() {
3734
+ return this.online$.getValue();
3735
+ }
3736
+ get offline() {
3737
+ return !this.online;
3738
+ }
3739
+ /** Override connection status */
3740
+ set online(value) {
3741
+ if (value == null) {
3742
+ this.onlineOverride = false;
3743
+ this.online$.next(typeof navigator == "undefined" ? true : navigator.onLine);
3744
+ } else {
3745
+ this.onlineOverride = true;
3746
+ if (value == this.online) return;
3747
+ this.online$.next(value);
3748
+ if (value) this.startHeartbeat();
3749
+ else this.stopHeartbeat();
3750
+ }
3691
3751
  }
3692
3752
  /** Logged in spoke */
3693
3753
  get spoke() {
@@ -3711,12 +3771,56 @@ const _Api = class _Api {
3711
3771
  }),
3712
3772
  body: JSON.stringify(_Api.translateTokens(req))
3713
3773
  }).then(async (resp) => {
3774
+ const warning = resp.headers["X-Warning"];
3775
+ if (warning) console.warn(warning);
3776
+ this.online = true;
3714
3777
  let data = JSONAttemptParse(await resp.text());
3715
3778
  if (!resp.ok || (data == null ? void 0 : data.error)) throw Object.assign(errorFromCode(resp.status, data.error), data);
3716
3779
  if (!options.raw) data = _Api.translateTokens(data);
3717
3780
  return data;
3718
3781
  });
3719
3782
  }
3783
+ async checkConnection() {
3784
+ if (typeof navigator != "undefined" && !navigator.onLine) {
3785
+ this.online$.next(false);
3786
+ return;
3787
+ }
3788
+ if (this.onlineOverride) return;
3789
+ const controller = new AbortController();
3790
+ const timeout = setTimeout(() => controller.abort(), this.heartbeat.timeout);
3791
+ try {
3792
+ const response = await fetch(this.url + this.heartbeat.target, { signal: controller.signal });
3793
+ this.online$.next(response.ok);
3794
+ } catch (error) {
3795
+ this.online$.next(false);
3796
+ } finally {
3797
+ clearTimeout(timeout);
3798
+ }
3799
+ }
3800
+ offlineBanner() {
3801
+ if (this.options.offlineBanner === false || typeof document == "undefined") return;
3802
+ const banner = document.querySelector(".datalynk-offline-banner");
3803
+ if (this.online) {
3804
+ banner == null ? void 0 : banner.remove();
3805
+ } else if (!banner) {
3806
+ const b = document.createElement("div");
3807
+ b.className = "datalynk-offline-banner";
3808
+ 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" });
3809
+ b.innerHTML = "⚠️ You are offline, please reconnect to sync changes";
3810
+ document.body.appendChild(b);
3811
+ }
3812
+ }
3813
+ startHeartbeat() {
3814
+ this.stopHeartbeat();
3815
+ this.heartbeat.interval = setInterval(() => this.checkConnection(), this.heartbeat.timeout / 2);
3816
+ this.checkConnection();
3817
+ }
3818
+ stopHeartbeat() {
3819
+ if (this.heartbeat.interval) {
3820
+ clearInterval(this.heartbeat.interval);
3821
+ this.heartbeat.interval = null;
3822
+ }
3823
+ }
3720
3824
  /**
3721
3825
  * Get list of slices
3722
3826
  * @return {Promise<number[]>}
@@ -3799,13 +3903,6 @@ const _Api = class _Api {
3799
3903
  { "$_": "*" }
3800
3904
  ] }, {});
3801
3905
  }
3802
- /**
3803
- * Exact same as `request` method, but logs the response in the console automatically
3804
- *
3805
- * @param {object | string} data Datalynk request as object or string
3806
- * @param {ApiRequestOptions} options
3807
- * @returns {Promise<any>} Datalynk response
3808
- */
3809
3906
  debug(data, options = {}) {
3810
3907
  return this.request(data, options).then((data2) => {
3811
3908
  console.log(data2);
@@ -3815,20 +3912,14 @@ const _Api = class _Api {
3815
3912
  return err;
3816
3913
  });
3817
3914
  }
3818
- /**
3819
- * Send a request to Datalynk
3820
- *
3821
- * @example
3822
- * ```ts
3823
- * const response = await api.request('$/auth/current');
3824
- * ```
3825
- *
3826
- * @param {object} data Request using Datalynk API syntax. Strings will be converted: '$/auth/current' -> {'$/auth/current': {}}
3827
- * @param {ApiRequestOptions} options
3828
- * @returns {Promise<any>} Datalynk response or error
3829
- */
3830
3915
  request(data, options = {}) {
3916
+ var _a, _b;
3831
3917
  data = typeof data == "string" ? { [data]: {} } : data;
3918
+ let key = JSON.stringify(data);
3919
+ if (this.offline) {
3920
+ (_b = (_a = this.database) == null ? void 0 : _a.table("pending")) == null ? void 0 : _b.add(data, key);
3921
+ return Promise.resolve();
3922
+ }
3832
3923
  if (options.noOptimize) {
3833
3924
  return new Promise((res, rej) => {
3834
3925
  this._request(data, options).then((resp) => {
@@ -3836,7 +3927,6 @@ const _Api = class _Api {
3836
3927
  }).catch((err) => rej(err));
3837
3928
  });
3838
3929
  }
3839
- let key = JSON.stringify(data);
3840
3930
  if (!this.pending[key]) {
3841
3931
  this.pending[key] = new Promise((res, rej) => this.bundle.push({ data, res, rej }));
3842
3932
  this.pending[key].catch().then(() => delete this.pending[key]);
package/dist/slice.d.ts CHANGED
@@ -231,13 +231,17 @@ export declare class ApiCall<T extends Meta = any> {
231
231
  export declare class Slice<T extends Meta = any> {
232
232
  private slice;
233
233
  private api;
234
+ static idMap: {
235
+ [key: number]: number;
236
+ };
237
+ static nextId: number;
234
238
  private table?;
235
239
  private info?;
236
- private pendingInsert;
237
- /** Unsubscribe from changes, undefined if not subscribed */
238
- unsubscribe?: Unsubscribe | null;
240
+ private loaded;
239
241
  /** Cached slice data as an observable */
240
242
  cache$: BehaviorSubject<T[]>;
243
+ /** Unsubscribe from changes, undefined if not subscribed */
244
+ unsubscribe?: Unsubscribe | null;
241
245
  /** Cached slice data */
242
246
  get cache(): T[];
243
247
  /** Set cached data & alert subscribers */
@@ -251,7 +255,6 @@ export declare class Slice<T extends Meta = any> {
251
255
  * @param {Api} api Api to send the requests through
252
256
  */
253
257
  constructor(slice: number | string, api: Api);
254
- private fixIncrement;
255
258
  private execWrapper;
256
259
  pushChanges(): Promise<void>;
257
260
  /**
@@ -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;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GAAG,EAAE,GAAG;IA8B5D,OAAO,CAAC,WAAW;IAqFb,WAAW;IAoCjB;;;;OAIG;IACG,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;IA8BnD;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,UAAO;IAyBd;;OAEG;IACH,KAAK,CAAC,GAAG,GAAE,MAAM,GAAG,MAAa;IAMjC;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE;IAM5B;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE;IAMpB;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE;IAMlB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE;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.6",
6
6
  "author": "Zak Timson <zaktimson@gmail.com>",
7
7
  "private": false,
8
8
  "main": "./dist/index.cjs",