@shipstatic/types 0.4.24 → 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 +5 -14
- package/dist/index.js +42 -0
- package/package.json +5 -3
- package/src/index.ts +53 -26
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
|
*
|
|
@@ -772,24 +772,15 @@ export declare const FileValidationStatus: {
|
|
|
772
772
|
};
|
|
773
773
|
export type FileValidationStatusType = typeof FileValidationStatus[keyof typeof FileValidationStatus];
|
|
774
774
|
/**
|
|
775
|
-
*
|
|
776
|
-
*/
|
|
777
|
-
export type ValidationIssueType = 'empty_file' | 'file_too_large' | 'total_size_exceeded' | 'invalid_mime_type' | 'invalid_filename' | 'mime_extension_mismatch' | 'file_count_exceeded' | 'processing_error';
|
|
778
|
-
/**
|
|
779
|
-
* A validation issue with severity level
|
|
775
|
+
* A validation issue with a display-ready message
|
|
780
776
|
*
|
|
781
|
-
* Issues are
|
|
782
|
-
* -
|
|
783
|
-
* - **warning**: Excludes file but allows deployment to proceed
|
|
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.
|
|
784
779
|
*/
|
|
785
780
|
export interface ValidationIssue {
|
|
786
781
|
/** File path that triggered this issue */
|
|
787
782
|
file: string;
|
|
788
|
-
/**
|
|
789
|
-
severity: 'error' | 'warning';
|
|
790
|
-
/** Issue type for programmatic handling */
|
|
791
|
-
type: ValidationIssueType;
|
|
792
|
-
/** Human-readable message explaining the issue */
|
|
783
|
+
/** Display-ready message explaining the issue */
|
|
793
784
|
message: string;
|
|
794
785
|
}
|
|
795
786
|
/**
|
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
|
// =========================================================================
|
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
|
// =========================================================================
|
|
@@ -1226,40 +1275,18 @@ export const FileValidationStatus = {
|
|
|
1226
1275
|
|
|
1227
1276
|
export type FileValidationStatusType = typeof FileValidationStatus[keyof typeof FileValidationStatus];
|
|
1228
1277
|
|
|
1229
|
-
/**
|
|
1230
|
-
* Types of validation issues that can occur during file validation
|
|
1231
|
-
*/
|
|
1232
|
-
export type ValidationIssueType =
|
|
1233
|
-
// Warnings (exclude file but don't block deployment)
|
|
1234
|
-
| 'empty_file'
|
|
1235
|
-
|
|
1236
|
-
// Errors (block deployment)
|
|
1237
|
-
| 'file_too_large'
|
|
1238
|
-
| 'total_size_exceeded'
|
|
1239
|
-
| 'invalid_mime_type'
|
|
1240
|
-
| 'invalid_filename'
|
|
1241
|
-
| 'mime_extension_mismatch'
|
|
1242
|
-
| 'file_count_exceeded'
|
|
1243
|
-
| 'processing_error';
|
|
1244
1278
|
|
|
1245
1279
|
/**
|
|
1246
|
-
* A validation issue with
|
|
1280
|
+
* A validation issue with a display-ready message
|
|
1247
1281
|
*
|
|
1248
|
-
* Issues are
|
|
1249
|
-
* -
|
|
1250
|
-
* - **warning**: Excludes file but allows deployment to proceed
|
|
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.
|
|
1251
1284
|
*/
|
|
1252
1285
|
export interface ValidationIssue {
|
|
1253
1286
|
/** File path that triggered this issue */
|
|
1254
1287
|
file: string;
|
|
1255
1288
|
|
|
1256
|
-
/**
|
|
1257
|
-
severity: 'error' | 'warning';
|
|
1258
|
-
|
|
1259
|
-
/** Issue type for programmatic handling */
|
|
1260
|
-
type: ValidationIssueType;
|
|
1261
|
-
|
|
1262
|
-
/** Human-readable message explaining the issue */
|
|
1289
|
+
/** Display-ready message explaining the issue */
|
|
1263
1290
|
message: string;
|
|
1264
1291
|
}
|
|
1265
1292
|
|