@trayio/commons
Advanced tools
Comparing version 4.54.0 to 4.55.0
@@ -7,32 +7,4 @@ /// <reference types="node" /> | ||
import { DynamicObject } from '../dynamictype/DynamicType'; | ||
export declare enum FileContentType { | ||
Text = "text/plain", | ||
Html = "text/html", | ||
Css = "text/css", | ||
Javascript = "application/javascript", | ||
Xml = "application/xml", | ||
Pdf = "application/pdf", | ||
Zip = "application/zip", | ||
Gif = "image/gif", | ||
Jpeg = "image/jpeg", | ||
Jpg = "image/jpg", | ||
Png = "image/png", | ||
Svg = "image/svg+xml", | ||
Bmp = "image/bmp", | ||
Webp = "image/webp", | ||
Ico = "image/x-icon", | ||
Tiff = "image/tiff", | ||
Heic = "image/heic", | ||
Heif = "image/heif", | ||
AudioMidi = "audio/midi", | ||
AudioMpeg = "audio/mpeg", | ||
AudioWebm = "audio/webm", | ||
AudioOgg = "audio/ogg", | ||
AudioWav = "audio/wav", | ||
VideoWebm = "video/webm", | ||
VideoOgg = "video/ogg", | ||
VideoMp4 = "video/mp4" | ||
} | ||
export interface FileContentTypeCheckerInterface { | ||
isFileContentType(value: unknown): value is FileContentType; | ||
isFileContentType(value: unknown): value is string; | ||
} | ||
@@ -43,3 +15,3 @@ export declare const FileContentTypeChecker: FileContentTypeCheckerInterface; | ||
size?: number; | ||
contentType?: FileContentType; | ||
contentType?: string; | ||
}; | ||
@@ -46,0 +18,0 @@ export declare const fileMetadataDescriptor: t.Type<FileMetadata, unknown>; |
@@ -26,36 +26,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FileDescriptor = exports.fileDescriptorDescriptor = exports.fileMetadataDescriptor = exports.FileContentTypeChecker = exports.FileContentType = void 0; | ||
exports.FileDescriptor = exports.fileDescriptorDescriptor = exports.fileMetadataDescriptor = exports.FileContentTypeChecker = void 0; | ||
const t = __importStar(require("io-ts")); | ||
var FileContentType; | ||
(function (FileContentType) { | ||
FileContentType["Text"] = "text/plain"; | ||
FileContentType["Html"] = "text/html"; | ||
FileContentType["Css"] = "text/css"; | ||
FileContentType["Javascript"] = "application/javascript"; | ||
FileContentType["Xml"] = "application/xml"; | ||
FileContentType["Pdf"] = "application/pdf"; | ||
FileContentType["Zip"] = "application/zip"; | ||
// Image types | ||
FileContentType["Gif"] = "image/gif"; | ||
FileContentType["Jpeg"] = "image/jpeg"; | ||
FileContentType["Jpg"] = "image/jpg"; | ||
FileContentType["Png"] = "image/png"; | ||
FileContentType["Svg"] = "image/svg+xml"; | ||
FileContentType["Bmp"] = "image/bmp"; | ||
FileContentType["Webp"] = "image/webp"; | ||
FileContentType["Ico"] = "image/x-icon"; | ||
FileContentType["Tiff"] = "image/tiff"; | ||
FileContentType["Heic"] = "image/heic"; | ||
FileContentType["Heif"] = "image/heif"; | ||
// Audio types | ||
FileContentType["AudioMidi"] = "audio/midi"; | ||
FileContentType["AudioMpeg"] = "audio/mpeg"; | ||
FileContentType["AudioWebm"] = "audio/webm"; | ||
FileContentType["AudioOgg"] = "audio/ogg"; | ||
FileContentType["AudioWav"] = "audio/wav"; | ||
// Video types | ||
FileContentType["VideoWebm"] = "video/webm"; | ||
FileContentType["VideoOgg"] = "video/ogg"; | ||
FileContentType["VideoMp4"] = "video/mp4"; | ||
})(FileContentType || (exports.FileContentType = FileContentType = {})); | ||
const mime = __importStar(require("mime-types")); | ||
exports.FileContentTypeChecker = { | ||
@@ -67,35 +36,5 @@ isFileContentType(value) { | ||
const lowerCaseValue = value.toLowerCase(); | ||
return Object.values(FileContentType) | ||
.map((contentType) => contentType.toLowerCase()) | ||
.includes(lowerCaseValue); | ||
return mime.contentType(lowerCaseValue) !== false; | ||
}, | ||
}; | ||
const contentTypeDescriptor = t.union([ | ||
t.literal(FileContentType.Text), | ||
t.literal(FileContentType.Html), | ||
t.literal(FileContentType.Css), | ||
t.literal(FileContentType.Javascript), | ||
t.literal(FileContentType.Xml), | ||
t.literal(FileContentType.Gif), | ||
t.literal(FileContentType.Jpeg), | ||
t.literal(FileContentType.Jpg), | ||
t.literal(FileContentType.Png), | ||
t.literal(FileContentType.Svg), | ||
t.literal(FileContentType.Pdf), | ||
t.literal(FileContentType.Zip), | ||
t.literal(FileContentType.Bmp), | ||
t.literal(FileContentType.Webp), | ||
t.literal(FileContentType.Ico), | ||
t.literal(FileContentType.Tiff), | ||
t.literal(FileContentType.Heic), | ||
t.literal(FileContentType.Heif), | ||
t.literal(FileContentType.AudioMidi), | ||
t.literal(FileContentType.AudioMpeg), | ||
t.literal(FileContentType.AudioWebm), | ||
t.literal(FileContentType.AudioOgg), | ||
t.literal(FileContentType.AudioWav), | ||
t.literal(FileContentType.VideoWebm), | ||
t.literal(FileContentType.VideoOgg), | ||
t.literal(FileContentType.VideoMp4), | ||
]); | ||
exports.fileMetadataDescriptor = t.intersection([ | ||
@@ -107,3 +46,3 @@ t.type({ | ||
size: t.number, | ||
contentType: contentTypeDescriptor, | ||
contentType: t.string, | ||
}), | ||
@@ -110,0 +49,0 @@ ]); |
@@ -58,13 +58,3 @@ /// <reference types="node" /> | ||
MultipartRequestBody = "multipart/form-data", | ||
Text = "text/plain", | ||
Html = "text/html", | ||
Css = "text/css", | ||
Javascript = "application/javascript", | ||
Xml = "application/xml", | ||
Gif = "image/gif", | ||
Jpeg = "image/jpeg", | ||
Png = "image/png", | ||
Svg = "image/svg+xml", | ||
Pdf = "application/pdf", | ||
Zip = "application/zip" | ||
Text = "text/plain" | ||
} | ||
@@ -71,0 +61,0 @@ export declare enum HttpHeader { |
@@ -85,12 +85,2 @@ "use strict"; | ||
HttpContentType["Text"] = "text/plain"; | ||
HttpContentType["Html"] = "text/html"; | ||
HttpContentType["Css"] = "text/css"; | ||
HttpContentType["Javascript"] = "application/javascript"; | ||
HttpContentType["Xml"] = "application/xml"; | ||
HttpContentType["Gif"] = "image/gif"; | ||
HttpContentType["Jpeg"] = "image/jpeg"; | ||
HttpContentType["Png"] = "image/png"; | ||
HttpContentType["Svg"] = "image/svg+xml"; | ||
HttpContentType["Pdf"] = "application/pdf"; | ||
HttpContentType["Zip"] = "application/zip"; | ||
})(HttpContentType || (exports.HttpContentType = HttpContentType = {})); | ||
@@ -97,0 +87,0 @@ var HttpHeader; |
{ | ||
"name": "@trayio/commons", | ||
"version": "4.54.0", | ||
"version": "4.55.0", | ||
"description": "Extensions to the standard/core libraries and basic features", | ||
@@ -18,2 +18,3 @@ "exports": { | ||
"@types/formidable": "3.4.5", | ||
"@types/mime-types": "^2.1.4", | ||
"@types/node": "18.11.9", | ||
@@ -32,2 +33,3 @@ "@types/uuid": "9.0.2", | ||
"lodash": "4.17.21", | ||
"mime-types": "^2.1.35", | ||
"monocle-ts": "2.3.13", | ||
@@ -34,0 +36,0 @@ "newtype-ts": "0.3.5", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
228304
20
4757
+ Added@types/mime-types@^2.1.4
+ Addedmime-types@^2.1.35
+ Added@types/mime-types@2.1.4(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)