@learncard/types 5.5.7 → 5.5.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/lcn.d.ts +184 -28
- 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 +42 -2
- 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 +202 -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,233 +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:
|
484
|
-
meta:
|
530
|
+
autoConnectRecipients: z9.boolean().optional(),
|
531
|
+
meta: z9.record(z9.any()).optional(),
|
485
532
|
claimPermissions: BoostPermissionsValidator.optional()
|
486
533
|
});
|
487
|
-
var
|
488
|
-
var BoostQueryValidator = z8.object({
|
534
|
+
var BoostQueryValidator = z9.object({
|
489
535
|
uri: StringQuery,
|
490
536
|
name: StringQuery,
|
491
537
|
type: StringQuery,
|
492
538
|
category: StringQuery,
|
493
|
-
meta:
|
494
|
-
status: LCNBoostStatus.or(
|
495
|
-
autoConnectRecipients:
|
539
|
+
meta: z9.record(StringQuery),
|
540
|
+
status: LCNBoostStatus.or(z9.object({ $in: LCNBoostStatus.array() })),
|
541
|
+
autoConnectRecipients: z9.boolean()
|
496
542
|
}).partial();
|
497
543
|
var PaginatedBoostsValidator = PaginationResponseValidator.extend({
|
498
544
|
records: BoostValidator.array()
|
499
545
|
});
|
500
|
-
var BoostRecipientValidator =
|
546
|
+
var BoostRecipientValidator = z9.object({
|
501
547
|
to: LCNProfileValidator,
|
502
|
-
from:
|
503
|
-
received:
|
548
|
+
from: z9.string(),
|
549
|
+
received: z9.string().optional()
|
504
550
|
});
|
505
551
|
var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
506
552
|
records: BoostRecipientValidator.array()
|
507
553
|
});
|
508
|
-
var LCNBoostClaimLinkSigningAuthorityValidator =
|
509
|
-
endpoint:
|
510
|
-
name:
|
511
|
-
did:
|
554
|
+
var LCNBoostClaimLinkSigningAuthorityValidator = z9.object({
|
555
|
+
endpoint: z9.string(),
|
556
|
+
name: z9.string(),
|
557
|
+
did: z9.string().optional()
|
512
558
|
});
|
513
|
-
var LCNBoostClaimLinkOptionsValidator =
|
514
|
-
ttlSeconds:
|
515
|
-
totalUses:
|
559
|
+
var LCNBoostClaimLinkOptionsValidator = z9.object({
|
560
|
+
ttlSeconds: z9.number().optional(),
|
561
|
+
totalUses: z9.number().optional()
|
516
562
|
});
|
517
|
-
var LCNSigningAuthorityValidator =
|
518
|
-
endpoint:
|
563
|
+
var LCNSigningAuthorityValidator = z9.object({
|
564
|
+
endpoint: z9.string()
|
519
565
|
});
|
520
|
-
var LCNSigningAuthorityForUserValidator =
|
566
|
+
var LCNSigningAuthorityForUserValidator = z9.object({
|
521
567
|
signingAuthority: LCNSigningAuthorityValidator,
|
522
|
-
relationship:
|
523
|
-
name:
|
568
|
+
relationship: z9.object({
|
569
|
+
name: z9.string().max(15).regex(/^[a-z0-9-]+$/, {
|
524
570
|
message: "The input string must contain only lowercase letters, numbers, and hyphens."
|
525
571
|
}),
|
526
|
-
did:
|
572
|
+
did: z9.string()
|
527
573
|
})
|
528
574
|
});
|
529
|
-
var ConsentFlowTermsStatusValidator =
|
530
|
-
var ConsentFlowContractValidator =
|
531
|
-
read:
|
532
|
-
anonymize:
|
533
|
-
credentials:
|
534
|
-
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({})
|
535
581
|
}).default({}),
|
536
|
-
write:
|
537
|
-
credentials:
|
538
|
-
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({})
|
539
585
|
}).default({})
|
540
586
|
});
|
541
|
-
var ConsentFlowContractDetailsValidator =
|
587
|
+
var ConsentFlowContractDetailsValidator = z9.object({
|
542
588
|
contract: ConsentFlowContractValidator,
|
543
589
|
owner: LCNProfileValidator,
|
544
|
-
name:
|
545
|
-
subtitle:
|
546
|
-
description:
|
547
|
-
reasonForAccessing:
|
548
|
-
image:
|
549
|
-
uri:
|
550
|
-
createdAt:
|
551
|
-
updatedAt:
|
552
|
-
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()
|
553
599
|
});
|
554
600
|
var PaginatedConsentFlowContractsValidator = PaginationResponseValidator.extend({
|
555
601
|
records: ConsentFlowContractDetailsValidator.omit({ owner: true }).array()
|
556
602
|
});
|
557
|
-
var ConsentFlowContractDataValidator =
|
558
|
-
credentials:
|
559
|
-
personal:
|
560
|
-
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()
|
561
607
|
});
|
562
608
|
var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
|
563
609
|
records: ConsentFlowContractDataValidator.array()
|
564
610
|
});
|
565
|
-
var ConsentFlowTermValidator =
|
566
|
-
sharing:
|
567
|
-
shared:
|
568
|
-
shareAll:
|
569
|
-
shareUntil:
|
570
|
-
});
|
571
|
-
var ConsentFlowTermsValidator =
|
572
|
-
read:
|
573
|
-
anonymize:
|
574
|
-
credentials:
|
575
|
-
shareAll:
|
576
|
-
sharing:
|
577
|
-
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({})
|
578
624
|
}).default({}),
|
579
|
-
personal:
|
625
|
+
personal: z9.record(z9.string()).default({})
|
580
626
|
}).default({}),
|
581
|
-
write:
|
582
|
-
credentials:
|
583
|
-
personal:
|
627
|
+
write: z9.object({
|
628
|
+
credentials: z9.object({ categories: z9.record(z9.boolean()).default({}) }).default({}),
|
629
|
+
personal: z9.record(z9.boolean()).default({})
|
584
630
|
}).default({})
|
585
631
|
});
|
586
632
|
var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
|
587
|
-
records:
|
588
|
-
expiresAt:
|
589
|
-
oneTime:
|
633
|
+
records: z9.object({
|
634
|
+
expiresAt: z9.string().optional(),
|
635
|
+
oneTime: z9.boolean().optional(),
|
590
636
|
terms: ConsentFlowTermsValidator,
|
591
637
|
contract: ConsentFlowContractDetailsValidator,
|
592
|
-
uri:
|
638
|
+
uri: z9.string(),
|
593
639
|
consenter: LCNProfileValidator,
|
594
640
|
status: ConsentFlowTermsStatusValidator
|
595
641
|
}).array()
|
596
642
|
});
|
597
|
-
var ConsentFlowContractQueryValidator =
|
598
|
-
read:
|
599
|
-
anonymize:
|
600
|
-
credentials:
|
601
|
-
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()
|
602
648
|
}).optional(),
|
603
|
-
personal:
|
649
|
+
personal: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
|
604
650
|
}).optional(),
|
605
|
-
write:
|
606
|
-
credentials:
|
607
|
-
categories:
|
651
|
+
write: z9.object({
|
652
|
+
credentials: z9.object({
|
653
|
+
categories: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
|
608
654
|
}).optional(),
|
609
|
-
personal:
|
655
|
+
personal: z9.record(z9.object({ required: z9.boolean().optional() })).optional()
|
610
656
|
}).optional()
|
611
657
|
});
|
612
|
-
var ConsentFlowDataQueryValidator =
|
613
|
-
anonymize:
|
614
|
-
credentials:
|
615
|
-
personal:
|
616
|
-
});
|
617
|
-
var ConsentFlowTermsQueryValidator =
|
618
|
-
read:
|
619
|
-
anonymize:
|
620
|
-
credentials:
|
621
|
-
shareAll:
|
622
|
-
sharing:
|
623
|
-
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()
|
624
670
|
}).optional(),
|
625
|
-
personal:
|
671
|
+
personal: z9.record(z9.string()).optional()
|
626
672
|
}).optional(),
|
627
|
-
write:
|
628
|
-
credentials:
|
629
|
-
personal:
|
673
|
+
write: z9.object({
|
674
|
+
credentials: z9.object({ categories: z9.record(z9.boolean()).optional() }).optional(),
|
675
|
+
personal: z9.record(z9.boolean()).optional()
|
630
676
|
}).optional()
|
631
677
|
});
|
632
|
-
var ConsentFlowTransactionActionValidator =
|
678
|
+
var ConsentFlowTransactionActionValidator = z9.enum([
|
633
679
|
"consent",
|
634
680
|
"update",
|
635
681
|
"sync",
|
636
682
|
"withdraw"
|
637
683
|
]);
|
638
|
-
var ConsentFlowTransactionsQueryValidator =
|
684
|
+
var ConsentFlowTransactionsQueryValidator = z9.object({
|
639
685
|
terms: ConsentFlowTermsQueryValidator.optional(),
|
640
686
|
action: ConsentFlowTransactionActionValidator.or(
|
641
687
|
ConsentFlowTransactionActionValidator.array()
|
642
688
|
).optional(),
|
643
|
-
date:
|
644
|
-
expiresAt:
|
645
|
-
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()
|
646
692
|
});
|
647
|
-
var ConsentFlowTransactionValidator =
|
648
|
-
expiresAt:
|
649
|
-
oneTime:
|
693
|
+
var ConsentFlowTransactionValidator = z9.object({
|
694
|
+
expiresAt: z9.string().optional(),
|
695
|
+
oneTime: z9.boolean().optional(),
|
650
696
|
terms: ConsentFlowTermsValidator.optional(),
|
651
|
-
id:
|
697
|
+
id: z9.string(),
|
652
698
|
action: ConsentFlowTransactionActionValidator,
|
653
|
-
date:
|
699
|
+
date: z9.string()
|
654
700
|
});
|
655
701
|
var PaginatedConsentFlowTransactionsValidator = PaginationResponseValidator.extend({
|
656
702
|
records: ConsentFlowTransactionValidator.array()
|
657
703
|
});
|
658
|
-
var LCNNotificationTypeEnumValidator =
|
704
|
+
var LCNNotificationTypeEnumValidator = z9.enum([
|
659
705
|
"CONNECTION_REQUEST",
|
660
706
|
"CONNECTION_ACCEPTED",
|
661
707
|
"CREDENTIAL_RECEIVED",
|
@@ -666,22 +712,22 @@ var LCNNotificationTypeEnumValidator = z8.enum([
|
|
666
712
|
"PRESENTATION_RECEIVED",
|
667
713
|
"CONSENT_FLOW_TRANSACTION"
|
668
714
|
]);
|
669
|
-
var LCNNotificationMessageValidator =
|
670
|
-
title:
|
671
|
-
body:
|
715
|
+
var LCNNotificationMessageValidator = z9.object({
|
716
|
+
title: z9.string().optional(),
|
717
|
+
body: z9.string().optional()
|
672
718
|
});
|
673
|
-
var LCNNotificationDataValidator =
|
674
|
-
vcUris:
|
675
|
-
vpUris:
|
719
|
+
var LCNNotificationDataValidator = z9.object({
|
720
|
+
vcUris: z9.array(z9.string()).optional(),
|
721
|
+
vpUris: z9.array(z9.string()).optional(),
|
676
722
|
transaction: ConsentFlowTransactionValidator.optional()
|
677
723
|
});
|
678
|
-
var LCNNotificationValidator =
|
724
|
+
var LCNNotificationValidator = z9.object({
|
679
725
|
type: LCNNotificationTypeEnumValidator,
|
680
|
-
to: LCNProfileValidator.partial().and(
|
681
|
-
from: LCNProfileValidator.partial().and(
|
726
|
+
to: LCNProfileValidator.partial().and(z9.object({ did: z9.string() })),
|
727
|
+
from: LCNProfileValidator.partial().and(z9.object({ did: z9.string() })),
|
682
728
|
message: LCNNotificationMessageValidator.optional(),
|
683
729
|
data: LCNNotificationDataValidator.optional(),
|
684
|
-
sent:
|
730
|
+
sent: z9.string().datetime().optional()
|
685
731
|
});
|
686
732
|
export {
|
687
733
|
AchievementCredentialValidator,
|
@@ -739,6 +785,7 @@ export {
|
|
739
785
|
LCNNotificationTypeEnumValidator,
|
740
786
|
LCNNotificationValidator,
|
741
787
|
LCNProfileConnectionStatusEnum,
|
788
|
+
LCNProfileQueryValidator,
|
742
789
|
LCNProfileValidator,
|
743
790
|
LCNSigningAuthorityForUserValidator,
|
744
791
|
LCNSigningAuthorityValidator,
|
@@ -764,7 +811,6 @@ export {
|
|
764
811
|
RubricCriterionValidator,
|
765
812
|
SentCredentialInfoValidator,
|
766
813
|
ServiceValidator,
|
767
|
-
StringQuery,
|
768
814
|
UnsignedAchievementCredentialValidator,
|
769
815
|
UnsignedVCValidator,
|
770
816
|
UnsignedVPValidator,
|