@learncard/types 5.5.7 → 5.5.9

Sign up to get free protection for your applications and to get access to all the features.
package/dist/types.esm.js CHANGED
@@ -1,3 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
1
4
  // src/vc.ts
2
5
  import { z } from "zod";
3
6
  var ContextValidator = z.array(z.string().or(z.record(z.any())));
@@ -429,233 +432,291 @@ var PaginatedEncryptedCredentialRecordsValidator = PaginationResponseValidator.e
429
432
  });
430
433
 
431
434
  // src/lcn.ts
435
+ import { z as z9 } from "zod";
436
+
437
+ // src/queries.ts
432
438
  import { z as z8 } from "zod";
433
- var LCNProfileValidator = z8.object({
434
- profileId: z8.string().min(3).max(40),
435
- displayName: z8.string().default(""),
436
- shortBio: z8.string().default(""),
437
- bio: z8.string().default(""),
438
- did: z8.string(),
439
- email: z8.string().optional(),
440
- image: z8.string().optional(),
441
- heroImage: z8.string().optional(),
442
- websiteLink: z8.string().optional(),
443
- isServiceProfile: z8.boolean().default(false).optional(),
444
- type: z8.string().optional(),
445
- notificationsWebhook: z8.string().url().startsWith("http").optional()
446
- });
439
+ var parseRegexString = /* @__PURE__ */ __name((regexStr) => {
440
+ const match = regexStr.match(/^\/(.*)\/([gimsuy]*)$/);
441
+ if (!match)
442
+ throw new Error("Invalid RegExp string format");
443
+ return { pattern: match[1], flags: match[2] };
444
+ }, "parseRegexString");
445
+ var RegExpValidator = z8.instanceof(RegExp).or(
446
+ z8.string().refine(
447
+ (str) => {
448
+ try {
449
+ parseRegexString(str);
450
+ return true;
451
+ } catch {
452
+ return false;
453
+ }
454
+ },
455
+ {
456
+ message: "Invalid RegExp string format. Must be in format '/pattern/flags'"
457
+ }
458
+ ).transform((str) => {
459
+ const { pattern, flags } = parseRegexString(str);
460
+ try {
461
+ return new RegExp(pattern, flags);
462
+ } catch (error) {
463
+ throw new Error(`Invalid RegExp: ${error.message}`);
464
+ }
465
+ })
466
+ );
467
+ var StringQuery = z8.string().or(z8.object({ $in: z8.string().array() })).or(z8.object({ $regex: RegExpValidator }));
468
+
469
+ // src/lcn.ts
470
+ var LCNProfileDisplayValidator = z9.object({
471
+ backgroundColor: z9.string().optional(),
472
+ backgroundImage: z9.string().optional(),
473
+ fadeBackgroundImage: z9.boolean().optional(),
474
+ repeatBackgroundImage: z9.boolean().optional(),
475
+ fontColor: z9.string().optional(),
476
+ accentColor: z9.string().optional(),
477
+ accentFontColor: z9.string().optional(),
478
+ idBackgroundImage: z9.string().optional(),
479
+ fadeIdBackgroundImage: z9.boolean().optional(),
480
+ idBackgroundColor: z9.string().optional(),
481
+ repeatIdBackgroundImage: z9.boolean().optional()
482
+ });
483
+ var LCNProfileValidator = z9.object({
484
+ profileId: z9.string().min(3).max(40),
485
+ displayName: z9.string().default(""),
486
+ shortBio: z9.string().default(""),
487
+ bio: z9.string().default(""),
488
+ did: z9.string(),
489
+ email: z9.string().optional(),
490
+ image: z9.string().optional(),
491
+ heroImage: z9.string().optional(),
492
+ websiteLink: z9.string().optional(),
493
+ isServiceProfile: z9.boolean().default(false).optional(),
494
+ type: z9.string().optional(),
495
+ notificationsWebhook: z9.string().url().startsWith("http").optional(),
496
+ display: LCNProfileDisplayValidator.optional()
497
+ });
498
+ var LCNProfileQueryValidator = z9.object({
499
+ profileId: StringQuery,
500
+ displayName: StringQuery,
501
+ shortBio: StringQuery,
502
+ bio: StringQuery,
503
+ email: StringQuery,
504
+ websiteLink: StringQuery,
505
+ isServiceProfile: z9.boolean(),
506
+ type: StringQuery
507
+ }).partial();
447
508
  var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
448
509
  records: LCNProfileValidator.array()
449
510
  });
450
- var LCNProfileConnectionStatusEnum = z8.enum([
511
+ var LCNProfileConnectionStatusEnum = z9.enum([
451
512
  "CONNECTED",
452
513
  "PENDING_REQUEST_SENT",
453
514
  "PENDING_REQUEST_RECEIVED",
454
515
  "NOT_CONNECTED"
455
516
  ]);
456
- var SentCredentialInfoValidator = z8.object({
457
- uri: z8.string(),
458
- to: z8.string(),
459
- from: z8.string(),
460
- sent: z8.string().datetime(),
461
- received: z8.string().datetime().optional()
462
- });
463
- var BoostPermissionsValidator = z8.object({
464
- role: z8.string(),
465
- canEdit: z8.boolean(),
466
- canIssue: z8.boolean(),
467
- canRevoke: z8.boolean(),
468
- canManagePermissions: z8.boolean(),
469
- canIssueChildren: z8.string(),
470
- canCreateChildren: z8.string(),
471
- canEditChildren: z8.string(),
472
- canRevokeChildren: z8.string(),
473
- canManageChildrenPermissions: z8.string(),
474
- canViewAnalytics: z8.boolean()
475
- });
476
- var LCNBoostStatus = z8.enum(["DRAFT", "LIVE"]);
477
- var BoostValidator = z8.object({
478
- uri: z8.string(),
479
- name: z8.string().optional(),
480
- type: z8.string().optional(),
481
- category: z8.string().optional(),
517
+ var SentCredentialInfoValidator = z9.object({
518
+ uri: z9.string(),
519
+ to: z9.string(),
520
+ from: z9.string(),
521
+ sent: z9.string().datetime(),
522
+ received: z9.string().datetime().optional()
523
+ });
524
+ var BoostPermissionsValidator = z9.object({
525
+ role: z9.string(),
526
+ canEdit: z9.boolean(),
527
+ canIssue: z9.boolean(),
528
+ canRevoke: z9.boolean(),
529
+ canManagePermissions: z9.boolean(),
530
+ canIssueChildren: z9.string(),
531
+ canCreateChildren: z9.string(),
532
+ canEditChildren: z9.string(),
533
+ canRevokeChildren: z9.string(),
534
+ canManageChildrenPermissions: z9.string(),
535
+ canViewAnalytics: z9.boolean()
536
+ });
537
+ var LCNBoostStatus = z9.enum(["DRAFT", "LIVE"]);
538
+ var BoostValidator = z9.object({
539
+ uri: z9.string(),
540
+ name: z9.string().optional(),
541
+ type: z9.string().optional(),
542
+ category: z9.string().optional(),
482
543
  status: LCNBoostStatus.optional(),
483
- autoConnectRecipients: z8.boolean().optional(),
484
- meta: z8.record(z8.any()).optional(),
544
+ autoConnectRecipients: z9.boolean().optional(),
545
+ meta: z9.record(z9.any()).optional(),
485
546
  claimPermissions: BoostPermissionsValidator.optional()
486
547
  });
487
- var StringQuery = z8.string().or(z8.object({ $in: z8.string().array() })).or(z8.object({ $regex: z8.instanceof(RegExp) }));
488
- var BoostQueryValidator = z8.object({
548
+ var BoostQueryValidator = z9.object({
489
549
  uri: StringQuery,
490
550
  name: StringQuery,
491
551
  type: StringQuery,
492
552
  category: StringQuery,
493
- meta: z8.record(StringQuery),
494
- status: LCNBoostStatus.or(z8.object({ $in: LCNBoostStatus.array() })),
495
- autoConnectRecipients: z8.boolean()
553
+ meta: z9.record(StringQuery),
554
+ status: LCNBoostStatus.or(z9.object({ $in: LCNBoostStatus.array() })),
555
+ autoConnectRecipients: z9.boolean()
496
556
  }).partial();
497
557
  var PaginatedBoostsValidator = PaginationResponseValidator.extend({
498
558
  records: BoostValidator.array()
499
559
  });
500
- var BoostRecipientValidator = z8.object({
560
+ var BoostRecipientValidator = z9.object({
501
561
  to: LCNProfileValidator,
502
- from: z8.string(),
503
- received: z8.string().optional()
562
+ from: z9.string(),
563
+ received: z9.string().optional(),
564
+ uri: z9.string().optional()
504
565
  });
505
566
  var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
506
567
  records: BoostRecipientValidator.array()
507
568
  });
508
- var LCNBoostClaimLinkSigningAuthorityValidator = z8.object({
509
- endpoint: z8.string(),
510
- name: z8.string(),
511
- did: z8.string().optional()
569
+ var LCNBoostClaimLinkSigningAuthorityValidator = z9.object({
570
+ endpoint: z9.string(),
571
+ name: z9.string(),
572
+ did: z9.string().optional()
512
573
  });
513
- var LCNBoostClaimLinkOptionsValidator = z8.object({
514
- ttlSeconds: z8.number().optional(),
515
- totalUses: z8.number().optional()
574
+ var LCNBoostClaimLinkOptionsValidator = z9.object({
575
+ ttlSeconds: z9.number().optional(),
576
+ totalUses: z9.number().optional()
516
577
  });
517
- var LCNSigningAuthorityValidator = z8.object({
518
- endpoint: z8.string()
578
+ var LCNSigningAuthorityValidator = z9.object({
579
+ endpoint: z9.string()
519
580
  });
520
- var LCNSigningAuthorityForUserValidator = z8.object({
581
+ var LCNSigningAuthorityForUserValidator = z9.object({
521
582
  signingAuthority: LCNSigningAuthorityValidator,
522
- relationship: z8.object({
523
- name: z8.string().max(15).regex(/^[a-z0-9-]+$/, {
583
+ relationship: z9.object({
584
+ name: z9.string().max(15).regex(/^[a-z0-9-]+$/, {
524
585
  message: "The input string must contain only lowercase letters, numbers, and hyphens."
525
586
  }),
526
- did: z8.string()
587
+ did: z9.string()
527
588
  })
528
589
  });
529
- var ConsentFlowTermsStatusValidator = z8.enum(["live", "stale", "withdrawn"]);
530
- var ConsentFlowContractValidator = z8.object({
531
- read: z8.object({
532
- anonymize: z8.boolean().optional(),
533
- credentials: z8.object({ categories: z8.record(z8.object({ required: z8.boolean() })).default({}) }).default({}),
534
- personal: z8.record(z8.object({ required: z8.boolean() })).default({})
590
+ var ConsentFlowTermsStatusValidator = z9.enum(["live", "stale", "withdrawn"]);
591
+ var ConsentFlowContractValidator = z9.object({
592
+ read: z9.object({
593
+ anonymize: z9.boolean().optional(),
594
+ credentials: z9.object({ categories: z9.record(z9.object({ required: z9.boolean() })).default({}) }).default({}),
595
+ personal: z9.record(z9.object({ required: z9.boolean() })).default({})
535
596
  }).default({}),
536
- write: z8.object({
537
- credentials: z8.object({ categories: z8.record(z8.object({ required: z8.boolean() })).default({}) }).default({}),
538
- personal: z8.record(z8.object({ required: z8.boolean() })).default({})
597
+ write: z9.object({
598
+ credentials: z9.object({ categories: z9.record(z9.object({ required: z9.boolean() })).default({}) }).default({}),
599
+ personal: z9.record(z9.object({ required: z9.boolean() })).default({})
539
600
  }).default({})
540
601
  });
541
- var ConsentFlowContractDetailsValidator = z8.object({
602
+ var ConsentFlowContractDetailsValidator = z9.object({
542
603
  contract: ConsentFlowContractValidator,
543
604
  owner: LCNProfileValidator,
544
- name: z8.string(),
545
- subtitle: z8.string().optional(),
546
- description: z8.string().optional(),
547
- reasonForAccessing: z8.string().optional(),
548
- image: z8.string().optional(),
549
- uri: z8.string(),
550
- createdAt: z8.string(),
551
- updatedAt: z8.string(),
552
- expiresAt: z8.string().optional()
605
+ name: z9.string(),
606
+ subtitle: z9.string().optional(),
607
+ description: z9.string().optional(),
608
+ reasonForAccessing: z9.string().optional(),
609
+ image: z9.string().optional(),
610
+ uri: z9.string(),
611
+ createdAt: z9.string(),
612
+ updatedAt: z9.string(),
613
+ expiresAt: z9.string().optional()
553
614
  });
554
615
  var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
555
616
  records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
556
617
  });
557
- var ConsentFlowContractDataValidator = z8.object({
558
- credentials: z8.object({ categories: z8.record(z8.string().array()).default({}) }),
559
- personal: z8.record(z8.string()).default({}),
560
- date: z8.string()
618
+ var ConsentFlowContractDataValidator = z9.object({
619
+ credentials: z9.object({ categories: z9.record(z9.string().array()).default({}) }),
620
+ personal: z9.record(z9.string()).default({}),
621
+ date: z9.string()
561
622
  });
562
623
  var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
563
624
  records: ConsentFlowContractDataValidator.array()
564
625
  });
565
- var ConsentFlowTermValidator = z8.object({
566
- sharing: z8.boolean().optional(),
567
- shared: z8.string().array().optional(),
568
- shareAll: z8.boolean().optional(),
569
- shareUntil: z8.string().optional()
570
- });
571
- var ConsentFlowTermsValidator = z8.object({
572
- read: z8.object({
573
- anonymize: z8.boolean().optional(),
574
- credentials: z8.object({
575
- shareAll: z8.boolean().optional(),
576
- sharing: z8.boolean().optional(),
577
- categories: z8.record(ConsentFlowTermValidator).default({})
626
+ var ConsentFlowTermValidator = z9.object({
627
+ sharing: z9.boolean().optional(),
628
+ shared: z9.string().array().optional(),
629
+ shareAll: z9.boolean().optional(),
630
+ shareUntil: z9.string().optional()
631
+ });
632
+ var ConsentFlowTermsValidator = z9.object({
633
+ read: z9.object({
634
+ anonymize: z9.boolean().optional(),
635
+ credentials: z9.object({
636
+ shareAll: z9.boolean().optional(),
637
+ sharing: z9.boolean().optional(),
638
+ categories: z9.record(ConsentFlowTermValidator).default({})
578
639
  }).default({}),
579
- personal: z8.record(z8.string()).default({})
640
+ personal: z9.record(z9.string()).default({})
580
641
  }).default({}),
581
- write: z8.object({
582
- credentials: z8.object({ categories: z8.record(z8.boolean()).default({}) }).default({}),
583
- personal: z8.record(z8.boolean()).default({})
642
+ write: z9.object({
643
+ credentials: z9.object({ categories: z9.record(z9.boolean()).default({}) }).default({}),
644
+ personal: z9.record(z9.boolean()).default({})
584
645
  }).default({})
585
646
  });
586
647
  var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
587
- records: z8.object({
588
- expiresAt: z8.string().optional(),
589
- oneTime: z8.boolean().optional(),
648
+ records: z9.object({
649
+ expiresAt: z9.string().optional(),
650
+ oneTime: z9.boolean().optional(),
590
651
  terms: ConsentFlowTermsValidator,
591
652
  contract: ConsentFlowContractDetailsValidator,
592
- uri: z8.string(),
653
+ uri: z9.string(),
593
654
  consenter: LCNProfileValidator,
594
655
  status: ConsentFlowTermsStatusValidator
595
656
  }).array()
596
657
  });
597
- var ConsentFlowContractQueryValidator = z8.object({
598
- read: z8.object({
599
- anonymize: z8.boolean().optional(),
600
- credentials: z8.object({
601
- categories: z8.record(z8.object({ required: z8.boolean().optional() })).optional()
658
+ var ConsentFlowContractQueryValidator = z9.object({
659
+ read: z9.object({
660
+ anonymize: z9.boolean().optional(),
661
+ credentials: z9.object({
662
+ categories: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
602
663
  }).optional(),
603
- personal: z8.record(z8.object({ required: z8.boolean().optional() })).optional()
664
+ personal: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
604
665
  }).optional(),
605
- write: z8.object({
606
- credentials: z8.object({
607
- categories: z8.record(z8.object({ required: z8.boolean().optional() })).optional()
666
+ write: z9.object({
667
+ credentials: z9.object({
668
+ categories: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
608
669
  }).optional(),
609
- personal: z8.record(z8.object({ required: z8.boolean().optional() })).optional()
670
+ personal: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
610
671
  }).optional()
611
672
  });
612
- var ConsentFlowDataQueryValidator = z8.object({
613
- anonymize: z8.boolean().optional(),
614
- credentials: z8.object({ categories: z8.record(z8.boolean()).optional() }).optional(),
615
- personal: z8.record(z8.boolean()).optional()
616
- });
617
- var ConsentFlowTermsQueryValidator = z8.object({
618
- read: z8.object({
619
- anonymize: z8.boolean().optional(),
620
- credentials: z8.object({
621
- shareAll: z8.boolean().optional(),
622
- sharing: z8.boolean().optional(),
623
- categories: z8.record(ConsentFlowTermValidator.optional()).optional()
673
+ var ConsentFlowDataQueryValidator = z9.object({
674
+ anonymize: z9.boolean().optional(),
675
+ credentials: z9.object({ categories: z9.record(z9.boolean()).optional() }).optional(),
676
+ personal: z9.record(z9.boolean()).optional()
677
+ });
678
+ var ConsentFlowTermsQueryValidator = z9.object({
679
+ read: z9.object({
680
+ anonymize: z9.boolean().optional(),
681
+ credentials: z9.object({
682
+ shareAll: z9.boolean().optional(),
683
+ sharing: z9.boolean().optional(),
684
+ categories: z9.record(ConsentFlowTermValidator.optional()).optional()
624
685
  }).optional(),
625
- personal: z8.record(z8.string()).optional()
686
+ personal: z9.record(z9.string()).optional()
626
687
  }).optional(),
627
- write: z8.object({
628
- credentials: z8.object({ categories: z8.record(z8.boolean()).optional() }).optional(),
629
- personal: z8.record(z8.boolean()).optional()
688
+ write: z9.object({
689
+ credentials: z9.object({ categories: z9.record(z9.boolean()).optional() }).optional(),
690
+ personal: z9.record(z9.boolean()).optional()
630
691
  }).optional()
631
692
  });
632
- var ConsentFlowTransactionActionValidator = z8.enum([
693
+ var ConsentFlowTransactionActionValidator = z9.enum([
633
694
  "consent",
634
695
  "update",
635
696
  "sync",
636
697
  "withdraw"
637
698
  ]);
638
- var ConsentFlowTransactionsQueryValidator = z8.object({
699
+ var ConsentFlowTransactionsQueryValidator = z9.object({
639
700
  terms: ConsentFlowTermsQueryValidator.optional(),
640
701
  action: ConsentFlowTransactionActionValidator.or(
641
702
  ConsentFlowTransactionActionValidator.array()
642
703
  ).optional(),
643
- date: z8.object({ $gt: z8.string() }).or(z8.object({ $lt: z8.string() })).or(z8.object({ $eq: z8.string() })).optional(),
644
- expiresAt: z8.object({ $gt: z8.string() }).or(z8.object({ $lt: z8.string() })).or(z8.object({ $eq: z8.string() })).optional(),
645
- oneTime: z8.boolean().optional()
704
+ date: z9.object({ $gt: z9.string() }).or(z9.object({ $lt: z9.string() })).or(z9.object({ $eq: z9.string() })).optional(),
705
+ expiresAt: z9.object({ $gt: z9.string() }).or(z9.object({ $lt: z9.string() })).or(z9.object({ $eq: z9.string() })).optional(),
706
+ oneTime: z9.boolean().optional()
646
707
  });
647
- var ConsentFlowTransactionValidator = z8.object({
648
- expiresAt: z8.string().optional(),
649
- oneTime: z8.boolean().optional(),
708
+ var ConsentFlowTransactionValidator = z9.object({
709
+ expiresAt: z9.string().optional(),
710
+ oneTime: z9.boolean().optional(),
650
711
  terms: ConsentFlowTermsValidator.optional(),
651
- id: z8.string(),
712
+ id: z9.string(),
652
713
  action: ConsentFlowTransactionActionValidator,
653
- date: z8.string()
714
+ date: z9.string()
654
715
  });
655
716
  var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
656
717
  records: ConsentFlowTransactionValidator.array()
657
718
  });
658
- var LCNNotificationTypeEnumValidator = z8.enum([
719
+ var LCNNotificationTypeEnumValidator = z9.enum([
659
720
  "CONNECTION_REQUEST",
660
721
  "CONNECTION_ACCEPTED",
661
722
  "CREDENTIAL_RECEIVED",
@@ -666,22 +727,22 @@ var LCNNotificationTypeEnumValidator = z8.enum([
666
727
  "PRESENTATION_RECEIVED",
667
728
  "CONSENT_FLOW_TRANSACTION"
668
729
  ]);
669
- var LCNNotificationMessageValidator = z8.object({
670
- title: z8.string().optional(),
671
- body: z8.string().optional()
730
+ var LCNNotificationMessageValidator = z9.object({
731
+ title: z9.string().optional(),
732
+ body: z9.string().optional()
672
733
  });
673
- var LCNNotificationDataValidator = z8.object({
674
- vcUris: z8.array(z8.string()).optional(),
675
- vpUris: z8.array(z8.string()).optional(),
734
+ var LCNNotificationDataValidator = z9.object({
735
+ vcUris: z9.array(z9.string()).optional(),
736
+ vpUris: z9.array(z9.string()).optional(),
676
737
  transaction: ConsentFlowTransactionValidator.optional()
677
738
  });
678
- var LCNNotificationValidator = z8.object({
739
+ var LCNNotificationValidator = z9.object({
679
740
  type: LCNNotificationTypeEnumValidator,
680
- to: LCNProfileValidator.partial().and(z8.object({ did: z8.string() })),
681
- from: LCNProfileValidator.partial().and(z8.object({ did: z8.string() })),
741
+ to: LCNProfileValidator.partial().and(z9.object({ did: z9.string() })),
742
+ from: LCNProfileValidator.partial().and(z9.object({ did: z9.string() })),
682
743
  message: LCNNotificationMessageValidator.optional(),
683
744
  data: LCNNotificationDataValidator.optional(),
684
- sent: z8.string().datetime().optional()
745
+ sent: z9.string().datetime().optional()
685
746
  });
686
747
  export {
687
748
  AchievementCredentialValidator,
@@ -739,6 +800,8 @@ export {
739
800
  LCNNotificationTypeEnumValidator,
740
801
  LCNNotificationValidator,
741
802
  LCNProfileConnectionStatusEnum,
803
+ LCNProfileDisplayValidator,
804
+ LCNProfileQueryValidator,
742
805
  LCNProfileValidator,
743
806
  LCNSigningAuthorityForUserValidator,
744
807
  LCNSigningAuthorityValidator,
@@ -764,7 +827,6 @@ export {
764
827
  RubricCriterionValidator,
765
828
  SentCredentialInfoValidator,
766
829
  ServiceValidator,
767
- StringQuery,
768
830
  UnsignedAchievementCredentialValidator,
769
831
  UnsignedVCValidator,
770
832
  UnsignedVPValidator,