@pol-studios/db 1.0.10 → 1.0.12
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/DataLayerContext-CL6alnkb.d.ts +755 -0
- package/dist/UserMetadataContext-B8gVWGMl.d.ts +35 -0
- package/dist/UserMetadataContext-DntmpK41.d.ts +33 -0
- package/dist/auth/context.d.ts +3 -2
- package/dist/auth/context.js +5 -4
- package/dist/auth/guards.js +2 -2
- package/dist/auth/hooks.d.ts +3 -3
- package/dist/auth/hooks.js +6 -5
- package/dist/auth/index.d.ts +3 -2
- package/dist/auth/index.js +8 -6
- package/dist/{canvas-UVNDA54X.node → canvas-C4TBBDUL.node} +0 -0
- package/dist/{canvas-75Y7XMF3.js → canvas-ZQNCL7JL.js} +2 -2
- package/dist/chunk-5EFDS7SR.js +205 -0
- package/dist/chunk-5EFDS7SR.js.map +1 -0
- package/dist/{chunk-BRTW7CO5.js → chunk-7SCJNYTE.js} +1 -9
- package/dist/chunk-7SCJNYTE.js.map +1 -0
- package/dist/chunk-DJ6VLEAL.js +247 -0
- package/dist/chunk-DJ6VLEAL.js.map +1 -0
- package/dist/{chunk-Y3INY2CS.js → chunk-GC3TBUWE.js} +1 -1
- package/dist/chunk-GC3TBUWE.js.map +1 -0
- package/dist/{chunk-7HG6G25H.js → chunk-H3LNH2NT.js} +169 -268
- package/dist/chunk-H3LNH2NT.js.map +1 -0
- package/dist/{chunk-USJYMRUO.js → chunk-HAWJTZCK.js} +2 -2
- package/dist/chunk-HAWJTZCK.js.map +1 -0
- package/dist/chunk-JAATANS3.js +429 -0
- package/dist/chunk-JAATANS3.js.map +1 -0
- package/dist/chunk-LNJ3WF7V.js +470 -0
- package/dist/chunk-LNJ3WF7V.js.map +1 -0
- package/dist/chunk-N26IEHZT.js +79 -0
- package/dist/chunk-N26IEHZT.js.map +1 -0
- package/dist/chunk-NSIAAYW3.js +1 -0
- package/dist/chunk-NSIAAYW3.js.map +1 -0
- package/dist/chunk-NZON56CB.js +3864 -0
- package/dist/chunk-NZON56CB.js.map +1 -0
- package/dist/{chunk-O3K7R32P.js → chunk-OQ7U6EQ3.js} +118 -123
- package/dist/chunk-OQ7U6EQ3.js.map +1 -0
- package/dist/chunk-SM73S2DY.js +11 -0
- package/dist/chunk-SM73S2DY.js.map +1 -0
- package/dist/{chunk-JUVE3DWY.js → chunk-TKWR5AAY.js} +47 -65
- package/dist/chunk-TKWR5AAY.js.map +1 -0
- package/dist/{chunk-2IFGILT3.js → chunk-U5UNPBKB.js} +76 -107
- package/dist/chunk-U5UNPBKB.js.map +1 -0
- package/dist/chunk-WGDJ4IXR.js +921 -0
- package/dist/chunk-WGDJ4IXR.js.map +1 -0
- package/dist/chunk-WVF7RUW5.js +186 -0
- package/dist/chunk-WVF7RUW5.js.map +1 -0
- package/dist/{chunk-ZTSBF536.js → chunk-X3HZLNBV.js} +637 -435
- package/dist/chunk-X3HZLNBV.js.map +1 -0
- package/dist/{chunk-EL45Z26M.js → chunk-XU3SBFAG.js} +1219 -208
- package/dist/chunk-XU3SBFAG.js.map +1 -0
- package/dist/chunk-ZVBHWU7O.js +1412 -0
- package/dist/chunk-ZVBHWU7O.js.map +1 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +42 -23
- package/dist/client/index.js.map +1 -1
- package/dist/core/index.d.ts +19 -0
- package/dist/{index-BFu5_dS8.d.ts → database.types-ChFCG-4M.d.ts} +1 -177
- package/dist/gen/index.js +4 -2
- package/dist/hooks/index.d.ts +10 -3
- package/dist/hooks/index.js +8 -10
- package/dist/index-CQLyNG6A.d.ts +433 -0
- package/dist/index.d.ts +12 -8
- package/dist/index.js +92 -48
- package/dist/index.native.d.ts +373 -33
- package/dist/index.native.js +79 -47
- package/dist/index.web.d.ts +10 -7
- package/dist/index.web.js +83 -78
- package/dist/index.web.js.map +1 -1
- package/dist/mutation/index.d.ts +2 -2
- package/dist/mutation/index.js +307 -122
- package/dist/mutation/index.js.map +1 -1
- package/dist/parser/index.js +2 -2
- package/dist/{pdf-3TIGQRLA.js → pdf-PHXP7RHD.js} +2 -2
- package/dist/powersync-bridge/index.d.ts +284 -0
- package/dist/powersync-bridge/index.js +22 -0
- package/dist/powersync-bridge/index.js.map +1 -0
- package/dist/query/index.js +5 -5
- package/dist/realtime/index.js +252 -128
- package/dist/realtime/index.js.map +1 -1
- package/dist/{UserMetadataContext-BYYqA6LI.d.ts → setupAuthContext-Kv-THH-h.d.ts} +1 -29
- package/dist/types/index.d.ts +5 -1
- package/dist/types/index.js +10 -5
- package/dist/{useBatchUpsert-CSQVX7w8.d.ts → useBatchUpsert-9OYjibLh.d.ts} +1 -1
- package/dist/{useDbCount-RGCuHmHp.d.ts → useDbCount-BG356T9i.d.ts} +3 -719
- package/dist/{useReceiptAI-Bn0czE7C.d.ts → useReceiptAI-6HkRpRml.d.ts} +1 -1
- package/dist/{useResolveFeedback-CpZPP8Pw.d.ts → useResolveFeedback-BWmatBlE.d.ts} +26 -45
- package/dist/{useSupabase-pPhUZHcl.d.ts → useSupabase-DvWVuHHE.d.ts} +2 -1
- package/dist/with-auth/index.d.ts +704 -0
- package/dist/with-auth/index.js +1221 -0
- package/dist/with-auth/index.js.map +1 -0
- package/package.json +25 -10
- package/dist/chunk-2IFGILT3.js.map +0 -1
- package/dist/chunk-3M2U6TXH.js +0 -928
- package/dist/chunk-3M2U6TXH.js.map +0 -1
- package/dist/chunk-5ZYAEGCJ.js +0 -416
- package/dist/chunk-5ZYAEGCJ.js.map +0 -1
- package/dist/chunk-7HG6G25H.js.map +0 -1
- package/dist/chunk-7XT7K4QT.js +0 -2687
- package/dist/chunk-7XT7K4QT.js.map +0 -1
- package/dist/chunk-AWFMICFV.js +0 -158
- package/dist/chunk-AWFMICFV.js.map +0 -1
- package/dist/chunk-BRTW7CO5.js.map +0 -1
- package/dist/chunk-EL45Z26M.js.map +0 -1
- package/dist/chunk-ERGF2FCE.js +0 -903
- package/dist/chunk-ERGF2FCE.js.map +0 -1
- package/dist/chunk-GK7B66LY.js +0 -135
- package/dist/chunk-GK7B66LY.js.map +0 -1
- package/dist/chunk-GQI6WJGI.js +0 -172
- package/dist/chunk-GQI6WJGI.js.map +0 -1
- package/dist/chunk-JUVE3DWY.js.map +0 -1
- package/dist/chunk-O3K7R32P.js.map +0 -1
- package/dist/chunk-SEY5UO2T.js +0 -89
- package/dist/chunk-SEY5UO2T.js.map +0 -1
- package/dist/chunk-USJYMRUO.js.map +0 -1
- package/dist/chunk-XX3IWSPM.js +0 -189
- package/dist/chunk-XX3IWSPM.js.map +0 -1
- package/dist/chunk-Y3INY2CS.js.map +0 -1
- package/dist/chunk-ZTSBF536.js.map +0 -1
- /package/dist/{canvas-75Y7XMF3.js.map → canvas-ZQNCL7JL.js.map} +0 -0
- /package/dist/{pdf-3TIGQRLA.js.map → pdf-PHXP7RHD.js.map} +0 -0
|
@@ -6487,8 +6487,10 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
|
6487
6487
|
// ../utils/dist/index.js
|
|
6488
6488
|
var __defProp = Object.defineProperty;
|
|
6489
6489
|
var __export = (target, all) => {
|
|
6490
|
-
for (var name in all)
|
|
6491
|
-
|
|
6490
|
+
for (var name in all) __defProp(target, name, {
|
|
6491
|
+
get: all[name],
|
|
6492
|
+
enumerable: true
|
|
6493
|
+
});
|
|
6492
6494
|
};
|
|
6493
6495
|
var string_exports = {};
|
|
6494
6496
|
__export(string_exports, {
|
|
@@ -6567,9 +6569,7 @@ function sortBy(items, property, isAscending = false) {
|
|
|
6567
6569
|
function sort(items, func, isAscending = false) {
|
|
6568
6570
|
const startingValue = isAscending ? 1 : -1;
|
|
6569
6571
|
const endingValue = isAscending ? -1 : 1;
|
|
6570
|
-
return [...items].sort(
|
|
6571
|
-
(a, b) => func(a) === func(b) ? 0 : func(a) < func(b) ? startingValue : endingValue
|
|
6572
|
-
);
|
|
6572
|
+
return [...items].sort((a, b) => func(a) === func(b) ? 0 : func(a) < func(b) ? startingValue : endingValue);
|
|
6573
6573
|
}
|
|
6574
6574
|
function selectByMin(items, action) {
|
|
6575
6575
|
return items.reduce((min, current) => {
|
|
@@ -6644,13 +6644,10 @@ function getAverage(arr) {
|
|
|
6644
6644
|
return sum / arr.length;
|
|
6645
6645
|
}
|
|
6646
6646
|
function convertArrayToObject(array, key) {
|
|
6647
|
-
return array?.reduce(
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
},
|
|
6652
|
-
{}
|
|
6653
|
-
);
|
|
6647
|
+
return array?.reduce((obj, item) => {
|
|
6648
|
+
obj[item[key]] = item;
|
|
6649
|
+
return obj;
|
|
6650
|
+
}, {});
|
|
6654
6651
|
}
|
|
6655
6652
|
var object_exports = {};
|
|
6656
6653
|
__export(object_exports, {
|
|
@@ -6667,7 +6664,9 @@ __export(object_exports, {
|
|
|
6667
6664
|
});
|
|
6668
6665
|
function omit(obj, keys) {
|
|
6669
6666
|
const keysArray = Array.isArray(keys) ? keys : [keys];
|
|
6670
|
-
const newObj = {
|
|
6667
|
+
const newObj = {
|
|
6668
|
+
...obj
|
|
6669
|
+
};
|
|
6671
6670
|
keysArray.forEach((key) => {
|
|
6672
6671
|
if (key in newObj) {
|
|
6673
6672
|
delete newObj[key];
|
|
@@ -6687,7 +6686,9 @@ function pick(obj, keys) {
|
|
|
6687
6686
|
var includeOnly = pick;
|
|
6688
6687
|
function diff(oldValue, newValue) {
|
|
6689
6688
|
if (isUsable(oldValue) === false) {
|
|
6690
|
-
return {
|
|
6689
|
+
return {
|
|
6690
|
+
...newValue
|
|
6691
|
+
};
|
|
6691
6692
|
}
|
|
6692
6693
|
const result = {};
|
|
6693
6694
|
function compare(o1, o2, res) {
|
|
@@ -6766,29 +6767,11 @@ __export(date_exports, {
|
|
|
6766
6767
|
});
|
|
6767
6768
|
function getUtcDate() {
|
|
6768
6769
|
const now = /* @__PURE__ */ new Date();
|
|
6769
|
-
return new Date(
|
|
6770
|
-
Date.UTC(
|
|
6771
|
-
now.getUTCFullYear(),
|
|
6772
|
-
now.getUTCMonth(),
|
|
6773
|
-
now.getUTCDate(),
|
|
6774
|
-
now.getUTCHours(),
|
|
6775
|
-
now.getUTCMinutes(),
|
|
6776
|
-
now.getUTCSeconds()
|
|
6777
|
-
)
|
|
6778
|
-
);
|
|
6770
|
+
return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds()));
|
|
6779
6771
|
}
|
|
6780
6772
|
function toUtcDate(date) {
|
|
6781
6773
|
if (isUsable(date) === false) return null;
|
|
6782
|
-
return new Date(
|
|
6783
|
-
Date.UTC(
|
|
6784
|
-
date.getUTCFullYear(),
|
|
6785
|
-
date.getUTCMonth(),
|
|
6786
|
-
date.getUTCDate(),
|
|
6787
|
-
date.getUTCHours(),
|
|
6788
|
-
date.getUTCMinutes(),
|
|
6789
|
-
date.getUTCSeconds()
|
|
6790
|
-
)
|
|
6791
|
-
);
|
|
6774
|
+
return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds()));
|
|
6792
6775
|
}
|
|
6793
6776
|
function getUtcMoment() {
|
|
6794
6777
|
return import_moment.default.utc(import_moment.default.now());
|
|
@@ -6802,9 +6785,7 @@ function dateReviver(key, value) {
|
|
|
6802
6785
|
if (isUtcOrLocalDate) {
|
|
6803
6786
|
return import_moment2.default.utc(value);
|
|
6804
6787
|
} else {
|
|
6805
|
-
const isTimeZoneDate = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,7})?[+-]\d{2}:\d{2}$/.test(
|
|
6806
|
-
value
|
|
6807
|
-
);
|
|
6788
|
+
const isTimeZoneDate = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,7})?[+-]\d{2}:\d{2}$/.test(value);
|
|
6808
6789
|
if (isTimeZoneDate) {
|
|
6809
6790
|
return (0, import_moment2.default)(value);
|
|
6810
6791
|
}
|
|
@@ -6817,9 +6798,7 @@ function parseWithDate(key, value) {
|
|
|
6817
6798
|
if (isUtcOrLocalDate) {
|
|
6818
6799
|
return new Date(value);
|
|
6819
6800
|
} else {
|
|
6820
|
-
const isTimeZoneDate = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,7})?[+-]\d{2}:\d{2}$/.test(
|
|
6821
|
-
value
|
|
6822
|
-
);
|
|
6801
|
+
const isTimeZoneDate = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,7})?[+-]\d{2}:\d{2}$/.test(value);
|
|
6823
6802
|
if (isTimeZoneDate) {
|
|
6824
6803
|
return new Date(value);
|
|
6825
6804
|
}
|
|
@@ -6997,14 +6976,10 @@ function getContentType(metadata, path) {
|
|
|
6997
6976
|
return ext || "Unknown";
|
|
6998
6977
|
}
|
|
6999
6978
|
function isImageType(contentType) {
|
|
7000
|
-
return ["JPEG", "JPG", "PNG", "GIF", "WEBP", "SVG", "HEIC", "HEIF"].includes(
|
|
7001
|
-
contentType.toUpperCase()
|
|
7002
|
-
);
|
|
6979
|
+
return ["JPEG", "JPG", "PNG", "GIF", "WEBP", "SVG", "HEIC", "HEIF"].includes(contentType.toUpperCase());
|
|
7003
6980
|
}
|
|
7004
6981
|
function isVideoType(contentType) {
|
|
7005
|
-
return ["MP4", "QUICKTIME", "MOV", "WEBM", "AVI", "MKV"].includes(
|
|
7006
|
-
contentType.toUpperCase()
|
|
7007
|
-
);
|
|
6982
|
+
return ["MP4", "QUICKTIME", "MOV", "WEBM", "AVI", "MKV"].includes(contentType.toUpperCase());
|
|
7008
6983
|
}
|
|
7009
6984
|
function isPdfType(contentType) {
|
|
7010
6985
|
return contentType.toUpperCase() === "PDF";
|
|
@@ -7041,29 +7016,50 @@ __export(validation_exports, {
|
|
|
7041
7016
|
function validateValue(value, rules) {
|
|
7042
7017
|
for (const rule of rules) {
|
|
7043
7018
|
if (!rule.validate(value)) {
|
|
7044
|
-
return {
|
|
7019
|
+
return {
|
|
7020
|
+
isValid: false,
|
|
7021
|
+
error: rule.message
|
|
7022
|
+
};
|
|
7045
7023
|
}
|
|
7046
7024
|
}
|
|
7047
|
-
return {
|
|
7025
|
+
return {
|
|
7026
|
+
isValid: true
|
|
7027
|
+
};
|
|
7048
7028
|
}
|
|
7049
7029
|
function validateEmail(email) {
|
|
7050
7030
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
7051
7031
|
if (!email || email.trim().length === 0) {
|
|
7052
|
-
return {
|
|
7032
|
+
return {
|
|
7033
|
+
isValid: false,
|
|
7034
|
+
error: "Email is required"
|
|
7035
|
+
};
|
|
7053
7036
|
}
|
|
7054
7037
|
if (!emailRegex.test(email)) {
|
|
7055
|
-
return {
|
|
7038
|
+
return {
|
|
7039
|
+
isValid: false,
|
|
7040
|
+
error: "Please enter a valid email address"
|
|
7041
|
+
};
|
|
7056
7042
|
}
|
|
7057
|
-
return {
|
|
7043
|
+
return {
|
|
7044
|
+
isValid: true
|
|
7045
|
+
};
|
|
7058
7046
|
}
|
|
7059
7047
|
function validateRequired(value) {
|
|
7060
7048
|
if (value === null || value === void 0 || value === "") {
|
|
7061
|
-
return {
|
|
7049
|
+
return {
|
|
7050
|
+
isValid: false,
|
|
7051
|
+
error: "This field is required"
|
|
7052
|
+
};
|
|
7062
7053
|
}
|
|
7063
7054
|
if (typeof value === "string" && value.trim().length === 0) {
|
|
7064
|
-
return {
|
|
7055
|
+
return {
|
|
7056
|
+
isValid: false,
|
|
7057
|
+
error: "This field is required"
|
|
7058
|
+
};
|
|
7065
7059
|
}
|
|
7066
|
-
return {
|
|
7060
|
+
return {
|
|
7061
|
+
isValid: true
|
|
7062
|
+
};
|
|
7067
7063
|
}
|
|
7068
7064
|
function validateMinLength(min) {
|
|
7069
7065
|
return (value) => {
|
|
@@ -7073,7 +7069,9 @@ function validateMinLength(min) {
|
|
|
7073
7069
|
error: `Must be at least ${min} characters`
|
|
7074
7070
|
};
|
|
7075
7071
|
}
|
|
7076
|
-
return {
|
|
7072
|
+
return {
|
|
7073
|
+
isValid: true
|
|
7074
|
+
};
|
|
7077
7075
|
};
|
|
7078
7076
|
}
|
|
7079
7077
|
function validateMaxLength(max) {
|
|
@@ -7084,15 +7082,22 @@ function validateMaxLength(max) {
|
|
|
7084
7082
|
error: `Must be no more than ${max} characters`
|
|
7085
7083
|
};
|
|
7086
7084
|
}
|
|
7087
|
-
return {
|
|
7085
|
+
return {
|
|
7086
|
+
isValid: true
|
|
7087
|
+
};
|
|
7088
7088
|
};
|
|
7089
7089
|
}
|
|
7090
7090
|
function validatePattern(pattern, message) {
|
|
7091
7091
|
return (value) => {
|
|
7092
7092
|
if (value && !pattern.test(value)) {
|
|
7093
|
-
return {
|
|
7093
|
+
return {
|
|
7094
|
+
isValid: false,
|
|
7095
|
+
error: message
|
|
7096
|
+
};
|
|
7094
7097
|
}
|
|
7095
|
-
return {
|
|
7098
|
+
return {
|
|
7099
|
+
isValid: true
|
|
7100
|
+
};
|
|
7096
7101
|
};
|
|
7097
7102
|
}
|
|
7098
7103
|
function calculatePasswordStrength(password) {
|
|
@@ -7241,9 +7246,7 @@ function getUserFriendlyError(error) {
|
|
|
7241
7246
|
};
|
|
7242
7247
|
}
|
|
7243
7248
|
}
|
|
7244
|
-
const patternMatch = errorMappings.find(
|
|
7245
|
-
(mapping) => mapping.pattern && mapping.pattern.test(errorMessage)
|
|
7246
|
-
);
|
|
7249
|
+
const patternMatch = errorMappings.find((mapping) => mapping.pattern && mapping.pattern.test(errorMessage));
|
|
7247
7250
|
if (patternMatch) {
|
|
7248
7251
|
return {
|
|
7249
7252
|
message: patternMatch.message,
|
|
@@ -7263,69 +7266,55 @@ function isNetworkError(error) {
|
|
|
7263
7266
|
const message = extractErrorMessage(error).toLowerCase();
|
|
7264
7267
|
return /network|connection|fetch|timeout|offline|failed to fetch/i.test(message);
|
|
7265
7268
|
}
|
|
7266
|
-
var validationMappings = [
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
action: "Example: https://example.com"
|
|
7311
|
-
},
|
|
7312
|
-
{
|
|
7313
|
-
pattern: /phone|invalid.*phone/i,
|
|
7314
|
-
message: "Please enter a valid phone number",
|
|
7315
|
-
action: "Example: (555) 123-4567"
|
|
7316
|
-
},
|
|
7317
|
-
{
|
|
7318
|
-
message: "Invalid value",
|
|
7319
|
-
action: "Please check your input"
|
|
7320
|
-
}
|
|
7321
|
-
];
|
|
7269
|
+
var validationMappings = [{
|
|
7270
|
+
pattern: /required|missing|empty/i,
|
|
7271
|
+
message: "This field is required",
|
|
7272
|
+
action: "Please fill in this field"
|
|
7273
|
+
}, {
|
|
7274
|
+
pattern: /min.*length|too short/i,
|
|
7275
|
+
message: "This field is too short",
|
|
7276
|
+
action: "Please enter more characters"
|
|
7277
|
+
}, {
|
|
7278
|
+
pattern: /max.*length|too long/i,
|
|
7279
|
+
message: "This field is too long",
|
|
7280
|
+
action: "Please enter fewer characters"
|
|
7281
|
+
}, {
|
|
7282
|
+
pattern: /email|invalid.*email/i,
|
|
7283
|
+
message: "Please enter a valid email address",
|
|
7284
|
+
action: "Example: name@example.com"
|
|
7285
|
+
}, {
|
|
7286
|
+
pattern: /password|weak/i,
|
|
7287
|
+
message: "Password is too weak",
|
|
7288
|
+
action: "Use at least 8 characters with numbers and letters"
|
|
7289
|
+
}, {
|
|
7290
|
+
pattern: /match|doesn't match/i,
|
|
7291
|
+
message: "Values don't match",
|
|
7292
|
+
action: "Please check that both fields match"
|
|
7293
|
+
}, {
|
|
7294
|
+
pattern: /number|numeric/i,
|
|
7295
|
+
message: "Please enter a valid number",
|
|
7296
|
+
action: "Only numbers are allowed"
|
|
7297
|
+
}, {
|
|
7298
|
+
pattern: /date|invalid.*date/i,
|
|
7299
|
+
message: "Please enter a valid date",
|
|
7300
|
+
action: "Use format: MM/DD/YYYY"
|
|
7301
|
+
}, {
|
|
7302
|
+
pattern: /url|invalid.*url/i,
|
|
7303
|
+
message: "Please enter a valid URL",
|
|
7304
|
+
action: "Example: https://example.com"
|
|
7305
|
+
}, {
|
|
7306
|
+
pattern: /phone|invalid.*phone/i,
|
|
7307
|
+
message: "Please enter a valid phone number",
|
|
7308
|
+
action: "Example: (555) 123-4567"
|
|
7309
|
+
}, {
|
|
7310
|
+
message: "Invalid value",
|
|
7311
|
+
action: "Please check your input"
|
|
7312
|
+
}];
|
|
7322
7313
|
function getFormFieldError(error) {
|
|
7323
7314
|
if (!error) return null;
|
|
7324
7315
|
const errorMessage = typeof error === "string" ? error : error.message || "";
|
|
7325
7316
|
if (!errorMessage) return null;
|
|
7326
|
-
const patternMatch = validationMappings.find(
|
|
7327
|
-
(mapping) => mapping.pattern && mapping.pattern.test(errorMessage)
|
|
7328
|
-
);
|
|
7317
|
+
const patternMatch = validationMappings.find((mapping) => mapping.pattern && mapping.pattern.test(errorMessage));
|
|
7329
7318
|
if (patternMatch) {
|
|
7330
7319
|
return {
|
|
7331
7320
|
message: patternMatch.message,
|
|
@@ -7392,7 +7381,10 @@ __export(state_exports, {
|
|
|
7392
7381
|
withUpdate: () => withUpdate
|
|
7393
7382
|
});
|
|
7394
7383
|
function withUpdate(item, updates) {
|
|
7395
|
-
return {
|
|
7384
|
+
return {
|
|
7385
|
+
...item,
|
|
7386
|
+
...updates
|
|
7387
|
+
};
|
|
7396
7388
|
}
|
|
7397
7389
|
function getObjectChanges(oldObj, newObj) {
|
|
7398
7390
|
const changes = {};
|
|
@@ -7476,7 +7468,9 @@ async function getFile(url, fileName) {
|
|
|
7476
7468
|
URL.revokeObjectURL(link.href);
|
|
7477
7469
|
}
|
|
7478
7470
|
async function downloadFile(text) {
|
|
7479
|
-
const blob = new Blob([text], {
|
|
7471
|
+
const blob = new Blob([text], {
|
|
7472
|
+
type: "text/plain"
|
|
7473
|
+
});
|
|
7480
7474
|
const link = document.createElement("a");
|
|
7481
7475
|
link.style.display = "none";
|
|
7482
7476
|
link.href = URL.createObjectURL(blob);
|
|
@@ -7540,6 +7534,7 @@ export {
|
|
|
7540
7534
|
chunkArray,
|
|
7541
7535
|
omit,
|
|
7542
7536
|
diff,
|
|
7537
|
+
delay,
|
|
7543
7538
|
newUuid,
|
|
7544
7539
|
getObjectChanges
|
|
7545
7540
|
};
|
|
@@ -7552,4 +7547,4 @@ moment/moment.js:
|
|
|
7552
7547
|
(*! license : MIT *)
|
|
7553
7548
|
(*! momentjs.com *)
|
|
7554
7549
|
*/
|
|
7555
|
-
//# sourceMappingURL=chunk-
|
|
7550
|
+
//# sourceMappingURL=chunk-OQ7U6EQ3.js.map
|