@learncard/helpers 1.0.19 → 1.0.20
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/helpers.esm.js
CHANGED
@@ -100,6 +100,7 @@ var require_types_cjs_development = __commonJS({
|
|
100
100
|
LCNNotificationTypeEnumValidator: () => LCNNotificationTypeEnumValidator,
|
101
101
|
LCNNotificationValidator: () => LCNNotificationValidator,
|
102
102
|
LCNProfileConnectionStatusEnum: () => LCNProfileConnectionStatusEnum,
|
103
|
+
LCNProfileQueryValidator: () => LCNProfileQueryValidator,
|
103
104
|
LCNProfileValidator: () => LCNProfileValidator,
|
104
105
|
LCNSigningAuthorityForUserValidator: () => LCNSigningAuthorityForUserValidator,
|
105
106
|
LCNSigningAuthorityValidator: () => LCNSigningAuthorityValidator,
|
@@ -125,7 +126,6 @@ var require_types_cjs_development = __commonJS({
|
|
125
126
|
RubricCriterionValidator: () => RubricCriterionValidator,
|
126
127
|
SentCredentialInfoValidator: () => SentCredentialInfoValidator,
|
127
128
|
ServiceValidator: () => ServiceValidator,
|
128
|
-
StringQuery: () => StringQuery,
|
129
129
|
UnsignedAchievementCredentialValidator: () => UnsignedAchievementCredentialValidator,
|
130
130
|
UnsignedVCValidator: () => UnsignedVCValidator,
|
131
131
|
UnsignedVPValidator: () => UnsignedVPValidator,
|
@@ -3876,6 +3876,35 @@ var require_types_cjs_development = __commonJS({
|
|
3876
3876
|
var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
|
3877
3877
|
records: EncryptedCredentialRecordValidator.array()
|
3878
3878
|
});
|
3879
|
+
var parseRegexString = /* @__PURE__ */ __name2((regexStr) => {
|
3880
|
+
const match = regexStr.match(/^\/(.*)\/([gimsuy]*)$/);
|
3881
|
+
if (!match)
|
3882
|
+
throw new Error("Invalid RegExp string format");
|
3883
|
+
return { pattern: match[1], flags: match[2] };
|
3884
|
+
}, "parseRegexString");
|
3885
|
+
var RegExpValidator = mod.instanceof(RegExp).or(
|
3886
|
+
mod.string().refine(
|
3887
|
+
(str) => {
|
3888
|
+
try {
|
3889
|
+
parseRegexString(str);
|
3890
|
+
return true;
|
3891
|
+
} catch (e) {
|
3892
|
+
return false;
|
3893
|
+
}
|
3894
|
+
},
|
3895
|
+
{
|
3896
|
+
message: "Invalid RegExp string format. Must be in format '/pattern/flags'"
|
3897
|
+
}
|
3898
|
+
).transform((str) => {
|
3899
|
+
const { pattern, flags } = parseRegexString(str);
|
3900
|
+
try {
|
3901
|
+
return new RegExp(pattern, flags);
|
3902
|
+
} catch (error) {
|
3903
|
+
throw new Error(`Invalid RegExp: ${error.message}`);
|
3904
|
+
}
|
3905
|
+
})
|
3906
|
+
);
|
3907
|
+
var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: RegExpValidator }));
|
3879
3908
|
var LCNProfileValidator = mod.object({
|
3880
3909
|
profileId: mod.string().min(3).max(40),
|
3881
3910
|
displayName: mod.string().default(""),
|
@@ -3890,6 +3919,16 @@ var require_types_cjs_development = __commonJS({
|
|
3890
3919
|
type: mod.string().optional(),
|
3891
3920
|
notificationsWebhook: mod.string().url().startsWith("http").optional()
|
3892
3921
|
});
|
3922
|
+
var LCNProfileQueryValidator = mod.object({
|
3923
|
+
profileId: StringQuery,
|
3924
|
+
displayName: StringQuery,
|
3925
|
+
shortBio: StringQuery,
|
3926
|
+
bio: StringQuery,
|
3927
|
+
email: StringQuery,
|
3928
|
+
websiteLink: StringQuery,
|
3929
|
+
isServiceProfile: mod.boolean(),
|
3930
|
+
type: StringQuery
|
3931
|
+
}).partial();
|
3893
3932
|
var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
|
3894
3933
|
records: LCNProfileValidator.array()
|
3895
3934
|
});
|
@@ -3930,7 +3969,6 @@ var require_types_cjs_development = __commonJS({
|
|
3930
3969
|
meta: mod.record(mod.any()).optional(),
|
3931
3970
|
claimPermissions: BoostPermissionsValidator.optional()
|
3932
3971
|
});
|
3933
|
-
var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: mod.instanceof(RegExp) }));
|
3934
3972
|
var BoostQueryValidator = mod.object({
|
3935
3973
|
uri: StringQuery,
|
3936
3974
|
name: StringQuery,
|