@learncard/helpers 1.0.18 → 1.0.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,
@@ -3875,6 +3876,35 @@ var require_types_cjs_development = __commonJS({
3875
3876
  var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
3876
3877
  records: EncryptedCredentialRecordValidator.array()
3877
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 }));
3878
3908
  var LCNProfileValidator = mod.object({
3879
3909
  profileId: mod.string().min(3).max(40),
3880
3910
  displayName: mod.string().default(""),
@@ -3889,6 +3919,16 @@ var require_types_cjs_development = __commonJS({
3889
3919
  type: mod.string().optional(),
3890
3920
  notificationsWebhook: mod.string().url().startsWith("http").optional()
3891
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();
3892
3932
  var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
3893
3933
  records: LCNProfileValidator.array()
3894
3934
  });
@@ -3926,13 +3966,15 @@ var require_types_cjs_development = __commonJS({
3926
3966
  category: mod.string().optional(),
3927
3967
  status: LCNBoostStatus.optional(),
3928
3968
  autoConnectRecipients: mod.boolean().optional(),
3969
+ meta: mod.record(mod.any()).optional(),
3929
3970
  claimPermissions: BoostPermissionsValidator.optional()
3930
3971
  });
3931
3972
  var BoostQueryValidator = mod.object({
3932
- uri: mod.string().or(mod.object({ $in: mod.string().array() })),
3933
- name: mod.string().or(mod.object({ $in: mod.string().array() })),
3934
- type: mod.string().or(mod.object({ $in: mod.string().array() })),
3935
- category: mod.string().or(mod.object({ $in: mod.string().array() })),
3973
+ uri: StringQuery,
3974
+ name: StringQuery,
3975
+ type: StringQuery,
3976
+ category: StringQuery,
3977
+ meta: mod.record(StringQuery),
3936
3978
  status: LCNBoostStatus.or(mod.object({ $in: LCNBoostStatus.array() })),
3937
3979
  autoConnectRecipients: mod.boolean()
3938
3980
  }).partial();