@learncard/types 5.5.6 → 5.5.8

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/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,230 +432,276 @@ 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 LCNProfileValidator = z9.object({
471
+ profileId: z9.string().min(3).max(40),
472
+ displayName: z9.string().default(""),
473
+ shortBio: z9.string().default(""),
474
+ bio: z9.string().default(""),
475
+ did: z9.string(),
476
+ email: z9.string().optional(),
477
+ image: z9.string().optional(),
478
+ heroImage: z9.string().optional(),
479
+ websiteLink: z9.string().optional(),
480
+ isServiceProfile: z9.boolean().default(false).optional(),
481
+ type: z9.string().optional(),
482
+ notificationsWebhook: z9.string().url().startsWith("http").optional()
483
+ });
484
+ var LCNProfileQueryValidator = z9.object({
485
+ profileId: StringQuery,
486
+ displayName: StringQuery,
487
+ shortBio: StringQuery,
488
+ bio: StringQuery,
489
+ email: StringQuery,
490
+ websiteLink: StringQuery,
491
+ isServiceProfile: z9.boolean(),
492
+ type: StringQuery
493
+ }).partial();
447
494
  var PaginatedLCNProfilesValidator = PaginationResponseValidator.extend({
448
495
  records: LCNProfileValidator.array()
449
496
  });
450
- var LCNProfileConnectionStatusEnum = z8.enum([
497
+ var LCNProfileConnectionStatusEnum = z9.enum([
451
498
  "CONNECTED",
452
499
  "PENDING_REQUEST_SENT",
453
500
  "PENDING_REQUEST_RECEIVED",
454
501
  "NOT_CONNECTED"
455
502
  ]);
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(),
503
+ var SentCredentialInfoValidator = z9.object({
504
+ uri: z9.string(),
505
+ to: z9.string(),
506
+ from: z9.string(),
507
+ sent: z9.string().datetime(),
508
+ received: z9.string().datetime().optional()
509
+ });
510
+ var BoostPermissionsValidator = z9.object({
511
+ role: z9.string(),
512
+ canEdit: z9.boolean(),
513
+ canIssue: z9.boolean(),
514
+ canRevoke: z9.boolean(),
515
+ canManagePermissions: z9.boolean(),
516
+ canIssueChildren: z9.string(),
517
+ canCreateChildren: z9.string(),
518
+ canEditChildren: z9.string(),
519
+ canRevokeChildren: z9.string(),
520
+ canManageChildrenPermissions: z9.string(),
521
+ canViewAnalytics: z9.boolean()
522
+ });
523
+ var LCNBoostStatus = z9.enum(["DRAFT", "LIVE"]);
524
+ var BoostValidator = z9.object({
525
+ uri: z9.string(),
526
+ name: z9.string().optional(),
527
+ type: z9.string().optional(),
528
+ category: z9.string().optional(),
482
529
  status: LCNBoostStatus.optional(),
483
- autoConnectRecipients: z8.boolean().optional(),
530
+ autoConnectRecipients: z9.boolean().optional(),
531
+ meta: z9.record(z9.any()).optional(),
484
532
  claimPermissions: BoostPermissionsValidator.optional()
485
533
  });
486
- var BoostQueryValidator = z8.object({
487
- uri: z8.string().or(z8.object({ $in: z8.string().array() })),
488
- name: z8.string().or(z8.object({ $in: z8.string().array() })),
489
- type: z8.string().or(z8.object({ $in: z8.string().array() })),
490
- category: z8.string().or(z8.object({ $in: z8.string().array() })),
491
- status: LCNBoostStatus.or(z8.object({ $in: LCNBoostStatus.array() })),
492
- autoConnectRecipients: z8.boolean()
534
+ var BoostQueryValidator = z9.object({
535
+ uri: StringQuery,
536
+ name: StringQuery,
537
+ type: StringQuery,
538
+ category: StringQuery,
539
+ meta: z9.record(StringQuery),
540
+ status: LCNBoostStatus.or(z9.object({ $in: LCNBoostStatus.array() })),
541
+ autoConnectRecipients: z9.boolean()
493
542
  }).partial();
494
543
  var PaginatedBoostsValidator = PaginationResponseValidator.extend({
495
544
  records: BoostValidator.array()
496
545
  });
497
- var BoostRecipientValidator = z8.object({
546
+ var BoostRecipientValidator = z9.object({
498
547
  to: LCNProfileValidator,
499
- from: z8.string(),
500
- received: z8.string().optional()
548
+ from: z9.string(),
549
+ received: z9.string().optional()
501
550
  });
502
551
  var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
503
552
  records: BoostRecipientValidator.array()
504
553
  });
505
- var LCNBoostClaimLinkSigningAuthorityValidator = z8.object({
506
- endpoint: z8.string(),
507
- name: z8.string(),
508
- did: z8.string().optional()
554
+ var LCNBoostClaimLinkSigningAuthorityValidator = z9.object({
555
+ endpoint: z9.string(),
556
+ name: z9.string(),
557
+ did: z9.string().optional()
509
558
  });
510
- var LCNBoostClaimLinkOptionsValidator = z8.object({
511
- ttlSeconds: z8.number().optional(),
512
- totalUses: z8.number().optional()
559
+ var LCNBoostClaimLinkOptionsValidator = z9.object({
560
+ ttlSeconds: z9.number().optional(),
561
+ totalUses: z9.number().optional()
513
562
  });
514
- var LCNSigningAuthorityValidator = z8.object({
515
- endpoint: z8.string()
563
+ var LCNSigningAuthorityValidator = z9.object({
564
+ endpoint: z9.string()
516
565
  });
517
- var LCNSigningAuthorityForUserValidator = z8.object({
566
+ var LCNSigningAuthorityForUserValidator = z9.object({
518
567
  signingAuthority: LCNSigningAuthorityValidator,
519
- relationship: z8.object({
520
- name: z8.string().max(15).regex(/^[a-z0-9-]+$/, {
568
+ relationship: z9.object({
569
+ name: z9.string().max(15).regex(/^[a-z0-9-]+$/, {
521
570
  message: "The input string must contain only lowercase letters, numbers, and hyphens."
522
571
  }),
523
- did: z8.string()
572
+ did: z9.string()
524
573
  })
525
574
  });
526
- var ConsentFlowTermsStatusValidator = z8.enum(["live", "stale", "withdrawn"]);
527
- var ConsentFlowContractValidator = z8.object({
528
- read: z8.object({
529
- anonymize: z8.boolean().optional(),
530
- credentials: z8.object({ categories: z8.record(z8.object({ required: z8.boolean() })).default({}) }).default({}),
531
- personal: z8.record(z8.object({ required: z8.boolean() })).default({})
575
+ var ConsentFlowTermsStatusValidator = z9.enum(["live", "stale", "withdrawn"]);
576
+ var ConsentFlowContractValidator = z9.object({
577
+ read: z9.object({
578
+ anonymize: z9.boolean().optional(),
579
+ credentials: z9.object({ categories: z9.record(z9.object({ required: z9.boolean() })).default({}) }).default({}),
580
+ personal: z9.record(z9.object({ required: z9.boolean() })).default({})
532
581
  }).default({}),
533
- write: z8.object({
534
- credentials: z8.object({ categories: z8.record(z8.object({ required: z8.boolean() })).default({}) }).default({}),
535
- personal: z8.record(z8.object({ required: z8.boolean() })).default({})
582
+ write: z9.object({
583
+ credentials: z9.object({ categories: z9.record(z9.object({ required: z9.boolean() })).default({}) }).default({}),
584
+ personal: z9.record(z9.object({ required: z9.boolean() })).default({})
536
585
  }).default({})
537
586
  });
538
- var ConsentFlowContractDetailsValidator = z8.object({
587
+ var ConsentFlowContractDetailsValidator = z9.object({
539
588
  contract: ConsentFlowContractValidator,
540
589
  owner: LCNProfileValidator,
541
- name: z8.string(),
542
- subtitle: z8.string().optional(),
543
- description: z8.string().optional(),
544
- reasonForAccessing: z8.string().optional(),
545
- image: z8.string().optional(),
546
- uri: z8.string(),
547
- createdAt: z8.string(),
548
- updatedAt: z8.string(),
549
- expiresAt: z8.string().optional()
590
+ name: z9.string(),
591
+ subtitle: z9.string().optional(),
592
+ description: z9.string().optional(),
593
+ reasonForAccessing: z9.string().optional(),
594
+ image: z9.string().optional(),
595
+ uri: z9.string(),
596
+ createdAt: z9.string(),
597
+ updatedAt: z9.string(),
598
+ expiresAt: z9.string().optional()
550
599
  });
551
600
  var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
552
601
  records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
553
602
  });
554
- var ConsentFlowContractDataValidator = z8.object({
555
- credentials: z8.object({ categories: z8.record(z8.string().array()).default({}) }),
556
- personal: z8.record(z8.string()).default({}),
557
- date: z8.string()
603
+ var ConsentFlowContractDataValidator = z9.object({
604
+ credentials: z9.object({ categories: z9.record(z9.string().array()).default({}) }),
605
+ personal: z9.record(z9.string()).default({}),
606
+ date: z9.string()
558
607
  });
559
608
  var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
560
609
  records: ConsentFlowContractDataValidator.array()
561
610
  });
562
- var ConsentFlowTermValidator = z8.object({
563
- sharing: z8.boolean().optional(),
564
- shared: z8.string().array().optional(),
565
- shareAll: z8.boolean().optional(),
566
- shareUntil: z8.string().optional()
567
- });
568
- var ConsentFlowTermsValidator = z8.object({
569
- read: z8.object({
570
- anonymize: z8.boolean().optional(),
571
- credentials: z8.object({
572
- shareAll: z8.boolean().optional(),
573
- sharing: z8.boolean().optional(),
574
- categories: z8.record(ConsentFlowTermValidator).default({})
611
+ var ConsentFlowTermValidator = z9.object({
612
+ sharing: z9.boolean().optional(),
613
+ shared: z9.string().array().optional(),
614
+ shareAll: z9.boolean().optional(),
615
+ shareUntil: z9.string().optional()
616
+ });
617
+ var ConsentFlowTermsValidator = z9.object({
618
+ read: z9.object({
619
+ anonymize: z9.boolean().optional(),
620
+ credentials: z9.object({
621
+ shareAll: z9.boolean().optional(),
622
+ sharing: z9.boolean().optional(),
623
+ categories: z9.record(ConsentFlowTermValidator).default({})
575
624
  }).default({}),
576
- personal: z8.record(z8.string()).default({})
625
+ personal: z9.record(z9.string()).default({})
577
626
  }).default({}),
578
- write: z8.object({
579
- credentials: z8.object({ categories: z8.record(z8.boolean()).default({}) }).default({}),
580
- personal: z8.record(z8.boolean()).default({})
627
+ write: z9.object({
628
+ credentials: z9.object({ categories: z9.record(z9.boolean()).default({}) }).default({}),
629
+ personal: z9.record(z9.boolean()).default({})
581
630
  }).default({})
582
631
  });
583
632
  var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
584
- records: z8.object({
585
- expiresAt: z8.string().optional(),
586
- oneTime: z8.boolean().optional(),
633
+ records: z9.object({
634
+ expiresAt: z9.string().optional(),
635
+ oneTime: z9.boolean().optional(),
587
636
  terms: ConsentFlowTermsValidator,
588
637
  contract: ConsentFlowContractDetailsValidator,
589
- uri: z8.string(),
638
+ uri: z9.string(),
590
639
  consenter: LCNProfileValidator,
591
640
  status: ConsentFlowTermsStatusValidator
592
641
  }).array()
593
642
  });
594
- var ConsentFlowContractQueryValidator = z8.object({
595
- read: z8.object({
596
- anonymize: z8.boolean().optional(),
597
- credentials: z8.object({
598
- categories: z8.record(z8.object({ required: z8.boolean().optional() })).optional()
643
+ var ConsentFlowContractQueryValidator = z9.object({
644
+ read: z9.object({
645
+ anonymize: z9.boolean().optional(),
646
+ credentials: z9.object({
647
+ categories: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
599
648
  }).optional(),
600
- personal: z8.record(z8.object({ required: z8.boolean().optional() })).optional()
649
+ personal: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
601
650
  }).optional(),
602
- write: z8.object({
603
- credentials: z8.object({
604
- categories: z8.record(z8.object({ required: z8.boolean().optional() })).optional()
651
+ write: z9.object({
652
+ credentials: z9.object({
653
+ categories: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
605
654
  }).optional(),
606
- personal: z8.record(z8.object({ required: z8.boolean().optional() })).optional()
655
+ personal: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
607
656
  }).optional()
608
657
  });
609
- var ConsentFlowDataQueryValidator = z8.object({
610
- anonymize: z8.boolean().optional(),
611
- credentials: z8.object({ categories: z8.record(z8.boolean()).optional() }).optional(),
612
- personal: z8.record(z8.boolean()).optional()
613
- });
614
- var ConsentFlowTermsQueryValidator = z8.object({
615
- read: z8.object({
616
- anonymize: z8.boolean().optional(),
617
- credentials: z8.object({
618
- shareAll: z8.boolean().optional(),
619
- sharing: z8.boolean().optional(),
620
- categories: z8.record(ConsentFlowTermValidator.optional()).optional()
658
+ var ConsentFlowDataQueryValidator = z9.object({
659
+ anonymize: z9.boolean().optional(),
660
+ credentials: z9.object({ categories: z9.record(z9.boolean()).optional() }).optional(),
661
+ personal: z9.record(z9.boolean()).optional()
662
+ });
663
+ var ConsentFlowTermsQueryValidator = z9.object({
664
+ read: z9.object({
665
+ anonymize: z9.boolean().optional(),
666
+ credentials: z9.object({
667
+ shareAll: z9.boolean().optional(),
668
+ sharing: z9.boolean().optional(),
669
+ categories: z9.record(ConsentFlowTermValidator.optional()).optional()
621
670
  }).optional(),
622
- personal: z8.record(z8.string()).optional()
671
+ personal: z9.record(z9.string()).optional()
623
672
  }).optional(),
624
- write: z8.object({
625
- credentials: z8.object({ categories: z8.record(z8.boolean()).optional() }).optional(),
626
- personal: z8.record(z8.boolean()).optional()
673
+ write: z9.object({
674
+ credentials: z9.object({ categories: z9.record(z9.boolean()).optional() }).optional(),
675
+ personal: z9.record(z9.boolean()).optional()
627
676
  }).optional()
628
677
  });
629
- var ConsentFlowTransactionActionValidator = z8.enum([
678
+ var ConsentFlowTransactionActionValidator = z9.enum([
630
679
  "consent",
631
680
  "update",
632
681
  "sync",
633
682
  "withdraw"
634
683
  ]);
635
- var ConsentFlowTransactionsQueryValidator = z8.object({
684
+ var ConsentFlowTransactionsQueryValidator = z9.object({
636
685
  terms: ConsentFlowTermsQueryValidator.optional(),
637
686
  action: ConsentFlowTransactionActionValidator.or(
638
687
  ConsentFlowTransactionActionValidator.array()
639
688
  ).optional(),
640
- date: z8.object({ $gt: z8.string() }).or(z8.object({ $lt: z8.string() })).or(z8.object({ $eq: z8.string() })).optional(),
641
- expiresAt: z8.object({ $gt: z8.string() }).or(z8.object({ $lt: z8.string() })).or(z8.object({ $eq: z8.string() })).optional(),
642
- oneTime: z8.boolean().optional()
689
+ date: z9.object({ $gt: z9.string() }).or(z9.object({ $lt: z9.string() })).or(z9.object({ $eq: z9.string() })).optional(),
690
+ expiresAt: z9.object({ $gt: z9.string() }).or(z9.object({ $lt: z9.string() })).or(z9.object({ $eq: z9.string() })).optional(),
691
+ oneTime: z9.boolean().optional()
643
692
  });
644
- var ConsentFlowTransactionValidator = z8.object({
645
- expiresAt: z8.string().optional(),
646
- oneTime: z8.boolean().optional(),
693
+ var ConsentFlowTransactionValidator = z9.object({
694
+ expiresAt: z9.string().optional(),
695
+ oneTime: z9.boolean().optional(),
647
696
  terms: ConsentFlowTermsValidator.optional(),
648
- id: z8.string(),
697
+ id: z9.string(),
649
698
  action: ConsentFlowTransactionActionValidator,
650
- date: z8.string()
699
+ date: z9.string()
651
700
  });
652
701
  var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
653
702
  records: ConsentFlowTransactionValidator.array()
654
703
  });
655
- var LCNNotificationTypeEnumValidator = z8.enum([
704
+ var LCNNotificationTypeEnumValidator = z9.enum([
656
705
  "CONNECTION_REQUEST",
657
706
  "CONNECTION_ACCEPTED",
658
707
  "CREDENTIAL_RECEIVED",
@@ -663,22 +712,22 @@ var LCNNotificationTypeEnumValidator = z8.enum([
663
712
  "PRESENTATION_RECEIVED",
664
713
  "CONSENT_FLOW_TRANSACTION"
665
714
  ]);
666
- var LCNNotificationMessageValidator = z8.object({
667
- title: z8.string().optional(),
668
- body: z8.string().optional()
715
+ var LCNNotificationMessageValidator = z9.object({
716
+ title: z9.string().optional(),
717
+ body: z9.string().optional()
669
718
  });
670
- var LCNNotificationDataValidator = z8.object({
671
- vcUris: z8.array(z8.string()).optional(),
672
- vpUris: z8.array(z8.string()).optional(),
719
+ var LCNNotificationDataValidator = z9.object({
720
+ vcUris: z9.array(z9.string()).optional(),
721
+ vpUris: z9.array(z9.string()).optional(),
673
722
  transaction: ConsentFlowTransactionValidator.optional()
674
723
  });
675
- var LCNNotificationValidator = z8.object({
724
+ var LCNNotificationValidator = z9.object({
676
725
  type: LCNNotificationTypeEnumValidator,
677
- to: LCNProfileValidator.partial().and(z8.object({ did: z8.string() })),
678
- from: LCNProfileValidator.partial().and(z8.object({ did: z8.string() })),
726
+ to: LCNProfileValidator.partial().and(z9.object({ did: z9.string() })),
727
+ from: LCNProfileValidator.partial().and(z9.object({ did: z9.string() })),
679
728
  message: LCNNotificationMessageValidator.optional(),
680
729
  data: LCNNotificationDataValidator.optional(),
681
- sent: z8.string().datetime().optional()
730
+ sent: z9.string().datetime().optional()
682
731
  });
683
732
  export {
684
733
  AchievementCredentialValidator,
@@ -736,6 +785,7 @@ export {
736
785
  LCNNotificationTypeEnumValidator,
737
786
  LCNNotificationValidator,
738
787
  LCNProfileConnectionStatusEnum,
788
+ LCNProfileQueryValidator,
739
789
  LCNProfileValidator,
740
790
  LCNSigningAuthorityForUserValidator,
741
791
  LCNSigningAuthorityValidator,