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
  *
@@ -2019,7 +2019,7 @@
2019
2019
  function promptForEmail(userInteraction, title, emailHint) {
2020
2020
  return __awaiter(this, void 0, void 0, function* () {
2021
2021
  let email = emailHint || '';
2022
- while (!email || !/^[\w-\.]+@([\w-]+\.)+[\w-]{2,10}$/.test(email)) {
2022
+ while (!email || !/^[\w-+.]+@([\w-]+\.)+[\w-]{2,10}$/.test(email)) {
2023
2023
  email = (yield interactWithUser(userInteraction, {
2024
2024
  type: 'email',
2025
2025
  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
@@ -6220,7 +6235,7 @@
6220
6235
  const syncComplete = new rxjs.Subject();
6221
6236
  dexie.cloud = {
6222
6237
  // @ts-ignore
6223
- version: "4.0.1-beta.53",
6238
+ version: "4.0.1-beta.54",
6224
6239
  options: Object.assign({}, DEFAULT_OPTIONS),
6225
6240
  schema: null,
6226
6241
  get currentUserId() {
@@ -6497,7 +6512,7 @@
6497
6512
  }
6498
6513
  }
6499
6514
  // @ts-ignore
6500
- dexieCloud.version = "4.0.1-beta.53";
6515
+ dexieCloud.version = "4.0.1-beta.54";
6501
6516
  Dexie.Cloud = dexieCloud;
6502
6517
 
6503
6518
  exports.default = dexieCloud;