web_lib

Common web application libraries
git clone https://radroots.dev/git/web_lib.git
Log | Files | Refs | LICENSE

commit d6497e698168b47e9a6b43fe323369740b23b4e9
parent 38764a9933b13865dfd9d8ab4b362ac509b26052
Author: triesap <triesap@radroots.dev>
Date:   Thu, 20 Nov 2025 13:48:05 +0000

utils: add http body normalization helper, extend shared types for nullable strings and storage configuration, and refine regex utilities

Diffstat:
Mutils/src/http.ts | 3+--
Mutils/src/types.ts | 9+++++++--
Mutils/src/validation/regex.ts | 2--
3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/utils/src/http.ts b/utils/src/http.ts @@ -65,7 +65,7 @@ export type IHttpOpts = { connect_timeout?: number; }; -export const lib_http_to_bodyinit = (data: any): any => { // @todo BodyInit +export const lib_http_to_bodyinit = (data: any): RequestInit["body"] => { if (typeof data === 'string') return data; else if (data instanceof FormData) return data; else if (data instanceof Blob) return data; @@ -138,4 +138,3 @@ export const http_fetch = async (opts: IHttpOpts): Promise<IHttpResponse> => { headers: lib_http_parse_headers(response.headers) }; }; - diff --git a/utils/src/types.ts b/utils/src/types.ts @@ -12,4 +12,9 @@ export type FileBytesFormat = `kb` | `mb` | `gb`; export type FileMimeType = string; export type FilePath = { file_path: string; file_name: string; mime_type: FileMimeType; } -export type ValStr = string | undefined | null -\ No newline at end of file +export type ValStr = string | undefined | null; + +export type IdbClientConfig = { + database: string; + store: string; +}; +\ No newline at end of file diff --git a/utils/src/validation/regex.ts b/utils/src/validation/regex.ts @@ -39,9 +39,7 @@ export const util_rxp = { quantity_unit: /^(kg|lb|g)$/, quantity_unit_ch: /[A-Za-z]$/, url_image_upload: /^file:\/\/.*\.(png|jpg|jpeg|gif|webp|bmp|svg)$/, - ///^blob:https:\/\/domain\.tld\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/, url_image_upload_dev: /^file:\/\/.*\.(png|jpg|jpeg|gif|webp|bmp|svg)$/, - // /^blob:http:\/\/localhost:\d+\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/, country_code_a2: /^[A-Za-z]{2}$/, addr_primary: /[a-zA-Z0-9., ]$/, addr_admin: /[a-zA-Z0-9., ]$/,