dexie-cloud-addon 4.0.1 → 4.0.3

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.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.0.1, Tue Mar 26 2024
11
+ * Version 4.0.3, Sat Apr 13 2024
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -2537,6 +2537,9 @@ function refreshAccessToken(url, login) {
2537
2537
  if (response.userValidUntil != null) {
2538
2538
  login.license.validUntil = new Date(response.userValidUntil);
2539
2539
  }
2540
+ if (response.data) {
2541
+ login.data = response.data;
2542
+ }
2540
2543
  return login;
2541
2544
  });
2542
2545
  }
@@ -2591,6 +2594,7 @@ function userAuthenticate(context, fetchToken, userInteraction, hints) {
2591
2594
  type: response2.userType,
2592
2595
  status: response2.claims.license || 'ok',
2593
2596
  };
2597
+ context.data = response2.data;
2594
2598
  if (response2.evalDaysLeft != null) {
2595
2599
  context.license.evalDaysLeft = response2.evalDaysLeft;
2596
2600
  }
@@ -3919,6 +3923,7 @@ function MessagesFromServerConsumer(db) {
3919
3923
  accessTokenExpiration: refreshedLogin.accessTokenExpiration,
3920
3924
  claims: refreshedLogin.claims,
3921
3925
  license: refreshedLogin.license,
3926
+ data: refreshedLogin.data,
3922
3927
  });
3923
3928
  // Updating $logins will trigger emission of db.cloud.currentUser observable, which
3924
3929
  // in turn will lead to that connectWebSocket.ts will reconnect the socket with the
@@ -4277,11 +4282,21 @@ function otpFetchTokenCallback(db) {
4277
4282
  }
4278
4283
  else {
4279
4284
  const email = yield promptForEmail(userInteraction, 'Enter email address', hints === null || hints === void 0 ? void 0 : hints.email);
4280
- tokenRequest = {
4281
- email,
4282
- grant_type: 'otp',
4283
- scopes: ['ACCESS_DB'],
4284
- };
4285
+ if (/@demo.local$/.test(email)) {
4286
+ tokenRequest = {
4287
+ demo_user: email,
4288
+ grant_type: 'demo',
4289
+ scopes: ['ACCESS_DB'],
4290
+ public_key
4291
+ };
4292
+ }
4293
+ else {
4294
+ tokenRequest = {
4295
+ email,
4296
+ grant_type: 'otp',
4297
+ scopes: ['ACCESS_DB'],
4298
+ };
4299
+ }
4285
4300
  }
4286
4301
  const res1 = yield fetch(`${url}/token`, {
4287
4302
  body: JSON.stringify(tokenRequest),
@@ -5457,6 +5472,7 @@ function connectWebSocket(db) {
5457
5472
  accessTokenExpiration: refreshedLogin.accessTokenExpiration,
5458
5473
  claims: refreshedLogin.claims,
5459
5474
  license: refreshedLogin.license,
5475
+ data: refreshedLogin.data
5460
5476
  });
5461
5477
  })), switchMap(() => createObservable()));
5462
5478
  }
@@ -6283,7 +6299,7 @@ function dexieCloud(dexie) {
6283
6299
  const syncComplete = new Subject();
6284
6300
  dexie.cloud = {
6285
6301
  // @ts-ignore
6286
- version: "4.0.1",
6302
+ version: "4.0.3",
6287
6303
  options: Object.assign({}, DEFAULT_OPTIONS),
6288
6304
  schema: null,
6289
6305
  get currentUserId() {
@@ -6560,7 +6576,7 @@ function dexieCloud(dexie) {
6560
6576
  }
6561
6577
  }
6562
6578
  // @ts-ignore
6563
- dexieCloud.version = "4.0.1";
6579
+ dexieCloud.version = "4.0.3";
6564
6580
  Dexie.Cloud = dexieCloud;
6565
6581
 
6566
6582
  // In case the SW lives for a while, let it reuse already opened connections: