@putkoff/abstract-utilities 1.0.135 → 1.0.139

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.
@@ -3,10 +3,9 @@ export type MimeByExt = Record<string, string>;
3
3
  export type MediaMap = Record<string, MimeByExt>;
4
4
  export type MediaCategory = keyof typeof MIME_TYPES;
5
5
  export interface MediaOptions {
6
- /** Alias to mirror the Python **kwargs['media_types'] behavior */
7
6
  media_types?: Iterable<string> | string[] | null;
8
7
  }
9
- /** ---- Data: large but explicit, mirrors your Python mapping ---- */
8
+ /** ---- Data ---- */
10
9
  export declare const MIME_TYPES: {
11
10
  readonly image: {
12
11
  readonly ".jpg": "image/jpeg";
@@ -136,35 +135,15 @@ export declare const MIME_TYPES: {
136
135
  readonly ".rpm": "application/x-rpm";
137
136
  };
138
137
  };
139
- /** Mirror of MEDIA_TYPES in Python: category -> Set of extensions */
138
+ /** category -> Set of extensions */
140
139
  export declare const MEDIA_TYPES: Record<MediaCategory, Set<string>>;
141
- /** ---- API (Python parity) ---- */
142
- /**
143
- * Return a sub-map of MEDIA_TYPES for the given categories.
144
- * If categories is falsy, returns all categories.
145
- */
140
+ /** ---- API ---- */
146
141
  export declare function getMediaMap(categories?: Iterable<string> | string[] | null, opts?: MediaOptions): Partial<Record<MediaCategory, Set<string>>>;
147
- /**
148
- * Return a flat, sorted list of all extensions for the given categories.
149
- */
150
142
  export declare function getMediaExts(categories?: Iterable<string> | string[] | null, opts?: MediaOptions): string[];
151
- /**
152
- * Given a file path or extension, return its media category (e.g. "image") or null.
153
- * Mirrors Python's confirm_type.
154
- */
155
143
  export declare function confirmType(pathOrExt: string, categories?: Iterable<string> | string[] | null, opts?: MediaOptions): MediaCategory | null;
156
- /**
157
- * True if the given file path or extension belongs to one of the categories.
158
- */
159
144
  export declare function isMediaType(pathOrExt: string, categories?: Iterable<string> | string[] | null, opts?: MediaOptions): boolean;
160
- /**
161
- * Look up the MIME type by extension; fall back to 'application/octet-stream'.
162
- */
163
145
  export declare function getMimeType(pathOrExt: string): string;
164
- export declare function getAllFileTypesSync(directory: string, categories?: Iterable<string> | string[] | null, opts?: MediaOptions): string[];
165
- export declare function getAllFileTypes(directory: string, categories?: Iterable<string> | string[] | null, opts?: MediaOptions): Promise<string[]>;
166
- /** Optional convenience re-exports that mirror your Python names */
167
- export declare const get_all_file_types: typeof getAllFileTypes;
146
+ /** snake_case aliases */
168
147
  export declare const get_media_map: typeof getMediaMap;
169
148
  export declare const get_media_exts: typeof getMediaExts;
170
149
  export declare const confirm_type: typeof confirmType;
@@ -0,0 +1,37 @@
1
+ /** ---- Types ---- */
2
+ export type MimeByExt = Record<string, string>;
3
+ export type MediaMap = Record<string, MimeByExt>;
4
+ export type MediaCategory = keyof typeof MIME_TYPES;
5
+ export interface MediaOptions {
6
+ media_types?: Iterable<string> | string[] | null;
7
+ }
8
+ /** ---- MIME TYPES ---- */
9
+ export declare const MIME_TYPES: {
10
+ readonly image: {
11
+ readonly ".jpg": "image/jpeg";
12
+ readonly ".png": "image/png";
13
+ readonly ".webp": "image/webp";
14
+ };
15
+ readonly video: {
16
+ readonly ".mp4": "video/mp4";
17
+ readonly ".webm": "video/webm";
18
+ };
19
+ readonly audio: {
20
+ readonly ".mp3": "audio/mpeg";
21
+ readonly ".wav": "audio/wav";
22
+ };
23
+ readonly document: {
24
+ readonly ".pdf": "application/pdf";
25
+ readonly ".txt": "text/plain";
26
+ };
27
+ readonly code: {
28
+ readonly ".ts": "application/typescript";
29
+ readonly ".js": "application/javascript";
30
+ };
31
+ };
32
+ /** ---- Derived ---- */
33
+ export declare const MEDIA_TYPES: Record<MediaCategory, Set<string>>;
34
+ /** ---- API ---- */
35
+ export declare function confirmType(pathOrExt: string, categories?: Iterable<string> | string[] | null): MediaCategory | null;
36
+ export declare function isMediaType(pathOrExt: string, categories?: Iterable<string> | string[] | null): boolean;
37
+ export declare function getMimeType(pathOrExt: string): string;
@@ -3,10 +3,9 @@ export type MimeByExt = Record<string, string>;
3
3
  export type MediaMap = Record<string, MimeByExt>;
4
4
  export type MediaCategory = keyof typeof MIME_TYPES;
5
5
  export interface MediaOptions {
6
- /** Alias to mirror the Python **kwargs['media_types'] behavior */
7
6
  media_types?: Iterable<string> | string[] | null;
8
7
  }
9
- /** ---- Data: large but explicit, mirrors your Python mapping ---- */
8
+ /** ---- Data ---- */
10
9
  export declare const MIME_TYPES: {
11
10
  readonly image: {
12
11
  readonly ".jpg": "image/jpeg";
@@ -136,35 +135,15 @@ export declare const MIME_TYPES: {
136
135
  readonly ".rpm": "application/x-rpm";
137
136
  };
138
137
  };
139
- /** Mirror of MEDIA_TYPES in Python: category -> Set of extensions */
138
+ /** category -> Set of extensions */
140
139
  export declare const MEDIA_TYPES: Record<MediaCategory, Set<string>>;
141
- /** ---- API (Python parity) ---- */
142
- /**
143
- * Return a sub-map of MEDIA_TYPES for the given categories.
144
- * If categories is falsy, returns all categories.
145
- */
140
+ /** ---- API ---- */
146
141
  export declare function getMediaMap(categories?: Iterable<string> | string[] | null, opts?: MediaOptions): Partial<Record<MediaCategory, Set<string>>>;
147
- /**
148
- * Return a flat, sorted list of all extensions for the given categories.
149
- */
150
142
  export declare function getMediaExts(categories?: Iterable<string> | string[] | null, opts?: MediaOptions): string[];
151
- /**
152
- * Given a file path or extension, return its media category (e.g. "image") or null.
153
- * Mirrors Python's confirm_type.
154
- */
155
143
  export declare function confirmType(pathOrExt: string, categories?: Iterable<string> | string[] | null, opts?: MediaOptions): MediaCategory | null;
156
- /**
157
- * True if the given file path or extension belongs to one of the categories.
158
- */
159
144
  export declare function isMediaType(pathOrExt: string, categories?: Iterable<string> | string[] | null, opts?: MediaOptions): boolean;
160
- /**
161
- * Look up the MIME type by extension; fall back to 'application/octet-stream'.
162
- */
163
145
  export declare function getMimeType(pathOrExt: string): string;
164
- export declare function getAllFileTypesSync(directory: string, categories?: Iterable<string> | string[] | null, opts?: MediaOptions): string[];
165
- export declare function getAllFileTypes(directory: string, categories?: Iterable<string> | string[] | null, opts?: MediaOptions): Promise<string[]>;
166
- /** Optional convenience re-exports that mirror your Python names */
167
- export declare const get_all_file_types: typeof getAllFileTypes;
146
+ /** snake_case aliases */
168
147
  export declare const get_media_map: typeof getMediaMap;
169
148
  export declare const get_media_exts: typeof getMediaExts;
170
149
  export declare const confirm_type: typeof confirmType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putkoff/abstract-utilities",
3
- "version": "1.0.135",
3
+ "version": "1.0.139",
4
4
  "type": "module",
5
5
  "description": "A reusable React Login component with JWT authentication",
6
6
  "main": "dist/cjs/index.js",