@learncard/types 5.22.0 → 5.23.0
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/__tests__/unsupportedSignInOperation.test.d.ts +2 -0
- package/dist/__tests__/unsupportedSignInOperation.test.d.ts.map +1 -0
- package/dist/auth.d.ts +18 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/clr.d.ts +2 -2
- package/dist/clr.d.ts.map +1 -1
- package/dist/clr.test.d.ts +2 -0
- package/dist/clr.test.d.ts.map +1 -0
- package/dist/inAppMessages.d.ts +10 -10
- package/dist/lcn.d.ts +1632 -9
- package/dist/lcn.d.ts.map +1 -1
- package/dist/share-links.d.ts +104 -0
- package/dist/share-links.d.ts.map +1 -1
- package/dist/types.cjs.development.cjs +352 -12
- package/dist/types.cjs.development.cjs.map +2 -2
- package/dist/types.cjs.production.min.cjs +22 -22
- package/dist/types.cjs.production.min.cjs.map +3 -3
- package/dist/types.esm.js +352 -12
- package/dist/types.esm.js.map +2 -2
- package/package.json +2 -1
- package/src/__tests__/unsupportedSignInOperation.test.ts +13 -0
- package/src/auth.ts +24 -1
- package/src/clr.test.ts +163 -0
- package/src/clr.ts +2 -1
- package/src/lcn.ts +342 -5
- package/src/share-links.ts +75 -0
package/src/share-links.ts
CHANGED
|
@@ -592,6 +592,8 @@ export const ShareLinkValidator = z.object({
|
|
|
592
592
|
version: safeVersion,
|
|
593
593
|
contentVersion: safeVersion,
|
|
594
594
|
status: ShareLinkStatusValidator,
|
|
595
|
+
attachmentId: z.string().uuid().nullable().optional(),
|
|
596
|
+
attachmentChunkCount: z.number().int().min(1).max(16).nullable().optional(),
|
|
595
597
|
contentState: ShareContentStateValidator,
|
|
596
598
|
createdAt: z.iso.datetime(),
|
|
597
599
|
updatedAt: z.iso.datetime(),
|
|
@@ -618,6 +620,74 @@ export type ShareLink = z.infer<typeof ShareLinkValidator>;
|
|
|
618
620
|
|
|
619
621
|
const clientRequestId = z.string().uuid();
|
|
620
622
|
|
|
623
|
+
/** Opaque, version-bound descriptor; PDF bytes and keys never reach Brain metadata. */
|
|
624
|
+
export const ShareLinkAttachmentValidator = z
|
|
625
|
+
.object({
|
|
626
|
+
id: z.string().uuid(),
|
|
627
|
+
chunkCount: z.number().int().min(1).max(16),
|
|
628
|
+
})
|
|
629
|
+
.strict();
|
|
630
|
+
export type ShareLinkAttachment = z.infer<typeof ShareLinkAttachmentValidator>;
|
|
631
|
+
|
|
632
|
+
const attachmentChunkKey = {
|
|
633
|
+
id: ShareLinkIdValidator,
|
|
634
|
+
contentVersion: safeVersion,
|
|
635
|
+
attachmentId: z.string().uuid(),
|
|
636
|
+
chunkIndex: z.number().int().min(0).max(15),
|
|
637
|
+
};
|
|
638
|
+
export const ShareLinkAttachmentChunkEnvelopeValidator = ShareEnvelopeValidator.refine(
|
|
639
|
+
value => (decodedBase64UrlByteLength(value.ct) ?? Infinity) <= 256 * 1024 + SHARE_TAG_BYTES
|
|
640
|
+
);
|
|
641
|
+
export const PutShareLinkAttachmentChunkInputValidator = z
|
|
642
|
+
.object({
|
|
643
|
+
...attachmentChunkKey,
|
|
644
|
+
chunkCount: z.number().int().min(1).max(16),
|
|
645
|
+
envelope: ShareLinkAttachmentChunkEnvelopeValidator,
|
|
646
|
+
ownerEncryptedRecovery: ShareOwnerRecoveryValidator,
|
|
647
|
+
})
|
|
648
|
+
.strict()
|
|
649
|
+
.refine(value => value.chunkIndex < value.chunkCount);
|
|
650
|
+
export type PutShareLinkAttachmentChunkInput = z.infer<
|
|
651
|
+
typeof PutShareLinkAttachmentChunkInputValidator
|
|
652
|
+
>;
|
|
653
|
+
export const GetShareLinkAttachmentChunkInputValidator = z
|
|
654
|
+
.object({
|
|
655
|
+
...attachmentChunkKey,
|
|
656
|
+
passcode: z.string().min(4).max(64).optional(),
|
|
657
|
+
accessToken: z.string().min(1).max(2048).optional(),
|
|
658
|
+
})
|
|
659
|
+
.strict();
|
|
660
|
+
export type GetShareLinkAttachmentChunkInput = z.infer<
|
|
661
|
+
typeof GetShareLinkAttachmentChunkInputValidator
|
|
662
|
+
>;
|
|
663
|
+
export const ShareLinkAttachmentChunkOutputValidator = z
|
|
664
|
+
.object({
|
|
665
|
+
...attachmentChunkKey,
|
|
666
|
+
envelope: ShareLinkAttachmentChunkEnvelopeValidator,
|
|
667
|
+
accessToken: z.string().min(1).max(2048).optional(),
|
|
668
|
+
})
|
|
669
|
+
.strict();
|
|
670
|
+
export type ShareLinkAttachmentChunkOutput = z.infer<
|
|
671
|
+
typeof ShareLinkAttachmentChunkOutputValidator
|
|
672
|
+
>;
|
|
673
|
+
export const DeleteShareLinkAttachmentChunksInputValidator = z
|
|
674
|
+
.object({
|
|
675
|
+
id: ShareLinkIdValidator,
|
|
676
|
+
contentVersion: safeVersion,
|
|
677
|
+
attachmentId: z.string().uuid(),
|
|
678
|
+
chunkCount: z.number().int().min(1).max(16),
|
|
679
|
+
})
|
|
680
|
+
.strict();
|
|
681
|
+
export type DeleteShareLinkAttachmentChunksInput = z.infer<
|
|
682
|
+
typeof DeleteShareLinkAttachmentChunksInputValidator
|
|
683
|
+
>;
|
|
684
|
+
export const PutShareLinkAttachmentChunkOutputValidator = z
|
|
685
|
+
.object({ ok: z.literal(true) })
|
|
686
|
+
.strict();
|
|
687
|
+
export const DeleteShareLinkAttachmentChunksOutputValidator = z
|
|
688
|
+
.object({ ok: z.boolean() })
|
|
689
|
+
.strict();
|
|
690
|
+
|
|
621
691
|
export const CreateShareLinkInputValidator = z
|
|
622
692
|
.object({
|
|
623
693
|
id: ShareLinkIdValidator,
|
|
@@ -631,6 +701,7 @@ export const CreateShareLinkInputValidator = z
|
|
|
631
701
|
contentVersion: z.literal(1),
|
|
632
702
|
envelope: ShareEnvelopeValidator,
|
|
633
703
|
ownerEncryptedRecovery: ShareOwnerRecoveryValidator,
|
|
704
|
+
attachment: ShareLinkAttachmentValidator.optional(),
|
|
634
705
|
})
|
|
635
706
|
.strict();
|
|
636
707
|
export type CreateShareLinkInput = z.infer<typeof CreateShareLinkInputValidator>;
|
|
@@ -655,6 +726,7 @@ export const UpdateShareLinkInputValidator = z
|
|
|
655
726
|
selectedCount: z.number().int().min(1).max(MAX_SELECTED_CREDENTIALS).optional(),
|
|
656
727
|
envelope: ShareEnvelopeValidator.optional(),
|
|
657
728
|
ownerEncryptedRecovery: ShareOwnerRecoveryValidator.optional(),
|
|
729
|
+
attachment: ShareLinkAttachmentValidator.optional(),
|
|
658
730
|
})
|
|
659
731
|
.strict()
|
|
660
732
|
.superRefine((value, ctx) => {
|
|
@@ -672,6 +744,9 @@ export const UpdateShareLinkInputValidator = z
|
|
|
672
744
|
'content replacement requires contentVersion, selectedCount, envelope and ownerEncryptedRecovery together',
|
|
673
745
|
});
|
|
674
746
|
}
|
|
747
|
+
if (value.attachment !== undefined && provided !== 4) {
|
|
748
|
+
ctx.addIssue({ code: 'custom', message: 'attachment requires a content replacement' });
|
|
749
|
+
}
|
|
675
750
|
});
|
|
676
751
|
export type UpdateShareLinkInput = z.infer<typeof UpdateShareLinkInputValidator>;
|
|
677
752
|
|