dexie-cloud-addon 4.0.1-beta.53 → 4.0.1-beta.54

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-beta.53, Sat Dec 02 2023
11
+ * Version 4.0.1-beta.54, Mon Dec 18 2023
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -2336,7 +2336,7 @@
2336
2336
  function promptForEmail(userInteraction, title, emailHint) {
2337
2337
  return __awaiter(this, void 0, void 0, function* () {
2338
2338
  let email = emailHint || '';
2339
- while (!email || !/^[\w-\.]+@([\w-]+\.)+[\w-]{2,10}$/.test(email)) {
2339
+ while (!email || !/^[\w-+.]+@([\w-]+\.)+[\w-]{2,10}$/.test(email)) {
2340
2340
  email = (yield interactWithUser(userInteraction, {
2341
2341
  type: 'email',
2342
2342
  title,
@@ -4640,6 +4640,21 @@
4640
4640
  const trans = req.trans;
4641
4641
  if ((_b = (_a = db.cloud.schema) === null || _a === void 0 ? void 0 : _a[tableName]) === null || _b === void 0 ? void 0 : _b.markedForSync) {
4642
4642
  if (req.type === 'add' || req.type === 'put') {
4643
+ if (tableName === 'members') {
4644
+ for (const member of req.values) {
4645
+ if (typeof member.email === 'string') {
4646
+ // Resolve https://github.com/dexie/dexie-cloud/issues/4
4647
+ // If adding a member, make sure email is lowercase and trimmed.
4648
+ // This is to avoid issues where the APP does not check this
4649
+ // and just allows the user to enter an email address that might
4650
+ // have been pasted by the user from a source that had a trailing
4651
+ // space or was in uppercase. We want to avoid that the user
4652
+ // creates a new member with a different email address than
4653
+ // the one he/she intended to create.
4654
+ member.email = member.email.trim().toLowerCase();
4655
+ }
4656
+ }
4657
+ }
4643
4658
  // No matter if user is logged in or not, make sure "owner" and "realmId" props are set properly.
4644
4659
  // If not logged in, this will be changed upon syncification of the tables (next sync after login),
4645
4660
  // however, application code will work better if we can always rely on that the properties realmId
@@ -6213,7 +6228,7 @@
6213
6228
  const syncComplete = new rxjs.Subject();
6214
6229
  dexie.cloud = {
6215
6230
  // @ts-ignore
6216
- version: "4.0.1-beta.53",
6231
+ version: "4.0.1-beta.54",
6217
6232
  options: Object.assign({}, DEFAULT_OPTIONS),
6218
6233
  schema: null,
6219
6234
  get currentUserId() {
@@ -6490,7 +6505,7 @@
6490
6505
  }
6491
6506
  }
6492
6507
  // @ts-ignore
6493
- dexieCloud.version = "4.0.1-beta.53";
6508
+ dexieCloud.version = "4.0.1-beta.54";
6494
6509
  Dexie.Cloud = dexieCloud;
6495
6510
 
6496
6511
  // In case the SW lives for a while, let it reuse already opened connections: