@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.
@@ -105,6 +105,7 @@ var require_types_cjs_development = __commonJS({
105
105
  LCNNotificationTypeEnumValidator: () => LCNNotificationTypeEnumValidator,
106
106
  LCNNotificationValidator: () => LCNNotificationValidator,
107
107
  LCNProfileConnectionStatusEnum: () => LCNProfileConnectionStatusEnum,
108
+ LCNProfileQueryValidator: () => LCNProfileQueryValidator,
108
109
  LCNProfileValidator: () => LCNProfileValidator,
109
110
  LCNSigningAuthorityForUserValidator: () => LCNSigningAuthorityForUserValidator,
110
111
  LCNSigningAuthorityValidator: () => LCNSigningAuthorityValidator,
@@ -3880,6 +3881,35 @@ var require_types_cjs_development = __commonJS({
3880
3881
  var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.extend({
3881
3882
  records: EncryptedCredentialRecordValidator.array()
3882
3883
  });
3884
+ var parseRegexString = /* @__PURE__ */ __name2((regexStr) => {
3885
+ const match = regexStr.match(/^\/(.*)\/([gimsuy]*)$/);
3886
+ if (!match)
3887
+ throw new Error("Invalid RegExp string format");
3888
+ return { pattern: match[1], flags: match[2] };
3889
+ }, "parseRegexString");
3890
+ var RegExpValidator = mod.instanceof(RegExp).or(
3891
+ mod.string().refine(
3892
+ (str) => {
3893
+ try {
3894
+ parseRegexString(str);
3895
+ return true;
3896
+ } catch (e) {
3897
+ return false;
3898
+ }
3899
+ },
3900
+ {
3901
+ message: "Invalid RegExp string format. Must be in format '/pattern/flags'"
3902
+ }
3903
+ ).transform((str) => {
3904
+ const { pattern, flags } = parseRegexString(str);
3905
+ try {
3906
+ return new RegExp(pattern, flags);
3907
+ } catch (error) {
3908
+ throw new Error(`Invalid RegExp: ${error.message}`);
3909
+ }
3910
+ })
3911
+ );
3912
+ var StringQuery = mod.string().or(mod.object({ $in: mod.string().array() })).or(mod.object({ $regex: RegExpValidator }));
3883
3913
  var LCNProfileValidator = mod.object({
3884
3914
  profileId: mod.string().min(3).max(40),
3885
3915
  displayName: mod.string().default(""),
@@ -3894,6 +3924,16 @@ var require_types_cjs_development = __commonJS({
3894
3924
  type: mod.string().optional(),
3895
3925
  notificationsWebhook: mod.string().url().startsWith("http").optional()
3896
3926
  });
3927
+ var LCNProfileQueryValidator = mod.object({
3928
+ profileId: StringQuery,
3929
+ displayName: StringQuery,
3930
+ shortBio: StringQuery,
3931
+ bio: StringQuery,
3932
+ email: StringQuery,
3933
+ websiteLink: StringQuery,
3934
+ isServiceProfile: mod.boolean(),
3935
+ type: StringQuery
3936
+ }).partial();
3897
3937
  var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
3898
3938
  records: LCNProfileValidator.array()
3899
3939
  });
@@ -3931,13 +3971,15 @@ var require_types_cjs_development = __commonJS({
3931
3971
  category: mod.string().optional(),
3932
3972
  status: LCNBoostStatus.optional(),
3933
3973
  autoConnectRecipients: mod.boolean().optional(),
3974
+ meta: mod.record(mod.any()).optional(),
3934
3975
  claimPermissions: BoostPermissionsValidator.optional()
3935
3976
  });
3936
3977
  var BoostQueryValidator = mod.object({
3937
- uri: mod.string().or(mod.object({ $in: mod.string().array() })),
3938
- name: mod.string().or(mod.object({ $in: mod.string().array() })),
3939
- type: mod.string().or(mod.object({ $in: mod.string().array() })),
3940
- category: mod.string().or(mod.object({ $in: mod.string().array() })),
3978
+ uri: StringQuery,
3979
+ name: StringQuery,
3980
+ type: StringQuery,
3981
+ category: StringQuery,
3982
+ meta: mod.record(StringQuery),
3941
3983
  status: LCNBoostStatus.or(mod.object({ $in: LCNBoostStatus.array() })),
3942
3984
  autoConnectRecipients: mod.boolean()
3943
3985
  }).partial();