@putkoff/abstract-utilities 1.0.63 → 1.0.66

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 CHANGED
@@ -26,23 +26,6 @@ interface FileListResponse {
26
26
  files?: ApiRow[];
27
27
  }
28
28
 
29
- interface ChangePasswordProps {
30
- onSuccess?: () => void;
31
- onCancel?: () => void;
32
- }
33
- interface ChangePasswordFormProps {
34
- username: string;
35
- setUsername: (value: string) => void;
36
- currentPwd: string;
37
- setCurrentPwd: (value: string) => void;
38
- newPwd: string;
39
- setNewPwd: (value: string) => void;
40
- busy: boolean;
41
- msg: string | null;
42
- onSubmit: (e: React.FormEvent) => void;
43
- onCancel?: () => void;
44
- }
45
-
46
29
  interface AppConfig {
47
30
  BASE_API_URL: string;
48
31
  BASE_OTHER_URL: string;
@@ -779,4 +762,4 @@ declare function processKeywords(keywords: string | string[]): string[];
779
762
  declare function get_keyword_string(keywords: any): string;
780
763
 
781
764
  export { API_PREFIX, ATTOSECOND, BASE_URL, CENTISECOND, DAY, DAY_IN_S, DECISECOND, DEV_PREFIX, DIST_ALIASES, DIST_FACTORS, DOMAIN_NAME, DistanceConverter, FEET_PER_METER, FEMTOSECOND, HOUR, HOUR_IN_S, KMS_PER_METER, MEDIA_TYPES, METERS_PER_FOOT, METERS_PER_KM, METERS_PER_MILE, MICROSECOND, MILES_PER_METER, MILISECOND, MIME_TYPES, MINUTE, MIN_IN_S, MONTH, MONTH_IN_S, MPerS_TO_MiPerH, MiPerH_TO_MPerS, NANOSECOND, PI, PI2, PICOSECOND, PROD_PREFIX, PROTOCOL, SECOND, SECONDS_PER_DAY, SECONDS_PER_HOUR, SECONDS_PER_MINUTE, SUB_DIR, SpeedConverter, TIME_ALIASES, TIME_FACTORS, TimeConverter, YEAR, YEAR_IN_S, ZEPTOSECOND, alertit, assureArray, assureList, assureNumber, assureString, assure_array, assure_list, assure_number, assure_string, assurearray, assurelist, assurenumber, assurestring, callStorage, callWindowMethod, canonDist, canonTime, capitalize, capitalize_str, checkResponse, cleanArray, cleanText, confirmType, confirm_type, convertDistance, convertSpeed, convertTime, create_list_string, decodeJwt, distanceToMeters, eatAll, eatElse, eatInner, eatOuter, eatall, eatinner, eatouter, ensureArray, ensureList, ensureNumber, ensureString, ensure_array, ensure_list, ensure_number, ensure_string, ensurearray, ensurelist, ensurenumber, ensurestring, exponential, fetchIndexHtml, fetchIndexHtmlContainer, fetchIt, fmt, formatNumber, fromMeters, fromMps, fromSeconds, geAuthsUtilsDirectory, geBackupsUtilsDirectory, geConstantsUtilsDirectory, geEnvUtilsDirectory, geFetchUtilsDirectory, geFileUtilsDirectory, gePathUtilsDirectory, geStaticDirectory, geStringUtilsDirectory, geTypeUtilsDirectory, get, getAbsDir, getAbsPath, getAllFileTypes, getAllFileTypesSync, getAlphaNum, getAlphas, getBaseDir, getBasename, getBody, getChar, getCleanArray, getComponentsUtilsDirectory, getConfig, getConfigContent, getConfigVar, getDbConfigsPath, getDirname, getDistDir, getDocumentProp, getEnvDir, getEnvPath, getExtname, getFetchVars, getFilename, getFunctionsDir, getFunctionsUtilsDirectory, getHeaders, getHooksUtilsDirectory, getHtmlDirectory, getLibUtilsDirectory, getMediaExts, getMediaMap, getMethod, getMimeType, getNums, getPublicDir, getResult, getSafeDocument, getSafeLocalStorage, getSafeWindow, getSchemasDirPath, getSchemasPath, getSplitext, getSrcDir, getSubstring, getWindowHost, getWindowProp, get_all_file_types, get_basename, get_dirname, get_extname, get_filename, get_full_path, get_full_url, get_key_value, get_keyword_string, get_media_exts, get_media_map, get_mime_type, get_relative_path, get_splitext, get_window, get_window_location, get_window_parts, get_window_pathname, getbasename, getdirname, getextname, getfilename, getsplitext, isFiniteNum, isMediaType, isNum, isStrInString, isTokenExpired, isType, is_media_type, loadConfig, makePath, make_path, make_sanitized_path, makepath, metersToDistance, mpsToSpeed, normalizeUrl, parseResult, pathJoin, path_join, path_to_url, pathjoin, processKeywords, readJsonFile, roundPercentage, safeDivide, safeGlobalProp, safeMultiply, safeNums, safeStorage, sanitizeFilename, secondsToTime, speedToMps, stripPrefixes, timeToSeconds, toMeters, toSeconds, truncateString, tryEatPrefix, tryParse, urlJoin, url_to_path, urljoin, velocityFromMs, velocityToMs };
782
- export type { ApiRow, AppConfig, CanonDist, CanonTime, ChangePasswordFormProps, ChangePasswordProps, ConvertDistance, ConvertSpeed, ConvertTime, Day, DistanceUnit, FetchVariables, FileItem, FileListResponse, Foot, Hour, InputProps, JwtPayload, Kilometer, LoginFormProps, LoginProps, LogoutButtonProps, MediaCategory, MediaMap, MediaOptions, Meter, Mile, MimeByExt, Minute, OutDist, OutDistance, OutSpeed, OutSpeedType, OutSpeeds, OutTime, OutTimeType, OutTimes, Promise$1 as Promise, Second, StartVelIn, TargetAltIn, TargetVelIn, TimeUnit, UnitConverter, UrlKey, VelocityUnit };
765
+ export type { ApiRow, AppConfig, CanonDist, CanonTime, ConvertDistance, ConvertSpeed, ConvertTime, Day, DistanceUnit, FetchVariables, FileItem, FileListResponse, Foot, Hour, InputProps, JwtPayload, Kilometer, LoginFormProps, LoginProps, LogoutButtonProps, MediaCategory, MediaMap, MediaOptions, Meter, Mile, MimeByExt, Minute, OutDist, OutDistance, OutSpeed, OutSpeedType, OutSpeeds, OutTime, OutTimeType, OutTimes, Promise$1 as Promise, Second, StartVelIn, TargetAltIn, TargetVelIn, TimeUnit, UnitConverter, UrlKey, VelocityUnit };
@@ -1 +1 @@
1
- export * from './';
1
+ export * from './src';
@@ -0,0 +1,2 @@
1
+ import 'server-only';
2
+ export * from './src';
@@ -0,0 +1,2 @@
1
+ import 'server-only';
2
+ export * from './mime_utils';
@@ -0,0 +1,172 @@
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
+ /** Alias to mirror the Python **kwargs['media_types'] behavior */
7
+ media_types?: Iterable<string> | string[] | null;
8
+ }
9
+ /** ---- Data: large but explicit, mirrors your Python mapping ---- */
10
+ export declare const MIME_TYPES: {
11
+ readonly image: {
12
+ readonly ".jpg": "image/jpeg";
13
+ readonly ".jpeg": "image/jpeg";
14
+ readonly ".png": "image/png";
15
+ readonly ".gif": "image/gif";
16
+ readonly ".bmp": "image/bmp";
17
+ readonly ".tiff": "image/tiff";
18
+ readonly ".webp": "image/webp";
19
+ readonly ".svg": "image/svg+xml";
20
+ readonly ".ico": "image/vnd.microsoft.icon";
21
+ readonly ".heic": "image/heic";
22
+ readonly ".psd": "image/vnd.adobe.photoshop";
23
+ readonly ".raw": "image/x-raw";
24
+ };
25
+ readonly video: {
26
+ readonly ".mp4": "video/mp4";
27
+ readonly ".webm": "video/webm";
28
+ readonly ".ogg": "video/ogg";
29
+ readonly ".mov": "video/quicktime";
30
+ readonly ".avi": "video/x-msvideo";
31
+ readonly ".mkv": "video/x-matroska";
32
+ readonly ".flv": "video/x-flv";
33
+ readonly ".wmv": "video/x-ms-wmv";
34
+ readonly ".3gp": "video/3gpp";
35
+ readonly ".ts": "video/mp2t";
36
+ readonly ".mpeg": "video/mpeg";
37
+ readonly ".mpg": "video/mpg";
38
+ };
39
+ readonly audio: {
40
+ readonly ".mp3": "audio/mpeg";
41
+ readonly ".wav": "audio/wav";
42
+ readonly ".flac": "audio/flac";
43
+ readonly ".aac": "audio/aac";
44
+ readonly ".ogg": "audio/ogg";
45
+ readonly ".m4a": "audio/mp4";
46
+ readonly ".opus": "audio/opus";
47
+ };
48
+ readonly document: {
49
+ readonly ".pdf": "application/pdf";
50
+ readonly ".doc": "application/msword";
51
+ readonly ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
52
+ readonly ".odt": "application/vnd.oasis.opendocument.text";
53
+ readonly ".txt": "text/plain";
54
+ readonly ".rtf": "application/rtf";
55
+ readonly ".md": "text/markdown";
56
+ readonly ".markdown": "text/markdown";
57
+ readonly ".tex": "application/x-tex";
58
+ readonly ".log": "text/plain";
59
+ readonly ".json": "application/json";
60
+ readonly ".xml": "application/xml";
61
+ readonly ".yaml": "application/x-yaml";
62
+ readonly ".yml": "application/x-yaml";
63
+ readonly ".ini": "text/plain";
64
+ readonly ".cfg": "text/plain";
65
+ readonly ".toml": "application/toml";
66
+ readonly ".csv": "text/csv";
67
+ readonly ".tsv": "text/tab-separated-values";
68
+ };
69
+ readonly presentation: {
70
+ readonly ".ppt": "application/vnd.ms-powerpoint";
71
+ readonly ".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation";
72
+ readonly ".odp": "application/vnd.oasis.opendocument.presentation";
73
+ };
74
+ readonly spreadsheet: {
75
+ readonly ".xls": "application/vnd.ms-excel";
76
+ readonly ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
77
+ readonly ".ods": "application/vnd.oasis.opendocument.spreadsheet";
78
+ readonly ".csv": "text/csv";
79
+ readonly ".tsv": "text/tab-separated-values";
80
+ };
81
+ readonly code: {
82
+ readonly ".py": "text/x-python";
83
+ readonly ".java": "text/x-java-source";
84
+ readonly ".c": "text/x-c";
85
+ readonly ".cpp": "text/x-c++";
86
+ readonly ".h": "text/x-c";
87
+ readonly ".hpp": "text/x-c++";
88
+ readonly ".js": "application/javascript";
89
+ readonly ".cjs": "application/javascript";
90
+ readonly ".mjs": "application/javascript";
91
+ readonly ".jsx": "application/javascript";
92
+ readonly ".ts": "application/typescript";
93
+ readonly ".tsx": "application/typescript";
94
+ readonly ".rb": "text/x-ruby";
95
+ readonly ".php": "application/x-php";
96
+ readonly ".go": "text/x-go";
97
+ readonly ".rs": "text/rust";
98
+ readonly ".swift": "text/x-swift";
99
+ readonly ".kt": "text/x-kotlin";
100
+ readonly ".sh": "application/x-shellscript";
101
+ readonly ".bash": "application/x-shellscript";
102
+ readonly ".ps1": "application/x-powershell";
103
+ readonly ".sql": "application/sql";
104
+ readonly ".yml": "application/x-yaml";
105
+ readonly ".coffee": "text/coffeescript";
106
+ readonly ".lua": "text/x-lua";
107
+ };
108
+ readonly archive: {
109
+ readonly ".zip": "application/zip";
110
+ readonly ".tar": "application/x-tar";
111
+ readonly ".gz": "application/gzip";
112
+ readonly ".tgz": "application/gzip";
113
+ readonly ".bz2": "application/x-bzip2";
114
+ readonly ".xz": "application/x-xz";
115
+ readonly ".rar": "application/vnd.rar";
116
+ readonly ".7z": "application/x-7z-compressed";
117
+ readonly ".iso": "application/x-iso9660-image";
118
+ readonly ".dmg": "application/x-apple-diskimage";
119
+ readonly ".jar": "application/java-archive";
120
+ readonly ".war": "application/java-archive";
121
+ readonly ".whl": "application/python-wheel";
122
+ readonly ".egg": "application/python-egg";
123
+ };
124
+ readonly font: {
125
+ readonly ".ttf": "font/ttf";
126
+ readonly ".otf": "font/otf";
127
+ readonly ".woff": "font/woff";
128
+ readonly ".woff2": "font/woff2";
129
+ readonly ".eot": "application/vnd.ms-fontobject";
130
+ };
131
+ readonly executable: {
132
+ readonly ".exe": "application/vnd.microsoft.portable-executable";
133
+ readonly ".dll": "application/vnd.microsoft.portable-executable";
134
+ readonly ".bin": "application/octet-stream";
135
+ readonly ".deb": "application/vnd.debian.binary-package";
136
+ readonly ".rpm": "application/x-rpm";
137
+ };
138
+ };
139
+ /** Mirror of MEDIA_TYPES in Python: category -> Set of extensions */
140
+ 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
+ */
146
+ 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
+ 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
+ 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
+ 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
+ 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;
168
+ export declare const get_media_map: typeof getMediaMap;
169
+ export declare const get_media_exts: typeof getMediaExts;
170
+ export declare const confirm_type: typeof confirmType;
171
+ export declare const is_media_type: typeof isMediaType;
172
+ export declare const get_mime_type: typeof getMimeType;
@@ -1,5 +1,4 @@
1
1
  export * from './Files';
2
- export * from './ChangePassword';
3
2
  export * from './utils';
4
3
  export * from './logout';
5
4
  export * from './login';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putkoff/abstract-utilities",
3
- "version": "1.0.63",
3
+ "version": "1.0.66",
4
4
  "type": "module",
5
5
  "description": "A reusable React Login component with JWT authentication",
6
6
  "main": "dist/cjs/index.js",
@@ -38,6 +38,7 @@
38
38
  "@testing-library/react": "^14.2.1",
39
39
  "@types/jest": "^29.5.12",
40
40
  "@types/node": "^24.0.13",
41
+ "@types/path-browserify": "^1.0.3",
41
42
  "@types/react": "^18.3.23",
42
43
  "@types/react-dom": "^18.3.7",
43
44
  "jest": "^29.7.0",
@@ -98,6 +99,16 @@
98
99
  "import": "./dist/esm/client/*/index.js",
99
100
  "require": "./dist/cjs/client/*/index.js"
100
101
  },
102
+ "./server": {
103
+ "types": "./dist/types/server/index.d.ts",
104
+ "import": "./dist/esm/server/index.js",
105
+ "require": "./dist/cjs/server/index.js"
106
+ },
107
+ "./server/*": {
108
+ "types": "./dist/types/server/*/index.d.ts",
109
+ "import": "./dist/esm/server/*/index.js",
110
+ "require": "./dist/cjs/server/*/index.js"
111
+ },
101
112
  "./package.json": "./package.json"
102
113
  },
103
114
  "files": [