@plyaz/types 1.30.0 → 1.31.1
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/api/endpoints/files/endpoints.d.ts +89 -0
- package/dist/api/endpoints/files/index.d.ts +9 -0
- package/dist/api/endpoints/files/schemas.d.ts +487 -0
- package/dist/api/endpoints/index.d.ts +1 -0
- package/dist/api/endpoints/types.d.ts +2 -1
- package/dist/api/index.cjs +225 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +201 -1
- package/dist/api/index.js.map +1 -1
- package/dist/core/domain/files/index.d.ts +6 -0
- package/dist/core/domain/files/types.d.ts +167 -0
- package/dist/core/domain/index.d.ts +2 -1
- package/dist/core/domain/types.d.ts +14 -0
- package/dist/core/events/index.d.ts +1 -1
- package/dist/core/events/payloads.d.ts +80 -0
- package/dist/core/frontend/types.d.ts +20 -0
- package/dist/core/services/types.d.ts +12 -2
- package/dist/db/databaseAdapter.d.ts +3 -3
- package/dist/db/databaseService.d.ts +9 -9
- package/dist/examples/index.d.ts +1 -1
- package/dist/examples/types.d.ts +63 -0
- package/dist/index.d.ts +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/interfaces.d.ts +109 -2
- package/dist/store/files/index.d.ts +6 -0
- package/dist/store/files/types.d.ts +107 -0
- package/dist/store/index.d.ts +1 -0
- package/dist/store/types.d.ts +3 -0
- package/package.json +1 -1
package/dist/api/index.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
3
5
|
// @plyaz package - Built with tsup
|
|
4
6
|
var __defProp = Object.defineProperty;
|
|
5
7
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -502,6 +504,204 @@ var PUB_SUB_EVENT = {
|
|
|
502
504
|
RequestError: "request:error",
|
|
503
505
|
RequestAbort: "request:abort"
|
|
504
506
|
};
|
|
507
|
+
var PDF_SCALE_MIN = 0.1;
|
|
508
|
+
var PDF_SCALE_MAX = 2;
|
|
509
|
+
var MAX_BULK_UPLOAD_CONCURRENCY = 10;
|
|
510
|
+
var OutputFormatSchema = zod.z.enum(["pdf", "docx", "xlsx", "html"]);
|
|
511
|
+
var AccessLevelSchema = zod.z.enum(["public", "private", "protected"]);
|
|
512
|
+
var PdfOptionsSchema = zod.z.object({
|
|
513
|
+
format: zod.z.enum(["A4", "Letter", "Legal"]).optional(),
|
|
514
|
+
landscape: zod.z.boolean().optional(),
|
|
515
|
+
margin: zod.z.object({
|
|
516
|
+
top: zod.z.string().optional(),
|
|
517
|
+
right: zod.z.string().optional(),
|
|
518
|
+
bottom: zod.z.string().optional(),
|
|
519
|
+
left: zod.z.string().optional()
|
|
520
|
+
}).optional(),
|
|
521
|
+
displayHeaderFooter: zod.z.boolean().optional(),
|
|
522
|
+
headerTemplate: zod.z.string().optional(),
|
|
523
|
+
footerTemplate: zod.z.string().optional(),
|
|
524
|
+
printBackground: zod.z.boolean().optional(),
|
|
525
|
+
scale: zod.z.number().min(PDF_SCALE_MIN).max(PDF_SCALE_MAX).optional()
|
|
526
|
+
}).optional();
|
|
527
|
+
var UploadFileRequestSchema = zod.z.object({
|
|
528
|
+
// Direct File Upload (base64)
|
|
529
|
+
base64: zod.z.string().optional(),
|
|
530
|
+
mimeType: zod.z.string().optional(),
|
|
531
|
+
filename: zod.z.string().optional(),
|
|
532
|
+
// Template-Based Generation
|
|
533
|
+
templateId: zod.z.string().optional(),
|
|
534
|
+
templateData: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
535
|
+
outputFormat: OutputFormatSchema.optional(),
|
|
536
|
+
locale: zod.z.string().optional(),
|
|
537
|
+
pdfOptions: PdfOptionsSchema,
|
|
538
|
+
// Path Generation & Storage (required)
|
|
539
|
+
category: zod.z.string(),
|
|
540
|
+
entityType: zod.z.string(),
|
|
541
|
+
entityId: zod.z.string(),
|
|
542
|
+
// Optional Metadata
|
|
543
|
+
accessLevel: AccessLevelSchema.optional(),
|
|
544
|
+
customMetadata: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
545
|
+
tags: zod.z.array(zod.z.string()).optional(),
|
|
546
|
+
customPath: zod.z.string().optional(),
|
|
547
|
+
ttl: zod.z.number().positive().optional(),
|
|
548
|
+
immutable: zod.z.boolean().optional(),
|
|
549
|
+
// Processing Options
|
|
550
|
+
extractMetadata: zod.z.boolean().optional(),
|
|
551
|
+
virusScan: zod.z.boolean().optional(),
|
|
552
|
+
processMedia: zod.z.boolean().optional()
|
|
553
|
+
}).refine(
|
|
554
|
+
(data) => {
|
|
555
|
+
return Boolean(data.base64) || Boolean(data.templateId);
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
message: "Either base64 content or templateId must be provided"
|
|
559
|
+
}
|
|
560
|
+
).refine(
|
|
561
|
+
(data) => {
|
|
562
|
+
if (data.base64 && !data.mimeType) {
|
|
563
|
+
return false;
|
|
564
|
+
}
|
|
565
|
+
return true;
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
message: "mimeType is required when base64 content is provided"
|
|
569
|
+
}
|
|
570
|
+
);
|
|
571
|
+
var FileVariantSchema = zod.z.object({
|
|
572
|
+
url: zod.z.string().url(),
|
|
573
|
+
size: zod.z.number().nonnegative(),
|
|
574
|
+
mimeType: zod.z.string()
|
|
575
|
+
});
|
|
576
|
+
var UploadFileResponseSchema = zod.z.object({
|
|
577
|
+
// Core identifiers
|
|
578
|
+
id: zod.z.string(),
|
|
579
|
+
key: zod.z.string(),
|
|
580
|
+
filename: zod.z.string(),
|
|
581
|
+
mimeType: zod.z.string(),
|
|
582
|
+
size: zod.z.number().nonnegative(),
|
|
583
|
+
checksum: zod.z.string().optional(),
|
|
584
|
+
// URLs
|
|
585
|
+
url: zod.z.string().optional(),
|
|
586
|
+
publicUrl: zod.z.string().optional(),
|
|
587
|
+
signedUrl: zod.z.string().optional(),
|
|
588
|
+
// Storage Info
|
|
589
|
+
bucket: zod.z.string(),
|
|
590
|
+
adapter: zod.z.string().optional(),
|
|
591
|
+
entityType: zod.z.string().optional(),
|
|
592
|
+
entityId: zod.z.string().optional(),
|
|
593
|
+
category: zod.z.string().optional(),
|
|
594
|
+
// Timestamps
|
|
595
|
+
uploadedAt: zod.z.string(),
|
|
596
|
+
expiresAt: zod.z.string().optional(),
|
|
597
|
+
// Variants
|
|
598
|
+
variants: zod.z.record(zod.z.string(), FileVariantSchema).optional(),
|
|
599
|
+
// Warnings
|
|
600
|
+
warnings: zod.z.array(zod.z.string()).optional()
|
|
601
|
+
});
|
|
602
|
+
var UploadFileItemSchema = UploadFileRequestSchema;
|
|
603
|
+
var UploadFilesRequestSchema = zod.z.object({
|
|
604
|
+
/** Array of files to upload */
|
|
605
|
+
files: zod.z.array(UploadFileItemSchema).min(1, "At least one file is required"),
|
|
606
|
+
/** Options for bulk upload */
|
|
607
|
+
options: zod.z.object({
|
|
608
|
+
/** Max concurrent uploads (default: 3, max: 10) */
|
|
609
|
+
concurrency: zod.z.number().min(1).max(MAX_BULK_UPLOAD_CONCURRENCY).optional(),
|
|
610
|
+
/** Continue uploading remaining files if one fails */
|
|
611
|
+
continueOnError: zod.z.boolean().optional(),
|
|
612
|
+
/** Use queue for background processing */
|
|
613
|
+
useQueue: zod.z.boolean().optional()
|
|
614
|
+
}).optional()
|
|
615
|
+
});
|
|
616
|
+
var UploadFileResultSchema = zod.z.object({
|
|
617
|
+
/** Index in original files array */
|
|
618
|
+
index: zod.z.number().nonnegative(),
|
|
619
|
+
/** Whether this file uploaded successfully */
|
|
620
|
+
success: zod.z.boolean(),
|
|
621
|
+
/** Upload result (when success=true) */
|
|
622
|
+
data: UploadFileResponseSchema.optional(),
|
|
623
|
+
/** Error message (when success=false) */
|
|
624
|
+
error: zod.z.string().optional()
|
|
625
|
+
});
|
|
626
|
+
var UploadFilesResponseSchema = zod.z.object({
|
|
627
|
+
/** Individual results for each file */
|
|
628
|
+
results: zod.z.array(UploadFileResultSchema),
|
|
629
|
+
/** Summary statistics */
|
|
630
|
+
summary: zod.z.object({
|
|
631
|
+
total: zod.z.number().nonnegative(),
|
|
632
|
+
succeeded: zod.z.number().nonnegative(),
|
|
633
|
+
failed: zod.z.number().nonnegative()
|
|
634
|
+
}),
|
|
635
|
+
/** Whether all files uploaded successfully */
|
|
636
|
+
allSucceeded: zod.z.boolean()
|
|
637
|
+
});
|
|
638
|
+
var GenerateDocumentRequestSchema = zod.z.object({
|
|
639
|
+
templateId: zod.z.string(),
|
|
640
|
+
templateData: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
641
|
+
outputFormat: OutputFormatSchema.optional().default("pdf"),
|
|
642
|
+
locale: zod.z.string().optional(),
|
|
643
|
+
pdfOptions: PdfOptionsSchema
|
|
644
|
+
});
|
|
645
|
+
var GenerateDocumentResponseSchema = zod.z.object({
|
|
646
|
+
buffer: zod.z.string(),
|
|
647
|
+
// base64 encoded
|
|
648
|
+
size: zod.z.number().nonnegative()
|
|
649
|
+
});
|
|
650
|
+
var GetFileParamsSchema = zod.z.object({
|
|
651
|
+
id: zod.z.string().uuid()
|
|
652
|
+
});
|
|
653
|
+
var GetFileRequestSchema = GetFileParamsSchema;
|
|
654
|
+
var GetFileResponseSchema = zod.z.object({
|
|
655
|
+
id: zod.z.string().uuid(),
|
|
656
|
+
key: zod.z.string(),
|
|
657
|
+
filename: zod.z.string(),
|
|
658
|
+
mimeType: zod.z.string(),
|
|
659
|
+
size: zod.z.number().nonnegative(),
|
|
660
|
+
checksum: zod.z.string().optional(),
|
|
661
|
+
url: zod.z.string().optional(),
|
|
662
|
+
publicUrl: zod.z.string().optional(),
|
|
663
|
+
signedUrl: zod.z.string().optional(),
|
|
664
|
+
bucket: zod.z.string(),
|
|
665
|
+
entityType: zod.z.string().optional(),
|
|
666
|
+
entityId: zod.z.string().optional(),
|
|
667
|
+
category: zod.z.string().optional(),
|
|
668
|
+
uploadedAt: zod.z.string(),
|
|
669
|
+
expiresAt: zod.z.string().optional()
|
|
670
|
+
});
|
|
671
|
+
var DownloadFileParamsSchema = zod.z.object({
|
|
672
|
+
id: zod.z.string().uuid()
|
|
673
|
+
});
|
|
674
|
+
var DownloadFileRequestSchema = DownloadFileParamsSchema;
|
|
675
|
+
var DownloadFileResponseSchema = zod.z.object({
|
|
676
|
+
buffer: zod.z.string(),
|
|
677
|
+
// base64 encoded
|
|
678
|
+
size: zod.z.number().nonnegative(),
|
|
679
|
+
mimeType: zod.z.string(),
|
|
680
|
+
filename: zod.z.string().optional()
|
|
681
|
+
});
|
|
682
|
+
var DeleteFileParamsSchema = zod.z.object({
|
|
683
|
+
id: zod.z.string().uuid()
|
|
684
|
+
});
|
|
685
|
+
var DeleteFileRequestSchema = DeleteFileParamsSchema;
|
|
686
|
+
var DeleteFileResponseSchema = zod.z.object({
|
|
687
|
+
success: zod.z.boolean()
|
|
688
|
+
});
|
|
689
|
+
var GetSignedUrlParamsSchema = zod.z.object({
|
|
690
|
+
id: zod.z.string().uuid()
|
|
691
|
+
});
|
|
692
|
+
var GetSignedUrlQuerySchema = zod.z.object({
|
|
693
|
+
expiresIn: zod.z.number().positive().optional()
|
|
694
|
+
});
|
|
695
|
+
var GetSignedUrlRequestSchema = zod.z.object({
|
|
696
|
+
/** File ID (UUID from media table) */
|
|
697
|
+
id: zod.z.string().uuid(),
|
|
698
|
+
/** Optional query parameters */
|
|
699
|
+
query: GetSignedUrlQuerySchema.optional()
|
|
700
|
+
});
|
|
701
|
+
var GetSignedUrlResponseSchema = zod.z.object({
|
|
702
|
+
url: zod.z.string().url(),
|
|
703
|
+
expiresAt: zod.z.string()
|
|
704
|
+
});
|
|
505
705
|
|
|
506
706
|
// src/errors/enums.ts
|
|
507
707
|
var ERROR_SEVERITY = {
|
|
@@ -5645,6 +5845,7 @@ exports.ALERT_SEVERITIES = ALERT_SEVERITIES;
|
|
|
5645
5845
|
exports.ALERT_TYPES = ALERT_TYPES;
|
|
5646
5846
|
exports.ALL_EVENTS = ALL_EVENTS;
|
|
5647
5847
|
exports.API_ERROR_CODES = API_ERROR_CODES;
|
|
5848
|
+
exports.AccessLevelSchema = AccessLevelSchema;
|
|
5648
5849
|
exports.CACHE_DURATION_MS = CACHE_DURATION_MS;
|
|
5649
5850
|
exports.CACHE_EVENTS = CACHE_EVENTS;
|
|
5650
5851
|
exports.CHANGE_TYPES = CHANGE_TYPES;
|
|
@@ -5659,6 +5860,12 @@ exports.DATA_SAVER_PRESETS = DATA_SAVER_PRESETS;
|
|
|
5659
5860
|
exports.DEBUGGER_CONFIG_SOURCES = DEBUGGER_CONFIG_SOURCES;
|
|
5660
5861
|
exports.DEBUG_EVENTS = DEBUG_EVENTS;
|
|
5661
5862
|
exports.DEFAULT_THRESHOLDS = DEFAULT_THRESHOLDS;
|
|
5863
|
+
exports.DeleteFileParamsSchema = DeleteFileParamsSchema;
|
|
5864
|
+
exports.DeleteFileRequestSchema = DeleteFileRequestSchema;
|
|
5865
|
+
exports.DeleteFileResponseSchema = DeleteFileResponseSchema;
|
|
5866
|
+
exports.DownloadFileParamsSchema = DownloadFileParamsSchema;
|
|
5867
|
+
exports.DownloadFileRequestSchema = DownloadFileRequestSchema;
|
|
5868
|
+
exports.DownloadFileResponseSchema = DownloadFileResponseSchema;
|
|
5662
5869
|
exports.ERROR_CATEGORY = ERROR_CATEGORY;
|
|
5663
5870
|
exports.ERROR_DEFINITIONS = ERROR_DEFINITIONS;
|
|
5664
5871
|
exports.ERROR_EVENTS = ERROR_EVENTS;
|
|
@@ -5671,6 +5878,16 @@ exports.EVENT_PRIORITY_MAP = EVENT_PRIORITY_MAP;
|
|
|
5671
5878
|
exports.EVENT_SCOPES = EVENT_SCOPES;
|
|
5672
5879
|
exports.EVENT_SCOPES_WITH_TEMPORARY = EVENT_SCOPES_WITH_TEMPORARY;
|
|
5673
5880
|
exports.FACTORY_OPERATIONS = FACTORY_OPERATIONS;
|
|
5881
|
+
exports.FileVariantSchema = FileVariantSchema;
|
|
5882
|
+
exports.GenerateDocumentRequestSchema = GenerateDocumentRequestSchema;
|
|
5883
|
+
exports.GenerateDocumentResponseSchema = GenerateDocumentResponseSchema;
|
|
5884
|
+
exports.GetFileParamsSchema = GetFileParamsSchema;
|
|
5885
|
+
exports.GetFileRequestSchema = GetFileRequestSchema;
|
|
5886
|
+
exports.GetFileResponseSchema = GetFileResponseSchema;
|
|
5887
|
+
exports.GetSignedUrlParamsSchema = GetSignedUrlParamsSchema;
|
|
5888
|
+
exports.GetSignedUrlQuerySchema = GetSignedUrlQuerySchema;
|
|
5889
|
+
exports.GetSignedUrlRequestSchema = GetSignedUrlRequestSchema;
|
|
5890
|
+
exports.GetSignedUrlResponseSchema = GetSignedUrlResponseSchema;
|
|
5674
5891
|
exports.HANDLER_SCOPES = HANDLER_SCOPES;
|
|
5675
5892
|
exports.HEADER_EVENTS = HEADER_EVENTS;
|
|
5676
5893
|
exports.HEADER_STAGES = HEADER_STAGES;
|
|
@@ -5682,10 +5899,12 @@ exports.NETWORK_EVENTS = NETWORK_EVENTS;
|
|
|
5682
5899
|
exports.NETWORK_QUALITY = NETWORK_QUALITY;
|
|
5683
5900
|
exports.NetworkPresetNames = NetworkPresetNames;
|
|
5684
5901
|
exports.OPERATIONS = COMMON_OPERATIONS;
|
|
5902
|
+
exports.OutputFormatSchema = OutputFormatSchema;
|
|
5685
5903
|
exports.PACKAGE_STATUS_CODES = INTERNAL_STATUS_CODES;
|
|
5686
5904
|
exports.PERFORMANCE_EVENTS = PERFORMANCE_EVENTS;
|
|
5687
5905
|
exports.PRIORITY_LEVEL = PRIORITY_LEVEL;
|
|
5688
5906
|
exports.PUB_SUB_EVENT = PUB_SUB_EVENT;
|
|
5907
|
+
exports.PdfOptionsSchema = PdfOptionsSchema;
|
|
5689
5908
|
exports.QUEUE_OPERATIONS = QUEUE_OPERATIONS;
|
|
5690
5909
|
exports.REGIONAL_CONFIDENCE_LEVELS = REGIONAL_CONFIDENCE_LEVELS;
|
|
5691
5910
|
exports.REGION_STORAGE_KEY = REGION_STORAGE_KEY;
|
|
@@ -5696,6 +5915,12 @@ exports.STORAGE_TYPES = COMMON_STORAGE_TYPES;
|
|
|
5696
5915
|
exports.TRACKING_PHASES = TRACKING_PHASES;
|
|
5697
5916
|
exports.UNIFIED_OPERATIONS = UNIFIED_OPERATIONS;
|
|
5698
5917
|
exports.UPDATE_STRATEGIES = UPDATE_STRATEGIES;
|
|
5918
|
+
exports.UploadFileItemSchema = UploadFileItemSchema;
|
|
5919
|
+
exports.UploadFileRequestSchema = UploadFileRequestSchema;
|
|
5920
|
+
exports.UploadFileResponseSchema = UploadFileResponseSchema;
|
|
5921
|
+
exports.UploadFileResultSchema = UploadFileResultSchema;
|
|
5922
|
+
exports.UploadFilesRequestSchema = UploadFilesRequestSchema;
|
|
5923
|
+
exports.UploadFilesResponseSchema = UploadFilesResponseSchema;
|
|
5699
5924
|
exports.VALIDATION_RANGES = VALIDATION_RANGES;
|
|
5700
5925
|
exports.isValidConfigSource = isValidConfigSource;
|
|
5701
5926
|
exports.isValidHistoryType = isValidHistoryType;
|