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.
@@ -19,4 +19,5 @@ export interface UserLogin {
19
19
  nonExportablePrivateKey?: CryptoKey;
20
20
  publicKey?: CryptoKey;
21
21
  isLoggedIn?: boolean;
22
+ data?: any;
22
23
  }
@@ -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
  *
@@ -2223,6 +2223,9 @@
2223
2223
  if (response.userValidUntil != null) {
2224
2224
  login.license.validUntil = new Date(response.userValidUntil);
2225
2225
  }
2226
+ if (response.data) {
2227
+ login.data = response.data;
2228
+ }
2226
2229
  return login;
2227
2230
  });
2228
2231
  }
@@ -2277,6 +2280,7 @@
2277
2280
  type: response2.userType,
2278
2281
  status: response2.claims.license || 'ok',
2279
2282
  };
2283
+ context.data = response2.data;
2280
2284
  if (response2.evalDaysLeft != null) {
2281
2285
  context.license.evalDaysLeft = response2.evalDaysLeft;
2282
2286
  }
@@ -2482,11 +2486,21 @@
2482
2486
  }
2483
2487
  else {
2484
2488
  const email = yield promptForEmail(userInteraction, 'Enter email address', hints === null || hints === void 0 ? void 0 : hints.email);
2485
- tokenRequest = {
2486
- email,
2487
- grant_type: 'otp',
2488
- scopes: ['ACCESS_DB'],
2489
- };
2489
+ if (/@demo.local$/.test(email)) {
2490
+ tokenRequest = {
2491
+ demo_user: email,
2492
+ grant_type: 'demo',
2493
+ scopes: ['ACCESS_DB'],
2494
+ public_key
2495
+ };
2496
+ }
2497
+ else {
2498
+ tokenRequest = {
2499
+ email,
2500
+ grant_type: 'otp',
2501
+ scopes: ['ACCESS_DB'],
2502
+ };
2503
+ }
2490
2504
  }
2491
2505
  const res1 = yield fetch(`${url}/token`, {
2492
2506
  body: JSON.stringify(tokenRequest),
@@ -4212,6 +4226,7 @@
4212
4226
  accessTokenExpiration: refreshedLogin.accessTokenExpiration,
4213
4227
  claims: refreshedLogin.claims,
4214
4228
  license: refreshedLogin.license,
4229
+ data: refreshedLogin.data,
4215
4230
  });
4216
4231
  // Updating $logins will trigger emission of db.cloud.currentUser observable, which
4217
4232
  // in turn will lead to that connectWebSocket.ts will reconnect the socket with the
@@ -5460,6 +5475,7 @@
5460
5475
  accessTokenExpiration: refreshedLogin.accessTokenExpiration,
5461
5476
  claims: refreshedLogin.claims,
5462
5477
  license: refreshedLogin.license,
5478
+ data: refreshedLogin.data
5463
5479
  });
5464
5480
  })), switchMap(() => createObservable()));
5465
5481
  }
@@ -6293,7 +6309,7 @@
6293
6309
  const syncComplete = new rxjs.Subject();
6294
6310
  dexie.cloud = {
6295
6311
  // @ts-ignore
6296
- version: "4.0.1",
6312
+ version: "4.0.3",
6297
6313
  options: Object.assign({}, DEFAULT_OPTIONS),
6298
6314
  schema: null,
6299
6315
  get currentUserId() {
@@ -6570,7 +6586,7 @@
6570
6586
  }
6571
6587
  }
6572
6588
  // @ts-ignore
6573
- dexieCloud.version = "4.0.1";
6589
+ dexieCloud.version = "4.0.3";
6574
6590
  Dexie.Cloud = dexieCloud;
6575
6591
 
6576
6592
  exports.default = dexieCloud;