dexie-cloud-addon 4.0.1-beta.53 → 4.0.1-beta.55
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/modern/dexie-cloud-addon.js +40 -4
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/service-worker.js +40 -4
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.js +40 -4
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +1 -1
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/service-worker.js +40 -4
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/package.json +1 -2
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ==========================================================================
|
|
10
10
|
*
|
|
11
|
-
* Version 4.0.1-beta.
|
|
11
|
+
* Version 4.0.1-beta.55, Tue Jan 02 2024
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -2016,7 +2016,28 @@ function alertUser(userInteraction, title, ...alerts) {
|
|
|
2016
2016
|
function promptForEmail(userInteraction, title, emailHint) {
|
|
2017
2017
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2018
2018
|
let email = emailHint || '';
|
|
2019
|
-
|
|
2019
|
+
// Regular expression for email validation
|
|
2020
|
+
// ^[\w-+.]+@([\w-]+\.)+[\w-]{2,10}(\sas\s[\w-+.]+@([\w-]+\.)+[\w-]{2,10})?$
|
|
2021
|
+
//
|
|
2022
|
+
// ^[\w-+.]+ : Matches the start of the string. Allows one or more word characters
|
|
2023
|
+
// (a-z, A-Z, 0-9, and underscore), hyphen, plus, or dot.
|
|
2024
|
+
//
|
|
2025
|
+
// @ : Matches the @ symbol.
|
|
2026
|
+
// ([\w-]+\.)+ : Matches one or more word characters or hyphens followed by a dot.
|
|
2027
|
+
// The plus sign outside the parentheses means this pattern can repeat one or more times,
|
|
2028
|
+
// allowing for subdomains.
|
|
2029
|
+
// [\w-]{2,10} : Matches between 2 and 10 word characters or hyphens. This is typically for
|
|
2030
|
+
// the domain extension like .com, .net, etc.
|
|
2031
|
+
// (\sas\s[\w-+.]+@([\w-]+\.)+[\w-]{2,10})?$ : This part is optional (due to the ? at the end).
|
|
2032
|
+
// If present, it matches " as " followed by another valid email address. This allows for the
|
|
2033
|
+
// input to be either a single email address or two email addresses separated by " as ".
|
|
2034
|
+
//
|
|
2035
|
+
// The use case for "<email1> as <email2>"" is for when a database owner with full access to the
|
|
2036
|
+
// database needs to impersonate another user in the database in order to troubleshoot. This
|
|
2037
|
+
// format will only be possible to use when email1 is the owner of an API client with GLOBAL_READ
|
|
2038
|
+
// and GLOBAL_WRITE permissions on the database. The email will be checked on the server before
|
|
2039
|
+
// allowing it and giving out a token for email2, using the OTP sent to email1.
|
|
2040
|
+
while (!email || !/^[\w-+.]+@([\w-]+\.)+[\w-]{2,10}(\sas\s[\w-+.]+@([\w-]+\.)+[\w-]{2,10})?$/.test(email)) {
|
|
2020
2041
|
email = (yield interactWithUser(userInteraction, {
|
|
2021
2042
|
type: 'email',
|
|
2022
2043
|
title,
|
|
@@ -4637,6 +4658,21 @@ function createImplicitPropSetterMiddleware(db) {
|
|
|
4637
4658
|
const trans = req.trans;
|
|
4638
4659
|
if ((_b = (_a = db.cloud.schema) === null || _a === void 0 ? void 0 : _a[tableName]) === null || _b === void 0 ? void 0 : _b.markedForSync) {
|
|
4639
4660
|
if (req.type === 'add' || req.type === 'put') {
|
|
4661
|
+
if (tableName === 'members') {
|
|
4662
|
+
for (const member of req.values) {
|
|
4663
|
+
if (typeof member.email === 'string') {
|
|
4664
|
+
// Resolve https://github.com/dexie/dexie-cloud/issues/4
|
|
4665
|
+
// If adding a member, make sure email is lowercase and trimmed.
|
|
4666
|
+
// This is to avoid issues where the APP does not check this
|
|
4667
|
+
// and just allows the user to enter an email address that might
|
|
4668
|
+
// have been pasted by the user from a source that had a trailing
|
|
4669
|
+
// space or was in uppercase. We want to avoid that the user
|
|
4670
|
+
// creates a new member with a different email address than
|
|
4671
|
+
// the one he/she intended to create.
|
|
4672
|
+
member.email = member.email.trim().toLowerCase();
|
|
4673
|
+
}
|
|
4674
|
+
}
|
|
4675
|
+
}
|
|
4640
4676
|
// No matter if user is logged in or not, make sure "owner" and "realmId" props are set properly.
|
|
4641
4677
|
// If not logged in, this will be changed upon syncification of the tables (next sync after login),
|
|
4642
4678
|
// however, application code will work better if we can always rely on that the properties realmId
|
|
@@ -6217,7 +6253,7 @@ function dexieCloud(dexie) {
|
|
|
6217
6253
|
const syncComplete = new Subject();
|
|
6218
6254
|
dexie.cloud = {
|
|
6219
6255
|
// @ts-ignore
|
|
6220
|
-
version: "4.0.1-beta.
|
|
6256
|
+
version: "4.0.1-beta.55",
|
|
6221
6257
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6222
6258
|
schema: null,
|
|
6223
6259
|
get currentUserId() {
|
|
@@ -6494,7 +6530,7 @@ function dexieCloud(dexie) {
|
|
|
6494
6530
|
}
|
|
6495
6531
|
}
|
|
6496
6532
|
// @ts-ignore
|
|
6497
|
-
dexieCloud.version = "4.0.1-beta.
|
|
6533
|
+
dexieCloud.version = "4.0.1-beta.55";
|
|
6498
6534
|
Dexie.Cloud = dexieCloud;
|
|
6499
6535
|
|
|
6500
6536
|
export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };
|