@shipstatic/types 0.4.23 → 0.4.25
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/index.d.ts +50 -9
- package/dist/index.js +48 -1
- package/package.json +5 -3
- package/src/index.ts +105 -8
package/dist/index.d.ts
CHANGED
|
@@ -417,7 +417,7 @@ export interface ConfigResponse {
|
|
|
417
417
|
* - Explicit allowlist (only approved formats, reject unknown)
|
|
418
418
|
* ============================================================================
|
|
419
419
|
*/
|
|
420
|
-
export declare const ALLOWED_MIME_TYPES: readonly ["text/html", "text/css", "text/plain", "text/markdown", "text/xml", "text/csv", "text/yaml", "text/vtt", "text/calendar", "text/javascript", "text/typescript", "text/tsx", "text/jsx", "text/x-scss", "text/x-sass", "text/less", "text/x-less", "text/stylus", "text/x-vue", "text/x-svelte", "image/", "audio/", "video/", "font/", "application/javascript", "application/ecmascript", "application/x-javascript", "application/wasm", "application/json", "application/ld+json", "application/manifest+json", "application/source-map", "application/xml", "application/xhtml+xml", "application/rss+xml", "application/atom+xml", "application/yaml", "application/toml", "application/pdf", "model/gltf+json", "model/gltf-binary", "application/mp4", "application/font-woff", "application/font-woff2", "application/x-font-woff", "application/x-woff", "application/vnd.ms-fontobject", "application/x-font-ttf", "application/x-font-truetype", "application/x-font-otf", "application/x-font-opentype"];
|
|
420
|
+
export declare const ALLOWED_MIME_TYPES: readonly ["text/html", "text/css", "text/plain", "text/markdown", "text/xml", "text/csv", "text/tab-separated-values", "text/yaml", "text/vcard", "text/mdx", "text/x-mdx", "text/vtt", "text/srt", "text/calendar", "text/javascript", "text/typescript", "application/x-typescript", "text/tsx", "text/jsx", "text/x-scss", "text/x-sass", "text/less", "text/x-less", "text/stylus", "text/x-vue", "text/x-svelte", "text/x-sql", "text/x-diff", "text/x-patch", "text/x-protobuf", "text/x-ini", "text/x-tex", "text/x-latex", "text/x-bibtex", "text/x-r-markdown", "image/", "audio/", "video/", "font/", "application/javascript", "application/ecmascript", "application/x-javascript", "application/wasm", "application/json", "application/ld+json", "application/geo+json", "application/manifest+json", "application/x-ipynb+json", "application/x-ndjson", "application/ndjson", "text/x-ndjson", "application/jsonl", "text/jsonl", "application/json5", "text/json5", "application/schema+json", "application/source-map", "application/xml", "application/xhtml+xml", "application/rss+xml", "application/atom+xml", "application/feed+json", "application/vnd.google-earth.kml+xml", "application/yaml", "application/toml", "application/pdf", "application/x-subrip", "application/sql", "application/graphql", "application/graphql+json", "application/x-protobuf", "application/x-ini", "application/x-tex", "application/x-bibtex", "model/gltf+json", "model/gltf-binary", "application/mp4", "application/font-woff", "application/font-woff2", "application/x-font-woff", "application/x-woff", "application/vnd.ms-fontobject", "application/x-font-ttf", "application/x-font-truetype", "application/x-font-otf", "application/x-font-opentype"];
|
|
421
421
|
/**
|
|
422
422
|
* Check if a MIME type is allowed for upload.
|
|
423
423
|
*
|
|
@@ -759,15 +759,34 @@ export interface ActivityListResponse {
|
|
|
759
759
|
* File status constants for validation state tracking
|
|
760
760
|
*/
|
|
761
761
|
export declare const FileValidationStatus: {
|
|
762
|
+
/** File is pending validation */
|
|
762
763
|
readonly PENDING: "pending";
|
|
764
|
+
/** File failed during processing (before validation) */
|
|
763
765
|
readonly PROCESSING_ERROR: "processing_error";
|
|
764
|
-
|
|
766
|
+
/** File was excluded by validation warning (not an error) */
|
|
767
|
+
readonly EXCLUDED: "excluded";
|
|
768
|
+
/** File failed validation (blocks deployment) */
|
|
765
769
|
readonly VALIDATION_FAILED: "validation_failed";
|
|
770
|
+
/** File passed validation and is ready for deployment */
|
|
766
771
|
readonly READY: "ready";
|
|
767
772
|
};
|
|
768
773
|
export type FileValidationStatusType = typeof FileValidationStatus[keyof typeof FileValidationStatus];
|
|
769
774
|
/**
|
|
770
|
-
*
|
|
775
|
+
* A validation issue with a display-ready message
|
|
776
|
+
*
|
|
777
|
+
* Issues are either errors (in errors[] array) or warnings (in warnings[] array).
|
|
778
|
+
* The array position determines severity - no need to duplicate it in the object.
|
|
779
|
+
*/
|
|
780
|
+
export interface ValidationIssue {
|
|
781
|
+
/** File path that triggered this issue */
|
|
782
|
+
file: string;
|
|
783
|
+
/** Display-ready message explaining the issue */
|
|
784
|
+
message: string;
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Legacy validation error structure
|
|
788
|
+
*
|
|
789
|
+
* @deprecated Use ValidationIssue[] from FileValidationResult instead
|
|
771
790
|
*/
|
|
772
791
|
export interface ValidationError {
|
|
773
792
|
error: string;
|
|
@@ -786,18 +805,40 @@ export interface ValidatableFile {
|
|
|
786
805
|
statusMessage?: string;
|
|
787
806
|
}
|
|
788
807
|
/**
|
|
789
|
-
* File validation result
|
|
808
|
+
* File validation result with severity-based issue reporting
|
|
809
|
+
*
|
|
810
|
+
* Validation checks files against constraints and categorizes issues by severity:
|
|
811
|
+
* - **Errors**: Block deployment (file too large, invalid type, etc.)
|
|
812
|
+
* - **Warnings**: Exclude files but allow deployment (empty files, etc.)
|
|
790
813
|
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
814
|
+
* @example
|
|
815
|
+
* ```typescript
|
|
816
|
+
* const result = validateFiles(files, config);
|
|
817
|
+
*
|
|
818
|
+
* if (!result.canDeploy) {
|
|
819
|
+
* // Has errors - must fix before deploying
|
|
820
|
+
* console.error('Deployment blocked:', result.errors);
|
|
821
|
+
* } else if (result.warnings.length > 0) {
|
|
822
|
+
* // Has warnings - deployment proceeds, some files excluded
|
|
823
|
+
* console.warn('Files excluded:', result.warnings);
|
|
824
|
+
* deploy(result.validFiles);
|
|
825
|
+
* } else {
|
|
826
|
+
* // All files valid
|
|
827
|
+
* deploy(result.validFiles);
|
|
828
|
+
* }
|
|
829
|
+
* ```
|
|
793
830
|
*/
|
|
794
831
|
export interface FileValidationResult<T extends ValidatableFile> {
|
|
795
832
|
/** All files with updated status */
|
|
796
833
|
files: T[];
|
|
797
|
-
/** Files
|
|
834
|
+
/** Files ready for deployment (status: 'ready') */
|
|
798
835
|
validFiles: T[];
|
|
799
|
-
/**
|
|
800
|
-
|
|
836
|
+
/** Blocking errors that prevent deployment */
|
|
837
|
+
errors: ValidationIssue[];
|
|
838
|
+
/** Non-blocking warnings (files excluded but deployment allowed) */
|
|
839
|
+
warnings: ValidationIssue[];
|
|
840
|
+
/** Whether deployment can proceed (true if errors.length === 0) */
|
|
841
|
+
canDeploy: boolean;
|
|
801
842
|
}
|
|
802
843
|
/**
|
|
803
844
|
* Represents a file that has been uploaded and stored
|
package/dist/index.js
CHANGED
|
@@ -277,14 +277,21 @@ export const ALLOWED_MIME_TYPES = [
|
|
|
277
277
|
'text/xml', // XML files
|
|
278
278
|
// Data formats
|
|
279
279
|
'text/csv', // CSV data files
|
|
280
|
+
'text/tab-separated-values', // TSV data files
|
|
280
281
|
'text/yaml', // YAML config files
|
|
282
|
+
'text/vcard', // VCard contact files (.vcf)
|
|
283
|
+
// Modern documentation formats
|
|
284
|
+
'text/mdx', // MDX (Markdown with JSX) - Next.js, Docusaurus, Nextra
|
|
285
|
+
'text/x-mdx', // MDX (alternative MIME type)
|
|
281
286
|
// Web-specific formats
|
|
282
287
|
'text/vtt', // WebVTT video subtitles/captions (accessibility)
|
|
288
|
+
'text/srt', // SRT subtitles (SubRip format, legacy video captions)
|
|
283
289
|
'text/calendar', // iCalendar (.ics) event files
|
|
284
290
|
// JavaScript (legacy MIME type, still widely used by ~50% of servers)
|
|
285
291
|
'text/javascript',
|
|
286
292
|
// Modern web development formats (uncompiled source)
|
|
287
293
|
'text/typescript', // TypeScript source (.ts)
|
|
294
|
+
'application/x-typescript', // TypeScript (alternative MIME type, .d.ts declarations)
|
|
288
295
|
'text/tsx', // TypeScript JSX (.tsx)
|
|
289
296
|
'text/jsx', // React JSX (.jsx)
|
|
290
297
|
'text/x-scss', // SCSS preprocessor
|
|
@@ -294,6 +301,17 @@ export const ALLOWED_MIME_TYPES = [
|
|
|
294
301
|
'text/stylus', // Stylus preprocessor
|
|
295
302
|
'text/x-vue', // Vue single-file components (.vue)
|
|
296
303
|
'text/x-svelte', // Svelte components (.svelte)
|
|
304
|
+
// Developer documentation formats
|
|
305
|
+
'text/x-sql', // SQL files (database schemas, migrations)
|
|
306
|
+
'text/x-diff', // Diff files (code comparisons, patches)
|
|
307
|
+
'text/x-patch', // Patch files (version upgrades, migrations)
|
|
308
|
+
'text/x-protobuf', // Protocol Buffers text format (gRPC schemas)
|
|
309
|
+
'text/x-ini', // INI configuration files
|
|
310
|
+
// Academic/research formats
|
|
311
|
+
'text/x-tex', // LaTeX documents
|
|
312
|
+
'text/x-latex', // LaTeX documents (alternative)
|
|
313
|
+
'text/x-bibtex', // BibTeX citations
|
|
314
|
+
'text/x-r-markdown', // R Markdown (statistical documentation)
|
|
297
315
|
// =========================================================================
|
|
298
316
|
// MEDIA (prefix matching - covers all common subtypes)
|
|
299
317
|
// =========================================================================
|
|
@@ -317,7 +335,18 @@ export const ALLOWED_MIME_TYPES = [
|
|
|
317
335
|
// JSON and structured data
|
|
318
336
|
'application/json',
|
|
319
337
|
'application/ld+json', // JSON-LD for structured data / SEO (Schema.org, Open Graph)
|
|
338
|
+
'application/geo+json', // GeoJSON for mapping (Leaflet, Mapbox)
|
|
320
339
|
'application/manifest+json', // PWA web app manifests
|
|
340
|
+
'application/x-ipynb+json', // Jupyter Notebooks (data science, ML tutorials)
|
|
341
|
+
// JSON variants (AI/ML, streaming data, configs)
|
|
342
|
+
'application/x-ndjson', // Newline-Delimited JSON (training datasets, logs)
|
|
343
|
+
'application/ndjson', // NDJSON (alternative MIME type)
|
|
344
|
+
'text/x-ndjson', // NDJSON (text variant)
|
|
345
|
+
'application/jsonl', // JSON Lines (Hugging Face, OpenAI fine-tuning)
|
|
346
|
+
'text/jsonl', // JSON Lines (text variant)
|
|
347
|
+
'application/json5', // JSON5 (JSON with comments, trailing commas)
|
|
348
|
+
'text/json5', // JSON5 (text variant)
|
|
349
|
+
'application/schema+json', // JSON Schema (API specs, model definitions)
|
|
321
350
|
// Development tools
|
|
322
351
|
'application/source-map', // Source maps (.js.map, .css.map) for debugging
|
|
323
352
|
// XML and feeds
|
|
@@ -325,11 +354,24 @@ export const ALLOWED_MIME_TYPES = [
|
|
|
325
354
|
'application/xhtml+xml', // XHTML - XML-compliant HTML (legacy sites)
|
|
326
355
|
'application/rss+xml', // RSS feeds (blogs, podcasts)
|
|
327
356
|
'application/atom+xml', // Atom feeds
|
|
357
|
+
'application/feed+json', // JSON Feed (modern RSS alternative)
|
|
358
|
+
'application/vnd.google-earth.kml+xml', // KML for mapping (Google Earth, GIS)
|
|
328
359
|
// Configuration formats
|
|
329
360
|
'application/yaml', // YAML configs (static site generators)
|
|
330
361
|
'application/toml', // TOML configs (Cargo, Netlify, Rust projects)
|
|
331
362
|
// Documents
|
|
332
363
|
'application/pdf', // PDF documents
|
|
364
|
+
// Media metadata
|
|
365
|
+
'application/x-subrip', // SRT subtitles (SubRip format)
|
|
366
|
+
// Developer tools and schemas
|
|
367
|
+
'application/sql', // SQL files (database schemas, queries)
|
|
368
|
+
'application/graphql', // GraphQL schemas (API documentation)
|
|
369
|
+
'application/graphql+json', // GraphQL with JSON encoding
|
|
370
|
+
'application/x-protobuf', // Protocol Buffers binary (gRPC)
|
|
371
|
+
'application/x-ini', // INI configuration files
|
|
372
|
+
// Academic formats
|
|
373
|
+
'application/x-tex', // LaTeX documents
|
|
374
|
+
'application/x-bibtex', // BibTeX citations
|
|
333
375
|
// =========================================================================
|
|
334
376
|
// 3D FORMATS (industry standard only)
|
|
335
377
|
// =========================================================================
|
|
@@ -460,10 +502,15 @@ export const DEFAULT_API = 'https://api.shipstatic.com';
|
|
|
460
502
|
* File status constants for validation state tracking
|
|
461
503
|
*/
|
|
462
504
|
export const FileValidationStatus = {
|
|
505
|
+
/** File is pending validation */
|
|
463
506
|
PENDING: 'pending',
|
|
507
|
+
/** File failed during processing (before validation) */
|
|
464
508
|
PROCESSING_ERROR: 'processing_error',
|
|
465
|
-
|
|
509
|
+
/** File was excluded by validation warning (not an error) */
|
|
510
|
+
EXCLUDED: 'excluded',
|
|
511
|
+
/** File failed validation (blocks deployment) */
|
|
466
512
|
VALIDATION_FAILED: 'validation_failed',
|
|
513
|
+
/** File passed validation and is ready for deployment */
|
|
467
514
|
READY: 'ready',
|
|
468
515
|
};
|
|
469
516
|
// =============================================================================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipstatic/types",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.25",
|
|
4
4
|
"description": "Shared types for Shipstatic platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,10 +34,12 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^24.10.9",
|
|
37
|
-
"typescript": "^5.9.3"
|
|
37
|
+
"typescript": "^5.9.3",
|
|
38
|
+
"vitest": "^2.1.8"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|
|
40
41
|
"build": "tsc",
|
|
41
|
-
"clean": "rm -rf dist"
|
|
42
|
+
"clean": "rm -rf dist",
|
|
43
|
+
"test": "vitest"
|
|
42
44
|
}
|
|
43
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -585,10 +585,17 @@ export const ALLOWED_MIME_TYPES = [
|
|
|
585
585
|
|
|
586
586
|
// Data formats
|
|
587
587
|
'text/csv', // CSV data files
|
|
588
|
+
'text/tab-separated-values', // TSV data files
|
|
588
589
|
'text/yaml', // YAML config files
|
|
590
|
+
'text/vcard', // VCard contact files (.vcf)
|
|
591
|
+
|
|
592
|
+
// Modern documentation formats
|
|
593
|
+
'text/mdx', // MDX (Markdown with JSX) - Next.js, Docusaurus, Nextra
|
|
594
|
+
'text/x-mdx', // MDX (alternative MIME type)
|
|
589
595
|
|
|
590
596
|
// Web-specific formats
|
|
591
597
|
'text/vtt', // WebVTT video subtitles/captions (accessibility)
|
|
598
|
+
'text/srt', // SRT subtitles (SubRip format, legacy video captions)
|
|
592
599
|
'text/calendar', // iCalendar (.ics) event files
|
|
593
600
|
|
|
594
601
|
// JavaScript (legacy MIME type, still widely used by ~50% of servers)
|
|
@@ -596,6 +603,7 @@ export const ALLOWED_MIME_TYPES = [
|
|
|
596
603
|
|
|
597
604
|
// Modern web development formats (uncompiled source)
|
|
598
605
|
'text/typescript', // TypeScript source (.ts)
|
|
606
|
+
'application/x-typescript', // TypeScript (alternative MIME type, .d.ts declarations)
|
|
599
607
|
'text/tsx', // TypeScript JSX (.tsx)
|
|
600
608
|
'text/jsx', // React JSX (.jsx)
|
|
601
609
|
'text/x-scss', // SCSS preprocessor
|
|
@@ -606,6 +614,19 @@ export const ALLOWED_MIME_TYPES = [
|
|
|
606
614
|
'text/x-vue', // Vue single-file components (.vue)
|
|
607
615
|
'text/x-svelte', // Svelte components (.svelte)
|
|
608
616
|
|
|
617
|
+
// Developer documentation formats
|
|
618
|
+
'text/x-sql', // SQL files (database schemas, migrations)
|
|
619
|
+
'text/x-diff', // Diff files (code comparisons, patches)
|
|
620
|
+
'text/x-patch', // Patch files (version upgrades, migrations)
|
|
621
|
+
'text/x-protobuf', // Protocol Buffers text format (gRPC schemas)
|
|
622
|
+
'text/x-ini', // INI configuration files
|
|
623
|
+
|
|
624
|
+
// Academic/research formats
|
|
625
|
+
'text/x-tex', // LaTeX documents
|
|
626
|
+
'text/x-latex', // LaTeX documents (alternative)
|
|
627
|
+
'text/x-bibtex', // BibTeX citations
|
|
628
|
+
'text/x-r-markdown', // R Markdown (statistical documentation)
|
|
629
|
+
|
|
609
630
|
// =========================================================================
|
|
610
631
|
// MEDIA (prefix matching - covers all common subtypes)
|
|
611
632
|
// =========================================================================
|
|
@@ -637,7 +658,19 @@ export const ALLOWED_MIME_TYPES = [
|
|
|
637
658
|
// JSON and structured data
|
|
638
659
|
'application/json',
|
|
639
660
|
'application/ld+json', // JSON-LD for structured data / SEO (Schema.org, Open Graph)
|
|
661
|
+
'application/geo+json', // GeoJSON for mapping (Leaflet, Mapbox)
|
|
640
662
|
'application/manifest+json', // PWA web app manifests
|
|
663
|
+
'application/x-ipynb+json', // Jupyter Notebooks (data science, ML tutorials)
|
|
664
|
+
|
|
665
|
+
// JSON variants (AI/ML, streaming data, configs)
|
|
666
|
+
'application/x-ndjson', // Newline-Delimited JSON (training datasets, logs)
|
|
667
|
+
'application/ndjson', // NDJSON (alternative MIME type)
|
|
668
|
+
'text/x-ndjson', // NDJSON (text variant)
|
|
669
|
+
'application/jsonl', // JSON Lines (Hugging Face, OpenAI fine-tuning)
|
|
670
|
+
'text/jsonl', // JSON Lines (text variant)
|
|
671
|
+
'application/json5', // JSON5 (JSON with comments, trailing commas)
|
|
672
|
+
'text/json5', // JSON5 (text variant)
|
|
673
|
+
'application/schema+json', // JSON Schema (API specs, model definitions)
|
|
641
674
|
|
|
642
675
|
// Development tools
|
|
643
676
|
'application/source-map', // Source maps (.js.map, .css.map) for debugging
|
|
@@ -647,6 +680,8 @@ export const ALLOWED_MIME_TYPES = [
|
|
|
647
680
|
'application/xhtml+xml', // XHTML - XML-compliant HTML (legacy sites)
|
|
648
681
|
'application/rss+xml', // RSS feeds (blogs, podcasts)
|
|
649
682
|
'application/atom+xml', // Atom feeds
|
|
683
|
+
'application/feed+json', // JSON Feed (modern RSS alternative)
|
|
684
|
+
'application/vnd.google-earth.kml+xml', // KML for mapping (Google Earth, GIS)
|
|
650
685
|
|
|
651
686
|
// Configuration formats
|
|
652
687
|
'application/yaml', // YAML configs (static site generators)
|
|
@@ -655,6 +690,20 @@ export const ALLOWED_MIME_TYPES = [
|
|
|
655
690
|
// Documents
|
|
656
691
|
'application/pdf', // PDF documents
|
|
657
692
|
|
|
693
|
+
// Media metadata
|
|
694
|
+
'application/x-subrip', // SRT subtitles (SubRip format)
|
|
695
|
+
|
|
696
|
+
// Developer tools and schemas
|
|
697
|
+
'application/sql', // SQL files (database schemas, queries)
|
|
698
|
+
'application/graphql', // GraphQL schemas (API documentation)
|
|
699
|
+
'application/graphql+json', // GraphQL with JSON encoding
|
|
700
|
+
'application/x-protobuf', // Protocol Buffers binary (gRPC)
|
|
701
|
+
'application/x-ini', // INI configuration files
|
|
702
|
+
|
|
703
|
+
// Academic formats
|
|
704
|
+
'application/x-tex', // LaTeX documents
|
|
705
|
+
'application/x-bibtex', // BibTeX citations
|
|
706
|
+
|
|
658
707
|
// =========================================================================
|
|
659
708
|
// 3D FORMATS (industry standard only)
|
|
660
709
|
// =========================================================================
|
|
@@ -1212,17 +1261,39 @@ export interface ActivityListResponse {
|
|
|
1212
1261
|
* File status constants for validation state tracking
|
|
1213
1262
|
*/
|
|
1214
1263
|
export const FileValidationStatus = {
|
|
1264
|
+
/** File is pending validation */
|
|
1215
1265
|
PENDING: 'pending',
|
|
1266
|
+
/** File failed during processing (before validation) */
|
|
1216
1267
|
PROCESSING_ERROR: 'processing_error',
|
|
1217
|
-
|
|
1268
|
+
/** File was excluded by validation warning (not an error) */
|
|
1269
|
+
EXCLUDED: 'excluded',
|
|
1270
|
+
/** File failed validation (blocks deployment) */
|
|
1218
1271
|
VALIDATION_FAILED: 'validation_failed',
|
|
1272
|
+
/** File passed validation and is ready for deployment */
|
|
1219
1273
|
READY: 'ready',
|
|
1220
1274
|
} as const;
|
|
1221
1275
|
|
|
1222
1276
|
export type FileValidationStatusType = typeof FileValidationStatus[keyof typeof FileValidationStatus];
|
|
1223
1277
|
|
|
1278
|
+
|
|
1224
1279
|
/**
|
|
1225
|
-
*
|
|
1280
|
+
* A validation issue with a display-ready message
|
|
1281
|
+
*
|
|
1282
|
+
* Issues are either errors (in errors[] array) or warnings (in warnings[] array).
|
|
1283
|
+
* The array position determines severity - no need to duplicate it in the object.
|
|
1284
|
+
*/
|
|
1285
|
+
export interface ValidationIssue {
|
|
1286
|
+
/** File path that triggered this issue */
|
|
1287
|
+
file: string;
|
|
1288
|
+
|
|
1289
|
+
/** Display-ready message explaining the issue */
|
|
1290
|
+
message: string;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* Legacy validation error structure
|
|
1295
|
+
*
|
|
1296
|
+
* @deprecated Use ValidationIssue[] from FileValidationResult instead
|
|
1226
1297
|
*/
|
|
1227
1298
|
export interface ValidationError {
|
|
1228
1299
|
error: string;
|
|
@@ -1243,18 +1314,44 @@ export interface ValidatableFile {
|
|
|
1243
1314
|
}
|
|
1244
1315
|
|
|
1245
1316
|
/**
|
|
1246
|
-
* File validation result
|
|
1317
|
+
* File validation result with severity-based issue reporting
|
|
1318
|
+
*
|
|
1319
|
+
* Validation checks files against constraints and categorizes issues by severity:
|
|
1320
|
+
* - **Errors**: Block deployment (file too large, invalid type, etc.)
|
|
1321
|
+
* - **Warnings**: Exclude files but allow deployment (empty files, etc.)
|
|
1322
|
+
*
|
|
1323
|
+
* @example
|
|
1324
|
+
* ```typescript
|
|
1325
|
+
* const result = validateFiles(files, config);
|
|
1247
1326
|
*
|
|
1248
|
-
*
|
|
1249
|
-
*
|
|
1327
|
+
* if (!result.canDeploy) {
|
|
1328
|
+
* // Has errors - must fix before deploying
|
|
1329
|
+
* console.error('Deployment blocked:', result.errors);
|
|
1330
|
+
* } else if (result.warnings.length > 0) {
|
|
1331
|
+
* // Has warnings - deployment proceeds, some files excluded
|
|
1332
|
+
* console.warn('Files excluded:', result.warnings);
|
|
1333
|
+
* deploy(result.validFiles);
|
|
1334
|
+
* } else {
|
|
1335
|
+
* // All files valid
|
|
1336
|
+
* deploy(result.validFiles);
|
|
1337
|
+
* }
|
|
1338
|
+
* ```
|
|
1250
1339
|
*/
|
|
1251
1340
|
export interface FileValidationResult<T extends ValidatableFile> {
|
|
1252
1341
|
/** All files with updated status */
|
|
1253
1342
|
files: T[];
|
|
1254
|
-
|
|
1343
|
+
|
|
1344
|
+
/** Files ready for deployment (status: 'ready') */
|
|
1255
1345
|
validFiles: T[];
|
|
1256
|
-
|
|
1257
|
-
|
|
1346
|
+
|
|
1347
|
+
/** Blocking errors that prevent deployment */
|
|
1348
|
+
errors: ValidationIssue[];
|
|
1349
|
+
|
|
1350
|
+
/** Non-blocking warnings (files excluded but deployment allowed) */
|
|
1351
|
+
warnings: ValidationIssue[];
|
|
1352
|
+
|
|
1353
|
+
/** Whether deployment can proceed (true if errors.length === 0) */
|
|
1354
|
+
canDeploy: boolean;
|
|
1258
1355
|
}
|
|
1259
1356
|
|
|
1260
1357
|
/**
|