@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/lcn.d.ts +244 -4
- package/dist/lcn.d.ts.map +1 -1
- package/dist/queries.d.ts +16 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/types.cjs.development.js +48 -4
- package/dist/types.cjs.development.js.map +3 -3
- package/dist/types.cjs.production.min.js +1 -1
- package/dist/types.cjs.production.min.js.map +4 -4
- package/dist/types.esm.js +206 -156
- package/dist/types.esm.js.map +4 -4
- package/package.json +1 -1
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
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
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 =
|
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 =
|
457
|
-
uri:
|
458
|
-
to:
|
459
|
-
from:
|
460
|
-
sent:
|
461
|
-
received:
|
462
|
-
});
|
463
|
-
var BoostPermissionsValidator =
|
464
|
-
role:
|
465
|
-
canEdit:
|
466
|
-
canIssue:
|
467
|
-
canRevoke:
|
468
|
-
canManagePermissions:
|
469
|
-
canIssueChildren:
|
470
|
-
canCreateChildren:
|
471
|
-
canEditChildren:
|
472
|
-
canRevokeChildren:
|
473
|
-
canManageChildrenPermissions:
|
474
|
-
canViewAnalytics:
|
475
|
-
});
|
476
|
-
var LCNBoostStatus =
|
477
|
-
var BoostValidator =
|
478
|
-
uri:
|
479
|
-
name:
|
480
|
-
type:
|
481
|
-
category:
|
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:
|
530
|
+
autoConnectRecipients: z9.boolean().optional(),
|
531
|
+
meta: z9.record(z9.any()).optional(),
|
484
532
|
claimPermissions: BoostPermissionsValidator.optional()
|
485
533
|
});
|
486
|
-
var BoostQueryValidator =
|
487
|
-
uri:
|
488
|
-
name:
|
489
|
-
type:
|
490
|
-
category:
|
491
|
-
|
492
|
-
|
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 =
|
546
|
+
var BoostRecipientValidator = z9.object({
|
498
547
|
to: LCNProfileValidator,
|
499
|
-
from:
|
500
|
-
received:
|
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 =
|
506
|
-
endpoint:
|
507
|
-
name:
|
508
|
-
did:
|
554
|
+
var LCNBoostClaimLinkSigningAuthorityValidator = z9.object({
|
555
|
+
endpoint: z9.string(),
|
556
|
+
name: z9.string(),
|
557
|
+
did: z9.string().optional()
|
509
558
|
});
|
510
|
-
var LCNBoostClaimLinkOptionsValidator =
|
511
|
-
ttlSeconds:
|
512
|
-
totalUses:
|
559
|
+
var LCNBoostClaimLinkOptionsValidator = z9.object({
|
560
|
+
ttlSeconds: z9.number().optional(),
|
561
|
+
totalUses: z9.number().optional()
|
513
562
|
});
|
514
|
-
var LCNSigningAuthorityValidator =
|
515
|
-
endpoint:
|
563
|
+
var LCNSigningAuthorityValidator = z9.object({
|
564
|
+
endpoint: z9.string()
|
516
565
|
});
|
517
|
-
var LCNSigningAuthorityForUserValidator =
|
566
|
+
var LCNSigningAuthorityForUserValidator = z9.object({
|
518
567
|
signingAuthority: LCNSigningAuthorityValidator,
|
519
|
-
relationship:
|
520
|
-
name:
|
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:
|
572
|
+
did: z9.string()
|
524
573
|
})
|
525
574
|
});
|
526
|
-
var ConsentFlowTermsStatusValidator =
|
527
|
-
var ConsentFlowContractValidator =
|
528
|
-
read:
|
529
|
-
anonymize:
|
530
|
-
credentials:
|
531
|
-
personal:
|
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:
|
534
|
-
credentials:
|
535
|
-
personal:
|
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 =
|
587
|
+
var ConsentFlowContractDetailsValidator = z9.object({
|
539
588
|
contract: ConsentFlowContractValidator,
|
540
589
|
owner: LCNProfileValidator,
|
541
|
-
name:
|
542
|
-
subtitle:
|
543
|
-
description:
|
544
|
-
reasonForAccessing:
|
545
|
-
image:
|
546
|
-
uri:
|
547
|
-
createdAt:
|
548
|
-
updatedAt:
|
549
|
-
expiresAt:
|
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 =
|
555
|
-
credentials:
|
556
|
-
personal:
|
557
|
-
date:
|
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 =
|
563
|
-
sharing:
|
564
|
-
shared:
|
565
|
-
shareAll:
|
566
|
-
shareUntil:
|
567
|
-
});
|
568
|
-
var ConsentFlowTermsValidator =
|
569
|
-
read:
|
570
|
-
anonymize:
|
571
|
-
credentials:
|
572
|
-
shareAll:
|
573
|
-
sharing:
|
574
|
-
categories:
|
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:
|
625
|
+
personal: z9.record(z9.string()).default({})
|
577
626
|
}).default({}),
|
578
|
-
write:
|
579
|
-
credentials:
|
580
|
-
personal:
|
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:
|
585
|
-
expiresAt:
|
586
|
-
oneTime:
|
633
|
+
records: z9.object({
|
634
|
+
expiresAt: z9.string().optional(),
|
635
|
+
oneTime: z9.boolean().optional(),
|
587
636
|
terms: ConsentFlowTermsValidator,
|
588
637
|
contract: ConsentFlowContractDetailsValidator,
|
589
|
-
uri:
|
638
|
+
uri: z9.string(),
|
590
639
|
consenter: LCNProfileValidator,
|
591
640
|
status: ConsentFlowTermsStatusValidator
|
592
641
|
}).array()
|
593
642
|
});
|
594
|
-
var ConsentFlowContractQueryValidator =
|
595
|
-
read:
|
596
|
-
anonymize:
|
597
|
-
credentials:
|
598
|
-
categories:
|
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:
|
649
|
+
personal: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
|
601
650
|
}).optional(),
|
602
|
-
write:
|
603
|
-
credentials:
|
604
|
-
categories:
|
651
|
+
write: z9.object({
|
652
|
+
credentials: z9.object({
|
653
|
+
categories: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
|
605
654
|
}).optional(),
|
606
|
-
personal:
|
655
|
+
personal: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
|
607
656
|
}).optional()
|
608
657
|
});
|
609
|
-
var ConsentFlowDataQueryValidator =
|
610
|
-
anonymize:
|
611
|
-
credentials:
|
612
|
-
personal:
|
613
|
-
});
|
614
|
-
var ConsentFlowTermsQueryValidator =
|
615
|
-
read:
|
616
|
-
anonymize:
|
617
|
-
credentials:
|
618
|
-
shareAll:
|
619
|
-
sharing:
|
620
|
-
categories:
|
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:
|
671
|
+
personal: z9.record(z9.string()).optional()
|
623
672
|
}).optional(),
|
624
|
-
write:
|
625
|
-
credentials:
|
626
|
-
personal:
|
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 =
|
678
|
+
var ConsentFlowTransactionActionValidator = z9.enum([
|
630
679
|
"consent",
|
631
680
|
"update",
|
632
681
|
"sync",
|
633
682
|
"withdraw"
|
634
683
|
]);
|
635
|
-
var ConsentFlowTransactionsQueryValidator =
|
684
|
+
var ConsentFlowTransactionsQueryValidator = z9.object({
|
636
685
|
terms: ConsentFlowTermsQueryValidator.optional(),
|
637
686
|
action: ConsentFlowTransactionActionValidator.or(
|
638
687
|
ConsentFlowTransactionActionValidator.array()
|
639
688
|
).optional(),
|
640
|
-
date:
|
641
|
-
expiresAt:
|
642
|
-
oneTime:
|
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 =
|
645
|
-
expiresAt:
|
646
|
-
oneTime:
|
693
|
+
var ConsentFlowTransactionValidator = z9.object({
|
694
|
+
expiresAt: z9.string().optional(),
|
695
|
+
oneTime: z9.boolean().optional(),
|
647
696
|
terms: ConsentFlowTermsValidator.optional(),
|
648
|
-
id:
|
697
|
+
id: z9.string(),
|
649
698
|
action: ConsentFlowTransactionActionValidator,
|
650
|
-
date:
|
699
|
+
date: z9.string()
|
651
700
|
});
|
652
701
|
var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
|
653
702
|
records: ConsentFlowTransactionValidator.array()
|
654
703
|
});
|
655
|
-
var LCNNotificationTypeEnumValidator =
|
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 =
|
667
|
-
title:
|
668
|
-
body:
|
715
|
+
var LCNNotificationMessageValidator = z9.object({
|
716
|
+
title: z9.string().optional(),
|
717
|
+
body: z9.string().optional()
|
669
718
|
});
|
670
|
-
var LCNNotificationDataValidator =
|
671
|
-
vcUris:
|
672
|
-
vpUris:
|
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 =
|
724
|
+
var LCNNotificationValidator = z9.object({
|
676
725
|
type: LCNNotificationTypeEnumValidator,
|
677
|
-
to: LCNProfileValidator.partial().and(
|
678
|
-
from: LCNProfileValidator.partial().and(
|
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:
|
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,
|